summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
Diffstat (limited to 'system')
-rw-r--r--system/core/Input.php10
-rw-r--r--system/helpers/array_helper.php1
-rw-r--r--system/libraries/Security.php3
-rw-r--r--system/libraries/Session.php4
-rw-r--r--system/libraries/Table.php3
-rw-r--r--system/libraries/Upload.php3
6 files changed, 19 insertions, 5 deletions
diff --git a/system/core/Input.php b/system/core/Input.php
index 3957aa63d..25fe102b5 100644
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -211,7 +211,7 @@ class CI_Input {
* @param bool true makes the cookie secure
* @return void
*/
- function set_cookie($name = '', $value = '', $expire = '', $domain = '', $path = '/', $prefix = '', $secure = FALSE)
+ function set_cookie($name = '', $value = '', $expire = '', $domain = '', $path = '/', $prefix = '', $secure = NULL)
{
if (is_array($name))
{
@@ -246,6 +246,12 @@ class CI_Input {
$expire = ($expire > 0) ? time() + $expire : 0;
}
+ // If TRUE/FALSE is not provided, use the config
+ if ( ! is_bool($secure))
+ {
+ $secure = (bool) (config_item('cookie_secure') === TRUE);
+ }
+
setcookie($prefix.$name, $value, $expire, $path, $domain, $secure);
}
@@ -676,4 +682,4 @@ class CI_Input {
// END Input class
/* End of file Input.php */
-/* Location: ./system/core/Input.php */ \ No newline at end of file
+/* Location: ./system/core/Input.php */
diff --git a/system/helpers/array_helper.php b/system/helpers/array_helper.php
index 6b2415df2..075a31fdf 100644
--- a/system/helpers/array_helper.php
+++ b/system/helpers/array_helper.php
@@ -69,6 +69,7 @@ if ( ! function_exists('random_element'))
{
return $array;
}
+
return $array[array_rand($array)];
}
}
diff --git a/system/libraries/Security.php b/system/libraries/Security.php
index 91896866f..58db4e79c 100644
--- a/system/libraries/Security.php
+++ b/system/libraries/Security.php
@@ -117,8 +117,9 @@ class CI_Security {
public function csrf_set_cookie()
{
$expire = time() + $this->csrf_expire;
+ $secure_cookie = (config_item('cookie_secure') === TRUE) ? 1 : 0;
- setcookie($this->csrf_cookie_name, $this->csrf_hash, $expire, config_item('cookie_path'), config_item('cookie_domain'), 0);
+ setcookie($this->csrf_cookie_name, $this->csrf_hash, $expire, config_item('cookie_path'), config_item('cookie_domain'), $secure_cookie);
log_message('debug', "CRSF cookie Set");
}
diff --git a/system/libraries/Session.php b/system/libraries/Session.php
index 53ff4f5d3..0b94340d5 100644
--- a/system/libraries/Session.php
+++ b/system/libraries/Session.php
@@ -658,6 +658,8 @@ class CI_Session {
}
$expire = ($this->sess_expire_on_close === TRUE) ? 0 : $this->sess_expiration + time();
+
+ $secure_cookie = (config_item('cookie_secure') === TRUE) ? 1 : 0;
// Set the cookie
setcookie(
@@ -666,7 +668,7 @@ class CI_Session {
$expire,
$this->cookie_path,
$this->cookie_domain,
- 0
+ $secure_cookie
);
}
diff --git a/system/libraries/Table.php b/system/libraries/Table.php
index 2a1a95b16..def696776 100644
--- a/system/libraries/Table.php
+++ b/system/libraries/Table.php
@@ -367,6 +367,9 @@ class CI_Table {
$out .= $this->template['table_close'];
+ // Clear table class properties before generating the table
+ $this->clear();
+
return $out;
}
diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php
index c8c42d885..e15ea1b5d 100644
--- a/system/libraries/Upload.php
+++ b/system/libraries/Upload.php
@@ -142,7 +142,8 @@ class CI_Upload {
*/
public function do_upload($field = 'userfile')
{
- // Is $_FILES[$field] set? If not, no reason to continue.
+
+ // Is $_FILES[$field] set? If not, no reason to continue.
if ( ! isset($_FILES[$field]))
{
$this->set_error('upload_no_file_selected');