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:
@@ -84,6 +84,7 @@ $options = [
|
||||
];
|
||||
|
||||
$smarty->DATA['drop_down_test'] = $options;
|
||||
$smarty->DATA['drop_down_test_selected'] = '';
|
||||
$smarty->DATA['loop_start'] = 2;
|
||||
// require BASE.INCLUDES.'admin_smarty.php';
|
||||
$smarty->setSmartyVarsAdmin();
|
||||
|
||||
@@ -133,8 +133,8 @@ define('USE_SCRIPTACULOUS', false);
|
||||
define('USE_JQUERY', true);
|
||||
|
||||
/************* LAYOUT WIDTHS *************/
|
||||
define('PAGE_WIDTH', 800);
|
||||
define('CONTENT_WIDTH', 800);
|
||||
define('PAGE_WIDTH', '100%');
|
||||
define('CONTENT_WIDTH', '100%');
|
||||
// the default template name
|
||||
define('MASTER_TEMPLATE_NAME', 'main_body.tpl');
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
// DEFINE('SOME_ID', <SOME VALUE>);
|
||||
// define('SOME_ID', <SOME VALUE>);
|
||||
|
||||
/************* CONVERT *******************/
|
||||
// this only needed if the external thumbnail create is used
|
||||
|
||||
@@ -100,10 +100,10 @@
|
||||
</script>
|
||||
<!-- /TinyMCE -->
|
||||
{/if}
|
||||
{popup_init src="`$js`/overlib/overlib.js"}
|
||||
</head>
|
||||
<body>
|
||||
<div style="margin: 2px; width: {$table_width}px; margin-bottom: 10px;">
|
||||
{popup_init src="`$js`/overlib/overlib.js"}
|
||||
<div style="margin: 2px; width: {$table_width}; margin-bottom: 10px;">
|
||||
<div style="position: relative; height: 20px;" class="menu">
|
||||
<div style="position: absolute; width: 200px;">{t 1=$USER_NAME|upper}Hello %1{/t}</div>
|
||||
<div style="position: absolute; text-align: right; right: 0px; width: 120px;">
|
||||
@@ -127,13 +127,13 @@
|
||||
{/if}
|
||||
{/foreach}
|
||||
</div>
|
||||
<div class="pagename">
|
||||
<div id="pagename" class="pagename">
|
||||
{$page_name}
|
||||
</div>
|
||||
</div>
|
||||
{* error/warning *}
|
||||
{if $messages}
|
||||
<div style="margin: 2px; width: {$table_width}px;">
|
||||
<div style="margin: 2px; width: {$table_width};">
|
||||
{foreach from=$messages item=item key=key}
|
||||
<div class="{$item.class}">{$item.msg}</div>
|
||||
{/foreach}
|
||||
@@ -143,7 +143,7 @@
|
||||
|
||||
{* debug info *}
|
||||
{if $DEBUG}
|
||||
<div style="width:{$table_width}px;" class="debug_message">
|
||||
<div style="width:{$table_width};" class="debug_message">
|
||||
{$Id}<br>
|
||||
<b>{$smarty.now|date_format:"%Y-%m-%d %H:%M:%S"}</b><br>
|
||||
{$debug_error_msg}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,24 +1,17 @@
|
||||
<?php
|
||||
<?php // phpcs:ignore PSR1.Files.SideEffects
|
||||
|
||||
/*********************************************************************
|
||||
* AUTHOR: Clemens Schwaighofer
|
||||
* CREATED: 2011/2/8
|
||||
* DESCRIPTION: pre function to collect all non critical errors into a log file if possible
|
||||
* include this file at the very beginning of the script to get the notices, strict, etc messages.
|
||||
* DESCRIPTION: pre function to collect all non critical errors
|
||||
* into a log file if possible
|
||||
* include this file at the very beginning of the script to get the notices,
|
||||
* strict, etc messages.
|
||||
* error etc will still be written to the log/display
|
||||
*********************************************************************/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
// define the base working directory outside because in the function it might return undefined
|
||||
// if we have config set BASE use this
|
||||
if (defined('BASE')) {
|
||||
DEFINE('CURRENT_WORKING_DIR', BASE);
|
||||
} else {
|
||||
// else we set. We fully assuem that Error.Handling is where it should be, in lib dir
|
||||
DEFINE('CURRENT_WORKING_DIR', str_replace('lib', '', __DIR__));
|
||||
}
|
||||
|
||||
/**
|
||||
* will catch any error except E_ERROR and try to write them to the log file
|
||||
* in log/php_error-<DAY>.log
|
||||
@@ -67,8 +60,15 @@ function MyErrorHandler(int $type, string $message, string $file, int $line, arr
|
||||
// : the php error message
|
||||
$output = '{' . array_pop($page_temp) . '} [' . $file . '] '
|
||||
. '<' . $line . '> [' . $error_level[$type] . '|' . $type . ']: ' . $message;
|
||||
# try to open file
|
||||
$ROOT = CURRENT_WORKING_DIR;
|
||||
// define the base working directory outside because in the function it might return undefined
|
||||
// if we have config set BASE use this
|
||||
$ROOT = '';
|
||||
if (defined('BASE')) {
|
||||
$ROOT = BASE;
|
||||
} else {
|
||||
// else we set. We fully assuem that Error.Handling is where it should be, in lib dir
|
||||
$ROOT = str_replace('lib', '', __DIR__);
|
||||
}
|
||||
$LOG = 'log' . DIRECTORY_SEPARATOR;
|
||||
// if the log folder is not found, try to create it
|
||||
if (!is_dir($ROOT . $LOG) && !is_file($ROOT . LOG)) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php // phpcs:ignore PSR1.Files.SideEffects
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user