X-Git-Url: https://git.p6c8.net/jirafeau_project.git/blobdiff_plain/d35f5d4eb87c1a74fd198be589fcdf51e9631ba9..9c3b702ab8f82079ddaa9a12413802de946d8ecc:/script.php diff --git a/script.php b/script.php index 8ebcce3..c0cee68 100644 --- a/script.php +++ b/script.php @@ -1,7 +1,9 @@ * Copyright (C) 2015 Jerome Jutteau + * Copyright (C) 2024 Jirafeau project (see AUTHORS.md) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -92,40 +94,11 @@ if (isset($_FILES['file']) && is_writable(VAR_FILES) exit; } - $time = time(); 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 @@ -468,40 +441,11 @@ elseif (isset($_GET['init_async'])) { exit; } - $time = time(); 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']) {