summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/core/Input.php18
-rw-r--r--system/libraries/Form_validation.php14
2 files changed, 20 insertions, 12 deletions
diff --git a/system/core/Input.php b/system/core/Input.php
index eb2048e58..3a52e37aa 100644
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -618,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
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index f45760024..9fe76b5f2 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -171,7 +171,7 @@ class CI_Form_validation {
}
$this->_error_messages = array_merge($this->_error_messages, $lang);
-
+
return $this;
}
@@ -191,7 +191,7 @@ class CI_Form_validation {
{
$this->_error_prefix = $prefix;
$this->_error_suffix = $suffix;
-
+
return $this;
}
@@ -339,13 +339,7 @@ class CI_Form_validation {
}
}
- preg_match_all('/([a-zA-Z_-]*(\[.*\])?)\|?/i', $row['rules'], $matches);
-
- $rules = $matches[1];
- array_pop($rules);
- unset($matches);
-
- $this->_execute($row, $rules, $this->_field_data[$field]['postdata']);
+ $this->_execute($row, explode('|', $row['rules']), $this->_field_data[$field]['postdata']);
}
// Did we end up with any errors?
@@ -742,7 +736,7 @@ class CI_Form_validation {
{
return array_shift($this->_field_data[$field]['postdata']);
}
-
+
return $this->_field_data[$field]['postdata'];
}