From 788e32b32859b584b8837c909835187f056eabf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9?= Date: Tue, 16 Oct 2018 20:08:52 +0200 Subject: [PATCH] [Web] Set new expire date for time limited aliases via actions button, fixes #1903 --- data/web/inc/functions.mailbox.inc.php | 11 +++++++---- data/web/lang/lang.de.php | 1 + data/web/lang/lang.en.php | 11 ++++++----- data/web/user.php | 6 +++++- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/data/web/inc/functions.mailbox.inc.php b/data/web/inc/functions.mailbox.inc.php index 1a4fa3ca..045fa011 100644 --- a/data/web/inc/functions.mailbox.inc.php +++ b/data/web/inc/functions.mailbox.inc.php @@ -1213,12 +1213,15 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { ); continue; } - $stmt = $pdo->prepare("UPDATE `spamalias` SET `validity` = (`validity` + 3600) WHERE - `address` = :address AND - `validity` >= :validity"); + if (empty($_data['validity'])) { + continue; + } + $validity = round((int)time() + ($_data['validity'] * 3600)); + $stmt = $pdo->prepare("UPDATE `spamalias` SET `validity` = :validity WHERE + `address` = :address"); $stmt->execute(array( ':address' => $address, - ':validity' => time() + ':validity' => $validity )); $_SESSION['return'][] = array( 'type' => 'success', diff --git a/data/web/lang/lang.de.php b/data/web/lang/lang.de.php index a4a57c14..5c0c6412 100644 --- a/data/web/lang/lang.de.php +++ b/data/web/lang/lang.de.php @@ -178,6 +178,7 @@ $lang['user']['alias_time_left'] = 'Zeit verbleibend'; $lang['user']['alias_full_date'] = 'd.m.Y, H:i:s T'; $lang['user']['alias_select_validity'] = 'Bitte Gültigkeit auswählen'; $lang['user']['sync_jobs'] = 'Sync Jobs'; +$lang['user']['expire_in'] = 'Ungültig in'; $lang['user']['hour'] = 'Stunde'; $lang['user']['hours'] = 'Stunden'; $lang['user']['day'] = 'Tag'; diff --git a/data/web/lang/lang.en.php b/data/web/lang/lang.en.php index 383a3997..904d87cb 100644 --- a/data/web/lang/lang.en.php +++ b/data/web/lang/lang.en.php @@ -181,11 +181,12 @@ $lang['user']['alias_time_left'] = 'Time left'; $lang['user']['alias_full_date'] = 'd.m.Y, H:i:s T'; $lang['user']['alias_select_validity'] = 'Period of validity'; $lang['user']['sync_jobs'] = 'Sync jobs'; -$lang['user']['hour'] = 'Hour'; -$lang['user']['hours'] = 'Hours'; -$lang['user']['day'] = 'Day'; -$lang['user']['week'] = 'Week'; -$lang['user']['weeks'] = 'Weeks'; +$lang['user']['expire_in'] = 'Expire in'; +$lang['user']['hour'] = 'hour'; +$lang['user']['hours'] = 'hours'; +$lang['user']['day'] = 'day'; +$lang['user']['week'] = 'week'; +$lang['user']['weeks'] = 'weeks'; $lang['user']['spamfilter'] = 'Spam filter'; $lang['admin']['spamfilter'] = 'Spam filter'; $lang['user']['spamfilter_wl'] = 'Whitelist'; diff --git a/data/web/user.php b/data/web/user.php index 76f55bee..bbdd2c6f 100644 --- a/data/web/user.php +++ b/data/web/user.php @@ -259,7 +259,11 @@ elseif (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == '