DB IO updates for settings return, Smarty Extended update

Update core template main body with better position for overlib init,
pagename div id add, remove px from any size call (width)

DB IO adds return for config settings, fix db async check to always
return boolean only, add had error variable return method

Some minor fixes in Smarty Extended for some legacy admin page variables
needed.

Update Error reporting to be self containing with defines
This commit is contained in:
Clemens Schwaighofer
2021-07-26 16:09:51 +09:00
parent 8577345799
commit a86ae3efc3
8 changed files with 64 additions and 31 deletions

View File

@@ -288,7 +288,7 @@ class IO extends \CoreLibs\Basic
private $nbsp = ''; // used by print_array recursion function
// error & warning id
protected $error_id;
private $had_error;
private $had_error = 0;
private $warning_id;
private $had_warning;
// error thrown on class init if we cannot connect to db
@@ -1097,6 +1097,25 @@ class IO extends \CoreLibs\Basic
case 'user':
$setting = $this->db_user;
break;
case 'encoding':
$setting = $this->db_encoding;
break;
case 'schema':
$setting = $this->db_schema;
break;
case 'host':
$setting = $this->db_host;
break;
case 'port':
$setting = $this->db_port;
break;
case 'ssl':
$setting = $this->db_ssl;
break;
// we return *** and never the actual password
case 'password':
$setting = '***';
break;
default:
$setting = false;
break;
@@ -1439,9 +1458,10 @@ class IO extends \CoreLibs\Basic
/**
* checks a previous async query and returns data if finished
* NEEDS : dbExecAsync
* @return bool true if the query is still running, false if an error occured or cursor of that query
* @return bool|resource cursor resource if the query is still running,
* false if an error occured or cursor of that query
*/
public function dbCheckAsync(): bool
public function dbCheckAsync()
{
// if there is actually a async query there
if ($this->async_running) {
@@ -2376,6 +2396,17 @@ class IO extends \CoreLibs\Basic
trigger_error('Method ' . __METHOD__ . ' is deprecated, use dbGetNumRows()', E_USER_DEPRECATED);
return $this->dbGetNumRows();
}
/**
* Sets error number that was last
* So we always have the last error number stored even if a new one is created
*
* @return int last error number
*/
public function getHadError()
{
return $this->had_error;
}
// end if db class
}

View File

@@ -361,6 +361,11 @@ class SmartyExtend extends SmartyBC
$this->HEADER['ENCODING'] = $this->encoding;
$this->HEADER['DEFAULT_ENCODING'] = DEFAULT_ENCODING;
// form name
$this->DATA['FORM_NAME'] = !$this->FORM_NAME ?
str_replace('.php', '', $this->page_name) :
$this->FORM_NAME;
$this->DATA['FORM_ACTION'] = $this->FORM_ACTION;
// special for admin
if ($admin_call === true) {
// set ACL extra show
@@ -385,6 +390,7 @@ class SmartyExtend extends SmartyBC
// the page name
$this->DATA['page_name'] = $this->page_name;
$this->DATA['table_width'] = $this->PAGE_WIDTH ?? PAGE_WIDTH;
$this->DATA['form_name'] = $this->DATA['FORM_NAME'];
// for tinymce special
$this->DATA['TINYMCE_LANG'] = $this->lang_short;
// include flags
@@ -404,11 +410,6 @@ class SmartyExtend extends SmartyBC
// LANG
$this->DATA['LANG'] = $this->lang;
// form name
$this->DATA['FORM_NAME'] = !$this->FORM_NAME ?
str_replace('.php', '', $this->page_name) :
$this->FORM_NAME;
$this->DATA['FORM_ACTION'] = $this->FORM_ACTION;
// include flags
$this->DATA['JS_DATEPICKR'] = $this->JS_DATEPICKR;
$this->DATA['JS_FLATPICKR'] = $this->JS_FLATPICKR;