mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 05:07:27 +02:00
Fixes #140: Sitelinks: Inline editing broken
This commit is contained in:
@@ -4547,7 +4547,11 @@ class e_admin_ui extends e_admin_controller_ui
|
|||||||
$_POST[$_name] = $_value; // set current field only
|
$_POST[$_name] = $_value; // set current field only
|
||||||
|
|
||||||
// generic handler - same as regular edit form submit
|
// generic handler - same as regular edit form submit
|
||||||
$res = $this->_manageSubmit('beforeUpdate', 'afterUpdate', 'onUpdateError', 'edit');
|
$this->convertToData($_POST);
|
||||||
|
$model->setPostedData($_POST, null, false, false)
|
||||||
|
->setParam('validateAvailable', true) // new param to control validate of available data only, reset on validate event
|
||||||
|
->update(true);
|
||||||
|
//$res = $this->_manageSubmit('beforeUpdate', 'afterUpdate', 'onUpdateError', 'edit');
|
||||||
|
|
||||||
if($model->hasError())
|
if($model->hasError())
|
||||||
{
|
{
|
||||||
|
@@ -2204,17 +2204,6 @@ class e_front_model extends e_model
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX - Wrong? Should validator keep track on validated data at all?
|
|
||||||
// retrieve only valid data
|
|
||||||
if($validate)
|
|
||||||
{
|
|
||||||
$data = $this->getValidator()->getValidData();
|
|
||||||
}
|
|
||||||
else // retrieve all posted data
|
|
||||||
{
|
|
||||||
$data = $this->getPostedData();
|
|
||||||
}*/
|
|
||||||
|
|
||||||
$data = $this->getPostedData();
|
$data = $this->getPostedData();
|
||||||
$valid_data = $validate ? $this->getValidator()->getValidData() : array();
|
$valid_data = $validate ? $this->getValidator()->getValidData() : array();
|
||||||
|
|
||||||
@@ -2312,7 +2301,17 @@ class e_front_model extends e_model
|
|||||||
{
|
{
|
||||||
$data = $this->getPostedData();
|
$data = $this->getPostedData();
|
||||||
}
|
}
|
||||||
return $this->getValidator()->validate($data);
|
|
||||||
|
// New param to control validate process - useful when part of the data is going to be updated
|
||||||
|
// Use it with cautious!!!
|
||||||
|
$availableOnly = false;
|
||||||
|
if($this->getParam('validateAvailable'))
|
||||||
|
{
|
||||||
|
$availableOnly = true;
|
||||||
|
$this->setParam('validateAvailable', null); // reset it
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->getValidator()->validate($data, $availableOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -295,9 +295,10 @@ class e_validator
|
|||||||
* Validate data
|
* Validate data
|
||||||
*
|
*
|
||||||
* @param array $data
|
* @param array $data
|
||||||
|
* @param boolean $availableOnly check only against available data if true
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function validate($data)
|
function validate($data, $availableOnly = false)
|
||||||
{
|
{
|
||||||
$this->reset();
|
$this->reset();
|
||||||
|
|
||||||
@@ -310,8 +311,12 @@ class e_validator
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$fieldList = $rules;
|
||||||
|
if($availableOnly) $fieldList = array_keys($data);
|
||||||
|
|
||||||
foreach ($rules as $field_name)
|
foreach ($rules as $field_name)
|
||||||
{
|
{
|
||||||
|
if(!in_array($field_name, $fieldList)) continue;
|
||||||
$value = varset($data[$field_name], null);
|
$value = varset($data[$field_name], null);
|
||||||
$required = $this->isRequiredField($field_name);
|
$required = $this->isRequiredField($field_name);
|
||||||
if(($required || $this->isOptionalField($field_name)) && !$this->validateField($field_name, $value, $required))
|
if(($required || $this->isOptionalField($field_name)) && !$this->validateField($field_name, $value, $required))
|
||||||
|
Reference in New Issue
Block a user