Remove \Basic class from all other Class extensions

If not created Logger class will be auto created in \DB\IO
Recommended to run a CoreLibs\Debug\Logging([...]); and use this class
for all ACL\Login, Admin\Backend, DB\IO, Output\Form\Generate calls.
Last parameter after DB CONFIG is the log parameter

Session create has been moved to a new Create\Session class from the
\Basic class and MUST be started before using ACL\Login. Currently
ACL\Login will fallback and start it if no session is yet started.

See the Readme.md file for which classes use _SESSION data

In future the _SESSION settings should be moved to some wrapper class
for this so we can unit test sessions

Only Output\Form\Generate class call has the new changed with the second
parameter no longer beeing the table width setting but the class
setting.
But as this is a semi retired class and only used for edit_base this is
not 100% breaking.
All other classes can be used as is and have internal fallback to run as
before.
Deprecation messages will be added later.
This commit is contained in:
Clemens Schwaighofer
2022-01-18 10:51:13 +09:00
parent 1bd45d8a8a
commit ad39a5b21f
45 changed files with 991 additions and 284 deletions

View File

@@ -46,12 +46,33 @@ if ($AJAX_PAGE && !$ZIP_STREAM) {
//------------------------------ basic variable settings start
//------------------------------ class init start
// create logger
$log = new CoreLibs\Debug\Logging([
'log_folder' => BASE . LOG,
'file_id' => LOG_FILE_ID,
'print_file_date' => true,
'per_class' => true,
'debug_all' => $DEBUG_ALL,
'echo_all' => $ECHO_ALL,
'print_all' => $PRINT_ALL,
]);
// automatic hide for DEBUG messages on live server
// can be overridden when setting DEBUG_ALL_OVERRIDE on top of the script
// (for emergency debugging of one page only)
if ((TARGET == 'live' || TARGET == 'remote') && !empty($DEBUG_ALL_OVERRIDE)) {
foreach (['debug', 'echo', 'print'] as $target) {
$log->setLogLevelAll($target, false);
}
}
// start session
CoreLibs\Create\Session::startSession();
// login & page access check
$login = new CoreLibs\ACL\Login(DB_CONFIG);
$login = new CoreLibs\ACL\Login(DB_CONFIG, $log);
// create smarty object
$smarty = new CoreLibs\Template\SmartyExtend();
// create new DB class
$cms = new CoreLibs\Admin\Backend(DB_CONFIG);
$log->setLogPer('class', false);
$cms = new CoreLibs\Admin\Backend(DB_CONFIG, $log);
// the menu show flag (what menu to show)
$cms->menu_show_flag = 'main';
// db nfo
@@ -65,12 +86,12 @@ ob_end_flush();
//------------------------------ logging start
// log backend data
// data part creation
$data = array(
$data = [
'_SESSION' => $_SESSION,
'_GET' => $_GET,
'_POST' => $_POST,
'_FILES' => $_FILES
);
];
// log action
// no log if login
if (!$login->login) {
@@ -78,14 +99,7 @@ if (!$login->login) {
}
//------------------------------ logging end
// automatic hide for DEBUG messages on live server
// can be overridden when setting DEBUG_ALL_OVERRIDE on top of the script (for emergency debugging of one page only)
if ((TARGET == 'live' || TARGET == 'remote') && !empty($DEBUG_ALL_OVERRIDE)) {
foreach (['debug', 'echo', 'print'] as $target) {
$login->log->setLogLevelAll($target, false);
$cms->log->setLogLevelAll($target, false);
}
}
// pass on DEBUG flag to JS via smarty variable
$smarty->DATA['JS_DEBUG'] = DEBUG;
// __END__