summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-03-01 14:01:58 +0100
committerAndrey Andreev <narf@bofh.bg>2012-03-01 14:01:58 +0100
commit3aaca2523de1a733c18473299cd3c72c9497869c (patch)
tree11d88239a0625e201c06f7bd78572862e6425a6c
parent005700340b444f3cfee8df98f5bf30b32c4a5085 (diff)
parent41e46a97a43b0d5080bb9ace1b9326266955ef21 (diff)
Merge upstream branch
-rw-r--r--system/database/DB_active_rec.php3
-rw-r--r--system/database/drivers/oci8/oci8_driver.php14
-rw-r--r--system/database/drivers/odbc/odbc_result.php9
-rw-r--r--system/helpers/download_helper.php3
-rw-r--r--system/libraries/Email.php331
-rw-r--r--system/libraries/Upload.php2
-rw-r--r--user_guide_src/source/changelog.rst3
7 files changed, 146 insertions, 219 deletions
diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php
index 424735157..eaae23f30 100644
--- a/system/database/DB_active_rec.php
+++ b/system/database/DB_active_rec.php
@@ -236,7 +236,8 @@ class CI_DB_active_record extends CI_DB_driver {
{
if (strpos($item, '.') !== FALSE)
{
- return end(explode('.', $item));
+ $item = explode('.', $item);
+ return end($item);
}
return $item;
diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php
index c6621901b..057095c23 100644
--- a/system/database/drivers/oci8/oci8_driver.php
+++ b/system/database/drivers/oci8/oci8_driver.php
@@ -398,10 +398,9 @@ class CI_DB_oci8_driver extends CI_DB {
/**
* Escape String
*
- * @access public
- * @param string
+ * @param string
* @param bool whether or not the string will be used in a LIKE condition
- * @return string
+ * @return string
*/
public function escape_str($str, $like = FALSE)
{
@@ -415,15 +414,14 @@ class CI_DB_oci8_driver extends CI_DB {
return $str;
}
- $str = remove_invisible_characters($str);
- $str = str_replace("'", "''", $str);
+ $str = str_replace("'", "''", remove_invisible_characters($str));
// escape LIKE condition wildcards
if ($like === TRUE)
{
- $str = str_replace( array('%', '_', $this->_like_escape_chr),
- array($this->_like_escape_chr.'%', $this->_like_escape_chr.'_', $this->_like_escape_chr.$this->_like_escape_chr),
- $str);
+ return str_replace(array($this->_like_escape_chr, '%', '_'),
+ array($this->_like_escape_chr.$this->_like_escape_chr, $this->_like_escape_chr.'%', $this->_like_escape_chr.'_'),
+ $str);
}
return $str;
diff --git a/system/database/drivers/odbc/odbc_result.php b/system/database/drivers/odbc/odbc_result.php
index e7cbc7af5..db3576d35 100644
--- a/system/database/drivers/odbc/odbc_result.php
+++ b/system/database/drivers/odbc/odbc_result.php
@@ -78,19 +78,18 @@ class CI_DB_odbc_result extends CI_DB_result {
*/
public function list_fields()
{
+ $field_names = array();
$num_fields = $this->num_fields();
+
if ($num_fields > 0)
{
- $field_names = array();
for ($i = 1; $i <= $num_fields; $i++)
{
- $field_names[] = odbc_field_name($this->result_id, $i);
+ $field_names[] = odbc_field_name($this->result_id, $i);
}
-
- return $field_names;
}
- return array();
+ return $field_names;
}
// --------------------------------------------------------------------
diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php
index 34380cc88..a8c59c2c0 100644
--- a/system/helpers/download_helper.php
+++ b/system/helpers/download_helper.php
@@ -70,7 +70,8 @@ if ( ! function_exists('force_download'))
return FALSE;
}
- $extension = end(explode('.', $filename));
+ $extension = explode('.', $filename);
+ $extension = end($extension);
// Load the mime types
if (defined('ENVIRONMENT') && is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'))
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index 922107e9f..c8a5b41af 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -25,8 +25,6 @@
* @filesource
*/
-// ------------------------------------------------------------------------
-
/**
* CodeIgniter Email Class
*
@@ -40,55 +38,55 @@
*/
class CI_Email {
- public $useragent = "CodeIgniter";
- public $mailpath = "/usr/sbin/sendmail"; // Sendmail path
- public $protocol = "mail"; // mail/sendmail/smtp
- public $smtp_host = ""; // SMTP Server. Example: mail.earthlink.net
- public $smtp_user = ""; // SMTP Username
- public $smtp_pass = ""; // SMTP Password
- public $smtp_port = "25"; // SMTP Port
- public $smtp_timeout = 5; // SMTP Timeout in seconds
- public $smtp_crypto = ""; // SMTP Encryption. Can be null, tls or ssl.
- public $wordwrap = TRUE; // TRUE/FALSE Turns word-wrap on/off
- public $wrapchars = "76"; // Number of characters to wrap at.
- public $mailtype = "text"; // text/html Defines email formatting
- public $charset = "utf-8"; // Default char set: iso-8859-1 or us-ascii
- public $multipart = "mixed"; // "mixed" (in the body) or "related" (separate)
- public $alt_message = ''; // Alternative message for HTML emails
- public $validate = FALSE; // TRUE/FALSE. Enables email validation
- public $priority = "3"; // Default priority (1 - 5)
- public $newline = "\n"; // Default newline. "\r\n" or "\n" (Use "\r\n" to comply with RFC 822)
- public $crlf = "\n"; // The RFC 2045 compliant CRLF for quoted-printable is "\r\n". Apparently some servers,
+ public $useragent = 'CodeIgniter';
+ public $mailpath = '/usr/sbin/sendmail'; // Sendmail path
+ public $protocol = 'mail'; // mail/sendmail/smtp
+ public $smtp_host = ''; // SMTP Server. Example: mail.earthlink.net
+ public $smtp_user = ''; // SMTP Username
+ public $smtp_pass = ''; // SMTP Password
+ public $smtp_port = 25; // SMTP Port
+ public $smtp_timeout = 5; // SMTP Timeout in seconds
+ public $smtp_crypto = ''; // SMTP Encryption. Can be null, tls or ssl.
+ public $wordwrap = TRUE; // TRUE/FALSE Turns word-wrap on/off
+ public $wrapchars = 76; // Number of characters to wrap at.
+ public $mailtype = 'text'; // text/html Defines email formatting
+ public $charset = 'utf-8'; // Default char set: iso-8859-1 or us-ascii
+ public $multipart = 'mixed'; // "mixed" (in the body) or "related" (separate)
+ public $alt_message = ''; // Alternative message for HTML emails
+ public $validate = FALSE; // TRUE/FALSE. Enables email validation
+ public $priority = 3; // Default priority (1 - 5)
+ public $newline = "\n"; // Default newline. "\r\n" or "\n" (Use "\r\n" to comply with RFC 822)
+ public $crlf = "\n"; // The RFC 2045 compliant CRLF for quoted-printable is "\r\n". Apparently some servers,
// even on the receiving end think they need to muck with CRLFs, so using "\n", while
// distasteful, is the only thing that seems to work for all environments.
public $send_multipart = TRUE; // TRUE/FALSE - Yahoo does not like multipart alternative, so this is an override. Set to FALSE for Yahoo.
- public $bcc_batch_mode = FALSE; // TRUE/FALSE Turns on/off Bcc batch feature
+ public $bcc_batch_mode = FALSE; // TRUE/FALSE - Turns on/off Bcc batch feature
public $bcc_batch_size = 200; // If bcc_batch_mode = TRUE, sets max number of Bccs in each batch
- private $_safe_mode = FALSE;
- private $_subject = "";
- private $_body = "";
- private $_finalbody = "";
- private $_alt_boundary = "";
- private $_atc_boundary = "";
- private $_header_str = "";
- private $_smtp_connect = "";
- private $_encoding = "8bit";
- private $_IP = FALSE;
- private $_smtp_auth = FALSE;
- private $_replyto_flag = FALSE;
- private $_debug_msg = array();
- private $_recipients = array();
- private $_cc_array = array();
- private $_bcc_array = array();
- private $_headers = array();
- private $_attach_name = array();
- private $_attach_type = array();
- private $_attach_disp = array();
- private $_protocols = array('mail', 'sendmail', 'smtp');
- private $_base_charsets = array('us-ascii', 'iso-2022-'); // 7-bit charsets (excluding language suffix)
- private $_bit_depths = array('7bit', '8bit');
- private $_priorities = array('1 (Highest)', '2 (High)', '3 (Normal)', '4 (Low)', '5 (Lowest)');
+ protected $_safe_mode = FALSE;
+ protected $_subject = '';
+ protected $_body = '';
+ protected $_finalbody = '';
+ protected $_alt_boundary = '';
+ protected $_atc_boundary = '';
+ protected $_header_str = '';
+ protected $_smtp_connect = '';
+ protected $_encoding = '8bit';
+ protected $_IP = FALSE;
+ protected $_smtp_auth = FALSE;
+ protected $_replyto_flag = FALSE;
+ protected $_debug_msg = array();
+ protected $_recipients = array();
+ protected $_cc_array = array();
+ protected $_bcc_array = array();
+ protected $_headers = array();
+ protected $_attach_name = array();
+ protected $_attach_type = array();
+ protected $_attach_disp = array();
+ protected $_protocols = array('mail', 'sendmail', 'smtp');
+ protected $_base_charsets = array('us-ascii', 'iso-2022-'); // 7-bit charsets (excluding language suffix)
+ protected $_bit_depths = array('7bit', '8bit');
+ protected $_priorities = array('1 (Highest)', '2 (High)', '3 (Normal)', '4 (Low)', '5 (Lowest)');
/**
* Constructor - Sets Email Preferences
@@ -103,11 +101,11 @@ class CI_Email {
}
else
{
- $this->_smtp_auth = ($this->smtp_user == '' AND $this->smtp_pass == '') ? FALSE : TRUE;
- $this->_safe_mode = (bool) @ini_get("safe_mode");
+ $this->_smtp_auth = ! ($this->smtp_user == '' && $this->smtp_pass == '');
+ $this->_safe_mode = (bool) @ini_get('safe_mode');
}
- log_message('debug', "Email Class Initialized");
+ log_message('debug', 'Email Class Initialized');
}
// --------------------------------------------------------------------
@@ -115,7 +113,6 @@ class CI_Email {
/**
* Initialize preferences
*
- * @access public
* @param array
* @return void
*/
@@ -139,8 +136,8 @@ class CI_Email {
}
$this->clear();
- $this->_smtp_auth = ($this->smtp_user == '' AND $this->smtp_pass == '') ? FALSE : TRUE;
- $this->_safe_mode = (bool) @ini_get("safe_mode");
+ $this->_smtp_auth = ! ($this->smtp_user == '' && $this->smtp_pass == '');
+ $this->_safe_mode = (bool) @ini_get('safe_mode');
return $this;
}
@@ -150,17 +147,16 @@ class CI_Email {
/**
* Initialize the Email Data
*
- * @access public
* @param bool
- * @return void
+ * @return object
*/
public function clear($clear_attachments = FALSE)
{
- $this->_subject = "";
- $this->_body = "";
- $this->_finalbody = "";
- $this->_header_str = "";
- $this->_replyto_flag = FALSE;
+ $this->_subject = '';
+ $this->_body = '';
+ $this->_finalbody = '';
+ $this->_header_str = '';
+ $this->_replyto_flag = FALSE;
$this->_recipients = array();
$this->_cc_array = array();
$this->_bcc_array = array();
@@ -185,14 +181,13 @@ class CI_Email {
/**
* Set FROM
*
- * @access public
* @param string
* @param string
- * @return void
+ * @return object
*/
public function from($from, $name = '')
{
- if (preg_match( '/\<(.*)\>/', $from, $match))
+ if (preg_match('/\<(.*)\>/', $from, $match))
{
$from = $match[1];
}
@@ -228,14 +223,13 @@ class CI_Email {
/**
* Set Reply-to
*
- * @access public
* @param string
* @param string
- * @return void
+ * @return object
*/
public function reply_to($replyto, $name = '')
{
- if (preg_match( '/\<(.*)\>/', $replyto, $match))
+ if (preg_match('/\<(.*)\>/', $replyto, $match))
{
$replyto = $match[1];
}
@@ -266,9 +260,8 @@ class CI_Email {
/**
* Set Recipients
*
- * @access public
* @param string
- * @return void
+ * @return object
*/
public function to($to)
{
@@ -282,17 +275,17 @@ class CI_Email {
if ($this->_get_protocol() !== 'mail')
{
- $this->_set_header('To', implode(", ", $to));
+ $this->_set_header('To', implode(', ', $to));
}
switch ($this->_get_protocol())
{
- case 'smtp' :
+ case 'smtp':
$this->_recipients = $to;
break;
- case 'sendmail' :
- case 'mail' :
- $this->_recipients = implode(", ", $to);
+ case 'sendmail':
+ case 'mail':
+ $this->_recipients = implode(', ', $to);
break;
}
@@ -304,9 +297,8 @@ class CI_Email {
/**
* Set CC
*
- * @access public
* @param string
- * @return void
+ * @return object
*/
public function cc($cc)
{
@@ -318,7 +310,7 @@ class CI_Email {
$this->validate_email($cc);
}
- $this->_set_header('Cc', implode(", ", $cc));
+ $this->_set_header('Cc', implode(', ', $cc));
if ($this->_get_protocol() === 'smtp')
{
@@ -333,10 +325,9 @@ class CI_Email {
/**
* Set BCC
*
- * @access public
* @param string
* @param string
- * @return void
+ * @return object
*/
public function bcc($bcc, $limit = '')
{
@@ -360,7 +351,7 @@ class CI_Email {
}
else
{
- $this->_set_header('Bcc', implode(", ", $bcc));
+ $this->_set_header('Bcc', implode(', ', $bcc));
}
return $this;
@@ -371,9 +362,8 @@ class CI_Email {
/**
* Set Email Subject
*
- * @access public
* @param string
- * @return void
+ * @return object
*/
public function subject($subject)
{
@@ -387,13 +377,12 @@ class CI_Email {
/**
* Set Body
*
- * @access public
* @param string
- * @return void
+ * @return object
*/
public function message($body)
{
- $this->_body = rtrim(str_replace("\r", "", $body));
+ $this->_body = rtrim(str_replace("\r", '', $body));
/* strip slashes only if magic quotes is ON
if we do it with magic quotes OFF, it strips real, user-inputted chars.
@@ -414,9 +403,8 @@ class CI_Email {
/**
* Assign file attachments
*
- * @access public
* @param string
- * @return void
+ * @return object
*/
public function attach($filename, $disposition = '', $newname = NULL)
{
@@ -431,7 +419,6 @@ class CI_Email {
/**
* Add a Header Item
*
- * @access protected
* @param string
* @param string
* @return void
@@ -446,7 +433,6 @@ class CI_Email {
/**
* Convert a String to an Array
*
- * @access protected
* @param string
* @return array
*/
@@ -460,8 +446,7 @@ class CI_Email {
}
else
{
- $email = trim($email);
- settype($email, "array");
+ $email = (array) trim($email);
}
}
return $email;
@@ -472,9 +457,8 @@ class CI_Email {
/**
* Set Multipart Value
*
- * @access public
* @param string
- * @return void
+ * @return object
*/
public function set_alt_message($str = '')
{
@@ -487,9 +471,8 @@ class CI_Email {
/**
* Set Mailtype
*
- * @access public
* @param string
- * @return void
+ * @return object
*/
public function set_mailtype($type = 'text')
{
@@ -502,9 +485,8 @@ class CI_Email {
/**
* Set Wordwrap
*
- * @access public
* @param bool
- * @return void
+ * @return object
*/
public function set_wordwrap($wordwrap = TRUE)
{
@@ -517,13 +499,12 @@ class CI_Email {
/**
* Set Protocol
*
- * @access public
* @param string
- * @return void
+ * @return object
*/
public function set_protocol($protocol = 'mail')
{
- $this->protocol = ( ! in_array($protocol, $this->_protocols, TRUE)) ? 'mail' : strtolower($protocol);
+ $this->protocol = in_array($protocol, $this->_protocols, TRUE) ? strtolower($protocol) : 'mail';
return $this;
}
@@ -532,19 +513,12 @@ class CI_Email {
/**
* Set Priority
*
- * @access public
- * @param integer
- * @return void
+ * @param int
+ * @return object
*/
public function set_priority($n = 3)
{
- if ( ! is_numeric($n) OR $n < 1 OR $n > 5)
- {
- $this->priority = 3;
- return;
- }
-
- $this->priority = (int) $n;
+ $this->priority = preg_match('/^[1-5]$/', $n) ? (int) $n : 3;
return $this;
}
@@ -553,9 +527,8 @@ class CI_Email {
/**
* Set Newline Character
*
- * @access public
* @param string
- * @return void
+ * @return object
*/
public function set_newline($newline = "\n")
{
@@ -568,13 +541,12 @@ class CI_Email {
/**
* Set CRLF
*
- * @access public
* @param string
- * @return void
+ * @return object
*/
public function set_crlf($crlf = "\n")
{
- $this->crlf = ($crlf !== "\n" AND $crlf !== "\r\n" AND $crlf !== "\r") ? "\n" : $crlf;
+ $this->crlf = ($crlf !== "\n" && $crlf !== "\r\n" && $crlf !== "\r") ? "\n" : $crlf;
return $this;
}
@@ -583,13 +555,12 @@ class CI_Email {
/**
* Set Message Boundary
*
- * @access protected
* @return void
*/
protected function _set_boundaries()
{
- $this->_alt_boundary = "B_ALT_".uniqid(''); // multipart/alternative
- $this->_atc_boundary = "B_ATC_".uniqid(''); // attachment boundary
+ $this->_alt_boundary = 'B_ALT_'.uniqid(''); // multipart/alternative
+ $this->_atc_boundary = 'B_ATC_'.uniqid(''); // attachment boundary
}
// --------------------------------------------------------------------
@@ -597,14 +568,12 @@ class CI_Email {
/**
* Get the Message ID
*
- * @access protected
* @return string
*/
protected function _get_message_id()
{
$from = str_replace(array('>', '<'), '', $this->_headers['Return-Path']);
-
- return "<".uniqid('').strstr($from, '@').">";
+ return '<'.uniqid('').strstr($from, '@').'>';
}
// --------------------------------------------------------------------
@@ -612,14 +581,13 @@ class CI_Email {
/**
* Get Mail Protocol
*
- * @access protected
* @param bool
- * @return string
+ * @return mixed
*/
protected function _get_protocol($return = TRUE)
{
$this->protocol = strtolower($this->protocol);
- $this->protocol = ( ! in_array($this->protocol, $this->_protocols, TRUE)) ? 'mail' : $this->protocol;
+ in_array($this->protocol, $this->_protocols, TRUE) OR $this->protocol = 'mail';
if ($return == TRUE)
{
@@ -632,13 +600,12 @@ class CI_Email {
/**
* Get Mail Encoding
*
- * @access protected
* @param bool
* @return string
*/
protected function _get_encoding($return = TRUE)
{
- $this->_encoding = ( ! in_array($this->_encoding, $this->_bit_depths)) ? '8bit' : $this->_encoding;
+ in_array($this->_encoding, $this->_bit_depths) OR $this->_encoding = '8bit';
foreach ($this->_base_charsets as $charset)
{
@@ -659,7 +626,6 @@ class CI_Email {
/**
* Get content type (text/html/attachment)
*
- * @access protected
* @return string
*/
protected function _get_content_type()
@@ -687,17 +653,16 @@ class CI_Email {
/**
* Set RFC 822 Date
*
- * @access protected
* @return string
*/
protected function _set_date()
{
- $timezone = date("Z");
+ $timezone = date('Z');
$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);
+ return sprintf('%s %s%04d', date('D, j M Y H:i:s'), $operator, $timezone);
}
// --------------------------------------------------------------------
@@ -705,12 +670,11 @@ class CI_Email {
/**
* Mime message
*
- * @access protected
* @return string
*/
protected function _get_mime_message()
{
- return "This is a multi-part message in MIME format.".$this->newline."Your email application may not support this format.";
+ return 'This is a multi-part message in MIME format.'.$this->newline.'Your email application may not support this format.';
}
// --------------------------------------------------------------------
@@ -718,7 +682,6 @@ class CI_Email {
/**
* Validate Email Address
*
- * @access public
* @param string
* @return bool
*/
@@ -747,13 +710,12 @@ class CI_Email {
/**
* Email Validation
*
- * @access public
* @param string
* @return bool
*/
public function valid_email($address)
{
- return (bool) preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $address);
+ return (bool) preg_match('/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix', $address);
}
// --------------------------------------------------------------------
@@ -761,7 +723,6 @@ class CI_Email {
/**
* Clean Extended Email Address: Joe Smith <joe@smith.com>
*
- * @access public
* @param string
* @return string
*/
@@ -776,7 +737,7 @@ class CI_Email {
foreach ($email as $addy)
{
- $clean_email[] = (preg_match( '/\<(.*)\>/', $addy, $match)) ? $match[1] : $addy;
+ $clean_email[] = preg_match('/\<(.*)\>/', $addy, $match) ? $match[1] : $addy;
}
return $clean_email;
@@ -792,12 +753,11 @@ class CI_Email {
* If the user hasn't specified his own alternative message
* it creates one by stripping the HTML
*
- * @access protected
* @return string
*/
protected function _get_alt_message()
{
- if ($this->alt_message != "")
+ if ($this->alt_message != '')
{
return $this->word_wrap($this->alt_message, '76');
}
@@ -818,9 +778,8 @@ class CI_Email {
/**
* Word Wrap
*
- * @access public
* @param string
- * @param integer
+ * @param int
* @return string
*/
public function word_wrap($str, $charlim = '')
@@ -911,8 +870,6 @@ class CI_Email {
/**
* Build final headers
*
- * @access protected
- * @param string
* @return string
*/
protected function _build_headers()
@@ -929,7 +886,6 @@ class CI_Email {
/**
* Write Headers as a string
*
- * @access protected
* @return void
*/
protected function _write_headers()
@@ -964,12 +920,11 @@ class CI_Email {
/**
* Build Final Body and attachments
*
- * @access protected
* @return void
*/
protected function _build_message()
{
- if ($this->wordwrap === TRUE AND $this->mailtype !== 'html')
+ if ($this->wordwrap === TRUE && $this->mailtype !== 'html')
{
$this->_body = $this->word_wrap($this->_body);
}
@@ -1131,9 +1086,8 @@ class CI_Email {
* Prepares string for Quoted-Printable Content-Transfer-Encoding
* Refer to RFC 2045 http://www.ietf.org/rfc/rfc2045.txt
*
- * @access protected
* @param string
- * @param integer
+ * @param int
* @return string
*/
protected function _prep_quoted_printable($str, $charlim = '')
@@ -1203,9 +1157,7 @@ class CI_Email {
}
// get rid of extra CRLF tacked onto the end
- $output = substr($output, 0, strlen($this->crlf) * -1);
-
- return $output;
+ return substr($output, 0, strlen($this->crlf) * -1);
}
// --------------------------------------------------------------------
@@ -1216,10 +1168,9 @@ class CI_Email {
* Performs "Q Encoding" on a string for use in email headers. It's related
* but not identical to quoted-printable, so it has its own method
*
- * @access public
- * @param str
- * @param bool // set to TRUE for processing From: headers
- * @return str
+ * @param string
+ * @param bool set to TRUE for processing From: headers
+ * @return string
*/
protected function _prep_q_encoding($str, $from = FALSE)
{
@@ -1275,9 +1226,7 @@ class CI_Email {
// wrap each line with the shebang, charset, and transfer encoding
// the preceding space on successive lines is required for header "folding"
- $str = trim(preg_replace('/^(.*)$/m', ' =?'.$this->charset.'?Q?$1?=', $str));
-
- return $str;
+ return trim(preg_replace('/^(.*)$/m', ' =?'.$this->charset.'?Q?$1?=', $str));
}
// --------------------------------------------------------------------
@@ -1285,7 +1234,6 @@ class CI_Email {
/**
* Send Email
*
- * @access public
* @return bool
*/
public function send()
@@ -1295,9 +1243,9 @@ class CI_Email {
$this->reply_to($this->_headers['From']);
}
- if (( ! isset($this->_recipients) AND ! isset($this->_headers['To'])) AND
- ( ! isset($this->_bcc_array) AND ! isset($this->_headers['Bcc'])) AND
- ( ! isset($this->_headers['Cc'])))
+ if ( ! isset($this->_recipients) && ! isset($this->_headers['To'])
+ && ! isset($this->_bcc_array) && ! isset($this->_headers['Bcc'])
+ && ! isset($this->_headers['Cc']))
{
$this->_set_error_message('lang:email_no_recipients');
return FALSE;
@@ -1305,44 +1253,40 @@ class CI_Email {
$this->_build_headers();
- if ($this->bcc_batch_mode AND count($this->_bcc_array) > $this->bcc_batch_size)
+ if ($this->bcc_batch_mode && count($this->_bcc_array) > $this->bcc_batch_size)
{
return $this->batch_bcc_send();
}
$this->_build_message();
-
return $this->_spool_email();
}
// --------------------------------------------------------------------
/**
- * Batch Bcc Send. Sends groups of BCCs in batches
+ * Batch Bcc Send. Sends groups of BCCs in batches
*
- * @access public
- * @return bool
+ * @return void
*/
public function batch_bcc_send()
{
- $float = $this->bcc_batch_size -1;
-
- $set = "";
-
+ $float = $this->bcc_batch_size - 1;
+ $set = '';
$chunk = array();
for ($i = 0, $c = count($this->_bcc_array); $i < $c; $i++)
{
if (isset($this->_bcc_array[$i]))
{
- $set .= ", ".$this->_bcc_array[$i];
+ $set .= ', '.$this->_bcc_array[$i];
}
if ($i == $float)
{
$chunk[] = substr($set, 1);
$float += $this->bcc_batch_size;
- $set = "";
+ $set = '';
}
if ($i === $c-1)
@@ -1359,7 +1303,7 @@ class CI_Email {
if ($this->protocol !== 'smtp')
{
- $this->_set_header('Bcc', implode(", ", $bcc));
+ $this->_set_header('Bcc', implode(', ', $bcc));
}
else
{
@@ -1376,7 +1320,6 @@ class CI_Email {
/**
* Unwrap special elements
*
- * @access protected
* @return void
*/
protected function _unwrap_specials()
@@ -1389,7 +1332,6 @@ class CI_Email {
/**
* Strip line-breaks via callback
*
- * @access protected
* @return string
*/
protected function _remove_nl_callback($matches)
@@ -1407,7 +1349,6 @@ class CI_Email {
/**
* Spool mail to the mail server
*
- * @access protected
* @return bool
*/
protected function _spool_email()
@@ -1429,7 +1370,6 @@ class CI_Email {
/**
* Send using mail()
*
- * @access protected
* @return bool
*/
protected function _send_with_mail()
@@ -1451,7 +1391,6 @@ class CI_Email {
/**
* Send using Sendmail
*
- * @access protected
* @return bool
*/
protected function _send_with_sendmail()
@@ -1484,7 +1423,6 @@ class CI_Email {
/**
* Send using SMTP
*
- * @access protected
* @return bool
*/
protected function _send_with_smtp()
@@ -1553,7 +1491,6 @@ class CI_Email {
/**
* SMTP Connect
*
- * @access protected
* @param string
* @return string
*/
@@ -1597,7 +1534,6 @@ class CI_Email {
/**
* Send SMTP command
*
- * @access protected
* @param string
* @param string
* @return string
@@ -1670,7 +1606,6 @@ class CI_Email {
/**
* SMTP Authenticate
*
- * @access protected
* @return bool
*/
protected function _smtp_authenticate()
@@ -1680,7 +1615,7 @@ class CI_Email {
return TRUE;
}
- if ($this->smtp_user == "" AND $this->smtp_pass == "")
+ if ($this->smtp_user == '' && $this->smtp_pass == '')
{
$this->_set_error_message('lang:email_no_smtp_unpw');
return FALSE;
@@ -1724,7 +1659,6 @@ class CI_Email {
/**
* Send SMTP data
*
- * @access protected
* @return bool
*/
protected function _send_data($data)
@@ -1743,7 +1677,6 @@ class CI_Email {
/**
* Get SMTP data
*
- * @access protected
* @return string
*/
protected function _get_smtp_data()
@@ -1768,12 +1701,11 @@ class CI_Email {
/**
* Get Hostname
*
- * @access protected
* @return string
*/
protected function _get_hostname()
{
- return (isset($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : 'localhost.localdomain';
+ return isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'localhost.localdomain';
}
// --------------------------------------------------------------------
@@ -1781,7 +1713,6 @@ class CI_Email {
/**
* Get IP
*
- * @access protected
* @return string
*/
protected function _get_ip()
@@ -1791,13 +1722,13 @@ class CI_Email {
return $this->_IP;
}
- $cip = (isset($_SERVER['HTTP_CLIENT_IP']) AND $_SERVER['HTTP_CLIENT_IP'] != "") ? $_SERVER['HTTP_CLIENT_IP'] : FALSE;
- $rip = (isset($_SERVER['REMOTE_ADDR']) AND $_SERVER['REMOTE_ADDR'] != "") ? $_SERVER['REMOTE_ADDR'] : FALSE;
+ $cip = ( ! empty($_SERVER['HTTP_CLIENT_IP'])) ? $_SERVER['HTTP_CLIENT_IP'] : FALSE;
+ $rip = ( ! empty($_SERVER['REMOTE_ADDR'])) ? $_SERVER['REMOTE_ADDR'] : FALSE;
if ($cip) $this->_IP = $cip;
elseif ($rip) $this->_IP = $rip;
else
{
- $fip = (isset($_SERVER['HTTP_X_FORWARDED_FOR']) AND $_SERVER['HTTP_X_FORWARDED_FOR'] != "") ? $_SERVER['HTTP_X_FORWARDED_FOR'] : FALSE;
+ $fip = ( ! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : FALSE;
if ($fip)
{
$this->_IP = $fip;
@@ -1810,7 +1741,7 @@ class CI_Email {
$this->_IP = end($x);
}
- if ( ! preg_match( "/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/", $this->_IP))
+ if ( ! preg_match('/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/', $this->_IP))
{
$this->_IP = '0.0.0.0';
}
@@ -1823,7 +1754,6 @@ class CI_Email {
/**
* Get Debug Message
*
- * @access public
* @return string
*/
public function print_debugger()
@@ -1838,8 +1768,7 @@ class CI_Email {
}
}
- $msg .= "<pre>".$this->_header_str."\n".htmlspecialchars($this->_subject)."\n".htmlspecialchars($this->_finalbody).'</pre>';
- return $msg;
+ return $msg.'<pre>'.$this->_header_str."\n".htmlspecialchars($this->_subject)."\n".htmlspecialchars($this->_finalbody).'</pre>';
}
// --------------------------------------------------------------------
@@ -1847,16 +1776,15 @@ class CI_Email {
/**
* Set Message
*
- * @access protected
* @param string
- * @return string
+ * @return void
*/
protected function _set_error_message($msg, $val = '')
{
$CI =& get_instance();
$CI->lang->load('email');
- if (substr($msg, 0, 5) !== 'lang:' || FALSE === ($line = $CI->lang->line(substr($msg, 5))))
+ if (substr($msg, 0, 5) !== 'lang:' OR FALSE === ($line = $CI->lang->line(substr($msg, 5))))
{
$this->_debug_msg[] = str_replace('%s', $val, $msg)."<br />";
}
@@ -1871,13 +1799,13 @@ class CI_Email {
/**
* Mime Types
*
- * @access protected
* @param string
* @return string
*/
- protected function _mime_types($ext = "")
+ protected function _mime_types($ext = '')
{
- $mimes = array( 'hqx' => 'application/mac-binhex40',
+ $mimes = array(
+ 'hqx' => 'application/mac-binhex40',
'cpt' => 'application/mac-compactpro',
'doc' => 'application/msword',
'bin' => 'application/macbinary',
@@ -1966,11 +1894,10 @@ class CI_Email {
'eml' => 'message/rfc822'
);
- return ( ! isset($mimes[strtolower($ext)])) ? "application/x-unknown-content-type" : $mimes[strtolower($ext)];
+ return isset($mimes[strtolower($ext)]) ? $mimes[strtolower($ext)] : 'application/x-unknown-content-type';
}
}
-// END CI_Email class
/* End of file Email.php */
/* Location: ./system/libraries/Email.php */
diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php
index 82383f658..0b853233d 100644
--- a/system/libraries/Upload.php
+++ b/system/libraries/Upload.php
@@ -960,7 +960,7 @@ class CI_Upload {
}
elseif (is_file(APPPATH.'config/mimes.php'))
{
- include(APPPATH.'config//mimes.php');
+ include(APPPATH.'config/mimes.php');
}
else
{
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 369a89c62..cdb274df0 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -113,7 +113,8 @@ Bug fixes for 3.0
- Fixed a bug (#1039) - MySQL's _backup() method failed due to a table name not being escaped.
- Fixed a bug (#1070) - CI_DB_driver::initialize() didn't set a character set if a database is not selected.
- Fixed a bug (#177) - CI_Form_validation::set_value() didn't set the default value if POST data is NULL.
-- Fixed a bug (#81) - ODBC's list_field() and field_data() methods skipped the first column due to odbc_field_*() functions' index starting at 1 instead of 0.
+- Fixed a bug (#68, #414) - Oracle's escape_str() didn't properly escape LIKE wild characters.
+- Fixed a bug (#81) - ODBC's list_fields() and field_data() methods skipped the first column due to odbc_field_*() functions' index starting at 1 instead of 0.
- Fixed a bug (#129) - ODBC's num_rows() returned -1 in some cases, due to not all subdrivers supporting the odbc_num_rows() function.
Version 2.1.1