summaryrefslogtreecommitdiffstats
path: root/system/core
diff options
context:
space:
mode:
authorJonatas Miguel <jonatas.df.miguel@gmail.com>2012-10-25 13:19:17 +0200
committerJonatas Miguel <jonatas.df.miguel@gmail.com>2012-10-25 13:19:17 +0200
commit33b321b92b6df59cc5cf96a4f739636cdc537115 (patch)
tree787efffdebb8ae2e76fcea2811e40d504d09dd19 /system/core
parentf73bc3ef4ad28c13c24db6eff8adda141adef01d (diff)
parente47425844e84d54c659280c04f450a3526b4e09d (diff)
Merge branch 'develop' of git://github.com/EllisLab/CodeIgniter into develop
Diffstat (limited to 'system/core')
-rw-r--r--system/core/Lang.php14
-rw-r--r--system/core/Loader.php8
-rw-r--r--system/core/Security.php2
-rw-r--r--system/core/URI.php15
4 files changed, 21 insertions, 18 deletions
diff --git a/system/core/Lang.php b/system/core/Lang.php
index 3001f1b13..601348aa4 100644
--- a/system/core/Lang.php
+++ b/system/core/Lang.php
@@ -65,11 +65,11 @@ class CI_Lang {
/**
* Load a language file
*
- * @param mixed the name of the language file to be loaded
- * @param string the language (english, etc.)
- * @param bool return loaded array of translations
- * @param bool add suffix to $langfile
- * @param string alternative path to look for language file
+ * @param mixed $langile the name of the language file to be loaded
+ * @param string $idiom = '' the language (english, etc.)
+ * @param bool $return = FALSE return loaded array of translations
+ * @param bool $add_suffix = TRUE add suffix to $langfile
+ * @param string $alt_path = '' alternative path to look for language file
* @return mixed
*/
public function load($langfile, $idiom = '', $return = FALSE, $add_suffix = TRUE, $alt_path = '')
@@ -83,10 +83,10 @@ class CI_Lang {
$langfile .= '.php';
- if ($idiom === '')
+ if (empty($idiom) OR ! ctype_alpha($idiom))
{
$config =& get_config();
- $idiom = ( ! empty($config['language'])) ? $config['language'] : 'english';
+ $idiom = empty($config['language']) ? 'english' : $config['language'];
}
if ($return === FALSE && isset($this->is_loaded[$langfile]) && $this->is_loaded[$langfile] === $idiom)
diff --git a/system/core/Loader.php b/system/core/Loader.php
index 5de2e5dde..b316c8e1b 100644
--- a/system/core/Loader.php
+++ b/system/core/Loader.php
@@ -318,9 +318,9 @@ class CI_Loader {
/**
* Database Loader
*
- * @param string the DB credentials
- * @param bool whether to return the DB object
- * @param bool whether to enable query builder (this allows us to override the config setting)
+ * @param mixed $params = '' the DB settings
+ * @param bool $return = FALSE whether to return the DB object
+ * @param bool $query_builder = NULL whether to enable query builder (overrides the config setting)
* @return object
*/
public function database($params = '', $return = FALSE, $query_builder = NULL)
@@ -329,7 +329,7 @@ class CI_Loader {
$CI =& get_instance();
// Do we even need to load the database class?
- if (class_exists('CI_DB') && $return === FALSE && $query_builder === NULL && isset($CI->db) && is_object($CI->db))
+ if ($return === FALSE && $query_builder === NULL && isset($CI->db) && is_object($CI->db) && ! empty($CI->db->conn_id))
{
return FALSE;
}
diff --git a/system/core/Security.php b/system/core/Security.php
index 2fbc5b34c..d7c82712d 100644
--- a/system/core/Security.php
+++ b/system/core/Security.php
@@ -161,7 +161,7 @@ class CI_Security {
}
// Do the tokens exist in both the _POST and _COOKIE arrays?
- if ( ! isset($_POST[$this->_csrf_token_name]) OR ! isset($_COOKIE[$this->_csrf_cookie_name])
+ if ( ! isset($_POST[$this->_csrf_token_name], $_COOKIE[$this->_csrf_cookie_name])
OR $_POST[$this->_csrf_token_name] !== $_COOKIE[$this->_csrf_cookie_name]) // Do the tokens match?
{
$this->csrf_show_error();
diff --git a/system/core/URI.php b/system/core/URI.php
index 15e6a5599..72f293c18 100644
--- a/system/core/URI.php
+++ b/system/core/URI.php
@@ -433,9 +433,9 @@ class CI_URI {
/**
* Generate a key value pair from the URI string or Re-routed URI string
*
- * @param int the starting segment number
- * @param array an array of default values
- * @param string which array we should use
+ * @param int $n = 3 the starting segment number
+ * @param array $default = array() an array of default values
+ * @param string $which = 'segment' which array we should use
* @return array
*/
protected function _uri_to_assoc($n = 3, $default = array(), $which = 'segment')
@@ -445,9 +445,11 @@ class CI_URI {
return $default;
}
- if (isset($this->keyval[$n]))
+ in_array($which, array('segment', 'rsegment'), TRUE) OR $which = 'segment';
+
+ if (isset($this->keyval[$which], $this->keyval[$which][$n]))
{
- return $this->keyval[$n];
+ return $this->keyval[$which][$n];
}
if ($which === 'segment')
@@ -499,7 +501,8 @@ class CI_URI {
}
// Cache the array for reuse
- $this->keyval[$n] = $retval;
+ isset($this->keyval[$which]) OR $this->keyval[$which] = array();
+ $this->keyval[$which][$n] = $retval;
return $retval;
}