From: Dan Untenzu Date: Fri, 13 Jan 2017 15:57:26 +0000 (+0100) Subject: [FEATURE] Add »quarter« expiration time X-Git-Tag: 1.2.0~7 X-Git-Url: https://git.p6c8.net/jirafeau.git/commitdiff_plain/28606cf6b85459d37b0b4e45a6114eced94fcf4c?ds=sidebyside [FEATURE] Add »quarter« expiration time Add »quarter« (3 x 1 Month = 90 days) as available expiration time. This option is disabled by default. Refs #87 --- diff --git a/lib/config.original.php b/lib/config.original.php index b07f0e2..537485e 100644 --- a/lib/config.original.php +++ b/lib/config.original.php @@ -78,13 +78,16 @@ $cfg['admin_http_auth_user'] = ''; * 'year': file available for one year * 'none': unlimited availability */ -$cfg['availabilities'] = array ('minute' => true, - 'hour' => true, - 'day' => true, - 'week' => true, - 'month' => true, - 'year' => false, - 'none' => false); +$cfg['availabilities'] = array ( + 'minute' => true, + 'hour' => true, + 'day' => true, + 'week' => true, + 'month' => true, + 'quarter' => false, + 'year' => false, + 'none' => false +); /* Set a default value for the expiration time. * The value has to equal one of the enabled options in »availabilities«, e.g. »month«) */ diff --git a/lib/functions.js.php b/lib/functions.js.php index fbce522..7a1c5af 100644 --- a/lib/functions.js.php +++ b/lib/functions.js.php @@ -232,6 +232,11 @@ function add_time_string_to_date(d, time) d.setSeconds (d.getSeconds() + 2419200); return true; } + if (time == 'quarter') + { + d.setSeconds (d.getSeconds() + 7257600); + return true; + } if (time == 'year') { d.setSeconds (d.getSeconds() + 29030400); diff --git a/lib/locales/template.json b/lib/locales/template.json index cf7aa81..0c780f7 100644 --- a/lib/locales/template.json +++ b/lib/locales/template.json @@ -14,6 +14,7 @@ "One day": "", "One week": "", "One month": "", + "One quarter": "", "One year": "", "None": "", "Upload password": "", diff --git a/lib/settings.php b/lib/settings.php index dc36996..bd71f59 100644 --- a/lib/settings.php +++ b/lib/settings.php @@ -37,6 +37,7 @@ define ('JIRAFEAU_HOUR', 3600); // JIRAFEAU_MINUTE * 60 define ('JIRAFEAU_DAY', 86400); // JIRAFEAU_HOUR * 24 define ('JIRAFEAU_WEEK', 604800); // JIRAFEAU_DAY * 7 define ('JIRAFEAU_MONTH', 2419200); // JIRAFEAU_WEEK * 4 +define ('JIRAFEAU_QUARTER', 7257600); // JIRAFEAU_MONTH * 3 define ('JIRAFEAU_YEAR', 29030400); // JIRAFEAU_MONTH * 12 ?> diff --git a/script.php b/script.php index b455003..f66b71f 100644 --- a/script.php +++ b/script.php @@ -119,6 +119,9 @@ if (isset ($_FILES['file']) && is_writable (VAR_FILES) case 'month': $time += JIRAFEAU_MONTH; break; + case 'quarter': + $time += JIRAFEAU_QUARTER; + break; case 'year': $time += JIRAFEAU_YEAR; break; @@ -504,6 +507,9 @@ elseif (isset ($_GET['init_async'])) case 'month': $time += JIRAFEAU_MONTH; break; + case 'quarter': + $time += JIRAFEAU_QUARTER; + break; case 'year': $time += JIRAFEAU_YEAR; break;