Commit f798aa09 authored by Falko Timme's avatar Falko Timme

- Implemented FS#3310 - add support for multiple email addresses in send copy to field (patch).

parent a01d1a3a
......@@ -1302,7 +1302,7 @@ class tform {
$perm = $app->db->quote($perm);
$table = $app->db->quote($table);
if($_SESSION["s"]["user"]["typ"] == 'admin') {
if($_SESSION["s"]["user"]["typ"] == 'admin' || $_SESSION['s']['user']['mailuser_id'] > 0) {
return '1';
} else {
if ($table != ''){
......
......@@ -160,7 +160,7 @@ $form["tabs"]['mailuser'] = array(
'type' => 'TOLOWER')
),
'validators' => array ( 0 => array ( 'type' => 'REGEX',
'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,1}$/i',
'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,1}(,\s*\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,}$/i',
'errmsg'=> 'cc_error_isemail'),
),
'default' => '',
......
......@@ -48,4 +48,5 @@ $wb['repeat_password_txt'] = 'Passwort wiederholen';
$wb['password_mismatch_txt'] = 'Die Passwörter stimmen nicht überein.';
$wb['password_match_txt'] = 'Die Passwörter stimmen überein.';
$wb['email_error_isascii'] = 'Bitte verwenden Sie keine Umlaute im Passwort. Dies kann zu Problemen mit Ihrem E-Mail-Programm führen.';
$wb['cc_note_txt'] = '(Mehrere E-Mail-Adressen mit Kommas trennen)';
?>
\ No newline at end of file
......@@ -48,4 +48,5 @@ $wb['repeat_password_txt'] = 'Repeat Password';
$wb['password_mismatch_txt'] = 'The passwords do not match.';
$wb['password_match_txt'] = 'The passwords do match.';
$wb['email_error_isascii'] = 'Please do not use special unicode characters for your password. This could lead to problems with your mail client.';
$wb['cc_note_txt'] = '(Separate multiple email addresses with commas)';
?>
......@@ -42,7 +42,7 @@
</div>
<div class="ctrlHolder">
<label for="name">{tmpl_var name='cc_txt'}</label>
<input name="cc" id="cc" value="{tmpl_var name='cc'}" size="30" maxlength="255" type="text" class="textInput" /> &nbsp; {tmpl_var name='name_optional_txt'}
<input name="cc" id="cc" value="{tmpl_var name='cc'}" size="30" maxlength="255" type="text" class="textInput" /> &nbsp; {tmpl_var name='name_optional_txt'} {tmpl_var name='cc_note_txt'}
</div>
<div class="ctrlHolder">
<label for="policy">{tmpl_var name='policy_txt'}</label>
......
......@@ -69,7 +69,8 @@ $form["tabs"]['mailuser'] = array (
'type' => 'TOLOWER')
),
'validators' => array ( 0 => array ( 'type' => 'REGEX',
'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\w+\.[a-z\-]{2,10}){0,1}$/i',
//'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\w+\.[a-z\-]{2,10}){0,1}$/i',
'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,1}(,\s*\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,}$/i',
'errmsg'=> 'cc_error_isemail'),
),
'default' => '',
......
......@@ -4,4 +4,6 @@ $wb['cc_txt'] = 'Kopie senden an';
$wb['email_txt'] = 'E-Mail';
$wb['cc_error_isemail'] = 'E-Mail Adresse ungültig im -Kopie senden an- Feld';
$wb['email_is_cc_error'] = 'E-Mail Adresse und ';
$wb['name_optional_txt'] = '(optional)';
$wb['cc_note_txt'] = '(Mehrere E-Mail-Adressen mit Kommas trennen)';
?>
\ No newline at end of file
......@@ -4,4 +4,6 @@ $wb["cc_txt"] = 'Send copy to';
$wb["email_txt"] = 'Email';
$wb["cc_error_isemail"] = 'Email address invalid in -Send copy to- field';
$wb["email_is_cc_error"] = 'Email address and send copy to address can not be the same.';
$wb["name_optional_txt"] = '(Optional)';
$wb['cc_note_txt'] = '(Separate multiple email addresses with commas)';
?>
\ No newline at end of file
......@@ -51,7 +51,8 @@ $app->load('tform_actions');
class page_action extends tform_actions {
function onShow() {
global $app;
$this->id = $app->functions->intval($_SESSION['s']['user']['mailuser_id']);
parent::onShow();
......
......@@ -11,7 +11,7 @@
</div>
<div class="ctrlHolder">
<label for="name">{tmpl_var name='cc_txt'}</label>
<input name="cc" id="cc" value="{tmpl_var name='cc'}" size="30" maxlength="255" type="text" class="textInput" /> &nbsp; {tmpl_var name='name_optional_txt'}
<input name="cc" id="cc" value="{tmpl_var name='cc'}" size="30" maxlength="255" type="text" class="textInput" /> &nbsp; {tmpl_var name='name_optional_txt'} {tmpl_var name='cc_note_txt'}
</div>
</fieldset>
......
......@@ -2,7 +2,9 @@ require ["fileinto", "regex", "vacation"];
<tmpl_if name="cc">
# Send a copy of email to
redirect "<tmpl_var name='cc'>";
<tmpl_loop name="ccloop">
redirect "<tmpl_var name='address'>";
</tmpl_loop>
</tmpl_if>
<tmpl_if name="move_junk" op="==" value="y">
......
......@@ -2,7 +2,9 @@ require ["fileinto", "regex", "date", "relational", "vacation"];
<tmpl_if name="cc">
# Send a copy of email to
redirect "<tmpl_var name='cc'>";
<tmpl_loop name="ccloop">
redirect "<tmpl_var name='address'>";
</tmpl_loop>
</tmpl_if>
<tmpl_if name="move_junk" op="==" value="y">
......
......@@ -120,7 +120,14 @@ class maildeliver_plugin {
$tpl->newTemplate($filter_file_template);
// cc Field
$tmp_mails_arr = explode(',',$data["new"]["cc"]);
$tmp_addresses_arr = array();
foreach($tmp_mails_arr as $address) {
if(trim($address) != '') $tmp_addresses_arr[] = array('address' => trim($address));
}
$tpl->setVar('cc', $data["new"]["cc"]);
$tpl->setLoop('ccloop', $tmp_addresses_arr);
// Custom filters
$tpl->setVar('custom_mailfilter', $data["new"]["custom_mailfilter"]);
......
......@@ -192,7 +192,11 @@ class maildrop_plugin {
$mailfilter_content = '';
if($data["new"]["cc"] != '') {
$mailfilter_content .= "cc \"!".$data["new"]["cc"]."\"\n";
$tmp_mails_arr = explode(',',$data["new"]["cc"]);
foreach($tmp_mails_arr as $address) {
if(trim($address) != '') $mailfilter_content .= "cc \"!".trim($address)."\"\n";
}
//$mailfilter_content .= "cc \"!".$data["new"]["cc"]."\"\n";
$app->log("Added CC address ".$data["new"]["cc"].' to mailfilter file.', LOGLEVEL_DEBUG);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment