From 25e3531d85e2aa8c68945fbc6c71a998a842e759 Mon Sep 17 00:00:00 2001 From: Horus3 Date: Mon, 17 Mar 2014 16:33:46 +0100 Subject: Fixed logical error and made the code smoother. --- www/functions/func_select.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/www/functions/func_select.php b/www/functions/func_select.php index e23c3cf..5181b9a 100755 --- a/www/functions/func_select.php +++ b/www/functions/func_select.php @@ -17,20 +17,15 @@ function select_file_id($db, $owner){ failure("Seems like the user doesn't want to show his tree: " . $root_id); } $parentdir = SQLite3::escapeString($root_id); - $temp_id = $root_id; - if(empty($folder_array_unsafe)){ - return $root_id; + if(empty($folder_array_unsafe[0])){ + return $root_id; // returns the primary key from the root dir } 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; // TODO: Is there a way this can happen? - } - $prim_id = $parentdir_db->fetchArray(SQLITE3_NUM); if(empty($prim_id)){ failure("Database error."); -- cgit v1.2.3