Changeset 696 for trunk/lib/Email.inc.php
- Timestamp:
- Aug 8, 2019 10:03:59 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Email.inc.php
r684 r696 118 118 . '(?:\s*>\s*|>\s+\([^,@]+\)\s*)' // TRUE, ensure ending > 119 119 . '|' 120 . '(?:|\s*|\s+\([^,@]+\)\s*))$/i ')); // FALSE ensure there is no ending >120 . '(?:|\s*|\s+\([^,@]+\)\s*))$/iu')); // FALSE ensure there is no ending > 121 121 122 122 if (isset($params)) { … … 260 260 // Apply regex pattern to search elements. 261 261 $search = array_keys($replacements); 262 array_walk($search, create_function('&$v', '$v = "{" . mb_strtoupper($v) . "}";')); 262 array_walk($search, function (&$v) { 263 $v = '{' . mb_strtoupper($v) . '}'; 264 }); 263 265 264 266 // Replacement values. … … 274 276 * You can also use this function to do post-processing on the email body before sending it, 275 277 * like removing extraneous lines: 276 * $email->setString(preg_replace('/(?:(?:\r\n|\r|\n)\s*){2}/s ', "\n\n", $email->getBody()));278 * $email->setString(preg_replace('/(?:(?:\r\n|\r|\n)\s*){2}/su', "\n\n", $email->getBody())); 277 279 * 278 280 * @access public … … 367 369 foreach ($headers as $key => $val) { 368 370 // Validate key and values. 369 if ( empty($val)) {371 if (!strlen($val)) { 370 372 $app->logMsg(sprintf('Empty email header provided: %s', $key), LOG_NOTICE, __FILE__, __LINE__); 371 373 continue; 372 374 } 373 if ( empty($key) || !is_string($key) || !is_string($val) || preg_match("/[\n\r]/", $key . $val) || preg_match('/[^\w-]/', $key)) {375 if (!strlen($key) || preg_match("/[\n\r]/", $key . $val) || preg_match('/[^\w-]/', $key)) { 374 376 $app->logMsg(sprintf('Broken email header provided: %s=%s', $key, $val), LOG_WARNING, __FILE__, __LINE__); 375 377 continue; … … 394 396 $envelope_sender_address = sprintf('<%s>', trim($this->_params['envelope_sender_address'], '<>')); 395 397 } else { 396 $envelope_sender_address = preg_replace('/^.*<?([^\s@\[\]<>()]+\@[A-Za-z0-9.-]{1,}\.[A-Za-z]{2,5})>?$/iU ', '$1', $this->_params['from']);398 $envelope_sender_address = preg_replace('/^.*<?([^\s@\[\]<>()]+\@[A-Za-z0-9.-]{1,}\.[A-Za-z]{2,5})>?$/iUu', '$1', $this->_params['from']); 397 399 } 398 400 if ('' != $envelope_sender_address && $this->validEmail($envelope_sender_address)) {
Note: See TracChangeset
for help on using the changeset viewer.