Erste Version des vmail-Modul
bernd authored 17 years ago
|
1) <?php
2)
3) require_once('session/start.php');
4)
5) require_once('vmail.php');
6)
7) require_role(ROLE_SYSTEMUSER);
8)
9) require_once("inc/debug.php");
10) global $debugmode;
11)
12)
13) if ($_GET['action'] == 'edit')
14) {
15) check_form_token('vmail_edit_mailbox');
16) $id = (int) $_GET['id'];
17)
18) $account = empty_account();
19) $account['id'] = NULL;
20) if ($id)
21) $account['id'] = $id;
22) $account['local'] = $_POST['local'];
23) $account['domain'] = (int) $_POST['domain'];
24) $account['spamfilter'] = $_POST['spamfilter_action'];
|
Anpassung auf neues Interface
bernd authored 17 years ago
|
25) $account['password'] = $_POST['password'];
|
diverse spezial/fehlerfälle...
bernd authored 17 years ago
|
26) if (($account['password'] == '') && ($_POST['mailbox'] == 'yes'))
27) system_failure("Sie haben ein leeres Passwort eingegeben!");
|
Sterne in das Passwort-Feld...
bernd authored 17 years ago
|
28) if ($_POST['password'] == '**********')
29) $account['password'] = '';
|
Anpassung auf neues Interface
bernd authored 17 years ago
|
30) if ($_POST['mailbox'] != 'yes')
31) $account['password'] = NULL;
32)
33) if ($_POST['forward'] == 'yes')
34) {
35) $num = 1;
36) while (true)
37) {
38) if (! isset($_POST['forward_to_'.$num]))
39) break;
|
Bugfixes
bernd authored 17 years ago
|
40) if ($_POST['forward_to_'.$num] == '')
41) break;
|
Anpassung auf neues Interface
bernd authored 17 years ago
|
42) $fwd = array("spamfilter" => $_POST['spamfilter_action_'.$num], "destination" => $_POST['forward_to_'.$num]);
43) array_push($account['forwards'], $fwd);
44) $num++;
45) }
|
diverse spezial/fehlerfälle...
bernd authored 17 years ago
|
46) if ($num == 1) system_failure("Bitte mindestens eine Weiterleitungsadresse angeben.");
|
Anpassung auf neues Interface
bernd authored 17 years ago
|
47) }
|
diverse spezial/fehlerfälle...
bernd authored 17 years ago
|
48)
49) if (($_POST['forward']!='yes') && ($_POST['mailbox']!='yes'))
50) system_failure("Entweder eine Mailbox oder eine Weiterleitung muss angegeben werden!");
|
Erste Version des vmail-Modul
bernd authored 17 years ago
|
51)
52) DEBUG($account);
53)
54) save_vmail_account($account);
55)
56) if (! ($debugmode || we_have_an_error()))
57) header('Location: accounts.php');
|
Löschen geht jetzt auch
bernd authored 17 years ago
|
58) }
59) elseif ($_GET['action'] == 'delete')
60) {
61) $title = "E-mail-Adresse löschen";
62) $section = 'vmail_vmail';
63)
64) $account = get_account_details( (int) $_GET['id'] );
65)
66) $domain = NULL;
67) $domains = get_vmail_domains();
68) foreach ($domains as $dom)
69) if ($dom->id == $account['domain'])
70) {
71) $domain = $dom->domainname;
72) break;
73) }
74) $account_string = $account['local'] . "@" . $domain;
75) $sure = user_is_sure();
76) if ($sure === NULL)
77) {
78) are_you_sure("action=delete&id={$account['id']}", "Möchten Sie die E-Mail-Adresse »{$account_string}« wirklich löschen?");
79) }
80) elseif ($sure === true)
81) {
82) delete_account($account['id']);
83) if (! $debugmode)
84) header("Location: accounts.php");
85) }
86) elseif ($sure === false)
87) {
88) if (! $debugmode)
89) header("Location: accounts.php");
90) }
|