From efd3bb601ac3d1937bddb4f2a5b945911ccc5326 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 12 Mar 2014 23:04:28 +0100 Subject: Some stuff werks. 'Showing the content' should now do the job. --- www/functions/func_select.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'www/functions/func_select.php') 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]){ -- cgit v1.2.3