Skip to content

Commit d4d1ead

Browse files
author
Marius Cramer
committed
Merge remote-tracking branch 'origin/stable-3.0.5'
Conflicts: interface/lib/classes/tpl.inc.php interface/web/mail/lib/lang/de_spamfilter_blacklist.lng interface/web/mail/lib/lang/de_spamfilter_users.lng interface/web/mail/lib/lang/de_spamfilter_whitelist.lng server/lib/classes/tpl.inc.php
2 parents f0bed3a + 42b689d commit d4d1ead

18 files changed

+473
-504
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
ALTER TABLE `client`
2+
ADD `web_servers` blob NOT NULL DEFAULT '' AFTER `default_webserver`,
3+
ADD `mail_servers` blob NOT NULL DEFAULT '' AFTER `default_mailserver`,
4+
ADD `db_servers` blob NOT NULL DEFAULT '' AFTER `default_dbserver`,
5+
ADD `dns_servers` blob NOT NULL DEFAULT '' AFTER `default_dnsserver`;
6+
7+
UPDATE `client` SET `web_servers` = `default_webserver`, `mail_servers` = `default_mailserver`, `db_servers` = `default_dbserver`, `dns_servers` = `default_dnsserver` WHERE 1;

interface/lib/classes/ispcmail.inc.php

Lines changed: 79 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,72 @@ private function _smtp_close() {
638638
return true;
639639
}
640640

641+
private function _extract_names($data) {
642+
$senders = array();
643+
644+
$data = stripslashes(preg_replace("'(\t|\r|\n)'", '', $data));
645+
646+
if(trim($data) == '') return $senders;
647+
648+
$armail = array();
649+
$counter = 0; $inthechar = 0;
650+
$chartosplit = ',;'; $protectchar = '"'; $temp = '';
651+
$closed = 1;
652+
653+
for($i = 0; $i < strlen($data); $i++) {
654+
$thischar = $data[$i];
655+
if($thischar == '<' && $closed) $closed = 0;
656+
if($thischar == '>' && !$closed) $closed = 1;
657+
if($thischar == $protectchar) $inthechar = ($inthechar) ? 0 : 1;
658+
if((strpos($chartosplit, $thischar) !== false) && !$inthechar && $closed) {
659+
$armail[] = $temp;
660+
$temp = '';
661+
} else {
662+
$temp .= $thischar;
663+
}
664+
}
665+
666+
if(trim($temp) != '') {
667+
$armail[] = trim($temp);
668+
unset($temp);
669+
}
670+
671+
foreach($armail as $thisPart) {
672+
$thisPart = trim(preg_replace('/^"(.*)"$/i', '$1', trim($thisPart)));
673+
if($thisPart != '') {
674+
$email = '';
675+
$name = '';
676+
if(preg_match('/(.*)<(.*)>/i', $thisPart, $matches)) {
677+
$email = trim($matches[2]);
678+
$name = trim($matches[1]);
679+
} else {
680+
if(preg_match('/([-a-z0-9_$+.]+@[-a-z0-9_.]+[-a-z0-9_]+)((.*))/i', $thisPart, $matches)) {
681+
$email = $matches[1];
682+
$name = $matches[2];
683+
} else {
684+
$email = $thisPart;
685+
}
686+
}
641687

688+
$email = preg_replace('/<(.*)\\>/', '$1', $email);
689+
$name = preg_replace('/"(.*)"/', '$1', trim($name));
690+
$name = preg_replace('/\((.*)\)/', '$1', $name);
691+
692+
if($name == '') $name = $email;
693+
if($email == '') $email = $name;
694+
$senders[] = array(
695+
'name' => $name,
696+
'mail' => $email
697+
);
698+
unset($name);
699+
unset($email);
700+
}
701+
}
702+
unset($armail);
703+
unset($thisPart);
704+
705+
return $senders;
706+
}
642707

643708
/**
644709
* Send the mail to one or more recipients
@@ -683,6 +748,7 @@ public function send($recipients) {
683748
$result = $this->_smtp_login();
684749
if(!$result) return false;
685750
}
751+
$bcc_cc_sent = false;
686752
foreach($recipients as $recipname => $recip) {
687753
if($this->_sent_mails >= $this->smtp_max_mails) {
688754
// close connection to smtp and reconnect
@@ -705,6 +771,19 @@ public function send($recipients) {
705771
fputs($this->_smtp_conn, 'RCPT TO: <' . $recip . '>' . $this->_crlf);
706772
$response = fgets($this->_smtp_conn, 515);
707773

774+
if($bcc_cc_sent == false) {
775+
$add_recips = array();
776+
if($this->getHeader('Cc') != '') $add_recips = array_merge($add_recips, $this->_extract_names($this->getHeader('Cc')));
777+
if($this->getHeader('Bcc') != '') $add_recips = array_merge($add_recips, $this->_extract_names($this->getHeader('Bcc')));
778+
foreach($add_recips as $add_recip) {
779+
if(!$add_recip['mail']) continue;
780+
fputs($this->_smtp_conn, 'RCPT TO: <' . $this->_encodeHeader($add_recip['mail'], $this->mail_charset) . '>' . $this->_crlf);
781+
$response = fgets($this->_smtp_conn, 515);
782+
}
783+
unset($add_recips);
784+
$bcc_cc_sent = true;
785+
}
786+
708787
//The Email
709788
fputs($this->_smtp_conn, 'DATA' . $this->_crlf);
710789
$response = fgets($this->_smtp_conn, 515);
@@ -715,7 +794,6 @@ public function send($recipients) {
715794

716795
$mail_content = 'Subject: ' . $enc_subject . $this->_crlf;
717796
$mail_content .= 'To: ' . $this->getHeader('To') . $this->_crlf;
718-
if($this->getHeader('Bcc') != '') $mail_content .= 'Bcc: ' . $this->_encodeHeader($this->getHeader('Bcc'), $this->mail_charset) . $this->_crlf;
719797
if($this->getHeader('Cc') != '') $mail_content .= 'Cc: ' . $this->_encodeHeader($this->getHeader('Cc'), $this->mail_charset) . $this->_crlf;
720798
$mail_content .= implode($this->_crlf, $headers) . $this->_crlf . ($this->_is_signed == false ? $this->_crlf : '') . $this->body;
721799

interface/lib/classes/tpl.inc.php

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,12 @@ public function setVar($k, $v = null)
234234
if (is_array($k)) {
235235
foreach($k as $key => $value){
236236
$key = ($this->OPTIONS['CASELESS']) ? strtolower(trim($key)) : trim($key);
237-
if (preg_match('/^[A-Za-z]+[A-Za-z0-9_]*$/', $key) && $value !== null ) {
237+
if (preg_match('/^[A-Za-z_]+[A-Za-z0-9_]*$/', $key) && $value !== null ) {
238238
$this->_vars[$key] = $value;
239239
}
240240
}
241241
} else {
242-
if (preg_match('/^[A-Za-z]+[A-Za-z0-9_]*$/', $k) && $v !== null) {
242+
if (preg_match('/^[A-Za-z_]+[A-Za-z0-9_]*$/', $k) && $v !== null) {
243243
if ($this->OPTIONS['CASELESS']) $k = strtolower($k);
244244
$this->_vars[trim($k)] = $v;
245245
} else {
@@ -287,7 +287,7 @@ public function unsetVar()
287287
for ($i = 0; $i < $num_args; $i++) {
288288
$var = func_get_arg($i);
289289
if ($this->OPTIONS['CASELESS']) $var = strtolower($var);
290-
if (!preg_match('/^[A-Za-z]+[A-Za-z0-9_]*$/', $var)) continue;
290+
if (!preg_match('/^[A-Za-z_]+[A-Za-z0-9_]*$/', $var)) continue;
291291
unset($this->_vars[$var]);
292292
}
293293
return true;
@@ -344,7 +344,7 @@ public function setContextVars()
344344
*/
345345
public function setLoop($k, $v)
346346
{
347-
if (is_array($v) && preg_match('/^[A-Za-z]+[A-Za-z0-9_]*$/', $k)) {
347+
if (is_array($v) && preg_match('/^[A-Za-z_]+[A-Za-z0-9_]*$/', $k)) {
348348
$k = ($this->OPTIONS['CASELESS']) ? strtolower(trim($k)) : trim($k);
349349
$this->_arrvars[$k] = array();
350350
if ($this->OPTIONS['SET_LOOP_VAR'] && !empty($v)) $this->setvar($k, 1);
@@ -1006,7 +1006,8 @@ private function _arrayBuild($arr)
10061006
* @access private
10071007
* @return string used for eval'ing
10081008
*/
1009-
function _parseIf ($varname, $value=null, $op=null, $namespace=null, $format=null) {
1009+
private function _parseIf($varname, $value = null, $op = null, $namespace = null, $format = null)
1010+
{
10101011
if (isset($namespace)) $namespace = substr($namespace, 0, -1);
10111012
$comp_str = ''; // used for extended if statements
10121013

@@ -1046,14 +1047,14 @@ function _parseIf ($varname, $value=null, $op=null, $namespace=null, $format=nul
10461047
if ($this->OPTIONS['GLOBAL_VARS'] && empty($namespace)) {
10471048
$retstr = '(('.$retstr.'[\''.$varname.'\'] !== null) ? '.$retstr.'[\''.$varname.'\'] : $this->_vars[\''.$varname.'\'])';
10481049
if(isset($format) && isset($value) && $format == 'version') {
1049-
return 'version_compare(' . $retstr . ', \'' . $value . '\', ' . (!empty($op) ? $op : '==') . ')';
1050+
return 'version_compare(' . $retstr . ', \'' . $value . '\', \'' . (!empty($op) ? $op : '==') . '\')';
10501051
} else {
10511052
return $retstr.$comp_str;
10521053
}
10531054
}
10541055
else {
10551056
if(isset($format) && isset($value) && $format == 'version') {
1056-
return 'version_compare(' . $retstr."['".$varname."']" . ', \'' . $value . '\', ' . (!empty($op) ? $op : '==') . ')';
1057+
return 'version_compare(' . $retstr."['".$varname."']" . ', \'' . $value . '\', \'' . (!empty($op) ? $op : '==') . '\')';
10571058
} else {
10581059
return $retstr."['".$varname."']".$comp_str;
10591060
}
@@ -1183,8 +1184,7 @@ private function _parseTag ($args)
11831184
if ($tag == 'loop' || $tag == 'endloop') array_pop($this->_namespace);
11841185
if ($tag == 'comment' || $tag == 'endcomment') {
11851186
return '<?php */ ?>';
1186-
}
1187-
else {
1187+
} else {
11881188
return '<?php } ?>';
11891189
}
11901190
}
@@ -1207,6 +1207,7 @@ private function _parseTag ($args)
12071207
$$key = $match[2];
12081208
}
12091209
}
1210+
12101211
$var = ($this->OPTIONS['CASELESS']) ? strtolower($name) : $name;
12111212

12121213
if ($this->_debug && !empty($var)) {
@@ -1228,47 +1229,37 @@ private function _parseTag ($args)
12281229
if (empty($escape) && (!empty($this->OPTIONS['DEFAULT_ESCAPE']) && strtolower($this->OPTIONS['DEFAULT_ESCAPE']) != 'none')) {
12291230
$escape = strtolower($this->OPTIONS['DEFAULT_ESCAPE']);
12301231
}
1231-
return '<?php '.$this->_parseVar ($wholetag, $tag, $var, @$escape, @$format, @$namespace).' ?>'."\n";
1232-
break;
1232+
return '<?php '.$this->_parseVar ($wholetag, $tag, $var, @$escape, @$format, @$namespace)." ?>\n";
12331233

12341234
case 'if':
12351235
return '<?php if ('. $this->_parseIf($var, @$value, @$op, @$namespace, @$format) .') { ?>';
1236-
break;
12371236

12381237
case 'unless':
12391238
return '<?php if (!'. $this->_parseIf($var, @$value, @$op, @$namespace, @$format) .') { ?>';
1240-
break;
12411239

12421240
case 'elseif':
12431241
return '<?php } elseif ('. $this->_parseIf($var, @$value, @$op, @$namespace, @$format) .') { ?>';
1244-
break;
12451242

12461243
case 'loop':
12471244
return '<?php '. $this->_parseLoop($var) .'?>';
1248-
break;
12491245

12501246
case 'comment':
12511247
if (empty($var)) { // full open/close style comment
12521248
return '<?php /* ?>';
1253-
}
1254-
else { // just ignore tag if it was a one line comment
1249+
} else { // just ignore tag if it was a one line comment
12551250
return;
12561251
}
1257-
break;
12581252

12591253
case 'phpinclude':
12601254
if ($this->OPTIONS['ENABLE_PHPINCLUDE']) {
12611255
return '<?php include(\''.$file.'\'); ?>';
12621256
}
1263-
break;
12641257

12651258
case 'include':
12661259
return '<?php $this->_getData($this->_fileSearch(\''.$file.'\'), 1); ?>';
1267-
break;
12681260

12691261
case 'dyninclude':
12701262
return '<?php $this->_getData($this->_fileSearch($this->_dyninclude[\''.$name.'\']), 1); ?>';
1271-
break;
12721263

12731264
default:
12741265
if ($this->OPTIONS['STRICT']) vlibTemplateError::raiseError('VT_ERROR_INVALID_TAG', KILL, htmlspecialchars($wholetag, ENT_QUOTES));

interface/web/mail/form/spamfilter_blacklist.tform.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
'datatype' => 'INTEGER',
102102
'formtype' => 'SELECT',
103103
'default' => 5,
104-
'value' => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10)
104+
'value' => array(1 => '1 - lowest', 2 => 2, 3 => 3, 4 => 4, 5 => '5 - medium', 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => '10 - highest')
105105
),
106106
'active' => array (
107107
'datatype' => 'VARCHAR',

interface/web/mail/form/spamfilter_users.tform.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
'datatype' => 'INTEGER',
7474
'formtype' => 'SELECT',
7575
'default' => 5,
76-
'value' => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10)
76+
'value' => array(1 => '1 - lowest', 2 => 2, 3 => 3, 4 => 4, 5 => '5 - medium', 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => '10 - highest')
7777
),
7878
'policy_id' => array (
7979
'datatype' => 'INTEGER',

interface/web/mail/form/spamfilter_whitelist.tform.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
'datatype' => 'INTEGER',
109109
'formtype' => 'SELECT',
110110
'default' => 5,
111-
'value' => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10)
111+
'value' => array(1 => '1 - lowest', 2 => 2, 3 => 3, 4 => 4, 5 => '5 - medium', 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => '10 - highest')
112112
),
113113
'active' => array (
114114
'datatype' => 'VARCHAR',

interface/web/mail/lib/lang/de_spamfilter_blacklist.lng

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,7 @@ $wb['email_txt'] = 'E-Mail Adresse';
66
$wb['priority_txt'] = 'Priorität';
77
$wb['active_txt'] = 'Aktiv';
88
$wb['limit_spamfilter_wblist_txt'] = 'Die maximale Anzahl an White- oder Blacklist Einträgen für ihr Konto wurde erreicht.';
9+
$wb['10 - highest'] = '10 - h&ouml;chste';
10+
$wb['5 - medium'] = '5 - normal';
11+
$wb['1 - lowest'] = '1 - niedrigste';
912
?>

interface/web/mail/lib/lang/de_spamfilter_users.lng

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,7 @@ $wb['fullname_txt'] = 'Name';
77
$wb['local_txt'] = 'Lokal';
88
$wb['email_error_notempty'] = 'Die E-Mail-Adresse darf nicht leer sein.';
99
$wb['fullname_error_notempty'] = 'Der Name darf nicht leer sein.';
10+
$wb['10 - highest'] = '10 - h&ouml;chste';
11+
$wb['5 - medium'] = '5 - normal';
12+
$wb['1 - lowest'] = '1 - niedrigste';
1013
?>

interface/web/mail/lib/lang/de_spamfilter_whitelist.lng

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,7 @@ $wb['email_txt'] = 'E-Mail';
66
$wb['priority_txt'] = 'Priorität';
77
$wb['active_txt'] = 'Aktiv';
88
$wb['limit_spamfilter_wblist_txt'] = 'Die maximale Anzahl an White- oder Blacklist Einträgen für Ihr Konto wurde erreicht.';
9+
$wb['10 - highest'] = '10 - h&ouml;chste';
10+
$wb['5 - medium'] = '5 - normal';
11+
$wb['1 - lowest'] = '1 - niedrigste';
912
?>

interface/web/mail/lib/lang/en_spamfilter_blacklist.lng

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,7 @@ $wb["email_txt"] = 'Email';
66
$wb["priority_txt"] = 'Priority';
77
$wb["active_txt"] = 'Active';
88
$wb["limit_spamfilter_wblist_txt"] = 'The max. number of White- or Blacklist records for your account is reached.';
9+
$wb['10 - highest'] = '10 - highest';
10+
$wb['5 - medium'] = '5 - medium';
11+
$wb['1 - lowest'] = '1 - lowest';
912
?>

0 commit comments

Comments
 (0)