summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHorus32014-03-27 00:23:09 +0100
committerHorus32014-03-27 00:23:09 +0100
commit09b1bac5a4543cdacc67be1752d9593d58a3eee0 (patch)
tree19458c42cd699ea98d9b423618db633cb9e886f3
parent768f0f6a1ec5aaaa576fdc1bd283973a8a5ffc89 (diff)
parent43933b5939b329a4ab333b093a370dabe995e0ad (diff)
downloadfiles.iamfabulous.de-09b1bac5a4543cdacc67be1752d9593d58a3eee0.tar.gz
Merge branch 'master' of git.iamfabulous.de:files.iamfabulous.de
-rwxr-xr-xblob/nginx_rewrite_rules23
-rwxr-xr-xwww/functions/func_rewrite.php2
-rwxr-xr-xwww/functions/func_upload.php7
-rwxr-xr-xwww/index.php16
4 files changed, 23 insertions, 25 deletions
diff --git a/blob/nginx_rewrite_rules b/blob/nginx_rewrite_rules
index 34a4f20..eb6b0a2 100755
--- a/blob/nginx_rewrite_rules
+++ b/blob/nginx_rewrite_rules
@@ -8,35 +8,38 @@ location /static {}
#location ~* ^/.+[^/].+\.css {}
location ~* ^/?login/?([a-z0-9]+=[a-z0-9]+(&[a-z0-9]+=[a-z0-9]+)?)?$ {
- rewrite ^/?login([?/]?.*) /index.php?task=login&arguments=$1 last;
+ rewrite ^/?login([?/]?.*) /index.php?task=login&arguments=$1 last;
}
location ~* ^/?logout/?(\?[0-9a-zA-Z]+(=[0-9a-zA-Z]*)?)?$ {
- rewrite ^/?logout([?/]?.*) /index.php?task=logout&arguments=$1 last;
+ rewrite ^/?logout([?/]?.*) /index.php?task=logout&arguments=$1 last;
}
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;
+ 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]*)?)?$ {
- rewrite ^/?invite(\?[0-9a-zA-Z]*(=[0-9a-zA-Z]*)?)? /index.php?task=invite&arguments=$1 last;
+ 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]*)?)?$ {
- rewrite ^/?user(\?[0-9a-zA-Z]*(=[0-9a-zA-Z]*)?)? /index.php?task=user&arguments=$1 last;
+ rewrite ^/?user(\?[0-9a-zA-Z]*(=[0-9a-zA-Z]*)?)? /index.php?task=user&arguments=$1 last;
}
location ~* ^/?download/?(\?[0-9a-zA-Z]+(=[0-9a-zA-Z]*)?)?$ {
- rewrite ^/?download(\?[0-9a-zA-Z]*(=[0-9a-zA-Z]*)?)? /index.php?task=download&arguments=$1 last;
+ rewrite ^/?download(\?[0-9a-zA-Z]*(=[0-9a-zA-Z]*)?)? /index.php?task=download&arguments=$1 last;
}
-#location ~* \.php(\?[0-9a-zA-Z]+(=[0-9a-zA-Z]*)?)?$ {} #empty block to catch all
+location ~* ^/password_recover/?(\?[0-9a-zA-Z]+(=[0-9a-zA-Z]*)?)?$ {
+ rewrite ^/?password_recover(\?[0-9a-zA-Z]*(=[0-9a-zA-Z]*)?)? /index.php?task=password_recover&arguments=$1 last;
+}
+#location ~* \.php(\?[0-9a-zA-Z]+(=[0-9a-zA-Z]*)?)?$ {} #empty block to catch all
location / {
- rewrite ^/([0-9a-zA-Z-_]+)/(.*) /index.php?name=$1&folder=$2 last;
- rewrite ^/([0-9a-zA-Z-_]+)$ /index.php?name=$1&folder= last;
- rewrite ^/$ /index.php last;
+ rewrite ^/([0-9a-zA-Z-_]+)/(.*) /index.php?name=$1&folder=$2 last;
+ rewrite ^/([0-9a-zA-Z-_]+)$ /index.php?name=$1&folder= last;
+ rewrite ^/$ /index.php last;
break;
}
diff --git a/www/functions/func_rewrite.php b/www/functions/func_rewrite.php
index d9f694d..0a123d6 100755
--- a/www/functions/func_rewrite.php
+++ b/www/functions/func_rewrite.php
@@ -16,7 +16,9 @@ function rewrite($db){
}
if($_SESSION["login"]){
+ $scheme = $GLOBALS["scheme"];
header("Refresh: 0; ".$scheme.$_SERVER["HTTP_HOST"]."/" . $_SESSION['username'] . "/" . $_GET["name"] . "/" . $folder . "");
+ exit;
}
return false;
diff --git a/www/functions/func_upload.php b/www/functions/func_upload.php
index 674b4cd..89bfbc0 100755
--- a/www/functions/func_upload.php
+++ b/www/functions/func_upload.php
@@ -33,10 +33,7 @@ function upload($path){
return UPLOAD_FOLDER_NOT_OWNER;
}
- $ownername = SQLite3::escapeString($_SESSION['username']);
- $owner_db = $db->query("SELECT id FROM user WHERE name='" . $ownername . "';");
- $owner_ar = $owner_db->fetchArray(SQLITE3_NUM);
- $owner = $owner_ar[0];
+ $owner = $_SESSION["userid"];
$overall_size_db = $db->query("SELECT size FROM files WHERE owner=" . $owner . " AND size > 0;");
$overall_size = 0;
@@ -45,7 +42,7 @@ function upload($path){
$overall_size = $overall_size + $row[$count];
$count++;
}
-
+
if($overall_size > 2147483648){ // == 2GB
return UPLOAD_QUOTA;
}
diff --git a/www/index.php b/www/index.php
index 5866411..de33f64 100755
--- a/www/index.php
+++ b/www/index.php
@@ -23,11 +23,12 @@ if(empty($_GET)){
if(empty($_GET["name"])){
switch($_GET["task"]){
case("login"):
+ if($_SESSION["login"]){
+ header("Refresh: 0; ".$scheme.$_SERVER["HTTP_HOST"]."/".$_SESSION["username"]);
+ exit;
+ }
+
if($_SERVER['REQUEST_METHOD'] == 'POST'){
- if($_SESSION["login"]){
- header("Refresh: 0; ".$scheme.$_SERVER["HTTP_HOST"]."/".$_SESSION["username"]);
- exit;
- }
$var = login($db);
if($var == LOGIN_SUCCESSFULL){
header("Refresh: 0; ".$scheme.$_SERVER["HTTP_HOST"]."/".$_SESSION["username"]);
@@ -36,12 +37,7 @@ if(empty($_GET)){
print_login($var);
}
} else {
- if(!$_SESSION["login"]){
- print_login(constant("EMPTY"));
- } else {
- header("Refresh: 0; ".$scheme.$_SERVER["HTTP_HOST"]."/" . $_SESSION["username"]);
- exit;
- }
+ print_login(constant("EMPTY"));
}
break;