bernd commited on 2008-04-03 16:02:28
Zeige 7 geänderte Dateien mit 56 Einfügungen und 44 Löschungen.
git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@1016 87cf0b9e-d624-0410-a070-f6ee81989793
... | ... |
@@ -1,19 +1,30 @@ |
1 | 1 |
<?php |
2 | 2 |
|
3 | 3 |
require_once('session/start.php'); |
4 |
- |
|
5 | 4 |
require_once('vmail.php'); |
5 |
+require_once('mailaccounts.php'); |
|
6 | 6 |
|
7 |
-require_role(ROLE_VMAIL_ACCOUNT); |
|
7 |
+require_role(array(ROLE_VMAIL_ACCOUNT, ROLE_MAILACCOUNT)); |
|
8 | 8 |
|
9 |
-$accname = $_SESSION['mailaccount']; |
|
9 |
+$role = $_SESSION['role']; |
|
10 | 10 |
|
11 | 11 |
$title = "Passwort ändern"; |
12 | 12 |
|
13 |
+ |
|
14 |
+ |
|
13 | 15 |
if ($_POST['password1'] != '') |
14 | 16 |
{ |
15 |
- check_form_token('vmail_chpass'); |
|
16 |
- $result = find_role($_SESSION['mailaccount'], $_POST['old_password']); |
|
17 |
+ $accname = ''; |
|
18 |
+ if ($role & ROLE_VMAIL_ACCOUNT) |
|
19 |
+ { |
|
20 |
+ $accname = $_SESSION['accountname']; |
|
21 |
+ } |
|
22 |
+ elseif ($role & ROLE_MAILACCOUNT) |
|
23 |
+ { |
|
24 |
+ $accname = $_SESSION['mailaccount']; |
|
25 |
+ } |
|
26 |
+ check_form_token('email_chpass'); |
|
27 |
+ $result = find_role($accname, $_POST['old_password']); |
|
17 | 28 |
|
18 | 29 |
if ($_POST['old_password'] == '') |
19 | 30 |
input_error('Altes Passwort nicht angegeben!'); |
... | ... |
@@ -26,7 +37,16 @@ if ($_POST['password1'] != '') |
26 | 37 |
elseif (($check = strong_password($_POST['password1'])) !== true) |
27 | 38 |
input_error("Das Passwort ist zu einfach (cracklib sagt: {$check})!"); |
28 | 39 |
else { |
40 |
+ if ($role & ROLE_VMAIL_ACCOUNT) |
|
41 |
+ { |
|
42 |
+ DEBUG("Ändere VMail-Passwort"); |
|
29 | 43 |
change_vmail_password($accname, $_POST['password1']); |
44 |
+ } |
|
45 |
+ elseif ($role & ROLE_MAILACCOUNT) |
|
46 |
+ { |
|
47 |
+ DEBUG("Ändere IMAP-Passwort"); |
|
48 |
+ change_mailaccount(get_mailaccount_id($accname), array('password' => $_POST['password1'])); |
|
49 |
+ } |
|
30 | 50 |
if (! $debugmode) |
31 | 51 |
header('Location: chpass.php'); |
32 | 52 |
else |
... | ... |
@@ -38,7 +58,7 @@ if ($_POST['password1'] != '') |
38 | 58 |
|
39 | 59 |
output('<h3>Passwort ändern</h3> |
40 | 60 |
<p>Hier können Sie Ihr Passwort ändern.</p> |
41 |
-'.html_form('vmail_chpass', 'chpass.php', '', '<table> |
|
61 |
+'.html_form('email_chpass', 'chpass.php', '', '<table> |
|
42 | 62 |
<tr> |
43 | 63 |
<td>bisheriges Passwort:</td> <td><input type="password" name="old_password" value="" /></td> |
44 | 64 |
</tr> |
... | ... |
@@ -54,6 +74,3 @@ output('<h3>Passwort ändern</h3> |
54 | 74 |
')); |
55 | 75 |
|
56 | 76 |
|
57 |
- |
|
58 |
- |
|
59 |
-?> |
... | ... |
@@ -16,7 +16,7 @@ if (isset($_GET['action']) && $_GET['action'] == 'save') |
16 | 16 |
{ |
17 | 17 |
if (isset($_GET['id'])) |
18 | 18 |
{ |
19 |
- check_form_token('imap_accounts_edit'); |
|
19 |
+ check_form_token('email_imap_edit'); |
|
20 | 20 |
$account = $_POST['user'].'@'.$_POST['domain']; |
21 | 21 |
if (isset($_POST['enabled']) && $_POST['enabled'] == 'true') |
22 | 22 |
$enabled = 'Y'; |
... | ... |
@@ -36,13 +36,13 @@ if (isset($_GET['action']) && $_GET['action'] == 'save') |
36 | 36 |
{ |
37 | 37 |
change_mailaccount($_GET['id'], $acc); |
38 | 38 |
if (! $debugmode) |
39 |
- header('Location: accounts.php'); |
|
39 |
+ header('Location: imap.php'); |
|
40 | 40 |
die(); |
41 | 41 |
} |
42 | 42 |
} |
43 | 43 |
elseif (isset($_POST['create'])) |
44 | 44 |
{ |
45 |
- check_form_token('imap_accounts_create'); |
|
45 |
+ check_form_token('email_imap_create'); |
|
46 | 46 |
$account = $_POST['user'].'@'.$_POST['domain']; |
47 | 47 |
if (isset($_POST['enabled']) && $_POST['enabled'] == 'true') |
48 | 48 |
$enabled = 'Y'; |
... | ... |
@@ -61,7 +61,7 @@ if (isset($_GET['action']) && $_GET['action'] == 'save') |
61 | 61 |
{ |
62 | 62 |
create_mailaccount($acc); |
63 | 63 |
if (! $debugmode) |
64 |
- header('Location: accounts.php'); |
|
64 |
+ header('Location: imap.php'); |
|
65 | 65 |
die(); |
66 | 66 |
} |
67 | 67 |
} |
... | ... |
@@ -78,7 +78,7 @@ elseif (isset($_GET['action']) && $_GET['action'] == 'create') |
78 | 78 |
output('<h3>E-Mail-Account anlegen</h3> |
79 | 79 |
<p>Hier können Sie ein neues POP3/IMAP-Konto anlegen.</p> |
80 | 80 |
<p style="border: 2px solid red; background-color: white; padding:1em;"><strong>ACHTUNG:</strong> ein POP3-/IMAP-Account ist <strong>keine E-Mail-Adresse</strong>. Wenn Sie sich nicht sicher sind, lesen Sie bitte die Anleitung <a href="https://wiki.schokokeks.org/E-Mail/Konfiguration">in unserem Wiki</a>. Sie können Ihre E-Mail-Konten auch über eine einfachere Möglichkeit verwalten, dann ist eine Einrichtung über diese Weboberfläche möglich. Die Umstellung erfolgt <a href="../vmail/domains.php">unter Domains</a>.</p> |
81 |
- '.html_form('imap_accounts_create', 'accounts.php', 'action=save', ' |
|
81 |
+ '.html_form('email_imap_create', 'imap.php', 'action=save', ' |
|
82 | 82 |
<table style="margin-bottom: 1em;"> |
83 | 83 |
<tr><th>Einstellung:</th><th>Wert:</th><th> </th></tr> |
84 | 84 |
<tr> |
... | ... |
@@ -131,13 +131,13 @@ elseif (isset($_GET['action']) && $_GET['action'] == 'delete' && $_GET['account' |
131 | 131 |
{ |
132 | 132 |
delete_mailaccount($_GET['account']); |
133 | 133 |
if (! $debugmode) |
134 |
- header('Location: accounts.php'); |
|
134 |
+ header('Location: imap.php'); |
|
135 | 135 |
die(); |
136 | 136 |
} |
137 | 137 |
elseif ($sure === false) |
138 | 138 |
{ |
139 | 139 |
if (! $debugmode) |
140 |
- header("Location: accounts.php"); |
|
140 |
+ header("Location: imap.php"); |
|
141 | 141 |
die(); |
142 | 142 |
} |
143 | 143 |
} |
... | ... |
@@ -182,7 +182,7 @@ elseif (isset($_GET['edit'])) |
182 | 182 |
<p><input type="submit" value="Änderungen speichern" /><br /> |
183 | 183 |
Hinweis: Das Passwort wird nur geändert, wenn Sie auf dieser Seite eines eingeben. Geben Sie keines an, wird das bisherige beibehalten!</p> |
184 | 184 |
'; |
185 |
- output(html_form('imap_accounts_edit', 'accounts.php', 'action=save&id='.$_GET['edit'], $form)); |
|
185 |
+ output(html_form('email_imap_edit', 'imap.php', 'action=save&id='.$_GET['edit'], $form)); |
|
186 | 186 |
} |
187 | 187 |
else |
188 | 188 |
{ |
... | ... |
@@ -198,13 +198,13 @@ else |
198 | 198 |
if (empty($mailbox)) |
199 | 199 |
$mailbox = '<i>nicht festgelegt</i>'; |
200 | 200 |
output('<tr> |
201 |
- <td>'.internal_link('accounts.php', $account['account'], 'edit='.$account['id']).'</td> |
|
201 |
+ <td>'.internal_link('imap.php', $account['account'], 'edit='.$account['id']).'</td> |
|
202 | 202 |
<td>'.$mailbox.'</td> |
203 | 203 |
<td><b>'.($account['enabled'] ? 'Ja' : 'Nein').'</b></td> |
204 |
- <td><a href="accounts.php?action=delete&account='.$account['id'].'">löschen</a></td></tr>'); |
|
204 |
+ <td><a href="imap.php?action=delete&account='.$account['id'].'">löschen</a></td></tr>'); |
|
205 | 205 |
} |
206 | 206 |
output('</table> |
207 |
-<p><a href="accounts.php?action=create">Neuen Account anlegen</a></p> |
|
207 |
+<p><a href="imap.php?action=create">Neuen Account anlegen</a></p> |
|
208 | 208 |
|
209 | 209 |
'); |
210 | 210 |
} |
... | ... |
@@ -0,0 +1,13 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+function encrypt_mail_password($pw) |
|
4 |
+{ |
|
5 |
+ DEBUG("unencrypted PW: ".$pw); |
|
6 |
+ require_once('inc/base.php'); |
|
7 |
+ $salt = random_string(8); |
|
8 |
+ $encpw = crypt($pw, "\$1\${$salt}\$"); |
|
9 |
+ DEBUG("encrypted PW: ".$encpw); |
|
10 |
+ return chop($encpw); |
|
11 |
+ |
|
12 |
+} |
|
13 |
+ |
... | ... |
@@ -7,6 +7,8 @@ require_once('inc/security.php'); |
7 | 7 |
|
8 | 8 |
require_once('class/domain.php'); |
9 | 9 |
|
10 |
+require_once('common.php'); |
|
11 |
+ |
|
10 | 12 |
function mailaccounts($uid) |
11 | 13 |
{ |
12 | 14 |
$uid = (int) $uid; |
... | ... |
@@ -30,17 +32,6 @@ function get_mailaccount($id) |
30 | 32 |
return $ret; |
31 | 33 |
} |
32 | 34 |
|
33 |
-function encrypt_mail_password($pw) |
|
34 |
-{ |
|
35 |
- DEBUG("unencrypted PW: ".$pw); |
|
36 |
- require_once('inc/base.php'); |
|
37 |
- $salt = random_string(8); |
|
38 |
- $encpw = crypt($pw, "\$1\${$salt}\$"); |
|
39 |
- DEBUG("encrypted PW: ".$encpw); |
|
40 |
- return chop($encpw); |
|
41 |
- |
|
42 |
-} |
|
43 |
- |
|
44 | 35 |
function change_mailaccount($id, $arr) |
45 | 36 |
{ |
46 | 37 |
$id = (int) $id; |
... | ... |
@@ -4,6 +4,8 @@ require_once('inc/debug.php'); |
4 | 4 |
|
5 | 5 |
require_once('hasdomain.php'); |
6 | 6 |
|
7 |
+require_once('common.php'); |
|
8 |
+ |
|
7 | 9 |
function empty_account() |
8 | 10 |
{ |
9 | 11 |
$account = array( |
... | ... |
@@ -113,17 +115,6 @@ function domainselect($selected = NULL, $selectattribute = '') |
113 | 115 |
} |
114 | 116 |
|
115 | 117 |
|
116 |
-function encrypt_mail_password($pw) |
|
117 |
-{ |
|
118 |
- DEBUG("unencrypted PW: ".$pw); |
|
119 |
- require_once('inc/base.php'); |
|
120 |
- $salt = random_string(8); |
|
121 |
- $encpw = crypt($pw, "\$1\${$salt}\$"); |
|
122 |
- DEBUG("encrypted PW: ".$encpw); |
|
123 |
- return chop($encpw); |
|
124 |
- |
|
125 |
-} |
|
126 |
- |
|
127 | 118 |
|
128 | 119 |
|
129 | 120 |
function save_vmail_account($account) |
... | ... |
@@ -100,7 +100,7 @@ output('<h3>E-Mail-Accounts</h3> |
100 | 100 |
output('<p><a href="edit.php">Neuen Account anlegen</a></p>'); |
101 | 101 |
|
102 | 102 |
/* FIXME: Das sollte nur kommen, wenn der IMAP/POP3-Menü-Eintrag nicht da ist */ |
103 |
-output('<p style="font-size: 90%;padding-top: 0.5em; border-top: 1px solid black;">Hinweis: schokokeks.org bietet für fortgeschrittene Nutzer die manuelle Einrichtung von POP3/IMAP-Accounts.<br/><a href="'.$prefix.'go/imap/accounts.php?action=create">Neuen POP3/IMAP-Account anlegen</a></p>'); |
|
103 |
+output('<p style="font-size: 90%;padding-top: 0.5em; border-top: 1px solid black;">Hinweis: schokokeks.org bietet für fortgeschrittene Nutzer die manuelle Einrichtung von POP3/IMAP-Accounts.<br/><a href="imap.php?action=create">Neuen POP3/IMAP-Account anlegen</a></p>'); |
|
104 | 104 |
|
105 | 105 |
} |
106 | 106 |
|
107 | 107 |