modules/email/edit.php
90ff5748
 <?php
 
 require_once('inc/debug.php');
 require_once('inc/security.php');
 
 require_once('vmail.php');
 
 $title = "E-Mail-Adresse bearbeiten";
3000accf
 $section = 'email_vmail';
90ff5748
 require_role(ROLE_SYSTEMUSER);
 
 $id = (int) $_GET['id'];
684c6a6c
 $account = empty_account();
90ff5748
 
 if ($id != 0)
   $account = get_account_details($id);
 
 DEBUG($account);
 if ($id == 0) {
   output("<h3>Neue E-Mail-Adresse anlegen</h3>");
   $title = "E-Mail-Adresse anlegen";
 }
 else {
   output("<h3>E-Mail-Adresse bearbeiten</h3>");
 }
 
 
83d84151
 $is_forward = (count($account['forwards']) > 0);
 $is_mailbox = ($account['password'] != NULL  ||  $id == 0);
 $numforwards = max(count($account['forwards']), 1);
90ff5748
 
c2fdf5e3
 output("<script type=\"text/javascript\">
   
83d84151
   var numForwards = {$numforwards};
c2fdf5e3
 
   function moreForward()
   {
     numForwards += 1;
 
4912d233
     P1 = document.createElement('p');
 
     TXT1 = document.createTextNode('Weiterleiten an ');
c2fdf5e3
 
     INPUT = document.createElement('input');
     INPUT.type = 'text';
     INPUT.name = 'forward_to_' + numForwards;
     INPUT.value = '';
 
4912d233
     P1.appendChild(TXT1);
     P1.appendChild(INPUT);
 
     P2 = document.createElement('p');
 
     TXT2 = document.createTextNode('Spam-Mails an diese Adresse ');
 
c2fdf5e3
     SELECT = document.createElement('select');
     SELECT.name = 'spamfilter_action_' + numForwards;
 
caf209e2
     SELECT.options[0] = new Option('nicht filtern', 'none', 1);
13eb3efd
     SELECT.options[1] = new Option('markieren und zustellen', 'tag', 0);
c2fdf5e3
     SELECT.options[2] = new Option('nicht zustellen', 'delete', 0);
 
4912d233
     P2.appendChild(TXT2);
     P2.appendChild(SELECT);
 
     DIV = document.createElement('div');
     DIV.className = 'vmail-forward';
c2fdf5e3
 
4912d233
     DIV.appendChild(P1);
     DIV.appendChild(P2);
c2fdf5e3
 
4912d233
     parent = document.getElementById('forward_config');
     parent.appendChild(DIV);
c2fdf5e3
   }
 </script>
 ");
90ff5748
 
 $form = "
11811ac9
     <p><strong>E-Mail-Adresse:</strong>&#160;<input type=\"text\" name=\"local\" id=\"local\" size=\"10\" value=\"{$account['local']}\" /><strong style=\"font-size: 1.5em;\">&#160;@&#160;</strong>".domainselect($account['domain'])."</p>";
90ff5748
 
 $password_message = '';
47f0f8f9
 $password_value = '';
83d84151
 if ($is_mailbox and ($account['password'] != ''))
47f0f8f9
 {
79544fe5
   $password_message = '<span style="font-size: 80%"><br /><em>Sie haben bereits ein Passwort gesetzt. Wenn Sie dieses Feld nicht ändern, wird das bisherige Passwort beibehalten.</em></span>';
47f0f8f9
   $password_value = '**********';
 } 
90ff5748
 
c2fdf5e3
 $form .= "
79544fe5
     <p><input type=\"checkbox\" id=\"mailbox\" name=\"mailbox\" value=\"yes\" ".($is_mailbox ? 'checked="checked" ' : '')." /><label for=\"mailbox\">&#160;<strong>In Mailbox speichern</strong></label></p>
47f0f8f9
     <p style=\"margin-left: 2em;\" id=\"mailbox_options\">Passwort für Abruf:&#160;<input type=\"password\" id=\"password\" name=\"password\" value=\"{$password_value}\" />{$password_message}</p>";
c2fdf5e3
 
79544fe5
 $form.= "<p style=\"margin-left: 2em;\" class=\"spamfilter_options\">Unerwünschte E-Mails (Spam, Viren) in diesem Postfach ".html_select('spamfilter_action', array("none" => 'nicht filtern', "folder" => 'in Unterordner »Spam« ablegen', "tag" => 'markieren und zustellen', "delete" => 'nicht zustellen (löschen)'), $account['spamfilter'])."</p>";
c2fdf5e3
 
79544fe5
 $form .= "<p><input type=\"checkbox\" id=\"forward\" name=\"forward\" value=\"yes\" ".($is_forward ? 'checked="checked" ' : '')." /><label for=\"forward\">&#160;<strong>Weiterleitung an andere E-Mail-Adressen</strong></label></p>";
c2fdf5e3
 
4912d233
 
 $form .= "<div style=\"margin-left: 2em;\" id=\"forward_config\">";
c2fdf5e3
 
83d84151
 if ($is_forward)
 {
   for ($i = 0 ; $i < $numforwards ; $i++)
   {
4912d233
     $num = $i+1;
     $form .= "<div class=\"vmail-forward\">
     <p>Weiterleiten an <input type=\"text\" id=\"forward_to_{$num}\" name=\"forward_to_{$num}\" value=\"{$account['forwards'][$i]['destination']}\" /></p>
     <p>Spam-Mails an diese Adresse ".html_select('spamfilter_action_'.$num, array("none" => 'nicht filtern', "tag" => 'markieren und zustellen', "delete" => 'nicht zustellen'), $account['forwards'][$i]['spamfilter'])."</p>
     </div>\n";
83d84151
   }
 }
 else
 {
4912d233
     $form .= "<div class=\"vmail-forward\">
     <p>Weiterleiten an <input type=\"text\" id=\"forward_to_1\" name=\"forward_to_1\" value=\"\" /></p>
     <p>Spam-Mails an diese Adresse ".html_select('spamfilter_action_1', array("none" => 'nicht filtern', "tag" => 'markieren und zustellen', "delete" => 'nicht zustellen'), "none")."</p>
     </div>\n";
83d84151
 }
 
4912d233
 $form .= '</div>';
 
 $form .= '<p style="margin-left: 2em;">[ <a href="#" onclick="moreForward();">mehr Empfänger</a> ]</p>
63a0529b
   <p><input type="submit" value="Speichern" />&#160;&#160;&#160;&#160;'.internal_link('accounts', 'Abbrechen').'</p>';
90ff5748
 
63a0529b
 output(html_form('vmail_edit_mailbox', 'save', 'action=edit'.($id != 0 ? '&id='.$id : ''), $form));
90ff5748
 
 
 ?>