beab525e8650eb1676c0bbd547138b4ee699fbd9
bernd Erste Version des vmail-Modul

bernd authored 16 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'];
bernd Anpassung auf neues Interface

bernd authored 16 years ago

25)   $account['password'] = $_POST['password'];
bernd Sterne in das Passwort-Feld...

bernd authored 16 years ago

26)   if ($_POST['password'] == '**********')
27)     $account['password'] = '';
bernd Anpassung auf neues Interface

bernd authored 16 years ago

28)   if ($_POST['mailbox'] != 'yes')
29)     $account['password'] = NULL;
30) 
31)   if ($_POST['forward'] == 'yes')
32)   {
33)     $num = 1;
34)     while (true)
35)     {
36)       if (! isset($_POST['forward_to_'.$num]))
37)         break;
bernd Bugfixes

bernd authored 16 years ago

38)       if ($_POST['forward_to_'.$num] == '')
39)         break;
bernd Anpassung auf neues Interface

bernd authored 16 years ago

40)       $fwd = array("spamfilter" => $_POST['spamfilter_action_'.$num], "destination" => $_POST['forward_to_'.$num]);
41)       array_push($account['forwards'], $fwd);
42)       $num++;
43)     }
44)   }
bernd Erste Version des vmail-Modul

bernd authored 16 years ago

45) 
46)   DEBUG($account);
47) 
48)   save_vmail_account($account);
49) 
50)   if (! ($debugmode || we_have_an_error()))
51)     header('Location: accounts.php');
bernd Löschen geht jetzt auch

bernd authored 16 years ago

52) }
53) elseif ($_GET['action'] == 'delete')
54) {
55)   $title = "E-mail-Adresse löschen";
56)   $section = 'vmail_vmail';
57) 
58)   $account = get_account_details( (int) $_GET['id'] );
59) 
60)   $domain = NULL;
61)   $domains = get_vmail_domains();
62)   foreach ($domains as $dom)
63)     if ($dom->id == $account['domain'])
64)     {
65)       $domain = $dom->domainname;
66)       break;
67)     }
68)   $account_string = $account['local'] . "@" . $domain;
69)   $sure = user_is_sure();
70)   if ($sure === NULL)
71)   {
72)     are_you_sure("action=delete&amp;id={$account['id']}", "Möchten Sie die E-Mail-Adresse »{$account_string}« wirklich löschen?");
73)   }
74)   elseif ($sure === true)
75)   {
76)     delete_account($account['id']);
77)     if (! $debugmode)
78)       header("Location: accounts.php");
79)   }
80)   elseif ($sure === false)
81)   {
82)     if (! $debugmode)
83)       header("Location: accounts.php");
84)   }