45b069aa21eaa745c2927fde0c271dd0b36374dc
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'];
26)   if ($_POST['mailbox'] != 'yes')
27)     $account['password'] = NULL;
28) 
29)   if ($_POST['forward'] == 'yes')
30)   {
31)     $num = 1;
32)     while (true)
33)     {
34)       if (! isset($_POST['forward_to_'.$num]))
35)         break;
bernd Bugfixes

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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