mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-07-18 02:42:40 -04:00
Upgrade to CI3.0.6
This commit is contained in:
@@ -450,7 +450,7 @@ class CI_Form_validation {
|
||||
$this->CI->lang->load('form_validation');
|
||||
|
||||
// Cycle through the rules for each field and match the corresponding $validation_data item
|
||||
foreach ($this->_field_data as $field => $row)
|
||||
foreach ($this->_field_data as $field => &$row)
|
||||
{
|
||||
// Fetch the data from the validation_data array item and cache it in the _field_data array.
|
||||
// Depending on whether the field name is an array or a string will determine where we get it from.
|
||||
@@ -467,7 +467,7 @@ class CI_Form_validation {
|
||||
// Execute validation rules
|
||||
// Note: A second foreach (for now) is required in order to avoid false-positives
|
||||
// for rules like 'matches', which correlate to other validation fields.
|
||||
foreach ($this->_field_data as $field => $row)
|
||||
foreach ($this->_field_data as $field => &$row)
|
||||
{
|
||||
// Don't try to validate if we have no rules set
|
||||
if (empty($row['rules']))
|
||||
@@ -475,7 +475,7 @@ class CI_Form_validation {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->_execute($row, $row['rules'], $this->_field_data[$field]['postdata']);
|
||||
$this->_execute($row, $row['rules'], $row['postdata']);
|
||||
}
|
||||
|
||||
// Did we end up with any errors?
|
||||
@@ -486,7 +486,7 @@ class CI_Form_validation {
|
||||
}
|
||||
|
||||
// Now we need to re-set the POST data with the new, processed data
|
||||
$this->_reset_post_array();
|
||||
empty($this->validation_data) && $this->_reset_post_array();
|
||||
|
||||
return ($total_errors === 0);
|
||||
}
|
||||
@@ -527,10 +527,7 @@ class CI_Form_validation {
|
||||
{
|
||||
if ($row['is_array'] === FALSE)
|
||||
{
|
||||
if (isset($_POST[$row['field']]))
|
||||
{
|
||||
$_POST[$row['field']] = $row['postdata'];
|
||||
}
|
||||
isset($_POST[$field]) && $_POST[$field] = $row['postdata'];
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -550,20 +547,7 @@ class CI_Form_validation {
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($row['postdata']))
|
||||
{
|
||||
$array = array();
|
||||
foreach ($row['postdata'] as $k => $v)
|
||||
{
|
||||
$array[$k] = $v;
|
||||
}
|
||||
|
||||
$post_ref = $array;
|
||||
}
|
||||
else
|
||||
{
|
||||
$post_ref = $row['postdata'];
|
||||
}
|
||||
$post_ref = $row['postdata'];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -583,7 +567,10 @@ class CI_Form_validation {
|
||||
protected function _execute($row, $rules, $postdata = NULL, $cycles = 0)
|
||||
{
|
||||
// If the $_POST data is an array we will run a recursive call
|
||||
if (is_array($postdata))
|
||||
//
|
||||
// Note: We MUST check if the array is empty or not!
|
||||
// Otherwise empty arrays will always pass validation.
|
||||
if (is_array($postdata) && ! empty($postdata))
|
||||
{
|
||||
foreach ($postdata as $key => $val)
|
||||
{
|
||||
@@ -1512,10 +1499,11 @@ class CI_Form_validation {
|
||||
* This function allows HTML to be safely shown in a form.
|
||||
* Special characters are converted.
|
||||
*
|
||||
* @param string
|
||||
* @return string
|
||||
* @deprecated 3.0.6 Not used anywhere within the framework and pretty much useless
|
||||
* @param mixed $data Input data
|
||||
* @return mixed
|
||||
*/
|
||||
public function prep_for_form($data = '')
|
||||
public function prep_for_form($data)
|
||||
{
|
||||
if ($this->_safe_form_data === FALSE OR empty($data))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user