1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-04 05:37:32 +02:00

Code cleanup

This commit is contained in:
Cameron
2020-12-18 13:24:14 -08:00
parent 7238743542
commit 2b8a3cff60

View File

@@ -265,7 +265,7 @@ class e_object
* *
* @param string $key * @param string $key
* @param mixed $value * @param mixed $value
* @return e_tree_model * @return mixed|e_tree_model
*/ */
public function setParam($key, $value) public function setParam($key, $value)
{ {
@@ -590,7 +590,7 @@ class e_model extends e_object
/** /**
* 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
* @return e_model * @return string
*/ */
public function getModelTable() public function getModelTable()
{ {
@@ -665,8 +665,14 @@ class e_model extends e_object
$eurl = e107::getUrl(); $eurl = e107::getUrl();
if(empty($options)) $options = array(); if (empty($options))
elseif(!is_array($options)) parse_str($options, $options); {
$options = array();
}
elseif(is_string($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']))
@@ -3571,7 +3577,9 @@ class e_tree_model extends e_front_model
*/ */
protected function countResults($sql) protected function countResults($sql)
{ {
$this->_total = is_int($sql->total_results) ? $sql->total_results : false; //requires SQL_CALC_FOUND_ROWS in query - see db handler $total = $sql->foundRows();
$this->_total = is_int($total) ? $total : false; //requires SQL_CALC_FOUND_ROWS in query - see db handler
if(false === $this->_total && $this->getModelTable() && !$this->getParam('nocount')) if(false === $this->_total && $this->getModelTable() && !$this->getParam('nocount'))
{ {
//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