summaryrefslogtreecommitdiff
path: root/www/functions/func_content.php
diff options
context:
space:
mode:
Diffstat (limited to 'www/functions/func_content.php')
-rwxr-xr-xwww/functions/func_content.php24
1 files changed, 18 insertions, 6 deletions
diff --git a/www/functions/func_content.php b/www/functions/func_content.php
index e24ea34..8431c15 100755
--- a/www/functions/func_content.php
+++ b/www/functions/func_content.php
@@ -11,6 +11,8 @@ function collect_content($db,$username, $folder_path){
if(!$file_id){
print_empty_folder($db, $username, $folder_path);
+ echo "Empty folder";
+ exit;
}
$content = get_content($db, $file_id, $owner);
@@ -20,7 +22,13 @@ function collect_content($db,$username, $folder_path){
function get_content($db, $file_id, $owner){
- $content_db = $db->query("SELECT * FROM files WHERE parent=" . $file_id . " AND owner=" . $owner . ";");
+ if($_SESSION["login"] && $_SESSION["userid"] == $owner){
+ $share="";
+ } else {
+ $share =" AND share='PUBLIC'";
+ }
+
+ $content_db = $db->query("SELECT * FROM files WHERE parent=" . $file_id . " AND owner=" . $owner . $share . ";");
$count=0;
@@ -46,27 +54,31 @@ function get_content($db, $file_id, $owner){
function get_path_to_empty_folder($db, $username, $folder_path){
+ $owner = user_id($db, $username);
+
if($_SESSION["login"] && $_SESSION["userid"] == $owner){
- if($_SESSION["login"] && $_SESSION["userid"] == $owner){}
+ $share = "";
} else {
- $share ="AND share='PUBLIC'";
+ $share =" AND share='PUBLIC'";
}
$folder_array_unsafe = explode("/",$folder_path);
$length = count($folder_array_unsafe);
- $root_db = $db->query("SELECT id FROM files WHERE parent=0 AND owner=" . SQLite3::escapeString($owner) . " AND fo lder='DIRECTORY' " . $share . ";");
+ //echo "SELECT id FROM files WHERE parent=0 AND owner=" . SQLite3::escapeString($owner) . " AND folder='DIRECTORY' " . $share . ";"; exit;
+
+ $root_db = $db->query("SELECT id FROM files WHERE parent=0 AND owner=" . SQLite3::escapeString($owner) . " AND folder='DIRECTORY' " . $share . ";");
$root_ar = $root_db->fetchArray(SQLITE3_NUM);
$root_id = $root_ar[0];
if(empty($root_id[0])){
- return NOT_PUBLIC;
+ return FOLDER_NOT_PUBLIC;
}
$parentdir = $root_id;
for($i=0; $i<$length; $i++){
- $parentdir_db = $db->query("SELECT id, parent FROM files WHERE owner=" . $owner . $share . " AND parent=" . $parentdir . " AND name='" . SQLite3::escapeString($folder_array_unsafe[$i]) . "';");
+ $parentdir_db = $db->query("SELECT id, parent FROM files WHERE owner=" . $owner . $share . " AND parent=". $parentdir . " AND name='" . SQLite3::escapeString($folder_array_unsafe[$i]) . "';");
$prim_id = $parentdir_db->fetchArray(SQLITE3_NUM);
if($parentdir != $prim_id[1]){