diff options
| author | root | 2014-03-12 23:04:28 +0100 |
|---|---|---|
| committer | root | 2014-03-12 23:04:28 +0100 |
| commit | efd3bb601ac3d1937bddb4f2a5b945911ccc5326 (patch) | |
| tree | 1dc5e5304994b99a2796771054dc7af7df7f296e /www/functions/func_select.php | |
| parent | 2f0f4ca056f92ffd2bbf80e7b7c49b489d6e7ed4 (diff) | |
| download | files.iamfabulous.de-efd3bb601ac3d1937bddb4f2a5b945911ccc5326.tar.gz | |
Some stuff werks. 'Showing the content' should now do the job.
Diffstat (limited to 'www/functions/func_select.php')
| -rw-r--r-- | www/functions/func_select.php | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/www/functions/func_select.php b/www/functions/func_select.php index 0659cdb..46afd46 100644 --- a/www/functions/func_select.php +++ b/www/functions/func_select.php @@ -7,6 +7,11 @@ function select($db, $owner){ $share ="AND share='PUBLIC'"; } + if(empty($_GET["folder"])){ + $_GET["folder"] = "/"; + } + + $folder_array_unsafe = explode("/",$_GET["folder"]); $length = count($folder_array_unsafe); @@ -19,16 +24,22 @@ function select($db, $owner){ $parentdir = SQLite3::escapeString($root_id); $temp_id = $root_id; - if(empty($folder_array_unsafe[$i])){ - + if(empty($folder_array_unsafe)){ + return $root_id; } + for($i=0; $i<$length; $i++){ $parentdir_db = $db->query("SELECT id, parent FROM files WHERE owner=" . $owner . " AND folder='DIRECTORY' " . $share . " AND parent=" . $parentdir . " AND name='" . SQLite3::escapeString($folder_array_unsafe[$i]) . "';"); + if(empty($folder_array_unsafe[$i])){ + return $parentdir; + } + $prim_id = $parentdir_db->fetchArray(SQLITE3_NUM); if(empty($prim_id)){ failure("Database error."); + echo $prim_id; } if($parentdir != $prim_id[1]){ |
