Compare commits

...

6 Commits

Author SHA1 Message Date
Clemens Schwaighofer
fd0af5a294 Update Login class to return login screen with reset _POST
Login class checks if AJAX_PAGE is set to true and then does not print
the login html to the screen directly, but returns it in the _POST array
login_html, _POST action is set to login
It also resets _POST & _GET arrays before hand to avoid any misuese.
All _SESSION array access needs to be checked in any following class as
the _SESSION is unset in this moment

html element should be overwritten with this JS:
document.getElementsByTagName('html')[0].innerHTML  =
data.content.login_html;
2019-10-03 15:37:06 +09:00
Clemens Schwaighofer
fd8caaf5de htaccess update for short open tag 2019-10-02 11:54:19 +09:00
Clemens Schwaighofer
3d842d4107 Missing strict declares, Progress bar init, missing site config bail
In master config if there is no site config for this page, bail out.
In the other config pages the strict declare header was missing.

Progress bar inits the progress array with all set to null to avoid
calls on not set index
2019-10-01 15:43:50 +09:00
Clemens Schwaighofer
c895beb35f IO: reset field names update
instead of set to array, set to null as we fully reset this entry
2019-09-30 15:57:23 +09:00
Clemens Schwaighofer
b6a35d15cf Basic: resurcive array search, IO unset fix
Basic: recusrive array search has correct parameter declarations &
checks for null/empty/not string

IO: all unset are removed and null or init to array is used to reset

Update for other include pages with some missing default data
2019-09-30 15:52:14 +09:00
Clemens Schwaighofer
20c44694e8 Default config fix for HOST_NAME and example db host array update 2019-09-26 15:03:00 +09:00
17 changed files with 175 additions and 131 deletions

View File

@@ -9,6 +9,7 @@ php_value xdebug.show_local_vars 0
# allowed COOKIE, FILES, GET, POST, REQUEST, SERVER, SESSION # allowed COOKIE, FILES, GET, POST, REQUEST, SERVER, SESSION
#php_value xdebug.dump.GET * #php_value xdebug.dump.GET *
# PHP ERROR SETTINGS # PHP ERROR SETTINGS
php_flag short_open_tag off
php_flag display_startup_errors on php_flag display_startup_errors on
php_flag display_errors on php_flag display_errors on
php_flag html_errors on php_flag html_errors on

View File

@@ -82,17 +82,17 @@ return [
// A list of directories holding code that we want // A list of directories holding code that we want
// to parse, but not analyze // to parse, but not analyze
"exclude_analysis_directory_list" => [ "exclude_analysis_directory_list" => [
'www/vendor', 'www/vendor',
'www/lib/FileUpload', 'www/lib/FileUpload',
'www/lib/pChart', 'www/lib/pChart',
'www/lib/pChart2.1.4', 'www/lib/pChart2.1.4',
'www/lib/Smarty', 'www/lib/Smarty',
'www/lib/smarty-3.1.30', 'www/lib/smarty-3.1.30',
'www/templates_c', 'www/templates_c',
'www/log', 'www/log',
'www/tmp', 'www/tmp',
'www/cache', 'www/cache',
'www/media', 'www/media',
], ],
'exclude_file_list' => [ 'exclude_file_list' => [
// ignore all symlink files to edit // ignore all symlink files to edit

View File

@@ -1,4 +1,4 @@
<?php <?php declare(strict_types=1);
/******************************************************************** /********************************************************************
* AUTHOR: Clemens Schwaighofer * AUTHOR: Clemens Schwaighofer
* CREATED: 2018/10/11 * CREATED: 2018/10/11

View File

@@ -1,4 +1,4 @@
<?php <?php declare(strict_types=1);
/******************************************************************** /********************************************************************
* AUTHOR: Clemens Schwaighofer * AUTHOR: Clemens Schwaighofer
* CREATED: 2018/10/11 * CREATED: 2018/10/11
@@ -7,19 +7,18 @@
* - DB access name (array group from config.db) * - DB access name (array group from config.db)
* - location (test/stage/live) * - location (test/stage/live)
* - debug flag (true/false) * - debug flag (true/false)
* - DB path (eg PUBLIC_SCHEMA) * - site lang
* - stie lang
* HISTORY: * HISTORY:
*********************************************************************/ *********************************************************************/
// other master config to attach // other master config to attach
// $LOCAL_CONFIG = array( // $__LOCAL_CONFIG = array(
// 'db_host' => '', // 'db_host' => '',
// 'location' => '', // 'location' => '',
// 'debug_flag' => true, // 'debug_flag' => true,
// 'site_lang' => 'en_utf8', // 'site_lang' => 'en_utf8',
// 'login_enabled' => true // 'login_enabled' => true
// ) // );
// each host has a different db_host // each host has a different db_host
$SITE_CONFIG = array( $SITE_CONFIG = array(
@@ -39,7 +38,7 @@ $SITE_CONFIG = array(
// enable/disable login override // enable/disable login override
'login_enabled' => true 'login_enabled' => true
), ),
// 'other.host.com' => $LOCAL_CONFIG // 'other.host.com' => $__LOCAL_CONFIG
); );
// __END__ // __END__

View File

@@ -1,4 +1,4 @@
<?php <?php declare(strict_types=1);
/******************************************************************** /********************************************************************
* AUTHOR: Clemens Schwaighofer * AUTHOR: Clemens Schwaighofer
* CREATED: 2003/06/10 * CREATED: 2003/06/10
@@ -190,24 +190,29 @@ if (file_exists(BASE.CONFIGS.'config.path.php')) {
// ** missing live domains ** // ** missing live domains **
// get the name without the port // get the name without the port
list($HOST_NAME) = array_pad(explode(':', $_SERVER['HTTP_HOST'], 2), 2, null); list($HOST_NAME) = array_pad(explode(':', $_SERVER['HTTP_HOST'], 2), 2, null);
// BAIL ON: // set HOST name
DEFINE('HOST_NAME', $HOST_NAME);
// BAIL ON MISSING MASTER SITE CONFIG
if (!isset($SITE_CONFIG[HOST_NAME]['location'])) {
echo 'Missing SITE_CONFIG entry for: "'.HOST_NAME.'". Contact Administrator';
exit;
}
// BAIL ON MISSING DB CONFIG:
// we have either no db selction for this host but have db config entries // we have either no db selction for this host but have db config entries
// or we have a db selection but no db config as array or empty // or we have a db selection but no db config as array or empty
// or we have a selection but no matching db config entry // or we have a selection but no matching db config entry
if ((!isset($SITE_CONFIG[$HOST_NAME]['db_host']) && count($DB_CONFIG)) || if ((!isset($SITE_CONFIG[HOST_NAME]['db_host']) && count($DB_CONFIG)) ||
(isset($SITE_CONFIG[$HOST_NAME]['db_host']) && (isset($SITE_CONFIG[HOST_NAME]['db_host']) &&
// missing DB CONFIG // missing DB CONFIG
((is_array($DB_CONFIG) && !count($DB_CONFIG)) || ((is_array($DB_CONFIG) && !count($DB_CONFIG)) ||
!is_array($DB_CONFIG) || !is_array($DB_CONFIG) ||
// has DB CONFIG but no match // has DB CONFIG but no match
(is_array($DB_CONFIG) && count($DB_CONFIG) && !isset($DB_CONFIG[$SITE_CONFIG[$HOST_NAME]['db_host']]))) (is_array($DB_CONFIG) && count($DB_CONFIG) && !isset($DB_CONFIG[$SITE_CONFIG[HOST_NAME]['db_host']])))
) )
) { ) {
echo 'No matching DB config found for: "'.$HOST_NAME.'". Contact Administrator'; echo 'No matching DB config found for: "'.HOST_NAME.'". Contact Administrator';
exit; exit;
} }
// set HOST name
DEFINE('HOST_NAME', $HOST_NAME);
// set SSL on // set SSL on
if ((array_key_exists('HTTPS', $_SERVER) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || if ((array_key_exists('HTTPS', $_SERVER) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ||
$_SERVER['SERVER_PORT'] == 443) { $_SERVER['SERVER_PORT'] == 443) {
@@ -218,7 +223,7 @@ if ((array_key_exists('HTTPS', $_SERVER) && !empty($_SERVER['HTTPS']) && $_SERVE
DEFINE('HOST_PROTOCOL', 'http://'); DEFINE('HOST_PROTOCOL', 'http://');
} }
// define the db config set name, the db config and the db schema // define the db config set name, the db config and the db schema
DEFINE('DB_CONFIG_NAME', $SITE_CONFIG[$HOST_NAME]['db_host']); DEFINE('DB_CONFIG_NAME', $SITE_CONFIG[HOST_NAME]['db_host']);
DEFINE('DB_CONFIG', isset($DB_CONFIG[DB_CONFIG_NAME]) ? $DB_CONFIG[DB_CONFIG_NAME] : array()); DEFINE('DB_CONFIG', isset($DB_CONFIG[DB_CONFIG_NAME]) ? $DB_CONFIG[DB_CONFIG_NAME] : array());
// DEFINE('DB_CONFIG_TARGET', SITE_CONFIG[$HOST_NAME]['db_host_target']); // DEFINE('DB_CONFIG_TARGET', SITE_CONFIG[$HOST_NAME]['db_host_target']);
// DEFINE('DB_CONFIG_OTHER', SITE_CONFIG[$HOST_NAME]['db_host_other']); // DEFINE('DB_CONFIG_OTHER', SITE_CONFIG[$HOST_NAME]['db_host_other']);
@@ -226,10 +231,10 @@ DEFINE('DB_CONFIG', isset($DB_CONFIG[DB_CONFIG_NAME]) ? $DB_CONFIG[DB_CONFIG_NAM
// DEFINE('LOGIN_DB_SCHEMA', PUBLIC_SCHEMA); // where the edit* tables are // DEFINE('LOGIN_DB_SCHEMA', PUBLIC_SCHEMA); // where the edit* tables are
// DEFINE('GLOBAL_DB_SCHEMA', PUBLIC_SCHEMA); // where global tables are that are used by all schemas (eg queue tables for online, etc) // DEFINE('GLOBAL_DB_SCHEMA', PUBLIC_SCHEMA); // where global tables are that are used by all schemas (eg queue tables for online, etc)
// debug settings, site lang, etc // debug settings, site lang, etc
DEFINE('TARGET', $SITE_CONFIG[$HOST_NAME]['location']); DEFINE('TARGET', $SITE_CONFIG[HOST_NAME]['location']);
DEFINE('DEBUG', $SITE_CONFIG[$HOST_NAME]['debug_flag']); DEFINE('DEBUG', $SITE_CONFIG[HOST_NAME]['debug_flag']);
DEFINE('SITE_LANG', $SITE_CONFIG[$HOST_NAME]['site_lang']); DEFINE('SITE_LANG', $SITE_CONFIG[HOST_NAME]['site_lang']);
DEFINE('LOGIN_ENABLED', $SITE_CONFIG[$HOST_NAME]['login_enabled']); DEFINE('LOGIN_ENABLED', $SITE_CONFIG[HOST_NAME]['login_enabled']);
// paths // paths
// DEFINE('CSV_PATH', $PATHS[TARGET]['csv_path']); // DEFINE('CSV_PATH', $PATHS[TARGET]['csv_path']);
// DEFINE('EXPORT_SCRIPT', $PATHS[TARGET]['perl_bin']); // DEFINE('EXPORT_SCRIPT', $PATHS[TARGET]['perl_bin']);

View File

@@ -1,4 +1,4 @@
<?php <?php declare(strict_types=1);
/******************************************************************** /********************************************************************
* AUTHOR: Clemens Schwaighofer * AUTHOR: Clemens Schwaighofer
* CREATED: 2018/10/11 * CREATED: 2018/10/11

View File

@@ -27,6 +27,12 @@ $SET_SESSION_NAME = EDIT_SESSION_NAME;
//------------------------------ library include end //------------------------------ library include end
//------------------------------ basic variable settings start //------------------------------ basic variable settings start
if (!isset($AJAX_PAGE)) {
$AJAX_PAGE = false;
}
if (!isset($ZIP_STREAM)) {
$ZIP_STREAM = false;
}
// set encoding // set encoding
if (!isset($encoding)) { if (!isset($encoding)) {
$encoding = DEFAULT_ENCODING; $encoding = DEFAULT_ENCODING;
@@ -38,10 +44,10 @@ if (session_id() && $_SESSION['DEFAULT_LANG']) {
$lang = defined('SITE_LANG') ? SITE_LANG : DEFAULT_LANG; $lang = defined('SITE_LANG') ? SITE_LANG : DEFAULT_LANG;
} }
// end the stop of the output flow, but only if we didn't request a csv file download // end the stop of the output flow, but only if we didn't request a csv file download
if (array_key_exists('action', $_POST) && $_POST['action'] != 'download_csv') { if (isset($_POST['action']) && $_POST['action'] != 'download_csv' && !$AJAX_PAGE) {
header("Content-type: text/html; charset=".$encoding); header("Content-type: text/html; charset=".$encoding);
} }
if (isset($AJAX_PAGE) && isset($ZIP_STREAM) && $AJAX_PAGE && !$ZIP_STREAM) { if ($AJAX_PAGE && !$ZIP_STREAM) {
header("Content-Type: application/json; charset=UTF-8"); header("Content-Type: application/json; charset=UTF-8");
} }
//------------------------------ basic variable settings start //------------------------------ basic variable settings start
@@ -86,7 +92,7 @@ if (!$login->login) {
//------------------------------ page rights start //------------------------------ page rights start
// flag if to show the edit access id drop down list // flag if to show the edit access id drop down list
// check if we have more than one EA ID // check if we have more than one EA ID
$cms->DATA['show_ea_extra'] = $login->acl['show_ea_extra']; $cms->DATA['show_ea_extra'] = isset($login->acl['show_ea_extra']) ? $login->acl['show_ea_extra'] : false;
//------------------------------ page rights ned //------------------------------ page rights ned
// automatic hide for DEBUG messages on live server // automatic hide for DEBUG messages on live server

View File

@@ -29,21 +29,21 @@ if (isset($_SESSION['DEFAULT_LANG'])) {
$lang_short = substr($lang, 0, 2); $lang_short = substr($lang, 0, 2);
// set include & template names // set include & template names
$PAGE_FILE_NAME = str_replace(".php", "", $cms->page_name); $PAGE_FILE_NAME = str_replace('.php', '', $cms->page_name);
// set include & template names // set include & template names
if (!isset($CONTENT_INCLUDE)) { if (!isset($CONTENT_INCLUDE)) {
$CONTENT_INCLUDE = $PAGE_FILE_NAME.'.tpl'; $CONTENT_INCLUDE = $PAGE_FILE_NAME.'.tpl';
} }
$FORM_NAME = !isset($FORM_NAME) || !$FORM_NAME ? str_replace(".php", "", $cms->page_name) : $FORM_NAME; $FORM_NAME = !isset($FORM_NAME) || !$FORM_NAME ? str_replace('.php', '', $cms->page_name) : $FORM_NAME;
// set local page title // set local page title
$L_TITLE = ucfirst(str_replace('_', ' ', $cms->getPageName(1))).(defined(G_TITLE) ? ' - '.G_TITLE : ''); $L_TITLE = ucfirst(str_replace('_', ' ', $cms->getPageName(1))).(defined(G_TITLE) ? ' - '.G_TITLE : '');
// strip tpl and replace it with php // strip tpl and replace it with php
// php include file per page // php include file per page
$cms->INC_TEMPLATE_NAME = str_replace(".tpl", ".php", $CONTENT_INCLUDE); $cms->INC_TEMPLATE_NAME = str_replace('.tpl', '.php', $CONTENT_INCLUDE);
// javascript include per page // javascript include per page
$cms->JS_TEMPLATE_NAME = str_replace(".tpl", ".js", $CONTENT_INCLUDE); $cms->JS_TEMPLATE_NAME = str_replace('.tpl', '.js', $CONTENT_INCLUDE);
// css per page // css per page
$cms->CSS_TEMPLATE_NAME = str_replace(".tpl", ".css", $CONTENT_INCLUDE); $cms->CSS_TEMPLATE_NAME = str_replace('.tpl', '.css', $CONTENT_INCLUDE);
// special CSS file // special CSS file
$cms->CSS_SPECIAL_TEMPLATE_NAME = isset($CSS_NAME) ? $CSS_NAME : ''; $cms->CSS_SPECIAL_TEMPLATE_NAME = isset($CSS_NAME) ? $CSS_NAME : '';
// special JS file // special JS file

View File

@@ -69,16 +69,23 @@ $cms->DATA['messages'] = $cms->messages;
// top menu // top menu
$cms->DATA['nav_menu'] = $cms->adbTopMenu(); $cms->DATA['nav_menu'] = $cms->adbTopMenu();
$cms->DATA['nav_menu_count'] = is_array($cms->DATA['nav_menu']) ? count($cms->DATA['nav_menu']) : 0;
// the page name // the page name
$cms->DATA['page_name'] = $cms->page_name; $cms->DATA['page_name'] = $cms->page_name;
// user name // user name
$cms->DATA['USER_NAME'] = $_SESSION['USER_NAME']; $cms->DATA['USER_NAME'] = $_SESSION['USER_NAME'];
$cms->DATA['ADMIN'] = $login->acl['admin'];
// the template part to include into the body // the template part to include into the body
$cms->DATA['TEMPLATE_NAME'] = $TEMPLATE_NAME; $cms->DATA['TEMPLATE_NAME'] = $TEMPLATE_NAME;
$cms->DATA['CONTENT_INCLUDE'] = $CONTENT_INCLUDE; $cms->DATA['CONTENT_INCLUDE'] = $CONTENT_INCLUDE;
$cms->DATA['TEMPLATE_TRANSLATE'] = $TEMPLATE_TRANSLATE;
$cms->DATA['PAGE_FILE_NAME'] = $PAGE_FILE_NAME;
// LANG // LANG
$cms->DATA['LANG'] = $lang; $cms->DATA['LANG'] = $lang;
$cms->DATA['TINYMCE_LANG'] = $lang_short; $cms->DATA['TINYMCE_LANG'] = $lang_short;
// form name
$cms->DATA['FORM_NAME'] = $FORM_NAME;
// include flags
$cms->DATA['USE_TINY_MCE'] = isset($USE_TINY_MCE) ? $USE_TINY_MCE : false; $cms->DATA['USE_TINY_MCE'] = isset($USE_TINY_MCE) ? $USE_TINY_MCE : false;
$cms->DATA['JS_DATEPICKR'] = isset($JS_DATEPICKR) ? $JS_DATEPICKR : false; $cms->DATA['JS_DATEPICKR'] = isset($JS_DATEPICKR) ? $JS_DATEPICKR : false;
$cms->DATA['JS_FLATPICKR'] = isset($JS_FLATPICKR) ? $JS_FLATPICKR : false; $cms->DATA['JS_FLATPICKR'] = isset($JS_FLATPICKR) ? $JS_FLATPICKR : false;

View File

@@ -1 +1 @@
../../../admin/default/javascript/debug.js ../../admin/javascript/debug.js

View File

@@ -1 +1 @@
../../../admin/default/javascript/fineuploader/ ../../admin/javascript/fineuploader/

View File

@@ -1 +1 @@
../../../admin/default/javascript/firebug.js ../../admin/javascript/firebug.js

View File

@@ -105,6 +105,9 @@ class Login extends \CoreLibs\DB\IO
// acl vars // acl vars
public $acl = array(); public $acl = array();
public $default_acl_list = array(); public $default_acl_list = array();
// login html, if we are on an ajax page
private $login_html = '';
private $login_is_ajax_page = false;
// language // language
public $l; public $l;
@@ -145,6 +148,10 @@ class Login extends \CoreLibs\DB\IO
exit; exit;
} }
// set global is ajax page for if we show the data directly, or need to pass it back
// to the continue AJAX class for output back to the user
$this->login_is_ajax_page = isset($GLOBALS['AJAX_PAGE']) && $GLOBALS['AJAX_PAGE'] ? true : false;
$this->l = new \CoreLibs\Language\L10n($lang); $this->l = new \CoreLibs\Language\L10n($lang);
// if we have a search path we need to set it, to use the correct DB to login // if we have a search path we need to set it, to use the correct DB to login
@@ -250,22 +257,41 @@ class Login extends \CoreLibs\DB\IO
$this->loginPasswordForgot(); $this->loginPasswordForgot();
} }
// if !$euid || permission not okay, print login screan // if !$euid || permission not okay, print login screan
echo $this->loginPrintLogin(); $this->login_html = $this->loginPrintLogin();
// closing all connections, depending on error status, exit // closing all connections, depending on error status, exit
if (!$this->loginCloseClass()) { if (!$this->loginCloseClass()) {
// do not go anywhere, quit processing here // if variable AJAX flag is not set, show output, else pass through for ajax work
// do something with possible debug data? if ($this->login_is_ajax_page !== true) {
if (TARGET == 'live' || TARGET == 'remote') { // the login screen if we hav no login permission & login screen html data
// login if ($this->login_html !== null) {
$this->debug_output_all = DEBUG ? 1 : 0; echo $this->login_html;
$this->echo_output_all = 0; }
$this->print_output_all = DEBUG ? 1 : 0; // do not go anywhere, quit processing here
// do something with possible debug data?
if (TARGET == 'live' || TARGET == 'remote') {
// login
$this->debug_output_all = DEBUG ? 1 : 0;
$this->echo_output_all = 0;
$this->print_output_all = DEBUG ? 1 : 0;
}
$status_msg = $this->printErrorMsg();
if ($this->echo_output_all) {
echo $status_msg;
}
// exit so we don't process anything further, at all
exit;
} else {
// if we are on an ajax page reset any POST/GET array data to avoid
// any accidentical processing going on
$_POST = array();
$_GET = array();
// set the action to login so we can trigger special login html return
$_POST['action'] = 'login';
$_POST['login_html'] = $this->login_html;
// NOTE: this part needs to be catched by the frontend AJAX
// and some function needs to then set something like this
// document.getElementsByTagName('html')[0].innerHTML = data.content.login_html;
} }
$status_msg = $this->printErrorMsg();
if ($this->echo_output_all) {
echo $status_msg;
}
exit;
} }
// set acls for this user/group and this page // set acls for this user/group and this page
$this->loginSetAcl(); $this->loginSetAcl();
@@ -737,9 +763,9 @@ class Login extends \CoreLibs\DB\IO
} }
// flag if to show extra edit access drop downs (because user has multiple groups assigned) // flag if to show extra edit access drop downs (because user has multiple groups assigned)
if (count($_SESSION['UNIT']) > 1) { if (count($_SESSION['UNIT']) > 1) {
$this->acl['show_ea_extra'] = 1; $this->acl['show_ea_extra'] = true;
} else { } else {
$this->acl['show_ea_extra'] = 0; $this->acl['show_ea_extra'] = false;
} }
// set the default edit access // set the default edit access
$this->acl['default_edit_access'] = $_SESSION['UNIT_DEFAULT']; $this->acl['default_edit_access'] = $_SESSION['UNIT_DEFAULT'];
@@ -902,76 +928,61 @@ class Login extends \CoreLibs\DB\IO
{ {
$html_string = null; $html_string = null;
if (!$this->permission_okay) { if (!$this->permission_okay) {
// get global AJAX page trigger // set the templates now
// if true, return error ajax $this->loginSetTemplates();
global $AJAX_PAGE; // if there is a global logout target ...
if ($AJAX_PAGE === true) { if (file_exists($this->logout_target) && $this->logout_target) {
$data = array( $LOGOUT_TARGET = $this->logout_target;
'status' => 'error',
'error_code' => $this->login_error,
'msg' => array(
'level' => 'error',
'str' => $this->l->__('Login necessary')
)
);
$html_string = json_encode($data);
} else { } else {
// set the templates now $LOGOUT_TARGET = "";
$this->loginSetTemplates(); }
// if there is a global logout target ...
if (file_exists($this->logout_target) && $this->logout_target) {
$LOGOUT_TARGET = $this->logout_target;
} else {
$LOGOUT_TARGET = "";
}
$html_string = $this->login_template['template']; $html_string = $this->login_template['template'];
// if password change is okay // if password change is okay
if ($this->password_change) { if ($this->password_change) {
$html_string_password_change = $this->login_template['password_change']; $html_string_password_change = $this->login_template['password_change'];
// pre change the data in the PASSWORD_CHANGE_DIV first // pre change the data in the PASSWORD_CHANGE_DIV first
foreach ($this->login_template['strings'] as $string => $data) { foreach ($this->login_template['strings'] as $string => $data) {
if ($data) { if ($data) {
$html_string_password_change = str_replace('{'.$string.'}', $data, $html_string_password_change); $html_string_password_change = str_replace('{'.$string.'}', $data, $html_string_password_change);
}
} }
// print error messagae
if ($this->login_error) {
$html_string_password_change = str_replace('{ERROR_MSG}', $this->login_error_msg[$this->login_error].'<br>', $html_string_password_change);
} else {
$html_string_password_change = str_replace('{ERROR_MSG}', '<br>', $html_string_password_change);
}
// if pw change action, show the float again
if ($this->change_password && !$this->password_change_ok) {
$html_string_password_change = str_replace('{PASSWORD_CHANGE_SHOW}', '<script language="JavaScript">ShowHideDiv(\'pw_change_div\');</script>', $html_string_password_change);
} else {
$html_string_password_change = str_replace('{PASSWORD_CHANGE_SHOW}', '', $html_string_password_change);
}
$this->login_template['strings']['PASSWORD_CHANGE_DIV'] = $html_string_password_change;
} }
// put in the logout redirect string
if ($this->logout && $LOGOUT_TARGET) {
$html_string = str_replace('{LOGOUT_TARGET}', '<meta http-equiv="refresh" content="0; URL='.$LOGOUT_TARGET.'">', $html_string);
} else {
$html_string = str_replace('{LOGOUT_TARGET}', '', $html_string);
}
// print error messagae // print error messagae
if ($this->login_error) { if ($this->login_error) {
$html_string = str_replace('{ERROR_MSG}', $this->login_error_msg[$this->login_error].'<br>', $html_string); $html_string_password_change = str_replace('{ERROR_MSG}', $this->login_error_msg[$this->login_error].'<br>', $html_string_password_change);
} elseif ($this->password_change_ok && $this->password_change) {
$html_string = str_replace('{ERROR_MSG}', $this->login_error_msg[300].'<br>', $html_string);
} else { } else {
$html_string = str_replace('{ERROR_MSG}', '<br>', $html_string); $html_string_password_change = str_replace('{ERROR_MSG}', '<br>', $html_string_password_change);
} }
// if pw change action, show the float again
if ($this->change_password && !$this->password_change_ok) {
$html_string_password_change = str_replace('{PASSWORD_CHANGE_SHOW}', '<script language="JavaScript">ShowHideDiv(\'pw_change_div\');</script>', $html_string_password_change);
} else {
$html_string_password_change = str_replace('{PASSWORD_CHANGE_SHOW}', '', $html_string_password_change);
}
$this->login_template['strings']['PASSWORD_CHANGE_DIV'] = $html_string_password_change;
}
// create the replace array context // put in the logout redirect string
foreach ($this->login_template['strings'] as $string => $data) { if ($this->logout && $LOGOUT_TARGET) {
$html_string = str_replace('{'.$string.'}', $data, $html_string); $html_string = str_replace('{LOGOUT_TARGET}', '<meta http-equiv="refresh" content="0; URL='.$LOGOUT_TARGET.'">', $html_string);
} } else {
$html_string = str_replace('{LOGOUT_TARGET}', '', $html_string);
}
// print error messagae
if ($this->login_error) {
$html_string = str_replace('{ERROR_MSG}', $this->login_error_msg[$this->login_error].'<br>', $html_string);
} elseif ($this->password_change_ok && $this->password_change) {
$html_string = str_replace('{ERROR_MSG}', $this->login_error_msg[300].'<br>', $html_string);
} else {
$html_string = str_replace('{ERROR_MSG}', '<br>', $html_string);
}
// create the replace array context
foreach ($this->login_template['strings'] as $string => $data) {
$html_string = str_replace('{'.$string.'}', $data, $html_string);
} }
} // if permission is 0 then print out login } // if permission is 0 then print out login
// return the created HTML here or null for nothing // return the created HTML here or null for nothing

View File

@@ -193,7 +193,7 @@ class Backend extends \CoreLibs\DB\IO
} }
// get the session pages array // get the session pages array
$PAGES = $_SESSION['PAGES']; $PAGES = isset($_SESSION['PAGES']) ? $_SESSION['PAGES'] : null;
if (!isset($PAGES) || !is_array($PAGES)) { if (!isset($PAGES) || !is_array($PAGES)) {
$PAGES = array(); $PAGES = array();
} }

View File

@@ -471,13 +471,22 @@ class Basic
* if strict mode is set, throws an error if the class variable is not set * if strict mode is set, throws an error if the class variable is not set
* default is strict mode false * default is strict mode false
* @param mixed $name class variable name * @param mixed $name class variable name
* @return void * @return mixed return set variable content
*/ */
public function __get($name): void public function &__get($name)
{ {
if ($this->set_strict_mode === true && !property_exists($this, $name)) { if ($this->set_strict_mode === true && !property_exists($this, $name)) {
trigger_error('Undefined property via __get(): '.$name, E_USER_NOTICE); trigger_error('Undefined property via __get(): '.$name, E_USER_NOTICE);
} }
// on set return
if (property_exists($this, $name)) {
return $this->$name;
} elseif ($this->set_compatible === true && !property_exists($this, $name)) {
// if it is not set, and we are in compatible mode we need to init.
// This is so that $class->array['key'] = 'bar'; works
$this->{$name} = null;
return $this->$name;
}
} }
// ************************************************************* // *************************************************************
@@ -1164,18 +1173,19 @@ class Basic
/** /**
* searches key = value in an array / array * searches key = value in an array / array
* only returns the first one found * only returns the first one found
* @param string|int $needle needle (search for) * @param string|int $needle needle (search for)
* @param array $haystack haystack (search in) * @param array $haystack haystack (search in)
* @param string $key_lookin the key to look out for, default empty * @param string|null $key_lookin the key to look out for, default empty
* @return ?array array with the elements where the needle can be found in the haystack array * @return array array with the elements where the needle can be
* found in the haystack array
*/ */
public static function arraySearchRecursive($needle, array $haystack, $key_lookin = ''): ?array public static function arraySearchRecursive($needle, array $haystack, ?string $key_lookin = null): array
{ {
$path = array(); $path = array();
if (!is_array($haystack)) { if (!is_array($haystack)) {
$haystack = array(); $haystack = array();
} }
if (!is_array($key_lookin) && if ($key_lookin != null &&
!empty($key_lookin) && !empty($key_lookin) &&
array_key_exists($key_lookin, $haystack) && array_key_exists($key_lookin, $haystack) &&
$needle === $haystack[$key_lookin] $needle === $haystack[$key_lookin]

View File

@@ -305,8 +305,8 @@ class IO extends \CoreLibs\Basic
/** /**
* main DB concstructor with auto connection to DB and failure set on failed connection * main DB concstructor with auto connection to DB and failure set on failed connection
* @param array $db_config DB configuration array * @param array $db_config DB configuration array
* @param int|integer $set_control_flag Class set control flag * @param int $set_control_flag 0/1/2/3 to set internal class parameter check
*/ */
public function __construct(array $db_config, int $set_control_flag = 0) public function __construct(array $db_config, int $set_control_flag = 0)
{ {
@@ -1056,7 +1056,7 @@ class IO extends \CoreLibs\Basic
// if it is a call with reset in it we reset the cursor, so we get an uncached return // if it is a call with reset in it we reset the cursor, so we get an uncached return
// but only for the FIRST call (pos == 0) // but only for the FIRST call (pos == 0)
if ($reset && !$this->cursor_ext[$md5]['pos']) { if ($reset && !$this->cursor_ext[$md5]['pos']) {
unset($this->cursor_ext[$md5]['cursor']); $this->cursor_ext[$md5]['cursor'] = null;
} }
// $this->debug('MENU', 'Reset: '.$reset.', Cursor: '.$this->cursor_ext[$md5]['cursor'].', Pos: '.$this->cursor_ext[$md5]['pos'].', Query: '.$query); // $this->debug('MENU', 'Reset: '.$reset.', Cursor: '.$this->cursor_ext[$md5]['cursor'].', Pos: '.$this->cursor_ext[$md5]['pos'].', Query: '.$query);
@@ -1156,7 +1156,7 @@ class IO extends \CoreLibs\Basic
// return row, if last && reset, then unset the hole md5 array // return row, if last && reset, then unset the hole md5 array
if (!$return && ($reset == 1 || $reset == 3) && $this->cursor_ext[$md5]['pos']) { if (!$return && ($reset == 1 || $reset == 3) && $this->cursor_ext[$md5]['pos']) {
// unset only the field names here of course // unset only the field names here of course
unset($this->cursor_ext[$md5]['field_names']); $this->cursor_ext[$md5]['field_names'] = null;
$this->cursor_ext[$md5]['pos'] = 0; $this->cursor_ext[$md5]['pos'] = 0;
} elseif (!$return && $reset == 2 && $this->cursor_ext[$md5]['pos']) { } elseif (!$return && $reset == 2 && $this->cursor_ext[$md5]['pos']) {
// at end of read reset pos & set cursor to 1 (so it does not get lost in session transfer) // at end of read reset pos & set cursor to 1 (so it does not get lost in session transfer)

View File

@@ -22,7 +22,12 @@ class ProgressBar
public $code; // unique code public $code; // unique code
public $status = 'new'; // current status (new,show,hide) public $status = 'new'; // current status (new,show,hide)
public $step = 0; // current step public $step = 0; // current step
public $position = array(); // current bar position public $position = array( // current bar position
'left' => null,
'top' => null,
'width' => null,
'height' => null,
);
public $clear_buffer_size = 1; // we need to send this before the lfush to get browser output public $clear_buffer_size = 1; // we need to send this before the lfush to get browser output
public $clear_buffer_size_init = 1024*1024; // if I don't send that junk, it won't send anything public $clear_buffer_size_init = 1024*1024; // if I don't send that junk, it won't send anything