diff --git a/www/admin/class_test.array.php b/www/admin/class_test.array.php index 0f9f7d8c..4cb8ed3c 100644 --- a/www/admin/class_test.array.php +++ b/www/admin/class_test.array.php @@ -73,7 +73,7 @@ print "ARRAYMERGERECURSIVE: ".$basic->printAr(ArrayHandler::arrayMergeRecursive( // print "ARRAYMERGERECURSIVE: ".$basic->printAr($basic->arrayMergeRecursive($array_1, $array_2, $array_3))."
"; // error message -print $basic->printErrorMsg(); +print $basic->log->printErrorMsg(); print ""; diff --git a/www/admin/class_test.byte.php b/www/admin/class_test.byte.php index b36e5005..b0f1a320 100644 --- a/www/admin/class_test.byte.php +++ b/www/admin/class_test.byte.php @@ -88,7 +88,7 @@ print "BYTE TO: $byte: ".$basic->humanReadableByteFormat($byte)."
"; print "BYTE FROM: $string: ".$basic->stringByteFormat($string)."
"; */ // error message -print $basic->printErrorMsg(); +print $basic->log->printErrorMsg(); print ""; diff --git a/www/admin/class_test.colors.php b/www/admin/class_test.colors.php index 8d99995e..25d7f363 100644 --- a/www/admin/class_test.colors.php +++ b/www/admin/class_test.colors.php @@ -58,7 +58,7 @@ print "S::COLOR hsl->rgb: $hsl[0], $hsl[1], $hsl[2]: ".$basic->printAr(Colors::h // TODO: run compare check input must match output // error message -print $basic->printErrorMsg(); +print $basic->log->printErrorMsg(); print ""; diff --git a/www/admin/class_test.datetime.php b/www/admin/class_test.datetime.php index f88481aa..3b1f4139 100644 --- a/www/admin/class_test.datetime.php +++ b/www/admin/class_test.datetime.php @@ -141,7 +141,7 @@ $compare_date = ['2021-05-01', '2021-05-10']; print "CALCDAYSINTERVAL(named): $compare_date[0] = $compare_date[1]: ".$basic->printAr($basic->calcDaysInterval($compare_date[0], $compare_date[1], true))."
"; */ // error message -print $basic->printErrorMsg(); +print $basic->log->printErrorMsg(); print ""; diff --git a/www/admin/class_test.db.php b/www/admin/class_test.db.php index 5d0cc4d1..95ee2419 100644 --- a/www/admin/class_test.db.php +++ b/www/admin/class_test.db.php @@ -200,7 +200,7 @@ print "ISSET: ".isset($res['null_varchar'])."
"; print "EMPTY: ".empty($res['null_varchar'])."
"; // error message -print $basic->printErrorMsg(); +print $basic->log->printErrorMsg(); print ""; diff --git a/www/admin/class_test.debug.php b/www/admin/class_test.debug.php index 7b04787d..174771ad 100644 --- a/www/admin/class_test.debug.php +++ b/www/admin/class_test.debug.php @@ -80,7 +80,7 @@ print "S::FDEBUG: ".FileWriter::fdebug('CLASS TEST DEBUG FILE: '.date('Y-m-d H:i // error message // future DEPRECATED $basic->debug('BASIC CLASS', 'Debug test'); -print "BASIC:
".$basic->printErrorMsg(); +print "BASIC:
".$basic->log->printErrorMsg(); print ""; diff --git a/www/admin/class_test.email.php b/www/admin/class_test.email.php index d0f54c97..ba0711bd 100644 --- a/www/admin/class_test.email.php +++ b/www/admin/class_test.email.php @@ -56,7 +56,7 @@ foreach ($email as $s_email) { } */ // error message -print $basic->printErrorMsg(); +print $basic->log->printErrorMsg(); print ""; diff --git a/www/admin/class_test.encoding.php b/www/admin/class_test.encoding.php index cbcbf160..92a85468 100644 --- a/www/admin/class_test.encoding.php +++ b/www/admin/class_test.encoding.php @@ -87,7 +87,7 @@ print "CONV ENCODING: $_string: ".$basic->convertEncoding($_string, 'ISO-2022-JP print "D/__MBMIMEENCODE: ".$basic->__mbMimeEncode('Some Text', 'UTF-8')."
"; */ // error message -print $basic->printErrorMsg(); +print $basic->log->printErrorMsg(); print ""; diff --git a/www/admin/class_test.file.php b/www/admin/class_test.file.php index b643597e..4f929652 100644 --- a/www/admin/class_test.file.php +++ b/www/admin/class_test.file.php @@ -40,7 +40,7 @@ $file = getcwd().DIRECTORY_SEPARATOR.'class_test.file.php'; print "GETLINESFROMFILE: $file: ".File::getLinesFromFile($file)."
"; // error message -print $basic->printErrorMsg(); +print $basic->log->printErrorMsg(); print ""; diff --git a/www/admin/class_test.hash.php b/www/admin/class_test.hash.php index 420bc056..a84ed069 100644 --- a/www/admin/class_test.hash.php +++ b/www/admin/class_test.hash.php @@ -55,7 +55,7 @@ print "D/__SHA1SHORT(off): $to_crc: ".$basic->__sha1short($to_crc)."
"; print "D/__hash(d): $to_crc: ".$basic->__hash($to_crc)."
"; */ // error message -print $basic->printErrorMsg(); +print $basic->log->printErrorMsg(); print ""; diff --git a/www/admin/class_test.html.php b/www/admin/class_test.html.php index 0c010a66..4827a21a 100644 --- a/www/admin/class_test.html.php +++ b/www/admin/class_test.html.php @@ -95,7 +95,7 @@ print "D/MAGICLINK: ".Html::htmlent($basic->magicLinks($magic_link))."
"; // error message -print $basic->printErrorMsg(); +print $basic->log->printErrorMsg(); print ""; diff --git a/www/admin/class_test.image.php b/www/admin/class_test.image.php index cf5965f3..4c778c6b 100644 --- a/www/admin/class_test.image.php +++ b/www/admin/class_test.image.php @@ -99,7 +99,7 @@ $basic->correctImageOrientation($image); echo "
S::CREATETHUMBNAILSIMPLE: ".basename($image).": WIDTH: $thumb_width
"; */ // error message -print $basic->printErrorMsg(); +print $basic->log->printErrorMsg(); print ""; diff --git a/www/admin/class_test.json.php b/www/admin/class_test.json.php index 1510bcd3..a31474ca 100644 --- a/www/admin/class_test.json.php +++ b/www/admin/class_test.json.php @@ -65,7 +65,7 @@ print "E-JSON: $json: ".$basic->printAr($output)."
"; print "E-JSON ERROR: ".$basic->jsonGetLastError().": ".$basic->jsonGetLastError(true)."
"; */ // error message -print $basic->printErrorMsg(); +print $basic->log->printErrorMsg(); print ""; diff --git a/www/admin/class_test.math.php b/www/admin/class_test.math.php index 5688e550..1378228e 100644 --- a/www/admin/class_test.math.php +++ b/www/admin/class_test.math.php @@ -50,7 +50,7 @@ print "FLOORP: ".$basic->floorp(5123456, -3)."
"; print "INITNUMERIC: ".$basic->initNumeric('123')."
"; */ // error message -print $basic->printErrorMsg(); +print $basic->log->printErrorMsg(); print ""; diff --git a/www/admin/class_test.mime.php b/www/admin/class_test.mime.php index ef432395..e4890f60 100644 --- a/www/admin/class_test.mime.php +++ b/www/admin/class_test.mime.php @@ -52,7 +52,7 @@ $mime = 'fake/mime'; $basic->mimeSetAppName($mime, 'This is a fake mime'); print "MIME $mime: ".$basic->mimeGetAppName($mime)."
"; */ -print $basic->printErrorMsg(); +print $basic->log->printErrorMsg(); print ""; diff --git a/www/admin/class_test.password.php b/www/admin/class_test.password.php index e1527009..5823ff06 100644 --- a/www/admin/class_test.password.php +++ b/www/admin/class_test.password.php @@ -26,6 +26,8 @@ if (!defined('SET_SESSION_NAME')) { $LOG_FILE_ID = 'classTest-pass'; ob_end_flush(); +use CoreLibs\Check\Password as PwdChk; + $basic = new CoreLibs\Basic(); $_password = new CoreLibs\Check\Password(); $password_class = 'CoreLibs\Check\Password'; diff --git a/www/admin/class_test.php b/www/admin/class_test.php index 69b41e25..8d724d4c 100644 --- a/www/admin/class_test.php +++ b/www/admin/class_test.php @@ -71,7 +71,7 @@ if (is_object($login) && isset($login->acl['unit'])) { print "Something went wrong with the login
"; } -// $basic->debug('SESSION', $basic->print_ar($_SESSION)); +// $basic->log->debug('SESSION', \CoreLibs\Debug\Support::printAr($_SESSION)); print '
'; print 'Logout'; @@ -79,22 +79,22 @@ print ''; print '
'; // print the debug core vars -print "DEBUG OUT: ".$basic->debug_output."
"; -print "ECHO OUT: ".$basic->echo_output."
"; -print "PRINT OUT: ".$basic->print_output."
"; -print "NOT DEBUG OUT: ".$basic->debug_output_not."
"; -print "NOT ECHO OUT: ".$basic->echo_output_not."
"; -print "NOT PRINT OUT: ".$basic->print_output_not."
"; -print "DEBUG OUT ALL: ".$basic->debug_output_all."
"; -print "ECHO OUT ALL: ".$basic->echo_output_all."
"; -print "PRINT OUT ALL: ".$basic->print_output_all."
"; +foreach (['on', 'off'] as $flag) { + foreach (['debug', 'echo', 'print'] as $type) { + $prefix = $flag == 'off' ? 'NOT ' : ''; + print $prefix.strtoupper($type).' OUT: '.\CoreLibs\Debug\Support::printAr($basic->log->getLogLevel($type, $flag)).'
'; + } +} +foreach (['debug', 'echo', 'print'] as $type) { + print strtoupper($type).' OUT ALL: '.$basic->log->getLogLevelAll($type).'
'; +} -$basic->debug('SOME MARK', 'Some error output'); +$basic->log->debug('SOME MARK', 'Some error output'); print "EDIT ACCESS ID: ".$basic->edit_access_id."
"; if (is_object($login)) { // print "ACL:
".$basic->print_ar($login->acl)."
"; - $basic->debug('ACL', "ACL: ".$basic->printAr($login->acl)); + $basic->log->debug('ACL', "ACL: ".\CoreLibs\Debug\Support::printAr($login->acl)); // print "DEFAULT ACL:
".$basic->print_ar($login->default_acl_list)."
"; // print "DEFAULT ACL:
".$basic->print_ar($login->default_acl_list)."
"; // $result = array_flip(array_filter(array_flip($login->default_acl_list), function ($key) { if (is_numeric($key)) return $key; })); @@ -104,8 +104,8 @@ if (is_object($login)) { } // print error messages -// print $login->printErrorMsg(); -print $basic->printErrorMsg(); +// print $login->log->printErrorMsg(); +print $basic->log->printErrorMsg(); print ""; diff --git a/www/admin/class_test.phpv.php b/www/admin/class_test.phpv.php index dca8625d..190eb639 100644 --- a/www/admin/class_test.phpv.php +++ b/www/admin/class_test.phpv.php @@ -59,7 +59,7 @@ print "U-S::MIN: $min_version: ".(string)PhpVersion::checkPHPVersion($min_versio // print "MIN: $min_version: ".(string)$basic->checkPHPVersion($min_version)."
"; // error message -print $basic->printErrorMsg(); +print $basic->log->printErrorMsg(); print ""; diff --git a/www/admin/class_test.randomkey.php b/www/admin/class_test.randomkey.php index 332167ca..94330536 100644 --- a/www/admin/class_test.randomkey.php +++ b/www/admin/class_test.randomkey.php @@ -48,7 +48,7 @@ print "C->RANDOMKEYGEN(auto): ".$_array->randomKeyGen()."
"; // print "D\RANDOMKEYGEN(auto): ".$basic->randomKeyGen()."
"; // error message -print $basic->printErrorMsg(); +print $basic->log->printErrorMsg(); print ""; diff --git a/www/admin/class_test.runningtime.php b/www/admin/class_test.runningtime.php index d17bec7b..733b3340 100644 --- a/www/admin/class_test.runningtime.php +++ b/www/admin/class_test.runningtime.php @@ -56,7 +56,7 @@ echo "RANDOM KEY [default]: ".$basic->randomKeyGen()."
"; echo "TIMED [hr]: ".$basic->hrRunningTime()."
"; */ // error message -print $basic->printErrorMsg(); +print $basic->log->printErrorMsg(); print ""; diff --git a/www/admin/class_test.system.php b/www/admin/class_test.system.php index 113ea626..f2e74fab 100644 --- a/www/admin/class_test.system.php +++ b/www/admin/class_test.system.php @@ -43,6 +43,6 @@ print "FILEUPLOADERRORMESSAGE(): ".System::fileUploadErrorMessage(-1)."
"; print "FILEUPLOADERRORMESSAGE(UPLOAD_ERR_CANT_WRITE): ".System::fileUploadErrorMessage(UPLOAD_ERR_CANT_WRITE)."
"; // error message -print $basic->printErrorMsg(); +print $basic->log->printErrorMsg(); print ""; diff --git a/www/admin/class_test.token.php b/www/admin/class_test.token.php index a240a9f4..78e818bd 100644 --- a/www/admin/class_test.token.php +++ b/www/admin/class_test.token.php @@ -51,7 +51,7 @@ print "TOKEN: $token: (ID) ".$token_id." => (S) ".$_SESSION[$token]."
"; print "VALIDATE: $token: ".(string)$basic->validateFormToken($token_id, $token)."
"; */ // error message -print $basic->printErrorMsg(); +print $basic->log->printErrorMsg(); print ""; diff --git a/www/admin/class_test.uids.php b/www/admin/class_test.uids.php index 86af392f..74fec0bb 100644 --- a/www/admin/class_test.uids.php +++ b/www/admin/class_test.uids.php @@ -49,7 +49,7 @@ print "S::UNIQID (sha256): ".$uids_class::uniqId('sha256')."
"; print "/DUNIQID (d): ".$basic->uniqId()."
"; */ // error message -print $basic->printErrorMsg(); +print $basic->log->printErrorMsg(); print ""; diff --git a/www/includes/Date.Vars.php b/www/includes/Date.Vars.php index da3df926..0bb6b0ac 100644 --- a/www/includes/Date.Vars.php +++ b/www/includes/Date.Vars.php @@ -7,7 +7,7 @@ * HISTORY: *********************************************************************/ -$day_short = array( +$day_short = [ 1 => 'Mon', 2 => 'Tue', 3 => 'Wed', @@ -15,9 +15,9 @@ $day_short = array( 5 => 'Fri', 6 => 'Sat', 7 => 'Sun' -); +]; -$day_long = array( +$day_long = [ 1 => 'Monday', 2 => 'Tuesday', 3 => 'Wednesday', @@ -25,10 +25,10 @@ $day_long = array( 5 => 'Friday', 6 => 'Saturday', 7 => 'Sunday' -); +]; // months -$month_long = array( +$month_long = [ 1 => 'January', 2 => 'February', 3 => 'March', @@ -41,9 +41,9 @@ $month_long = array( 10 => 'October', 11 => 'November', 12 => 'December' -); +]; -$month_short = array( +$month_short = [ 1 => 'Jan', 2 => 'Feb', 3 => 'Mar', @@ -56,6 +56,6 @@ $month_short = array( 10 => 'Oct', 11 => 'Nov', 12 => 'Dec' -); +]; // __END__ diff --git a/www/includes/admin_footer.php b/www/includes/admin_footer.php index 969cea0f..3e4cb7ab 100644 --- a/www/includes/admin_footer.php +++ b/www/includes/admin_footer.php @@ -8,7 +8,7 @@ *********************************************************************/ // print debug messages -echo $login->printErrorMsg(); -echo $cms->printErrorMsg(); +echo $login->log->printErrorMsg(); +echo $cms->log->printErrorMsg(); // __END__ diff --git a/www/includes/edit_base.php b/www/includes/edit_base.php index c81ed40b..d0e83d2e 100644 --- a/www/includes/edit_base.php +++ b/www/includes/edit_base.php @@ -54,20 +54,20 @@ $smarty = new CoreLibs\Template\SmartyExtend(); if (TARGET == 'live' || TARGET == 'remote') { // login - $login->debug_output_all = DEBUG ? 1 : 0; - $login->echo_output_all = 0; - $login->print_output_all = DEBUG ? 1 : 0; + $login->log->setLogLevelAll('debug', DEBUG ? true : false); + $login->log->setLogLevelAll('echo', false); + $login->log->setLogLevelAll('print', DEBUG ? true : false); // form - $form->debug_output_all = DEBUG ? 1 : 0; - $form->echo_output_all = 0; - $form->print_output_all = DEBUG ? 1 : 0; + $form->log->setLogLevelAll('debug', DEBUG ? true : false); + $form->log->setLogLevelAll('echo', false); + $form->log->setLogLevelAll('print', DEBUG ? true : false); } // space for setting special debug flags -$login->debug_output_all = 1; +$login->log->setLogLevelAll('debug', true); // set smarty arrays -$HEADER = array(); -$DATA = array(); -$DEBUG_DATA = array(); +$HEADER = []; +$DATA = []; +$DEBUG_DATA = []; // set the template dir // WARNING: this has a special check for the mailing tool layout (old layout) if (defined('LAYOUT')) { @@ -94,13 +94,13 @@ if ($form->my_page_name == 'edit_order') { // order name is _always_ order_number for the edit interface // follwing arrays do exist here: - // $position ... has the positions of the array(0..max), cause in a // I can't put an number into the array field, in this array, // there are the POSITION stored, that should CHANGE there order (up/down) // $row_data_id ... has ALL ids from the sorting part // $row_data_order ... has ALL order positions from the soirting part if (!isset($position)) { - $position = array(); + $position = []; } $row_data_id = $_POST['row_data_id'] ?? []; $original_id = $row_data_id; @@ -156,29 +156,33 @@ if ($form->my_page_name == 'edit_order') { $q .= "ORDER BY order_number"; // init arrays - $row_data = array(); - $options_id = array(); - $options_name = array(); - $options_selected = array(); + $row_data = []; + $options_id = []; + $options_name = []; + $options_selected = []; // DB read data for menu while ($res = $form->dbReturn($q)) { - $row_data[] = array( + $row_data[] = [ "id" => $res[$table_name."_id"], "name" => $res["name"], "order" => $res["order_number"] - ); + ]; } // while read data ... // html title $HEADER['HTML_TITLE'] = $form->l->__('Edit Order'); - $messages = array(); + $messages = []; // error msg if (isset($error)) { if (!isset($msg)) { - $msg = array(); + $msg = []; } - $messages[] = array('msg' => $msg, 'class' => 'error', 'width' => '100%'); + $messages[] = [ + 'msg' => $msg, + 'class' => 'error', + 'width' => '100%' + ]; } $DATA['form_error_msg'] = $messages; @@ -201,8 +205,8 @@ if ($form->my_page_name == 'edit_order') { $DATA['options_selected'] = $options_selected; // hidden list for the data (id, order number) - $row_data_id = array(); - $row_data_order = array(); + $row_data_id = []; + $row_data_order = []; for ($i = 0; $i < count($row_data); $i++) { $row_data_id[] = $row_data[$i]['id']; $row_data_order[] = $row_data[$i]['order']; @@ -230,7 +234,7 @@ if ($form->my_page_name == 'edit_order') { $DATA['table_width'] = $table_width; - $messages = array(); + $messages = []; // write out error / status messages $messages[] = $form->formPrintMsg(); $DATA['form_error_msg'] = $messages; @@ -252,9 +256,9 @@ if ($form->my_page_name == 'edit_order') { // build nav from $PAGES ... if (!isset($PAGES) || !is_array($PAGES)) { - $PAGES = array(); + $PAGES = []; } - $menuarray = array(); + $menuarray = []; foreach ($PAGES as $PAGE_CUID => $PAGE_DATA) { if ($PAGE_DATA['menu'] && $PAGE_DATA['online']) { $menuarray[] = $PAGE_DATA; @@ -273,7 +277,7 @@ if ($form->my_page_name == 'edit_order') { } $position = 0; - $menu_data = array(); + $menu_data = []; // for ($i = 1; $i <= count($menuarray); $i ++) { foreach ($menuarray as $i => $data) { // do that for new array @@ -299,7 +303,7 @@ if ($form->my_page_name == 'edit_order') { } // on matching, we also need to check if we are in the same folder if (isset($data['filename']) && - $data['filename'] == $form->getPageName() && + $data['filename'] == \CoreLibs\Get\System::getPageName() && (!isset($data['hostname']) || ( isset($data['hostname']) && (!$data['hostname'] || strstr($data['hostname'], CONTENT_PATH) !== false) @@ -344,7 +348,7 @@ if ($form->my_page_name == 'edit_order') { $DATA['form_my_page_name'] = $form->my_page_name; $DATA['filename_exist'] = 0; $DATA['drop_down_input'] = 0; - $elements = array(); + $elements = []; // depending on the "getPageName()" I show different stuff switch ($form->my_page_name) { case 'edit_users': @@ -382,9 +386,9 @@ if ($form->my_page_name == 'edit_order') { $q = "DELETE FROM temp_files"; $form->dbExec($q); // gets all files in the current dir and dirs given ending with .php - $folders = array('../admin/', '../frontend/'); - $files = array('*.php'); - $search_glob = array(); + $folders = ['../admin/', '../frontend/']; + $files = ['*.php']; + $search_glob = []; foreach ($folders as $folder) { // make sure this folder actually exists if (is_dir(ROOT.$folder)) { @@ -498,7 +502,7 @@ if (is_dir(BASE.CACHE)) { $smarty->display($EDIT_TEMPLATE, 'editAdmin_'.$smarty->lang, 'editAdmin_'.$smarty->lang); // debug output -echo $login->printErrorMsg(); -echo $form->printErrorMsg(); +echo $login->log->printErrorMsg(); +echo $form->log->printErrorMsg(); // __END__ diff --git a/www/includes/table_arrays/array_edit_access.php b/www/includes/table_arrays/array_edit_access.php index 8c84db11..f129332e 100644 --- a/www/includes/table_arrays/array_edit_access.php +++ b/www/includes/table_arrays/array_edit_access.php @@ -1,26 +1,26 @@ array( - 'edit_access_id' => array( - 'value' => isset($GLOBALS['edit_access_id']) ? $GLOBALS['edit_access_id'] : '', +$edit_access = [ + 'table_array' => [ + 'edit_access_id' => [ + 'value' => $GLOBALS['edit_access_id'] ?? '', 'type' => 'hidden', 'pk' => 1 - ), - 'name' => array( - 'value' => isset($GLOBALS['name']) ? $GLOBALS['name'] : '', + ], + 'name' => [ + 'value' => $GLOBALS['name'] ?? '', 'output_name' => 'Access Group Name', 'mandatory' => 1, 'type' => 'text', 'error_check' => 'alphanumericspace|unique' - ), - 'description' => array( - 'value' => isset($GLOBALS['description']) ? $GLOBALS['description'] : '', + ], + 'description' => [ + 'value' => $GLOBALS['description'] ?? '', 'output_name' => 'Description', 'type' => 'textarea' - ), - 'color' => array( - 'value' => isset($GLOBALS['color']) ? $GLOBALS['color'] : '', + ], + 'color' => [ + 'value' => $GLOBALS['color'] ?? '', 'output_name' => 'Color', 'mandatory' => 0, 'type' => 'text', @@ -29,80 +29,80 @@ $edit_access = array( 'error_check' => 'custom', 'error_regex' => "/[\dA-Fa-f]{6}/", 'error_example' => 'F6A544' - ), - 'enabled' => array( - 'value' => isset($GLOBALS['enabled']) ? $GLOBALS['enabled'] : 0, + ], + 'enabled' => [ + 'value' => $GLOBALS['enabled'] ?? 0, 'output_name' => 'Enabled', 'type' => 'binary', 'int' => 1, // OR 'bool' => 1 - 'element_list' => array( + 'element_list' => [ '1' => 'Yes', '0' => 'No' - ) - ), - 'protected' => array( - 'value' => isset($GLOBALS['protected']) ? $GLOBALS['protected'] : 0, + ], + ], + 'protected' => [ + 'value' => $GLOBALS['protected'] ?? 0, 'output_name' => 'Protected', 'type' => 'binary', 'int' => 1, - 'element_list' => array( + 'element_list' => [ '1' => 'Yes', '0' => 'No' - ) - ), - 'additional_acl' => array( - 'value' => isset($GLOBALS['additional_acl']) ? $GLOBALS['additional_acl'] : '', + ], + ], + 'additional_acl' => [ + 'value' => $GLOBALS['additional_acl'] ?? '', 'output_name' => 'Additional ACL (as JSON)', 'type' => 'textarea', 'error_check' => 'json', 'rows' => 10, 'cols' => 60 - ), - ), + ], + ], 'table_name' => 'edit_access', "load_query" => "SELECT edit_access_id, name FROM edit_access ORDER BY name", - 'show_fields' => array( - array( + 'show_fields' => [ + [ 'name' => 'name' - ) - ), - 'element_list' => array( - 'edit_access_data' => array( + ], + ], + 'element_list' => [ + 'edit_access_data' => [ 'output_name' => 'Edit Access Data', 'delete_name' => 'remove_edit_access_data', - // 'type' => 'reference_data', # is not a sub table read and connect, but only a sub table with data - 'max_empty' => 5, # maxium visible if no data is set, if filled add this number to visible + // 'type' => 'reference_data', // is not a sub table read and connect, but only a sub table with data + 'max_empty' => 5, // maxium visible if no data is set, if filled add this number to visible 'prefix' => 'ead', - 'elements' => array( - 'name' => array( + 'elements' => [ + 'name' => [ 'type' => 'text', 'error_check' => 'alphanumeric|unique', 'output_name' => 'Name', 'mandatory' => 1 - ), - 'value' => array( + ], + 'value' => [ 'type' => 'text', 'output_name' => 'Value' - ), - 'enabled' => array( + ], + 'enabled' => [ 'type' => 'checkbox', 'output_name' => 'Activate', 'int' => 1, - 'element_list' => array(1) - ), - /*'edit_access_id' => array( + 'element_list' => [1] + ], + /*'edit_access_id' => [ 'int' => 1, 'type' => 'hidden', - 'fk_id' => 1 # reference main key from master table above - ),*/ - 'edit_access_data_id' => array( + 'fk_id' => 1 // reference main key from master table above + ],*/ + 'edit_access_data_id' => [ 'type' => 'hidden', 'int' => 1, 'pk_id' => 1 - ) - ) - ) - ) -); + ], + ], + ], + ], +]; // __END__ diff --git a/www/includes/table_arrays/array_edit_groups.php b/www/includes/table_arrays/array_edit_groups.php index ddc0ca32..09cb1fb5 100644 --- a/www/includes/table_arrays/array_edit_groups.php +++ b/www/includes/table_arrays/array_edit_groups.php @@ -1,109 +1,109 @@ array( - 'edit_group_id' => array( - 'value' => isset($GLOBALS['edit_group_id']) ? $GLOBALS['edit_group_id'] : '', +$edit_groups = [ + 'table_array' => [ + 'edit_group_id' => [ + 'value' => $GLOBALS['edit_group_id'] ?? '', 'pk' => 1, 'type' => 'hidden' - ), - 'enabled' => array( - 'value' => isset($GLOBALS['enabled']) ? $GLOBALS['enabled'] : '', + ], + 'enabled' => [ + 'value' => $GLOBALS['enabled'] ?? '', 'output_name' => 'Enabled', 'int' => 1, 'type' => 'binary', - 'element_list' => array( + 'element_list' => [ '1' => 'Yes', '0' => 'No' - ) - ), - 'name' => array( - 'value' => isset($GLOBALS['name']) ? $GLOBALS['name'] : '', + ], + ], + 'name' => [ + 'value' => $GLOBALS['name'] ?? '', 'output_name' => 'Group Name', 'type' => 'text', 'mandatory' => 1 - ), - 'edit_access_right_id' => array( - 'value' => isset($GLOBALS['edit_access_right_id']) ? $GLOBALS['edit_access_right_id'] : '', + ], + 'edit_access_right_id' => [ + 'value' => $GLOBALS['edit_access_right_id'] ?? '', 'output_name' => 'Group Level', 'mandatory' => 1, 'int' => 1, 'type' => 'drop_down_db', 'query' => "SELECT edit_access_right_id, name FROM edit_access_right ORDER BY level" - ), - 'edit_scheme_id' => array( - 'value' => isset($GLOBALS['edit_scheme_id']) ? $GLOBALS['edit_scheme_id'] : '', + ], + 'edit_scheme_id' => [ + 'value' => $GLOBALS['edit_scheme_id'] ?? '', 'output_name' => 'Group Scheme', 'int_null' => 1, 'type' => 'drop_down_db', 'query' => "SELECT edit_scheme_id, name FROM edit_scheme WHERE enabled = 1 ORDER BY name" - ), - 'additional_acl' => array( - 'value' => isset($GLOBALS['additional_acl']) ? $GLOBALS['additional_acl'] : '', + ], + 'additional_acl' => [ + 'value' => $GLOBALS['additional_acl'] ?? '', 'output_name' => 'Additional ACL (as JSON)', 'type' => 'textarea', 'error_check' => 'json', 'rows' => 10, 'cols' => 60 - ), - ), + ], + ], 'load_query' => "SELECT edit_group_id, name, enabled FROM edit_group ORDER BY name", 'table_name' => 'edit_group', - 'show_fields' => array( - array( + 'show_fields' => [ + [ 'name' => 'name' - ), - array( + ], + [ 'name' => 'enabled', - 'binary' => array('Yes', 'No'), + 'binary' => ['Yes', 'No'], 'before_value' => 'Enabled: ' - ) - ), - 'element_list' => array( - 'edit_page_access' => array( + ], + ], + 'element_list' => [ + 'edit_page_access' => [ 'output_name' => 'Pages', 'mandatory' => 1, 'delete' => 0, // set then reference entries are deleted, else the 'enable' flag is only set 'enable_name' => 'enable_page_access', 'prefix' => 'epa', - 'read_data' => array( + 'read_data' => [ 'table_name' => 'edit_page', 'pk_id' => 'edit_page_id', 'name' => 'name', 'order' => 'order_number' - ), - 'elements' => array( - 'edit_page_access_id' => array( + ], + 'elements' => [ + 'edit_page_access_id' => [ 'type' => 'hidden', 'int' => 1, 'pk_id' => 1 - ), - 'enabled' => array( + ], + 'enabled' => [ 'type' => 'checkbox', 'output_name' => 'Activate', 'int' => 1, - 'element_list' => array(1) - ), - 'edit_access_right_id' => array( + 'element_list' => [1], + ], + 'edit_access_right_id' => [ 'type' => 'drop_down_db', 'output_name' => 'Access Level', 'int' => 1, 'preset' => 1, // first of the select 'query' => "SELECT edit_access_right_id, name FROM edit_access_right ORDER BY level" - ), - 'edit_page_id' => array( + ], + 'edit_page_id' => [ 'int' => 1, 'type' => 'hidden' - ) + ], /*, - 'edit_default' => array( + 'edit_default' => [ 'output_name' => 'Default', 'type' => 'radio', 'mandatory' => 1 - )*/ - ) - ) // edit pages ggroup - ) -); + ],*/ + ], + ], // edit pages ggroup + ], +]; // __END__ diff --git a/www/includes/table_arrays/array_edit_languages.php b/www/includes/table_arrays/array_edit_languages.php index 2cec7d55..eb2658e6 100644 --- a/www/includes/table_arrays/array_edit_languages.php +++ b/www/includes/table_arrays/array_edit_languages.php @@ -1,75 +1,75 @@ array( - 'edit_language_id' => array( - 'value' => isset($GLOBALS['edit_language_id']) ? $GLOBALS['edit_language_id'] : '', +$edit_languages=[ + 'table_array' => [ + 'edit_language_id' => [ + 'value' => $GLOBALS['edit_language_id'] ?? '', 'type' => 'hidden', 'pk' => 1 - ), - 'short_name' => array( - 'value' => isset($GLOBALS['short_name']) ? $GLOBALS['short_name'] : '', + ], + 'short_name' => [ + 'value' => $GLOBALS['short_name'] ?? '', 'output_name' => 'Language (short)', 'mandatory' => 1, 'type' => 'text', 'size' => 2, 'length' => 2 - ), - 'long_name' => array( - 'value' => isset($GLOBALS['long_name']) ? $GLOBALS['long_name'] : '', + ], + 'long_name' => [ + 'value' => $GLOBALS['long_name'] ?? '', 'output_name' => 'Language (long)', 'mandatory' => 1, 'type' => 'text', 'size' => 40 - ), - 'iso_name' => array( - 'value' => isset($GLOBALS['iso_name']) ? $GLOBALS['iso_name'] : '', + ], + 'iso_name' => [ + 'value' => $GLOBALS['iso_name'] ?? '', 'output_name' => 'ISO Code', 'mandatory' => 1, 'type' => 'text' - ), - 'order_number' => array( - 'value' => isset($GLOBALS['order_number']) ? $GLOBALS['order_number'] : '', + ], + 'order_number' => [ + 'value' => $GLOBALS['order_number'] ?? '', 'int' => 1, 'order' => 1 - ), - 'enabled' => array( - 'value' => isset($GLOBALS['enabled']) ? $GLOBALS['enabled'] : '', + ], + 'enabled' => [ + 'value' => $GLOBALS['enabled'] ?? '', 'output_name' => 'Enabled', 'int' => 1, 'type' => 'binary', - 'element_list' => array( + 'element_list' => [ '1' => 'Yes', '0' => 'No' - ) - ), - 'lang_default' => array( - 'value' => isset($GLOBALS['lang_default']) ? $GLOBALS['lang_default'] : '', + ], + ], + 'lang_default' => [ + 'value' => $GLOBALS['lang_default'] ?? '', 'output_name' => 'Default Language', 'int' => 1, 'type' => 'binary', - 'element_list' => array( + 'element_list' => [ '1' => 'Yes', '0' => 'No' - ) - ) - ), + ], + ], + ], 'load_query' => "SELECT edit_language_id, long_name, iso_name, enabled FROM edit_language ORDER BY long_name", - 'show_fields' => array( - array( + 'show_fields' => [ + [ 'name' => 'long_name' - ), - array( + ], + [ 'name' => 'iso_name', 'before_value' => 'ISO: ' - ), - array( + ], + [ 'name' => 'enabled', 'before_value' => 'Enabled: ', - 'binary' => array('Yes','No') - ) - ), + 'binary' => ['Yes','No'], + ], + ], 'table_name' => 'edit_language' -); +]; // __END__ diff --git a/www/includes/table_arrays/array_edit_menu_group.php b/www/includes/table_arrays/array_edit_menu_group.php index cd509fde..074e04c1 100644 --- a/www/includes/table_arrays/array_edit_menu_group.php +++ b/www/includes/table_arrays/array_edit_menu_group.php @@ -1,40 +1,40 @@ array( - 'edit_menu_group_id' => array( - 'value' => isset($GLOBALS['edit_menu_group_id']) ? $GLOBALS['edit_menu_group_id'] : '', +$edit_menu_group = [ + 'table_array' => [ + 'edit_menu_group_id' => [ + 'value' => $GLOBALS['edit_menu_group_id'] ?? '', 'type' => 'hidden', 'pk' => 1 - ), - 'name' => array( - 'value' => isset($GLOBALS['name']) ? $GLOBALS['name'] : '', + ], + 'name' => [ + 'value' => $GLOBALS['name'] ?? '', 'output_name' => 'Group name', 'mandatory' => 1, 'type' => 'text' - ), - 'flag' => array( - 'value' => isset($GLOBALS['flag']) ? $GLOBALS['flag'] : '', + ], + 'flag' => [ + 'value' => $GLOBALS['flag'] ?? '', 'output_name' => 'Flag', 'mandatory' => 1, 'type' => 'text', 'error_check' => 'alphanumeric|unique' - ), - 'order_number' => array( - 'value' => isset($GLOBALS['order_number']) ? $GLOBALS['order_number'] : '', + ], + 'order_number' => [ + 'value' => $GLOBALS['order_number'] ?? '', 'output_name' => 'Group order', 'type' => 'order', 'int' => 1, 'order' => 1 - ) - ), + ], + ], 'table_name' => 'edit_menu_group', 'load_query' => "SELECT edit_menu_group_id, name FROM edit_menu_group ORDER BY name", - 'show_fields' => array( - array( + 'show_fields' => [ + [ 'name' => 'name' - ) - ) -); + ], + ], +]; // __END__ diff --git a/www/includes/table_arrays/array_edit_pages.php b/www/includes/table_arrays/array_edit_pages.php index faf6a782..a52f434e 100644 --- a/www/includes/table_arrays/array_edit_pages.php +++ b/www/includes/table_arrays/array_edit_pages.php @@ -1,101 +1,101 @@ array( - 'edit_page_id' => array( - 'value' => isset($GLOBALS['edit_page_id']) ? $GLOBALS['edit_page_id'] : '', +$edit_pages = [ + 'table_array' => [ + 'edit_page_id' => [ + 'value' => $GLOBALS['edit_page_id'] ?? '', 'type' => 'hidden', 'pk' => 1 - ), - 'filename' => array( - 'value' => isset($GLOBALS['filename']) ? $GLOBALS['filename'] : '', + ], + 'filename' => [ + 'value' => $GLOBALS['filename'] ?? '', 'output_name' => 'Add File ...', 'mandatory' => 1, 'type' => 'drop_down_db', - 'query' => "SELECT DISTINCT temp_files.filename AS id, temp_files.folder || temp_files.filename AS name ". - "FROM temp_files ". - "LEFT JOIN edit_page ep ON temp_files.filename = ep.filename ". - "WHERE ep.filename IS NULL" - ), - 'hostname' => array( - 'value' => isset($GLOBALS['hostname']) ? $GLOBALS['hostname'] : '', + 'query' => "SELECT DISTINCT temp_files.filename AS id, temp_files.folder || temp_files.filename AS name " + ."FROM temp_files " + ."LEFT JOIN edit_page ep ON temp_files.filename = ep.filename " + ."WHERE ep.filename IS NULL" + ], + 'hostname' => [ + 'value' => $GLOBALS['hostname'] ?? '', 'output_name' => 'Hostname or folder', 'type' => 'text' - ), - 'name' => array( - 'value' => isset($GLOBALS['name']) ? $GLOBALS['name'] : '', + ], + 'name' => [ + 'value' => $GLOBALS['name'] ?? '', 'output_name' => 'Page name', 'mandatory' => 1, 'type' => 'text' - ), - 'order_number' => array( - 'value' => isset($GLOBALS['order_number']) ? $GLOBALS['order_number'] : '', + ], + 'order_number' => [ + 'value' => $GLOBALS['order_number'] ?? '', 'output_name' => 'Page order', 'type' => 'order', 'int' => 1, 'order' => 1 - ), - /* 'flag' => array( + ], + /* 'flag' => [ 'value' => isset($GLOBALS['flag']) ? $GLOBALS['flag'] : '', 'output_name' => 'Page Flag', 'type' => 'drop_down_array', - 'query' => array( + 'query' => [ '0' => '0', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5' - ) - ),*/ - 'online' => array( - 'value' => isset($GLOBALS['online']) ? $GLOBALS['online'] : '', + ], + ],*/ + 'online' => [ + 'value' => $GLOBALS['online'] ?? '', 'output_name' => 'Online', 'int' => 1, 'type' => 'binary', - 'element_list' => array( + 'element_list' => [ '1' => 'Yes', '0' => 'No' - ) - ), - 'menu' => array( - 'value' => isset($GLOBALS['menu']) ? $GLOBALS['menu'] : '', + ], + ], + 'menu' => [ + 'value' => $GLOBALS['menu'] ?? '', 'output_name' => 'Menu', 'int' => 1, 'type' => 'binary', - 'element_list' => array( + 'element_list' => [ '1' => 'Yes', '0' => 'No' - ) - ), - 'popup' => array( - 'value' => isset($GLOBALS['popup']) ? $GLOBALS['popup'] : '', + ], + ], + 'popup' => [ + 'value' => $GLOBALS['popup'] ?? '', 'output_name' => 'Popup', 'int' => 1, 'type' => 'binary', - 'element_list' => array( + 'element_list' => [ '1' => 'Yes', '0' => 'No' - ) - ), - 'popup_x' => array( - 'value' => isset($GLOBALS['popup_x']) ? $GLOBALS['popup_x'] : '', + ], + ], + 'popup_x' => [ + 'value' => $GLOBALS['popup_x'] ?? '', 'output_name' => 'Popup Width', 'int_null' => 1, 'type' => 'text', 'size' => 4, 'length' => 4 - ), - 'popup_y' => array( - 'value' => isset($GLOBALS['popup_y']) ? $GLOBALS['popup_y'] : '', + ], + 'popup_y' => [ + 'value' => $GLOBALS['popup_y'] ?? '', 'output_name' => 'Popup Height', 'int_null' => 1, 'type' => 'text', 'size' => 4, 'length' => 4 - ), - 'content_alias_edit_page_id' => array( - 'value' => isset($GLOBALS['content_alias_edit_page_id']) ? $GLOBALS['content_alias_edit_page_id'] : '', + ], + 'content_alias_edit_page_id' => [ + 'value' => $GLOBALS['content_alias_edit_page_id'] ?? '', 'output_name' => 'Content Alias Source', 'int_null' => 1, 'type' => 'drop_down_db', @@ -110,132 +110,132 @@ $edit_pages = array( // "FROM edit_page ". // (isset($GLOBALS['edit_page_id']) ? " WHERE edit_page_id <> ".$GLOBALS['edit_page_id'] : "")." ". // "ORDER BY order_number" - ) - ), + ], + ], 'load_query' => "SELECT edit_page_id, CASE WHEN hostname IS NOT NULL THEN hostname ELSE ''::VARCHAR END || filename AS filename, name, online, menu, popup FROM edit_page ORDER BY order_number", 'table_name' => 'edit_page', - 'show_fields' => array( - array( + 'show_fields' => [ + [ 'name' => 'name' - ), - array( + ], + [ 'name' => 'filename', 'before_value' => 'Filename: ' - ), - array( + ], + [ 'name' => 'online', - 'binary' => array('Yes','No'), + 'binary' => ['Yes','No'], 'before_value' => 'Online: ' - ), - array( + ], + [ 'name' => 'menu', - 'binary' => array('Yes','No'), + 'binary' => ['Yes','No'], 'before_value' => 'Menu: ' - ), - array( + ], + [ 'name' => 'popup', - 'binary' => array('Yes','No'), + 'binary' => ['Yes','No'], 'before_value' => 'Popup: ' - ) - ), - 'reference_arrays' => array( - 'edit_visible_group' => array( + ], + ], + 'reference_arrays' => [ + 'edit_visible_group' => [ 'table_name' => 'edit_page_visible_group', 'other_table_pk' => 'edit_visible_group_id', 'output_name' => 'Visible Groups (access)', 'mandatory' => 1, 'select_size' => 10, - 'selected' => isset($GLOBALS['edit_visible_group_id']) ? $GLOBALS['edit_visible_group_id'] : '', + 'selected' => $GLOBALS['edit_visible_group_id'] ?? '', 'query' => "SELECT edit_visible_group_id, 'Name: ' || name || ', ' || 'Flag: ' || flag FROM edit_visible_group ORDER BY name" - ), - 'edit_menu_group' => array( + ], + 'edit_menu_group' => [ 'table_name' => 'edit_page_menu_group', 'other_table_pk' => 'edit_menu_group_id', 'output_name' => 'Menu Groups (grouping)', 'mandatory' => 1, 'select_size' => 10, - 'selected' => isset($GLOBALS['edit_menu_group_id']) ? $GLOBALS['edit_menu_group_id'] : '', + 'selected' => $GLOBALS['edit_menu_group_id'] ?? '', 'query' => "SELECT edit_menu_group_id, 'Name: ' || name || ', ' || 'Flag: ' || flag FROM edit_menu_group ORDER BY order_number" - ) + ], - ), - 'element_list' => array( - 'edit_query_string' => array( + ], + 'element_list' => [ + 'edit_query_string' => [ 'output_name' => 'Query Strings', 'delete_name' => 'remove_query_string', 'prefix' => 'eqs', - 'elements' => array( - 'name' => array( + 'elements' => [ + 'name' => [ 'output_name' => 'Name', 'type' => 'text', 'error_check' => 'unique|alphanumeric', 'mandatory' => 1 - ), - 'value' => array( + ], + 'value' => [ 'output_name' => 'Value', 'type' => 'text' - ), - 'enabled' => array( + ], + 'enabled' => [ 'output_name' => 'Enabled', 'int' => 1, 'type' => 'checkbox', - 'element_list' => array(1) - ), - 'dynamic' => array( + 'element_list' => [1], + ], + 'dynamic' => [ 'output_name' => 'Dynamic', 'int' => 1, 'type' => 'checkbox', - 'element_list' => array(1) - ), - 'edit_query_string_id' => array( + 'element_list' => [1], + ], + 'edit_query_string_id' => [ 'type' => 'hidden', 'pk_id' => 1 - ) - ) // elements - ), // query_string element list - 'edit_page_content' => array( + ], + ], // elements + ], // query_string element list + 'edit_page_content' => [ 'output_name' => 'Page Content', 'delete_name' => 'remove_page_content', 'prefix' => 'epc', - 'elements' => array( - 'name' => array( + 'elements' => [ + 'name' => [ 'output_name' => 'Content', 'type' => 'text', 'error_check' => 'alphanumeric', 'mandatory' => 1 - ), - 'uid' => array( + ], + 'uid' => [ 'output_name' => 'UID', 'type' => 'text', 'error_check' => 'unique|alphanumeric', 'mandatory' => 1 - ), - 'order_number' => array( + ], + 'order_number' => [ 'output_name' => 'Order', 'type' => 'text', 'error_check' => 'int', 'mandatory' => 1 - ), - 'online' => array( + ], + 'online' => [ 'output_name' => 'Online', 'int' => 1, 'type' => 'checkbox', - 'element_list' => array(1) - ), - 'edit_access_right_id' => array( + 'element_list' => [1], + ], + 'edit_access_right_id' => [ 'type' => 'drop_down_db', 'output_name' => 'Access Level', 'int' => 1, 'preset' => 1, // first of the select 'query' => "SELECT edit_access_right_id, name FROM edit_access_right ORDER BY level" - ), - 'edit_page_content_id' => array( + ], + 'edit_page_content_id' => [ 'type' => 'hidden', 'pk_id' => 1 - ) - ) - ) - ) // element list -); + ], + ], + ], + ], // element list +]; // __END__ diff --git a/www/includes/table_arrays/array_edit_schemes.php b/www/includes/table_arrays/array_edit_schemes.php index 082a721f..2fde4668 100644 --- a/www/includes/table_arrays/array_edit_schemes.php +++ b/www/includes/table_arrays/array_edit_schemes.php @@ -1,20 +1,20 @@ array( - 'edit_scheme_id' => array( - 'value' => isset($GLOBALS['edit_scheme_id']) ? $GLOBALS['edit_scheme_id'] : '', +$edit_schemes = [ + 'table_array' => [ + 'edit_scheme_id' => [ + 'value' => $GLOBALS['edit_scheme_id'] ?? '', 'type' => 'hidden', 'pk' => 1 - ), - 'name' => array( - 'value' => isset($GLOBALS['name']) ? $GLOBALS['name'] : '', + ], + 'name' => [ + 'value' => $GLOBALS['name'] ?? '', 'output_name' => 'Scheme Name', 'mandatory' => 1, 'type' => 'text' - ), - 'header_color' => array( - 'value' => isset($GLOBALS['header_color']) ? $GLOBALS['header_color'] : '', + ], + 'header_color' => [ + 'value' => $GLOBALS['header_color'] ?? '', 'output_name' => 'Header Color', 'mandatory' => 1, 'type' => 'text', @@ -23,35 +23,35 @@ $edit_schemes = array( 'error_check' => 'custom', 'error_regex' => '/[\dA-Fa-f]{6}/', 'error_example' => 'F6A544' - ), - 'enabled' => array( - 'value' => isset($GLOBALS['enabled']) ? $GLOBALS['enabled'] : '', + ], + 'enabled' => [ + 'value' => $GLOBALS['enabled'] ?? '', 'output_name' => 'Enabled', 'int' => 1, 'type' => 'binary', - 'element_list' => array( + 'element_list' => [ '1' => 'Yes', '0' => 'No' - ) - ), - 'template' => array( - 'value' => isset($GLOBALS['template']) ? $GLOBALS['template'] : '', + ], + ], + 'template' => [ + 'value' => $GLOBALS['template'] ?? '', 'output_name' => 'Template', 'type' => 'text' - ) - ), + ], + ], 'table_name' => 'edit_scheme', 'load_query' => "SELECT edit_scheme_id, name, enabled FROM edit_scheme ORDER BY name", - 'show_fields' => array( - array( + 'show_fields' => [ + [ 'name' => 'name' - ), - array( + ], + [ 'name' => 'enabled', - 'binary' => array('Yes', 'No'), + 'binary' => ['Yes', 'No'], 'before_value' => 'Enabled: ' - ) - ) -); // main array + ], + ], +]; // main array // __END__ diff --git a/www/includes/table_arrays/array_edit_users.php b/www/includes/table_arrays/array_edit_users.php index 96dbc6b5..48501dda 100644 --- a/www/includes/table_arrays/array_edit_users.php +++ b/www/includes/table_arrays/array_edit_users.php @@ -1,270 +1,270 @@ array( - 'edit_user_id' => array( - 'value' => isset($GLOBALS['edit_user_id']) ? $GLOBALS['edit_user_id'] : '', +$edit_users = [ + 'table_array' => [ + 'edit_user_id' => [ + 'value' => $GLOBALS['edit_user_id'] ?? '', 'type' => 'hidden', 'pk' => 1, 'int' => 1 - ), - 'username' => array( - 'value' => isset($GLOBALS['username']) ? $GLOBALS['username'] : '', + ], + 'username' => [ + 'value' => $GLOBALS['username'] ?? '', 'output_name' => 'Username', 'mandatory' => 1, 'error_check' => 'unique|alphanumericextended', 'type' => 'text' - ), - 'password' => array( - 'value' => isset($GLOBALS['password']) ? $GLOBALS['password'] : '', - 'HIDDEN_value' => isset($GLOBALS['HIDDEN_password']) ? $GLOBALS['HIDDEN_password'] : '', - 'CONFIRM_value' => isset($GLOBALS['CONFIRM_password']) ? $GLOBALS['CONFIRM_password'] : '', + ], + 'password' => [ + 'value' => $GLOBALS['password'] ?? '', + 'HIDDEN_value' => $GLOBALS['HIDDEN_password'] ?? '', + 'CONFIRM_value' => $GLOBALS['CONFIRM_password'] ?? '', 'output_name' => 'Password', 'mandatory' => 1, 'type' => 'password', // later has to be password for encryption in database - 'update' => array( // connected field updates, and update data - 'password_change_date' => array( // db row to update + 'update' => [ // connected field updates, and update data + 'password_change_date' => [ // db row to update 'type' => 'date', // type of field (int/text/date/etc) 'value' => 'NOW()' // value [todo: complex reference - ) - ) - ), + ], + ], + ], // password date when first insert and password is set, needs special field with connection to password // password reset force interval, if set, user needs to reset password after X time period - 'password_change_interval' => array( - 'value' => isset($GLOBALS['password_change_interval']) ? $GLOBALS['password_change_interval'] : '', + 'password_change_interval' => [ + 'value' => $GLOBALS['password_change_interval'] ?? '', 'output_name' => 'Password change interval', 'error_check' => 'intervalshort', // can be any date length format. n Y/M/D [not H/M/S], only one set, no combination 'type' => 'text', 'interval' => 1, // interval needs NULL write for empty 'size' => 5, // make it 5 chars long 'length' => 5 - ), - 'enabled' => array( - 'value' => isset($GLOBALS['enabled']) ? $GLOBALS['enabled'] : '', + ], + 'enabled' => [ + 'value' => $GLOBALS['enabled'] ?? '', 'output_name' => 'Enabled', 'type' => 'binary', 'int' => 1, - 'element_list' => array( + 'element_list' => [ '1' => 'Yes', '0' => 'No' - ) - ), - 'strict' => array( - 'value' => isset($GLOBALS['strict']) ? $GLOBALS['strict'] : '', + ], + ], + 'strict' => [ + 'value' => $GLOBALS['strict'] ?? '', 'output_name' => 'Strict (Lock after errors)', 'type' => 'binary', 'int' => 1, - 'element_list' => array( + 'element_list' => [ '1' => 'Yes', '0' => 'No' - ) - ), - 'locked' => array( - 'value' => isset($GLOBALS['locked']) ? $GLOBALS['locked'] : '', + ], + ], + 'locked' => [ + 'value' => $GLOBALS['locked'] ?? '', 'output_name' => 'Locked (auto set if strict with errors)', 'type' => 'binary', 'int' => 1, - 'element_list' => array( + 'element_list' => [ '1' => 'Yes', '0' => 'No' - ) - ), - 'admin' => array( - 'value' => isset($GLOBALS['admin']) ? $GLOBALS['admin'] : '', + ], + ], + 'admin' => [ + 'value' => $GLOBALS['admin'] ?? '', 'output_name' => 'Admin', 'type' => 'binary', 'int' => 1, - 'element_list' => array( + 'element_list' => [ '1' => 'Yes', '0' => 'No' - ) - ), - 'debug' => array( - 'value' => isset($GLOBALS['debug']) ? $GLOBALS['debug'] : '', + ], + ], + 'debug' => [ + 'value' => $GLOBALS['debug'] ?? '', 'output_name' => 'Debug', 'type' => 'binary', 'int' => 1, - 'element_list' => array( + 'element_list' => [ '1' => 'Yes', '0' => 'No' - ) - ), - 'db_debug' => array( - 'value' => isset($GLOBALS['db_debug']) ? $GLOBALS['db_debug'] : '', + ], + ], + 'db_debug' => [ + 'value' => $GLOBALS['db_debug'] ?? '', 'output_name' => 'DB Debug', 'type' => 'binary', 'int' => 1, - 'element_list' => array( + 'element_list' => [ '1' => 'Yes', '0' => 'No' - ) - ), - 'email' => array( - 'value' => isset($GLOBALS['email']) ? $GLOBALS['email'] : '', + ], + ], + 'email' => [ + 'value' => $GLOBALS['email'] ?? '', 'output_name' => 'E-Mail', 'type' => 'text', 'error_check' => 'email' - ), - 'last_name' => array( - 'value' => isset($GLOBALS['last_name']) ? $GLOBALS['last_name'] : '', + ], + 'last_name' => [ + 'value' => $GLOBALS['last_name'] ?? '', 'output_name' => 'Last Name', 'type' => 'text' - ), - 'first_name' => array( - 'value' => isset($GLOBALS['first_name']) ? $GLOBALS['first_name'] : '', + ], + 'first_name' => [ + 'value' => $GLOBALS['first_name'] ?? '', 'output_name' => 'First Name', 'type' => 'text' - ), - 'edit_language_id' => array( - 'value' => isset($GLOBALS['edit_language_id']) ? $GLOBALS['edit_language_id'] : '', + ], + 'edit_language_id' => [ + 'value' => $GLOBALS['edit_language_id'] ?? '', 'output_name' => 'Language', 'mandatory' => 1, 'int' => 1, 'type' => 'drop_down_db', 'query' => "SELECT edit_language_id, long_name FROM edit_language WHERE enabled = 1 ORDER BY order_number" - ), - 'edit_scheme_id' => array( - 'value' => isset($GLOBALS['edit_scheme_id']) ? $GLOBALS['edit_scheme_id'] : '', + ], + 'edit_scheme_id' => [ + 'value' => $GLOBALS['edit_scheme_id'] ?? '', 'output_name' => 'Scheme', 'int_null' => 1, 'type' => 'drop_down_db', 'query' => "SELECT edit_scheme_id, name FROM edit_scheme WHERE enabled = 1 ORDER BY name" - ), - 'edit_group_id' => array( - 'value' => isset($GLOBALS['edit_group_id']) ? $GLOBALS['edit_group_id'] : '', + ], + 'edit_group_id' => [ + 'value' => $GLOBALS['edit_group_id'] ?? '', 'output_name' => 'Group', 'int' => 1, 'type' => 'drop_down_db', 'query' => "SELECT edit_group_id, name FROM edit_group WHERE enabled = 1 ORDER BY name", 'mandatory' => 1 - ), - 'edit_access_right_id' => array( - 'value' => isset($GLOBALS['edit_access_right_id']) ? $GLOBALS['edit_access_right_id'] : '', + ], + 'edit_access_right_id' => [ + 'value' => $GLOBALS['edit_access_right_id'] ?? '', 'output_name' => 'User Level', 'mandatory' => 1, 'int' => 1, 'type' => 'drop_down_db', 'query' => "SELECT edit_access_right_id, name FROM edit_access_right ORDER BY level" - ), - 'login_error_count' => array( + ], + 'login_error_count' => [ 'output_name' => 'Login error count', - 'value' => isset($GLOBALS['login_error_count']) ? $GLOBALS['login_error_count'] : '', + 'value' => $GLOBALS['login_error_count'] ?? '', 'type' => 'view', 'empty' => '0' - ), - 'login_error_date_last' => array( + ], + 'login_error_date_last' => [ 'output_name' => 'Last login error', - 'value' => isset($GLOBALS['login_error_date_liast']) ? $GLOBALS['login_error_date_liast'] : '', + 'value' => $GLOBALS['login_error_date_liast'] ?? '', 'type' => 'view', 'empty' => '-' - ), - 'login_error_date_first' => array( + ], + 'login_error_date_first' => [ 'output_name' => 'First login error', - 'value' => isset($GLOBALS['login_error_date_first']) ? $GLOBALS['login_error_date_first'] : '', + 'value' => $GLOBALS['login_error_date_first'] ?? '', 'type' => 'view', 'empty' => '-' - ), - 'protected' => array( - 'value' => isset($GLOBALS['protected']) ? $GLOBALS['protected'] : '', + ], + 'protected' => [ + 'value' => $GLOBALS['protected'] ?? '', 'output_name' => 'Protected', 'type' => 'binary', 'int' => 1, - 'element_list' => array( + 'element_list' => [ '1' => 'Yes', '0' => 'No' - ) - ), - 'additional_acl' => array( - 'value' => isset($GLOBALS['additional_acl']) ? $GLOBALS['additional_acl'] : '', + ], + ], + 'additional_acl' => [ + 'value' => $GLOBALS['additional_acl'] ?? '', 'output_name' => 'Additional ACL (as JSON)', 'type' => 'textarea', 'error_check' => 'json', 'rows' => 10, 'cols' => 60 - ), - ), + ], + ], 'load_query' => "SELECT edit_user_id, username, enabled, debug, db_debug, strict, locked, login_error_count FROM edit_user ORDER BY username", 'table_name' => 'edit_user', - 'show_fields' => array( - array( + 'show_fields' => [ + [ 'name' => 'username' - ), - array( + ], + [ 'name' => 'enabled', - 'binary' => array('Yes', 'No'), + 'binary' => ['Yes', 'No'], 'before_value' => 'Enabled: ' - ), - array( + ], + [ 'name' => 'debug', - 'binary' => array('Yes', 'No'), + 'binary' => ['Yes', 'No'], 'before_value' => 'Debug: ' - ), - array( + ], + [ 'name' => 'db_debug', - 'binary' => array('Yes', 'No'), + 'binary' => ['Yes', 'No'], 'before_value' => 'DB Debug: ' - ), - array( + ], + [ 'name' => 'strict', - 'binary' => array('Yes', 'No'), + 'binary' => ['Yes', 'No'], 'before_value' => 'Strict: ' - ), - array( + ], + [ 'name' => 'locked', - 'binary' => array('Yes', 'No'), + 'binary' => ['Yes', 'No'], 'before_value' => 'Locked: ' - ), - array( + ], + [ 'name' => 'login_error_count', 'before_value' => 'Errors: ' - ) - ), - 'element_list' => array( - 'edit_access_user' => array( + ], + ], + 'element_list' => [ + 'edit_access_user' => [ 'output_name' => 'Accounts', 'mandatory' => 1, 'delete' => 0, // set then reference entries are deleted, else the 'enable' flag is only set 'prefix' => 'ecu', - 'read_data' => array( + 'read_data' => [ 'table_name' => 'edit_access', 'pk_id' => 'edit_access_id', 'name' => 'name', 'order' => 'name' - ), - 'elements' => array( - 'edit_access_user_id' => array( + ], + 'elements' => [ + 'edit_access_user_id' => [ 'output_name' => 'Activate', 'type' => 'hidden', 'int' => 1, 'pk_id' => 1 - ), - 'enabled' => array( + ], + 'enabled' => [ 'type' => 'checkbox', 'output_name' => 'Activate', 'int' => 1, - 'element_list' => array(1) - ), - 'edit_access_right_id' => array( + 'element_list' => [1], + ], + 'edit_access_right_id' => [ 'type' => 'drop_down_db', 'output_name' => 'Access Level', 'preset' => 1, // first of the select 'int' => 1, 'query' => "SELECT edit_access_right_id, name FROM edit_access_right ORDER BY level" - ), - 'edit_default' => array( + ], + 'edit_default' => [ 'type' => 'radio_group', 'output_name' => 'Default', 'int' => 1, 'element_list' => 'radio_group' - ), - 'edit_access_id' => array( + ], + 'edit_access_id' => [ 'type' => 'hidden', 'int' => 1 - ) - ) - ) // edit pages ggroup - ) -); + ], + ], + ], // edit pages ggroup + ], +]; // __END__ diff --git a/www/includes/table_arrays/array_edit_visible_group.php b/www/includes/table_arrays/array_edit_visible_group.php index 30ded6a3..c4b4c14d 100644 --- a/www/includes/table_arrays/array_edit_visible_group.php +++ b/www/includes/table_arrays/array_edit_visible_group.php @@ -1,33 +1,33 @@ array( - 'edit_visible_group_id' => array( - 'value' => isset($GLOBALS['edit_visible_group_id']) ? $GLOBALS['edit_visible_group_id'] : '', +$edit_visible_group = [ + 'table_array' => [ + 'edit_visible_group_id' => [ + 'value' => $GLOBALS['edit_visible_group_id'] ?? '', 'type' => 'hidden', 'pk' => 1 - ), - 'name' => array( - 'value' => isset($GLOBALS['name']) ? $GLOBALS['name'] : '', + ], + 'name' => [ + 'value' => $GLOBALS['name'] ?? '', 'output_name' => 'Group name', 'mandatory' => 1, 'type' => 'text' - ), - 'flag' => array( - 'value' => isset($GLOBALS['flag']) ? $GLOBALS['flag'] : '', + ], + 'flag' => [ + 'value' => $GLOBALS['flag'] ?? '', 'output_name' => 'Flag', 'mandatory' => 1, 'type' => 'text', 'error_check' => 'alphanumeric|unique' - ) - ), + ], + ], 'table_name' => 'edit_visible_group', 'load_query' => "SELECT edit_visible_group_id, name FROM edit_visible_group ORDER BY name", - 'show_fields' => array( - array( + 'show_fields' => [ + [ 'name' => 'name' - ) - ) -); + ], + ], +]; // __END__ diff --git a/www/lib/CoreLibs/ACL/Login.php b/www/lib/CoreLibs/ACL/Login.php index c3223aca..efad71da 100644 --- a/www/lib/CoreLibs/ACL/Login.php +++ b/www/lib/CoreLibs/ACL/Login.php @@ -59,6 +59,8 @@ namespace CoreLibs\ACL; +use CoreLibs\Check\Password; + class Login extends \CoreLibs\DB\IO { private $euid; // the user id var @@ -78,33 +80,33 @@ class Login extends \CoreLibs\DB\IO private $pw_old_password; private $pw_new_password; private $pw_new_password_confirm; - private $pw_change_deny_users = array(); // array of users for which the password change is forbidden + private $pw_change_deny_users = []; // array of users for which the password change is forbidden private $logout_target; private $max_login_error_count = -1; - private $lock_deny_users = array(); + private $lock_deny_users = []; // if we have password change we need to define some rules private $password_min_length = PASSWORD_MIN_LENGTH; // max length is fixed as 255 (for input type max), if set highter, it will be set back to 255 private $password_max_length = PASSWORD_MAX_LENGTH; // can have several regexes, if nothing set, all is ok - private $password_valid_chars = array( + private $password_valid_chars = [ // '^(?=.*\d)(?=.*[A-Za-z])[0-9A-Za-z!@#$%]{8,}$', // '^(?.*(\pL)u)(?=.*(\pN)u)(?=.*([^\pL\pN])u).{8,}', - ); + ]; // all possible login error conditions - private $login_error_msg = array(); + private $login_error_msg = []; // this is an array holding all strings & templates passed from the outside (translation) - private $login_template = array( - 'strings' => array(), + private $login_template = [ + 'strings' => [], 'password_change' => '', 'template' => '' - ); + ]; // acl vars - public $acl = array(); - public $default_acl_list = array(); + public $acl = []; + public $default_acl_list = []; // login html, if we are on an ajax page private $login_html = ''; private $login_is_ajax_page = false; @@ -190,7 +192,7 @@ class Login extends \CoreLibs\DB\IO // logout target (from config) $this->logout_target = LOGOUT_TARGET; // disallow user list for password change - $this->pw_change_deny_users = array('admin'); + $this->pw_change_deny_users = ['admin']; // set flag if password change is okay if (defined('PASSWORD_CHANGE')) { $this->password_change = PASSWORD_CHANGE; @@ -202,18 +204,18 @@ class Login extends \CoreLibs\DB\IO // max login counts before error reporting $this->max_login_error_count = 10; // users that never get locked, even if they are set strict - $this->lock_deny_users = array('admin'); + $this->lock_deny_users = ['admin']; // init default ACL list array - $_SESSION['DEFAULT_ACL_LIST'] = array(); + $_SESSION['DEFAULT_ACL_LIST'] = []; // read the current edit_access_right list into an array $q = "SELECT level, type, name FROM edit_access_right WHERE level >= 0 ORDER BY level"; while ($res = $this->dbReturn($q)) { // level to description format (numeric) - $this->default_acl_list[$res['level']] = array( + $this->default_acl_list[$res['level']] = [ 'type' => $res['type'], 'name' => $res['name'] - ); + ]; } // write that into the session $_SESSION['DEFAULT_ACL_LIST'] = $this->default_acl_list; @@ -246,12 +248,13 @@ class Login extends \CoreLibs\DB\IO // 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; + $this->log->setLogLevelAll('debug', DEBUG ? true : false); + $this->log->setLogLevelAll('echo', false); + $this->log->setLogLevelAll('print', DEBUG ? true : false); } - $status_msg = $this->printErrorMsg(); - if ($this->echo_output_all) { + $status_msg = $this->log->printErrorMsg(); + // if ($this->echo_output_all) { + if ($this->log->getLogLevelAll('echo')) { echo $status_msg; } // exit so we don't process anything further, at all @@ -259,8 +262,8 @@ class Login extends \CoreLibs\DB\IO } 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(); + $_POST = []; + $_GET = []; // set the action to login so we can trigger special login html return $_POST['action'] = 'login'; $_POST['login_html'] = $this->login_html; @@ -299,6 +302,7 @@ class Login extends \CoreLibs\DB\IO if (!$password) { $password = $this->password; } + // first, errors on missing encryption if ((preg_match("/^\\$2(a|y)\\$/", $hash) && CRYPT_BLOWFISH != 1) || (preg_match("/^\\$1\\$/", $hash) && CRYPT_MD5 != 1) || (preg_match("/^\\$[0-9A-Za-z.]{12}$/", $hash) && CRYPT_STD_DES != 1) @@ -306,22 +310,11 @@ class Login extends \CoreLibs\DB\IO // this means password cannot be decrypted because of missing crypt methods $this->login_error = 9999; $password_ok = false; - } elseif ((preg_match("/^\\$2(a)\\$/", $hash) || - // old password have $07$ so we check this - (preg_match("/^\\$2(y)\\$/", $hash) && preg_match("/\\$07\\$/", $hash)) || - preg_match("/^\\$1\\$/", $hash) || - preg_match("/^\\$[0-9A-Za-z.]{12}$/", $hash)) && - /** @phan-suppress-next-line PhanDeprecatedFunction */ - !$this->verifyCryptString($password, $hash) - ) { - // check passwword as crypted, $2a$ or $2y$ is blowfish start, $1$ is MD5 start, $\w{12} is standard DES - // this is only for OLD $07$ password - $this->login_error = 1011; - $password_ok = false; } elseif (preg_match("/^\\$2y\\$/", $hash) && - !$this->passwordVerify($password, $hash) + !Password::passwordVerify($password, $hash) ) { // this is the new password hash methid, is only $2y$ + // all others are not valid anymore $this->login_error = 1013; $password_ok = false; } elseif (!preg_match("/^\\$2(a|y)\\$/", $hash) && @@ -393,10 +386,10 @@ class Login extends \CoreLibs\DB\IO // none to be set, set in login password check } else { // check if the current password is an invalid hash and do a rehash and set password - // $this->debug('LOGIN', 'Hash: '.$res['password'].' -> VERIFY: '.($this->passwordVerify($this->password, $res['password']) ? 'OK' : 'FAIL').' => HASH: '.($this->passwordRehashCheck($res['password']) ? 'NEW NEEDED' : 'OK')); - if ($this->passwordRehashCheck($res['password'])) { + // $this->debug('LOGIN', 'Hash: '.$res['password'].' -> VERIFY: '.($Password::passwordVerify($this->password, $res['password']) ? 'OK' : 'FAIL').' => HASH: '.(Password::passwordRehashCheck($res['password']) ? 'NEW NEEDED' : 'OK')); + if (Password::passwordRehashCheck($res['password'])) { // update password hash to new one now - $q = "UPDATE edit_user SET password = '".$this->dbEscapeString($this->passwordSet($this->password))."' WHERE edit_user_id = ".$res['edit_user_id']; + $q = "UPDATE edit_user SET password = '".$this->dbEscapeString(Password::passwordSet($this->password))."' WHERE edit_user_id = ".$res['edit_user_id']; $this->dbExec($q); } // normal user processing @@ -428,9 +421,9 @@ class Login extends \CoreLibs\DB\IO $q .= "WHERE edit_user_id = ".$res['edit_user_id']; $this->dbExec($q); } - $edit_page_ids = array(); - $pages = array(); - $pages_acl = array(); + $edit_page_ids = []; + $pages = []; + $pages_acl = []; // set pages access $q = "SELECT ep.edit_page_id, ep.cuid, epca.cuid AS content_alias_uid, "; $q .= "ep.hostname, ep.filename, ep.name AS edit_page_name, "; @@ -446,7 +439,7 @@ class Login extends \CoreLibs\DB\IO // page id array for sub data readout $edit_page_ids[$res['edit_page_id']] = $res['cuid']; // create the array for pages - $pages[$res['cuid']] = array( + $pages[$res['cuid']] = [ 'edit_page_id' => $res['edit_page_id'], 'cuid' => $res['cuid'], 'content_alias_uid' => $res['content_alias_uid'], // for reference of content data on a differen page @@ -461,9 +454,9 @@ class Login extends \CoreLibs\DB\IO 'online' => $res['online'], 'acl_level' => $res['level'], 'acl_type' => $res['type'], - 'query' => array(), - 'visible' => array() - ); + 'query' => [], + 'visible' => [] + ]; // make reference filename -> level $pages_acl[$res['filename']] = $res['level']; } // for each page @@ -482,11 +475,11 @@ class Login extends \CoreLibs\DB\IO $q .= "WHERE enabled = 1 AND edit_page_id IN (".join(', ', array_keys($edit_page_ids)).") "; $q .= "ORDER BY eqs.edit_page_id"; while ($res = $this->dbReturn($q)) { - $pages[$edit_page_ids[$res['edit_page_id']]]['query'][] = array( + $pages[$edit_page_ids[$res['edit_page_id']]]['query'][] = [ 'name' => $res['name'], 'value' => $res['value'], 'dynamic' => $res['dynamic'] - ); + ]; } // get the page content and add them to the page $_edit_page_id = 0; @@ -496,7 +489,7 @@ class Login extends \CoreLibs\DB\IO $q .= "epc.edit_page_id IN (".join(', ', array_keys($edit_page_ids)).") "; $q .= "ORDER BY epc.order_number"; while ($res = $this->dbReturn($q)) { - $pages[$edit_page_ids[$res['edit_page_id']]]['content'][$res['uid']] = array( + $pages[$edit_page_ids[$res['edit_page_id']]]['content'][$res['uid']] = [ 'name' => $res['name'], 'uid' => $res['uid'], 'online' => $res['online'], @@ -504,7 +497,7 @@ class Login extends \CoreLibs\DB\IO // access name and level 'acl_type' => $res['type'], 'acl_level' => $res['level'] - ); + ]; } // write back the pages data to the output array $_SESSION['PAGES'] = $pages; @@ -515,18 +508,18 @@ class Login extends \CoreLibs\DB\IO $q .= "WHERE eau.edit_access_id = ea.edit_access_id AND eau.edit_access_right_id = ear.edit_access_right_id "; $q .= "AND eau.enabled = 1 AND edit_user_id = ".$this->euid." "; $q .= "ORDER BY ea.name"; - $unit_access = array(); - $eauid = array(); - $unit_acl = array(); + $unit_access = []; + $eauid = []; + $unit_acl = []; while ($res = $this->dbReturn($q)) { // read edit access data fields and drop them into the unit access array $q_sub ="SELECT name, value FROM edit_access_data WHERE enabled = 1 AND edit_access_id = ".$res['edit_access_id']; - $ea_data = array(); + $ea_data = []; while ($res_sub = $this->dbReturn($q_sub)) { $ea_data[$res_sub['name']] = $res_sub['value']; } // build master unit array - $unit_access[$res['edit_access_id']] = array( + $unit_access[$res['edit_access_id']] = [ 'id' => $res['edit_access_id'], 'acl_level' => $res['level'], 'acl_type' => $res['type'], @@ -535,7 +528,7 @@ class Login extends \CoreLibs\DB\IO 'color' => $res['color'], 'default' => $res['edit_default'], 'data' => $ea_data - ); + ]; // set the default unit if ($res['edit_default']) { $_SESSION['UNIT_DEFAULT'] = $res['edit_access_id']; @@ -729,13 +722,13 @@ class Login extends \CoreLibs\DB\IO } } // detail name/level set - $this->acl['unit_detail'][$ea_id] = array( + $this->acl['unit_detail'][$ea_id] = [ 'name' => $unit['name'], 'uid' => $unit['uid'], 'level' => $this->default_acl_list[$this->acl['unit'][$ea_id]]['name'], 'default' => $unit['default'], 'data' => $unit['data'] - ); + ]; // set default if ($unit['default']) { $this->acl['unit_id'] = $unit['id']; @@ -887,7 +880,7 @@ class Login extends \CoreLibs\DB\IO // no error change this users password if (!$this->login_error && $edit_user_id) { // update the user (edit_user_id) with the new password - $q = "UPDATE edit_user SET password = '".$this->dbEscapeString($this->passwordSet($this->pw_new_password))."' WHERE edit_user_id = ".$edit_user_id; + $q = "UPDATE edit_user SET password = '".$this->dbEscapeString(Password::passwordSet($this->pw_new_password))."' WHERE edit_user_id = ".$edit_user_id; $this->dbExec($q); $data = 'Password change for user "'.$this->pw_username.'"'; $this->password_change_ok = true; @@ -1013,7 +1006,7 @@ class Login extends \CoreLibs\DB\IO */ private function loginSetTemplates(): void { - $strings = array( + $strings = [ 'HTML_TITLE' => $this->l->__('LOGIN'), 'TITLE' => $this->l->__('LOGIN'), 'USERNAME' => $this->l->__('Username'), @@ -1022,9 +1015,9 @@ class Login extends \CoreLibs\DB\IO 'ERROR_MSG' => '', 'LOGOUT_TARGET' => '', 'PASSWORD_CHANGE_BUTTON_VALUE' => $this->l->__('Change Password') - ); + ]; - $error_msgs = array( + $error_msgs = [ '100' => $this->l->__('Fatal Error: [EUID] came in as GET/POST!'), // actually obsolete '1010' => $this->l->__('Fatal Error: Login Failed - Wrong Username or Password'), // user not found '1011' => $this->l->__('Fatal Error: Login Failed - Wrong Username or Password'), // blowfish password wrong @@ -1043,11 +1036,11 @@ class Login extends \CoreLibs\DB\IO '205' => $this->l->__('Fatal Error: Password change - The new password is not in a valid format'), // we should also not here WHAT is valid '300' => $this->l->__('Success: Password change successful'), // for OK password change '9999' => $this->l->__('Fatal Error: necessary crypt engine could not be found. Login is impossible') // this is bad bad error - ); + ]; // if password change is okay if ($this->password_change) { - $strings = array_merge($strings, array( + $strings = array_merge($strings, [ 'TITLE_PASSWORD_CHANGE' => 'Change Password for User', 'OLD_PASSWORD' => $this->l->__('Old Password'), 'NEW_PASSWORD' => $this->l->__('New Password'), @@ -1055,7 +1048,7 @@ class Login extends \CoreLibs\DB\IO 'CLOSE' => $this->l->__('Close'), 'JS_SHOW_HIDE' => "function ShowHideDiv(id) { element = document.getElementById(id); if (element.className == 'visible' || !element.className) element.className = 'hidden'; else element.className = 'visible'; }", 'PASSWORD_CHANGE_BUTTON' => '' - )); + ]); $this->login_template['password_change'] = <<