diff options
| author | root | 2014-03-21 19:25:02 +0100 |
|---|---|---|
| committer | root | 2014-03-21 19:25:02 +0100 |
| commit | 296d8a14511739a15327ffe30c0895cd3490e940 (patch) | |
| tree | 2bd7d23df26374b99b3235366e267ed734eef2bf /www/functions/func_select.php | |
| parent | 4611b609e81cce6ba1269707ff7f483d285bcec3 (diff) | |
| download | files.iamfabulous.de-296d8a14511739a15327ffe30c0895cd3490e940.tar.gz | |
Doesn't show private files anymore and trying to write a empty_folder function.
Diffstat (limited to 'www/functions/func_select.php')
| -rwxr-xr-x | www/functions/func_select.php | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/www/functions/func_select.php b/www/functions/func_select.php index af7b239..53f1fa6 100755 --- a/www/functions/func_select.php +++ b/www/functions/func_select.php @@ -8,7 +8,6 @@ function select_file_id($db, $owner, $folder_path){ } $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 folder='DIRECTORY' " . $share . ";"); $root_ar = $root_db->fetchArray(SQLITE3_NUM); @@ -16,24 +15,33 @@ function select_file_id($db, $owner, $folder_path){ if(empty($root_ar[0])){ failure("Seems like the user doesn't want to show his tree: " . $root_id); } + + $tmp_length = count($folder_array_unsafe); + + if(empty($folder_array_unsafe[$tmp_length-1])){ + $length = $tmp_length-1; + } else { + $length = $tmp_length; + } + $parentdir = SQLite3::escapeString($root_id); if(empty($folder_array_unsafe[0])){ return $root_id; // returns the primary key from the root dir } + //echo "Länge: ".$length." ".var_dump($folder_array_unsafe); exit; + 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]) . "';"); $prim_id = $parentdir_db->fetchArray(SQLITE3_NUM); - if(empty($prim_id[0])){ - return $parentdir; //TODO; Return false because file not found - } if($parentdir != $prim_id[1]){ +/* $wrong_folder = $folder_array_unsafe[$i]; $working_path[0] = $wrong_folder; @@ -42,12 +50,15 @@ function select_file_id($db, $owner, $folder_path){ } get_404($working_path, $wrong_folder); +*/ return false; } $parentdir = $prim_id[0]; + var_dump($parentdir); echo "func_select, during for"; } + //var_dump($parentdir); echo "func_select, after for"; exit; return $parentdir; // returns the primary key from the last entry in the folder array } |
