Bernd Wurst commited on 2014-07-22 11:47:11
Zeige 5 geänderte Dateien mit 132 Einfügungen und 7 Löschungen.
... | ... |
@@ -145,7 +145,10 @@ if (! $enddate) { |
145 | 145 |
} |
146 | 146 |
$form .= "<h4>Deaktivierung</h4>"; |
147 | 147 |
$form .= "<p><label for=\"ar_valid_until_date\">Keine Antworten mehr versenden ab dem </label>". |
148 |
- "<input type=\"text\" value=\"$enddate\" id=\"ar_enddate\" name=\"ar_enddate\" /><br/><small>(Automatische Antworten sind nur befristet erlaubt. Benötigen Sie langfristig funktionierende automatische Antworten, sprechen Sie unsere Administratoren bitte an, dann suchen wir eine Lösung.)</small></p>"; |
|
148 |
+ "<input type=\"text\" value=\"$enddate\" id=\"ar_enddate\" name=\"ar_enddate\" /><br/>"; |
|
149 |
+if (!$accountlogin && ($id != 0)) { |
|
150 |
+ $form .= "<small>(Automatische Antworten sind nur befristet erlaubt. Wenn Sie diese Adresse dauerhaft stillegen möchten, können Sie dies am Ende dieser Seite tun.)</small></p>"; |
|
151 |
+} |
|
149 | 152 |
/* |
150 | 153 |
$form .= "<p><input type=\"radio\" name=\"ar_valid_until\" value=\"infinity\" id=\"ar_valid_until_infinity\"{$valid_until_infinity_checked} /> <label for=\"ar_valid_until_infinity\">Unbefristet</label><br />". |
151 | 154 |
"<input type=\"radio\" name=\"ar_valid_until\" value=\"date\" id=\"ar_valid_until_date\"{$valid_until_date_checked} /> <label for=\"ar_valid_until_date\">Keine Antworten mehr versenden ab dem </label>". |
... | ... |
@@ -231,5 +234,9 @@ $form .= '<p><input id="submit" type="submit" value="Speichern" />  &# |
231 | 234 |
|
232 | 235 |
output(html_form('vmail_edit_mailbox', 'save', 'action=edit'.($id != 0 ? '&id='.$id : ''), $form)); |
233 | 236 |
|
237 |
+if (! $accountlogin && ($id != 0)) { |
|
238 |
+ output("<p>".internal_link('suspend', 'Diese Adresse stillegen (mit individuellem Fehlertext)', "account=".$id)."</p>"); |
|
239 |
+} |
|
240 |
+ |
|
234 | 241 |
|
235 | 242 |
?> |
... | ... |
@@ -55,6 +55,7 @@ function empty_account() |
55 | 55 |
'local' => '', |
56 | 56 |
'domain' => NULL, |
57 | 57 |
'password' => NULL, |
58 |
+ 'smtpreply' => NULL, |
|
58 | 59 |
'spamfilter' => 'folder', |
59 | 60 |
'spamexpire' => 7, |
60 | 61 |
'quota' => config('vmail_basequota'), |
... | ... |
@@ -101,7 +102,7 @@ function get_account_details($id, $checkuid = true) |
101 | 102 |
$uid_check = "useraccount=:uid AND "; |
102 | 103 |
$args[":uid"] = $uid; |
103 | 104 |
} |
104 |
- $result = db_query("SELECT id, local, domain, password, spamfilter, forwards, autoresponder, server, quota, COALESCE(quota_used, 0) AS quota_used, quota_threshold from mail.v_vmail_accounts WHERE {$uid_check}id=:id LIMIT 1", $args); |
|
105 |
+ $result = db_query("SELECT id, local, domain, password, smtpreply, spamfilter, forwards, autoresponder, server, quota, COALESCE(quota_used, 0) AS quota_used, quota_threshold from mail.v_vmail_accounts WHERE {$uid_check}id=:id LIMIT 1", $args); |
|
105 | 106 |
if ($result->rowCount() == 0) |
106 | 107 |
system_failure('Ungültige ID oder kein eigener Account'); |
107 | 108 |
$acc = empty_account(); |
... | ... |
@@ -236,6 +237,9 @@ function save_vmail_account($account) |
236 | 237 |
system_failure('Sie können die E-Mail-Adresse nicht ändern!'); |
237 | 238 |
if ($account['quota'] != $oldaccount['quota']) |
238 | 239 |
system_failure('Sie können Ihren eigenen Speicherplatz nicht verändern.'); |
240 |
+ if ($account['smtpreply'] != NULL) { |
|
241 |
+ system_failure("Sie können nicht den Account stillegen mit dem Sie grade angemeldet sind."); |
|
242 |
+ } |
|
239 | 243 |
} else { |
240 | 244 |
|
241 | 245 |
$account['local'] = filter_input_username($account['local']); |
... | ... |
@@ -344,10 +348,13 @@ function save_vmail_account($account) |
344 | 348 |
|
345 | 349 |
$account['local'] = strtolower($account['local']); |
346 | 350 |
$account['spamexpire'] = (int) $account['spamexpire']; |
351 |
+ # Leerstring wird zu NULL |
|
352 |
+ $account['smtpreply'] = ($account['smtpreply'] ? $account['smtpreply'] : NULL); |
|
347 | 353 |
|
348 | 354 |
$args = array(":local" => $account['local'], |
349 | 355 |
":domain" => $account['domain'], |
350 | 356 |
":password" => $password, |
357 |
+ ":smtpreply" => $account['smtpreply'], |
|
351 | 358 |
":spamfilter" => $spam, |
352 | 359 |
":spamexpire" => $account['spamexpire'], |
353 | 360 |
":quota" => $account['quota'], |
... | ... |
@@ -358,7 +365,7 @@ function save_vmail_account($account) |
358 | 365 |
if ($newaccount) |
359 | 366 |
{ |
360 | 367 |
unset($args[":id"]); |
361 |
- $query = "INSERT INTO mail.vmail_accounts (local, domain, spamfilter, spamexpire, password, quota, quota_threshold) VALUES (:local, :domain, :spamfilter, :spamexpire, :password, :quota, :quota_threshold)"; |
|
368 |
+ $query = "INSERT INTO mail.vmail_accounts (local, domain, spamfilter, spamexpire, password, smtpreply, quota, quota_threshold) VALUES (:local, :domain, :spamfilter, :spamexpire, :password, :smtpreply, :quota, :quota_threshold)"; |
|
362 | 369 |
} else { |
363 | 370 |
if ($set_password) |
364 | 371 |
$pw=", password=:password"; |
... | ... |
@@ -366,7 +373,7 @@ function save_vmail_account($account) |
366 | 373 |
unset($args[":password"]); |
367 | 374 |
$pw=''; |
368 | 375 |
} |
369 |
- $query = "UPDATE mail.vmail_accounts SET local=:local, domain=:domain{$pw}, spamfilter=:spamfilter, spamexpire=:spamexpire, quota=:quota, quota_threshold=:quota_threshold WHERE id=:id"; |
|
376 |
+ $query = "UPDATE mail.vmail_accounts SET local=:local, domain=:domain{$pw}, smtpreply=:smtpreply, spamfilter=:spamfilter, spamexpire=:spamexpire, quota=:quota, quota_threshold=:quota_threshold WHERE id=:id"; |
|
370 | 377 |
} |
371 | 378 |
db_query($query, $args); |
372 | 379 |
if ($newaccount) { |
... | ... |
@@ -218,6 +218,55 @@ elseif ($_GET['action'] == 'delete') |
218 | 218 |
} |
219 | 219 |
|
220 | 220 |
} |
221 |
+elseif ($_GET['action'] == 'suspend') |
|
222 |
+{ |
|
223 |
+ $title = "E-mail-Adresse stillegen"; |
|
224 |
+ $section = 'vmail_vmail'; |
|
225 |
+ |
|
226 |
+ $account = get_account_details( (int) $_GET['id'] ); |
|
227 |
+ |
|
228 |
+ $domain = NULL; |
|
229 |
+ $domains = get_vmail_domains(); |
|
230 |
+ foreach ($domains as $dom) |
|
231 |
+ if ($dom['id'] == $account['domain']) |
|
232 |
+ { |
|
233 |
+ $domain = $dom['domainname']; |
|
234 |
+ break; |
|
235 |
+ } |
|
236 |
+ $account_string = $account['local'] . "@" . $domain; |
|
237 |
+ |
|
238 |
+ if (!isset($_POST['smtpreply']) || !$_POST['smtpreply']) { |
|
239 |
+ system_failure('Zur Stillegung einer Adresse müssen Sie einen Text eingeben den der Absender als Fehlermeldung erhält.'); |
|
240 |
+ } |
|
241 |
+ $account['smtpreply'] = $_POST['smtpreply']; |
|
242 |
+ |
|
243 |
+ save_vmail_account($account); |
|
244 |
+ if (! $debugmode) |
|
245 |
+ header("Location: vmail"); |
|
246 |
+} |
|
247 |
+elseif ($_GET['action'] == 'unsuspend') |
|
248 |
+{ |
|
249 |
+ $title = "E-mail-Adresse wieder aktivieren"; |
|
250 |
+ $section = 'vmail_vmail'; |
|
251 |
+ |
|
252 |
+ $account = get_account_details( (int) $_GET['id'] ); |
|
253 |
+ |
|
254 |
+ $domain = NULL; |
|
255 |
+ $domains = get_vmail_domains(); |
|
256 |
+ foreach ($domains as $dom) |
|
257 |
+ if ($dom['id'] == $account['domain']) |
|
258 |
+ { |
|
259 |
+ $domain = $dom['domainname']; |
|
260 |
+ break; |
|
261 |
+ } |
|
262 |
+ $account_string = $account['local'] . "@" . $domain; |
|
263 |
+ |
|
264 |
+ $account['smtpreply'] = NULL; |
|
265 |
+ |
|
266 |
+ save_vmail_account($account); |
|
267 |
+ if (! $debugmode) |
|
268 |
+ header("Location: vmail"); |
|
269 |
+} |
|
221 | 270 |
else |
222 | 271 |
system_failure("Unimplemented action"); |
223 | 272 |
|
... | ... |
@@ -0,0 +1,57 @@ |
1 |
+<?php |
|
2 |
+/* |
|
3 |
+This file belongs to the Webinterface of schokokeks.org Hosting |
|
4 |
+ |
|
5 |
+Written 2008-2014 by schokokeks.org Hosting, namely |
|
6 |
+ Bernd Wurst <bernd@schokokeks.org> |
|
7 |
+ Hanno Böck <hanno@schokokeks.org> |
|
8 |
+ |
|
9 |
+To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty. |
|
10 |
+ |
|
11 |
+You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see |
|
12 |
+http://creativecommons.org/publicdomain/zero/1.0/ |
|
13 |
+ |
|
14 |
+Nevertheless, in case you use a significant part of this code, we ask (but not require, see the license) that you keep the authors' names in place and return your changes to the public. We would be especially happy if you tell us what you're going to do with this code. |
|
15 |
+*/ |
|
16 |
+ |
|
17 |
+require_once('inc/debug.php'); |
|
18 |
+require_once('inc/security.php'); |
|
19 |
+require_once('inc/icons.php'); |
|
20 |
+ |
|
21 |
+require_once('vmail.php'); |
|
22 |
+ |
|
23 |
+$section = 'email_vmail'; |
|
24 |
+require_role(array(ROLE_SYSTEMUSER)); |
|
25 |
+ |
|
26 |
+if (! isset($_REQUEST['account'])) { |
|
27 |
+ system_failure("Fehler beim Aufruf dieser Seite"); |
|
28 |
+} |
|
29 |
+$id = $_REQUEST['account']; |
|
30 |
+$account = get_account_details($id); |
|
31 |
+ |
|
32 |
+$suspended = False; |
|
33 |
+if ($account['smtpreply']) { |
|
34 |
+ $suspended = True; |
|
35 |
+} else { |
|
36 |
+ $account['smtpreply'] = 'Diese E-Mail-Adresse wird nicht mehr verwendet. |
|
37 |
+ |
|
38 |
+Bitte besuchen Sie unsere Website um eine aktuelle Kontaktmöglichkeit zu finden.'; |
|
39 |
+} |
|
40 |
+ |
|
41 |
+title("E-Mail-Adresse stillegen"); |
|
42 |
+ |
|
43 |
+output('<p>Mit dieser Funktion können Sie eine E-Mail-Adresse stillegen (so werden keine Nachrichten für diese Adresse angenommen) und dabei dem Absender einen eigenen, hier festgelegten Fehlertext zukommen lassen. Diese Methode hat nicht die Probleme, die ein klassische Autoresponder verursacht, da keine Antwort-E-Mails versendet werden. Der Absender erhält von seinem Mail-Server eine Fehlermeldung mit dem entsprechenden Text.</p> |
|
44 |
+<p><strong>Wichtig:</strong> Dieses Verfahren funktioniert nur, wenn die E-Mails wirklich nicht angenommen werden (Annahme wird verweigert), somit sind keine Weiterleitung und keine Speicherung möglich. Sie können aber natürlich im Text auf eine andere E-Mail-Adresse hinweisen.</p>'); |
|
45 |
+ |
|
46 |
+$form = "<h4>Text der Fehlermeldung</h4>". |
|
47 |
+ "<p><textarea cols=\"80\" rows=\"10\" name=\"smtpreply\" id=\"smtpreply\">{$account['smtpreply']}</textarea></p>"; |
|
48 |
+ |
|
49 |
+$form .= '<p><input id="submit" type="submit" value="Speichern" />    '.internal_link('edit', 'Abbrechen', "id=".$id).'</p>'; |
|
50 |
+output(html_form('vmail_edit_mailbox', 'save', 'action=suspend&id='.$id, $form)); |
|
51 |
+ |
|
52 |
+if ($suspended) { |
|
53 |
+ output("<p><strong>".internal_link('save', 'Stillegung aufheben', 'action=unsuspend&id='.$account['id'])."</strong></p>"); |
|
54 |
+} |
|
55 |
+ |
|
56 |
+ |
|
57 |
+?> |
... | ... |
@@ -83,7 +83,7 @@ if (count($domains) > 0) |
83 | 83 |
$acc = get_account_details($this_account['id']); |
84 | 84 |
$actions = array(); |
85 | 85 |
DEBUG($acc); |
86 |
- if ($acc['password'] != '') |
|
86 |
+ if ($acc['password'] != '' && ($acc['smtpreply'] == NULL)) |
|
87 | 87 |
{ |
88 | 88 |
$percent = round(( $acc["quota_used"] / $acc["quota"] ) * 100 ); |
89 | 89 |
$color = ( $percent > 95 ? 'red' : ($percent > 75 ? "yellow" : "green" )); |
... | ... |
@@ -141,8 +141,13 @@ if (count($domains) > 0) |
141 | 141 |
$dest .= "<li>{$a}</li>"; |
142 | 142 |
$dest .= '</ul>'; |
143 | 143 |
} |
144 |
- output('<p>'.internal_link('edit', $acc['local'].'@'.$this_account['domainname'], 'id='.$acc['id']).' '.internal_link("save", '<img src="'.$prefix.'images/delete.png" alt="löschen" title="Dieses Konto löschen"/>', "action=delete&id=".$acc['id']).'</p> |
|
145 |
- <p>'.$dest.'</p>'); |
|
144 |
+ if ($acc['smtpreply']) { |
|
145 |
+ output('<p><strike>'.$acc['local'].'@'.$this_account['domainname'].'</strike> '.internal_link("save", '<img src="'.$prefix.'images/delete.png" alt="löschen" title="Dieses Konto löschen"/>', "action=delete&id=".$acc['id']).'</p>'); |
|
146 |
+ output("<ul><li>".icon_disabled()." Diese Adresse ist stillgelegt. <strong>".internal_link('suspend', 'Stillegung ändern/aufheben', 'account='.$acc['id']).'</strong></li></ul>'); |
|
147 |
+ } else { |
|
148 |
+ output('<p>'.internal_link('edit', $acc['local'].'@'.$this_account['domainname'], 'id='.$acc['id']).' '.internal_link("save", '<img src="'.$prefix.'images/delete.png" alt="löschen" title="Dieses Konto löschen"/>', "action=delete&id=".$acc['id']).'</p>'); |
|
149 |
+ output('<p>'.$dest.'</p>'); |
|
150 |
+ } |
|
146 | 151 |
} |
147 | 152 |
} else { |
148 | 153 |
output('<p><em>Bisher keine E-Mail-Adressen unter dieser Domain.</em></p>'); |
149 | 154 |