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 | |
| parent | 2f0f4ca056f92ffd2bbf80e7b7c49b489d6e7ed4 (diff) | |
| download | files.iamfabulous.de-efd3bb601ac3d1937bddb4f2a5b945911ccc5326.tar.gz | |
Some stuff werks. 'Showing the content' should now do the job.
| -rw-r--r-- | blob/nginx_rewrite_rules | 10 | ||||
| -rw-r--r-- | www/functions/func_interface.php | 4 | ||||
| -rw-r--r-- | www/functions/func_select.php | 15 |
3 files changed, 20 insertions, 9 deletions
diff --git a/blob/nginx_rewrite_rules b/blob/nginx_rewrite_rules index f54ba65..226905c 100644 --- a/blob/nginx_rewrite_rules +++ b/blob/nginx_rewrite_rules @@ -12,21 +12,21 @@ location ~* ^/?login/?([a-z0-9]+=[a-z0-9]+(&[a-z0-9]+=[a-z0-9]+)?)?$ { rewrite ^/?login([?/]?.*) /index.php?task=login&arguments=$1 last; } -location ~* ^/?logout(/?\?[0-9a-zA-Z]+(=[0-9a-zA-Z]*)?)?$ { +location ~* ^/?logout/?(\?[0-9a-zA-Z]+(=[0-9a-zA-Z]*)?)?$ { rewrite ^/?logout([?/]?.*) /index.php?task=logout&arguments=$1 last; } -location ~* ^/?register(\?[0-9a-zA-Z]+(=[0-9a-zA-Z]*)?)?$ { +location ~* ^/?register/?(\?[0-9a-zA-Z]+(=[0-9a-zA-Z]*)?)?$ { rewrite ^/?register(\?[0-9a-zA-Z]*(=[0-9a-zA-Z]*)?)? /index.php?task=register&arguments=$1 last; } -location ~* ^/?invite(\?[0-9a-zA-Z]+(=[0-9a-zA-Z]*)?)?$ { +location ~* ^/?invite/?(\?[0-9a-zA-Z]+(=[0-9a-zA-Z]*)?)?$ { rewrite ^/?invite(\?[0-9a-zA-Z]*(=[0-9a-zA-Z]*)?)? /index.php?task=invite&arguments=$1 last; } -location ~* ^/?user(\?[0-9a-zA-Z]+(=[0-9a-zA-Z]*)?)?$ { +location ~* ^/?user/?(\?[0-9a-zA-Z]+(=[0-9a-zA-Z]*)?)?$ { rewrite ^/?user(\?[0-9a-zA-Z]*(=[0-9a-zA-Z]*)?)? /index.php?task=user&arguments=$1 last; } @@ -34,7 +34,7 @@ location ~* ^/?user(\?[0-9a-zA-Z]+(=[0-9a-zA-Z]*)?)?$ { location / { rewrite ^/([0-9a-zA-Z-_]+)/(.*) /index.php?name=$1&folder=$2 last; - rewrite ^/([0-9a-zA-Z-_]+)$ /index.php?name=$1 last; + rewrite ^/([0-9a-zA-Z-_]+)$ /index.php?name=$1&folder=/ last; rewrite ^/$ /index.php last; break; } 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]){ |
