summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
Diffstat (limited to 'system')
-rw-r--r--system/core/Lang.php2
-rw-r--r--system/core/Loader.php6
-rw-r--r--system/core/URI.php7
-rw-r--r--system/database/DB.php5
-rw-r--r--system/database/DB_driver.php6
-rw-r--r--system/database/DB_forge.php3
-rw-r--r--system/database/drivers/mysql/mysql_driver.php14
-rw-r--r--system/database/drivers/mysqli/mysqli_driver.php14
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php21
-rw-r--r--system/language/english/ftp_lang.php10
-rw-r--r--system/libraries/Ftp.php10
-rw-r--r--system/libraries/Profiler.php3
-rw-r--r--system/libraries/Session/drivers/Session_cookie.php97
13 files changed, 76 insertions, 122 deletions
diff --git a/system/core/Lang.php b/system/core/Lang.php
index 3236709f2..290b38bea 100644
--- a/system/core/Lang.php
+++ b/system/core/Lang.php
@@ -166,7 +166,7 @@ class CI_Lang {
* @param bool $log_errors Whether to log an error message if the line is not found
* @return string Translation
*/
- public function line($line = '', $log_errors = TRUE)
+ public function line($line, $log_errors = TRUE)
{
$value = ($line === '' OR ! isset($this->language[$line])) ? FALSE : $this->language[$line];
diff --git a/system/core/Loader.php b/system/core/Loader.php
index 70c1e4154..334a5c46e 100644
--- a/system/core/Loader.php
+++ b/system/core/Loader.php
@@ -472,16 +472,16 @@ class CI_Loader {
/**
* Clear Cached Variables
- *
+ *
* Clears the cached variables.
- *
+ *
* @return void
*/
public function clear_vars()
{
$this->_ci_cached_vars = array();
}
-
+
// --------------------------------------------------------------------
/**
diff --git a/system/core/URI.php b/system/core/URI.php
index bad9985d7..5e4c80a00 100644
--- a/system/core/URI.php
+++ b/system/core/URI.php
@@ -703,12 +703,7 @@ class CI_URI {
{
global $RTR;
- if (($dir = $RTR->directory) === '/')
- {
- $dir = '';
- }
-
- return $dir.implode('/', $this->rsegment_array());
+ return ltrim($RTR->directory, '/').implode('/', $this->rsegment_array());
}
}
diff --git a/system/database/DB.php b/system/database/DB.php
index 8742800c8..96da87c6d 100644
--- a/system/database/DB.php
+++ b/system/database/DB.php
@@ -206,11 +206,6 @@ function &DB($params = '', $query_builder_override = NULL)
$DB->initialize();
}
- if ( ! empty($params['stricton']))
- {
- $DB->query('SET SESSION sql_mode="STRICT_ALL_TABLES"');
- }
-
return $DB;
}
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index 9aa6c5de5..4791c3b89 100644
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
@@ -1421,7 +1421,7 @@ abstract class CI_DB_driver {
*/
protected function _has_operator($str)
{
- return (bool) preg_match('/(<|>|!|=|\sIS NULL|\sIS NOT NULL|\sBETWEEN|\sLIKE|\sIN\s*\(|\s)/i', trim($str));
+ return (bool) preg_match('/(<|>|!|=|\sIS NULL|\sIS NOT NULL|\sEXISTS|\sBETWEEN|\sLIKE|\sIN\s*\(|\s)/i', trim($str));
}
// --------------------------------------------------------------------
@@ -1447,6 +1447,8 @@ abstract class CI_DB_driver {
'\s*>\s*', // >
'\s+IS NULL', // IS NULL
'\s+IS NOT NULL', // IS NOT NULL
+ '\s+EXISTS\s*\([^\)]+\)', // EXISTS(sql)
+ '\s+NOT EXISTS\s*\([^\)]+\)', // NOT EXISTS(sql)
'\s+BETWEEN\s+\S+\s+AND\s+\S+', // BETWEEN value AND value
'\s+IN\s*\([^\)]+\)', // IN(list)
'\s+NOT IN\s*\([^\)]+\)', // NOT IN (list)
@@ -1483,7 +1485,7 @@ abstract class CI_DB_driver {
}
return (func_num_args() > 1)
- ? call_user_func_array($function, array_splice(func_get_args(), 1))
+ ? call_user_func_array($function, array_slice(func_get_args(), 1))
: call_user_func($function);
}
diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php
index 92806d305..1cebb189c 100644
--- a/system/database/DB_forge.php
+++ b/system/database/DB_forge.php
@@ -984,7 +984,6 @@ abstract class CI_DB_forge {
*/
protected function _process_indexes($table)
{
- $table = $this->db->escape_identifiers($table);
$sqls = array();
for ($i = 0, $c = count($this->keys); $i < $c; $i++)
@@ -1008,7 +1007,7 @@ abstract class CI_DB_forge {
is_array($this->keys[$i]) OR $this->keys[$i] = array($this->keys[$i]);
- $sqls[] = 'CREATE INDEX '.$this->db->escape_identifiers(implode('_', $this->keys[$i]))
+ $sqls[] = 'CREATE INDEX '.$this->db->escape_identifiers($table.'_'.implode('_', $this->keys[$i]))
.' ON '.$this->db->escape_identifiers($table)
.' ('.implode(', ', $this->db->escape_identifiers($this->keys[$i])).');';
}
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php
index b94642b35..16b2f6f53 100644
--- a/system/database/drivers/mysql/mysql_driver.php
+++ b/system/database/drivers/mysql/mysql_driver.php
@@ -66,6 +66,15 @@ class CI_DB_mysql_driver extends CI_DB {
*/
public $delete_hack = TRUE;
+ /**
+ * Strict ON flag
+ *
+ * Whether we're running in strict SQL mode.
+ *
+ * @var bool
+ */
+ public $stricton = FALSE;
+
// --------------------------------------------------------------------
/**
@@ -126,6 +135,11 @@ class CI_DB_mysql_driver extends CI_DB {
: FALSE;
}
+ if ($this->stricton && is_resource($this->conn_id))
+ {
+ $this->simple_query('SET SESSION sql_mode="STRICT_ALL_TABLES"');
+ }
+
return $this->conn_id;
}
diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php
index 0f3c6fc62..62ba2c50d 100644
--- a/system/database/drivers/mysqli/mysqli_driver.php
+++ b/system/database/drivers/mysqli/mysqli_driver.php
@@ -66,6 +66,15 @@ class CI_DB_mysqli_driver extends CI_DB {
*/
public $delete_hack = TRUE;
+ /**
+ * Strict ON flag
+ *
+ * Whether we're running in strict SQL mode.
+ *
+ * @var bool
+ */
+ public $stricton = FALSE;
+
// --------------------------------------------------------------------
/**
@@ -93,6 +102,11 @@ class CI_DB_mysqli_driver extends CI_DB {
$client_flags = ($this->compress === TRUE) ? MYSQLI_CLIENT_COMPRESS : 0;
$mysqli = mysqli_init();
+ if ($this->stricton)
+ {
+ $mysqli->options(MYSQLI_INIT_COMMAND, 'SET SESSION sql_mode="STRICT_ALL_TABLES"');
+ }
+
return @$mysqli->real_connect($hostname, $this->username, $this->password, $this->database, $port, NULL, $client_flags)
? $mysqli : FALSE;
}
diff --git a/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php b/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php
index ff486fc5a..bc92cab83 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php
@@ -55,6 +55,15 @@ class CI_DB_pdo_mysql_driver extends CI_DB_pdo_driver {
*/
public $compress = FALSE;
+ /**
+ * Strict ON flag
+ *
+ * Whether we're running in strict SQL mode.
+ *
+ * @var bool
+ */
+ public $stricton = FALSE;
+
// --------------------------------------------------------------------
/**
@@ -114,6 +123,18 @@ class CI_DB_pdo_mysql_driver extends CI_DB_pdo_driver {
.(empty($this->dbcollat) ? '' : ' COLLATE '.$this->dbcollat);
}
+ if ($this->stricton)
+ {
+ if (empty($this->options[PDO::MYSQL_ATTR_INIT_COMMAND]))
+ {
+ $this->options[PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET SESSION sql_mode="STRICT_ALL_TABLES"';
+ }
+ else
+ {
+ $this->options[PDO::MYSQL_ATTR_INIT_COMMAND] .= ', @@session.sql_mode = "STRICT_ALL_TABLES"';
+ }
+ }
+
if ($this->compress === TRUE)
{
$this->options[PDO::MYSQL_ATTR_COMPRESS] = TRUE;
diff --git a/system/language/english/ftp_lang.php b/system/language/english/ftp_lang.php
index ae4086ff3..042ab55df 100644
--- a/system/language/english/ftp_lang.php
+++ b/system/language/english/ftp_lang.php
@@ -26,18 +26,18 @@
*/
defined('BASEPATH') OR exit('No direct script access allowed');
-$lang['ftp_no_connection'] = 'Unable to locate a valid connection ID. Please make sure you are connected before peforming any file routines.';
+$lang['ftp_no_connection'] = 'Unable to locate a valid connection ID. Please make sure you are connected before peforming any file routines.';
$lang['ftp_unable_to_connect'] = 'Unable to connect to your FTP server using the supplied hostname.';
$lang['ftp_unable_to_login'] = 'Unable to login to your FTP server. Please check your username and password.';
-$lang['ftp_unable_to_makdir'] = 'Unable to create the directory you have specified.';
+$lang['ftp_unable_to_mkdir'] = 'Unable to create the directory you have specified.';
$lang['ftp_unable_to_changedir'] = 'Unable to change directories.';
-$lang['ftp_unable_to_chmod'] = 'Unable to set file permissions. Please check your path. Note: This feature is only available in PHP 5 or higher.';
+$lang['ftp_unable_to_chmod'] = 'Unable to set file permissions. Please check your path.';
$lang['ftp_unable_to_upload'] = 'Unable to upload the specified file. Please check your path.';
$lang['ftp_unable_to_download'] = 'Unable to download the specified file. Please check your path.';
-$lang['ftp_no_source_file'] = 'Unable to locate the source file. Please check your path.';
+$lang['ftp_no_source_file'] = 'Unable to locate the source file. Please check your path.';
$lang['ftp_unable_to_rename'] = 'Unable to rename the file.';
$lang['ftp_unable_to_delete'] = 'Unable to delete the file.';
-$lang['ftp_unable_to_move'] = 'Unable to move the file. Please make sure the destination directory exists.';
+$lang['ftp_unable_to_move'] = 'Unable to move the file. Please make sure the destination directory exists.';
/* End of file ftp_lang.php */
/* Location: ./system/language/english/ftp_lang.php */ \ No newline at end of file
diff --git a/system/libraries/Ftp.php b/system/libraries/Ftp.php
index 2489f490f..4be2d0a21 100644
--- a/system/libraries/Ftp.php
+++ b/system/libraries/Ftp.php
@@ -214,10 +214,10 @@ class CI_FTP {
* Internally, this parameter is only used by the "mirror" function below.
*
* @param string $path
- * @param bool $supress_debug
+ * @param bool $suppress_debug
* @return bool
*/
- public function changedir($path = '', $supress_debug = FALSE)
+ public function changedir($path, $suppress_debug = FALSE)
{
if ($path === '' OR ! $this->_is_conn())
{
@@ -228,7 +228,7 @@ class CI_FTP {
if ($result === FALSE)
{
- if ($this->debug === TRUE && $supress_debug === FALSE)
+ if ($this->debug === TRUE && $suppress_debug === FALSE)
{
$this->_error('ftp_unable_to_changedir');
}
@@ -247,7 +247,7 @@ class CI_FTP {
* @param int $permissions
* @return bool
*/
- public function mkdir($path = '', $permissions = NULL)
+ public function mkdir($path, $permissions = NULL)
{
if ($path === '' OR ! $this->_is_conn())
{
@@ -260,7 +260,7 @@ class CI_FTP {
{
if ($this->debug === TRUE)
{
- $this->_error('ftp_unable_to_makdir');
+ $this->_error('ftp_unable_to_mkdir');
}
return FALSE;
}
diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php
index 50ba1673f..7c889dd96 100644
--- a/system/libraries/Profiler.php
+++ b/system/libraries/Profiler.php
@@ -278,6 +278,7 @@ class CI_Profiler {
}
$output .= "</table>\n</fieldset>";
+ $count++;
}
return $output;
@@ -563,4 +564,4 @@ class CI_Profiler {
}
/* End of file Profiler.php */
-/* Location: ./system/libraries/Profiler.php */ \ No newline at end of file
+/* Location: ./system/libraries/Profiler.php */
diff --git a/system/libraries/Session/drivers/Session_cookie.php b/system/libraries/Session/drivers/Session_cookie.php
index d3d22d03a..dc75d8e8e 100644
--- a/system/libraries/Session/drivers/Session_cookie.php
+++ b/system/libraries/Session/drivers/Session_cookie.php
@@ -397,7 +397,7 @@ class CI_Session_cookie extends CI_Session_driver {
}
// Unserialize the session array
- $session = $this->_unserialize($session);
+ $session = @unserialize($session);
// Is the session data we unserialized an array with the correct format?
if ( ! is_array($session) OR ! isset($session['session_id'], $session['ip_address'], $session['user_agent'], $session['last_activity']))
@@ -472,7 +472,7 @@ class CI_Session_cookie extends CI_Session_driver {
$row = $query->row();
if ( ! empty($row->user_data))
{
- $custom_data = $this->_unserialize($row->user_data);
+ $custom_data = unserialize(trim($row->user_data));
if (is_array($custom_data))
{
@@ -608,7 +608,7 @@ class CI_Session_cookie extends CI_Session_driver {
if ( ! empty($userdata))
{
// Serialize the custom data array so we can store it
- $set['user_data'] = $this->_serialize($userdata);
+ $set['user_data'] = serialize($userdata);
}
// Reset query builder values.
@@ -696,7 +696,7 @@ class CI_Session_cookie extends CI_Session_driver {
: $this->userdata;
// Serialize the userdata for the cookie
- $cookie_data = $this->_serialize($cookie_data);
+ $cookie_data = serialize($cookie_data);
if ($this->sess_encrypt_cookie === TRUE)
{
@@ -737,93 +737,6 @@ class CI_Session_cookie extends CI_Session_driver {
// ------------------------------------------------------------------------
/**
- * Serialize an array
- *
- * This function first converts any slashes found in the array to a temporary
- * marker, so when it gets unserialized the slashes will be preserved
- *
- * @param mixed Data to serialize
- * @return string Serialized data
- */
- protected function _serialize($data)
- {
- if (is_array($data))
- {
- array_walk_recursive($data, array(&$this, '_escape_slashes'));
- }
- elseif (is_string($data))
- {
- $data = str_replace('\\', '{{slash}}', $data);
- }
-
- return serialize($data);
- }
-
- // ------------------------------------------------------------------------
-
- /**
- * Escape slashes
- *
- * This function converts any slashes found into a temporary marker
- *
- * @param string Value
- * @param string Key
- * @return void
- */
- protected function _escape_slashes(&$val, $key)
- {
- if (is_string($val))
- {
- $val = str_replace('\\', '{{slash}}', $val);
- }
- }
-
- // ------------------------------------------------------------------------
-
- /**
- * Unserialize
- *
- * This function unserializes a data string, then converts any
- * temporary slash markers back to actual slashes
- *
- * @param mixed Data to unserialize
- * @return mixed Unserialized data
- */
- protected function _unserialize($data)
- {
- $data = @unserialize(trim($data));
-
- if (is_array($data))
- {
- array_walk_recursive($data, array(&$this, '_unescape_slashes'));
- return $data;
- }
-
- return is_string($data) ? str_replace('{{slash}}', '\\', $data) : $data;
- }
-
- // ------------------------------------------------------------------------
-
- /**
- * Unescape slashes
- *
- * This function converts any slash markers back into actual slashes
- *
- * @param string Value
- * @param string Key
- * @return void
- */
- protected function _unescape_slashes(&$val, $key)
- {
- if (is_string($val))
- {
- $val = str_replace('{{slash}}', '\\', $val);
- }
- }
-
- // ------------------------------------------------------------------------
-
- /**
* Garbage collection
*
* This deletes expired session rows from database
@@ -841,7 +754,7 @@ class CI_Session_cookie extends CI_Session_driver {
$probability = ini_get('session.gc_probability');
$divisor = ini_get('session.gc_divisor');
- if ((mt_rand(0, $divisor) / $divisor) < $probability)
+ if (mt_rand(1, $divisor) <= $probability)
{
$expire = $this->now - $this->sess_expiration;
$this->CI->db->delete($this->sess_table_name, 'last_activity < '.$expire);