bernd commited on 2012-03-02 09:59:53
Zeige 6 geänderte Dateien mit 65 Einfügungen und 20 Löschungen.
git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@2215 87cf0b9e-d624-0410-a070-f6ee81989793
... | ... |
@@ -335,13 +335,20 @@ function html_datepicker($nameprefix, $timestamp) |
335 | 335 |
$valid_months = array( 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, |
336 | 336 |
6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, |
337 | 337 |
11 => 11, 12 => 12); |
338 |
+ $current_year = (int) date('Y'); |
|
339 |
+ $valid_years = array($current_year => $current_year, |
|
340 |
+ $current_year+1 => $current_year+1, |
|
341 |
+ $current_year+2 => $current_year+2, |
|
342 |
+ $current_year+3 => $current_year+3, |
|
343 |
+ $current_year+4 => $current_year+4); |
|
344 |
+ |
|
338 | 345 |
$selected_day = date('d', $timestamp); |
339 | 346 |
$selected_month = date('m', $timestamp); |
340 | 347 |
$selected_year = date('Y', $timestamp); |
341 | 348 |
$ret = ''; |
342 | 349 |
$ret .= html_select($nameprefix.'_day', $valid_days, $selected_day, 'style="text-align: right;"').". "; |
343 | 350 |
$ret .= html_select($nameprefix.'_month', $valid_months, $selected_month, 'style="text-align: right;"').". "; |
344 |
- $ret .= '<input type="text" name="'.$nameprefix.'_year" value="'.$selected_year.'" size="5" />'; |
|
351 |
+ $ret .= html_select($nameprefix.'_year', $valid_years, $selected_year); |
|
345 | 352 |
return $ret; |
346 | 353 |
} |
347 | 354 |
|
... | ... |
@@ -152,7 +152,7 @@ if ($ar['valid_until'] != NULL && $ar['valid_until'] < date('Y-m-d')) { |
152 | 152 |
$valid_from_now_checked = ($ar['valid_from'] <= date('Y-m-d H:i:s') || $ar['valid_from'] == NULL) ? ' checked="checked"' : ''; |
153 | 153 |
$valid_from_future_checked = ($ar['valid_from'] > date('Y-m-d H:i:s')) ? ' checked="checked"' : ''; |
154 | 154 |
$startdate = $ar['valid_from']; |
155 |
-if (! $startdate) { |
|
155 |
+if (! $startdate || $startdate <= date('Y-m-d')) { |
|
156 | 156 |
$startdate = date('Y-m-d', time() + 1*24*60*60); |
157 | 157 |
} |
158 | 158 |
$form .= "<p><input type=\"radio\" name=\"ar_valid_from\" value=\"now\" id=\"ar_valid_from_now\"{$valid_from_now_checked} /> <label for=\"ar_valid_from_now\">Ab sofort</label><br />". |
... | ... |
@@ -27,7 +27,7 @@ function empty_account() |
27 | 27 |
function empty_autoresponder_config() |
28 | 28 |
{ |
29 | 29 |
$ar = array( |
30 |
- 'valid_from' => date( 'Y-m-d H:i:s' ), |
|
30 |
+ 'valid_from' => date( 'Y-m-d' ), |
|
31 | 31 |
'valid_until' => NULL, |
32 | 32 |
'fromname' => NULL, |
33 | 33 |
'fromaddr' => NULL, |
... | ... |
@@ -75,7 +75,7 @@ function get_account_details($id, $checkuid = true) |
75 | 75 |
} |
76 | 76 |
} |
77 | 77 |
if ($acc['autoresponder'] > 0) { |
78 |
- $result = db_query("SELECT id, IF(valid_from IS NULL OR valid_from > NOW() OR valid_until < NOW(), 0, 1) AS active, valid_from, valid_until, fromname, fromaddr, subject, message, quote FROM mail.vmail_autoresponder WHERE account={$acc['id']}"); |
|
78 |
+ $result = db_query("SELECT id, IF(valid_from IS NULL OR valid_from > NOW() OR valid_until < NOW(), 0, 1) AS active, DATE(valid_from) AS valid_from, DATE(valid_until) AS valid_until, fromname, fromaddr, subject, message, quote FROM mail.vmail_autoresponder WHERE account={$acc['id']}"); |
|
79 | 79 |
$item = mysql_fetch_assoc($result); |
80 | 80 |
DEBUG($item); |
81 | 81 |
$acc['autoresponder'] = $item; |
... | ... |
@@ -9,6 +9,8 @@ require_role(array(ROLE_SYSTEMUSER, ROLE_VMAIL_ACCOUNT)); |
9 | 9 |
require_once("inc/debug.php"); |
10 | 10 |
global $debugmode; |
11 | 11 |
|
12 |
+$section = 'email_vmail'; |
|
13 |
+ |
|
12 | 14 |
|
13 | 15 |
if ($_GET['action'] == 'edit') |
14 | 16 |
{ |
... | ... |
@@ -21,7 +23,7 @@ if ($_GET['action'] == 'edit') |
21 | 23 |
// Leere das, sonst werden die vervielfacht |
22 | 24 |
$account['forwards'] = array(); |
23 | 25 |
} else { |
24 |
- $id = (int) $_GET['id']; |
|
26 |
+ $id = isset($_GET['id']) ? (int) $_GET['id'] : NULL; |
|
25 | 27 |
|
26 | 28 |
$account = empty_account(); |
27 | 29 |
$account['id'] = NULL; |
... | ... |
@@ -55,21 +57,52 @@ if ($_GET['action'] == 'edit') |
55 | 57 |
$ar = empty_autoresponder_config(); |
56 | 58 |
$valid_from_date = time(); |
57 | 59 |
$valid_until_date = NULL; |
60 |
+ if (isset($_POST['ar_valid_from']) && ($_POST['ar_valid_from'] == 'now')) { |
|
61 |
+ $valid_from_date = time(); |
|
62 |
+ } else { |
|
58 | 63 |
if (isset($_POST['ar_valid_from_day']) && isset($_POST['ar_valid_from_month']) && isset($_POST['ar_valid_from_year'])) { |
59 |
- $valid_from_date = strtotime($_POST['ar_valid_from_year'].'-'.$_POST['ar_valid_from_month'].'-'.$_POST['ar_valid_from_day']); |
|
64 |
+ $tmpdate = $_POST['ar_valid_from_year'].'-'.$_POST['ar_valid_from_month'].'-'.$_POST['ar_valid_from_day']; |
|
65 |
+ if (date('Y-n-j', strtotime($tmpdate)) != $tmpdate) { |
|
66 |
+ system_failure('Das Aktivierungs-Datum scheint ungültig zu sein.'); |
|
67 |
+ } else { |
|
68 |
+ $valid_from_date = strtotime($tmpdate); |
|
69 |
+ } |
|
60 | 70 |
} |
61 |
- if (isset($_POST['ar_valid_until_day']) && isset($_POST['ar_valid_until_month']) && isset($_POST['ar_valid_until_year'])) { |
|
62 |
- $valid_until_date = strtotime($_POST['ar_valid_until_year'].'-'.$_POST['ar_valid_until_month'].'-'.$_POST['ar_valid_until_day']); |
|
63 | 71 |
} |
64 |
- if (isset($_POST['ar_valid_from']) && ($_POST['ar_valid_from'] == 'now' || $valid_from_date < time())) { |
|
72 |
+ if ($valid_from_date < time()) { |
|
65 | 73 |
$valid_from_date = time(); |
74 |
+ warning('Das Aktivierungs-Datum liegt in der Vergangenheit. Die Funktion wird ab sofort aktiviert.'); |
|
75 |
+ } |
|
76 |
+ if ($valid_from_date > time() + 365*24*60*60) { |
|
77 |
+ warning('Das Aktivierungs-Datum liegt mehr als ein Jahr in der Zukunft. Bitte prüfen Sie ob Sie das korrekte Jahr gewählt haben.'); |
|
78 |
+ } |
|
79 |
+ if (isset($_POST['ar_valid_until']) && ($_POST['ar_valid_until'] == 'infinity')) { |
|
80 |
+ $valid_until_date = NULL; |
|
81 |
+ } else { |
|
82 |
+ if (isset($_POST['ar_valid_until_day']) && isset($_POST['ar_valid_until_month']) && isset($_POST['ar_valid_until_year'])) { |
|
83 |
+ $tmpdate = $_POST['ar_valid_until_year'].'-'.$_POST['ar_valid_until_month'].'-'.$_POST['ar_valid_until_day']; |
|
84 |
+ if (date('Y-n-j', strtotime($tmpdate)) != $tmpdate) { |
|
85 |
+ system_failure('Das Deaktivierungs-Datum scheint ungültig zu sein.'); |
|
86 |
+ } else { |
|
87 |
+ $valid_until_date = strtotime($tmpdate); |
|
88 |
+ } |
|
89 |
+ } |
|
66 | 90 |
} |
67 |
- $ar['valid_from'] = date('Y-m-d', $valid_from_date); |
|
68 |
- $ar['valid_until'] = date('Y-m-d', $valid_until_date); |
|
69 | 91 |
if (!isset($_POST['autoresponder']) || $_POST['autoresponder'] != 'yes') { |
92 |
+ $valid_from_date = NULL; |
|
93 |
+ } |
|
94 |
+ if ($valid_until_date && $valid_until_date < time()) { |
|
95 |
+ warning('Das Deaktivierungs-Datum liegt in der Vergangenheit, eine automatische Deaktivierung wird nicht stattfinden.'); |
|
96 |
+ $valid_until_date = NULL; |
|
97 |
+ } |
|
98 |
+ if ($valid_from_date) { |
|
99 |
+ $ar['valid_from'] = date('Y-m-d', $valid_from_date); |
|
100 |
+ } else { |
|
70 | 101 |
$ar['valid_from'] = NULL; |
71 | 102 |
} |
72 |
- if (isset($_POST['ar_valid_until']) && ($_POST['ar_valid_until'] == 'infinity' || $valid_until_date < time())) { |
|
103 |
+ if ($valid_until_date) { |
|
104 |
+ $ar['valid_until'] = date('Y-m-d', $valid_until_date); |
|
105 |
+ } else { |
|
73 | 106 |
$ar['valid_until'] = NULL; |
74 | 107 |
} |
75 | 108 |
|
... | ... |
@@ -121,13 +154,14 @@ if ($_GET['action'] == 'edit') |
121 | 154 |
|
122 | 155 |
save_vmail_account($account); |
123 | 156 |
|
124 |
- if (! ($debugmode || we_have_an_error())) |
|
157 |
+ if (! ($debugmode || we_have_an_error())) { |
|
125 | 158 |
if ($accountlogin) { |
126 | 159 |
header('Location: ../index/index'); |
127 | 160 |
} else { |
128 | 161 |
header('Location: vmail'); |
129 | 162 |
} |
130 | 163 |
} |
164 |
+} |
|
131 | 165 |
elseif ($_GET['action'] == 'delete') |
132 | 166 |
{ |
133 | 167 |
$title = "E-mail-Adresse löschen"; |
... | ... |
@@ -81,20 +81,22 @@ if (count($sorted_by_domains) > 0) |
81 | 81 |
array_push($actions, "Ablegen in Mailbox ({$spam})<br />".$quotachart); |
82 | 82 |
} |
83 | 83 |
if ($acc['autoresponder']) { |
84 |
- $now = date( 'Y-m-d H:i:s' ); |
|
84 |
+ $now = date( 'Y-m-d' ); |
|
85 | 85 |
$valid_from = $acc['autoresponder']['valid_from']; |
86 |
+ $valid_from_string = date('d.m.Y', strtotime($acc['autoresponder']['valid_from'])); |
|
86 | 87 |
$valid_until = $acc['autoresponder']['valid_until']; |
88 |
+ $valid_until_string = date('d.m.Y', strtotime($acc['autoresponder']['valid_until'])); |
|
87 | 89 |
if ($valid_from == NULL) { |
88 | 90 |
// Autoresponder abgeschaltet |
89 | 91 |
//array_push($actions, "<strike>Automatische Antwort versenden</strike> (Abgeschaltet)"); |
90 | 92 |
} elseif ($valid_from > $now) { |
91 |
- array_push($actions, "<strike>Automatische Antwort versenden</strike> (Wird aktiviert am {$valid_from})"); |
|
93 |
+ array_push($actions, "<strike>Automatische Antwort versenden</strike> (Wird aktiviert am {$valid_from_string})"); |
|
92 | 94 |
} elseif ($valid_until == NULL) { |
93 | 95 |
array_push($actions, "Automatische Antwort versenden (Unbefristet)"); |
94 | 96 |
} elseif ($valid_until > $now) { |
95 |
- array_push($actions, "Automatische Antwort versenden (Wird deaktiviert am {$valid_until})"); |
|
97 |
+ array_push($actions, "Automatische Antwort versenden (Wird deaktiviert am {$valid_until_string})"); |
|
96 | 98 |
} elseif ($valid_until < $now) { |
97 |
- array_push($actions, "<strike>Automatische Antwort versenden</strike> (Automatisch abgeschaltet seit {$valid_until})"); |
|
99 |
+ array_push($actions, "<strike>Automatische Antwort versenden</strike> (Automatisch abgeschaltet seit {$valid_until_string})"); |
|
98 | 100 |
} |
99 | 101 |
} |
100 | 102 |
foreach ($acc['forwards'] AS $fwd) |
... | ... |
@@ -38,18 +38,20 @@ $content .= '<p>'.other_icon('go.png')." Ablegen in Ihrer Mailbox ({$spam})</p>" |
38 | 38 |
if ($acc['autoresponder']) { |
39 | 39 |
$now = date( 'Y-m-d H:i:s' ); |
40 | 40 |
$valid_from = $acc['autoresponder']['valid_from']; |
41 |
+ $valid_from_string = date('d.m.Y', strtotime($acc['autoresponder']['valid_from'])); |
|
41 | 42 |
$valid_until = $acc['autoresponder']['valid_until']; |
43 |
+ $valid_until_string = date('d.m.Y', strtotime($acc['autoresponder']['valid_until'])); |
|
42 | 44 |
if ($valid_from == NULL) { |
43 | 45 |
// Autoresponder abgeschaltet |
44 | 46 |
//$content .= '<p>'.other_icon('go.png')." Es wird keine automatische Antwort versendet</p>"; |
45 | 47 |
} elseif ($valid_from > $now) { |
46 |
- $content .= '<p>'.other_icon('go.png')." Es wird ab dem {$valid_from} eine automatische Antwort versendet</p>"; |
|
48 |
+ $content .= '<p>'.other_icon('go.png')." Es wird ab dem {$valid_from_string} eine automatische Antwort versendet</p>"; |
|
47 | 49 |
} elseif ($valid_until == NULL) { |
48 | 50 |
$content .= '<p>'.other_icon('go.png')." Es wird eine automatische Antwort versendet</p>"; |
49 | 51 |
} elseif ($valid_until > $now) { |
50 |
- $content .= '<p>'.other_icon('go.png')." Es wird eine automatische Antwort versendet, jedoch nicht mehr ab dem {$valid_until}</p>"; |
|
52 |
+ $content .= '<p>'.other_icon('go.png')." Es wird eine automatische Antwort versendet, jedoch nicht mehr ab dem {$valid_until_string}</p>"; |
|
51 | 53 |
} elseif ($valid_until < $now) { |
52 |
- $content .= '<p>'.other_icon('go.png')." Es wird seit dem {$valid_until} keine automatische Antwort mehr versendet</p>"; |
|
54 |
+ $content .= '<p>'.other_icon('go.png')." Es wird seit dem {$valid_until_string} keine automatische Antwort mehr versendet</p>"; |
|
53 | 55 |
} |
54 | 56 |
} |
55 | 57 |
|
56 | 58 |