]> git.p6c8.net - jirafeau_mojo42.git/blobdiff - script.php
[BUGFIX] Disallow file preview for image/svg+xml files
[jirafeau_mojo42.git] / script.php
index cd7cec60ad7ec74a5389b79816ce213cd1ac10ff..d31ce78ec7d708010b6fb952cc81b48e452f7bf4 100644 (file)
@@ -32,8 +32,6 @@ require(JIRAFEAU_ROOT . 'lib/lang.php');
  * Be sure PHP's safe mode is off.
  */
 @set_time_limit(0);
  * Be sure PHP's safe mode is off.
  */
 @set_time_limit(0);
-/* Remove errors. */
-@error_reporting(0);
 
 if ($_SERVER['REQUEST_METHOD'] == "GET" && count($_GET) == 0) {
     require(JIRAFEAU_ROOT . 'lib/template/header.php');
 
 if ($_SERVER['REQUEST_METHOD'] == "GET" && count($_GET) == 0) {
     require(JIRAFEAU_ROOT . 'lib/template/header.php');
@@ -67,7 +65,7 @@ if (has_error()) {
 /* Upload file */
 if (isset($_FILES['file']) && is_writable(VAR_FILES)
     && is_writable(VAR_LINKS)) {
 /* Upload file */
 if (isset($_FILES['file']) && is_writable(VAR_FILES)
     && is_writable(VAR_LINKS)) {
-    if (isset ($_POST['upload_password'])) {
+    if (isset($_POST['upload_password'])) {
         if (!jirafeau_challenge_upload($cfg, get_ip_address($cfg), $_POST['upload_password'])) {
             echo 'Error 3: Invalid password';
             exit;
         if (!jirafeau_challenge_upload($cfg, get_ip_address($cfg), $_POST['upload_password'])) {
             echo 'Error 3: Invalid password';
             exit;
@@ -129,11 +127,22 @@ if (isset($_FILES['file']) && is_writable(VAR_FILES)
         exit;
     }
 
         exit;
     }
 
-    $res = jirafeau_upload($_FILES['file'],
-                           isset($_POST['one_time_download']),
-                           $key, $time, get_ip_address($cfg),
-                           $cfg['enable_crypt'], $cfg['link_name_length'],
-                           $cfg['file_hash']);
+    if ($cfg['store_uploader_ip']) {
+        $ip = get_ip_address($cfg);
+    } else {
+        $ip = "";
+    }
+    
+    $res = jirafeau_upload(
+        $_FILES['file'],
+        isset($_POST['one_time_download']),
+        $key,
+        $time,
+        $ip,
+        $cfg['enable_crypt'],
+        $cfg['link_name_length'],
+        $cfg['file_hash']
+    );
 
     if (empty($res) || $res['error']['has_error']) {
         echo 'Error 6 ' . $res['error']['why'];
 
     if (empty($res) || $res['error']['has_error']) {
         echo 'Error 6 ' . $res['error']['why'];
@@ -374,7 +383,7 @@ if [ "$1" == "send" ]; then
         echo "    ${0} get ${url}${apipage}?h=$code [PASSWORD}"
     fi
     echo "Delete via API:"
         echo "    ${0} get ${url}${apipage}?h=$code [PASSWORD}"
     fi
     echo "Delete via API:"
-    echo "    ${0} delete ${url}${downloadpage}?h=$code&d=$del_code"
+    echo "    ${0} delete \"${url}${downloadpage}?h=$code&d=$del_code\""
 
 elif [ "$1" == "get" ]; then
     if [ -z "$password" ]; then
 
 elif [ "$1" == "get" ]; then
     if [ -z "$password" ]; then
@@ -383,10 +392,9 @@ elif [ "$1" == "get" ]; then
         $curl $proxy -OJ -X POST -F key=$password "$2"
     fi
 elif [ "$1" == "delete" ]; then
         $curl $proxy -OJ -X POST -F key=$password "$2"
     fi
 elif [ "$1" == "delete" ]; then
-    $curl $proxy "$2"
+    $curl $proxy "$2" --data-raw "do_delete=1%2F" | grep "div class" |sed -e "s/<[^>]\+>//g"
 fi
 <?php
 fi
 <?php
-
     } else {
         echo 'Error 12';
         exit;
     } else {
         echo 'Error 12';
         exit;
@@ -394,7 +402,7 @@ fi
 }
 /* Initialize an asynchronous upload. */
 elseif (isset($_GET['init_async'])) {
 }
 /* Initialize an asynchronous upload. */
 elseif (isset($_GET['init_async'])) {
-    if (isset($_POST['upload_password'])){
+    if (isset($_POST['upload_password'])) {
         if (!jirafeau_challenge_upload($cfg, get_ip_address($cfg), $_POST['upload_password'])) {
             echo 'Error 20: Invalid password';
             exit;
         if (!jirafeau_challenge_upload($cfg, get_ip_address($cfg), $_POST['upload_password'])) {
             echo 'Error 20: Invalid password';
             exit;
@@ -459,12 +467,21 @@ elseif (isset($_GET['init_async'])) {
                 break;
         }
     }
                 break;
         }
     }
-    echo jirafeau_async_init($_POST['filename'],
-                              $type,
-                              isset($_POST['one_time_download']),
-                              $key,
-                              $time,
-                              get_ip_address($cfg));
+
+    if ($cfg['store_uploader_ip']) {
+        $ip = get_ip_address($cfg);
+    } else {
+        $ip = "";
+    }
+    
+    echo jirafeau_async_init(
+        $_POST['filename'],
+        $type,
+        isset($_POST['one_time_download']),
+        $key,
+        $time,
+        $ip
+    );
 }
 /* Continue an asynchronous upload. */
 elseif (isset($_GET['push_async'])) {
 }
 /* Continue an asynchronous upload. */
 elseif (isset($_GET['push_async'])) {
@@ -473,10 +490,12 @@ elseif (isset($_GET['push_async'])) {
         || (!isset($_POST['code']))) {
         echo 'Error 23';
     } else {
         || (!isset($_POST['code']))) {
         echo 'Error 23';
     } else {
-        echo jirafeau_async_push($_POST['ref'],
-                                  $_FILES['data'],
-                                  $_POST['code'],
-                                  $cfg['maximal_upload_size']);
+        echo jirafeau_async_push(
+            $_POST['ref'],
+            $_FILES['data'],
+            $_POST['code'],
+            $cfg['maximal_upload_size']
+        );
     }
 }
 /* Finalize an asynchronous upload. */
     }
 }
 /* Finalize an asynchronous upload. */

patrick-canterino.de