From 62bd43029cbd290d684ee32a8387f66ccad3a64a Mon Sep 17 00:00:00 2001 From: Derek Allard Date: Mon, 12 May 2008 22:19:03 +0000 Subject: preg_split changed to explode --- system/libraries/Email.php | 330 ++++++++++++++++++++++----------------------- 1 file changed, 165 insertions(+), 165 deletions(-) (limited to 'system/libraries/Email.php') diff --git a/system/libraries/Email.php b/system/libraries/Email.php index b7d9d2ebf..ebb969288 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -83,13 +83,13 @@ class CI_Email { * The constructor can be passed an array of config values */ function CI_Email($config = array()) - { + { if (count($config) > 0) { $this->initialize($config); } - $this->_smtp_auth = ($this->smtp_user == '' AND $this->smtp_pass == '') ? FALSE : TRUE; + $this->_smtp_auth = ($this->smtp_user == '' AND $this->smtp_pass == '') ? FALSE : TRUE; $this->_safe_mode = ((boolean)@ini_get("safe_mode") === FALSE) ? FALSE : TRUE; log_message('debug', "Email Class Initialized"); @@ -112,7 +112,7 @@ class CI_Email { if (isset($this->$key)) { $method = 'set_'.$key; - + if (method_exists($this, $method)) { $this->$method($val); @@ -120,7 +120,7 @@ class CI_Email { else { $this->$key = $val; - } + } } } } @@ -143,16 +143,16 @@ class CI_Email { $this->_recipients = array(); $this->_headers = array(); $this->_debug_msg = array(); - - $this->_set_header('User-Agent', $this->useragent); + + $this->_set_header('User-Agent', $this->useragent); $this->_set_header('Date', $this->_set_date()); - + if ($clear_attachments !== FALSE) { $this->_attach_name = array(); $this->_attach_type = array(); $this->_attach_disp = array(); - } + } } // -------------------------------------------------------------------- @@ -176,7 +176,7 @@ class CI_Email { { $this->validate_email($this->_str_to_array($from)); } - + if ($name != '' && strncmp($name, '"', 1) != 0) { $name = '"'.$name.'"'; @@ -240,7 +240,7 @@ class CI_Email { { $this->validate_email($to); } - + if ($this->_get_protocol() != 'mail') { $this->_set_header('To', implode(", ", $to)); @@ -275,7 +275,7 @@ class CI_Email { $this->validate_email($cc); $this->_set_header('Cc', implode(", ", $cc)); - + if ($this->_get_protocol() == "smtp") { $this->_cc_array = $cc; @@ -302,7 +302,7 @@ class CI_Email { $bcc = $this->_str_to_array($bcc); $bcc = $this->clean_email($bcc); - + if ($this->validate) { $this->validate_email($bcc); @@ -331,8 +331,8 @@ class CI_Email { { $subject = preg_replace("/(\r\n)|(\r)|(\n)/", "", $subject); $subject = preg_replace("/(\t)/", " ", $subject); - - $this->_set_header('Subject', trim($subject)); + + $this->_set_header('Subject', trim($subject)); } // -------------------------------------------------------------------- @@ -357,9 +357,9 @@ class CI_Email { * @access public * @param string * @return string - */ + */ function attach($filename, $disposition = 'attachment') - { + { $this->_attach_name[] = $filename; $this->_attach_type[] = $this->_mime_types(next(explode('.', basename($filename)))); $this->_attach_disp[] = $disposition; // Can also be 'inline' Not sure if it matters @@ -398,7 +398,7 @@ class CI_Email { $email = preg_split('/[\s,]/', $email, -1, PREG_SPLIT_NO_EMPTY); } else - { + { $email = trim($email); settype($email, "array"); } @@ -572,7 +572,7 @@ class CI_Email { { $this->protocol = strtolower($this->protocol); $this->protocol = (! in_array($this->protocol, $this->_protocols, TRUE)) ? 'mail' : $this->protocol; - + if ($return == TRUE) { return $this->protocol; @@ -589,9 +589,9 @@ class CI_Email { * @return string */ function _get_encoding($return = TRUE) - { + { $this->_encoding = (! in_array($this->_encoding, $this->_bit_depths)) ? '8bit' : $this->_encoding; - + foreach ($this->_base_charsets as $charset) { if (strncmp($charset, $this->charset, strlen($charset)) == 0) @@ -599,10 +599,10 @@ class CI_Email { $this->_encoding = '7bit'; } } - + if ($return == TRUE) { - return $this->_encoding; + return $this->_encoding; } } @@ -622,7 +622,7 @@ class CI_Email { } elseif ($this->mailtype == 'html' && count($this->_attach_name) > 0) { - return 'html-attach'; + return 'html-attach'; } elseif ($this->mailtype == 'text' && count($this->_attach_name) > 0) { @@ -648,7 +648,7 @@ class CI_Email { $operator = (strncmp($timezone, '-', 1) == 0) ? '-' : '+'; $timezone = abs($timezone); $timezone = floor($timezone/3600) * 100 + ($timezone % 3600 ) / 60; - + return sprintf("%s %s%04d", date("D, j M Y H:i:s"), $operator, $timezone); } @@ -678,7 +678,7 @@ class CI_Email { { if (! is_array($email)) { - $this->_set_error_message('email_must_be_array'); + $this->_set_error_message('email_must_be_array'); return FALSE; } @@ -686,7 +686,7 @@ class CI_Email { { if (! $this->valid_email($val)) { - $this->_set_error_message('email_invalid_address', $val); + $this->_set_error_message('email_invalid_address', $val); return FALSE; } } @@ -728,21 +728,21 @@ class CI_Email { return $email; } } - + $clean_email = array(); foreach ($email as $addy) { if (preg_match( '/\<(.*)\>/', $addy, $match)) { - $clean_email[] = $match['1']; + $clean_email[] = $match['1']; } else { - $clean_email[] = $addy; + $clean_email[] = $addy; } } - + return $clean_email; } @@ -765,7 +765,7 @@ class CI_Email { { return $this->word_wrap($this->alt_message, '76'); } - + if (preg_match('/\(.*)\<\/body\>/si', $this->_body, $match)) { $body = $match['1']; @@ -774,20 +774,20 @@ class CI_Email { { $body = $this->_body; } - + $body = trim(strip_tags($body)); $body = preg_replace( '#