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 | |
| 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')
| -rw-r--r-- | www/functions/func_interface.php | 4 | ||||
| -rw-r--r-- | www/functions/func_select.php | 15 |
2 files changed, 15 insertions, 4 deletions
diff --git a/www/functions/func_interface.php b/www/functions/func_interface.php index b7fbb5f..b543054 100644 --- a/www/functions/func_interface.php +++ b/www/functions/func_interface.php @@ -11,8 +11,8 @@ function show($db){ $content = get_content($db, $parentdir, $owner); - if(!content){ - failure("There is no data."); + if(!$content){ + failure("This folder is empty."); } var_dump($content); 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]){ |
