mirror of
https://github.com/e107inc/e107.git
synced 2025-04-20 20:51:53 +02:00
Send field and field-type values to e_parse toDB
This commit is contained in:
parent
375d019169
commit
0b920163a6
@ -4269,6 +4269,7 @@ class e_admin_ui extends e_admin_controller_ui
|
||||
|
||||
protected $fieldTypes = array();
|
||||
protected $dataFields = array();
|
||||
protected $fieldInputTypes = array();
|
||||
protected $validationRules = array();
|
||||
|
||||
protected $table;
|
||||
@ -5696,6 +5697,10 @@ class e_admin_ui extends e_admin_controller_ui
|
||||
if(($key !== 'options' && false !== varset($att['data']) && null !== varset($att['type'],null) && !vartrue($att['noedit'])) || vartrue($att['forceSave']))
|
||||
{
|
||||
$this->dataFields[$key] = vartrue($att['data'], 'str');
|
||||
if(!empty($att['type']))
|
||||
{
|
||||
$this->fieldInputTypes[$key] = $att['type'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -5728,12 +5733,15 @@ class e_admin_ui extends e_admin_controller_ui
|
||||
if($this->_model) return $this;
|
||||
|
||||
// default model
|
||||
|
||||
|
||||
$this->_model = new e_admin_model();
|
||||
$this->_model->setModelTable($this->table)
|
||||
->setFieldIdName($this->pid)
|
||||
->setUrl($this->url)
|
||||
->setValidationRules($this->validationRules)
|
||||
->setDbTypes($this->fieldTypes)
|
||||
->setFieldInputTypes($this->fieldInputTypes)
|
||||
->setDataFields($this->dataFields)
|
||||
->setMessageStackName('admin_ui_model_'.$this->table)
|
||||
->setParam('db_query', $this->editQry);
|
||||
|
@ -489,7 +489,7 @@ class e_parse extends e_parser
|
||||
* @return string
|
||||
* @todo complete the documentation of this essential method
|
||||
*/
|
||||
public function toDB($data, $nostrip =false, $no_encode = false, $mod = false, $original_author = false)
|
||||
public function toDB($data, $nostrip =false, $no_encode = false, $mod = false, $parm = null)
|
||||
{
|
||||
$core_pref = e107::getConfig();
|
||||
|
||||
@ -550,12 +550,11 @@ class e_parse extends e_parser
|
||||
$no_encode = true;
|
||||
}
|
||||
|
||||
if (is_numeric($original_author) && !check_class($core_pref->get('post_html'), '', $original_author))
|
||||
if($parm !== null && is_numeric($parm) && !check_class($core_pref->get('post_html'), '', $parm))
|
||||
{
|
||||
$no_encode = false;
|
||||
}
|
||||
|
||||
|
||||
if ($no_encode === true && strpos($mod, 'no_html') === false)
|
||||
{
|
||||
$search = array('$', '"', "'", '\\', '<?');
|
||||
@ -595,8 +594,8 @@ class e_parse extends e_parser
|
||||
$opts = array(
|
||||
'nostrip' => $nostrip,
|
||||
'noencode' => $no_encode,
|
||||
'mode' => $mod,
|
||||
'author' => $original_author
|
||||
'type' => $parm['type'],
|
||||
'field' => $parm['field']
|
||||
);
|
||||
|
||||
foreach($eParseList as $plugin)
|
||||
|
@ -514,6 +514,17 @@ class e_model extends e_object
|
||||
*/
|
||||
protected $_data_fields = array();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Current model field types eg. text, bbarea, dropdown etc.
|
||||
*
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_field_input_types = array();
|
||||
|
||||
|
||||
/**
|
||||
* Current model DB table, used in all db calls
|
||||
*
|
||||
@ -719,6 +730,21 @@ class e_model extends e_object
|
||||
return $this->_data_fields;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $key
|
||||
* @return bool
|
||||
*/
|
||||
public function getFieldInputType($key)
|
||||
{
|
||||
if(isset($this->_field_input_types[$key]))
|
||||
{
|
||||
return $this->_field_input_types[$key];
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Predefined data fields in format key => type
|
||||
* @return e_model
|
||||
@ -729,6 +755,16 @@ class e_model extends e_object
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Predefined data fields in format key => type
|
||||
* @return e_model
|
||||
*/
|
||||
public function setFieldInputTypes($fields)
|
||||
{
|
||||
$this->_field_input_types = $fields;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Predefined data field
|
||||
* @return e_model
|
||||
@ -2646,6 +2682,7 @@ class e_front_model extends e_model
|
||||
$value = $this->getPostedData($key);
|
||||
}
|
||||
|
||||
|
||||
switch ($type)
|
||||
{
|
||||
case 'int':
|
||||
@ -2660,7 +2697,8 @@ class e_front_model extends e_model
|
||||
case 'str':
|
||||
case 'string':
|
||||
case 'array':
|
||||
return $tp->toDB($value, false, false, 'model');
|
||||
$type = $this->getFieldInputType($key);
|
||||
return $tp->toDB($value, false, false, 'model', array('type'=>$type, 'field'=>$key));
|
||||
break;
|
||||
|
||||
case 'json':
|
||||
|
Loading…
x
Reference in New Issue
Block a user