Bernd Wurst commited on 2013-03-12 08:41:29
Zeige 3 geänderte Dateien mit 31 Einfügungen und 2 Löschungen.
| ... | ... |
@@ -142,7 +142,7 @@ if ($role != ROLE_ANONYMOUS) {
|
| 142 | 142 |
$userinfo .= '<br />(Kunde '.$_SESSION['customerinfo']['customerno'].')'; |
| 143 | 143 |
} |
| 144 | 144 |
elseif ($role & (ROLE_MAILACCOUNT | ROLE_VMAIL_ACCOUNT)) {
|
| 145 |
- $userinfo .= '<strong>'.$_SESSION['mailaccount'].'</strong><br />(E-Mail-Account)'; |
|
| 145 |
+ $userinfo .= '<strong>'.$_SESSION['mailaccount'].'</strong><br />(Postfach von Benutzer <em>'.$_SESSION['userinfo']['username'].'</em>)'; |
|
| 146 | 146 |
} |
| 147 | 147 |
$userinfo .= '</p>'; |
| 148 | 148 |
} |
| ... | ... |
@@ -316,7 +316,11 @@ $form .= '</div>'; |
| 316 | 316 |
$form .= '<p><a href="#" onclick="moreForward();">'.icon_add().' Weiteren Empfänger hinzufügen</a></p> |
| 317 | 317 |
</div>'; |
| 318 | 318 |
|
| 319 |
-$form .= '<p><input type="submit" value="Speichern" />    '.internal_link('vmail', 'Abbrechen').'</p>';
|
|
| 319 |
+$target = 'vmail'; |
|
| 320 |
+if ($accountlogin) {
|
|
| 321 |
+ $target = '../index/index'; |
|
| 322 |
+} |
|
| 323 |
+$form .= '<p><input type="submit" value="Speichern" />    '.internal_link($target, 'Abbrechen').'</p>'; |
|
| 320 | 324 |
|
| 321 | 325 |
output(html_form('vmail_edit_mailbox', 'save', 'action=edit'.($id != 0 ? '&id='.$id : ''), $form));
|
| 322 | 326 |
|
| ... | ... |
@@ -266,6 +266,27 @@ function set_systemuser_password($uid, $newpass) |
| 266 | 266 |
} |
| 267 | 267 |
|
| 268 | 268 |
|
| 269 |
+function user_for_mailaccount($account) |
|
| 270 |
+{
|
|
| 271 |
+ $result = db_query("SELECT uid FROM mail.courier_mailaccounts WHERE account='{$account}' LIMIT 1;");
|
|
| 272 |
+ if (mysql_num_rows($result) != 1) {
|
|
| 273 |
+ system_failure('Diese Adresse ist herrenlos?!');
|
|
| 274 |
+ } |
|
| 275 |
+ $tmp = mysql_fetch_assoc($result); |
|
| 276 |
+ return $tmp['uid']; |
|
| 277 |
+} |
|
| 278 |
+ |
|
| 279 |
+function user_for_vmail_account($account) |
|
| 280 |
+{
|
|
| 281 |
+ $result = db_query("SELECT useraccount FROM mail.v_vmail_accounts WHERE CONCAT_WS('@', local, domainname)='{$account}' LIMIT 1;");
|
|
| 282 |
+ if (mysql_num_rows($result) != 1) {
|
|
| 283 |
+ system_failure('Diese Adresse ist herrenlos?!');
|
|
| 284 |
+ } |
|
| 285 |
+ $tmp = mysql_fetch_assoc($result); |
|
| 286 |
+ return $tmp['useraccount']; |
|
| 287 |
+} |
|
| 288 |
+ |
|
| 289 |
+ |
|
| 269 | 290 |
function setup_session($role, $useridentity) |
| 270 | 291 |
{
|
| 271 | 292 |
session_regenerate_id(); |
| ... | ... |
@@ -304,13 +325,17 @@ function setup_session($role, $useridentity) |
| 304 | 325 |
$id = $useridentity; |
| 305 | 326 |
if (! strstr($id, '@')) |
| 306 | 327 |
$id .= '@'.config('masterdomain');
|
| 328 |
+ $uid = user_for_mailaccount($id); |
|
| 307 | 329 |
$_SESSION['mailaccount'] = $id; |
| 330 |
+ $_SESSION['userinfo'] = get_user_info($uid); |
|
| 308 | 331 |
DEBUG("We are mailaccount: {$_SESSION['mailaccount']}");
|
| 309 | 332 |
} |
| 310 | 333 |
if ($role & ROLE_VMAIL_ACCOUNT) |
| 311 | 334 |
{
|
| 312 | 335 |
$id = $useridentity; |
| 336 |
+ $uid = user_for_vmail_account($id); |
|
| 313 | 337 |
$_SESSION['mailaccount'] = $id; |
| 338 |
+ $_SESSION['userinfo'] = get_user_info($uid); |
|
| 314 | 339 |
DEBUG("We are virtual mailaccount: {$_SESSION['mailaccount']}");
|
| 315 | 340 |
} |
| 316 | 341 |
|
| 317 | 342 |