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:
@@ -25,6 +25,7 @@ declare(strict_types=1);
|
||||
|
||||
$DEBUG_ALL = true;
|
||||
$PRINT_ALL = true;
|
||||
$ECHO_ALL = false;
|
||||
$DB_DEBUG = true;
|
||||
|
||||
// TODO: only extract _POST data that is needed
|
||||
@@ -33,7 +34,7 @@ extract($_POST, EXTR_SKIP);
|
||||
ob_start();
|
||||
require 'config.php';
|
||||
// set session name here
|
||||
$SET_SESSION_NAME = EDIT_SESSION_NAME;
|
||||
// $SET_SESSION_NAME = EDIT_SESSION_NAME;
|
||||
// overrride debug flags
|
||||
if (!DEBUG) {
|
||||
$DEBUG_ALL = false;
|
||||
@@ -44,11 +45,26 @@ if (!DEBUG) {
|
||||
|
||||
// should be utf8
|
||||
header("Content-type: text/html; charset=" . DEFAULT_ENCODING);
|
||||
// set session
|
||||
\CoreLibs\Create\Session::startSession(EDIT_SESSION_NAME);
|
||||
// init logger
|
||||
$log = new CoreLibs\Debug\Logging([
|
||||
'log_folder' => BASE . LOG,
|
||||
'file_id' => LOG_FILE_ID . 'EditBase',
|
||||
'print_file_date' => true,
|
||||
'per_class' => true,
|
||||
'debug_all' => $DEBUG_ALL,
|
||||
'echo_all' => $ECHO_ALL,
|
||||
'print_all' => $PRINT_ALL,
|
||||
]);
|
||||
// login page
|
||||
$login = new CoreLibs\ACL\Login(DB_CONFIG, $log);
|
||||
// flush and start
|
||||
ob_end_flush();
|
||||
$login = new CoreLibs\ACL\Login(DB_CONFIG);
|
||||
|
||||
// turn off set log per class
|
||||
$log->setLogPer('class', false);
|
||||
// create form class
|
||||
$form = new CoreLibs\Output\Form\Generate(DB_CONFIG);
|
||||
$form = new CoreLibs\Output\Form\Generate(DB_CONFIG, $log);
|
||||
if ($form->mobile_phone) {
|
||||
echo "I am sorry, but this page cannot be viewed by a mobile phone";
|
||||
exit;
|
||||
|
||||
Reference in New Issue
Block a user