From 6722468bdb1cc43bc71556c546491a666e4e4d15 Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Wed, 14 Jul 2021 10:00:56 +0900 Subject: [PATCH] Update from PSR-2 to PSR-12 - Tabs are indent - Warning at 120, Error at 240 char length --- .phan/config.php | 5 +- README.md | 8 + phpstan-bootstrap.php | 1 + www/admin/class_test.admin.backend.php | 16 +- www/admin/class_test.array.php | 41 +- www/admin/class_test.byte.php | 15 +- www/admin/class_test.colors.php | 26 +- www/admin/class_test.datetime.php | 54 +- www/admin/class_test.db.php | 177 ++-- www/admin/class_test.debug.php | 61 +- www/admin/class_test.email.php | 19 +- www/admin/class_test.encoding.php | 32 +- www/admin/class_test.file.php | 11 +- www/admin/class_test.hash.php | 17 +- www/admin/class_test.html.php | 37 +- www/admin/class_test.image.php | 37 +- www/admin/class_test.json.php | 21 +- www/admin/class_test.lang.php | 16 +- www/admin/class_test.math.php | 17 +- www/admin/class_test.mime.php | 17 +- www/admin/class_test.output.form.php | 9 +- www/admin/class_test.password.php | 19 +- www/admin/class_test.php | 45 +- www/admin/class_test.phpv.php | 24 +- www/admin/class_test.randomkey.php | 19 +- www/admin/class_test.runningtime.php | 17 +- www/admin/class_test.smarty.php | 4 +- www/admin/class_test.system.php | 19 +- www/admin/class_test.token.php | 13 +- www/admin/class_test.uids.php | 21 +- www/admin/error_test.php | 8 +- www/admin/phan_test.php | 6 +- www/admin/qq_file_upload_ajax.php | 12 +- www/admin/qq_file_upload_front.php | 2 +- www/configs/config.db.php | 5 +- www/configs/config.host.php | 5 +- www/configs/config.master.php | 128 +-- www/configs/config.other.php | 9 +- www/configs/config.path.php | 5 +- www/configs/config.php | 18 +- www/frontend/index.php | 4 +- www/includes/Date.Vars.php | 5 +- www/includes/admin_footer.php | 5 +- www/includes/admin_header.php | 11 +- www/includes/admin_set_paths.php | 5 +- www/includes/admin_smarty.php | 10 +- www/includes/edit_base.php | 81 +- .../table_arrays/array_edit_access.php | 4 +- .../table_arrays/array_edit_groups.php | 4 +- .../table_arrays/array_edit_languages.php | 6 +- .../table_arrays/array_edit_menu_group.php | 4 +- .../table_arrays/array_edit_pages.php | 28 +- .../table_arrays/array_edit_schemes.php | 4 +- .../table_arrays/array_edit_users.php | 10 +- .../table_arrays/array_edit_visible_group.php | 4 +- www/lib/CoreLibs/ACL/Login.php | 387 +++++--- www/lib/CoreLibs/Admin/Backend.php | 136 ++- www/lib/CoreLibs/Basic.php | 260 +++--- www/lib/CoreLibs/Check/Email.php | 59 +- www/lib/CoreLibs/Check/File.php | 7 +- www/lib/CoreLibs/Check/Jason.php | 4 +- www/lib/CoreLibs/Check/Password.php | 4 +- www/lib/CoreLibs/Check/PhpVersion.php | 4 +- www/lib/CoreLibs/Combined/ArrayHandler.php | 27 +- www/lib/CoreLibs/Combined/DateTime.php | 29 +- www/lib/CoreLibs/Convert/Byte.php | 27 +- www/lib/CoreLibs/Convert/Colors.php | 4 +- www/lib/CoreLibs/Convert/Html.php | 6 +- www/lib/CoreLibs/Convert/Math.php | 4 +- www/lib/CoreLibs/Convert/MimeAppName.php | 4 +- www/lib/CoreLibs/Create/Hash.php | 4 +- www/lib/CoreLibs/Create/RandomKey.php | 9 +- www/lib/CoreLibs/Create/Uids.php | 4 +- www/lib/CoreLibs/DB/Extended/ArrayIO.php | 126 +-- www/lib/CoreLibs/DB/IO.php | 391 +++++--- www/lib/CoreLibs/DB/SQL/PgSQL.php | 56 +- www/lib/CoreLibs/Debug/FileWriter.php | 11 +- www/lib/CoreLibs/Debug/Logging.php | 120 +-- www/lib/CoreLibs/Debug/RunningTime.php | 8 +- www/lib/CoreLibs/Debug/Support.php | 6 +- www/lib/CoreLibs/Get/System.php | 4 +- .../Language/Core/CachedFileReader.php | 8 +- www/lib/CoreLibs/Language/Core/FileReader.php | 4 +- .../CoreLibs/Language/Core/GetTextReader.php | 21 +- .../CoreLibs/Language/Core/StreamReader.php | 4 +- .../CoreLibs/Language/Core/StringReader.php | 4 +- www/lib/CoreLibs/Language/Encoding.php | 23 +- www/lib/CoreLibs/Language/L10n.php | 17 +- www/lib/CoreLibs/Output/Form/Elements.php | 99 +- www/lib/CoreLibs/Output/Form/Generate.php | 874 ++++++++++++------ www/lib/CoreLibs/Output/Form/Token.php | 4 +- www/lib/CoreLibs/Output/Image.php | 120 ++- www/lib/CoreLibs/Output/Progressbar.php | 272 ++++-- www/lib/CoreLibs/Template/SmartyExtend.php | 125 +-- www/lib/Error.Handling.php | 42 +- www/lib/autoloader.php | 13 +- 96 files changed, 2855 insertions(+), 1677 deletions(-) diff --git a/.phan/config.php b/.phan/config.php index 900f9ef8..848e87e9 100644 --- a/.phan/config.php +++ b/.phan/config.php @@ -1,7 +1,5 @@ "; print '
Class Test Master
'; // set acl, from eg login acl -print "SETACL[]: ".$backend->setACL([])."
"; -print "ADBEDITLOG: ".$backend->adbEditLog('CLASSTEST-ADMIN', 'Some info stirng')."
"; -print "ADBTOPMENU(0): ".\CoreLibs\Debug\Support::printAr($backend->adbTopMenu())."
"; -print "ADBMSG: ".$backend->adbMsg('info', 'Message: %1$d', [1])."
"; -print "Messaes: ".\CoreLibs\Debug\Support::printAr($this->messages)."
"; -print "ADBPRINTDATETIME:
".$backend->adbPrintDateTime(2021, 6, 21, 6, 38, '_test')."
"; +print "SETACL[]: " . $backend->setACL([]) . "
"; +print "ADBEDITLOG: " . $backend->adbEditLog('CLASSTEST-ADMIN', 'Some info stirng') . "
"; +print "ADBTOPMENU(0): " . \CoreLibs\Debug\Support::printAr($backend->adbTopMenu()) . "
"; +print "ADBMSG: " . $backend->adbMsg('info', 'Message: %1$d', [1]) . "
"; +print "Messaes: " . \CoreLibs\Debug\Support::printAr($this->messages) . "
"; +print "ADBPRINTDATETIME:
" . $backend->adbPrintDateTime(2021, 6, 21, 6, 38, '_test') . "
"; // error message print $basic->log->printErrorMsg(); diff --git a/www/admin/class_test.array.php b/www/admin/class_test.array.php index b9d986b6..e2088369 100644 --- a/www/admin/class_test.array.php +++ b/www/admin/class_test.array.php @@ -1,9 +1,11 @@ "; +echo "SOURCE ARRAY: " . DgS::printAr($test_array) . "
"; // frist return -echo "ARRAYSEARCHRECURSIVE(email, [array], type): ".DgS::printAr(ArrayHandler::arraySearchRecursive('email', $test_array, 'type'))."
"; -echo "ARRAYSEARCHRECURSIVE(email, [array]['input'], type): ".DgS::printAr(ArrayHandler::arraySearchRecursive('email', $test_array['input'], 'type'))."
"; +echo "ARRAYSEARCHRECURSIVE(email, [array], type): " + . DgS::printAr(ArrayHandler::arraySearchRecursive('email', $test_array, 'type')) . "
"; +echo "ARRAYSEARCHRECURSIVE(email, [array]['input'], type): " + . DgS::printAr(ArrayHandler::arraySearchRecursive('email', $test_array['input'], 'type')) . "
"; // all return -echo "ARRAYSEARCHRECURSIVEALL(email, [array], type): ".Dgs::printAr((array)ArrayHandler::arraySearchRecursiveAll('email', $test_array, 'type'))."
"; +echo "ARRAYSEARCHRECURSIVEALL(email, [array], type): " + . Dgs::printAr((array)ArrayHandler::arraySearchRecursiveAll('email', $test_array, 'type')) . "
"; // simple search -echo "ARRAYSEARCHSIMPLE([array], type, email): ".(string)ArrayHandler::arraySearchSimple($test_array, 'type', 'email')."
"; +echo "ARRAYSEARCHSIMPLE([array], type, email): " + . (string)ArrayHandler::arraySearchSimple($test_array, 'type', 'email') . "
"; $array_1 = [ 'foo' => 'bar' @@ -76,7 +82,7 @@ $array_3 = [ ] ]; // recusrice merge -print "ARRAYMERGERECURSIVE: ".DgS::printAr(ArrayHandler::arrayMergeRecursive($array_1, $array_2, $array_3))."
"; +print "ARRAYMERGERECURSIVE: " . DgS::printAr(ArrayHandler::arrayMergeRecursive($array_1, $array_2, $array_3)) . "
"; // array difference $array_left = [ 'same' => 'data', @@ -86,14 +92,14 @@ $array_right = [ 'same' => 'data', 'right' => 'has R' ]; -print "ARRAYDIFF: ".DgS::printAr(ArrayHandler::arrayDiff($array_left, $array_right))."
"; +print "ARRAYDIFF: " . DgS::printAr(ArrayHandler::arrayDiff($array_left, $array_right)) . "
"; // in array check -print "INARRAYANY([1,3], [array]): ".DgS::printAr(ArrayHandler::inArrayAny([1, 3], $array_2))."
"; +print "INARRAYANY([1,3], [array]): " . DgS::printAr(ArrayHandler::inArrayAny([1, 3], $array_2)) . "
"; // flatten array -print "FLATTENARRAY: ".DgS::printAr(ArrayHandler::flattenArray($test_array))."
"; -print "FLATTENARRAYKEY: ".DgS::printAr(ArrayHandler::flattenArrayKey($test_array))."
"; +print "FLATTENARRAY: " . DgS::printAr(ArrayHandler::flattenArray($test_array)) . "
"; +print "FLATTENARRAYKEY: " . DgS::printAr(ArrayHandler::flattenArrayKey($test_array)) . "
"; // flatten for key set -print "ARRAYFLATFORKEY: ".DgS::printAr(ArrayHandler::arrayFlatForKey($test_array, 'type'))."
"; +print "ARRAYFLATFORKEY: " . DgS::printAr(ArrayHandler::arrayFlatForKey($test_array, 'type')) . "
"; // DEPRECATED // print "ARRAYMERGERECURSIVE: ".DgS::printAr($basic->arrayMergeRecursive($array_1, $array_2, $array_3))."
"; @@ -111,18 +117,19 @@ function rec(string $pre, string $cur, array $node = []) if (!is_array($node)) { $node = []; } - print "
#### PRE: ".$pre.", CUR: ".$cur.", N-c: ".count($node)." [".join('|', array_keys($node))."]
"; + print "
#### PRE: " . $pre . ", CUR: " . $cur . ", N-c: " + . count($node) . " [" . join('|', array_keys($node)) . "]
"; if (!$pre) { print "** NEW
"; $node[$cur] = []; } else { if (array_key_exists($pre, $node)) { - print "+ KEY FOUND: ".$pre.", add: ".$cur."
"; + print "+ KEY FOUND: " . $pre . ", add: " . $cur . "
"; $node[$pre][$cur] = []; } else { print "- NOT FOUND: loop
"; foreach ($node as $_pre => $_cur) { - print "> TRY: ".$_pre." => ".count($_cur)." [".join('|', array_keys($_cur))."]
"; + print "> TRY: " . $_pre . " => " . count($_cur) . " [" . join('|', array_keys($_cur)) . "]
"; if (count($_cur) > 0) { $node[$_pre] = rec($pre, $cur, $_cur); } @@ -185,8 +192,8 @@ $test = rec('C', 'U', $test); $test = rec('F', 'U', $test); $test = rec('', 'Al', $test); $test = rec('B', 'B1', $test); -print "ORIGINAL: ".\CoreLibs\Debug\Support::printAr($test)."
"; -print "FLATTEN: ".\CoreLibs\Debug\Support::printAr(flattenArrayKey($test))."
"; +print "ORIGINAL: " . \CoreLibs\Debug\Support::printAr($test) . "
"; +print "FLATTEN: " . \CoreLibs\Debug\Support::printAr(flattenArrayKey($test)) . "
"; // error message print $basic->log->printErrorMsg(); diff --git a/www/admin/class_test.byte.php b/www/admin/class_test.byte.php index b0f1a320..7cbacf84 100644 --- a/www/admin/class_test.byte.php +++ b/www/admin/class_test.byte.php @@ -1,8 +1,11 @@ -Class Test Master'; $byte = 254779258; $string = '242.98 MB'; // static -print "S::BYTE TO: $byte: ".$byte_class::humanReadableByteFormat($byte)."
"; -print "S::BYTE FROM: $string: ".$byte_class::stringByteFormat($string)."
"; +print "S::BYTE TO: $byte: " . $byte_class::humanReadableByteFormat($byte) . "
"; +print "S::BYTE FROM: $string: " . $byte_class::stringByteFormat($string) . "
"; // *** BYTES TEST *** $bytes = array( @@ -59,9 +62,9 @@ foreach ($bytes as $byte) { print '
'; // print '
'; - print "(".number_format($byte)."/".$byte.") bytes :"; + print "(" . number_format($byte) . "/" . $byte . ") bytes :"; $_bytes = Byte::humanReadableByteFormat($byte); - print '
'.$_bytes; + print '
' . $_bytes; print '
'; print Byte::stringByteFormat($_bytes); print "
"; @@ -73,7 +76,7 @@ foreach ($bytes as $byte) { print '
'; print "bytes [si]:"; $_bytes = Byte::humanReadableByteFormat($byte, Byte::BYTE_FORMAT_SI); - print '
'.$_bytes; + print '
' . $_bytes; print '
'; print Byte::stringByteFormat($_bytes); print "
"; diff --git a/www/admin/class_test.colors.php b/www/admin/class_test.colors.php index f28768a2..54d35d19 100644 --- a/www/admin/class_test.colors.php +++ b/www/admin/class_test.colors.php @@ -1,9 +1,11 @@ Class Test Master
'; // define a list of from to color sets for conversion test // A(out of bounds) -print "C::S/COLOR invalid rgb->hex (gray 125): -1, -1, -1: ".CoreLibs\Convert\Colors::rgb2hex(-1, -1, -1)."
"; -print "\$C::S/COLOR invalid rgb->hex (gary 125): -1, -1, -1: ".$color_class::rgb2hex(-1, -1, -1)."
"; +print "C::S/COLOR invalid rgb->hex (gray 125): -1, -1, -1: " . CoreLibs\Convert\Colors::rgb2hex(-1, -1, -1) . "
"; +print "\$C::S/COLOR invalid rgb->hex (gary 125): -1, -1, -1: " . $color_class::rgb2hex(-1, -1, -1) . "
"; // B(valid) $rgb = [10, 20, 30]; $hex = '#0a141e'; $hsb = [210, 67, 12]; $hsl = [210, 50, 7.8]; -print "S::COLOR rgb->hex: $rgb[0], $rgb[1], $rgb[2]: ".Colors::rgb2hex($rgb[0], $rgb[1], $rgb[2])."
"; -print "S::COLOR hex->rgb: $hex: ".DgS::printAr(Colors::hex2rgb($hex))."
"; -print "C::S/COLOR rgb->hext: $hex: ".DgS::printAr(CoreLibs\Convert\Colors::hex2rgb($hex))."
"; +print "S::COLOR rgb->hex: $rgb[0], $rgb[1], $rgb[2]: " . Colors::rgb2hex($rgb[0], $rgb[1], $rgb[2]) . "
"; +print "S::COLOR hex->rgb: $hex: " . DgS::printAr(Colors::hex2rgb($hex)) . "
"; +print "C::S/COLOR rgb->hext: $hex: " . DgS::printAr(CoreLibs\Convert\Colors::hex2rgb($hex)) . "
"; // C(to hsb/hsl) -print "S::COLOR rgb->hsb: $rgb[0], $rgb[1], $rgb[2]: ".DgS::printAr(Colors::rgb2hsb($rgb[0], $rgb[1], $rgb[2]))."
"; -print "S::COLOR rgb->hsl: $rgb[0], $rgb[1], $rgb[2]: ".DgS::printAr(Colors::rgb2hsl($rgb[0], $rgb[1], $rgb[2]))."
"; +print "S::COLOR rgb->hsb: $rgb[0], $rgb[1], $rgb[2]: " + . DgS::printAr(Colors::rgb2hsb($rgb[0], $rgb[1], $rgb[2])) . "
"; +print "S::COLOR rgb->hsl: $rgb[0], $rgb[1], $rgb[2]: " + . DgS::printAr(Colors::rgb2hsl($rgb[0], $rgb[1], $rgb[2])) . "
"; // D(from hsb/hsl) Note that param 2 + 3 is always 0-100 divided -print "S::COLOR hsb->rgb: $hsb[0], $hsb[1], $hsb[2]: ".DgS::printAr(Colors::hsb2rgb($hsb[0], $hsb[1], $hsb[2]))."
"; -print "S::COLOR hsl->rgb: $hsl[0], $hsl[1], $hsl[2]: ".DgS::printAr(Colors::hsl2rgb($hsl[0], $hsl[1], $hsl[2]))."
"; +print "S::COLOR hsb->rgb: $hsb[0], $hsb[1], $hsb[2]: " + . DgS::printAr(Colors::hsb2rgb($hsb[0], $hsb[1], $hsb[2])) . "
"; +print "S::COLOR hsl->rgb: $hsl[0], $hsl[1], $hsl[2]: " + . DgS::printAr(Colors::hsl2rgb($hsl[0], $hsl[1], $hsl[2])) . "
"; // TODO: run compare check input must match output diff --git a/www/admin/class_test.datetime.php b/www/admin/class_test.datetime.php index ce3e485d..f9244282 100644 --- a/www/admin/class_test.datetime.php +++ b/www/admin/class_test.datetime.php @@ -1,8 +1,11 @@ -Class Test Master'; // class $timestamp = 1622788315.123456; // static -print "S::DATESTRINGFORMAT(sm:0): $timestamp: ".$datetime_class::dateStringFormat($timestamp)."
"; +print "S::DATESTRINGFORMAT(sm:0): $timestamp: " . $datetime_class::dateStringFormat($timestamp) . "
"; // time string thest $timestamp = 5887998.33445; $time_string = DateTime::timeStringFormat($timestamp); -print "PLANE TIME STRING: ".$timestamp."
"; -print "TIME STRING TEST: ".$time_string."
"; -print "REVERSE TIME STRING: ".DateTime::stringToTime($time_string)."
"; +print "PLANE TIME STRING: " . $timestamp . "
"; +print "TIME STRING TEST: " . $time_string . "
"; +print "REVERSE TIME STRING: " . DateTime::stringToTime($time_string) . "
"; if (round($timestamp, 4) == DateTime::stringToTime($time_string)) { print "REVERSE TIME STRING MATCH
"; } else { print "REVERSE TRIME STRING DO NOT MATCH
"; } -print "ZERO TIME STRING: ".DateTime::timeStringFormat(0, true)."
"; -print "ZERO TIME STRING: ".DateTime::timeStringFormat(0.0, true)."
"; -print "ZERO TIME STRING: ".DateTime::timeStringFormat(1.005, true)."
"; +print "ZERO TIME STRING: " . DateTime::timeStringFormat(0, true) . "
"; +print "ZERO TIME STRING: " . DateTime::timeStringFormat(0.0, true) . "
"; +print "ZERO TIME STRING: " . DateTime::timeStringFormat(1.005, true) . "
"; $timestamps = [ 1622788315.123456, -1622788315.456789 ]; foreach ($timestamps as $timestamp) { - print "DATESTRINGFORMAT(sm:0): $timestamp: ".DateTime::dateStringFormat($timestamp)."
"; - print "DATESTRINGFORMAT(sm:1): $timestamp: ".DateTime::dateStringFormat($timestamp, true)."
"; + print "DATESTRINGFORMAT(sm:0): $timestamp: " . DateTime::dateStringFormat($timestamp) . "
"; + print "DATESTRINGFORMAT(sm:1): $timestamp: " . DateTime::dateStringFormat($timestamp, true) . "
"; } $intervals = [ 788315.123456, -123.456 ]; foreach ($intervals as $interval) { - print "TIMESTRINGFORMAT(sm:0): $interval: ".DateTime::timeStringFormat($interval, false)."
"; + print "TIMESTRINGFORMAT(sm:0): $interval: " . DateTime::timeStringFormat($interval, false) . "
"; $reverse_interval = DateTime::timeStringFormat($interval); - print "TIMESTRINGFORMAT(sm:1): $interval: ".$reverse_interval."
"; - print "STRINGTOTIME: $reverse_interval: ".DateTime::stringToTime($reverse_interval)."
"; + print "TIMESTRINGFORMAT(sm:1): $interval: " . $reverse_interval . "
"; + print "STRINGTOTIME: $reverse_interval: " . DateTime::stringToTime($reverse_interval) . "
"; } $check_dates = [ '2021-05-01', '2021-05-40' ]; foreach ($check_dates as $check_date) { - print "CHECKDATE: $check_date: ".(string)DateTime::checkDate($check_date)."
"; + print "CHECKDATE: $check_date: " . (string)DateTime::checkDate($check_date) . "
"; } $check_datetimes = [ '2021-05-01', @@ -89,7 +92,7 @@ $check_datetimes = [ '2021-05-01 25:13:14', ]; foreach ($check_datetimes as $check_datetime) { - print "CHECKDATETIME: $check_datetime: ".(string)DateTime::checkDateTime($check_datetime)."
"; + print "CHECKDATETIME: $check_datetime: " . (string)DateTime::checkDateTime($check_datetime) . "
"; } $compare_dates = [ [ '2021-05-01', '2021-05-02', ], @@ -99,7 +102,8 @@ $compare_dates = [ ]; // compareDate foreach ($compare_dates as $compare_date) { - print "COMPAREDATE: $compare_date[0] = $compare_date[1]: ".(string)DateTime::compareDate($compare_date[0], $compare_date[1])."
"; + print "COMPAREDATE: $compare_date[0] = $compare_date[1]: " + . (string)DateTime::compareDate($compare_date[0], $compare_date[1]) . "
"; } $compare_datetimes = [ [ '2021-05-01', '2021-05-02', ], @@ -110,7 +114,8 @@ $compare_datetimes = [ [ '2021-05-01 10:00:00', '2021-05-01 10:00:00', ], ]; foreach ($compare_datetimes as $compare_datetime) { - print "COMPAREDATE: $compare_datetime[0] = $compare_datetime[1]: ".(string)DateTime::compareDateTime($compare_datetime[0], $compare_datetime[1])."
"; + print "COMPAREDATE: $compare_datetime[0] = $compare_datetime[1]: " + . (string)DateTime::compareDateTime($compare_datetime[0], $compare_datetime[1]) . "
"; } $compare_dates = [ [ '2021-05-01', '2021-05-10', ], @@ -119,8 +124,10 @@ $compare_dates = [ [ '2021-05-02', '2021-05-02', ], ]; foreach ($compare_dates as $compare_date) { - print "CALCDAYSINTERVAL: $compare_date[0] = $compare_date[1]: ".DgS::printAr(DateTime::calcDaysInterval($compare_date[0], $compare_date[1]))."
"; - print "CALCDAYSINTERVAL(named): $compare_date[0] = $compare_date[1]: ".DgS::printAr(DateTime::calcDaysInterval($compare_date[0], $compare_date[1], true))."
"; + print "CALCDAYSINTERVAL: $compare_date[0] = $compare_date[1]: " + . DgS::printAr(DateTime::calcDaysInterval($compare_date[0], $compare_date[1])) . "
"; + print "CALCDAYSINTERVAL(named): $compare_date[0] = $compare_date[1]: " + . DgS::printAr(DateTime::calcDaysInterval($compare_date[0], $compare_date[1], true)) . "
"; } // DEPRECATED @@ -135,11 +142,14 @@ print "CHECKDATE: $check_date: ".(string)$basic->checkDate($check_date)."
"; $check_datetime = '2021-05-01 12:13:14'; print "CHECKDATETIME: $check_datetime: ".(string)$basic->checkDateTime($check_datetime)."
"; $compare_date = ['2021-05-01', '2021-05-02']; -print "COMPAREDATE: $compare_date[0] = $compare_date[1]: ".(string)$basic->compareDate($compare_date[0], $compare_date[1])."
"; +print "COMPAREDATE: $compare_date[0] = $compare_date[1]: " + . (string)$basic->compareDate($compare_date[0], $compare_date[1])."
"; $compare_datetime = ['2021-05-01 10:00:00', '2021-05-01 11:00:00']; -print "COMPAREDATE: $compare_datetime[0] = $compare_datetime[1]: ".(string)$basic->compareDateTime($compare_datetime[0], $compare_datetime[1])."
"; +print "COMPAREDATE: $compare_datetime[0] = $compare_datetime[1]: " + . (string)$basic->compareDateTime($compare_datetime[0], $compare_datetime[1])."
"; $compare_date = ['2021-05-01', '2021-05-10']; -print "CALCDAYSINTERVAL(named): $compare_date[0] = $compare_date[1]: ".DgS::printAr($basic->calcDaysInterval($compare_date[0], $compare_date[1], true))."
"; */ +print "CALCDAYSINTERVAL(named): $compare_date[0] = $compare_date[1]: " + . DgS::printAr($basic->calcDaysInterval($compare_date[0], $compare_date[1], true))."
"; */ // error message print $basic->log->printErrorMsg(); diff --git a/www/admin/class_test.db.php b/www/admin/class_test.db.php index a496ac9a..994a3886 100644 --- a/www/admin/class_test.db.php +++ b/www/admin/class_test.db.php @@ -1,9 +1,11 @@ TEST CLASS: DB"; print ""; print '
Class Test Master
'; -print "DBINFO: ".$db->dbInfo()."
"; -echo "DB_CONFIG_SET constant:
".print_r(DB_CONFIG, true)."

"; +print "DBINFO: " . $db->dbInfo() . "
"; +echo "DB_CONFIG_SET constant:
" . print_r(DB_CONFIG, true) . "

"; // DB client encoding -print "DB Client encoding: ".$db->dbGetEncoding()."
"; +print "DB Client encoding: " . $db->dbGetEncoding() . "
"; while ($res = $db->dbReturn("SELECT * FROM max_test", 0, true)) { - print "TIME: ".$res['time']."
"; + print "TIME: " . $res['time'] . "
"; } -print "CACHED DATA:
".print_r($db->cursor_ext, true)."

"; +print "CACHED DATA:
" . print_r($db->cursor_ext, true) . "

"; while ($res = $db->dbReturn("SELECT * FROM max_test")) { - print "[CACHED] TIME: ".$res['time']."
"; + print "[CACHED] TIME: " . $res['time'] . "
"; } print "
";
-$status = $db->dbExec("INSERT INTO foo (test) VALUES ('FOO TEST ".time()."') RETURNING test");
+$status = $db->dbExec("INSERT INTO foo (test) VALUES ('FOO TEST " . time() . "') RETURNING test");
 print "DIRECT INSERT STATUS: $status | "
-	."PRIMARY KEY: ".$db->dbGetInsertPK()." | "
-	."RETURNING EXT: ".print_r($db->dbGetReturningExt(), true)." | "
-	."RETURNING ARRAY: ".print_r($db->dbGetReturningArray(), true)."
"; + . "PRIMARY KEY: " . $db->dbGetInsertPK() . " | " + . "RETURNING EXT: " . print_r($db->dbGetReturningExt(), true) . " | " + . "RETURNING ARRAY: " . print_r($db->dbGetReturningArray(), true) . "
"; // should throw deprecated error // $db->getReturningExt(); -print "DIRECT INSERT PREVIOUS INSERTED: ".print_r($db->dbReturnRow("SELECT foo_id, test FROM foo WHERE foo_id = ".$db->dbGetInsertPK()), true)."
"; +print "DIRECT INSERT PREVIOUS INSERTED: " + . print_r($db->dbReturnRow("SELECT foo_id, test FROM foo WHERE foo_id = " . $db->dbGetInsertPK()), true) . "
"; $db->dbPrepare("ins_foo", "INSERT INTO foo (test) VALUES ($1)"); -$status = $db->dbExecute("ins_foo", array('BAR TEST '.time())); +$status = $db->dbExecute("ins_foo", array('BAR TEST ' . time())); print "PREPARE INSERT STATUS: $status | " - ."PRIMARY KEY: ".$db->dbGetInsertPK()." | " - ."RETURNING EXT: ".print_r($db->dbGetReturningExt(), true)." | " - ."RETURNING RETURN: ".print_r($db->dbGetReturningArray(), true)."
"; + . "PRIMARY KEY: " . $db->dbGetInsertPK() . " | " + . "RETURNING EXT: " . print_r($db->dbGetReturningExt(), true) . " | " + . "RETURNING RETURN: " . print_r($db->dbGetReturningArray(), true) . "
"; -print "PREPARE INSERT PREVIOUS INSERTED: ".print_r($db->dbReturnRow("SELECT foo_id, test FROM foo WHERE foo_id = ".$db->dbGetInsertPK()), true)."
"; +print "PREPARE INSERT PREVIOUS INSERTED: " + . print_r($db->dbReturnRow("SELECT foo_id, test FROM foo WHERE foo_id = " . $db->dbGetInsertPK()), true) . "
"; // returning test with multiple entries -// $status = $db->db_exec("INSERT INTO foo (test) values ('BAR 1 ".time()."'), ('BAR 2 ".time()."'), ('BAR 3 ".time()."') RETURNING foo_id"); -$status = $db->dbExec("INSERT INTO foo (test) values ('BAR 1 ".time()."'), ('BAR 2 ".time()."'), ('BAR 3 ".time()."') RETURNING foo_id, test"); +// $status = $db->db_exec( +// "INSERT INTO foo (test) VALUES " +// . "('BAR 1 " . time() . "'), " +// . "('BAR 2 " . time() . "'), " +// . "('BAR 3 " . time() . "') " +// . "RETURNING foo_id" +// ); +$status = $db->dbExec( + "INSERT INTO foo (test) VALUES " + . "('BAR 1 " . time() . "'), " + . "('BAR 2 " . time() . "'), " + . "('BAR 3 " . time() . "') " + . "RETURNING foo_id, test" +); print "DIRECT MULTIPLE INSERT STATUS: $status | " - ."PRIMARY KEYS: ".print_r($db->dbGetInsertPK(), true)." | " - ."RETURNING EXT: ".print_r($db->dbGetReturningExt(), true)." | " - ."RETURNING ARRAY: ".print_r($db->dbGetReturningArray(), true)."
"; + . "PRIMARY KEYS: " . print_r($db->dbGetInsertPK(), true) . " | " + . "RETURNING EXT: " . print_r($db->dbGetReturningExt(), true) . " | " + . "RETURNING ARRAY: " . print_r($db->dbGetReturningArray(), true) . "
"; // no returning, but not needed ; -$status = $db->dbExec("INSERT INTO foo (test) VALUES ('FOO; TEST ".time()."');"); +$status = $db->dbExec("INSERT INTO foo (test) VALUES ('FOO; TEST " . time() . "');"); print "DIRECT INSERT STATUS: $status | " - ."PRIMARY KEY: ".$db->dbGetInsertPK()." | " - ."RETURNING EXT: ".print_r($db->dbGetReturningExt(), true)." | " - ."RETURNING ARRAY: ".print_r($db->dbGetReturningArray(), true)."
"; + . "PRIMARY KEY: " . $db->dbGetInsertPK() . " | " + . "RETURNING EXT: " . print_r($db->dbGetReturningExt(), true) . " | " + . "RETURNING ARRAY: " . print_r($db->dbGetReturningArray(), true) . "
"; // UPDATE WITH RETURNING $status = $db->dbExec("UPDATE foo SET test = 'SOMETHING DIFFERENT' WHERE foo_id = 3688452 RETURNING test"); print "UPDATE STATUS: $status | " - ."RETURNING EXT: ".print_r($db->dbGetReturningExt(), true)." | " - ."RETURNING ARRAY: ".print_r($db->dbGetReturningArray(), true)."
"; + . "RETURNING EXT: " . print_r($db->dbGetReturningExt(), true) . " | " + . "RETURNING ARRAY: " . print_r($db->dbGetReturningArray(), true) . "
"; print "
"; // REEAD PREPARE -if ($db->dbPrepare('sel_foo', "SELECT foo_id, test, some_bool, string_a, number_a, number_a_numeric, some_time FROM foo ORDER BY foo_id DESC LIMIT 5") === false) { +if ( + $db->dbPrepare( + 'sel_foo', + "SELECT foo_id, test, some_bool, string_a, number_a, number_a_numeric, some_time " + . "FROM foo ORDER BY foo_id DESC LIMIT 5" + ) === false +) { print "Error in sel_foo prepare
"; } else { $max_rows = 6; @@ -109,37 +131,65 @@ if ($db->dbPrepare('sel_foo', "SELECT foo_id, test, some_bool, string_a, number_ $cursor = $db->dbExecute('sel_foo', []); $i = 1; while (($res = $db->dbFetchArray($cursor, true)) !== false) { - print "DB PREP EXEC FETCH ARR: ".$i.":
".print_r($res, true)."

"; - $i ++; + print "DB PREP EXEC FETCH ARR: " . $i . ":
" . print_r($res, true) . "

"; + $i++; } } # db write class test $table = 'foo'; -print "TABLE META DATA: ".DgS::printAr($db->dbShowTableMetaData($table))."
"; +print "TABLE META DATA: " . DgS::printAr($db->dbShowTableMetaData($table)) . "
"; $primary_key = ''; # unset $db_write_table = array('test', 'string_a', 'number_a', 'some_bool'); // $db_write_table = array('test'); $object_fields_not_touch = array(); $object_fields_not_update = array(); -$data = array('test' => 'BOOL TEST SOMETHING '.time(), 'string_a' => 'SOME TEXT', 'number_a' => 5); -$primary_key = $db->dbWriteDataExt($db_write_table, $primary_key, $table, $object_fields_not_touch, $object_fields_not_update, $data); +$data = array('test' => 'BOOL TEST SOMETHING ' . time(), 'string_a' => 'SOME TEXT', 'number_a' => 5); +$primary_key = $db->dbWriteDataExt( + $db_write_table, + $primary_key, + $table, + $object_fields_not_touch, + $object_fields_not_update, + $data +); print "Wrote to DB tabel $table and got primary key $primary_key
"; -$data = array('test' => 'BOOL TEST ON '.time(), 'string_a' => '', 'number_a' => 0, 'some_bool' => 1); -$primary_key = $db->dbWriteDataExt($db_write_table, $primary_key, $table, $object_fields_not_touch, $object_fields_not_update, $data); +$data = array('test' => 'BOOL TEST ON ' . time(), 'string_a' => '', 'number_a' => 0, 'some_bool' => 1); +$primary_key = $db->dbWriteDataExt( + $db_write_table, + $primary_key, + $table, + $object_fields_not_touch, + $object_fields_not_update, + $data +); print "Wrote to DB tabel $table and got primary key $primary_key
"; -$data = array('test' => 'BOOL TEST OFF '.time(), 'string_a' => null, 'number_a' => null, 'some_bool' => 0); -$primary_key = $db->dbWriteDataExt($db_write_table, $primary_key, $table, $object_fields_not_touch, $object_fields_not_update, $data); +$data = array('test' => 'BOOL TEST OFF ' . time(), 'string_a' => null, 'number_a' => null, 'some_bool' => 0); +$primary_key = $db->dbWriteDataExt( + $db_write_table, + $primary_key, + $table, + $object_fields_not_touch, + $object_fields_not_update, + $data +); print "Wrote to DB tabel $table and got primary key $primary_key
"; -$data = array('test' => 'BOOL TEST UNSET '.time()); -$primary_key = $db->dbWriteDataExt($db_write_table, $primary_key, $table, $object_fields_not_touch, $object_fields_not_update, $data); +$data = array('test' => 'BOOL TEST UNSET ' . time()); +$primary_key = $db->dbWriteDataExt( + $db_write_table, + $primary_key, + $table, + $object_fields_not_touch, + $object_fields_not_update, + $data +); print "Wrote to DB tabel $table and got primary key $primary_key
"; // return Array Test $query = "SELECT type, sdate, integer FROM foobar"; $data = $db->dbReturnArray($query, true); -print "Full foobar list:
".print_r($data, true)."

"; +print "Full foobar list:
" . print_r($data, true) . "

"; # async test queries /* $db->dbExecAsync("SELECT test FROM foo, (SELECT pg_sleep(10)) as sub WHERE foo_id IN (27, 50, 67, 44, 10)"); @@ -156,36 +206,37 @@ while (($ret = $db->dbCheckAsync()) === true) sleep(1); flush(); } -print "
END STATUS: ".$ret."
"; +print "
END STATUS: " . $ret . "
"; // while ($res = $db->dbFetchArray($ret)) while ($res = $db->dbFetchArray()) { - echo "RES: ".$res['test']."
"; + echo "RES: " . $res['test'] . "
"; } # test async insert -$db->dbExecAsync("INSERT INTO foo (Test) VALUES ('ASYNC TEST ".time()."')"); +$db->dbExecAsync("INSERT INTO foo (Test) VALUES ('ASYNC TEST " . time() . "')"); echo "WAITING FOR ASYNC INSERT: "; while (($ret = $db->dbCheckAsync()) === true) { - print "."; + print " . "; sleep(1); flush(); } -print "
END STATUS: ".$ret." | PK: ".$db->insert_id."
"; -print "ASYNC PREVIOUS INSERTED: ".print_r($db->dbReturnRow("SELECT foo_id, test FROM foo WHERE foo_id = ".$db->insert_id), true)."
"; */ +print "
END STATUS: " . $ret . " | PK: " . $db->insert_id . "
"; +print "ASYNC PREVIOUS INSERTED: " + . print_r($db->dbReturnRow("SELECT foo_id, test FROM foo WHERE foo_id = " . $db->insert_id), true) . "
"; */ $to_db_version = '9.1.9'; -print "VERSION DB: ".$db->dbVersion()."
"; -print "DB Version smaller $to_db_version: ".$db->dbCompareVersion('<'.$to_db_version)."
"; -print "DB Version smaller than $to_db_version: ".$db->dbCompareVersion('<='.$to_db_version)."
"; -print "DB Version equal $to_db_version: ".$db->dbCompareVersion('='.$to_db_version)."
"; -print "DB Version bigger than $to_db_version: ".$db->dbCompareVersion('>='.$to_db_version)."
"; -print "DB Version bigger $to_db_version: ".$db->dbCompareVersion('>'.$to_db_version)."
"; +print "VERSION DB: " . $db->dbVersion() . "
"; +print "DB Version smaller $to_db_version: " . $db->dbCompareVersion('<' . $to_db_version) . "
"; +print "DB Version smaller than $to_db_version: " . $db->dbCompareVersion('<=' . $to_db_version) . "
"; +print "DB Version equal $to_db_version: " . $db->dbCompareVersion('=' . $to_db_version) . "
"; +print "DB Version bigger than $to_db_version: " . $db->dbCompareVersion('>=' . $to_db_version) . "
"; +print "DB Version bigger $to_db_version: " . $db->dbCompareVersion('>' . $to_db_version) . "
"; /* $q = "SELECT FOO FRO BAR"; // $q = "Select * from foo"; $foo = $db->dbExecAsync($q); -print "[ERR] Query: ".$q."
"; +print "[ERR] Query: " . $q . "
"; print "[ERR] RESOURCE: $foo
"; while (($ret = $db->dbCheckAsync()) === true) { @@ -197,19 +248,23 @@ while (($ret = $db->dbCheckAsync()) === true) $q = "SHOW search_path"; $cursor = $db->dbExec($q); $data = $db->dbFetchArray($cursor)['search_path']; -print "RETURN DATA FOR search_path: ".$data."
"; -// print "RETURN DATA FOR search_path: ".DgS::printAr($data)."
"; +print "RETURN DATA FOR search_path: " . $data . "
"; +// print "RETURN DATA FOR search_path: " . DgS::printAr($data) . "
"; // insert something into test.schema_test and see if we get the PK back -$status = $db->dbExec("INSERT INTO test.schema_test (contents, id) VALUES ('TIME: ".time()."', ".rand(1, 10).")"); -print "OTHER SCHEMA INSERT STATUS: ".$status." | PK NAME: ".$db->pk_name.", PRIMARY KEY: ".$db->insert_id."
"; +$status = $db->dbExec( + "INSERT INTO test.schema_test (contents, id) VALUES " + . "('TIME: " . time() . "', " . rand(1, 10) . ")" +); +print "OTHER SCHEMA INSERT STATUS: " + . $status . " | PK NAME: " . $db->pk_name . ", PRIMARY KEY: " . $db->insert_id . "
"; print "NULL TEST DB READ
"; $q = "SELECT uid, null_varchar, null_int FROM test_null_data WHERE uid = 'A'"; $res = $db->dbReturnRow($q); var_dump($res); -print "RES: ".DgS::printAr($res)."
"; -print "ISSET: ".isset($res['null_varchar'])."
"; -print "EMPTY: ".empty($res['null_varchar'])."
"; +print "RES: " . DgS::printAr($res) . "
"; +print "ISSET: " . isset($res['null_varchar']) . "
"; +print "EMPTY: " . empty($res['null_varchar']) . "
"; // error message print $basic->log->printErrorMsg(); diff --git a/www/admin/class_test.debug.php b/www/admin/class_test.debug.php index 624cc86e..f427aa7f 100644 --- a/www/admin/class_test.debug.php +++ b/www/admin/class_test.debug.php @@ -1,9 +1,11 @@ "; -print "S::GETCALLERMETHOD: ".test()."
"; -print "S::PRINTAR: ".DebugSupport::printAr(['Foo', 'Bar'])."
"; -print "V-S::PRINTAR: ".$debug_support_class::printAr(['Foo', 'Bar'])."
"; -print "S::DEBUSTRING(s): ".DebugSupport::debugString('SET')."
"; -print "S::DEBUSTRING(''): ".DebugSupport::debugString('')."
"; -print "S::DEBUSTRING(,s): ".DebugSupport::debugString(null, '{-}')."
"; +print "S::GETCALLERMETHOD: " . DebugSupport::getCallerMethod(0) . "
"; +print "S::GETCALLERMETHOD: " . test() . "
"; +print "S::PRINTAR: " . DebugSupport::printAr(['Foo', 'Bar']) . "
"; +print "V-S::PRINTAR: " . $debug_support_class::printAr(['Foo', 'Bar']) . "
"; +print "S::DEBUSTRING(s): " . DebugSupport::debugString('SET') . "
"; +print "S::DEBUSTRING(''): " . DebugSupport::debugString('') . "
"; +print "S::DEBUSTRING(,s): " . DebugSupport::debugString(null, '{-}') . "
"; // debug -print "C->DEBUG: ".$debug->debug('CLASS-TEST-DEBUG', 'Class Test Debug')."
"; -print "C->DEBUG(html): ".$debug->debug('CLASS-TEST-DEBUG', 'HTML TAG
BOLD')."
"; -print "C->DEBUG(html,strip): ".$debug->debug('CLASS-TEST-DEBUG', 'HTML TAG
BOLD', true)."
"; -print "C->PRINTERRORMSG:
".$debug->printErrorMsg()."
"; +print "C->DEBUG: " . $debug->debug('CLASS-TEST-DEBUG', 'Class Test Debug') . "
"; +print "C->DEBUG(html): " . $debug->debug('CLASS-TEST-DEBUG', 'HTML TAG
BOLD') . "
"; +print "C->DEBUG(html,strip): " . $debug->debug('CLASS-TEST-DEBUG', 'HTML TAG
BOLD', true) . "
"; +print "C->PRINTERRORMSG:
" . $debug->printErrorMsg() . "
"; echo "CLASS DEBUG CALL
"; // @codingStandardsIgnoreLine @@ -73,8 +75,8 @@ class TestL } public function test(string $ts = null) { - print "* GETCALLERCLASS(INSIDE CLASS): ".\CoreLibs\Debug\Support::getCallerClass()."
"; - $this->log->debug('TESTL', 'Logging in class testL'.($ts !== null ? ': '.$ts : '')); + print "* GETCALLERCLASS(INSIDE CLASS): " . \CoreLibs\Debug\Support::getCallerClass() . "
"; + $this->log->debug('TESTL', 'Logging in class testL' . ($ts !== null ? ': ' . $ts : '')); $this->log->debug('TESTL', 'Some other message'); return true; } @@ -89,22 +91,23 @@ class TestR extends TestL } public function subTest() { - print "** GETCALLERCLASS(INSIDE EXTND CLASS): ".\CoreLibs\Debug\Support::getCallerClass()."
"; + print "** GETCALLERCLASS(INSIDE EXTND CLASS): " . \CoreLibs\Debug\Support::getCallerClass() . "
"; $this->log->debug('TESTR', 'Logging in class testR (extends testL)'); $this->test('TESTR INSIDE'); - $this->log->debug('TESTR', 'Array: '.$this->log->prAr(['a', 'b']).', Other: '.$this->log->prAr(['a', 'b'])); + $this->log->debug('TESTR', 'Array: ' + . $this->log->prAr(['a', 'b']) . ', Other: ' . $this->log->prAr(['a', 'b'])); return true; } } $tl = new TestL(); -print "CLASS: LOG ECHO: ".(string)$tl->log->getLogLevelAll('echo')."
"; -print "CLASS: DEBUG: ".$tl->test()."
"; -print "CLASS: PRINTERRORMSG:
".$tl->log->printErrorMsg()."
"; +print "CLASS: LOG ECHO: " . (string)$tl->log->getLogLevelAll('echo') . "
"; +print "CLASS: DEBUG: " . $tl->test() . "
"; +print "CLASS: PRINTERRORMSG:
" . $tl->log->printErrorMsg() . "
"; $tr = new TestR(); -print "CLASS: LOG ECHO: ".(string)$tr->log->getLogLevelAll('echo')."
"; -print "CLASS EXTEND: DEBUG/tl: ".$tr->test('TESTR OUTSIDE')."
"; -print "CLASS EXTEND: DEBUG/tr: ".$tr->subTest()."
"; -print "CLASS EXTEND: PRINTERRORMSG:
".$tr->log->printErrorMsg()."
"; +print "CLASS: LOG ECHO: " . (string)$tr->log->getLogLevelAll('echo') . "
"; +print "CLASS EXTEND: DEBUG/tl: " . $tr->test('TESTR OUTSIDE') . "
"; +print "CLASS EXTEND: DEBUG/tr: " . $tr->subTest() . "
"; +print "CLASS EXTEND: PRINTERRORMSG:
" . $tr->log->printErrorMsg() . "
"; // test attaching a logger from outside // @codingStandardsIgnoreLine @@ -122,7 +125,7 @@ class AttachOutside } } $ao = new AttachOutside($basic->log); -print "AO-CLASS: DEBUG: ".$ao->test()."
"; +print "AO-CLASS: DEBUG: " . $ao->test() . "
"; // @codingStandardsIgnoreLine class AttachFull @@ -141,20 +144,20 @@ class AttachFull $af = new AttachFull($basic); // should trigger deprecated -print "DEPREACTEDTEST: ".$af->test()."
"; +print "DEPREACTEDTEST: " . $af->test() . "
"; -print "GETCALLERCLASS(NON CLASS): ".\CoreLibs\Debug\Support::getCallerClass()."
"; +print "GETCALLERCLASS(NON CLASS): " . \CoreLibs\Debug\Support::getCallerClass() . "
"; // fdebug -print "S::FSETFILENAME: ".FileWriter::fsetFilename('class_test_debug_file.log')."
"; -print "S::FDEBUG: ".FileWriter::fdebug('CLASS TEST DEBUG FILE: '.date('Y-m-d H:i:s'))."
"; +print "S::FSETFILENAME: " . FileWriter::fsetFilename('class_test_debug_file.log') . "
"; +print "S::FDEBUG: " . FileWriter::fdebug('CLASS TEST DEBUG FILE: ' . date('Y-m-d H:i:s')) . "
"; // error message // future DEPRECATED // $basic->debug('BASIC CLASS', 'Debug test'); $basic->log->debug('BASIC CLASS', 'Debug test'); -print "BASIC PRINTERRORMSG:
".$basic->log->printErrorMsg(); +print "BASIC PRINTERRORMSG:
" . $basic->log->printErrorMsg(); print ""; diff --git a/www/admin/class_test.email.php b/www/admin/class_test.email.php index f40927aa..1443a014 100644 --- a/www/admin/class_test.email.php +++ b/www/admin/class_test.email.php @@ -1,8 +1,11 @@ -"; print '
Class Test Master
'; // regex get -print "S::GETEMAILREGEX(0): ".Email::getEmailRegex(0)."
"; -print "S::GETEMAILREGEX(2): ".Email::getEmailRegex(2)."
"; -print "S::GETEMAILREGEX(7): ".Email::getEmailRegex(7)."
"; -print "S::GETEMAILREGEX(8 invalid): ".Email::getEmailRegex(8)."
"; -print "S::GETEMAILREGEXCHECK: ".DgS::printAr(Email::getEmailRegexCheck())."
"; +print "S::GETEMAILREGEX(0): " . Email::getEmailRegex(0) . "
"; +print "S::GETEMAILREGEX(2): " . Email::getEmailRegex(2) . "
"; +print "S::GETEMAILREGEX(7): " . Email::getEmailRegex(7) . "
"; +print "S::GETEMAILREGEX(8 invalid): " . Email::getEmailRegex(8) . "
"; +print "S::GETEMAILREGEXCHECK: " . DgS::printAr(Email::getEmailRegexCheck()) . "
"; $email = [ 'foo@bar.org', 'foo@i.softbank.ne.jp' ]; foreach ($email as $s_email) { - print "S::EMAIL: $s_email: ".Email::getEmailType($s_email)."
"; - print "S::EMAIL SHORT: $s_email: ".Email::getEmailType($s_email, true)."
"; + print "S::EMAIL: $s_email: " . Email::getEmailType($s_email) . "
"; + print "S::EMAIL SHORT: $s_email: " . Email::getEmailType($s_email, true) . "
"; } // DEPRECATED /* foreach ($email as $s_email) { diff --git a/www/admin/class_test.encoding.php b/www/admin/class_test.encoding.php index 92a85468..561d2ac7 100644 --- a/www/admin/class_test.encoding.php +++ b/www/admin/class_test.encoding.php @@ -1,8 +1,11 @@ -"; + print "__MBMIMEENCODE: $mime_encode[0]: " . Encoding::__mbMimeEncode($mime_encode[0], $mime_encode[1]) . "
"; } $enc_strings = [ @@ -59,26 +62,29 @@ $enc_strings = [ $_encoding->setErrorChar('∴'); foreach ($enc_strings as $_string) { $string = $_encoding->checkConvertEncoding($_string, 'UTF-8', 'ISO-2022-JP-MS'); - print "ENC CHECK: $_string: ".($string === false ? '-OK-' : $string)."
"; - print "CONV ENCODING: $_string: ".$_encoding->convertEncoding($_string, 'ISO-2022-JP')."
"; - print "CONV ENCODING (s): $_string: ".$_encoding->convertEncoding($_string, 'ISO-2022-JP', 'UTF-8')."
"; - print "CONV ENCODING (s,a-false): $_string: ".$_encoding->convertEncoding($_string, 'ISO-2022-JP', 'UTF-8', false)."
"; + print "ENC CHECK: $_string: " . ($string === false ? '-OK-' : $string) . "
"; + print "CONV ENCODING: $_string: " . $_encoding->convertEncoding($_string, 'ISO-2022-JP') . "
"; + print "CONV ENCODING (s): $_string: " . $_encoding->convertEncoding($_string, 'ISO-2022-JP', 'UTF-8') . "
"; + print "CONV ENCODING (s,a-false): $_string: " + . $_encoding->convertEncoding($_string, 'ISO-2022-JP', 'UTF-8', false) . "
"; } -print "ERROR CHAR: ".$_encoding->getErrorChar()."
"; +print "ERROR CHAR: " . $_encoding->getErrorChar() . "
"; // static $encoding_class::setErrorChar('∴'); foreach ($enc_strings as $_string) { $string = $encoding_class::checkConvertEncoding($_string, 'UTF-8', 'ISO-2022-JP-MS'); - print "S::ENC CHECK: $_string: ".($string === false ? '-OK-' : $string)."
"; - print "S::CONV ENCODING: $_string: ".$encoding_class::convertEncoding($_string, 'ISO-2022-JP')."
"; - print "S::CONV ENCODING (s): $_string: ".$encoding_class::convertEncoding($_string, 'ISO-2022-JP', 'UTF-8')."
"; - print "S::CONV ENCODING (s,a-false): $_string: ".$encoding_class::convertEncoding($_string, 'ISO-2022-JP', 'UTF-8', false)."
"; + print "S::ENC CHECK: $_string: " . ($string === false ? '-OK-' : $string) . "
"; + print "S::CONV ENCODING: $_string: " . $encoding_class::convertEncoding($_string, 'ISO-2022-JP') . "
"; + print "S::CONV ENCODING (s): $_string: " + . $encoding_class::convertEncoding($_string, 'ISO-2022-JP', 'UTF-8') . "
"; + print "S::CONV ENCODING (s,a-false): $_string: " + . $encoding_class::convertEncoding($_string, 'ISO-2022-JP', 'UTF-8', false) . "
"; } -print "S::ERROR CHAR: ".$encoding_class::getErrorChar()."
"; +print "S::ERROR CHAR: " . $encoding_class::getErrorChar() . "
"; // static use $_string = $enc_strings[1]; $string = Encoding::checkConvertEncoding($_string, 'UTF-8', 'ISO-2022-JP-MS'); -print "S::ENC CHECK: $_string: ".($string === false ? '-OK-' : $string)."
"; +print "S::ENC CHECK: $_string: " . ($string === false ? '-OK-' : $string) . "
"; // DEPRECATED /* $string = $basic->checkConvertEncoding($_string, 'UTF-8', 'ISO-2022-JP-MS'); diff --git a/www/admin/class_test.file.php b/www/admin/class_test.file.php index 4f929652..07f44833 100644 --- a/www/admin/class_test.file.php +++ b/www/admin/class_test.file.php @@ -1,8 +1,11 @@ -"; print '
Class Test Master
'; $file = '/some/path/to/some/file.txt'; -print "GETFILENAMEENDING: $file: ".File::getFilenameEnding($file)."
"; -$file = getcwd().DIRECTORY_SEPARATOR.'class_test.file.php'; -print "GETLINESFROMFILE: $file: ".File::getLinesFromFile($file)."
"; +print "GETFILENAMEENDING: $file: " . File::getFilenameEnding($file) . "
"; +$file = getcwd() . DIRECTORY_SEPARATOR . 'class_test.file.php'; +print "GETLINESFROMFILE: $file: " . File::getLinesFromFile($file) . "
"; // error message print $basic->log->printErrorMsg(); diff --git a/www/admin/class_test.hash.php b/www/admin/class_test.hash.php index a84ed069..aec85b70 100644 --- a/www/admin/class_test.hash.php +++ b/www/admin/class_test.hash.php @@ -1,8 +1,11 @@ -Class Test Master'; $to_crc = 'Some text block'; // static -print "S::__CRC32B: $to_crc: ".$hash_class::__crc32b($to_crc)."
"; -print "S::__SHA1SHORT(off): $to_crc: ".$hash_class::__sha1short($to_crc)."
"; -print "S::__SHA1SHORT(on): $to_crc: ".$hash_class::__sha1short($to_crc, true)."
"; -print "S::__hash(d): $to_crc: ".$hash_class::__hash($to_crc)."
"; +print "S::__CRC32B: $to_crc: " . $hash_class::__crc32b($to_crc) . "
"; +print "S::__SHA1SHORT(off): $to_crc: " . $hash_class::__sha1short($to_crc) . "
"; +print "S::__SHA1SHORT(on): $to_crc: " . $hash_class::__sha1short($to_crc, true) . "
"; +print "S::__hash(d): $to_crc: " . $hash_class::__hash($to_crc) . "
"; foreach (['adler32', 'fnv132', 'fnv1a32', 'joaat'] as $__hash_c) { - print "S::__hash($__hash_c): $to_crc: ".$hash_class::__hash($to_crc, $__hash_c)."
"; + print "S::__hash($__hash_c): $to_crc: " . $hash_class::__hash($to_crc, $__hash_c) . "
"; } // static use -print "U-S::__CRC32B: $to_crc: ".Hash::__crc32b($to_crc)."
"; +print "U-S::__CRC32B: $to_crc: " . Hash::__crc32b($to_crc) . "
"; // DEPRECATED /* print "D/__CRC32B: $to_crc: ".$basic->__crc32b($to_crc)."
"; diff --git a/www/admin/class_test.html.php b/www/admin/class_test.html.php index b7190046..93be8ac5 100644 --- a/www/admin/class_test.html.php +++ b/www/admin/class_test.html.php @@ -1,9 +1,11 @@ "; print '
Class Test Master
'; $string = "Something < = > Other
Next line"; -print "HTMLENT: ".Html::htmlent($string).": ".$_html->htmlent($string)."
"; -print "REMOVELB: ".Html::htmlent($string).": ".$_html->removeLB($string)."
"; +print "HTMLENT: " . Html::htmlent($string) . ": " . $_html->htmlent($string) . "
"; +print "REMOVELB: " . Html::htmlent($string) . ": " . $_html->removeLB($string) . "
"; $date_str = [2021, 5, 1, 11, 10]; -print "PRINTDATETIME: ".$_elements->printDateTime($date_str[0], $date_str[1], $date_str[2], $date_str[3], $date_str[4])."
"; +print "PRINTDATETIME: " + . $_elements->printDateTime($date_str[0], $date_str[1], $date_str[2], $date_str[3], $date_str[4]) . "
"; // STATIC $string = "Something < = > Other
Next line"; -print "S::HTMLENT: ".Html::htmlent($string).": ".$html_class::htmlent($string)."
"; -print "S::REMOVELB: ".Html::htmlent($string).": ".$html_class::removeLB($string)."
"; +print "S::HTMLENT: " . Html::htmlent($string) . ": " . $html_class::htmlent($string) . "
"; +print "S::REMOVELB: " . Html::htmlent($string) . ": " . $html_class::removeLB($string) . "
"; $date_str = [2021, 5, 1, 11, 10]; -print "S::PRINTDATETIME: ".$elements_class::printDateTime($date_str[0], $date_str[1], $date_str[2], $date_str[3], $date_str[4])."
"; +print "S::PRINTDATETIME: " + . $elements_class::printDateTime($date_str[0], $date_str[1], $date_str[2], $date_str[3], $date_str[4]) . "
"; // STATIC use -echo "U-S::HTML ENT INT: ".Html::htmlent(5)."
"; -echo "U-S::HTML ENT STRING: ".Html::htmlent('5<<>')."
"; -echo "U-S::HTML ENT NULL: ".Html::htmlent(null)."
"; +echo "U-S::HTML ENT INT: " . Html::htmlent(5) . "
"; +echo "U-S::HTML ENT STRING: " . Html::htmlent('5<<>') . "
"; +echo "U-S::HTML ENT NULL: " . Html::htmlent(null) . "
"; // check convert $checked_list = [ @@ -67,8 +71,8 @@ $checked_list = [ ['foo', ['bar']], ]; foreach ($checked_list as $check) { - print "CHECKED(0): $check[0]: ".Html::checked($check[1], $check[0])."
"; - print "CHECKED(1): $check[0]: ".Html::checked($check[1], $check[0], 1)."
"; + print "CHECKED(0): $check[0]: " . Html::checked($check[1], $check[0]) . "
"; + print "CHECKED(1): $check[0]: " . Html::checked($check[1], $check[0], 1) . "
"; } // magic link creation test @@ -81,7 +85,7 @@ $magic_links = [ 'http://www.somelink.com/?with=1234
Some Title', ]; foreach ($magic_links as $magic_link) { - print "MAGICLINK: ".Html::htmlent($magic_link).": ".Html::htmlent(Elements::magicLinks($magic_link))."
"; + print "MAGICLINK: " . Html::htmlent($magic_link) . ": " . Html::htmlent(Elements::magicLinks($magic_link)) . "
"; } // DEPREACTED @@ -89,7 +93,8 @@ foreach ($magic_links as $magic_link) { print "D/HTMLENT: $string: ".$basic->htmlent($string)."
"; print "D/REMOVELB: $string: ".$basic->removeLB($string)."
"; $date_str = [2021, 5, 1, 11, 10]; -print "D/PRINTDATETIME: ".$basic->printDateTime($date_str[0], $date_str[1], $date_str[2], $date_str[3], $date_str[4])."
"; +print "D/PRINTDATETIME: " + . $basic->printDateTime($date_str[0], $date_str[1], $date_str[2], $date_str[3], $date_str[4])."
"; $magic_link = 'http://www.somelink.com/?with=1234|Some Title|'; print "D/MAGICLINK: ".Html::htmlent($basic->magicLinks($magic_link))."
"; */ @@ -100,8 +105,8 @@ line breaks in there. Theis is sucky'; -print "LB remove: ".\CoreLibs\Convert\Html::removeLB($text)."
"; -print "LB remove: ".\CoreLibs\Convert\Html::removeLB($text, '##BR##')."
"; +print "LB remove: " . \CoreLibs\Convert\Html::removeLB($text) . "
"; +print "LB remove: " . \CoreLibs\Convert\Html::removeLB($text, '##BR##') . "
"; // error message print $basic->log->printErrorMsg(); diff --git a/www/admin/class_test.image.php b/www/admin/class_test.image.php index 4c778c6b..61888392 100644 --- a/www/admin/class_test.image.php +++ b/www/admin/class_test.image.php @@ -1,8 +1,11 @@ -Class Test Master'; $thumb_width = 250; $thumb_height = 300; // class -$image = BASE.LAYOUT.CONTENT_PATH.IMAGES.'no_picture_square.jpg'; +$image = BASE . LAYOUT . CONTENT_PATH . IMAGES . 'no_picture_square.jpg'; // rotate image first $_image->correctImageOrientation($image); // thumbnail tests -echo "
CLASS->CREATETHUMBNAILSIMPLE: ".basename($image).": WIDTH: $thumb_width
"; +echo "
CLASS->CREATETHUMBNAILSIMPLE: " + . basename($image) . ": WIDTH: $thumb_width
"; // static -$image = BASE.LAYOUT.CONTENT_PATH.IMAGES.'no_picture.jpg'; +$image = BASE . LAYOUT . CONTENT_PATH . IMAGES . 'no_picture.jpg'; // rotate image first $image_class::correctImageOrientation($image); // thumbnail tests -echo "
S::CREATETHUMBNAILSIMPLE: ".basename($image).": WIDTH: $thumb_width
"; +echo "
S::CREATETHUMBNAILSIMPLE: " + . basename($image) . ": WIDTH: $thumb_width
"; echo "U-STATIC VARIOUS:
"; // image thumbnail @@ -76,17 +83,22 @@ $images = array( // return mime type ala mimetype $finfo = new finfo(FILEINFO_MIME_TYPE); foreach ($images as $image) { - $image = BASE.LAYOUT.CONTENT_PATH.IMAGES.$image; + $image = BASE . LAYOUT . CONTENT_PATH . IMAGES . $image; list ($height, $width, $img_type) = getimagesize($image); - echo "
IMAGE INFO: ".$height."x".$width.", TYPE: ".$img_type." [".$finfo->file($image)."]
"; + echo "
IMAGE INFO: " . $height . "x" . $width . ", TYPE: " + . $img_type . " [" . $finfo->file($image) . "]
"; // rotate image first Image::correctImageOrientation($image); // thumbnail tests - echo "
".basename($image).": WIDTH: $thumb_width
"; - echo "
".basename($image).": HEIGHT: $thumb_height
"; - echo "
".basename($image).": WIDTH/HEIGHT: $thumb_width x $thumb_height
"; + echo "
" . basename($image) . ": WIDTH: $thumb_width
"; + echo "
" . basename($image) . ": HEIGHT: $thumb_height
"; + echo "
" . basename($image) . ": WIDTH/HEIGHT: $thumb_width x $thumb_height
"; // test with dummy - echo "
".basename($image).": WIDTH/HEIGHT: $thumb_width x $thumb_height (+DUMMY)
"; + echo "
" . basename($image) . ": WIDTH/HEIGHT: $thumb_width x $thumb_height (+DUMMY)
"; echo "
"; } @@ -96,7 +108,8 @@ foreach ($images as $image) { // rotate image first $basic->correctImageOrientation($image); // thumbnail tests -echo "
S::CREATETHUMBNAILSIMPLE: ".basename($image).": WIDTH: $thumb_width
"; */ +echo "
S::CREATETHUMBNAILSIMPLE: ".basename($image).": WIDTH: $thumb_width
"; */ // error message print $basic->log->printErrorMsg(); diff --git a/www/admin/class_test.json.php b/www/admin/class_test.json.php index b7aa5078..628211b0 100644 --- a/www/admin/class_test.json.php +++ b/www/admin/class_test.json.php @@ -1,8 +1,11 @@ -Class Test Master'; $json = '{"foo": "bar"}'; $output = Jason::jsonConvertToArray($json); -print "S::JSON: $json: ".DgS::printAr($output)."
"; -print "S::JSON ERROR: ".Jason::jsonGetLastError().": ".Jason::jsonGetLastError(true)."
"; +print "S::JSON: $json: " . DgS::printAr($output) . "
"; +print "S::JSON ERROR: " . Jason::jsonGetLastError() . ": " . Jason::jsonGetLastError(true) . "
"; $json = '["f: {b"""ar}]'; $output = Jason::jsonConvertToArray($json); -print "S::E-JSON: $json: ".DgS::printAr($output)."
"; -print "S::E-JSON ERROR: ".Jason::jsonGetLastError().": ".Jason::jsonGetLastError(true)."
"; +print "S::E-JSON: $json: " . DgS::printAr($output) . "
"; +print "S::E-JSON ERROR: " . Jason::jsonGetLastError() . ": " . Jason::jsonGetLastError(true) . "
"; // direct $json = '{"direct": "static function call"}'; $output = $json_class::jsonConvertToArray($json); -print "J/S::JSON: $json: ".DgS::printAr($output)."
"; -print "J/S::JSON ERROR: ".$json_class::jsonGetLastError().": ".$json_class::jsonGetLastError(true)."
"; +print "J/S::JSON: $json: " . DgS::printAr($output) . "
"; +print "J/S::JSON ERROR: " . $json_class::jsonGetLastError() . ": " . $json_class::jsonGetLastError(true) . "
"; $json = '["f: {b"""ar}]'; $output = $json_class::jsonConvertToArray($json); -print "J/S::E-JSON: $json: ".DgS::printAr($output)."
"; -print "J/S::E-JSON ERROR: ".$json_class::jsonGetLastError().": ".$json_class::jsonGetLastError(true)."
"; +print "J/S::E-JSON: $json: " . DgS::printAr($output) . "
"; +print "J/S::E-JSON ERROR: " . $json_class::jsonGetLastError() . ": " . $json_class::jsonGetLastError(true) . "
"; // DEPRECATE TEST /* $json = '["f: {b"""ar}]'; diff --git a/www/admin/class_test.lang.php b/www/admin/class_test.lang.php index 71ead5c5..5e3d27d9 100644 --- a/www/admin/class_test.lang.php +++ b/www/admin/class_test.lang.php @@ -1,9 +1,11 @@ Class Test Master'; $string = 'INPUT TEST'; -echo "LANGUAGE SET: ".$l->__getLang()."
"; -echo "LANGUAGE FILE: ".$l->__getMoFile()."
"; -echo "INPUT TEST: ".$string." => ".$l->__($string)."
"; +echo "LANGUAGE SET: " . $l->__getLang() . "
"; +echo "LANGUAGE FILE: " . $l->__getMoFile() . "
"; +echo "INPUT TEST: " . $string . " => " . $l->__($string) . "
"; // switch to other language $lang = 'ja_utf8'; $l->l10nReloadMOfile($lang); -echo "LANGUAGE SET: ".$l->__getLang()."
"; -echo "LANGUAGE FILE: ".$l->__getMoFile()."
"; -echo "INPUT TEST: ".$string." => ".$l->__($string)."
"; +echo "LANGUAGE SET: " . $l->__getLang() . "
"; +echo "LANGUAGE FILE: " . $l->__getMoFile() . "
"; +echo "INPUT TEST: " . $string . " => " . $l->__($string) . "
"; // TODO: run compare check input must match output // error message diff --git a/www/admin/class_test.math.php b/www/admin/class_test.math.php index 1378228e..b73ce4bb 100644 --- a/www/admin/class_test.math.php +++ b/www/admin/class_test.math.php @@ -1,8 +1,11 @@ -TEST CLASS: MATH"; print ""; print '
Class Test Master
'; -print "FCEIL: ".$_math->fceil(5.1234567890, 5)."
"; -print "FLOORP: ".$_math->floorp(5123456, -3)."
"; -print "INITNUMERIC: ".$_math->initNumeric('123')."
"; +print "FCEIL: " . $_math->fceil(5.1234567890, 5) . "
"; +print "FLOORP: " . $_math->floorp(5123456, -3) . "
"; +print "INITNUMERIC: " . $_math->initNumeric('123') . "
"; -print "S-FCEIL: ".$math_class::fceil(5.1234567890, 5)."
"; -print "S-FLOORP: ".$math_class::floorp(5123456, -3)."
"; -print "S-INITNUMERIC: ".$math_class::initNumeric('123')."
"; +print "S-FCEIL: " . $math_class::fceil(5.1234567890, 5) . "
"; +print "S-FLOORP: " . $math_class::floorp(5123456, -3) . "
"; +print "S-INITNUMERIC: " . $math_class::initNumeric('123') . "
"; // DEPRECATED /* print "FCEIL: ".$basic->fceil(5.1234567890, 5)."
"; diff --git a/www/admin/class_test.mime.php b/www/admin/class_test.mime.php index ebca3092..e7726f12 100644 --- a/www/admin/class_test.mime.php +++ b/www/admin/class_test.mime.php @@ -1,8 +1,11 @@ -"; print '
Class Test Master
'; $mime = 'application/illustrator'; -print "MIME $mime: ".$_mime->mimeGetAppName($mime)."
"; +print "MIME $mime: " . $_mime->mimeGetAppName($mime) . "
"; $mime = 'fake/mime'; $_mime->mimeSetAppName($mime, 'This is a fake mime'); -print "MIME $mime: ".$_mime->mimeGetAppName($mime)."
"; +print "MIME $mime: " . $_mime->mimeGetAppName($mime) . "
"; // mime test $mime = 'application/vnd.ms-excel'; -print "App for mime $mime: ".$_mime->mimeGetAppName($mime)."
"; +print "App for mime $mime: " . $_mime->mimeGetAppName($mime) . "
"; $_mime->mimeSetAppName($mime, 'Microsoft (better) Excel'); -print "App for mime changed $mime: ".$_mime->mimeGetAppName($mime)."
"; +print "App for mime changed $mime: " . $_mime->mimeGetAppName($mime) . "
"; // static call test $mime = 'application/x-indesign'; -print "S::App for mime $mime: ".\CoreLibs\Convert\MimeAppName::mimeGetAppName($mime)."
"; +print "S::App for mime $mime: " . \CoreLibs\Convert\MimeAppName::mimeGetAppName($mime) . "
"; $mime = 'application/vnd.ms-excel'; -print "S::App for mime $mime: ".\CoreLibs\Convert\MimeAppName::mimeGetAppName($mime)."
"; +print "S::App for mime $mime: " . \CoreLibs\Convert\MimeAppName::mimeGetAppName($mime) . "
"; // DEPRECATED /* $mime = 'application/illustrator'; diff --git a/www/admin/class_test.output.form.php b/www/admin/class_test.output.form.php index 3646e90f..c7c8ef8a 100644 --- a/www/admin/class_test.output.form.php +++ b/www/admin/class_test.output.form.php @@ -1,9 +1,11 @@ TEST CLASS: FORM GENERATE"; print ""; print '
Class Test Master
'; -print "MOBILE PHONE: ".$form->mobile_phone."
"; -print "MY PAGE NAME: ".$form->my_page_name."
"; // sets table array to include +print "MOBILE PHONE: " . $form->mobile_phone . "
"; +// sets table array to include +print "MY PAGE NAME: " . $form->my_page_name . "
"; // error message print $basic->log->printErrorMsg(); diff --git a/www/admin/class_test.password.php b/www/admin/class_test.password.php index 5872bd67..787e5a78 100644 --- a/www/admin/class_test.password.php +++ b/www/admin/class_test.password.php @@ -1,8 +1,11 @@ -Class Test Master'; $password = 'something1234'; $enc_password = $_password->passwordSet($password); -print "PASSWORD: $password: ".$enc_password."
"; -print "PASSWORD VERIFY: ".(string)$_password->passwordVerify($password, $enc_password)."
"; -print "PASSWORD REHASH: ".(string)$_password->passwordRehashCheck($enc_password)."
"; +print "PASSWORD: $password: " . $enc_password . "
"; +print "PASSWORD VERIFY: " . (string)$_password->passwordVerify($password, $enc_password) . "
"; +print "PASSWORD REHASH: " . (string)$_password->passwordRehashCheck($enc_password) . "
"; // static verify $password = 'othername7890'; $enc_password = $password_class::passwordSet($password); -print "PASSWORD: $password: ".$enc_password."
"; -print "S-PASSWORD VERIFY: ".(string)$password_class::passwordVerify($password, $enc_password)."
"; -print "PASSWORD REHASH: ".(string)$password_class::passwordRehashCheck($enc_password)."
"; +print "PASSWORD: $password: " . $enc_password . "
"; +print "S-PASSWORD VERIFY: " . (string)$password_class::passwordVerify($password, $enc_password) . "
"; +print "PASSWORD REHASH: " . (string)$password_class::passwordRehashCheck($enc_password) . "
"; // direct static -print "S::PASSWORD VERFIY: ".(string)PwdChk::passwordVerify($password, $enc_password)."
"; +print "S::PASSWORD VERFIY: " . (string)PwdChk::passwordVerify($password, $enc_password) . "
"; // DEPRECATED /* $password = 'deprecated4567'; diff --git a/www/admin/class_test.php b/www/admin/class_test.php index 66e75369..97574db4 100644 --- a/www/admin/class_test.php +++ b/www/admin/class_test.php @@ -1,9 +1,11 @@ Class Test: SMARTY'; // set + check edit access id $edit_access_id = 3; if (is_object($login) && isset($login->acl['unit'])) { - print "ACL UNIT: ".print_r(array_keys($login->acl['unit']), true)."
"; - print "ACCESS CHECK: ".(string)$login->loginCheckEditAccess($edit_access_id)."
"; + print "ACL UNIT: " . print_r(array_keys($login->acl['unit']), true) . "
"; + print "ACCESS CHECK: " . (string)$login->loginCheckEditAccess($edit_access_id) . "
"; if ($login->loginCheckEditAccess($edit_access_id)) { $basic->edit_access_id = $edit_access_id; } else { @@ -79,7 +81,8 @@ if (is_object($login) && isset($login->acl['unit'])) { // $basic->log->debug('SESSION', \CoreLibs\Debug\Support::printAr($_SESSION)); print '
'; -print 'Logout'; +print 'Logout'; print ''; print '
'; @@ -87,38 +90,48 @@ print ''; 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)).'
'; + 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).'
'; + print strtoupper($type) . ' OUT ALL: ' . $basic->log->getLogLevelAll($type) . '
'; } $basic->log->debug('SOME MARK', 'Some error output'); // INTERNAL SET -print "EDIT ACCESS ID: ".$basic->edit_access_id."
"; +print "EDIT ACCESS ID: " . $basic->edit_access_id . "
"; if (is_object($login)) { // print "ACL:
".$basic->print_ar($login->acl)."
"; - $basic->log->debug('ACL', "ACL: ".\CoreLibs\Debug\Support::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; })); + // $result = array_flip( + // array_filter( + // array_flip($login->default_acl_list), + // function ($key) { + // if (is_numeric($key)) { + // return $key; + // } + // } + // ) + // ); // print "DEFAULT ACL:
".$basic->print_ar($result)."
"; // DEPRICATED CALL // $basic->adbSetACL($login->acl); } -print "THIS HOST: ".HOST_NAME.", with PROTOCOL: ".HOST_PROTOCOL." is running SSL: ".HOST_SSL."
"; -print "DIR: ".DIR."
"; -print "BASE: ".BASE."
"; -print "ROOT: ".ROOT."
"; -print "HOST: ".HOST_NAME." => DB HOST: ".DB_CONFIG_NAME." => ".print_r(DB_CONFIG, true)."
"; +print "THIS HOST: " . HOST_NAME . ", with PROTOCOL: " . HOST_PROTOCOL . " is running SSL: " . HOST_SSL . "
"; +print "DIR: " . DIR . "
"; +print "BASE: " . BASE . "
"; +print "ROOT: " . ROOT . "
"; +print "HOST: " . HOST_NAME . " => DB HOST: " . DB_CONFIG_NAME . " => " . print_r(DB_CONFIG, true) . "
"; $ds = defined('DS') ? DS : DIRECTORY_SEPARATOR; $du = DS ?? DIRECTORY_SEPARATOR; -print "DS is: ".$ds."
"; -print "SERVER HOST: ".$_SERVER['HTTP_HOST']."
"; +print "DS is: " . $ds . "
"; +print "SERVER HOST: " . $_SERVER['HTTP_HOST'] . "
"; // print error messages // print $login->log->printErrorMsg(); diff --git a/www/admin/class_test.phpv.php b/www/admin/class_test.phpv.php index 190eb639..280432da 100644 --- a/www/admin/class_test.phpv.php +++ b/www/admin/class_test.phpv.php @@ -1,8 +1,11 @@ -checkPHPVersion($min_version)."
"; -print "MIN/MAX: $min_version/$max_version: ".(string)$_phpv->checkPHPVersion($min_version, $max_version)."
"; -print "MIN/S: $min_version_s: ".(string)$_phpv->checkPHPVersion($min_version_s)."
"; -print "MIN/SS: $min_version_ss: ".(string)$_phpv->checkPHPVersion($min_version_ss)."
"; +print "MIN: $min_version: " . (string)$_phpv->checkPHPVersion($min_version) . "
"; +print "MIN/MAX: $min_version/$max_version: " . (string)$_phpv->checkPHPVersion($min_version, $max_version) . "
"; +print "MIN/S: $min_version_s: " . (string)$_phpv->checkPHPVersion($min_version_s) . "
"; +print "MIN/SS: $min_version_ss: " . (string)$_phpv->checkPHPVersion($min_version_ss) . "
"; // static -print "S::MIN: $min_version: ".(string)$phpv_class::checkPHPVersion($min_version)."
"; -print "S::MIN/MAX: $min_version/$max_version: ".(string)$phpv_class::checkPHPVersion($min_version, $max_version)."
"; -print "S::MIN/S: $min_version_s: ".(string)$phpv_class::checkPHPVersion($min_version_s)."
"; -print "S::MIN/SS: $min_version_ss: ".(string)$phpv_class::checkPHPVersion($min_version_ss)."
"; +print "S::MIN: $min_version: " . (string)$phpv_class::checkPHPVersion($min_version) . "
"; +print "S::MIN/MAX: $min_version/$max_version: " + . (string)$phpv_class::checkPHPVersion($min_version, $max_version) . "
"; +print "S::MIN/S: $min_version_s: " . (string)$phpv_class::checkPHPVersion($min_version_s) . "
"; +print "S::MIN/SS: $min_version_ss: " . (string)$phpv_class::checkPHPVersion($min_version_ss) . "
"; // use stats -print "U-S::MIN: $min_version: ".(string)PhpVersion::checkPHPVersion($min_version)."
"; +print "U-S::MIN: $min_version: " . (string)PhpVersion::checkPHPVersion($min_version) . "
"; // DEPRECATED // print "MIN: $min_version: ".(string)$basic->checkPHPVersion($min_version)."
"; diff --git a/www/admin/class_test.randomkey.php b/www/admin/class_test.randomkey.php index 94330536..ef555541 100644 --- a/www/admin/class_test.randomkey.php +++ b/www/admin/class_test.randomkey.php @@ -1,8 +1,11 @@ -Class Test Master'; $key_length = 10; $key_length_b = 5; -print "S::RANDOMKEYGEN(auto): ".RandomKey::randomKeyGen()."
"; -print "S::SETRANDOMKEYLENGTH($key_length): ".RandomKey::setRandomKeyLength($key_length)."
"; -print "S::RANDOMKEYGEN($key_length): ".RandomKey::randomKeyGen()."
"; -print "S::RANDOMKEYGEN($key_length_b): ".RandomKey::randomKeyGen($key_length_b)."
"; -print "S::RANDOMKEYGEN($key_length): ".RandomKey::randomKeyGen()."
"; -$_array= new CoreLibs\Create\RandomKey(); -print "C->RANDOMKEYGEN(auto): ".$_array->randomKeyGen()."
"; +print "S::RANDOMKEYGEN(auto): " . RandomKey::randomKeyGen() . "
"; +print "S::SETRANDOMKEYLENGTH($key_length): " . RandomKey::setRandomKeyLength($key_length) . "
"; +print "S::RANDOMKEYGEN($key_length): " . RandomKey::randomKeyGen() . "
"; +print "S::RANDOMKEYGEN($key_length_b): " . RandomKey::randomKeyGen($key_length_b) . "
"; +print "S::RANDOMKEYGEN($key_length): " . RandomKey::randomKeyGen() . "
"; +$_array = new CoreLibs\Create\RandomKey(); +print "C->RANDOMKEYGEN(auto): " . $_array->randomKeyGen() . "
"; // DEPRECATED // print "D\RANDOMKEYGEN(auto): ".$basic->randomKeyGen()."
"; diff --git a/www/admin/class_test.runningtime.php b/www/admin/class_test.runningtime.php index 733b3340..d4f265dd 100644 --- a/www/admin/class_test.runningtime.php +++ b/www/admin/class_test.runningtime.php @@ -1,8 +1,11 @@ -Class Test Master'; RunningTime::hrRunningTime(); RunningTime::runningTime(); -echo "RANDOM KEY [50]: ".\CoreLibs\Create\RandomKey::randomKeyGen(50)."
"; -echo "TIMED [hr]: ".RunningTime::hrRunningTime()."
"; -echo "TIMED [def]: ".RunningTime::runningTime()."
"; -echo "TIMED [string]: ".RunningTime::runningTimeString()."
"; +echo "RANDOM KEY [50]: " . \CoreLibs\Create\RandomKey::randomKeyGen(50) . "
"; +echo "TIMED [hr]: " . RunningTime::hrRunningTime() . "
"; +echo "TIMED [def]: " . RunningTime::runningTime() . "
"; +echo "TIMED [string]: " . RunningTime::runningTimeString() . "
"; RunningTime::hrRunningTime(); -echo "RANDOM KEY [default]: ".\CoreLibs\Create\RandomKey::randomKeyGen()."
"; -echo "TIMED [hr]: ".RunningTime::hrRunningTime()."
"; +echo "RANDOM KEY [default]: " . \CoreLibs\Create\RandomKey::randomKeyGen() . "
"; +echo "TIMED [hr]: " . RunningTime::hrRunningTime() . "
"; // DEPRECATED /* $basic->hrRunningTime(); diff --git a/www/admin/class_test.smarty.php b/www/admin/class_test.smarty.php index ea337dea..c82b6bd1 100644 --- a/www/admin/class_test.smarty.php +++ b/www/admin/class_test.smarty.php @@ -1,9 +1,11 @@ TEST CLASS: SYSTEM"; print ""; print '
Class Test Master
'; -print "GETHOSTNAME: ".DgS::printAr(System::getHostName())."
"; -print "GETPAGENAME(0): ".System::getPageName()."
"; -print "GETPAGENAME(1): ".System::getPageName(1)."
"; -print "GETPAGENAME(2): ".System::getPageName(2)."
"; -print "GETPAGENAMEARRAY: ".\CoreLibs\Debug\Support::printAr(System::getPageNameArray())."
"; +print "GETHOSTNAME: " . DgS::printAr(System::getHostName()) . "
"; +print "GETPAGENAME(0): " . System::getPageName() . "
"; +print "GETPAGENAME(1): " . System::getPageName(1) . "
"; +print "GETPAGENAME(2): " . System::getPageName(2) . "
"; +print "GETPAGENAMEARRAY: " . \CoreLibs\Debug\Support::printAr(System::getPageNameArray()) . "
"; // seting errro codes file upload -print "FILEUPLOADERRORMESSAGE(): ".System::fileUploadErrorMessage(-1)."
"; -print "FILEUPLOADERRORMESSAGE(UPLOAD_ERR_CANT_WRITE): ".System::fileUploadErrorMessage(UPLOAD_ERR_CANT_WRITE)."
"; +print "FILEUPLOADERRORMESSAGE(): " . System::fileUploadErrorMessage(-1) . "
"; +print "FILEUPLOADERRORMESSAGE(UPLOAD_ERR_CANT_WRITE): " + . System::fileUploadErrorMessage(UPLOAD_ERR_CANT_WRITE) . "
"; // error message print $basic->log->printErrorMsg(); diff --git a/www/admin/class_test.token.php b/www/admin/class_test.token.php index 78e818bd..7d6e763a 100644 --- a/www/admin/class_test.token.php +++ b/www/admin/class_test.token.php @@ -1,8 +1,11 @@ -Class Test Master'; $token = 'test_form_token'; $token_id = $_token->setFormToken($token); -print "TOKEN: $token: (ID) ".$token_id." => (S) ".$_SESSION[$token]."
"; -print "VALIDATE: $token: ".(string)$_token->validateFormToken($token_id, $token)."
"; +print "TOKEN: $token: (ID) " . $token_id . " => (S) " . $_SESSION[$token] . "
"; +print "VALIDATE: $token: " . (string)$_token->validateFormToken($token_id, $token) . "
"; $token = 'test_form_token_static'; $token_id = $token_class::setFormToken($token); -print "S-TOKEN: $token: (ID) ".$token_id." => (S) ".$_SESSION[$token]."
"; -print "S-VALIDATE: $token: ".(string)$token_class::validateFormToken($token_id, $token)."
"; +print "S-TOKEN: $token: (ID) " . $token_id . " => (S) " . $_SESSION[$token] . "
"; +print "S-VALIDATE: $token: " . (string)$token_class::validateFormToken($token_id, $token) . "
"; // DEPRECATED /* $token = 'test_form_token_deprecated'; diff --git a/www/admin/class_test.uids.php b/www/admin/class_test.uids.php index 74fec0bb..f1f20b47 100644 --- a/www/admin/class_test.uids.php +++ b/www/admin/class_test.uids.php @@ -1,8 +1,11 @@ -"; print '
Class Test Master
'; // class -print "UUIDV4: ".$_uids->uuidv4()."
"; -print "UNIQID (d): ".$_uids->uniqId()."
"; -print "UNIQID (md5): ".$_uids->uniqId('md5')."
"; -print "UNIQID (sha256): ".$_uids->uniqId('sha256')."
"; +print "UUIDV4: " . $_uids->uuidv4() . "
"; +print "UNIQID (d): " . $_uids->uniqId() . "
"; +print "UNIQID (md5): " . $_uids->uniqId('md5') . "
"; +print "UNIQID (sha256): " . $_uids->uniqId('sha256') . "
"; // statc -print "S::UUIDV4: ".$uids_class::uuidv4()."
"; -print "S::UNIQID (d): ".$uids_class::uniqId()."
"; -print "S::UNIQID (md5): ".$uids_class::uniqId('md5')."
"; -print "S::UNIQID (sha256): ".$uids_class::uniqId('sha256')."
"; +print "S::UUIDV4: " . $uids_class::uuidv4() . "
"; +print "S::UNIQID (d): " . $uids_class::uniqId() . "
"; +print "S::UNIQID (md5): " . $uids_class::uniqId('md5') . "
"; +print "S::UNIQID (sha256): " . $uids_class::uniqId('sha256') . "
"; // DEPRECATED /* print "D/UUIDV4: ".$basic->uuidv4()."
"; print "/DUNIQID (d): ".$basic->uniqId()."
"; */ diff --git a/www/admin/error_test.php b/www/admin/error_test.php index 8844ff45..02e2c0dc 100644 --- a/www/admin/error_test.php +++ b/www/admin/error_test.php @@ -1,4 +1,6 @@ -"; -require(BASE.LIB."Error.Handling.php"); +echo "FILE: " . BASE . LIB . "Error.Handling.php
"; +require(BASE . LIB . "Error.Handling.php"); if ($var) { echo "OUT
"; diff --git a/www/admin/phan_test.php b/www/admin/phan_test.php index 90b8e0e3..cdd5e311 100755 --- a/www/admin/phan_test.php +++ b/www/admin/phan_test.php @@ -1,7 +1,9 @@ -StringByteFormat(ini_get('upload_max_filesize')); // test for qqFileUploader (AJAX side) $allowedExtensions = array ('csv', 'zip', 'jpg', 'pdf', 'bz2'); $sizeLimit = $MAX_UPLOAD_SIZE; // as set in php ini -$base->debug('AJAX UPLOAD', 'Size: '.$sizeLimit.', Memory Limit: '.ini_get('memory_limit')); +$base->debug('AJAX UPLOAD', 'Size: ' . $sizeLimit . ', Memory Limit: ' . ini_get('memory_limit')); $uploader = new FileUpload\qqFileUploader($allowedExtensions, $sizeLimit); // either in post or get -$_action= $_POST['action'] ? $_POST['action'] : $_GET['action']; +$_action = $_POST['action'] ? $_POST['action'] : $_GET['action']; $_task_uid = $_POST['task_uid'] ? $_POST['task_uid'] : $_GET['task_uid']; $get_post['start'] = microtime(true); -$base->debug('AJAX UPLOAD', 'Action: '.$_action.', Task UID: '.$_task_uid.' => '.$base->dateStringFormat($get_post['start'])); +$base->debug('AJAX UPLOAD', 'Action: ' . $_action . ', Task UID: ' + . $_task_uid . ' => ' . $base->dateStringFormat($get_post['start'])); -$upload_path = ROOT.MEDIA.UPLOADS; +$upload_path = ROOT . MEDIA . UPLOADS; $get_post['result'] = $uploader->handleUpload($upload_path, false); -$base->debug('AJAX UPLOAD', 'Memory peak: '.$base->ByteStringFormat(memory_get_usage()).' | '.$base->ByteStringFormat(memory_get_peak_usage())); +$base->debug('AJAX UPLOAD', 'Memory peak: ' . $base->ByteStringFormat(memory_get_usage()) + . ' | ' . $base->ByteStringFormat(memory_get_peak_usage())); // set file name $get_post['filename'] = $uploader->uploadFileName; diff --git a/www/admin/qq_file_upload_front.php b/www/admin/qq_file_upload_front.php index cbb5eb3e..cb21033a 100755 --- a/www/admin/qq_file_upload_front.php +++ b/www/admin/qq_file_upload_front.php @@ -10,7 +10,7 @@ require 'config.php'; $base = new CoreLibs\Basic(); // set max upload size $MAX_UPLOAD_SIZE = $base->StringByteFormat(ini_get('upload_max_filesize')); -$base->debug('UPLOADED FRONT', 'With max size: '.$MAX_UPLOAD_SIZE); +$base->debug('UPLOADED FRONT', 'With max size: ' . $MAX_UPLOAD_SIZE); // very basic template output with super basic div for two file upload ?> diff --git a/www/configs/config.db.php b/www/configs/config.db.php index b5f51467..012c1195 100755 --- a/www/configs/config.db.php +++ b/www/configs/config.db.php @@ -1,4 +1,5 @@ - [ diff --git a/www/configs/config.host.php b/www/configs/config.host.php index c9f4b09e..beaadab1 100755 --- a/www/configs/config.host.php +++ b/www/configs/config.host.php @@ -1,4 +1,5 @@ - '', diff --git a/www/configs/config.master.php b/www/configs/config.master.php index d0c49679..81891cec 100644 --- a/www/configs/config.master.php +++ b/www/configs/config.master.php @@ -1,4 +1,5 @@ -); /************* CONVERT *******************/ @@ -18,9 +21,9 @@ $paths = [ ]; // find convert foreach ($paths as $path) { - if (file_exists($path.DS.'convert') && is_file($path.DS.'convert')) { + if (file_exists($path . DS . 'convert') && is_file($path . DS . 'convert')) { // image magick convert location - define('CONVERT', $path.DS.'convert'); + define('CONVERT', $path . DS . 'convert'); } } unset($paths); diff --git a/www/configs/config.path.php b/www/configs/config.path.php index 50e9fb4d..82740f4e 100755 --- a/www/configs/config.path.php +++ b/www/configs/config.path.php @@ -1,4 +1,5 @@ - bail $CONFIG_PATH_PREFIX = ''; -for ($dir_pos = 0, $dir_max = count(explode(DIRECTORY_SEPARATOR, __DIR__)); $dir_pos <= $dir_max; $dir_pos ++) { - $CONFIG_PATH_PREFIX .= '..'.DIRECTORY_SEPARATOR; - if (file_exists($CONFIG_PATH_PREFIX.CONFIG_PATH.'config.master.php')) { - require $CONFIG_PATH_PREFIX.CONFIG_PATH.'config.master.php'; +for ($dir_pos = 0, $dir_max = count(explode(DIRECTORY_SEPARATOR, __DIR__)); $dir_pos <= $dir_max; $dir_pos++) { + $CONFIG_PATH_PREFIX .= '..' . DIRECTORY_SEPARATOR; + if (file_exists($CONFIG_PATH_PREFIX . CONFIG_PATH . 'config.master.php')) { + require $CONFIG_PATH_PREFIX . CONFIG_PATH . 'config.master.php'; break; } } @@ -24,8 +26,8 @@ if (!defined('DS')) { } // find trigger name "admin/" or "frontend/" in the getcwd() folder foreach (['admin', 'frontend'] as $folder) { - if (strstr(getcwd(), DS.$folder)) { - define('CONTENT_PATH', $folder.DS); + if (strstr(getcwd(), DS . $folder)) { + define('CONTENT_PATH', $folder . DS); break; } } diff --git a/www/frontend/index.php b/www/frontend/index.php index 78cd824c..c4441331 100644 --- a/www/frontend/index.php +++ b/www/frontend/index.php @@ -1,3 +1,5 @@ - 'Mon', 2 => 'Tue', diff --git a/www/includes/admin_footer.php b/www/includes/admin_footer.php index 96c50d9e..c88b5a5f 100644 --- a/www/includes/admin_footer.php +++ b/www/includes/admin_footer.php @@ -1,4 +1,5 @@ -log->printErrorMsg(); echo $cms->log->printErrorMsg(); diff --git a/www/includes/admin_header.php b/www/includes/admin_header.php index 395e32b1..f34f1219 100644 --- a/www/includes/admin_header.php +++ b/www/includes/admin_header.php @@ -1,4 +1,5 @@ -.log if ($DEBUG_ALL && $ENABLE_ERROR_HANDLING) { - include BASE.LIBS."Error.Handling.php"; + include BASE . LIBS . "Error.Handling.php"; } // predefine vars $messages = array(); @@ -21,7 +24,7 @@ $messages = array(); ob_start(); // set the session name $SET_SESSION_NAME = EDIT_SESSION_NAME; -$LOG_FILE_ID = BASE_NAME.'Admin'; +$LOG_FILE_ID = BASE_NAME . 'Admin'; //------------------------------ library include end //------------------------------ basic variable settings start @@ -37,7 +40,7 @@ if (!isset($ENCODING) || !$ENCODING) { } // end the stop of the output flow, but only if we didn't request a csv file download 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 ($AJAX_PAGE && !$ZIP_STREAM) { header("Content-Type: application/json; charset=UTF-8"); diff --git a/www/includes/admin_set_paths.php b/www/includes/admin_set_paths.php index 760c725f..9ebc58ff 100644 --- a/www/includes/admin_set_paths.php +++ b/www/includes/admin_set_paths.php @@ -1,4 +1,5 @@ -setSmartyVarsAdmin(); or setSmartyVarsFrontend();', E_USER_DEPRECATED); +trigger_error( + 'admin_smarty.php is deprecated. Use SmartyExtended->setSmartyVarsAdmin(); or setSmartyVarsFrontend();', + E_USER_DEPRECATED +); $smarty->setSmartyVarsAdmin(); // __END__ diff --git a/www/includes/edit_base.php b/www/includes/edit_base.php index 9127bde3..17b3c464 100644 --- a/www/includes/edit_base.php +++ b/www/includes/edit_base.php @@ -1,4 +1,5 @@ -setTemplateDir(BASE.INCLUDES.TEMPLATES.CONTENT_PATH); - $DATA['css'] = LAYOUT.CSS; - $DATA['js'] = LAYOUT.JS; + $smarty->setTemplateDir(BASE . INCLUDES . TEMPLATES . CONTENT_PATH); + $DATA['css'] = LAYOUT . CSS; + $DATA['js'] = LAYOUT . JS; } else { $smarty->setTemplateDir(TEMPLATES); $DATA['css'] = CSS; @@ -115,17 +121,22 @@ if ($form->my_page_name == 'edit_order') { // this gets temp, id before that, gets actual (moves one "down") // this gets the old before (moves one "up") // is done for every element in row - // echo "A: ".$row_data_id[$position[$i]]." (".$row_data_order[$position[$i]].") -- ".$row_data_id[$position[$i]-1]." (".$row_data_order[$position[$i]-1].")
"; + // echo "A: ".$row_data_id[$position[$i]] + // ." (".$row_data_order[$position[$i]].") -- ".$row_data_id[$position[$i]-1] + // ." (".$row_data_order[$position[$i]-1].")
"; $temp_id = $row_data_id[$position[$i]] ?? null; $row_data_id[$position[$i]] = $row_data_id[$position[$i] - 1] ?? null; $row_data_id[$position[$i] - 1] = $temp_id; - // echo "A: ".$row_data_id[$position[$i]]." (".$row_data_order[$position[$i]].") -- ".$row_data_id[$position[$i]-1]." (".$row_data_order[$position[$i]-1].")
"; + // echo "A: ".$row_data_id[$position[$i]] + // ." (".$row_data_order[$position[$i]].") -- " + // .$row_data_id[$position[$i]-1]." (".$row_data_order[$position[$i]-1].")
"; } // for } // if up - // the last position id from position array is not to be the count-1 of row_data_id array, or it is the last element + // the last position id from position array is not to be the count - 1 of + // row_data_id array, or it is the last element if (isset($down) && ($position[count($position) - 1] != (count($row_data_id) - 1))) { - for ($i = count($position) - 1; $i >= 0; $i --) { + for ($i = count($position) - 1; $i >= 0; $i--) { // same as up, just up in other way, starts from bottom (last element) and moves "up" // element before actuel gets temp, this element, becomes element after this, // element after this, gets this @@ -136,12 +147,15 @@ if ($form->my_page_name == 'edit_order') { } // if down // write data ... (which has to be abstrackt ...) - if ((isset($up) && $position[0] > 0) || + if ( + (isset($up) && $position[0] > 0) || (isset($down) && ($position[count($position) - 1] != (count($row_data_id) - 1))) ) { - for ($i = 0; $i < count($row_data_id); $i ++) { + for ($i = 0; $i < count($row_data_id); $i++) { if (isset($row_data_order[$i]) && isset($row_data_id[$i])) { - $q = "UPDATE ".$table_name." SET order_number = ".$row_data_order[$i]." WHERE ".$table_name."_id = ".$row_data_id[$i]; + $q = "UPDATE " . $table_name + . " SET order_number = " . $row_data_order[$i] + . " WHERE " . $table_name . "_id = " . $row_data_id[$i]; $q = $form->dbExec($q); } } // for all article ids ... @@ -149,7 +163,7 @@ if ($form->my_page_name == 'edit_order') { } // if there is something to move // get ... - $q = "SELECT ".$table_name."_id, name, order_number FROM ".$table_name." "; + $q = "SELECT " . $table_name . "_id, name, order_number FROM " . $table_name . " "; if (!empty($where_string)) { $q .= "WHERE $where_string "; } @@ -163,7 +177,7 @@ if ($form->my_page_name == 'edit_order') { // DB read data for menu while ($res = $form->dbReturn($q)) { $row_data[] = [ - "id" => $res[$table_name."_id"], + "id" => $res[$table_name . "_id"], "name" => $res["name"], "order" => $res["order_number"] ]; @@ -187,13 +201,14 @@ if ($form->my_page_name == 'edit_order') { $DATA['form_error_msg'] = $messages; // all the row data - for ($i = 0; $i < count($row_data); $i ++) { + for ($i = 0; $i < count($row_data); $i++) { $options_id[] = $i; $options_name[] = $row_data[$i]['name']; // list of points to order for ($j = 0; $j < count($position); $j++) { // if matches, put into select array - if (isset($original_id[$position[$j]]) && isset($row_data[$i]['id']) && + if ( + isset($original_id[$position[$j]]) && isset($row_data[$i]['id']) && $original_id[$position[$j]] == $row_data[$i]['id'] ) { $options_selected[] = $i; @@ -288,11 +303,11 @@ if ($form->my_page_name == 'edit_order') { (isset($data['hostname']) && $data['hostname'] ? $data['hostname'] : '' - ). + ) // filename - ($data['filename'] ?? ''). + . ($data['filename'] ?? '') // query string - (isset($data['query_string']) && $data['query_string'] ? + . (isset($data['query_string']) && $data['query_string'] ? $data['query_string'] : '' ); @@ -302,7 +317,8 @@ if ($form->my_page_name == 'edit_order') { $menu_data[$i]['splitfactor_in'] = 0; } // on matching, we also need to check if we are in the same folder - if (isset($data['filename']) && + if ( + isset($data['filename']) && $data['filename'] == \CoreLibs\Get\System::getPageName() && (!isset($data['hostname']) || ( isset($data['hostname']) && @@ -334,7 +350,7 @@ if ($form->my_page_name == 'edit_order') { } // for // $form->log->debug('MENU ARRAY', $form->log->prAr($menu_data)); $DATA['menu_data'] = $menu_data; - $DATA['page_name'] = $menuarray[$position]['page_name'] ?? '-Undefined ['.$position.'] -'; + $DATA['page_name'] = $menuarray[$position]['page_name'] ?? '-Undefined [' . $position . '] -'; $L_TITLE = $DATA['page_name']; // html title $HEADER['HTML_TITLE'] = $form->l->__($L_TITLE); @@ -391,13 +407,13 @@ if ($form->my_page_name == 'edit_order') { $search_glob = []; foreach ($folders as $folder) { // make sure this folder actually exists - if (is_dir(ROOT.$folder)) { + if (is_dir(ROOT . $folder)) { foreach ($files as $file) { - $search_glob[] = $folder.$file; + $search_glob[] = $folder . $file; } } } - $crap = exec('ls '.join(' ', $search_glob), $output, $status); + $crap = exec('ls ' . join(' ', $search_glob), $output, $status); // now get all that are NOT in de DB $q = "INSERT INTO temp_files (folder, filename) VALUES "; $t_q = ''; @@ -410,10 +426,11 @@ if ($form->my_page_name == 'edit_order') { if ($t_q) { $t_q .= ', '; } - $t_q .= "('".$form->dbEscapeString($matches[1])."', '".$form->dbEscapeString($matches[2])."')"; + $t_q .= "('" . $form->dbEscapeString($matches[1]) . "', '" + . $form->dbEscapeString($matches[2]) . "')"; } } - $form->dbExec($q.$t_q, 'NULL'); + $form->dbExec($q . $t_q, 'NULL'); $elements[] = $form->formCreateElement('filename'); } else { // show file menu @@ -493,13 +510,13 @@ $CONTENT_DATA = array_merge($HEADER, $DATA, $DEBUG_DATA); foreach ($CONTENT_DATA as $key => $value) { $smarty->assign($key, $value); } -if (is_dir(BASE.TEMPLATES_C)) { - $smarty->setCompileDir(BASE.TEMPLATES_C); +if (is_dir(BASE . TEMPLATES_C)) { + $smarty->setCompileDir(BASE . TEMPLATES_C); } -if (is_dir(BASE.CACHE)) { - $smarty->setCacheDir(BASE.CACHE); +if (is_dir(BASE . CACHE)) { + $smarty->setCacheDir(BASE . CACHE); } -$smarty->display($EDIT_TEMPLATE, 'editAdmin_'.$smarty->lang, 'editAdmin_'.$smarty->lang); +$smarty->display($EDIT_TEMPLATE, 'editAdmin_' . $smarty->lang, 'editAdmin_' . $smarty->lang); // debug output echo $login->log->printErrorMsg(); diff --git a/www/includes/table_arrays/array_edit_access.php b/www/includes/table_arrays/array_edit_access.php index f129332e..c3c483a8 100644 --- a/www/includes/table_arrays/array_edit_access.php +++ b/www/includes/table_arrays/array_edit_access.php @@ -1,4 +1,6 @@ - [ diff --git a/www/includes/table_arrays/array_edit_groups.php b/www/includes/table_arrays/array_edit_groups.php index 09cb1fb5..ac7d29f1 100644 --- a/www/includes/table_arrays/array_edit_groups.php +++ b/www/includes/table_arrays/array_edit_groups.php @@ -1,4 +1,6 @@ - [ diff --git a/www/includes/table_arrays/array_edit_languages.php b/www/includes/table_arrays/array_edit_languages.php index eb2658e6..7f4632e0 100644 --- a/www/includes/table_arrays/array_edit_languages.php +++ b/www/includes/table_arrays/array_edit_languages.php @@ -1,6 +1,8 @@ - [ 'edit_language_id' => [ 'value' => $GLOBALS['edit_language_id'] ?? '', diff --git a/www/includes/table_arrays/array_edit_menu_group.php b/www/includes/table_arrays/array_edit_menu_group.php index 074e04c1..c45e8c74 100644 --- a/www/includes/table_arrays/array_edit_menu_group.php +++ b/www/includes/table_arrays/array_edit_menu_group.php @@ -1,4 +1,6 @@ - [ diff --git a/www/includes/table_arrays/array_edit_pages.php b/www/includes/table_arrays/array_edit_pages.php index a52f434e..ca6c7704 100644 --- a/www/includes/table_arrays/array_edit_pages.php +++ b/www/includes/table_arrays/array_edit_pages.php @@ -1,4 +1,6 @@ - [ @@ -13,9 +15,9 @@ $edit_pages = [ '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" + . "FROM temp_files " + . "LEFT JOIN edit_page ep ON temp_files.filename = ep.filename " + . "WHERE ep.filename IS NULL" ], 'hostname' => [ 'value' => $GLOBALS['hostname'] ?? '', @@ -112,7 +114,11 @@ $edit_pages = [ // "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", + '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' => [ [ @@ -124,17 +130,17 @@ $edit_pages = [ ], [ 'name' => 'online', - 'binary' => ['Yes','No'], + 'binary' => ['Yes', 'No'], 'before_value' => 'Online: ' ], [ 'name' => 'menu', - 'binary' => ['Yes','No'], + 'binary' => ['Yes', 'No'], 'before_value' => 'Menu: ' ], [ 'name' => 'popup', - 'binary' => ['Yes','No'], + 'binary' => ['Yes', 'No'], 'before_value' => 'Popup: ' ], ], @@ -146,7 +152,8 @@ $edit_pages = [ 'mandatory' => 1, 'select_size' => 10, 'selected' => $GLOBALS['edit_visible_group_id'] ?? '', - 'query' => "SELECT edit_visible_group_id, 'Name: ' || name || ', ' || 'Flag: ' || flag FROM edit_visible_group ORDER BY name" + 'query' => "SELECT edit_visible_group_id, 'Name: ' || name || ', ' || 'Flag: ' || flag " + . "FROM edit_visible_group ORDER BY name" ], 'edit_menu_group' => [ 'table_name' => 'edit_page_menu_group', @@ -155,7 +162,8 @@ $edit_pages = [ 'mandatory' => 1, 'select_size' => 10, 'selected' => $GLOBALS['edit_menu_group_id'] ?? '', - 'query' => "SELECT edit_menu_group_id, 'Name: ' || name || ', ' || 'Flag: ' || flag FROM edit_menu_group ORDER BY order_number" + 'query' => "SELECT edit_menu_group_id, 'Name: ' || name || ', ' || 'Flag: ' || flag " + . "FROM edit_menu_group ORDER BY order_number" ], ], diff --git a/www/includes/table_arrays/array_edit_schemes.php b/www/includes/table_arrays/array_edit_schemes.php index 2fde4668..fa137469 100644 --- a/www/includes/table_arrays/array_edit_schemes.php +++ b/www/includes/table_arrays/array_edit_schemes.php @@ -1,4 +1,6 @@ - [ diff --git a/www/includes/table_arrays/array_edit_users.php b/www/includes/table_arrays/array_edit_users.php index 48501dda..94abbe10 100644 --- a/www/includes/table_arrays/array_edit_users.php +++ b/www/includes/table_arrays/array_edit_users.php @@ -1,4 +1,6 @@ - [ @@ -34,7 +36,8 @@ $edit_users = [ '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 + // can be any date length format. n Y/M/D [not H/M/S], only one set, no combination + 'error_check' => 'intervalshort', 'type' => 'text', 'interval' => 1, // interval needs NULL write for empty 'size' => 5, // make it 5 chars long @@ -184,7 +187,8 @@ $edit_users = [ 'cols' => 60 ], ], - 'load_query' => "SELECT edit_user_id, username, enabled, debug, db_debug, strict, locked, login_error_count FROM edit_user ORDER BY username", + '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' => [ [ diff --git a/www/includes/table_arrays/array_edit_visible_group.php b/www/includes/table_arrays/array_edit_visible_group.php index c4b4c14d..80492f6a 100644 --- a/www/includes/table_arrays/array_edit_visible_group.php +++ b/www/includes/table_arrays/array_edit_visible_group.php @@ -1,4 +1,6 @@ - [ diff --git a/www/lib/CoreLibs/ACL/Login.php b/www/lib/CoreLibs/ACL/Login.php index 79c291c7..55b89785 100644 --- a/www/lib/CoreLibs/ACL/Login.php +++ b/www/lib/CoreLibs/ACL/Login.php @@ -1,4 +1,5 @@ - unset the session vars * 2005/07/04 (cs) add a function to write into the edit log file * 2005/07/01 (cs) start adepting login class to new edit interface layout * 2005/03/31 (cs) fixed the class call with all debug vars * 2004/11/17 (cs) unused var cleanup -* 2004/11/16 (cs) rewrite login so it uses a template and not just plain html. prepare it, so it will be able to use external stuff later (some interface has to be designed for that -* 2004/11/16 (cs) removed the mobile html part from login * 2004/09/30 (cs) layout fix -* 2003-11-11: if user has debug 1 unset memlimit, because there can be serious problems with the query logging +* 2004/11/16 (cs) rewrite login so it uses a template and not just plain html. +* prepare it, so it will be able to use external stuff later +* (some interface has to be designed for that +* 2004/11/16 (cs) removed the mobile html part from login +* 2004/09/30 (cs) layout fix +* 2003-11-11: if user has debug 1 unset memlimit, because there can be serious +* problems with the query logging * 2003-06-12: added flag to PAGES array * changed the get vars from GLOBALS to _POST * changed the session registration. no more GLOBAL vars are registered @@ -57,6 +64,8 @@ * 2000-06-01: created basic idea and functions *********************************************************************/ +declare(strict_types=1); + namespace CoreLibs\ACL; use CoreLibs\Check\Password; @@ -64,16 +73,19 @@ use CoreLibs\Check\Password; class Login extends \CoreLibs\DB\IO { private $euid; // the user id var - private $permission_okay = false; // is set to one if login okay, or EUID is set and user is okay to access this page + // is set to one if login okay, or EUID is set and user is okay to access this page + private $permission_okay = false; public $login; // pressed login private $action; // master action command private $username; // login name private $password; // login password private $logout; // logout button - private $login_error = 0; // login error code, can be matched to the array login_error_msg, which holds the string + // login error code, can be matched to the array login_error_msg, which holds the string + private $login_error = 0; private $password_change = false; // if this is set to true, the user can change passwords private $password_change_ok = false; // password change was successful - private $password_forgot = false; // can we reset password and mail to user with new password set screen + // can we reset password and mail to user with new password set screen + private $password_forgot = false; private $password_forgot_ok = false; // password forgot mail send ok private $change_password; private $pw_username; @@ -161,7 +173,9 @@ class Login extends \CoreLibs\DB\IO $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 - // check what schema to use. if there is a login schema use this, else check if there is a schema set in the config, or fall back to DB_SCHEMA if this exists, if this also does not exists use public schema + // check what schema to use. if there is a login schema use this, else check + // if there is a schema set in the config, or fall back to DB_SCHEMA + // if this exists, if this also does not exists use public schema if (defined('LOGIN_DB_SCHEMA') && LOGIN_DB_SCHEMA) { $SCHEMA = LOGIN_DB_SCHEMA; } elseif (isset($db_config['db_schema']) && $db_config['db_schema']) { @@ -173,9 +187,10 @@ class Login extends \CoreLibs\DB\IO } // set schema if schema differs to schema set in db conneciton if ($this->dbGetSchema() && $this->dbGetSchema() != $SCHEMA) { - $this->dbExec("SET search_path TO ".$SCHEMA); + $this->dbExec("SET search_path TO " . $SCHEMA); } - $this->euid = array_key_exists('EUID', $_SESSION) ? $_SESSION['EUID'] : 0; // if there is none, there is none, saves me POST/GET check + // if there is none, there is none, saves me POST/GET check + $this->euid = array_key_exists('EUID', $_SESSION) ? $_SESSION['EUID'] : 0; // get login vars, are so, can't be changed // prepare // pass on vars to Object vars @@ -303,21 +318,24 @@ class Login extends \CoreLibs\DB\IO $password = $this->password; } // first, errors on missing encryption - if ((preg_match("/^\\$2(a|y)\\$/", $hash) && CRYPT_BLOWFISH != 1) || + 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) ) { // this means password cannot be decrypted because of missing crypt methods $this->login_error = 9999; $password_ok = false; - } elseif (preg_match("/^\\$2y\\$/", $hash) && + } elseif ( + preg_match("/^\\$2y\\$/", $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) && + } elseif ( + !preg_match("/^\\$2(a|y)\\$/", $hash) && !preg_match("/^\\$1\\$/", $hash) && !preg_match("/^\\$[0-9A-Za-z.]{12}$/", $hash) && $hash != $password @@ -344,30 +362,37 @@ class Login extends \CoreLibs\DB\IO $this->login_error = 102; } else { // we have to get the themes in here too - $q = "SELECT eu.edit_user_id, username, password, eu.edit_group_id, eg.name AS edit_group_name, admin, "; - $q .= "eu.login_error_count, eu.login_error_date_last, eu.login_error_date_first, eu.strict, eu.locked, "; - $q .= "debug, db_debug, "; - $q .= "eareu.level AS user_level, eareu.type AS user_type, "; - $q .= "eareg.level AS group_level, eareg.type AS group_type, "; - $q .= "eu.enabled, el.short_name AS lang_short, el.iso_name AS lang_iso, first.header_color AS first_header_color, "; - $q .= "second.header_color AS second_header_color, second.template "; - $q .= "FROM edit_user eu "; - $q .= "LEFT JOIN edit_scheme second ON (second.edit_scheme_id = eu.edit_scheme_id AND second.enabled = 1), "; - $q .= "edit_language el, edit_group eg, "; - $q .= "edit_access_right eareu, "; - $q .= "edit_access_right eareg, "; - $q .= "edit_scheme first "; - $q .= "WHERE first.edit_scheme_id = eg.edit_scheme_id AND eu.edit_group_id = eg.edit_group_id AND eu.edit_language_id = el.edit_language_id AND "; - $q .= "eu.edit_access_right_id = eareu.edit_access_right_id AND "; - $q .= "eg.edit_access_right_id = eareg.edit_access_right_id AND "; - // password match is done in script, against old plain or new blowfish encypted - $q .= "(LOWER(username) = '".$this->dbEscapeString(strtolower($this->username))."') "; + $q = "SELECT eu.edit_user_id, username, password, eu.edit_group_id, " + . "eg.name AS edit_group_name, admin, " + . "eu.login_error_count, eu.login_error_date_last, " + . "eu.login_error_date_first, eu.strict, eu.locked, " + . "debug, db_debug, " + . "eareu.level AS user_level, eareu.type AS user_type, " + . "eareg.level AS group_level, eareg.type AS group_type, " + . "eu.enabled, el.short_name AS lang_short, el.iso_name AS lang_iso, " + . "firstheader_color AS first_header_color, " + . "second.header_color AS second_header_color, second.template " + . "FROM edit_user eu " + . "LEFT JOIN edit_scheme second ON " + . "(second.edit_scheme_id = eu.edit_scheme_id AND second.enabled = 1), " + . "edit_language el, edit_group eg, " + . "edit_access_right eareu, " + . "edit_access_right eareg, " + . "edit_scheme first " + . "WHERE first.edit_scheme_id = eg.edit_scheme_id " + . "AND eu.edit_group_id = egedit_group_id " + . "AND eu.edit_language_id = el.edit_language_id AND " + . "eu.edit_access_right_id = eareu.edit_access_right_id AND " + . "eg.edit_access_right_id = eareg.edit_access_right_id AND " + // password match is done in script, against old plain or new blowfish encypted + . "(LOWER(username) = '" . $this->dbEscapeString(strtolower($this->username)) . "') "; $res = $this->dbReturn($q); // username is wrong, but we throw for wrong username and wrong password the same error if (!$this->cursor_ext[md5($q)]['num_rows']) { $this->login_error = 1010; } else { - // if login errors is half of max errors and the last login error was less than 10s ago, forbid any new login try + // if login errors is half of max errors and the last login error + // was less than 10s ago, forbid any new login try // check flow // - user is enabled @@ -386,10 +411,14 @@ 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: '.($Password::passwordVerify($this->password, $res['password']) ? 'OK' : 'FAIL').' => HASH: '.(Password::passwordRehashCheck($res['password']) ? 'NEW NEEDED' : 'OK')); + // $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(Password::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 @@ -410,31 +439,36 @@ class Login extends \CoreLibs\DB\IO $_SESSION['GROUP_ACL_TYPE'] = $res['group_type']; // deprecated TEMPLATE setting $_SESSION['TEMPLATE'] = $res['template'] ? $res['template'] : ''; - $_SESSION['HEADER_COLOR'] = $res['second_header_color'] ? $res['second_header_color'] : $res['first_header_color']; + $_SESSION['HEADER_COLOR'] = $res['second_header_color'] ? + $res['second_header_color'] : + $res['first_header_color']; $_SESSION['LANG'] = $res['lang_short']; $_SESSION['DEFAULT_CHARSET'] = $res['lang_iso']; - $_SESSION['DEFAULT_LANG'] = $res['lang_short'].'_'.strtolower(str_replace('-', '', $res['lang_iso'])); + $_SESSION['DEFAULT_LANG'] = $res['lang_short'] . '_' + . strtolower(str_replace('-', '', $res['lang_iso'])); // reset any login error count for this user if ($res['login_error_count'] > 0) { - $q = "UPDATE edit_user "; - $q .= "SET login_error_count = 0, login_error_date_last = NULL, login_error_date_first = NULL "; - $q .= "WHERE edit_user_id = ".$res['edit_user_id']; + $q = "UPDATE edit_user " + . "SET login_error_count = 0, login_error_date_last = NULL, " + . "login_error_date_first = NULL " + . "WHERE edit_user_id = " . $res['edit_user_id']; $this->dbExec($q); } $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, "; - $q .= "ep.order_number AS edit_page_order, ep.menu, "; - $q .= "ep.popup, ep.popup_x, ep.popup_y, ep.online, ear.level, ear.type "; - $q .= "FROM edit_page ep "; - $q .= "LEFT JOIN edit_page epca ON (epca.edit_page_id = ep.content_alias_edit_page_id)"; - $q .= ", edit_page_access epa, edit_access_right ear "; - $q .= "WHERE ep.edit_page_id = epa.edit_page_id AND ear.edit_access_right_id = epa.edit_access_right_id "; - $q .= "AND epa.enabled = 1 AND epa.edit_group_id = ".$res["edit_group_id"]." "; - $q .= "ORDER BY ep.order_number"; + $q = "SELECT ep.edit_page_id, ep.cuid, epca.cuid AS content_alias_uid, " + . "ep.hostname, ep.filename, ep.name AS edit_page_name, " + . "ep.order_number AS edit_page_order, ep.menu, " + . "ep.popup, ep.popup_x, ep.popup_y, ep.online, ear.level, ear.type " + . "FROM edit_page ep " + . "LEFT JOIN edit_page epca ON (epca.edit_page_id = ep.content_alias_edit_page_id)" + . ", edit_page_access epa, edit_access_right ear " + . "WHERE ep.edit_page_id = epa.edit_page_id " + . "AND ear.edit_access_right_id = epa.edit_access_right_id " + . "AND epa.enabled = 1 AND epa.edit_group_id = " . $res["edit_group_id"] . " " + . "ORDER BY ep.order_number"; while ($res = $this->dbReturn($q)) { // page id array for sub data readout $edit_page_ids[$res['edit_page_id']] = $res['cuid']; @@ -442,7 +476,8 @@ class Login extends \CoreLibs\DB\IO $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 + // for reference of content data on a differen page + 'content_alias_uid' => $res['content_alias_uid'], 'hostname' => $res['hostname'], 'filename' => $res['filename'], 'page_name' => $res['edit_page_name'], @@ -462,18 +497,20 @@ class Login extends \CoreLibs\DB\IO } // for each page // get the visible groups for all pages and write them to the pages $_edit_page_id = 0; - $q = "SELECT epvg.edit_page_id, name, flag "; - $q .= "FROM edit_visible_group evp, edit_page_visible_group epvg "; - $q .= "WHERE evp.edit_visible_group_id = epvg.edit_visible_group_id AND epvg.edit_page_id IN (".join(', ', array_keys($edit_page_ids)).") "; - $q .= "ORDER BY epvg.edit_page_id"; + $q = "SELECT epvg.edit_page_id, name, flag " + . "FROM edit_visible_group evp, edit_page_visible_group epvg " + . "WHERE evp.edit_visible_group_id = epvg.edit_visible_group_id " + . "AND epvg.edit_page_id IN (" . join(', ', array_keys($edit_page_ids)) . ") " + . "ORDER BY epvg.edit_page_id"; while ($res = $this->dbReturn($q)) { $pages[$edit_page_ids[$res['edit_page_id']]]['visible'][$res['name']] = $res['flag']; } // get the same for the query strings $_edit_page_id = 0; - $q = "SELECT eqs.edit_page_id, name, value, dynamic FROM edit_query_string eqs "; - $q .= "WHERE enabled = 1 AND edit_page_id IN (".join(', ', array_keys($edit_page_ids)).") "; - $q .= "ORDER BY eqs.edit_page_id"; + $q = "SELECT eqs.edit_page_id, name, value, dynamic FROM edit_query_string eqs " + . "WHERE enabled = 1 AND edit_page_id " + . "IN (" . join(', ', array_keys($edit_page_ids)) . ") " + . "ORDER BY eqs.edit_page_id"; while ($res = $this->dbReturn($q)) { $pages[$edit_page_ids[$res['edit_page_id']]]['query'][] = [ 'name' => $res['name'], @@ -483,11 +520,12 @@ class Login extends \CoreLibs\DB\IO } // get the page content and add them to the page $_edit_page_id = 0; - $q = "SELECT epc.edit_page_id, epc.name, epc.uid, epc.order_number, epc.online, ear.level, ear.type "; - $q .= "FROM edit_page_content epc, edit_access_right ear "; - $q .= "WHERE epc.edit_access_right_id = ear.edit_access_right_id AND "; - $q .= "epc.edit_page_id IN (".join(', ', array_keys($edit_page_ids)).") "; - $q .= "ORDER BY epc.order_number"; + $q = "SELECT epc.edit_page_id, epc.name, epc.uid, epc.order_number, " + . "epc.online, ear.level, ear.type " + . "FROM edit_page_content epc, edit_access_right ear " + . "WHERE epc.edit_access_right_id = ear.edit_access_right_id AND " + . "epc.edit_page_id IN (" . join(', ', array_keys($edit_page_ids)) . ") " + . "ORDER BY epc.order_number"; while ($res = $this->dbReturn($q)) { $pages[$edit_page_ids[$res['edit_page_id']]]['content'][$res['uid']] = [ 'name' => $res['name'], @@ -503,17 +541,20 @@ class Login extends \CoreLibs\DB\IO $_SESSION['PAGES'] = $pages; $_SESSION['PAGES_ACL_LEVEL'] = $pages_acl; // load the edit_access user rights - $q = "SELECT ea.edit_access_id, level, type, ea.name, ea.color, ea.uid, edit_default "; - $q .= "FROM edit_access_user eau, edit_access_right ear, edit_access ea "; - $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"; + $q = "SELECT ea.edit_access_id, level, type, ea.name, ea.color, ea.uid, edit_default " + . "FROM edit_access_user eau, edit_access_right ear, edit_access ea " + . "WHERE eau.edit_access_id = ea.edit_access_id " + . "AND eau.edit_access_right_id = ear.edit_access_right_id " + . "AND eau.enabled = 1 AND edit_user_id = " . $this->euid . " " + . "ORDER BY ea.name"; $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']; + $q_sub = "SELECT name, value " + . "FROM edit_access_data " + . "WHERE enabled = 1 AND edit_access_id = " . $res['edit_access_id']; $ea_data = []; while ($res_sub = $this->dbReturn($q_sub)) { $ea_data[$res_sub['name']] = $res_sub['value']; @@ -548,19 +589,21 @@ class Login extends \CoreLibs\DB\IO $login_error_date_first = ", login_error_date_first = NOW()"; } // update login error count for this user - $q = "UPDATE edit_user "; - $q .= "SET login_error_count = login_error_count + 1, login_error_date_last = NOW() ".$login_error_date_first." "; - $q .= "WHERE edit_user_id = ".$res['edit_user_id']; + $q = "UPDATE edit_user " + . "SET login_error_count = login_error_count + 1, " + . "login_error_date_last = NOW() " . $login_error_date_first . " " + . "WHERE edit_user_id = " . $res['edit_user_id']; $this->dbExec($q); // totally lock the user if error max is reached - if ($this->max_login_error_count != -1 && + if ( + $this->max_login_error_count != -1 && $res['login_error_count'] + 1 > $this->max_login_error_count ) { // do some alert reporting in case this error is too big // if strict is set, lock this user // this needs manual unlocking by an admin user if ($res['strict'] && !in_array($this->username, $this->lock_deny_users)) { - $q = "UPDATE edit_user SET locked = 1 WHERE edit_user_id = ".$res['edit_user_id']; + $q = "UPDATE edit_user SET locked = 1 WHERE edit_user_id = " . $res['edit_user_id']; } } } @@ -581,14 +624,23 @@ class Login extends \CoreLibs\DB\IO public function loginCheckPermissions(): bool { if ($this->euid && $this->login_error != 103) { - $q = "SELECT filename "; - $q .= "FROM edit_page ep, edit_page_access epa, edit_group eg, edit_user eu "; - $q .= "WHERE ep.edit_page_id = epa.edit_page_id AND eg.edit_group_id = epa.edit_group_id AND eg.edit_group_id = eu.edit_group_id "; - $q .= "AND eu.edit_user_id = ".$this->euid." AND filename = '".$this->page_name."' AND eg.enabled = 1 AND epa.enabled = 1"; + $q = "SELECT filename " + . "FROM edit_page ep, edit_page_access epa, edit_group eg, edit_user eu " + . "WHERE ep.edit_page_id = epa.edit_page_id " + . "AND eg.edit_group_id = epa.edit_group_id " + . "AND eg.edit_group_id = eu.edit_group_id " + . "AND eu.edit_user_id = " . $this->euid . " " + . "AND filename = '" . $this->page_name . "' " + . "AND eg.enabled = 1 AND epa.enabled = 1"; $res = $this->dbReturnRow($q); // unset mem limit if debug is set to 1 - // if (($GLOBALS["DEBUG_ALL"] || $GLOBALS["DB_DEBUG"] || $_SESSION["DEBUG_ALL"] || $_SESSION["DB_DEBUG"]) && ini_get('memory_limit') != -1) - // ini_set('memory_limit', -1); + // if ( + // ($GLOBALS["DEBUG_ALL"] || $GLOBALS["DB_DEBUG"] || + // $_SESSION["DEBUG_ALL"] || $_SESSION["DB_DEBUG"]) && + // ini_get('memory_limit') != -1 + // ) { + // ini_set('memory_limit', '-1'); + // } if (isset($res['filename']) && $res['filename'] == $this->page_name) { $this->permission_okay = true; } else { @@ -687,7 +739,10 @@ class Login extends \CoreLibs\DB\IO if ($_SESSION['GROUP_ACL_LEVEL'] != -1) { $this->acl['page'] = $_SESSION['GROUP_ACL_LEVEL']; } - if (isset($_SESSION['PAGES_ACL_LEVEL'][$this->page_name]) && $_SESSION['PAGES_ACL_LEVEL'][$this->page_name] != -1) { + if ( + isset($_SESSION['PAGES_ACL_LEVEL'][$this->page_name]) && + $_SESSION['PAGES_ACL_LEVEL'][$this->page_name] != -1 + ) { $this->acl['page'] = $_SESSION['PAGES_ACL_LEVEL'][$this->page_name]; } @@ -820,7 +875,10 @@ class Login extends \CoreLibs\DB\IO } // check user exist, if not -> error if (!$this->login_error) { - $q = "SELECT edit_user_id FROM edit_user WHERE enabled = 1 AND username = '".$this->dbEscapeString($this->pw_username)."'"; + $q = "SELECT edit_user_id " + . "FROM edit_user " + . "WHERE enabled = 1 " + . "AND username = '" . $this->dbEscapeString($this->pw_username) . "'"; list ($edit_user_id) = $this->dbReturnRow($q); if (!$edit_user_id) { // username wrong @@ -830,7 +888,10 @@ class Login extends \CoreLibs\DB\IO } // check old passwords match -> error if (!$this->login_error) { - $q = "SELECT edit_user_id, password FROM edit_user WHERE enabled = 1 AND username = '".$this->dbEscapeString($this->pw_username)."'"; + $q = "SELECT edit_user_id, password " + . "FROM edit_user " + . "WHERE enabled = 1 " + . "AND username = '" . $this->dbEscapeString($this->pw_username) . "'"; list ($edit_user_id, $old_password_hash) = $this->dbReturnRow($q); if (!$edit_user_id || !$this->loginPasswordCheck($old_password_hash, $this->pw_old_password)) { // old password wrong @@ -862,15 +923,18 @@ 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(Password::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.'"'; + $data = 'Password change for user "' . $this->pw_username . '"'; $this->password_change_ok = true; } } else { // illegal user error $this->login_error = 220; - $data = 'Illegal user for password change: '.$this->pw_username; + $data = 'Illegal user for password change: ' . $this->pw_username; } // log this password change attempt $this->writeLog($event, $data, $this->login_error, $this->pw_username); @@ -903,43 +967,76 @@ class Login extends \CoreLibs\DB\IO // pre change the data in the PASSWORD_CHANGE_DIV first foreach ($this->login_template['strings'] as $string => $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].'
', $html_string_password_change); + $html_string_password_change = str_replace( + '{ERROR_MSG}', + $this->login_error_msg[$this->login_error] . '
', + $html_string_password_change + ); } else { - $html_string_password_change = str_replace('{ERROR_MSG}', '
', $html_string_password_change); + $html_string_password_change = str_replace( + '{ERROR_MSG}', + '
', + $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}', '', $html_string_password_change); + $html_string_password_change = str_replace( + '{PASSWORD_CHANGE_SHOW}', + '', + $html_string_password_change + ); } else { - $html_string_password_change = str_replace('{PASSWORD_CHANGE_SHOW}', '', $html_string_password_change); + $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}', '', $html_string); + $html_string = str_replace( + '{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].'
', $html_string); + $html_string = str_replace( + '{ERROR_MSG}', + $this->login_error_msg[$this->login_error] . '
', + $html_string + ); } elseif ($this->password_change_ok && $this->password_change) { - $html_string = str_replace('{ERROR_MSG}', $this->login_error_msg[300].'
', $html_string); + $html_string = str_replace( + '{ERROR_MSG}', + $this->login_error_msg[300] . '
', + $html_string + ); } else { $html_string = str_replace('{ERROR_MSG}', '
', $html_string); } // create the replace array context foreach ($this->login_template['strings'] as $string => $data) { - $html_string = str_replace('{'.$string.'}', $data, $html_string); + $html_string = str_replace('{' . $string . '}', $data, $html_string); } } // if permission is 0 then print out login // return the created HTML here or null for nothing @@ -968,7 +1065,7 @@ class Login extends \CoreLibs\DB\IO // prepare for log if ($this->euid) { // get user from user table - $q = "SELECT username FROM edit_user WHERE edit_user_id = ".$this->euid; + $q = "SELECT username FROM edit_user WHERE edit_user_id = " . $this->euid; list($username) = $this->dbReturnRow($q); } // if euid is set, get username (or try) $this->writeLog($event, '', $this->login_error, $username); @@ -1000,24 +1097,33 @@ class Login extends \CoreLibs\DB\IO ]; $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 - '1012' => $this->l->__('Fatal Error: Login Failed - Wrong Username or Password'), // fallback md5 password wrong - '1013' => $this->l->__('Fatal Error: Login Failed - Wrong Username or Password'), // new password_hash wrong + // actually obsolete + '100' => $this->l->__('Fatal Error: [EUID] came in as GET/POST!'), + // user not found + '1010' => $this->l->__('Fatal Error: Login Failed - Wrong Username or Password'), + // blowfish password wrong + '1011' => $this->l->__('Fatal Error: Login Failed - Wrong Username or Password'), + // fallback md5 password wrong + '1012' => $this->l->__('Fatal Error: Login Failed - Wrong Username or Password'), + // new password_hash wrong + '1013' => $this->l->__('Fatal Error: Login Failed - Wrong Username or Password'), '102' => $this->l->__('Fatal Error: Login Failed - Please enter username and password'), '103' => $this->l->__('Fatal Error: You do not have the rights to access this Page'), '104' => $this->l->__('Fatal Error: Login Failed - User not enabled'), '105' => $this->l->__('Fatal Error: Login Failed - User is locked'), - '220' => $this->l->__('Fatal Error: Password change - The user could not be found'), // actually this is an illegal user, but I mask it + // actually this is an illegal user, but I mask it + '220' => $this->l->__('Fatal Error: Password change - The user could not be found'), '200' => $this->l->__('Fatal Error: Password change - Please enter username and old password'), '201' => $this->l->__('Fatal Error: Password change - The user could not be found'), '202' => $this->l->__('Fatal Error: Password change - The old password is not correct'), '203' => $this->l->__('Fatal Error: Password change - Please fill out both new password fields'), '204' => $this->l->__('Fatal Error: Password change - The new passwords do not match'), - '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 + // we should also not here WHAT is valid + '205' => $this->l->__('Fatal Error: Password change - The new password is not in a valid format'), + // for OK password change + '300' => $this->l->__('Success: Password change successful'), + // this is bad bad error + '9999' => $this->l->__('Fatal Error: necessary crypt engine could not be found. Login is impossible') ]; // if password change is okay @@ -1028,23 +1134,36 @@ class Login extends \CoreLibs\DB\IO 'NEW_PASSWORD' => $this->l->__('New Password'), 'NEW_PASSWORD_CONFIRM' => $this->l->__('New Password confirm'), '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' => '' + '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' => '' ]); + // NOTE: for the HTML block I ignore line lengths + // phpcs:disable $this->login_template['password_change'] = <<