mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 20:30:39 +02:00
phpDoc fix
This commit is contained in:
@@ -38,7 +38,7 @@ class e_object
|
|||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $_params = array();
|
protected $_params = array();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of object id field
|
* Name of object id field
|
||||||
@@ -84,7 +84,7 @@ class e_object
|
|||||||
{
|
{
|
||||||
return $this->_field_id;
|
return $this->_field_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve object primary id field value
|
* Retrieve object primary id field value
|
||||||
*
|
*
|
||||||
@@ -125,7 +125,7 @@ class e_object
|
|||||||
{
|
{
|
||||||
return (isset($this->_data[$key]) ? $this->_data[$key] : $default);
|
return (isset($this->_data[$key]) ? $this->_data[$key] : $default);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get object data
|
* Get object data
|
||||||
* @return array
|
* @return array
|
||||||
@@ -134,7 +134,7 @@ class e_object
|
|||||||
{
|
{
|
||||||
return $this->_data;
|
return $this->_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overwrite data in the object for a single field.
|
* Overwrite data in the object for a single field.
|
||||||
*
|
*
|
||||||
@@ -147,7 +147,7 @@ class e_object
|
|||||||
$this->_data[$key] = $value;
|
$this->_data[$key] = $value;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set object data
|
* Set object data
|
||||||
* @return e_object
|
* @return e_object
|
||||||
@@ -157,7 +157,7 @@ class e_object
|
|||||||
$this->_data = $data;
|
$this->_data = $data;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update object data
|
* Update object data
|
||||||
* @return e_object
|
* @return e_object
|
||||||
@@ -170,7 +170,7 @@ class e_object
|
|||||||
}
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove object data key
|
* Remove object data key
|
||||||
*
|
*
|
||||||
@@ -182,7 +182,7 @@ class e_object
|
|||||||
unset($this->_data[$key]);
|
unset($this->_data[$key]);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset object data key
|
* Reset object data key
|
||||||
*
|
*
|
||||||
@@ -203,7 +203,7 @@ class e_object
|
|||||||
{
|
{
|
||||||
return (isset($this->_data[$key]));
|
return (isset($this->_data[$key]));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if key is set and not empty
|
* Check if key is set and not empty
|
||||||
* @param string $key
|
* @param string $key
|
||||||
@@ -213,7 +213,7 @@ class e_object
|
|||||||
{
|
{
|
||||||
return (isset($this->_data[$key]) && !empty($this->_data[$key]));
|
return (isset($this->_data[$key]) && !empty($this->_data[$key]));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if object has data
|
* Check if object has data
|
||||||
* @return boolean
|
* @return boolean
|
||||||
@@ -222,7 +222,7 @@ class e_object
|
|||||||
{
|
{
|
||||||
return !empty($this->_data);
|
return !empty($this->_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set parameter array
|
* Set parameter array
|
||||||
* @param array $params
|
* @param array $params
|
||||||
@@ -233,7 +233,7 @@ class e_object
|
|||||||
$this->_params = $params;
|
$this->_params = $params;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update parameter array
|
* Update parameter array
|
||||||
* @param array $params
|
* @param array $params
|
||||||
@@ -241,11 +241,11 @@ class e_object
|
|||||||
*/
|
*/
|
||||||
public function updateParams(array $params)
|
public function updateParams(array $params)
|
||||||
{
|
{
|
||||||
foreach ($params as $k => $v)
|
foreach ($params as $k => $v)
|
||||||
{
|
{
|
||||||
$this->setParam($k, $v);
|
$this->setParam($k, $v);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,7 +273,7 @@ class e_object
|
|||||||
unset($this->_params[$key]);
|
unset($this->_params[$key]);
|
||||||
}
|
}
|
||||||
else $this->_params[$key] = $value;
|
else $this->_params[$key] = $value;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -287,7 +287,7 @@ class e_object
|
|||||||
{
|
{
|
||||||
return (isset($this->_params[$key]) ? $this->_params[$key] : $default);
|
return (isset($this->_params[$key]) ? $this->_params[$key] : $default);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert object data to simple shortcodes (e_vars object)
|
* Convert object data to simple shortcodes (e_vars object)
|
||||||
* @return string
|
* @return string
|
||||||
@@ -295,8 +295,8 @@ class e_object
|
|||||||
public function toSc()
|
public function toSc()
|
||||||
{
|
{
|
||||||
return new e_vars($this->_data);
|
return new e_vars($this->_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert object data to array
|
* Convert object data to array
|
||||||
* @return string
|
* @return string
|
||||||
@@ -314,7 +314,7 @@ class e_object
|
|||||||
{
|
{
|
||||||
return $this->_data;
|
return $this->_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Magic method - convert object data to an array
|
* Magic method - convert object data to an array
|
||||||
*
|
*
|
||||||
@@ -353,7 +353,7 @@ class e_object
|
|||||||
/**
|
/**
|
||||||
* Magic setter
|
* Magic setter
|
||||||
* Triggered on e.g. <code><?php $e_object->myKey = 'someValue'; </code>
|
* Triggered on e.g. <code><?php $e_object->myKey = 'someValue'; </code>
|
||||||
*
|
*
|
||||||
* @param string $key
|
* @param string $key
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
*/
|
*/
|
||||||
@@ -468,7 +468,7 @@ class e_vars extends e_object
|
|||||||
{
|
{
|
||||||
return (!$this->hasData());
|
return (!$this->hasData());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if given data key is set
|
* Check if given data key is set
|
||||||
* @param string $key
|
* @param string $key
|
||||||
@@ -478,7 +478,7 @@ class e_vars extends e_object
|
|||||||
{
|
{
|
||||||
return $this->is($key);
|
return $this->is($key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No need of object conversion, optional cloning
|
* No need of object conversion, optional cloning
|
||||||
* @param boolean $clone return current object clone
|
* @param boolean $clone return current object clone
|
||||||
@@ -521,15 +521,15 @@ class e_model extends e_object
|
|||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $_db_table;
|
protected $_db_table;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current url Profile data
|
* Current url Profile data
|
||||||
* Example: array('route'=>'page/view/index', 'vars' => array('id' => 'page_id', 'sef' => 'page_sef'), 'name' => 'page_title', 'description' => '');
|
* Example: array('route'=>'page/view/index', 'vars' => array('id' => 'page_id', 'sef' => 'page_sef'), 'name' => 'page_title', 'description' => '');
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $_url = array();
|
protected $_url = array();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current Featurebox Profile data
|
* Current Featurebox Profile data
|
||||||
* Example: array('title' => 'page_title', 'text' => '');
|
* Example: array('title' => 'page_title', 'text' => '');
|
||||||
@@ -574,7 +574,7 @@ class e_model extends e_object
|
|||||||
*/
|
*/
|
||||||
protected $_cache_force = false;
|
protected $_cache_force = false;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Optional DB table - used for auto-load data from the DB
|
* Optional DB table - used for auto-load data from the DB
|
||||||
* @param string $table
|
* @param string $table
|
||||||
@@ -608,7 +608,7 @@ class e_model extends e_object
|
|||||||
$this->_url = $url;
|
$this->_url = $url;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get url profile
|
* Get url profile
|
||||||
* @return array
|
* @return array
|
||||||
@@ -617,7 +617,7 @@ class e_model extends e_object
|
|||||||
{
|
{
|
||||||
return $this->_url;
|
return $this->_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set model Featurebox Profile
|
* Set model Featurebox Profile
|
||||||
* @param string $table
|
* @param string $table
|
||||||
@@ -629,7 +629,7 @@ class e_model extends e_object
|
|||||||
$this->_featurebox = $fb;
|
$this->_featurebox = $fb;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Featurebox profile
|
* Get Featurebox profile
|
||||||
* @return array
|
* @return array
|
||||||
@@ -637,9 +637,9 @@ class e_model extends e_object
|
|||||||
public function getFeaturebox()
|
public function getFeaturebox()
|
||||||
{
|
{
|
||||||
return $this->_featurebox;
|
return $this->_featurebox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generic URL assembling method
|
* Generic URL assembling method
|
||||||
* @param array $options [optional] see eRouter::assemble() for $options structure
|
* @param array $options [optional] see eRouter::assemble() for $options structure
|
||||||
@@ -648,67 +648,67 @@ class e_model extends e_object
|
|||||||
*/
|
*/
|
||||||
public function url($options = array(), $extended = false)
|
public function url($options = array(), $extended = false)
|
||||||
{
|
{
|
||||||
$urldata = $this->getUrl();
|
$urldata = $this->getUrl();
|
||||||
if(empty($urldata) || !vartrue($urldata['route'])) return ($extended ? array() : null);
|
if(empty($urldata) || !vartrue($urldata['route'])) return ($extended ? array() : null);
|
||||||
|
|
||||||
$eurl = e107::getUrl();
|
$eurl = e107::getUrl();
|
||||||
|
|
||||||
if(empty($options)) $options = array();
|
if(empty($options)) $options = array();
|
||||||
elseif(!is_array($options)) parse_str($options, $options);
|
elseif(!is_array($options)) parse_str($options, $options);
|
||||||
|
|
||||||
$vars = $this->toArray();
|
$vars = $this->toArray();
|
||||||
if(!isset($options['allow']) || empty($options['allow']))
|
if(!isset($options['allow']) || empty($options['allow']))
|
||||||
{
|
{
|
||||||
if(vartrue($urldata['vars']) && is_array($urldata['vars']))
|
if(vartrue($urldata['vars']) && is_array($urldata['vars']))
|
||||||
{
|
{
|
||||||
$vars = array();
|
$vars = array();
|
||||||
foreach ($urldata['vars'] as $var => $field)
|
foreach ($urldata['vars'] as $var => $field)
|
||||||
{
|
{
|
||||||
if($field === true) $field = $var;
|
if($field === true) $field = $var;
|
||||||
$vars[$var] = $this->get($field);
|
$vars[$var] = $this->get($field);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$method = isset($options['sc']) ? 'sc' : 'create';
|
$method = isset($options['sc']) ? 'sc' : 'create';
|
||||||
|
|
||||||
$url = e107::getUrl()->$method($urldata['route'], $vars, $options);
|
$url = e107::getUrl()->$method($urldata['route'], $vars, $options);
|
||||||
|
|
||||||
if(!$extended)
|
if(!$extended)
|
||||||
{
|
{
|
||||||
return $url;
|
return $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'url' => $url,
|
'url' => $url,
|
||||||
'name' => vartrue($urldata['name']) ? $this->get($urldata['name']) : '',
|
'name' => vartrue($urldata['name']) ? $this->get($urldata['name']) : '',
|
||||||
'description' => vartrue($urldata['description']) ? $this->get($urldata['description']) : '',
|
'description' => vartrue($urldata['description']) ? $this->get($urldata['description']) : '',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generic Featurebox assembling method
|
* Generic Featurebox assembling method
|
||||||
* @return mixed URL string or extended array data
|
* @return mixed URL string or extended array data
|
||||||
*/
|
*/
|
||||||
public function featurebox($options = array(), $extended = false)
|
public function featurebox($options = array(), $extended = false)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get data fields array
|
* Get data fields array
|
||||||
* @return array
|
* @return array
|
||||||
@@ -893,14 +893,14 @@ class e_model extends e_object
|
|||||||
*
|
*
|
||||||
* If $index is specified it will assume that attribute data is an array
|
* If $index is specified it will assume that attribute data is an array
|
||||||
* and retrieve corresponding member.
|
* and retrieve corresponding member.
|
||||||
*
|
*
|
||||||
* NEW: '/' supported in keys now, just use double slashes '//' as key separator
|
* NEW: '/' supported in keys now, just use double slashes '//' as key separator
|
||||||
* Examples:
|
* Examples:
|
||||||
* - 'key//some/key/with/slashes//more' -> [key][some/key/with/slashes][more]
|
* - 'key//some/key/with/slashes//more' -> [key][some/key/with/slashes][more]
|
||||||
* - '//some/key' -> [some/key] - starting with // means - don't parse!
|
* - '//some/key' -> [some/key] - starting with // means - don't parse!
|
||||||
* - '///some/key/' -> [/some/key/]
|
* - '///some/key/' -> [/some/key/]
|
||||||
* - '//key//some/key/with/slashes//more' WRONG -> single key [key//some/key/with/slashes//more]
|
* - '//key//some/key/with/slashes//more' WRONG -> single key [key//some/key/with/slashes//more]
|
||||||
*
|
*
|
||||||
* @param string $key
|
* @param string $key
|
||||||
* @param mixed $default
|
* @param mixed $default
|
||||||
* @param integer $index
|
* @param integer $index
|
||||||
@@ -913,7 +913,7 @@ class e_model extends e_object
|
|||||||
{
|
{
|
||||||
return $this->$data_src;
|
return $this->$data_src;
|
||||||
}
|
}
|
||||||
|
|
||||||
$simple = false;
|
$simple = false;
|
||||||
if(strpos($key, '//') === 0)
|
if(strpos($key, '//') === 0)
|
||||||
{
|
{
|
||||||
@@ -923,11 +923,11 @@ class e_model extends e_object
|
|||||||
/*elseif($key[0] == '/')
|
/*elseif($key[0] == '/')
|
||||||
{
|
{
|
||||||
// just use it!
|
// just use it!
|
||||||
$simple = true;
|
$simple = true;
|
||||||
}*/
|
}*/
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$simple = strpos($key, '/') === false;
|
$simple = strpos($key, '/') === false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix - check if _data[path/to/value] really doesn't exist
|
// Fix - check if _data[path/to/value] really doesn't exist
|
||||||
@@ -938,7 +938,7 @@ class e_model extends e_object
|
|||||||
{
|
{
|
||||||
return $this->_parsed_keys[$data_src.'/'.$key];
|
return $this->_parsed_keys[$data_src.'/'.$key];
|
||||||
}
|
}
|
||||||
// new feature (double slash) - when searched key string is key//some/key/with/slashes//more
|
// new feature (double slash) - when searched key string is key//some/key/with/slashes//more
|
||||||
// -> search for 'key' => array('some/key/with/slashes', array('more' => value));
|
// -> search for 'key' => array('some/key/with/slashes', array('more' => value));
|
||||||
$keyArr = explode(strpos($key, '//') ? '//' : '/', $key);
|
$keyArr = explode(strpos($key, '//') ? '//' : '/', $key);
|
||||||
$data = $this->$data_src;
|
$data = $this->$data_src;
|
||||||
@@ -1023,7 +1023,7 @@ class e_model extends e_object
|
|||||||
* - '//some/key' -> [some/key] - starting with // means - don't parse!
|
* - '//some/key' -> [some/key] - starting with // means - don't parse!
|
||||||
* - '///some/key/' -> [/some/key/]
|
* - '///some/key/' -> [/some/key/]
|
||||||
* - '//key//some/key/with/slashes//more' WRONG -> single key [key//some/key/with/slashes//more]
|
* - '//key//some/key/with/slashes//more' WRONG -> single key [key//some/key/with/slashes//more]
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @param string|array $key
|
* @param string|array $key
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
@@ -1053,13 +1053,13 @@ class e_model extends e_object
|
|||||||
{
|
{
|
||||||
foreach($value as $k => $v)
|
foreach($value as $k => $v)
|
||||||
{
|
{
|
||||||
// new - $k couldn't be a path - e.g. 'key' 'value/value1'
|
// new - $k couldn't be a path - e.g. 'key' 'value/value1'
|
||||||
// will result in 'key' => 'value/value1' and NOT 'key' => array('value' => value1)
|
// will result in 'key' => 'value/value1' and NOT 'key' => array('value' => value1)
|
||||||
$this->_setData($key.'//'.$k, $v, true, $data_src);
|
$this->_setData($key.'//'.$k, $v, true, $data_src);
|
||||||
}
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
$simple = false;
|
$simple = false;
|
||||||
if(strpos($key, '//') === 0)
|
if(strpos($key, '//') === 0)
|
||||||
{
|
{
|
||||||
@@ -1072,14 +1072,14 @@ class e_model extends e_object
|
|||||||
}
|
}
|
||||||
/*elseif($key[0] == '/')
|
/*elseif($key[0] == '/')
|
||||||
{
|
{
|
||||||
$simple = true;
|
$simple = true;
|
||||||
}*/
|
}*/
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$simple = strpos($key, '/') === false;
|
$simple = strpos($key, '/') === false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//multidimensional array support - parse key
|
//multidimensional array support - parse key
|
||||||
if(!$simple)
|
if(!$simple)
|
||||||
{
|
{
|
||||||
//$key = trim($key, '/');
|
//$key = trim($key, '/');
|
||||||
@@ -1088,8 +1088,8 @@ class e_model extends e_object
|
|||||||
{
|
{
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// new feature (double slash) - when parsing key: key//some/key/with/slashes//more
|
// new feature (double slash) - when parsing key: key//some/key/with/slashes//more
|
||||||
// -> result is 'key' => array('some/key/with/slashes', array('more' => value));
|
// -> result is 'key' => array('some/key/with/slashes', array('more' => value));
|
||||||
$keyArr = explode(strpos($key, '//') ? '//' : '/', $key);
|
$keyArr = explode(strpos($key, '//') ? '//' : '/', $key);
|
||||||
//$keyArr = explode('/', $key);
|
//$keyArr = explode('/', $key);
|
||||||
@@ -1492,7 +1492,7 @@ class e_model extends e_object
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(!is_numeric($id)) $id = "'{$id}'";
|
if(!is_numeric($id)) $id = "'{$id}'";
|
||||||
|
|
||||||
$res = $sql->db_Select(
|
$res = $sql->db_Select(
|
||||||
$this->getModelTable(),
|
$this->getModelTable(),
|
||||||
$this->getParam('db_fields', '*'),
|
$this->getParam('db_fields', '*'),
|
||||||
@@ -1568,7 +1568,7 @@ class e_model extends e_object
|
|||||||
e107::getCache()->clear_sys($this->getCacheString(true), false);
|
e107::getCache()->clear_sys($this->getCacheString(true), false);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clrear system cache (public proxy) if enabled for the model
|
* Clrear system cache (public proxy) if enabled for the model
|
||||||
* @return e_model
|
* @return e_model
|
||||||
@@ -1738,15 +1738,15 @@ class e_model extends e_object
|
|||||||
{
|
{
|
||||||
$larr = localeconv();
|
$larr = localeconv();
|
||||||
$search = array(
|
$search = array(
|
||||||
$larr['decimal_point'],
|
$larr['decimal_point'],
|
||||||
$larr['mon_decimal_point'],
|
$larr['mon_decimal_point'],
|
||||||
$larr['thousands_sep'],
|
$larr['thousands_sep'],
|
||||||
$larr['mon_thousands_sep'],
|
$larr['mon_thousands_sep'],
|
||||||
$larr['currency_symbol'],
|
$larr['currency_symbol'],
|
||||||
$larr['int_curr_symbol']
|
$larr['int_curr_symbol']
|
||||||
);
|
);
|
||||||
$replace = array('.', '.', '', '', '', '');
|
$replace = array('.', '.', '', '', '', '');
|
||||||
|
|
||||||
return str_replace($search, $replace, $value);
|
return str_replace($search, $replace, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2214,7 +2214,7 @@ class e_front_model extends e_model
|
|||||||
|
|
||||||
$oldData = $this->getData();
|
$oldData = $this->getData();
|
||||||
// $this->addMessageDebug("OLDD".print_a($oldData,true));
|
// $this->addMessageDebug("OLDD".print_a($oldData,true));
|
||||||
|
|
||||||
|
|
||||||
$data = $this->getPostedData();
|
$data = $this->getPostedData();
|
||||||
|
|
||||||
@@ -2248,10 +2248,10 @@ class e_front_model extends e_model
|
|||||||
$this->setData($field, $dt, $strict)
|
$this->setData($field, $dt, $strict)
|
||||||
->removePostedData($field);
|
->removePostedData($field);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2301,8 +2301,8 @@ class e_front_model extends e_model
|
|||||||
{
|
{
|
||||||
$this->setData($key, $value, $strict);
|
$this->setData($key, $value, $strict);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@@ -2326,16 +2326,16 @@ class e_front_model extends e_model
|
|||||||
{
|
{
|
||||||
$data = $this->getPostedData();
|
$data = $this->getPostedData();
|
||||||
}
|
}
|
||||||
|
|
||||||
// New param to control validate process - useful when part of the data is going to be updated
|
// New param to control validate process - useful when part of the data is going to be updated
|
||||||
// Use it with cautious!!!
|
// Use it with cautious!!!
|
||||||
$availableOnly = false;
|
$availableOnly = false;
|
||||||
if($this->getParam('validateAvailable'))
|
if($this->getParam('validateAvailable'))
|
||||||
{
|
{
|
||||||
$availableOnly = true;
|
$availableOnly = true;
|
||||||
$this->setParam('validateAvailable', null); // reset it
|
$this->setParam('validateAvailable', null); // reset it
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->getValidator()->validate($data, $availableOnly);
|
return $this->getValidator()->validate($data, $availableOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2540,18 +2540,18 @@ class e_front_model extends e_model
|
|||||||
}
|
}
|
||||||
|
|
||||||
$qry['_FIELD_TYPES'] = $this->_FIELD_TYPES; //DB field types are optional
|
$qry['_FIELD_TYPES'] = $this->_FIELD_TYPES; //DB field types are optional
|
||||||
|
|
||||||
// support for tables with no auto-increment PK
|
// support for tables with no auto-increment PK
|
||||||
$id = $this->getId();
|
$id = $this->getId();
|
||||||
$qry['data'][$this->getFieldIdName()] = $id;
|
$qry['data'][$this->getFieldIdName()] = $id;
|
||||||
|
|
||||||
if($action == 'create' && !$id) $qry['_FIELD_TYPES'][$this->getFieldIdName()] = 'NULL';
|
if($action == 'create' && !$id) $qry['_FIELD_TYPES'][$this->getFieldIdName()] = 'NULL';
|
||||||
elseif(is_numeric($id)) $qry['_FIELD_TYPES'][$this->getFieldIdName()] = 'integer';
|
elseif(is_numeric($id)) $qry['_FIELD_TYPES'][$this->getFieldIdName()] = 'integer';
|
||||||
else $qry['_FIELD_TYPES'][$this->getFieldIdName()] = 'string';
|
else $qry['_FIELD_TYPES'][$this->getFieldIdName()] = 'string';
|
||||||
|
|
||||||
foreach ($this->_data_fields as $key => $type)
|
foreach ($this->_data_fields as $key => $type)
|
||||||
{
|
{
|
||||||
|
|
||||||
if($key == $this->getFieldIdName())
|
if($key == $this->getFieldIdName())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@@ -2560,14 +2560,14 @@ class e_front_model extends e_model
|
|||||||
{
|
{
|
||||||
$qry['_FIELD_TYPES'][$key] = $type; //_FIELD_TYPES much more optional now...
|
$qry['_FIELD_TYPES'][$key] = $type; //_FIELD_TYPES much more optional now...
|
||||||
}
|
}
|
||||||
|
|
||||||
if($qry['_FIELD_TYPES'][$key] == 'set') //new 'set' type, could be moved in mysql handler now
|
if($qry['_FIELD_TYPES'][$key] == 'set') //new 'set' type, could be moved in mysql handler now
|
||||||
{
|
{
|
||||||
$qry['_FIELD_TYPES'][$key] = 'str';
|
$qry['_FIELD_TYPES'][$key] = 'str';
|
||||||
if(is_array($this->getData($key))) $this->setData($key, implode(',', $this->getData($key)));
|
if(is_array($this->getData($key))) $this->setData($key, implode(',', $this->getData($key)));
|
||||||
}
|
}
|
||||||
$qry['data'][$key] = $this->getData($key);
|
$qry['data'][$key] = $this->getData($key);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch($action)
|
switch($action)
|
||||||
@@ -2583,11 +2583,11 @@ class e_front_model extends e_model
|
|||||||
unset($qry['data'][$this->getFieldIdName()]);
|
unset($qry['data'][$this->getFieldIdName()]);
|
||||||
if(is_numeric($id)) $id = intval($id);
|
if(is_numeric($id)) $id = intval($id);
|
||||||
else $id = "'".e107::getParser()->toDB($id)."'";
|
else $id = "'".e107::getParser()->toDB($id)."'";
|
||||||
$qry['WHERE'] = $this->getFieldIdName().'='.$id;
|
$qry['WHERE'] = $this->getFieldIdName().'='.$id;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->addMessageDebug('SQL Qry: '.print_a($qry,true), $session_messages);
|
$this->addMessageDebug('SQL Qry: '.print_a($qry,true), $session_messages);
|
||||||
return $qry;
|
return $qry;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2618,7 +2618,7 @@ class e_front_model extends e_model
|
|||||||
}
|
}
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isset($this->_data_fields[$key]))
|
if(!isset($this->_data_fields[$key]))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
@@ -2686,11 +2686,11 @@ class e_front_model extends e_model
|
|||||||
$this->_db_errno = 0;
|
$this->_db_errno = 0;
|
||||||
$this->_db_errmsg = '';
|
$this->_db_errmsg = '';
|
||||||
$this->_db_qry = '';
|
$this->_db_qry = '';
|
||||||
|
|
||||||
// $this->getData();
|
// $this->getData();
|
||||||
// $this->getPostedData();
|
// $this->getPostedData();
|
||||||
|
|
||||||
|
|
||||||
if($this->hasError()) return false;
|
if($this->hasError()) return false;
|
||||||
if(!$this->data_has_changed && !$force)
|
if(!$this->data_has_changed && !$force)
|
||||||
{
|
{
|
||||||
@@ -2700,7 +2700,7 @@ class e_front_model extends e_model
|
|||||||
$sql = e107::getDb();
|
$sql = e107::getDb();
|
||||||
$qry = $this->toSqlQuery('update');
|
$qry = $this->toSqlQuery('update');
|
||||||
$table = $this->getModelTable();
|
$table = $this->getModelTable();
|
||||||
|
|
||||||
$res = $sql->db_Update($table, $qry, $this->getParam('db_debug', false));
|
$res = $sql->db_Update($table, $qry, $this->getParam('db_debug', false));
|
||||||
if(!$res)
|
if(!$res)
|
||||||
{
|
{
|
||||||
@@ -2717,12 +2717,12 @@ class e_front_model extends e_model
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
$this->clearCache()->addMessageSuccess(LAN_UPDATED);
|
$this->clearCache()->addMessageSuccess(LAN_UPDATED);
|
||||||
|
|
||||||
e107::getAdminLog()->addSuccess('TABLE: '.$table, false);
|
e107::getAdminLog()->addSuccess('TABLE: '.$table, false);
|
||||||
e107::getAdminLog()->addSuccess('WHERE: '.$qry['WHERE'], false);
|
e107::getAdminLog()->addSuccess('WHERE: '.$qry['WHERE'], false);
|
||||||
e107::getAdminLog()->save('ADMINUI_02');
|
e107::getAdminLog()->save('ADMINUI_02');
|
||||||
|
|
||||||
|
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2741,7 +2741,7 @@ class e_front_model extends e_model
|
|||||||
|
|
||||||
if($from_post)
|
if($from_post)
|
||||||
{
|
{
|
||||||
//no strict copy, validate & sanitize
|
//no strict copy, validate & sanitize
|
||||||
$this->mergePostedData(false, true, true);
|
$this->mergePostedData(false, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2752,7 +2752,7 @@ class e_front_model extends e_model
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update record
|
* Update record
|
||||||
*
|
*
|
||||||
@@ -2848,7 +2848,7 @@ class e_admin_model extends e_front_model
|
|||||||
|
|
||||||
return $this->dbInsert($session_messages);
|
return $this->dbInsert($session_messages);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert record
|
* Insert record
|
||||||
*
|
*
|
||||||
@@ -2897,7 +2897,7 @@ class e_admin_model extends e_front_model
|
|||||||
$sql = e107::getDb();
|
$sql = e107::getDb();
|
||||||
$sqlQry = $this->toSqlQuery('create');
|
$sqlQry = $this->toSqlQuery('create');
|
||||||
$table = $this->getModelTable();
|
$table = $this->getModelTable();
|
||||||
|
|
||||||
$res = $sql->db_Insert($table, $sqlQry, $this->getParam('db_debug', false));
|
$res = $sql->db_Insert($table, $sqlQry, $this->getParam('db_debug', false));
|
||||||
if(!$res)
|
if(!$res)
|
||||||
{
|
{
|
||||||
@@ -2906,13 +2906,13 @@ class e_admin_model extends e_front_model
|
|||||||
$this->_db_qry = $sql->getLastQuery();
|
$this->_db_qry = $sql->getLastQuery();
|
||||||
$this->addMessageError('SQL Insert Error', $session_messages); //TODO - Lan
|
$this->addMessageError('SQL Insert Error', $session_messages); //TODO - Lan
|
||||||
$this->addMessageDebug('SQL Error #'.$this->_db_errno.': '.$sql->getLastErrorText());
|
$this->addMessageDebug('SQL Error #'.$this->_db_errno.': '.$sql->getLastErrorText());
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
e107::getAdminLog()->save('ADMINUI_01');
|
e107::getAdminLog()->save('ADMINUI_01');
|
||||||
// e107::getAdminLog()->clear()->addSuccess($table,false)->addArray($sqlQry)->save('ADMINUI_01');
|
// e107::getAdminLog()->clear()->addSuccess($table,false)->addArray($sqlQry)->save('ADMINUI_01');
|
||||||
|
|
||||||
// Set the reutrned ID
|
// Set the reutrned ID
|
||||||
$this->setId($res);
|
$this->setId($res);
|
||||||
$this->clearCache()->addMessageSuccess(LAN_CREATED);
|
$this->clearCache()->addMessageSuccess(LAN_CREATED);
|
||||||
@@ -2929,9 +2929,9 @@ class e_admin_model extends e_front_model
|
|||||||
protected function dbReplace($force = false, $session_messages = false)
|
protected function dbReplace($force = false, $session_messages = false)
|
||||||
{
|
{
|
||||||
$this->_db_errno = 0;
|
$this->_db_errno = 0;
|
||||||
$this->_db_errmsg = '';
|
$this->_db_errmsg = '';
|
||||||
$this->_db_qry = '';
|
$this->_db_qry = '';
|
||||||
|
|
||||||
if($this->hasError()) return false;
|
if($this->hasError()) return false;
|
||||||
if(!$this->data_has_changed && !$force)
|
if(!$this->data_has_changed && !$force)
|
||||||
{
|
{
|
||||||
@@ -2968,7 +2968,7 @@ class e_admin_model extends e_front_model
|
|||||||
$this->_db_errno = 0;
|
$this->_db_errno = 0;
|
||||||
$this->_db_errmsg = '';
|
$this->_db_errmsg = '';
|
||||||
$this->_db_qry = '';
|
$this->_db_qry = '';
|
||||||
|
|
||||||
if($this->hasError())
|
if($this->hasError())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -3118,7 +3118,7 @@ class e_tree_model extends e_front_model
|
|||||||
{
|
{
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
e107::getCache()->set_sys(
|
e107::getCache()->set_sys(
|
||||||
$this->getCacheString(true),
|
$this->getCacheString(true),
|
||||||
$this->toString(false, null, $this->getParam('nocount') ? false : true),
|
$this->toString(false, null, $this->getParam('nocount') ? false : true),
|
||||||
@@ -3177,11 +3177,11 @@ class e_tree_model extends e_front_model
|
|||||||
|
|
||||||
$this->_total = false;
|
$this->_total = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->isCacheEnabled() && !$this->getParam('noCacheStringModify'))
|
if($this->isCacheEnabled() && !$this->getParam('noCacheStringModify'))
|
||||||
{
|
{
|
||||||
$str = !$this->getParam('db_query')
|
$str = !$this->getParam('db_query')
|
||||||
?
|
?
|
||||||
$this->getModelTable()
|
$this->getModelTable()
|
||||||
.$this->getParam('nocount')
|
.$this->getParam('nocount')
|
||||||
.$this->getParam('db_where')
|
.$this->getParam('db_where')
|
||||||
@@ -3189,7 +3189,7 @@ class e_tree_model extends e_front_model
|
|||||||
.$this->getParam('db_limit')
|
.$this->getParam('db_limit')
|
||||||
:
|
:
|
||||||
$this->getParam('db_query');
|
$this->getParam('db_query');
|
||||||
|
|
||||||
$this->setCacheString($this->getCacheString().'_'.md5($str));
|
$this->setCacheString($this->getCacheString().'_'.md5($str));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3199,7 +3199,7 @@ class e_tree_model extends e_front_model
|
|||||||
$this->_loadFromArray($cached);
|
$this->_loadFromArray($cached);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
$class_name = $this->getParam('model_class', 'e_model');
|
$class_name = $this->getParam('model_class', 'e_model');
|
||||||
// auto-load all
|
// auto-load all
|
||||||
if(!$this->getParam('db_query') && $this->getModelTable())
|
if(!$this->getParam('db_query') && $this->getModelTable())
|
||||||
@@ -3235,12 +3235,12 @@ class e_tree_model extends e_front_model
|
|||||||
{
|
{
|
||||||
//SQL_CALC_FOUND_ROWS not found in the query, do one more query
|
//SQL_CALC_FOUND_ROWS not found in the query, do one more query
|
||||||
// $this->_total = e107::getDb()->db_Count($this->getModelTable()); // fails with specific listQry
|
// $this->_total = e107::getDb()->db_Count($this->getModelTable()); // fails with specific listQry
|
||||||
|
|
||||||
// Calculates correct total when using filters and search. //XXX Optimize.
|
// Calculates correct total when using filters and search. //XXX Optimize.
|
||||||
$countQry = preg_replace('/(LIMIT ([\d,\s])*)$/', "", $this->getParam('db_query'));
|
$countQry = preg_replace('/(LIMIT ([\d,\s])*)$/', "", $this->getParam('db_query'));
|
||||||
|
|
||||||
$this->_total = e107::getDb()->gen($countQry);
|
$this->_total = e107::getDb()->gen($countQry);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($tmp);
|
unset($tmp);
|
||||||
@@ -3498,7 +3498,7 @@ class e_front_tree_model extends e_tree_model
|
|||||||
{
|
{
|
||||||
$syncvalue = $value;
|
$syncvalue = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($sanitize)
|
if($sanitize)
|
||||||
{
|
{
|
||||||
$ids = array_map(array($tp, 'toDB'), $ids);
|
$ids = array_map(array($tp, 'toDB'), $ids);
|
||||||
@@ -3511,7 +3511,7 @@ class e_front_tree_model extends e_tree_model
|
|||||||
$this->_db_errno = $sql->getLastErrorNumber();
|
$this->_db_errno = $sql->getLastErrorNumber();
|
||||||
$this->_db_errmsg = $sql->getLastErrorText();
|
$this->_db_errmsg = $sql->getLastErrorText();
|
||||||
$this->_db_qry = $sql->getLastQuery();
|
$this->_db_qry = $sql->getLastQuery();
|
||||||
|
|
||||||
if(!$res)
|
if(!$res)
|
||||||
{
|
{
|
||||||
if($sql->getLastErrorNumber())
|
if($sql->getLastErrorNumber())
|
||||||
@@ -3536,7 +3536,7 @@ class e_front_tree_model extends e_tree_model
|
|||||||
{
|
{
|
||||||
$node = $this->getNode($id);
|
$node = $this->getNode($id);
|
||||||
if(!$node) continue;
|
if(!$node) continue;
|
||||||
|
|
||||||
if(null !== $syncvalue)
|
if(null !== $syncvalue)
|
||||||
{
|
{
|
||||||
$node->set($field, $syncvalue)
|
$node->set($field, $syncvalue)
|
||||||
@@ -3575,15 +3575,15 @@ class e_admin_tree_model extends e_front_tree_model
|
|||||||
$sql = e107::getDb();
|
$sql = e107::getDb();
|
||||||
$table = $this->getModelTable();
|
$table = $this->getModelTable();
|
||||||
$sqlQry = $this->getFieldIdName().' IN (\''.$idstr.'\')';
|
$sqlQry = $this->getFieldIdName().' IN (\''.$idstr.'\')';
|
||||||
|
|
||||||
$res = $sql->db_Delete($table, $sqlQry);
|
$res = $sql->db_Delete($table, $sqlQry);
|
||||||
|
|
||||||
$this->_db_errno = $sql->getLastErrorNumber();
|
$this->_db_errno = $sql->getLastErrorNumber();
|
||||||
$this->_db_errmsg = $sql->getLastErrorText();
|
$this->_db_errmsg = $sql->getLastErrorText();
|
||||||
$this->_db_qry = $sql->getLastQuery();
|
$this->_db_qry = $sql->getLastQuery();
|
||||||
|
|
||||||
$modelCacheCheck = $this->getParam('clearModelCache');
|
$modelCacheCheck = $this->getParam('clearModelCache');
|
||||||
|
|
||||||
if(!$res)
|
if(!$res)
|
||||||
{
|
{
|
||||||
if($sql->getLastErrorNumber())
|
if($sql->getLastErrorNumber())
|
||||||
@@ -3615,7 +3615,7 @@ class e_admin_tree_model extends e_front_tree_model
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Batch Copy Table Rows.
|
* Batch Copy Table Rows.
|
||||||
*/
|
*/
|
||||||
public function copy($ids)
|
public function copy($ids)
|
||||||
{
|
{
|
||||||
@@ -3635,25 +3635,25 @@ class e_admin_tree_model extends e_front_tree_model
|
|||||||
{
|
{
|
||||||
$this->addMessageError('SQL Copy Error', $session_messages); //TODO - Lan
|
$this->addMessageError('SQL Copy Error', $session_messages); //TODO - Lan
|
||||||
$this->addMessageDebug('SQL Error #'.$sql->getLastErrorNumber().': '.$sql->getLastErrorText());
|
$this->addMessageDebug('SQL Error #'.$sql->getLastErrorNumber().': '.$sql->getLastErrorText());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->_db_errno = $sql->getLastErrorNumber();
|
$this->_db_errno = $sql->getLastErrorNumber();
|
||||||
$this->_db_errmsg = $sql->getLastErrorText();
|
$this->_db_errmsg = $sql->getLastErrorText();
|
||||||
$this->_db_qry = $sql->getLastQuery();
|
$this->_db_qry = $sql->getLastQuery();
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get urls/url data for given nodes
|
* Get urls/url data for given nodes
|
||||||
*/
|
*/
|
||||||
public function url($ids, $options = array(), $extended = false)
|
public function url($ids, $options = array(), $extended = false)
|
||||||
{
|
{
|
||||||
$ret = array();
|
$ret = array();
|
||||||
foreach ($ids as $id)
|
foreach ($ids as $id)
|
||||||
{
|
{
|
||||||
if(!$this->hasNode($id)) continue;
|
if(!$this->hasNode($id)) continue;
|
||||||
|
|
||||||
$model = $this->getNode($id);
|
$model = $this->getNode($id);
|
||||||
if($this->getUrl()) $model->setUrl($this->getUrl()); // copy url config data if available
|
if($this->getUrl()) $model->setUrl($this->getUrl()); // copy url config data if available
|
||||||
$ret[$id] = $model->url($options, $extended);
|
$ret[$id] = $model->url($options, $extended);
|
||||||
|
@@ -335,7 +335,7 @@ class xmlClass
|
|||||||
/**
|
/**
|
||||||
* Set Xml tags that should always return arrays.
|
* Set Xml tags that should always return arrays.
|
||||||
*
|
*
|
||||||
* @param object $string (comma separated)
|
* @param string $string (comma separated)
|
||||||
* @return xmlClass
|
* @return xmlClass
|
||||||
*/
|
*/
|
||||||
public function setOptArrayTags($string)
|
public function setOptArrayTags($string)
|
||||||
|
Reference in New Issue
Block a user