diff options
| author | Horus3 | 2014-03-17 16:33:46 +0100 |
|---|---|---|
| committer | Horus3 | 2014-03-17 16:33:46 +0100 |
| commit | 25e3531d85e2aa8c68945fbc6c71a998a842e759 (patch) | |
| tree | 367aecfaed1bf182aa0b1f4f00a3293abc19a461 /www/functions | |
| parent | aba2b5d61d707aafe8d64ccdb406c4f20b9682d6 (diff) | |
| download | files.iamfabulous.de-25e3531d85e2aa8c68945fbc6c71a998a842e759.tar.gz | |
Fixed logical error and made the code smoother.
Diffstat (limited to 'www/functions')
| -rwxr-xr-x | www/functions/func_select.php | 9 |
1 files 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."); |
