From f603008440b28f0d8423c56ac49a56b5481d4089 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9?= Date: Sun, 5 Nov 2017 12:20:05 +0100 Subject: [PATCH] [Web] Reset last_run for imapsync jobs to run next, other minor changes... --- data/web/inc/functions.mailbox.inc.php | 12 ++++++++++-- data/web/lang/lang.de.php | 4 ++++ data/web/lang/lang.en.php | 5 ++++- data/web/mailbox.php | 6 +++--- data/web/modals/mailbox.php | 2 +- data/web/modals/user.php | 2 +- 6 files changed, 23 insertions(+), 8 deletions(-) diff --git a/data/web/inc/functions.mailbox.inc.php b/data/web/inc/functions.mailbox.inc.php index ed3caaa7..2ca86e81 100644 --- a/data/web/inc/functions.mailbox.inc.php +++ b/data/web/inc/functions.mailbox.inc.php @@ -1390,11 +1390,12 @@ function mailbox($_action, $_type, $_data = null, $attr = null) { return false; } foreach ($ids as $id) { - $is_now = mailbox('get', 'syncjob_details', $id); + $is_now = mailbox('get', 'syncjob_details', $id, array('with_password')); if (!empty($is_now)) { $username = $is_now['user2']; $user1 = (!empty($_data['user1'])) ? $_data['user1'] : $is_now['user1']; $active = (isset($_data['active'])) ? intval($_data['active']) : $is_now['active_int']; + $last_run = (isset($_data['last_run'])) ? NULL : $is_now['last_run']; $delete2duplicates = (isset($_data['delete2duplicates'])) ? intval($_data['delete2duplicates']) : $is_now['delete2duplicates']; $delete1 = (isset($_data['delete1'])) ? intval($_data['delete1']) : $is_now['delete1']; $delete2 = (isset($_data['delete2'])) ? intval($_data['delete2']) : $is_now['delete2']; @@ -1456,7 +1457,7 @@ function mailbox($_action, $_type, $_data = null, $attr = null) { return false; } try { - $stmt = $pdo->prepare("UPDATE `imapsync` SET `delete1` = :delete1, `delete2` = :delete2, `maxage` = :maxage, `subfolder2` = :subfolder2, `exclude` = :exclude, `host1` = :host1, `user1` = :user1, `password1` = :password1, `mins_interval` = :mins_interval, `port1` = :port1, `enc1` = :enc1, `delete2duplicates` = :delete2duplicates, `active` = :active + $stmt = $pdo->prepare("UPDATE `imapsync` SET `delete1` = :delete1, `delete2` = :delete2, `maxage` = :maxage, `subfolder2` = :subfolder2, `exclude` = :exclude, `host1` = :host1, `last_run` = :last_run, `user1` = :user1, `password1` = :password1, `mins_interval` = :mins_interval, `port1` = :port1, `enc1` = :enc1, `delete2duplicates` = :delete2duplicates, `active` = :active WHERE `id` = :id"); $stmt->execute(array( ':delete1' => $delete1, @@ -1468,6 +1469,7 @@ function mailbox($_action, $_type, $_data = null, $attr = null) { ':host1' => $host1, ':user1' => $user1, ':password1' => $password1, + ':last_run' => $last_run, ':mins_interval' => $mins_interval, ':port1' => $port1, ':enc1' => $enc1, @@ -2446,6 +2448,12 @@ function mailbox($_action, $_type, $_data = null, $attr = null) { CASE `active` WHEN 1 THEN '".$lang['mailbox']['yes']."' ELSE '".$lang['mailbox']['no']."' END AS `active` FROM `imapsync` WHERE id = :id"); } + elseif (isset($attr) && in_array('with_password', $attr)) { + $stmt = $pdo->prepare("SELECT *, + `active` AS `active_int`, + CASE `active` WHEN 1 THEN '".$lang['mailbox']['yes']."' ELSE '".$lang['mailbox']['no']."' END AS `active` + FROM `imapsync` WHERE id = :id"); + } else { $field_query = $pdo->query('SHOW FIELDS FROM `imapsync` WHERE FIELD NOT IN ("password1")'); $fields = $field_query->fetchAll(PDO::FETCH_ASSOC); diff --git a/data/web/lang/lang.de.php b/data/web/lang/lang.de.php index bd329fa1..938ef26a 100644 --- a/data/web/lang/lang.de.php +++ b/data/web/lang/lang.de.php @@ -268,6 +268,10 @@ $lang['mailbox']['deactivate'] = 'Deaktivieren'; $lang['mailbox']['owner'] = 'Besitzer'; $lang['mailbox']['mins_interval'] = 'Intervall (min)'; $lang['mailbox']['last_run'] = 'Letzte Ausführung'; +$lang['mailbox']['last_run_reset'] = 'Als nächstes ausführen'; +$lang['mailbox']['sieve_info'] = 'Es können mehrere Filter pro Benutzer existieren, aber nur ein Filter eines Typs (Pre-/Postfilter) kann gleichzeitig aktiv sein.
+Die Ausführung erfolgt in nachstehender Reihenfolge. Ein fehlgeschlagenes Script sowie der Befehl "keep;" stoppen die weitere Verarbeitung nicht.
+Prefilter → User scripts → Postfilter → global sieve postfilter'; $lang['info']['no_action'] = 'Keine Aktion anwendbar'; $lang['delete']['title'] = 'Objekt entfernen'; diff --git a/data/web/lang/lang.en.php b/data/web/lang/lang.en.php index efa19dd2..cdf0474b 100644 --- a/data/web/lang/lang.en.php +++ b/data/web/lang/lang.en.php @@ -271,7 +271,10 @@ $lang['mailbox']['deactivate'] = 'Deactivate'; $lang['mailbox']['owner'] = 'Owner'; $lang['mailbox']['mins_interval'] = 'Interval (min)'; $lang['mailbox']['last_run'] = 'Last run'; - +$lang['mailbox']['last_run_reset'] = 'Schedule next'; +$lang['mailbox']['sieve_info'] = 'You can store multiple filters per user, but only one prefilter and one postfilter can be active at the same time.
+Each filter will be processed in the described order. Neither a failed script nor an issued "keep;" will stop processing of further scripts.
+Prefilter → User scripts → Postfilter → global sieve postfilter'; $lang['info']['no_action'] = 'No action applicable'; $lang['delete']['title'] = 'Remove object'; diff --git a/data/web/mailbox.php b/data/web/mailbox.php index a2d72f22..149a59d3 100644 --- a/data/web/mailbox.php +++ b/data/web/mailbox.php @@ -162,6 +162,8 @@ $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];