]> git.p6c8.net - jirafeau_project.git/blobdiff - script.php
removed local upload folders localization from this branch
[jirafeau_project.git] / script.php
index be29f3d015dcbdf65ab50bbbbd6114ff3b0de0ca..95888b5f7a0e80d266844bc049ae9edfcd642dc1 100644 (file)
@@ -44,7 +44,7 @@ if ($_SERVER['REQUEST_METHOD'] == "GET" && count($_GET) == 0) {
     <div class="info">
     <h2>Scripting interface</h2>
     <p>This interface permits to script your uploads and downloads.</p>
     <div class="info">
     <h2>Scripting interface</h2>
     <p>This interface permits to script your uploads and downloads.</p>
-    <p>See <a href="https://gitlab.com/jirafeau/Jirafeau/blob/master/script.php">source code</a> of this interface to get available calls :)</p>
+    <p>See <a href="<?php echo JIRAFEAU_WEBSITE ?>/blob/master/script.php">source code</a> of this interface to get available calls :)</p>
     <p>You may download a preconfigured <a href="script.php?lang=bash">Bash Script</a> to easily send to and get files from the API via command line.</p>
     </div>
     <br />
     <p>You may download a preconfigured <a href="script.php?lang=bash">Bash Script</a> to easily send to and get files from the API via command line.</p>
     </div>
     <br />
@@ -92,40 +92,11 @@ if (isset($_FILES['file']) && is_writable(VAR_FILES)
         exit;
     }
 
         exit;
     }
 
-    $time = time();
     if (!isset($_POST['time']) || !$cfg['availabilities'][$_POST['time']]) {
         echo 'Error 4: The parameter time is invalid.';
         exit;
     } else {
     if (!isset($_POST['time']) || !$cfg['availabilities'][$_POST['time']]) {
         echo 'Error 4: The parameter time is invalid.';
         exit;
     } else {
-        switch ($_POST['time']) {
-            case 'minute':
-                $time += JIRAFEAU_MINUTE;
-                break;
-            case 'hour':
-                $time += JIRAFEAU_HOUR;
-                break;
-            case 'day':
-                $time += JIRAFEAU_DAY;
-                break;
-            case 'week':
-                $time += JIRAFEAU_WEEK;
-                break;
-            case 'fortnight':
-                $time += JIRAFEAU_FORTNIGHT;
-                break;
-            case 'month':
-                $time += JIRAFEAU_MONTH;
-                break;
-            case 'quarter':
-                $time += JIRAFEAU_QUARTER;
-                break;
-            case 'year':
-                $time += JIRAFEAU_YEAR;
-                break;
-            default:
-                $time = JIRAFEAU_INFINITY;
-                break;
-        }
+        $time = jirafeau_datestr_to_int($_POST['time']);
     }
 
     // Check file size
     }
 
     // Check file size
@@ -468,40 +439,11 @@ elseif (isset($_GET['init_async'])) {
         exit;
     }
 
         exit;
     }
 
-    $time = time();
     if (!isset($_POST['time']) || !$cfg['availabilities'][$_POST['time']]) {
         echo 'Error 22';
         exit;
     } else {
     if (!isset($_POST['time']) || !$cfg['availabilities'][$_POST['time']]) {
         echo 'Error 22';
         exit;
     } else {
-        switch ($_POST['time']) {
-            case 'minute':
-                $time += JIRAFEAU_MINUTE;
-                break;
-            case 'hour':
-                $time += JIRAFEAU_HOUR;
-                break;
-            case 'day':
-                $time += JIRAFEAU_DAY;
-                break;
-            case 'week':
-                $time += JIRAFEAU_WEEK;
-                break;
-            case 'fortnight':
-                $time += JIRAFEAU_FORTNIGHT;
-                break;
-            case 'month':
-                $time += JIRAFEAU_MONTH;
-                break;
-            case 'quarter':
-                $time += JIRAFEAU_QUARTER;
-                break;
-            case 'year':
-                $time += JIRAFEAU_YEAR;
-                break;
-            default:
-                $time = JIRAFEAU_INFINITY;
-                break;
-        }
+        $time = jirafeau_datestr_to_int($_POST['time']);
     }
 
     if ($cfg['store_uploader_ip']) {
     }
 
     if ($cfg['store_uploader_ip']) {

patrick-canterino.de