a15eafe2a3c88e7ad47d04bcf9b738cfcd4f9732
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 diverse spezial/fehlerfälle...

bernd authored 16 years ago

26)   if (($account['password'] == '') && ($_POST['mailbox'] == 'yes'))
27)     system_failure("Sie haben ein leeres Passwort eingegeben!");
bernd Sterne in das Passwort-Feld...

bernd authored 16 years ago

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

bernd authored 16 years ago

30)   if ($_POST['mailbox'] != 'yes')
bernd Setze Spamfilter=none wenn...

bernd authored 16 years ago

31)   {
bernd Anpassung auf neues Interface

bernd authored 16 years ago

32)     $account['password'] = NULL;
bernd Setze Spamfilter=none wenn...

bernd authored 16 years ago

33)     $account['spamfilter'] = 'none';
34)   }
bernd Anpassung auf neues Interface

bernd authored 16 years ago

35) 
36)   if ($_POST['forward'] == 'yes')
37)   {
38)     $num = 1;
39)     while (true)
40)     {
41)       if (! isset($_POST['forward_to_'.$num]))
42)         break;
bernd Bugfixes

bernd authored 16 years ago

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

bernd authored 16 years ago

45)       $fwd = array("spamfilter" => $_POST['spamfilter_action_'.$num], "destination" => $_POST['forward_to_'.$num]);
46)       array_push($account['forwards'], $fwd);
47)       $num++;
48)     }
bernd diverse spezial/fehlerfälle...

bernd authored 16 years ago

49)     if ($num == 1) system_failure("Bitte mindestens eine Weiterleitungsadresse angeben.");
bernd Anpassung auf neues Interface

bernd authored 16 years ago

50)   }
bernd diverse spezial/fehlerfälle...

bernd authored 16 years ago

51) 
52)   if (($_POST['forward']!='yes') && ($_POST['mailbox']!='yes'))
53)     system_failure("Entweder eine Mailbox oder eine Weiterleitung muss angegeben werden!");
bernd Erste Version des vmail-Modul

bernd authored 16 years ago

54) 
55)   DEBUG($account);
56) 
57)   save_vmail_account($account);
58) 
59)   if (! ($debugmode || we_have_an_error()))
60)     header('Location: accounts.php');
bernd Löschen geht jetzt auch

bernd authored 16 years ago

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