summaryrefslogtreecommitdiffstats
path: root/system/core/Input.php
diff options
context:
space:
mode:
Diffstat (limited to 'system/core/Input.php')
-rw-r--r--system/core/Input.php39
1 files changed, 23 insertions, 16 deletions
diff --git a/system/core/Input.php b/system/core/Input.php
index 1157601e1..3e82874fd 100644
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -30,7 +30,7 @@ class CI_Input {
var $ip_address = FALSE;
var $user_agent = FALSE;
- var $_allow_get_array = FALSE;
+ var $_allow_get_array = TRUE;
var $_standardize_newlines = TRUE;
var $_enable_xss = FALSE; // Set automatically based on config setting
var $_enable_csrf = FALSE; // Set automatically based on config setting
@@ -49,9 +49,9 @@ class CI_Input {
{
log_message('debug', "Input Class Initialized");
- $this->_allow_get_array = (config_item('enable_query_strings') === TRUE) ? TRUE : FALSE;
- $this->_enable_xss = (config_item('global_xss_filtering') === TRUE) ? TRUE : FALSE;
- $this->_enable_csrf = (config_item('csrf_protection') === TRUE) ? TRUE : FALSE;
+ $this->_allow_get_array = (config_item('allow_get_array') === TRUE);
+ $this->_enable_xss = (config_item('global_xss_filtering') === TRUE);
+ $this->_enable_csrf = (config_item('csrf_protection') === TRUE);
// Do we need to load the security class?
if ($this->_enable_xss == TRUE OR $this->_enable_csrf == TRUE)
@@ -216,14 +216,7 @@ class CI_Input {
}
else
{
- if ($expire > 0)
- {
- $expire = time() + $expire;
- }
- else
- {
- $expire = 0;
- }
+ $expire = ($expire > 0) ? time() + $expire : 0;
}
setcookie($prefix.$name, $value, $expire, $path, $domain, 0);
@@ -492,7 +485,7 @@ class CI_Input {
}
// We strip slashes if magic quotes is on to keep things consistent
- if (get_magic_quotes_gpc())
+ if (function_exists('get_magic_quotes_gpc') AND get_magic_quotes_gpc())
{
$str = stripslashes($str);
}
@@ -514,7 +507,7 @@ class CI_Input {
{
if (strpos($str, "\r") !== FALSE)
{
- $str = str_replace(array("\r\n", "\r"), "\n", $str);
+ $str = str_replace(array("\r\n", "\r"), PHP_EOL, $str);
}
}
@@ -625,19 +618,33 @@ class CI_Input {
}
// --------------------------------------------------------------------
-
+
/**
* Is ajax Request?
*
* Test to see if a request contains the HTTP_X_REQUESTED_WITH header
*
- * @return boolean
+ * @return boolean
*/
public function is_ajax_request()
{
return ($this->server('HTTP_X_REQUESTED_WITH') === 'XMLHttpRequest');
}
+ // --------------------------------------------------------------------
+
+ /**
+ * Is cli Request?
+ *
+ * Test to see if a request was made from the command line
+ *
+ * @return boolean
+ */
+ public function is_cli_request()
+ {
+ return (bool) defined('STDIN');
+ }
+
}
// END Input class