Code Clean up, more testing
Remove unused code and classes. Clean up code to remove all named constant from them and throw deprecation alerts if used. Add basic psalm setup in root folder and remove from www folder
This commit is contained in:
@@ -11,10 +11,6 @@ $DEBUG_ALL = true;
|
||||
$PRINT_ALL = true;
|
||||
$DB_DEBUG = true;
|
||||
|
||||
if ($DEBUG_ALL) {
|
||||
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||
}
|
||||
|
||||
ob_start();
|
||||
|
||||
// basic class test file
|
||||
@@ -35,9 +31,9 @@ $log = new CoreLibs\Debug\Logging([
|
||||
// add file date
|
||||
'print_file_date' => true,
|
||||
// set debug and print flags
|
||||
'debug_all' => $DEBUG_ALL ?? false,
|
||||
'echo_all' => $ECHO_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL ?? false,
|
||||
'debug_all' => $DEBUG_ALL,
|
||||
'echo_all' => $ECHO_ALL,
|
||||
'print_all' => $PRINT_ALL,
|
||||
]);
|
||||
// db config with logger
|
||||
$db = new CoreLibs\DB\IO(DB_CONFIG, $log);
|
||||
@@ -47,7 +43,15 @@ $l10n = new \CoreLibs\Language\L10n(
|
||||
$locale['domain'],
|
||||
$locale['path'],
|
||||
);
|
||||
$backend = new CoreLibs\Admin\Backend($db, $log, $session, $l10n, $locale);
|
||||
$backend = new CoreLibs\Admin\Backend(
|
||||
$db,
|
||||
$log,
|
||||
$session,
|
||||
$l10n,
|
||||
$locale,
|
||||
DEFAULT_ACL_LEVEL
|
||||
);
|
||||
use CoreLibs\Debug\Support;
|
||||
|
||||
$PAGE_NAME = 'TEST CLASS: ADMIN BACKEND';
|
||||
print "<!DOCTYPE html>";
|
||||
@@ -57,11 +61,14 @@ print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||
|
||||
// set acl, from eg login acl
|
||||
print "SETACL[]: " . $backend->setACL(['EMPTY' => 'EMPTY']) . "<br>";
|
||||
print "ADBEDITLOG: " . $backend->adbEditLog('CLASSTEST-ADMIN', 'Some info stirng') . "<br>";
|
||||
print "ADBTOPMENU(0): " . \CoreLibs\Debug\Support::printAr($backend->adbTopMenu()) . "<br>";
|
||||
print "ADBMSG: " . $backend->adbMsg('info', 'Message: %1$d', [1]) . "<br>";
|
||||
print "Messaes: " . \CoreLibs\Debug\Support::printAr($backend->messages) . "<br>";
|
||||
print "SETACL[]: <br>";
|
||||
$backend->setACL(['EMPTY' => 'EMPTY']);
|
||||
print "ADBEDITLOG: <br>";
|
||||
$backend->adbEditLog('CLASSTEST-ADMIN', 'Some info string');
|
||||
print "ADBTOPMENU(0): " . Support::printAr($backend->adbTopMenu(CONTENT_PATH)) . "<br>";
|
||||
print "ADBMSG: <br>";
|
||||
$backend->adbMsg('info', 'Message: %1$d', [1]);
|
||||
print "Messaes: " . Support::printAr($backend->messages) . "<br>";
|
||||
print "ADBPRINTDATETIME:<br>" . $backend->adbPrintDateTime(2021, 6, 21, 6, 38, '_test') . "<br>";
|
||||
|
||||
// error message
|
||||
|
||||
@@ -6,14 +6,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = 1;
|
||||
$PRINT_ALL = 1;
|
||||
$DB_DEBUG = 1;
|
||||
|
||||
if ($DEBUG_ALL) {
|
||||
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||
}
|
||||
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = true;
|
||||
$PRINT_ALL = true;
|
||||
$DB_DEBUG = true;
|
||||
|
||||
ob_start();
|
||||
|
||||
@@ -27,6 +23,7 @@ ob_end_flush();
|
||||
|
||||
use CoreLibs\Combined\ArrayHandler;
|
||||
use CoreLibs\Debug\Support as DgS;
|
||||
use CoreLibs\Convert\SetVarType;
|
||||
|
||||
$log = new CoreLibs\Debug\Logging([
|
||||
'log_folder' => BASE . LOG,
|
||||
@@ -34,9 +31,9 @@ $log = new CoreLibs\Debug\Logging([
|
||||
// add file date
|
||||
'print_file_date' => true,
|
||||
// set debug and print flags
|
||||
'debug_all' => $DEBUG_ALL ?? false,
|
||||
'debug_all' => $DEBUG_ALL,
|
||||
'echo_all' => $ECHO_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL,
|
||||
]);
|
||||
// $_array = new CoreLibs\Combined\ArrayHandler();
|
||||
// $array_class = 'CoreLibs\Combination\ArrayHandler';
|
||||
@@ -92,7 +89,9 @@ $array_3 = [
|
||||
]
|
||||
];
|
||||
// recusrice merge
|
||||
print "ARRAYMERGERECURSIVE: " . DgS::printAr(ArrayHandler::arrayMergeRecursive($array_1, $array_2, $array_3)) . "<br>";
|
||||
print "ARRAYMERGERECURSIVE: " . DgS::printAr(SetVarType::setArray(
|
||||
ArrayHandler::arrayMergeRecursive($array_1, $array_2, $array_3)
|
||||
)) . "<br>";
|
||||
// array difference
|
||||
$array_left = [
|
||||
'same' => 'data',
|
||||
@@ -104,7 +103,9 @@ $array_right = [
|
||||
];
|
||||
print "ARRAYDIFF: " . DgS::printAr(ArrayHandler::arrayDiff($array_left, $array_right)) . "<br>";
|
||||
// in array check
|
||||
print "INARRAYANY([1,3], [array]): " . DgS::printAr(ArrayHandler::inArrayAny([1, 3], $array_2)) . "<br>";
|
||||
print "INARRAYANY([1,3], [array]): " . DgS::printAr(SetVarType::setArray(
|
||||
ArrayHandler::inArrayAny([1, 3], $array_2)
|
||||
)) . "<br>";
|
||||
// flatten array
|
||||
print "FLATTENARRAY: " . DgS::printAr(ArrayHandler::flattenArray($test_array)) . "<br>";
|
||||
print "FLATTENARRAYKEY: " . DgS::printAr(ArrayHandler::flattenArrayKey($test_array)) . "<br>";
|
||||
@@ -114,10 +115,10 @@ print "ARRAYFLATFORKEY: " . DgS::printAr(ArrayHandler::arrayFlatForKey($test_arr
|
||||
/**
|
||||
* attach key/value to an array so it becomes nested
|
||||
*
|
||||
* @param string $pre Attach to new (empty for new root node)
|
||||
* @param string $cur New node
|
||||
* @param array $node Previous created array
|
||||
* @return array Updated array
|
||||
* @param string $pre Attach to new (empty for new root node)
|
||||
* @param string $cur New node
|
||||
* @param array<mixed> $node Previous created array
|
||||
* @return array<mixed> Updated array
|
||||
*/
|
||||
function rec(string $pre, string $cur, array $node = [])
|
||||
{
|
||||
|
||||
@@ -11,10 +11,6 @@ $DEBUG_ALL = true;
|
||||
$PRINT_ALL = true;
|
||||
$DB_DEBUG = true;
|
||||
|
||||
if ($DEBUG_ALL) {
|
||||
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||
}
|
||||
|
||||
ob_start();
|
||||
// basic class test file
|
||||
define('USE_DATABASE', false);
|
||||
|
||||
@@ -6,14 +6,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = 1;
|
||||
$PRINT_ALL = 1;
|
||||
$DB_DEBUG = 1;
|
||||
|
||||
if ($DEBUG_ALL) {
|
||||
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||
}
|
||||
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = true;
|
||||
$PRINT_ALL = true;
|
||||
$DB_DEBUG = true;
|
||||
|
||||
ob_start();
|
||||
|
||||
@@ -33,9 +29,9 @@ $log = new CoreLibs\Debug\Logging([
|
||||
// add file date
|
||||
'print_file_date' => true,
|
||||
// set debug and print flags
|
||||
'debug_all' => $DEBUG_ALL ?? false,
|
||||
'debug_all' => $DEBUG_ALL,
|
||||
'echo_all' => $ECHO_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL,
|
||||
]);
|
||||
$byte_class = 'CoreLibs\Convert\Byte';
|
||||
|
||||
|
||||
@@ -6,14 +6,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = 1;
|
||||
$PRINT_ALL = 1;
|
||||
$DB_DEBUG = 1;
|
||||
|
||||
if ($DEBUG_ALL) {
|
||||
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||
}
|
||||
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = true;
|
||||
$PRINT_ALL = true;
|
||||
$DB_DEBUG = true;
|
||||
|
||||
ob_start();
|
||||
|
||||
@@ -34,9 +30,9 @@ $log = new CoreLibs\Debug\Logging([
|
||||
// add file date
|
||||
'print_file_date' => true,
|
||||
// set debug and print flags
|
||||
'debug_all' => $DEBUG_ALL ?? false,
|
||||
'debug_all' => $DEBUG_ALL,
|
||||
'echo_all' => $ECHO_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL,
|
||||
]);
|
||||
|
||||
$PAGE_NAME = 'TEST CLASS: CHECK COLORS';
|
||||
|
||||
@@ -6,14 +6,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = 1;
|
||||
$PRINT_ALL = 1;
|
||||
$DB_DEBUG = 1;
|
||||
|
||||
if ($DEBUG_ALL) {
|
||||
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||
}
|
||||
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = true;
|
||||
$PRINT_ALL = true;
|
||||
$DB_DEBUG = true;
|
||||
|
||||
ob_start();
|
||||
|
||||
@@ -31,9 +27,9 @@ $log = new CoreLibs\Debug\Logging([
|
||||
// add file date
|
||||
'print_file_date' => true,
|
||||
// set debug and print flags
|
||||
'debug_all' => $DEBUG_ALL ?? false,
|
||||
'debug_all' => $DEBUG_ALL,
|
||||
'echo_all' => $ECHO_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL,
|
||||
]);
|
||||
|
||||
$PAGE_NAME = 'TEST CLASS: CONFIG DIRECT';
|
||||
@@ -47,7 +43,7 @@ print "DIR: " . DIR . "<br>";
|
||||
print "BASE: " . BASE . "<br>";
|
||||
print "ROOT: " . ROOT . "<br>";
|
||||
print "BASE NAME: " . BASE_NAME . "<br>";
|
||||
echo "Config path prefix: " . $CONFIG_PATH_PREFIX . "<br>";
|
||||
echo "Config path prefix: " . ($CONFIG_PATH_PREFIX ?? '') . "<br>";
|
||||
print "DB Name: " . DB_CONFIG_NAME . "<br>";
|
||||
print "DB Config: " . \CoreLibs\Debug\Support::printAr(DB_CONFIG) . "<br>";
|
||||
|
||||
|
||||
@@ -6,14 +6,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = 1;
|
||||
$PRINT_ALL = 1;
|
||||
$DB_DEBUG = 1;
|
||||
|
||||
if ($DEBUG_ALL) {
|
||||
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||
}
|
||||
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = true;
|
||||
$PRINT_ALL = true;
|
||||
$DB_DEBUG = true;
|
||||
|
||||
ob_start();
|
||||
|
||||
@@ -31,9 +27,9 @@ $log = new CoreLibs\Debug\Logging([
|
||||
// add file date
|
||||
'print_file_date' => true,
|
||||
// set debug and print flags
|
||||
'debug_all' => $DEBUG_ALL ?? false,
|
||||
'debug_all' => $DEBUG_ALL,
|
||||
'echo_all' => $ECHO_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL,
|
||||
]);
|
||||
|
||||
$PAGE_NAME = 'TEST CLASS: CONFIG LINK';
|
||||
@@ -47,7 +43,7 @@ print "DIR: " . DIR . "<br>";
|
||||
print "BASE: " . BASE . "<br>";
|
||||
print "ROOT: " . ROOT . "<br>";
|
||||
print "BASE NAME: " . BASE_NAME . "<br>";
|
||||
echo "Config path prefix: " . $CONFIG_PATH_PREFIX . "<br>";
|
||||
echo "Config path prefix: " . ($CONFIG_PATH_PREFIX ?? '') . "<br>";
|
||||
print "DB Name: " . DB_CONFIG_NAME . "<br>";
|
||||
print "DB Config: " . \CoreLibs\Debug\Support::printAr(DB_CONFIG) . "<br>";
|
||||
|
||||
|
||||
@@ -6,14 +6,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = 1;
|
||||
$PRINT_ALL = 1;
|
||||
$DB_DEBUG = 1;
|
||||
|
||||
if ($DEBUG_ALL) {
|
||||
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||
}
|
||||
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = true;
|
||||
$PRINT_ALL = true;
|
||||
$DB_DEBUG = true;
|
||||
|
||||
ob_start();
|
||||
|
||||
@@ -27,6 +23,7 @@ ob_end_flush();
|
||||
|
||||
use CoreLibs\Convert\Colors;
|
||||
use CoreLibs\Debug\Support as DgS;
|
||||
use CoreLibs\Convert\SetVarType;
|
||||
|
||||
$log = new CoreLibs\Debug\Logging([
|
||||
'log_folder' => BASE . LOG,
|
||||
@@ -34,9 +31,9 @@ $log = new CoreLibs\Debug\Logging([
|
||||
// add file date
|
||||
'print_file_date' => true,
|
||||
// set debug and print flags
|
||||
'debug_all' => $DEBUG_ALL ?? false,
|
||||
'debug_all' => $DEBUG_ALL,
|
||||
'echo_all' => $ECHO_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL,
|
||||
]);
|
||||
$color_class = 'CoreLibs\Convert\Colors';
|
||||
|
||||
@@ -59,24 +56,40 @@ $hsb = [210, 67, 12];
|
||||
$hsb_f = [210.5, 67.5, 12.5];
|
||||
$hsl = [210, 50, 7.8];
|
||||
print "S::COLOR rgb->hex: $rgb[0], $rgb[1], $rgb[2]: " . Colors::rgb2hex($rgb[0], $rgb[1], $rgb[2]) . "<br>";
|
||||
print "S::COLOR hex->rgb: $hex: " . DgS::printAr(Colors::hex2rgb($hex)) . "<br>";
|
||||
print "C::S/COLOR rgb->hext: $hex: " . DgS::printAr(CoreLibs\Convert\Colors::hex2rgb($hex)) . "<br>";
|
||||
print "S::COLOR hex->rgb: $hex: " . DgS::printAr(SetVarType::setArray(
|
||||
Colors::hex2rgb($hex)
|
||||
)) . "<br>";
|
||||
print "C::S/COLOR rgb->hext: $hex: " . DgS::printAr(SetVarType::setArray(
|
||||
CoreLibs\Convert\Colors::hex2rgb($hex)
|
||||
)) . "<br>";
|
||||
// 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])) . "<br>";
|
||||
. DgS::printAr(SetVarType::setArray(
|
||||
Colors::rgb2hsb($rgb[0], $rgb[1], $rgb[2])
|
||||
)) . "<br>";
|
||||
print "S::COLOR rgb->hsl: $rgb[0], $rgb[1], $rgb[2]: "
|
||||
. DgS::printAr(Colors::rgb2hsl($rgb[0], $rgb[1], $rgb[2])) . "<br>";
|
||||
. DgS::printAr(SetVarType::setArray(
|
||||
Colors::rgb2hsl($rgb[0], $rgb[1], $rgb[2])
|
||||
)) . "<br>";
|
||||
// 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])) . "<br>";
|
||||
print "S::COLOR hsb_f->rgb: $hsb_f[0], $hsb_f[1], $hsb_f[2]: "
|
||||
. DgS::printAr(Colors::hsb2rgb($hsb_f[0], $hsb_f[1], $hsb_f[2])) . "<br>";
|
||||
. DgS::printAr(SetVarType::setArray(
|
||||
Colors::hsb2rgb($hsb[0], $hsb[1], $hsb[2])
|
||||
)) . "<br>";
|
||||
print "S::COLOR hsb_f->rgb: $hsb_f[0], $hsb_f[1], $hsb_f[2]: "
|
||||
. DgS::printAr(SetVarType::setArray(
|
||||
Colors::hsb2rgb($hsb_f[0], $hsb_f[1], $hsb_f[2])
|
||||
)) . "<br>";
|
||||
print "S::COLOR hsl->rgb: $hsl[0], $hsl[1], $hsl[2]: "
|
||||
. DgS::printAr(Colors::hsl2rgb($hsl[0], $hsl[1], $hsl[2])) . "<br>";
|
||||
. DgS::printAr(SetVarType::setArray(
|
||||
Colors::hsl2rgb($hsl[0], $hsl[1], $hsl[2])
|
||||
)) . "<br>";
|
||||
|
||||
$hsb = [0, 0, 5];
|
||||
print "S::COLOR hsb->rgb: $hsb[0], $hsb[1], $hsb[2]: "
|
||||
. DgS::printAr(Colors::hsb2rgb($hsb[0], $hsb[1], $hsb[2])) . "<br>";
|
||||
. DgS::printAr(SetVarType::setArray(
|
||||
Colors::hsb2rgb($hsb[0], $hsb[1], $hsb[2])
|
||||
)) . "<br>";
|
||||
|
||||
// Random text
|
||||
$h = rand(0, 359);
|
||||
@@ -84,8 +97,8 @@ $s = rand(15, 70);
|
||||
$b = 100;
|
||||
$l = 50;
|
||||
print "RANDOM IN: H: " . $h . ", S: " . $s . ", B/L: " . $b . "/" . $l . "<br>";
|
||||
print "RANDOM hsb->rgb: <pre>" . DgS::printAr(Colors::hsb2rgb($h, $s, $b)) . "</pre><br>";
|
||||
print "RANDOM hsl->rgb: <pre>" . DgS::printAr(Colors::hsl2rgb($h, $s, $l)) . "</pre><br>";
|
||||
print "RANDOM hsb->rgb: <pre>" . DgS::printAr(SetVarType::setArray(Colors::hsb2rgb($h, $s, $b))) . "</pre><br>";
|
||||
print "RANDOM hsl->rgb: <pre>" . DgS::printAr(SetVarType::setArray(Colors::hsl2rgb($h, $s, $l))) . "</pre><br>";
|
||||
|
||||
// TODO: run compare check input must match output
|
||||
|
||||
|
||||
@@ -13,10 +13,6 @@ $PRINT_ALL = true;
|
||||
$ECHO_ALL = true;
|
||||
$DB_DEBUG = true;
|
||||
|
||||
if ($DEBUG_ALL) {
|
||||
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||
}
|
||||
|
||||
ob_start();
|
||||
|
||||
// basic class test file
|
||||
|
||||
@@ -6,14 +6,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = 1;
|
||||
$PRINT_ALL = 1;
|
||||
$DB_DEBUG = 1;
|
||||
|
||||
if ($DEBUG_ALL) {
|
||||
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||
}
|
||||
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = true;
|
||||
$PRINT_ALL = true;
|
||||
$DB_DEBUG = true;
|
||||
|
||||
ob_start();
|
||||
|
||||
@@ -34,9 +30,9 @@ $log = new CoreLibs\Debug\Logging([
|
||||
// add file date
|
||||
'print_file_date' => true,
|
||||
// set debug and print flags
|
||||
'debug_all' => $DEBUG_ALL ?? false,
|
||||
'debug_all' => $DEBUG_ALL,
|
||||
'echo_all' => $ECHO_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL,
|
||||
]);
|
||||
$datetime_class = 'CoreLibs\Combined\DateTime';
|
||||
|
||||
|
||||
@@ -31,9 +31,9 @@ $log = new CoreLibs\Debug\Logging([
|
||||
// add file date
|
||||
'print_file_date' => true,
|
||||
// set debug and print flags
|
||||
'debug_all' => $DEBUG_ALL ?? false,
|
||||
'echo_all' => $ECHO_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL ?? false,
|
||||
'debug_all' => $DEBUG_ALL ?? true,
|
||||
'echo_all' => $ECHO_ALL,
|
||||
'print_all' => $PRINT_ALL ?? true,
|
||||
]);
|
||||
// db connection and attach logger
|
||||
$db = new CoreLibs\DB\IO(DB_CONFIG, $log);
|
||||
|
||||
@@ -24,6 +24,7 @@ ob_end_flush();
|
||||
use CoreLibs\Debug\Support as DgS;
|
||||
use CoreLibs\DB\IO as DbIo;
|
||||
use CoreLibs\Debug\Support;
|
||||
use CoreLibs\Convert\SetVarType;
|
||||
|
||||
$log = new CoreLibs\Debug\Logging([
|
||||
'log_folder' => BASE . LOG,
|
||||
@@ -31,9 +32,9 @@ $log = new CoreLibs\Debug\Logging([
|
||||
// add file date
|
||||
'print_file_date' => true,
|
||||
// set debug and print flags
|
||||
'debug_all' => $DEBUG_ALL ?? false,
|
||||
'echo_all' => $ECHO_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL ?? false,
|
||||
'debug_all' => $DEBUG_ALL ?? true,
|
||||
'echo_all' => $ECHO_ALL,
|
||||
'print_all' => $PRINT_ALL ?? true,
|
||||
]);
|
||||
// db connection and attach logger
|
||||
$db = new CoreLibs\DB\IO(DB_CONFIG, $log);
|
||||
@@ -131,7 +132,7 @@ $status = $db->dbExec("INSERT INTO test_foo (test, number_a) VALUES "
|
||||
print "DIRECT INSERT STATUS: " . Support::printToString($status) . " |<br>"
|
||||
. "QUERY: " . $db->dbGetQuery() . " |<br>"
|
||||
. "DB OBJECT: <pre>" . print_r($status, true) . "</pre>| "
|
||||
. "PRIMARY KEY: " . $db->dbGetInsertPK() . " | "
|
||||
. "PRIMARY KEY: " . Support::printToString($db->dbGetInsertPK()) . " | "
|
||||
. "RETURNING EXT: " . print_r($db->dbGetReturningExt(), true) . " | "
|
||||
. "RETURNING EXT[test]: " . print_r($db->dbGetReturningExt('test'), true) . " | "
|
||||
. "RETURNING ARRAY: " . print_r($db->dbGetReturningArray(), true) . "<br>";
|
||||
@@ -152,7 +153,7 @@ $status = $db->dbExec($query);
|
||||
print "EOM STRING DIRECT INSERT STATUS: " . Support::printToString($status) . " |<br>"
|
||||
. "QUERY: " . $db->dbGetQuery() . " |<br>"
|
||||
. "DB OBJECT: <pre>" . print_r($status, true) . "</pre>| "
|
||||
. "PRIMARY KEY: " . $db->dbGetInsertPK() . " | "
|
||||
. "PRIMARY KEY: " . Support::printToString($db->dbGetInsertPK()) . " | "
|
||||
. "RETURNING EXT: " . print_r($db->dbGetReturningExt(), true) . " | "
|
||||
. "RETURNING EXT[test]: " . print_r($db->dbGetReturningExt('test'), true) . " | "
|
||||
. "RETURNING ARRAY: " . print_r($db->dbGetReturningArray(), true) . "<br>";
|
||||
@@ -164,12 +165,13 @@ var_dump($db->dbGetReturningExt());
|
||||
$last_insert_pk = $db->dbGetInsertPK();
|
||||
print "DIRECT INSERT PREVIOUS INSERTED: "
|
||||
. print_r($db->dbReturnRow("SELECT test_foo_id, test FROM test_foo "
|
||||
. "WHERE test_foo_id = " . $last_insert_pk), true) . "<br>";
|
||||
. "WHERE test_foo_id = " . (int)$last_insert_pk), true) . "<br>";
|
||||
$__last_insert_pk = (int)$last_insert_pk;
|
||||
$q = <<<EOM
|
||||
SELECT
|
||||
test_foo_id, test
|
||||
FROM test_foo
|
||||
WHERE test_foo_id = $last_insert_pk;
|
||||
WHERE test_foo_id = $__last_insert_pk;
|
||||
EOM;
|
||||
print "EOM READ OF PREVIOUS INSERTED: " . print_r($db->dbReturnRow($q), true) . "<br>";
|
||||
print "LAST ERROR: " . $db->dbGetLastError() . "<br>";
|
||||
@@ -180,13 +182,13 @@ $db->dbPrepare("ins_test_foo", "INSERT INTO test_foo (test) VALUES ($1) RETURNIN
|
||||
$status = $db->dbExecute("ins_test_foo", ['BAR TEST ' . time()]);
|
||||
print "PREPARE INSERT[ins_test_foo] STATUS: " . Support::printToString($status) . " |<br>"
|
||||
. "QUERY: " . $db->dbGetPrepareCursorValue('ins_test_foo', 'query') . " |<br>"
|
||||
. "PRIMARY KEY: " . $db->dbGetInsertPK() . " | "
|
||||
. "PRIMARY KEY: " . Support::printToString($db->dbGetInsertPK()) . " | "
|
||||
. "RETURNING EXT: " . print_r($db->dbGetReturningExt(), true) . " | "
|
||||
. "RETURNING RETURN: " . print_r($db->dbGetReturningArray(), true) . "<br>";
|
||||
|
||||
print "PREPARE INSERT PREVIOUS INSERTED: "
|
||||
. print_r($db->dbReturnRow("SELECT test_foo_id, test FROM test_foo "
|
||||
. "WHERE test_foo_id = " . $db->dbGetInsertPK()), true) . "<br>";
|
||||
. "WHERE test_foo_id = " . (int)$db->dbGetInsertPK()), true) . "<br>";
|
||||
|
||||
print "PREPARE CURSOR RETURN:<br>";
|
||||
foreach (['pk_name', 'count', 'query', 'returning_id'] as $key) {
|
||||
@@ -205,7 +207,7 @@ $db->dbPrepare("ins_test_foo_eom", $query);
|
||||
$status = $db->dbExecute("ins_test_foo_eom", ['EOM BAR TEST ' . time()]);
|
||||
print "EOM STRING PREPARE INSERT[ins_test_foo_eom] STATUS: " . Support::printToString($status) . " |<br>"
|
||||
. "QUERY: " . $db->dbGetPrepareCursorValue('ins_test_foo_eom', 'query') . " |<br>"
|
||||
. "PRIMARY KEY: " . $db->dbGetInsertPK() . " | "
|
||||
. "PRIMARY KEY: " . Support::printToString($db->dbGetInsertPK()) . " | "
|
||||
. "RETURNING EXT: " . print_r($db->dbGetReturningExt(), true) . " | "
|
||||
. "RETURNING RETURN: " . print_r($db->dbGetReturningArray(), true) . "<br>";
|
||||
|
||||
@@ -255,21 +257,21 @@ print "EOM STRING DIRECT MULTIPLE INSERT WITH RETURN STATUS: " . Support::printT
|
||||
$status = $db->dbExec("INSERT INTO test_foo (test) VALUES ('FOO; TEST " . time() . "')");
|
||||
print "DIRECT INSERT NO RETURN STATUS: " . Support::printToString($status) . " |<br>"
|
||||
. "QUERY: " . $db->dbGetQuery() . " |<br>"
|
||||
. "PRIMARY KEY: " . $db->dbGetInsertPK() . " | "
|
||||
. "PRIMARY KEY: " . Support::printToString($db->dbGetInsertPK()) . " | "
|
||||
. "RETURNING EXT: " . print_r($db->dbGetReturningExt(), true) . " | "
|
||||
. "RETURNING ARRAY: " . print_r($db->dbGetReturningArray(), true) . "<br>";
|
||||
$last_insert_pk = $db->dbGetInsertPK();
|
||||
|
||||
// is_array read test
|
||||
$q = "SELECT test_foo_id, test FROM test_foo WHERE test_foo_id = " . $last_insert_pk;
|
||||
$q = "SELECT test_foo_id, test FROM test_foo WHERE test_foo_id = " . (int)$last_insert_pk;
|
||||
if (is_array($s_res = $db->dbReturnRow($q)) && !empty($s_res['test'])) {
|
||||
print "WE HAVE DATA FOR: " . $last_insert_pk . " WITH: " . $s_res['test'] . "<br>";
|
||||
print "WE HAVE DATA FOR: " . Support::printToString($last_insert_pk) . " WITH: " . $s_res['test'] . "<br>";
|
||||
}
|
||||
|
||||
// UPDATE WITH RETURNING
|
||||
$status = $db->dbExec("UPDATE test_foo SET test = 'SOMETHING DIFFERENT' "
|
||||
. "WHERE test_foo_id = " . $last_insert_pk . " RETURNING test");
|
||||
print "UPDATE WITH PK " . $last_insert_pk
|
||||
. "WHERE test_foo_id = " . (int)$last_insert_pk . " RETURNING test");
|
||||
print "UPDATE WITH PK " . Support::printToString($last_insert_pk)
|
||||
. " RETURN STATUS: " . Support::printToString($status) . " |<br>"
|
||||
. "QUERY: " . $db->dbGetQuery() . " |<br>"
|
||||
. "RETURNING EXT: " . print_r($db->dbGetReturningExt(), true) . " | "
|
||||
@@ -279,14 +281,14 @@ print "UPDATE WITH PK " . $last_insert_pk
|
||||
$status = $db->dbExec("INSERT INTO test_foobar (type, integer) VALUES ('WITHOUT DATA', 456)");
|
||||
print "INSERT WITH NO PRIMARY KEY NO RETURNING STATUS: " . Support::printToString($status) . " |<br>"
|
||||
. "QUERY: " . $db->dbGetQuery() . " |<br>"
|
||||
. "PRIMARY KEY: " . $db->dbGetInsertPK() . " | "
|
||||
. "PRIMARY KEY: " . Support::printToString($db->dbGetInsertPK()) . " | "
|
||||
. "RETURNING EXT: " . print_r($db->dbGetReturningExt(), true) . " | "
|
||||
. "RETURNING ARRAY: " . print_r($db->dbGetReturningArray(), true) . "<br>";
|
||||
|
||||
$status = $db->dbExec("INSERT INTO test_foobar (type, integer) VALUES ('WITH DATA', 123) RETURNING type, integer");
|
||||
print "INSERT WITH NO PRIMARY KEY WITH RETURNING STATUS: " . Support::printToString($status) . " |<br>"
|
||||
. "QUERY: " . $db->dbGetQuery() . " |<br>"
|
||||
. "PRIMARY KEY: " . $db->dbGetInsertPK() . " | "
|
||||
. "PRIMARY KEY: " . Support::printToString($db->dbGetInsertPK()) . " | "
|
||||
. "RETURNING EXT: " . print_r($db->dbGetReturningExt(), true) . " | "
|
||||
. "RETURNING ARRAY: " . print_r($db->dbGetReturningArray(), true) . "<br>";
|
||||
|
||||
@@ -339,7 +341,7 @@ echo "<hr>";
|
||||
|
||||
// NOTE: try to replacate connection still exists if script is run a second time
|
||||
// open pg bouncer connection
|
||||
$db_pgb = new CoreLibs\DB\IO($DB_CONFIG['test_pgbouncer'], $log);
|
||||
$db_pgb = new CoreLibs\DB\IO($DB_CONFIG['test_pgbouncer'] ?? [], $log);
|
||||
print "[PGB] DBINFO: " . $db_pgb->dbInfo() . "<br>";
|
||||
if ($db->dbPrepare('pgb_sel_test_foo', $q_prep) === false) {
|
||||
print "[PGB] [1] Error in pgb_sel_test_foo prepare<br>";
|
||||
@@ -356,7 +358,9 @@ $db_pgb->dbClose();
|
||||
|
||||
# db write class test
|
||||
$table = 'test_foo';
|
||||
print "TABLE META DATA: " . DgS::printAr($db->dbShowTableMetaData($table)) . "<br>";
|
||||
print "TABLE META DATA: " . DgS::printAr(SetVarType::setArray(
|
||||
$db->dbShowTableMetaData($table)
|
||||
)) . "<br>";
|
||||
// insert first, then use primary key to update
|
||||
$primary_key = ''; # unset
|
||||
$db_write_table = ['test', 'string_a', 'number_a', 'some_bool'];
|
||||
@@ -379,7 +383,7 @@ $data = [
|
||||
];
|
||||
$primary_key = $db->dbWriteDataExt(
|
||||
$db_write_table,
|
||||
$primary_key,
|
||||
(int)$primary_key,
|
||||
$table,
|
||||
$object_fields_not_touch,
|
||||
$object_fields_not_update,
|
||||
@@ -391,7 +395,7 @@ $data = [
|
||||
];
|
||||
$primary_key = $db->dbWriteDataExt(
|
||||
$db_write_table,
|
||||
$primary_key,
|
||||
(int)$primary_key,
|
||||
$table,
|
||||
$object_fields_not_touch,
|
||||
$object_fields_not_update,
|
||||
@@ -403,7 +407,7 @@ $data = [
|
||||
];
|
||||
$primary_key = $db->dbWriteDataExt(
|
||||
$db_write_table,
|
||||
$primary_key,
|
||||
(int)$primary_key,
|
||||
$table,
|
||||
$object_fields_not_touch,
|
||||
$object_fields_not_update,
|
||||
@@ -508,24 +512,24 @@ while (($ret = $db->dbCheckAsync()) === true)
|
||||
// search path check
|
||||
$q = "SHOW search_path";
|
||||
$cursor = $db->dbExec($q);
|
||||
$data = $db->dbFetchArray($cursor)['search_path'];
|
||||
$data = $db->dbFetchArray($cursor)['search_path'] ?? '';
|
||||
print "RETURN DATA FOR search_path: " . $data . "<br>";
|
||||
// print "RETURN DATA FOR search_path: " . DgS::printAr($data) . "<br>";
|
||||
// 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) . ")"
|
||||
. "('TIME: " . (string)time() . "', " . (string)rand(1, 10) . ")"
|
||||
);
|
||||
print "OTHER SCHEMA INSERT STATUS: "
|
||||
. Support::printToString($status)
|
||||
. " | PK NAME: " . $db->dbGetInsertPKName()
|
||||
. ", PRIMARY KEY: " . $db->dbGetInsertPK() . "<br>";
|
||||
. ", PRIMARY KEY: " . Support::printToString($db->dbGetInsertPK()) . "<br>";
|
||||
|
||||
print "<b>NULL TEST DB READ</b><br>";
|
||||
$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) . "<br>";
|
||||
print "RES: " . DgS::printAr(SetVarType::setArray($res)) . "<br>";
|
||||
print "ISSET: " . isset($res['null_varchar']) . "<br>";
|
||||
print "EMPTY: " . empty($res['null_varchar']) . "<br>";
|
||||
|
||||
|
||||
@@ -13,10 +13,6 @@ $PRINT_ALL = false;
|
||||
$ECHO_ALL = true;
|
||||
$DB_DEBUG = true;
|
||||
|
||||
if ($DEBUG_ALL) {
|
||||
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||
}
|
||||
|
||||
ob_start();
|
||||
|
||||
// basic class test file
|
||||
@@ -51,12 +47,22 @@ print "<body>";
|
||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||
|
||||
function test()
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
function test(): ?string
|
||||
{
|
||||
return DebugSupport::getCallerMethod(1);
|
||||
}
|
||||
|
||||
function test2()
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @return array<mixed>
|
||||
*/
|
||||
function test2(): array
|
||||
{
|
||||
return DebugSupport::getCallerMethodList(1);
|
||||
}
|
||||
@@ -108,19 +114,28 @@ $new_log = new CoreLibs\Debug\Logging([
|
||||
$new_log->debug('OPTIONS TYPE', 'New Type error');
|
||||
print "OPTIONS LOGGER:<br>" . $new_log->printErrorMsg();
|
||||
$new_log->setLogLevel('debug', 'on', ['A', 'B', 'C' => false]);
|
||||
print "LOG LEVEL: " . DebugSupport::printAr($new_log->getLogLevel('debug', 'on')) . "<br>";
|
||||
print "LOG LEVEL: " . DebugSupport::printAr(\CoreLibs\Convert\SetVarType::setArray(
|
||||
$new_log->getLogLevel('debug', 'on')
|
||||
)) . "<br>";
|
||||
|
||||
echo "<b>CLASS DEBUG CALL</b><br>";
|
||||
|
||||
// @codingStandardsIgnoreLine
|
||||
class TestL
|
||||
{
|
||||
/** @var \CoreLibs\Debug\Logging */
|
||||
public $log;
|
||||
public function __construct()
|
||||
{
|
||||
$this->log = new CoreLibs\Debug\Logging();
|
||||
}
|
||||
public function test(string $ts = null)
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string|null $ts
|
||||
* @return bool
|
||||
*/
|
||||
public function test(?string $ts = null): bool
|
||||
{
|
||||
print "* GETCALLERCLASS(INSIDE CLASS): " . \CoreLibs\Debug\Support::getCallerClass() . "<br>";
|
||||
$this->log->debug('TESTL', 'Logging in class testL' . ($ts !== null ? ': ' . $ts : ''));
|
||||
@@ -131,12 +146,18 @@ class TestL
|
||||
// @codingStandardsIgnoreLine
|
||||
class TestR extends TestL
|
||||
{
|
||||
/** @var string */
|
||||
public $foo;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function subTest()
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function subTest(): bool
|
||||
{
|
||||
print "** GETCALLERCLASS(INSIDE EXTND CLASS): " . \CoreLibs\Debug\Support::getCallerClass() . "<br>";
|
||||
$this->log->debug('TESTR', 'Logging in class testR (extends testL)');
|
||||
@@ -160,12 +181,18 @@ print "CLASS EXTEND: PRINTERRORMSG: <br>" . $tr->log->printErrorMsg() . "<br>";
|
||||
// @codingStandardsIgnoreLine
|
||||
class AttachOutside
|
||||
{
|
||||
/** @var \CoreLibs\Debug\Logging */
|
||||
public $log;
|
||||
public function __construct(object $logger_class)
|
||||
public function __construct(\CoreLibs\Debug\Logging $logger_class)
|
||||
{
|
||||
$this->log = $logger_class;
|
||||
}
|
||||
public function test()
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function test(): string
|
||||
{
|
||||
$this->log->debug('ATTACHOUTSIDE', 'A test');
|
||||
return get_class($this);
|
||||
|
||||
@@ -6,14 +6,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = 1;
|
||||
$PRINT_ALL = 1;
|
||||
$DB_DEBUG = 1;
|
||||
|
||||
if ($DEBUG_ALL) {
|
||||
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||
}
|
||||
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = true;
|
||||
$PRINT_ALL = true;
|
||||
$DB_DEBUG = true;
|
||||
|
||||
ob_start();
|
||||
|
||||
@@ -34,9 +30,9 @@ $log = new CoreLibs\Debug\Logging([
|
||||
// add file date
|
||||
'print_file_date' => true,
|
||||
// set debug and print flags
|
||||
'debug_all' => $DEBUG_ALL ?? false,
|
||||
'debug_all' => $DEBUG_ALL,
|
||||
'echo_all' => $ECHO_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL,
|
||||
]);
|
||||
|
||||
$PAGE_NAME = 'TEST CLASS: HTML/ELEMENTS';
|
||||
|
||||
@@ -6,14 +6,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = 1;
|
||||
$PRINT_ALL = 1;
|
||||
$DB_DEBUG = 1;
|
||||
|
||||
if ($DEBUG_ALL) {
|
||||
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||
}
|
||||
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = true;
|
||||
$PRINT_ALL = true;
|
||||
$DB_DEBUG = true;
|
||||
|
||||
ob_start();
|
||||
|
||||
@@ -35,9 +31,9 @@ $log = new CoreLibs\Debug\Logging([
|
||||
// add file date
|
||||
'print_file_date' => true,
|
||||
// set debug and print flags
|
||||
'debug_all' => $DEBUG_ALL ?? false,
|
||||
'debug_all' => $DEBUG_ALL,
|
||||
'echo_all' => $ECHO_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL,
|
||||
]);
|
||||
// class type
|
||||
$_chk_enc = new CoreLibs\Check\Encoding();
|
||||
@@ -102,7 +98,7 @@ foreach ($enc_strings as $_string) {
|
||||
// static use
|
||||
$_string = $enc_strings[1];
|
||||
$string = $chk_enc::checkConvertEncoding($_string, 'UTF-8', 'ISO-2022-JP-MS');
|
||||
print "S::ENC CHECK: $_string: " . ($string === false ? '-OK-' : $string) . "<br>";
|
||||
print "S::ENC CHECK: $_string: " . ($string === false ? '-OK-' : $log->prAr($string)) . "<br>";
|
||||
|
||||
// error message
|
||||
print $log->printErrorMsg();
|
||||
|
||||
@@ -6,14 +6,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = 1;
|
||||
$PRINT_ALL = 1;
|
||||
$DB_DEBUG = 1;
|
||||
|
||||
if ($DEBUG_ALL) {
|
||||
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||
}
|
||||
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = true;
|
||||
$PRINT_ALL = true;
|
||||
$DB_DEBUG = true;
|
||||
|
||||
ob_start();
|
||||
|
||||
@@ -33,9 +29,9 @@ $log = new CoreLibs\Debug\Logging([
|
||||
// add file date
|
||||
'print_file_date' => true,
|
||||
// set debug and print flags
|
||||
'debug_all' => $DEBUG_ALL ?? false,
|
||||
'debug_all' => $DEBUG_ALL,
|
||||
'echo_all' => $ECHO_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL,
|
||||
]);
|
||||
|
||||
$PAGE_NAME = 'TEST CLASS: FILE';
|
||||
|
||||
@@ -6,14 +6,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = 1;
|
||||
$PRINT_ALL = 1;
|
||||
$DB_DEBUG = 1;
|
||||
|
||||
if ($DEBUG_ALL) {
|
||||
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||
}
|
||||
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = true;
|
||||
$PRINT_ALL = true;
|
||||
$DB_DEBUG = true;
|
||||
|
||||
ob_start();
|
||||
|
||||
@@ -33,9 +29,9 @@ $log = new CoreLibs\Debug\Logging([
|
||||
// add file date
|
||||
'print_file_date' => true,
|
||||
// set debug and print flags
|
||||
'debug_all' => $DEBUG_ALL ?? false,
|
||||
'debug_all' => $DEBUG_ALL,
|
||||
'echo_all' => $ECHO_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL,
|
||||
]);
|
||||
$hash_class = 'CoreLibs\Create\Hash';
|
||||
|
||||
|
||||
@@ -6,14 +6,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = 1;
|
||||
$PRINT_ALL = 1;
|
||||
$DB_DEBUG = 1;
|
||||
|
||||
if ($DEBUG_ALL) {
|
||||
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||
}
|
||||
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = true;
|
||||
$PRINT_ALL = true;
|
||||
$DB_DEBUG = true;
|
||||
|
||||
ob_start();
|
||||
|
||||
@@ -34,9 +30,9 @@ $log = new CoreLibs\Debug\Logging([
|
||||
// add file date
|
||||
'print_file_date' => true,
|
||||
// set debug and print flags
|
||||
'debug_all' => $DEBUG_ALL ?? false,
|
||||
'debug_all' => $DEBUG_ALL,
|
||||
'echo_all' => $ECHO_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL,
|
||||
]);
|
||||
$_html = new CoreLibs\Convert\Html();
|
||||
$_elements = new CoreLibs\Output\Form\Elements();
|
||||
|
||||
@@ -6,14 +6,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = 1;
|
||||
$PRINT_ALL = 1;
|
||||
$DB_DEBUG = 1;
|
||||
|
||||
if ($DEBUG_ALL) {
|
||||
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||
}
|
||||
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = true;
|
||||
$PRINT_ALL = true;
|
||||
$DB_DEBUG = true;
|
||||
|
||||
ob_start();
|
||||
|
||||
@@ -33,9 +29,9 @@ $log = new CoreLibs\Debug\Logging([
|
||||
// add file date
|
||||
'print_file_date' => true,
|
||||
// set debug and print flags
|
||||
'debug_all' => $DEBUG_ALL ?? false,
|
||||
'debug_all' => $DEBUG_ALL,
|
||||
'echo_all' => $ECHO_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL,
|
||||
]);
|
||||
$_image = new CoreLibs\Output\Image();
|
||||
$image_class = 'CoreLibs\Output\Image';
|
||||
@@ -54,12 +50,15 @@ $thumb_width = 250;
|
||||
$thumb_height = 300;
|
||||
// class
|
||||
$image = BASE . LAYOUT . CONTENT_PATH . IMAGES . 'no_picture_square.jpg';
|
||||
// folders
|
||||
$cache_folder = BASE . LAYOUT . CONTENT_PATH . CACHE . IMAGES;
|
||||
$web_folder = LAYOUT . CACHE . IMAGES;
|
||||
// rotate image first
|
||||
$_image->correctImageOrientation($image);
|
||||
// thumbnail tests
|
||||
echo "<div>CLASS->CREATETHUMBNAILSIMPLE: "
|
||||
. basename($image) . ": WIDTH: $thumb_width<br><img src="
|
||||
. $_image->createThumbnailSimple($image, $thumb_width) . "></div>";
|
||||
. $_image->createThumbnailSimple($image, $thumb_width, 0, $cache_folder, $web_folder) . "></div>";
|
||||
// static
|
||||
$image = BASE . LAYOUT . CONTENT_PATH . IMAGES . 'no_picture.jpg';
|
||||
// rotate image first
|
||||
@@ -67,7 +66,7 @@ $image_class::correctImageOrientation($image);
|
||||
// thumbnail tests
|
||||
echo "<div>S::CREATETHUMBNAILSIMPLE: "
|
||||
. basename($image) . ": WIDTH: $thumb_width<br><img src="
|
||||
. $image_class::createThumbnailSimple($image, $thumb_width) . "></div>";
|
||||
. $image_class::createThumbnailSimple($image, $thumb_width, 0, $cache_folder, $web_folder) . "></div>";
|
||||
|
||||
echo "U-STATIC VARIOUS:<br>";
|
||||
// image thumbnail
|
||||
@@ -92,21 +91,29 @@ $images = array(
|
||||
$finfo = new finfo(FILEINFO_MIME_TYPE);
|
||||
foreach ($images as $image) {
|
||||
$image = BASE . LAYOUT . CONTENT_PATH . IMAGES . $image;
|
||||
list ($height, $width, $img_type) = getimagesize($image);
|
||||
list ($height, $width, $img_type) = \CoreLibs\Convert\SetVarType::setArray(getimagesize($image));
|
||||
echo "<div><b>IMAGE INFO</b>: " . $height . "x" . $width . ", TYPE: "
|
||||
. $img_type . " [" . $finfo->file($image) . "]</div>";
|
||||
. $log->prAr($img_type) . " [" . $finfo->file($image) . "]</div>";
|
||||
// rotate image first
|
||||
Image::correctImageOrientation($image);
|
||||
// thumbnail tests
|
||||
echo "<div>" . basename($image) . ": WIDTH: $thumb_width<br><img src="
|
||||
. Image::createThumbnailSimple($image, $thumb_width) . "></div>";
|
||||
. Image::createThumbnailSimple($image, $thumb_width, 0, $cache_folder, $web_folder) . "></div>";
|
||||
echo "<div>" . basename($image) . ": HEIGHT: $thumb_height<br><img src="
|
||||
. Image::createThumbnailSimple($image, 0, $thumb_height) . "></div>";
|
||||
. Image::createThumbnailSimple($image, 0, $thumb_height, $cache_folder, $web_folder) . "></div>";
|
||||
echo "<div>" . basename($image) . ": WIDTH/HEIGHT: $thumb_width x $thumb_height<br><img src="
|
||||
. Image::createThumbnailSimple($image, $thumb_width, $thumb_height) . "></div>";
|
||||
. Image::createThumbnailSimple($image, $thumb_width, $thumb_height, $cache_folder, $web_folder) . "></div>";
|
||||
// test with dummy
|
||||
echo "<div>" . basename($image) . ": WIDTH/HEIGHT: $thumb_width x $thumb_height (+DUMMY)<br><img src="
|
||||
. Image::createThumbnailSimple($image, $thumb_width, $thumb_height, null, true, false) . "></div>";
|
||||
. Image::createThumbnailSimple(
|
||||
$image,
|
||||
$thumb_width,
|
||||
$thumb_height,
|
||||
$cache_folder,
|
||||
$web_folder,
|
||||
true,
|
||||
false
|
||||
) . "></div>";
|
||||
echo "<hr>";
|
||||
}
|
||||
|
||||
|
||||
@@ -6,14 +6,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = 1;
|
||||
$PRINT_ALL = 1;
|
||||
$DB_DEBUG = 1;
|
||||
|
||||
if ($DEBUG_ALL) {
|
||||
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||
}
|
||||
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = true;
|
||||
$PRINT_ALL = true;
|
||||
$DB_DEBUG = true;
|
||||
|
||||
ob_start();
|
||||
|
||||
@@ -34,9 +30,9 @@ $log = new CoreLibs\Debug\Logging([
|
||||
// add file date
|
||||
'print_file_date' => true,
|
||||
// set debug and print flags
|
||||
'debug_all' => $DEBUG_ALL ?? false,
|
||||
'debug_all' => $DEBUG_ALL,
|
||||
'echo_all' => $ECHO_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL,
|
||||
]);
|
||||
$json_class = 'CoreLibs\Convert\Json';
|
||||
|
||||
|
||||
@@ -6,14 +6,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = 1;
|
||||
$PRINT_ALL = 1;
|
||||
$DB_DEBUG = 1;
|
||||
|
||||
if ($DEBUG_ALL) {
|
||||
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||
}
|
||||
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = true;
|
||||
$PRINT_ALL = true;
|
||||
$DB_DEBUG = true;
|
||||
|
||||
ob_start();
|
||||
|
||||
@@ -33,30 +29,44 @@ print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||
|
||||
use CoreLibs\Language\L10n;
|
||||
use CoreLibs\Language;
|
||||
use CoreLibs\Debug\Support;
|
||||
|
||||
echo "<br><b>LIST LOCALES</b><br>";
|
||||
|
||||
$locale = 'en_US.UTF-8';
|
||||
$locales = CoreLibs\Language\L10n::listLocales($locale);
|
||||
$locales = L10n::listLocales($locale);
|
||||
print "[" . $locale . "] LOCALES: " . Support::printAr($locales) . "<br>";
|
||||
$locale = 'en.UTF-8';
|
||||
$locales = CoreLibs\Language\L10n::listLocales($locale);
|
||||
$locales = L10n::listLocales($locale);
|
||||
print "[" . $locale . "] LOCALES: " . Support::printAr($locales) . "<br>";
|
||||
|
||||
echo "<br><b>LOCALE INFO</b><br>";
|
||||
echo "<br><b>PARSE LOCAL</b><br>";
|
||||
$locale = 'en_US.UTF-8';
|
||||
$locale_info = CoreLibs\Language\L10n::parseLocale($locale);
|
||||
$locale_info = L10n::parseLocale($locale);
|
||||
print "[" . $locale . "] INFO: " . Support::printAr($locale_info) . "<br>";
|
||||
$locale = 'en.UTF-8';
|
||||
$locale_info = CoreLibs\Language\L10n::parseLocale($locale);
|
||||
$locale_info = L10n::parseLocale($locale);
|
||||
print "[" . $locale . "] INFO: " . Support::printAr($locale_info) . "<br>";
|
||||
|
||||
echo "<br><b>AUTO DETECT</b><br>";
|
||||
|
||||
$get_locale = \CoreLibs\Language\GetLocale::setLocale();
|
||||
print "[AUTO]: " . Support::printAr($get_locale) . "<br>";
|
||||
$get_locale = \CoreLibs\Language\GetLocale::setLocale('en', 'foo', 'ISO-8895');
|
||||
// DEPRECATED
|
||||
// $get_locale = Language\GetLocale::setLocale();
|
||||
// print "[AUTO, DEPRECATED]: " . Support::printAr($get_locale) . "<br>";
|
||||
$get_locale = Language\GetLocale::setLocale(
|
||||
SITE_LOCALE,
|
||||
str_replace('/', '', CONTENT_PATH),
|
||||
null,
|
||||
BASE . INCLUDES . LOCALE
|
||||
);
|
||||
print "[NAMED CONSTANTS OUTSIDE]: " . Support::printAr($get_locale) . "<br>";
|
||||
$get_locale = Language\GetLocale::setLocale(
|
||||
'en',
|
||||
'foo',
|
||||
'ISO-8895',
|
||||
BASE . INCLUDES . LOCALE
|
||||
);
|
||||
print "[OVERRIDE]: " . Support::printAr($get_locale) . "<br>";
|
||||
|
||||
// try to load non existing
|
||||
@@ -69,7 +79,7 @@ $domain = 'admin';
|
||||
$encoding = 'UTF-8';
|
||||
$path = BASE . INCLUDES . LOCALE;
|
||||
// load direct
|
||||
$l = new CoreLibs\Language\L10n($lang, $domain, $path);
|
||||
$l = new L10n($lang, $domain, $path);
|
||||
echo "*<br>";
|
||||
echo "LANGUAGE WANT/SET: " . $lang . '/' . $l->getLocale() . "<br>";
|
||||
echo "DOMAIN WANT/SET: " . $domain . '/' . $l->getDomain() . "<br>";
|
||||
|
||||
@@ -6,14 +6,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = 1;
|
||||
$PRINT_ALL = 1;
|
||||
$DB_DEBUG = 1;
|
||||
|
||||
if ($DEBUG_ALL) {
|
||||
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||
}
|
||||
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = true;
|
||||
$PRINT_ALL = true;
|
||||
$DB_DEBUG = true;
|
||||
|
||||
ob_start();
|
||||
|
||||
@@ -32,13 +28,26 @@ $log = new CoreLibs\Debug\Logging([
|
||||
// add file date
|
||||
'print_file_date' => true,
|
||||
// set debug and print flags
|
||||
'debug_all' => $DEBUG_ALL ?? false,
|
||||
'debug_all' => $DEBUG_ALL,
|
||||
'echo_all' => $ECHO_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL,
|
||||
]);
|
||||
$db = new CoreLibs\DB\IO(DB_CONFIG, $log);
|
||||
$login = new CoreLibs\ACL\Login($db, $log, $session);
|
||||
$login = new CoreLibs\ACL\Login(
|
||||
$db,
|
||||
$log,
|
||||
$session,
|
||||
[
|
||||
'auto_login' => false,
|
||||
'default_acl_level' => DEFAULT_ACL_LEVEL,
|
||||
'logout_target' => LOGOUT_TARGET,
|
||||
'site_locale' => SITE_LOCALE,
|
||||
'site_domain' => SITE_DOMAIN,
|
||||
'locale_path' => BASE . INCLUDES . LOCALE,
|
||||
]
|
||||
);
|
||||
ob_end_flush();
|
||||
$login->loginMainCall();
|
||||
|
||||
$PAGE_NAME = 'TEST CLASS: LOGIN';
|
||||
print "<!DOCTYPE html>";
|
||||
@@ -53,7 +62,7 @@ echo "MIN ACCESS BASE: " . ($login->loginCheckAccessBase('admin') ? 'OK' : 'BAD'
|
||||
echo "MIN ACCESS PAGE: " . ($login->loginCheckAccessPage('admin') ? 'OK' : 'BAD') . "<br>";
|
||||
|
||||
echo "ACL: " . \CoreLibs\Debug\Support::printAr($login->loginGetAcl()) . "<br>";
|
||||
echo "ACL (MIN): " . \CoreLibs\Debug\Support::printAr($login->loginGetAcl()['min']) . "<br>";
|
||||
echo "ACL (MIN): " . \CoreLibs\Debug\Support::printAr($login->loginGetAcl()['min'] ?? []) . "<br>";
|
||||
|
||||
// error message
|
||||
print $log->printErrorMsg();
|
||||
|
||||
@@ -6,14 +6,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = 1;
|
||||
$PRINT_ALL = 1;
|
||||
$DB_DEBUG = 1;
|
||||
|
||||
if ($DEBUG_ALL) {
|
||||
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||
}
|
||||
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = true;
|
||||
$PRINT_ALL = true;
|
||||
$DB_DEBUG = true;
|
||||
|
||||
ob_start();
|
||||
|
||||
@@ -31,9 +27,9 @@ $log = new CoreLibs\Debug\Logging([
|
||||
// add file date
|
||||
'print_file_date' => true,
|
||||
// set debug and print flags
|
||||
'debug_all' => $DEBUG_ALL ?? false,
|
||||
'debug_all' => $DEBUG_ALL,
|
||||
'echo_all' => $ECHO_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL,
|
||||
]);
|
||||
$_math = new CoreLibs\Convert\Math();
|
||||
$math_class = 'CoreLibs\Convert\Math';
|
||||
|
||||
@@ -6,14 +6,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = 1;
|
||||
$PRINT_ALL = 1;
|
||||
$DB_DEBUG = 1;
|
||||
|
||||
if ($DEBUG_ALL) {
|
||||
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||
}
|
||||
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = true;
|
||||
$PRINT_ALL = true;
|
||||
$DB_DEBUG = true;
|
||||
|
||||
ob_start();
|
||||
|
||||
@@ -34,9 +30,9 @@ $log = new CoreLibs\Debug\Logging([
|
||||
// add file date
|
||||
'print_file_date' => true,
|
||||
// set debug and print flags
|
||||
'debug_all' => $DEBUG_ALL ?? false,
|
||||
'debug_all' => $DEBUG_ALL,
|
||||
'echo_all' => $ECHO_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL,
|
||||
]);
|
||||
|
||||
$PAGE_NAME = 'TEST CLASS: MEMORY USAGE';
|
||||
|
||||
@@ -4,16 +4,12 @@
|
||||
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
declare(strict_types=1);
|
||||
|
||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = 1;
|
||||
$PRINT_ALL = 1;
|
||||
$DB_DEBUG = 1;
|
||||
|
||||
if ($DEBUG_ALL) {
|
||||
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||
}
|
||||
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = true;
|
||||
$PRINT_ALL = true;
|
||||
$DB_DEBUG = true;
|
||||
|
||||
ob_start();
|
||||
|
||||
@@ -31,9 +27,9 @@ $log = new CoreLibs\Debug\Logging([
|
||||
// add file date
|
||||
'print_file_date' => true,
|
||||
// set debug and print flags
|
||||
'debug_all' => $DEBUG_ALL ?? false,
|
||||
'debug_all' => $DEBUG_ALL,
|
||||
'echo_all' => $ECHO_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL,
|
||||
]);
|
||||
$_mime = new CoreLibs\Convert\MimeAppName();
|
||||
|
||||
|
||||
@@ -11,10 +11,6 @@ $DEBUG_ALL = true;
|
||||
$PRINT_ALL = true;
|
||||
$DB_DEBUG = true;
|
||||
|
||||
if ($DEBUG_ALL) {
|
||||
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||
}
|
||||
|
||||
ob_start();
|
||||
|
||||
// basic class test file
|
||||
@@ -63,11 +59,28 @@ $log = new CoreLibs\Debug\Logging([
|
||||
// add file date
|
||||
'print_file_date' => true,
|
||||
// set debug and print flags
|
||||
'debug_all' => $DEBUG_ALL ?? false,
|
||||
'echo_all' => $ECHO_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL ?? false,
|
||||
'debug_all' => $DEBUG_ALL,
|
||||
'echo_all' => $ECHO_ALL,
|
||||
'print_all' => $PRINT_ALL,
|
||||
]);
|
||||
$form = new CoreLibs\Output\Form\Generate(DB_CONFIG, $log, table_arrays: $table_arrays);
|
||||
$locale = CoreLibs\Language\GetLocale::setLocale(
|
||||
SITE_LOCALE,
|
||||
SITE_DOMAIN,
|
||||
SITE_ENCODING,
|
||||
BASE . INCLUDES . LOCALE
|
||||
);
|
||||
$l10n = new CoreLibs\Language\L10n(
|
||||
SITE_LOCALE,
|
||||
SITE_DOMAIN,
|
||||
BASE . INCLUDES . LOCALE
|
||||
);
|
||||
$form = new CoreLibs\Output\Form\Generate(
|
||||
DB_CONFIG,
|
||||
$log,
|
||||
$l10n,
|
||||
$locale,
|
||||
table_arrays: $table_arrays
|
||||
);
|
||||
|
||||
$PAGE_NAME = 'TEST CLASS: FORM GENERATE';
|
||||
print "<!DOCTYPE html>";
|
||||
|
||||
@@ -6,14 +6,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = 1;
|
||||
$PRINT_ALL = 1;
|
||||
$DB_DEBUG = 1;
|
||||
|
||||
if ($DEBUG_ALL) {
|
||||
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||
}
|
||||
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = true;
|
||||
$PRINT_ALL = true;
|
||||
$DB_DEBUG = true;
|
||||
|
||||
ob_start();
|
||||
|
||||
@@ -33,9 +29,9 @@ $log = new CoreLibs\Debug\Logging([
|
||||
// add file date
|
||||
'print_file_date' => true,
|
||||
// set debug and print flags
|
||||
'debug_all' => $DEBUG_ALL ?? false,
|
||||
'debug_all' => $DEBUG_ALL,
|
||||
'echo_all' => $ECHO_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL,
|
||||
]);
|
||||
$_password = new CoreLibs\Check\Password();
|
||||
$password_class = 'CoreLibs\Check\Password';
|
||||
|
||||
@@ -11,9 +11,6 @@ $DEBUG_ALL = true;
|
||||
$PRINT_ALL = true;
|
||||
$DB_DEBUG = true;
|
||||
|
||||
if ($DEBUG_ALL) {
|
||||
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||
}
|
||||
|
||||
ob_start();
|
||||
|
||||
@@ -33,19 +30,43 @@ $log = new CoreLibs\Debug\Logging([
|
||||
// add file date
|
||||
'print_file_date' => true,
|
||||
// set debug and print flags
|
||||
'debug_all' => $DEBUG_ALL ?? false,
|
||||
'debug_all' => $DEBUG_ALL,
|
||||
'echo_all' => $ECHO_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL,
|
||||
]);
|
||||
$db = new CoreLibs\DB\IO(DB_CONFIG, $log);
|
||||
$login = new CoreLibs\ACL\Login($db, $log, $session);
|
||||
$locale = \CoreLibs\Language\GetLocale::setLocale();
|
||||
$locale = \CoreLibs\Language\GetLocale::setLocale(
|
||||
SITE_LOCALE,
|
||||
SITE_DOMAIN,
|
||||
SITE_ENCODING,
|
||||
BASE . INCLUDES . LOCALE
|
||||
);
|
||||
$l10n = new \CoreLibs\Language\L10n(
|
||||
$locale['locale'],
|
||||
$locale['domain'],
|
||||
$locale['path'],
|
||||
);
|
||||
$backend = new CoreLibs\Admin\Backend($db, $log, $session, $l10n, $locale);
|
||||
$login = new CoreLibs\ACL\Login(
|
||||
$db,
|
||||
$log,
|
||||
$session,
|
||||
[
|
||||
'auto_login' => true,
|
||||
'default_acl_level' => DEFAULT_ACL_LEVEL,
|
||||
'logout_target' => LOGOUT_TARGET,
|
||||
'site_locale' => $locale['locale'],
|
||||
'site_domain' => $locale['domain'],
|
||||
'locale_path' => $locale['path'],
|
||||
]
|
||||
);
|
||||
$backend = new CoreLibs\Admin\Backend(
|
||||
$db,
|
||||
$log,
|
||||
$session,
|
||||
$l10n,
|
||||
$locale,
|
||||
DEFAULT_ACL_LEVEL
|
||||
);
|
||||
$backend->db->dbInfo(true);
|
||||
ob_end_flush();
|
||||
|
||||
@@ -126,7 +147,9 @@ foreach (['on', 'off'] as $flag) {
|
||||
foreach (['debug', 'echo', 'print'] as $type) {
|
||||
$prefix = $flag == 'off' ? 'NOT ' : '';
|
||||
print $prefix . strtoupper($type) . ' OUT: '
|
||||
. \CoreLibs\Debug\Support::printAr($backend->log->getLogLevel($type, $flag)) . '<br>';
|
||||
. \CoreLibs\Debug\Support::printAr(\CoreLibs\Convert\SetVarType::setArray(
|
||||
$backend->log->getLogLevel($type, $flag)
|
||||
)) . '<br>';
|
||||
}
|
||||
}
|
||||
foreach (['debug', 'echo', 'print'] as $type) {
|
||||
|
||||
@@ -6,14 +6,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = 1;
|
||||
$PRINT_ALL = 1;
|
||||
$DB_DEBUG = 1;
|
||||
|
||||
if ($DEBUG_ALL) {
|
||||
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||
}
|
||||
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = true;
|
||||
$PRINT_ALL = true;
|
||||
$DB_DEBUG = true;
|
||||
|
||||
ob_start();
|
||||
|
||||
@@ -33,9 +29,9 @@ $log = new CoreLibs\Debug\Logging([
|
||||
// add file date
|
||||
'print_file_date' => true,
|
||||
// set debug and print flags
|
||||
'debug_all' => $DEBUG_ALL ?? false,
|
||||
'debug_all' => $DEBUG_ALL,
|
||||
'echo_all' => $ECHO_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL,
|
||||
]);
|
||||
$_phpv = new CoreLibs\Check\PhpVersion();
|
||||
$phpv_class = 'CoreLibs\Check\PhpVersion';
|
||||
@@ -71,6 +67,8 @@ print "S::MAX $max_version_ss: " . (string)$phpv_class::checkPHPVersion(null, $m
|
||||
// use stats
|
||||
print "U-S::MIN: $min_version: " . (string)PhpVersion::checkPHPVersion($min_version) . "<br>";
|
||||
|
||||
print "PHP_VERSION_ID: " . PHP_VERSION_ID . "<br>";
|
||||
|
||||
// error message
|
||||
print $log->printErrorMsg();
|
||||
|
||||
|
||||
@@ -6,14 +6,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = 1;
|
||||
$PRINT_ALL = 1;
|
||||
$DB_DEBUG = 1;
|
||||
|
||||
if ($DEBUG_ALL) {
|
||||
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||
}
|
||||
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = true;
|
||||
$PRINT_ALL = true;
|
||||
$DB_DEBUG = true;
|
||||
|
||||
ob_start();
|
||||
|
||||
@@ -33,9 +29,9 @@ $log = new CoreLibs\Debug\Logging([
|
||||
// add file date
|
||||
'print_file_date' => true,
|
||||
// set debug and print flags
|
||||
'debug_all' => $DEBUG_ALL ?? false,
|
||||
'debug_all' => $DEBUG_ALL,
|
||||
'echo_all' => $ECHO_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL,
|
||||
]);
|
||||
$array_class = 'CoreLibs\Create\RandomKey';
|
||||
|
||||
|
||||
@@ -24,9 +24,9 @@ $log = new CoreLibs\Debug\Logging([
|
||||
// add file date
|
||||
'print_file_date' => true,
|
||||
// set debug and print flags
|
||||
'debug_all' => $DEBUG_ALL ?? false,
|
||||
'debug_all' => $DEBUG_ALL ?? true,
|
||||
'echo_all' => $ECHO_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL ?? true,
|
||||
]);
|
||||
$ref_class = 'CoreLibs\Get\ReadEnvFile';
|
||||
|
||||
|
||||
@@ -6,14 +6,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = 1;
|
||||
$PRINT_ALL = 1;
|
||||
$DB_DEBUG = 1;
|
||||
|
||||
if ($DEBUG_ALL) {
|
||||
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||
}
|
||||
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = true;
|
||||
$PRINT_ALL = true;
|
||||
$DB_DEBUG = true;
|
||||
|
||||
ob_start();
|
||||
|
||||
@@ -33,9 +29,9 @@ $log = new CoreLibs\Debug\Logging([
|
||||
// add file date
|
||||
'print_file_date' => true,
|
||||
// set debug and print flags
|
||||
'debug_all' => $DEBUG_ALL ?? false,
|
||||
'debug_all' => $DEBUG_ALL,
|
||||
'echo_all' => $ECHO_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL,
|
||||
]);
|
||||
|
||||
$PAGE_NAME = 'TEST CLASS: RUNNING TIME';
|
||||
|
||||
@@ -2,14 +2,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = 1;
|
||||
$PRINT_ALL = 1;
|
||||
$DB_DEBUG = 1;
|
||||
|
||||
if ($DEBUG_ALL) {
|
||||
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||
}
|
||||
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = true;
|
||||
$PRINT_ALL = true;
|
||||
$DB_DEBUG = true;
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
@@ -53,9 +49,9 @@ $log = new CoreLibs\Debug\Logging([
|
||||
// add file date
|
||||
'print_file_date' => true,
|
||||
// set debug and print flags
|
||||
'debug_all' => $DEBUG_ALL ?? false,
|
||||
'debug_all' => $DEBUG_ALL,
|
||||
'echo_all' => $ECHO_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL,
|
||||
]);
|
||||
use CoreLibs\Create\Session;
|
||||
$session = new Session();
|
||||
@@ -128,11 +124,11 @@ $session->unsetS('setwrap');
|
||||
print "[READ WRAP] unset setwrap: " . $session->getS('setwrap') . "<br>";
|
||||
print "[READ WRAP] unset Isset: " . ($session->issetS('setwrap') ? 'Yes' : 'No') . "<br>";
|
||||
// test __get/__set
|
||||
$session->setwrap = 'YES, magic set _SESSION var';
|
||||
print "[READ MAGIC] A setwrap: " . $session->setwrap . "<br>";
|
||||
$session->setwrap = 'YES, magic set _SESSION var'; /** @phpstan-ignore-line GET/SETTER */
|
||||
print "[READ MAGIC] A setwrap: " . ($session->setwrap ?? '') . "<br>";
|
||||
print "[READ MAGIC] Isset: " . (isset($session->setwrap) ? 'Yes' : 'No') . "<br>";
|
||||
unset($session->setwrap);
|
||||
print "[READ MAGIC] unset setwrap: " . $session->setwrap . "<br>";
|
||||
print "[READ MAGIC] unset setwrap: " . ($session->setwrap ?? '') . "<br>";
|
||||
print "[READ MAGIC] unset Isset: " . (isset($session->setwrap) ? 'Yes' : 'No') . "<br>";
|
||||
|
||||
// differnt session name
|
||||
|
||||
@@ -2,14 +2,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = 1;
|
||||
$PRINT_ALL = 1;
|
||||
$DB_DEBUG = 1;
|
||||
|
||||
if ($DEBUG_ALL) {
|
||||
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||
}
|
||||
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = true;
|
||||
$PRINT_ALL = true;
|
||||
$DB_DEBUG = true;
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
@@ -53,9 +49,9 @@ $log = new CoreLibs\Debug\Logging([
|
||||
// add file date
|
||||
'print_file_date' => true,
|
||||
// set debug and print flags
|
||||
'debug_all' => $DEBUG_ALL ?? false,
|
||||
'debug_all' => $DEBUG_ALL,
|
||||
'echo_all' => $ECHO_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL,
|
||||
]);
|
||||
use CoreLibs\Create\Session;
|
||||
$session = new Session();
|
||||
|
||||
@@ -11,10 +11,6 @@ $DEBUG_ALL = true;
|
||||
$PRINT_ALL = true;
|
||||
$DB_DEBUG = true;
|
||||
|
||||
if ($DEBUG_ALL) {
|
||||
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||
}
|
||||
|
||||
ob_start();
|
||||
|
||||
// basic class test file
|
||||
@@ -33,9 +29,9 @@ $log = new CoreLibs\Debug\Logging([
|
||||
// add file date
|
||||
'print_file_date' => true,
|
||||
// set debug and print flags
|
||||
'debug_all' => $DEBUG_ALL ?? false,
|
||||
'echo_all' => $ECHO_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL ?? false,
|
||||
'debug_all' => $DEBUG_ALL,
|
||||
'echo_all' => $ECHO_ALL,
|
||||
'print_all' => $PRINT_ALL,
|
||||
]);
|
||||
$locale = \CoreLibs\Language\GetLocale::setLocale();
|
||||
$l10n = new \CoreLibs\Language\L10n(
|
||||
@@ -43,7 +39,12 @@ $l10n = new \CoreLibs\Language\L10n(
|
||||
$locale['domain'],
|
||||
$locale['path'],
|
||||
);
|
||||
$smarty = new CoreLibs\Template\SmartyExtend($l10n, $locale);
|
||||
$smarty = new CoreLibs\Template\SmartyExtend(
|
||||
$l10n,
|
||||
$locale,
|
||||
CACHE_ID,
|
||||
COMPILE_ID,
|
||||
);
|
||||
|
||||
$PAGE_NAME = 'TEST CLASS: SMARTY';
|
||||
print "<!DOCTYPE html>";
|
||||
@@ -59,7 +60,7 @@ $smarty->CSS_SPECIAL_TEMPLATE_NAME = 'smart_test.css';
|
||||
$smarty->USE_PROTOTYPE = false;
|
||||
$smarty->USE_JQUERY = true;
|
||||
$smarty->JS_DATEPICKR = false;
|
||||
if ($smarty->USE_PROTOTYPE) {
|
||||
if ($smarty->USE_PROTOTYPE) { /** @phpstan-ignore-line for debug purpose */
|
||||
$smarty->ADMIN_JAVASCRIPT = 'edit.pt.js';
|
||||
$smarty->JS_SPECIAL_TEMPLATE_NAME = 'prototype.test.js';
|
||||
} elseif ($smarty->USE_JQUERY) {
|
||||
@@ -67,7 +68,17 @@ if ($smarty->USE_PROTOTYPE) {
|
||||
$smarty->JS_SPECIAL_TEMPLATE_NAME = 'jquery.test.js';
|
||||
}
|
||||
$smarty->PAGE_WIDTH = '100%';
|
||||
$smarty->setSmartyPaths();
|
||||
$smarty->setSmartyPaths(
|
||||
BASE . INCLUDES,
|
||||
BASE . INCLUDES . TEMPLATES . CONTENT_PATH,
|
||||
LAYOUT . JS,
|
||||
LAYOUT . CSS,
|
||||
LAYOUT . FONT,
|
||||
LAYOUT . IMAGES,
|
||||
LAYOUT . CACHE,
|
||||
ROOT . LAYOUT . CACHE,
|
||||
null // master template name optional
|
||||
);
|
||||
|
||||
// smarty test
|
||||
$smarty->DATA['SMARTY_TEST'] = 'Test Data';
|
||||
@@ -122,7 +133,18 @@ $smarty->DATA['checkbox_test_selected'] = ['1', '-1'];
|
||||
$smarty->DATA['checkbox_test_pos_selected'] = ['0', '-1'];
|
||||
|
||||
|
||||
$smarty->setSmartyVarsAdmin();
|
||||
$smarty->setSmartyVarsAdmin(
|
||||
BASE . TEMPLATES_C,
|
||||
BASE . CACHE,
|
||||
CSS,
|
||||
FONT,
|
||||
JS,
|
||||
DEFAULT_ENCODING,
|
||||
G_TITLE,
|
||||
ADMIN_STYLESHEET,
|
||||
ADMIN_JAVASCRIPT,
|
||||
PAGE_WIDTH
|
||||
);
|
||||
|
||||
// error message
|
||||
print $log->printErrorMsg();
|
||||
|
||||
@@ -2,14 +2,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = 1;
|
||||
$PRINT_ALL = 1;
|
||||
$DB_DEBUG = 1;
|
||||
|
||||
if ($DEBUG_ALL) {
|
||||
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||
}
|
||||
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = true;
|
||||
$PRINT_ALL = true;
|
||||
$DB_DEBUG = true;
|
||||
|
||||
ob_start();
|
||||
|
||||
@@ -27,9 +23,9 @@ $log = new CoreLibs\Debug\Logging([
|
||||
// add file date
|
||||
'print_file_date' => true,
|
||||
// set debug and print flags
|
||||
'debug_all' => $DEBUG_ALL ?? false,
|
||||
'debug_all' => $DEBUG_ALL,
|
||||
'echo_all' => $ECHO_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL,
|
||||
]);
|
||||
$byte_class = 'CoreLibs\Convert\Strings';
|
||||
|
||||
|
||||
@@ -6,14 +6,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = 1;
|
||||
$PRINT_ALL = 1;
|
||||
$DB_DEBUG = 1;
|
||||
|
||||
if ($DEBUG_ALL) {
|
||||
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||
}
|
||||
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = true;
|
||||
$PRINT_ALL = true;
|
||||
$DB_DEBUG = true;
|
||||
|
||||
ob_start();
|
||||
|
||||
@@ -34,9 +30,9 @@ $log = new CoreLibs\Debug\Logging([
|
||||
// add file date
|
||||
'print_file_date' => true,
|
||||
// set debug and print flags
|
||||
'debug_all' => $DEBUG_ALL ?? false,
|
||||
'debug_all' => $DEBUG_ALL,
|
||||
'echo_all' => $ECHO_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL,
|
||||
]);
|
||||
|
||||
$PAGE_NAME = 'TEST CLASS: SYSTEM';
|
||||
|
||||
@@ -6,14 +6,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = 1;
|
||||
$PRINT_ALL = 1;
|
||||
$DB_DEBUG = 1;
|
||||
|
||||
if ($DEBUG_ALL) {
|
||||
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||
}
|
||||
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = true;
|
||||
$PRINT_ALL = true;
|
||||
$DB_DEBUG = true;
|
||||
|
||||
ob_start();
|
||||
|
||||
@@ -31,9 +27,9 @@ $log = new CoreLibs\Debug\Logging([
|
||||
// add file date
|
||||
'print_file_date' => true,
|
||||
// set debug and print flags
|
||||
'debug_all' => $DEBUG_ALL ?? false,
|
||||
'debug_all' => $DEBUG_ALL,
|
||||
'echo_all' => $ECHO_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL,
|
||||
]);
|
||||
$_token = new CoreLibs\Output\Form\Token();
|
||||
$token_class = 'CoreLibs\Output\Form\Token';
|
||||
|
||||
@@ -6,14 +6,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = 1;
|
||||
$PRINT_ALL = 1;
|
||||
$DB_DEBUG = 1;
|
||||
|
||||
if ($DEBUG_ALL) {
|
||||
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||
}
|
||||
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = true;
|
||||
$PRINT_ALL = true;
|
||||
$DB_DEBUG = true;
|
||||
|
||||
ob_start();
|
||||
|
||||
@@ -31,9 +27,9 @@ $log = new CoreLibs\Debug\Logging([
|
||||
// add file date
|
||||
'print_file_date' => true,
|
||||
// set debug and print flags
|
||||
'debug_all' => $DEBUG_ALL ?? false,
|
||||
'debug_all' => $DEBUG_ALL,
|
||||
'echo_all' => $ECHO_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL,
|
||||
]);
|
||||
$_uids = new CoreLibs\Create\Uids();
|
||||
use CoreLibs\Create\Uids;
|
||||
|
||||
@@ -6,14 +6,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = 1;
|
||||
$PRINT_ALL = 1;
|
||||
$DB_DEBUG = 1;
|
||||
|
||||
if ($DEBUG_ALL) {
|
||||
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||
}
|
||||
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = true;
|
||||
$PRINT_ALL = true;
|
||||
$DB_DEBUG = true;
|
||||
|
||||
ob_start();
|
||||
|
||||
@@ -35,9 +31,9 @@ $log = new CoreLibs\Debug\Logging([
|
||||
// add file date
|
||||
'print_file_date' => true,
|
||||
// set debug and print flags
|
||||
'debug_all' => $DEBUG_ALL ?? false,
|
||||
'debug_all' => $DEBUG_ALL,
|
||||
'echo_all' => $ECHO_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL ?? false,
|
||||
'print_all' => $PRINT_ALL,
|
||||
]);
|
||||
|
||||
$PAGE_NAME = 'TEST CLASS: CONVERT\VARISTYPE';
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
},
|
||||
"require": {
|
||||
"egrajp/smarty-extended": "^4.3",
|
||||
"php": ">=8.1"
|
||||
"php": ">=8.1",
|
||||
"gullevek/dotenv": "^2.0"
|
||||
}
|
||||
}
|
||||
|
||||
86
www/composer.lock
generated
86
www/composer.lock
generated
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "5b803d9f077cbb1b28dcb383f5e89b0a",
|
||||
"content-hash": "88bf0aa9b348a55a525b96fcaed7b5a9",
|
||||
"packages": [
|
||||
{
|
||||
"name": "egrajp/smarty-extended",
|
||||
@@ -35,6 +35,60 @@
|
||||
"templating"
|
||||
],
|
||||
"time": "2023-02-17T14:14:10+09:00"
|
||||
},
|
||||
{
|
||||
"name": "gullevek/dotenv",
|
||||
"version": "v2.0.8",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/gullevek/dotEnv.git",
|
||||
"reference": "e29f9fcd8853a09bb89b0eb8ee555b754ecee36e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/gullevek/dotEnv/zipball/e29f9fcd8853a09bb89b0eb8ee555b754ecee36e",
|
||||
"reference": "e29f9fcd8853a09bb89b0eb8ee555b754ecee36e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.4.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phan/phan": "^5.4",
|
||||
"phpstan/phpstan": "^1.10",
|
||||
"phpunit/phpunit": "^9"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"gullevek\\dotEnv\\": "src/",
|
||||
"gullevek\\dotenv\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Clemens Schwaighofer",
|
||||
"email": "gullevek@gullevek.org",
|
||||
"homepage": "http://gullevek.org"
|
||||
}
|
||||
],
|
||||
"description": "Simple .env file processing and storing in _ENV array",
|
||||
"homepage": "https://github.com/gullevek/dotEnv",
|
||||
"keywords": [
|
||||
".env",
|
||||
"_ENV",
|
||||
"dotenv",
|
||||
"environment variables"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/gullevek/dotEnv/issues",
|
||||
"source": "https://github.com/gullevek/dotEnv/tree/v2.0.8"
|
||||
},
|
||||
"time": "2023-03-03T00:32:02+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [
|
||||
@@ -336,23 +390,23 @@
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-code-coverage",
|
||||
"version": "9.2.24",
|
||||
"version": "9.2.25",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
|
||||
"reference": "2cf940ebc6355a9d430462811b5aaa308b174bed"
|
||||
"reference": "0e2b40518197a8c0d4b08bc34dfff1c99c508954"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2cf940ebc6355a9d430462811b5aaa308b174bed",
|
||||
"reference": "2cf940ebc6355a9d430462811b5aaa308b174bed",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/0e2b40518197a8c0d4b08bc34dfff1c99c508954",
|
||||
"reference": "0e2b40518197a8c0d4b08bc34dfff1c99c508954",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-dom": "*",
|
||||
"ext-libxml": "*",
|
||||
"ext-xmlwriter": "*",
|
||||
"nikic/php-parser": "^4.14",
|
||||
"nikic/php-parser": "^4.15",
|
||||
"php": ">=7.3",
|
||||
"phpunit/php-file-iterator": "^3.0.3",
|
||||
"phpunit/php-text-template": "^2.0.2",
|
||||
@@ -401,7 +455,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
|
||||
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.24"
|
||||
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.25"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -409,7 +463,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2023-01-26T08:26:55+00:00"
|
||||
"time": "2023-02-25T05:32:00+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-file-iterator",
|
||||
@@ -654,16 +708,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit",
|
||||
"version": "9.6.3",
|
||||
"version": "9.6.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||
"reference": "e7b1615e3e887d6c719121c6d4a44b0ab9645555"
|
||||
"reference": "9125ee085b6d95e78277dc07aa1f46f9e0607b8d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e7b1615e3e887d6c719121c6d4a44b0ab9645555",
|
||||
"reference": "e7b1615e3e887d6c719121c6d4a44b0ab9645555",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9125ee085b6d95e78277dc07aa1f46f9e0607b8d",
|
||||
"reference": "9125ee085b6d95e78277dc07aa1f46f9e0607b8d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -736,7 +790,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.3"
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.4"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -752,7 +806,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-02-04T13:37:15+00:00"
|
||||
"time": "2023-02-27T13:06:37+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/cli-parser",
|
||||
@@ -1774,7 +1828,9 @@
|
||||
"stability-flags": [],
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": [],
|
||||
"platform": {
|
||||
"php": ">=8.1"
|
||||
},
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "2.3.0"
|
||||
}
|
||||
|
||||
@@ -100,27 +100,6 @@ define('DEFAULT_ACL_LEVEL', 80);
|
||||
/************* LOGOUT ********************/
|
||||
// logout target
|
||||
define('LOGOUT_TARGET', '');
|
||||
// password change allowed
|
||||
define('PASSWORD_CHANGE', false);
|
||||
define('PASSWORD_FORGOT', false);
|
||||
// min/max password length
|
||||
define('PASSWORD_MIN_LENGTH', 9);
|
||||
define('PASSWORD_MAX_LENGTH', 255);
|
||||
// defines allowed special characters
|
||||
define('PASSWORD_SPECIAL_RANGE', '@$!%*?&');
|
||||
// password must have upper case, lower case, number, special
|
||||
// comment out for not mandatory
|
||||
define('PASSWORD_LOWER', '(?=.*[a-z])');
|
||||
define('PASSWORD_UPPER', '(?=.*[A-Z])');
|
||||
define('PASSWORD_NUMBER', '(?=.*\d)');
|
||||
define('PASSWORD_SPECIAL', "(?=.*[" . PASSWORD_SPECIAL_RANGE . "])");
|
||||
// define full regex
|
||||
define('PASSWORD_REGEX', "/^"
|
||||
. (defined('PASSWORD_LOWER') ? PASSWORD_LOWER : '')
|
||||
. (defined('PASSWORD_UPPER') ? PASSWORD_UPPER : '')
|
||||
. (defined('PASSWORD_NUMBER') ? PASSWORD_NUMBER : '')
|
||||
. (defined('PASSWORD_SPECIAL') ? PASSWORD_SPECIAL : '')
|
||||
. "[A-Za-z\d" . PASSWORD_SPECIAL_RANGE . "]{" . PASSWORD_MIN_LENGTH . "," . PASSWORD_MAX_LENGTH . "}$/");
|
||||
|
||||
/************* AJAX / ACCESS *************/
|
||||
// ajax request type
|
||||
@@ -264,6 +243,7 @@ $GLOBALS['DB_CONFIG_SET'] = DB_CONFIG;
|
||||
define('TARGET', $SITE_CONFIG[HOST_NAME]['location'] ?? 'test');
|
||||
define('DEBUG', $SITE_CONFIG[HOST_NAME]['debug_flag'] ?? false);
|
||||
define('SITE_LOCALE', $SITE_CONFIG[HOST_NAME]['site_locale'] ?? DEFAULT_LOCALE);
|
||||
define('SITE_DOMAIN', str_replace(DIRECTORY_SEPARATOR, '', CONTENT_PATH));
|
||||
define('SITE_ENCODING', $SITE_CONFIG[HOST_NAME]['site_encoding'] ?? DEFAULT_ENCODING);
|
||||
define('LOGIN_ENABLED', $SITE_CONFIG[HOST_NAME]['login_enabled'] ?? false);
|
||||
define('AUTH', $SITE_CONFIG[HOST_NAME]['auth'] ?? false);
|
||||
|
||||
@@ -50,9 +50,22 @@ for (
|
||||
is_file($__DIR__PATH . $CONFIG_PATH_PREFIX . CONFIG_PATH . 'config.master.php')
|
||||
) {
|
||||
// load enviorment file if it exists
|
||||
\CoreLibs\Get\DotEnv::readEnvFile(
|
||||
\gullevek\dotEnv\DotEnv::readEnvFile(
|
||||
$__DIR__PATH . $CONFIG_PATH_PREFIX . CONFIG_PATH
|
||||
);
|
||||
// find trigger name "admin/" or "frontend/" in the getcwd() folder
|
||||
$folder = '';
|
||||
foreach (['admin', 'frontend'] as $_folder) {
|
||||
if (strstr(getcwd() ?: '', DIRECTORY_SEPARATOR . $_folder)) {
|
||||
$folder = $_folder;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// if content path is empty, fallback is default
|
||||
if (empty($folder)) {
|
||||
$folder = 'default';
|
||||
}
|
||||
define('CONTENT_PATH', $folder . DIRECTORY_SEPARATOR);
|
||||
// load master config file that loads all other config files
|
||||
require $__DIR__PATH . $CONFIG_PATH_PREFIX . CONFIG_PATH . 'config.master.php';
|
||||
break;
|
||||
@@ -62,18 +75,5 @@ for (
|
||||
if (!defined('DIR')) {
|
||||
exit('Base config could not be loaded');
|
||||
}
|
||||
// find trigger name "admin/" or "frontend/" in the getcwd() folder
|
||||
$folder = '';
|
||||
foreach (['admin', 'frontend'] as $_folder) {
|
||||
if (strstr(getcwd() ?: '', DIRECTORY_SEPARATOR . $_folder)) {
|
||||
$folder = $_folder;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// if content path is empty, fallback is default
|
||||
if (empty($folder)) {
|
||||
$folder = 'default';
|
||||
}
|
||||
define('CONTENT_PATH', $folder . DIRECTORY_SEPARATOR);
|
||||
|
||||
// __END__
|
||||
|
||||
@@ -61,6 +61,16 @@ ob_end_flush();
|
||||
// init smarty and form class
|
||||
$edit_base = new CoreLibs\Admin\EditBase(DB_CONFIG, $log, $l10n, $locale);
|
||||
// creates edit pages and runs actions
|
||||
$edit_base->editBaseRun();
|
||||
$edit_base->editBaseRun(
|
||||
BASE . INCLUDES . TEMPLATES . CONTENT_PATH,
|
||||
BASE . TEMPLATES_C,
|
||||
BASE . CACHE,
|
||||
ADMIN_STYLESHEET,
|
||||
DEFAULT_ENCODING,
|
||||
LAYOUT . CSS,
|
||||
LAYOUT . JS,
|
||||
ROOT,
|
||||
CONTENT_PATH
|
||||
);
|
||||
|
||||
// __END__
|
||||
|
||||
@@ -131,6 +131,31 @@ class Login
|
||||
// it will be set back to 255
|
||||
/** @var int */
|
||||
private $password_max_length = 255;
|
||||
|
||||
/** @var int minum password length */
|
||||
public const PASSWORD_MIN_LENGTH = 9;
|
||||
/** @var int maxium password lenght */
|
||||
public const PASSWORD_MAX_LENGTH = 255;
|
||||
/** @var string special characters for regex */
|
||||
public const PASSWORD_SPECIAL_RANGE = '@$!%*?&';
|
||||
/** @var string regex for lower case alphabet */
|
||||
public const PASSWORD_LOWER = '(?=.*[a-z])';
|
||||
/** @var string regex for upper case alphabet */
|
||||
public const PASSWORD_UPPER = '(?=.*[A-Z])';
|
||||
/** @var string regex for numbers */
|
||||
public const PASSWORD_NUMBER = '(?=.*\d)';
|
||||
/** @var string regex for special chanagers */
|
||||
public const PASSWORD_SPECIAL = "(?=.*[" . self::PASSWORD_SPECIAL_RANGE . "])";
|
||||
/** @var string regex for fixed allowed characters password regex */
|
||||
public const PASSWORD_REGEX = "/^"
|
||||
. self::PASSWORD_LOWER
|
||||
. self::PASSWORD_UPPER
|
||||
. self::PASSWORD_NUMBER
|
||||
. self::PASSWORD_SPECIAL
|
||||
. "[A-Za-z\d" . self::PASSWORD_SPECIAL_RANGE . "]"
|
||||
. "{" . self::PASSWORD_MIN_LENGTH . "," . self::PASSWORD_MAX_LENGTH . "}"
|
||||
. "$/";
|
||||
|
||||
/** @var array<string> can have several regexes, if nothing set, all is ok */
|
||||
private $password_valid_chars = [
|
||||
// '^(?=.*\d)(?=.*[A-Za-z])[0-9A-Za-z!@#$%]{8,}$',
|
||||
@@ -167,6 +192,12 @@ class Login
|
||||
/** @var bool */
|
||||
private $login_is_ajax_page = false;
|
||||
|
||||
// settings
|
||||
/** @var array<string,mixed> options */
|
||||
private $options = [];
|
||||
/** @var array<string,string> locale options: locale, domain, encoding (opt), path */
|
||||
private $locale = [];
|
||||
|
||||
/** @var \CoreLibs\Debug\Logging logger */
|
||||
public $log;
|
||||
/** @var \CoreLibs\DB\IO database */
|
||||
@@ -183,15 +214,14 @@ class Login
|
||||
* @param \CoreLibs\DB\IO $db Database connection class
|
||||
* @param \CoreLibs\Debug\Logging $log Logging class
|
||||
* @param \CoreLibs\Create\Session $session Session interface class
|
||||
* @param bool $auto_login [default true] Auto login flag, legacy
|
||||
* If set to true will run login
|
||||
* during construction
|
||||
* @param array<string,mixed> $options Login ACL settings
|
||||
* $auto_login [default true] DEPRECATED, moved into options
|
||||
*/
|
||||
public function __construct(
|
||||
\CoreLibs\DB\IO $db,
|
||||
\CoreLibs\Debug\Logging $log,
|
||||
\CoreLibs\Create\Session $session,
|
||||
bool $auto_login = true
|
||||
array $options = []
|
||||
) {
|
||||
// attach db class
|
||||
$this->db = $db;
|
||||
@@ -202,6 +232,13 @@ class Login
|
||||
// attach session class
|
||||
$this->session = $session;
|
||||
|
||||
// set and check options
|
||||
if (false === $this->loginSetOptions($options)) {
|
||||
// on failure, exit
|
||||
echo "<b>Could not set options</b>";
|
||||
$this->loginTerminate(4000);
|
||||
}
|
||||
|
||||
// string key, msg: string, flag: e (error), o (ok)
|
||||
$this->login_error_msg = [
|
||||
'0' => [
|
||||
@@ -339,7 +376,7 @@ class Login
|
||||
$_SESSION['DEFAULT_ACL_LIST_TYPE'] = $this->default_acl_list_type;
|
||||
|
||||
// this will be deprecated
|
||||
if ($auto_login === true) {
|
||||
if ($this->options['auto_login'] === true) {
|
||||
$this->loginMainCall();
|
||||
}
|
||||
}
|
||||
@@ -384,6 +421,183 @@ class Login
|
||||
// **** PRIVATE INTERNAL
|
||||
// *************************************************************************
|
||||
|
||||
/**
|
||||
* Set options
|
||||
* Current allowed
|
||||
* target <string>: site target
|
||||
* debug <bool>
|
||||
* auto_login <bool>: self start login process
|
||||
* db_schema <string>
|
||||
* password_min_length <int>
|
||||
* default_acl_level <int>
|
||||
* logout_target <string>: should default be '' or target path to where
|
||||
* can_change <bool>: can change password (NOT IMPLEMENTED)
|
||||
* forget_flow <boo>: reset password on forget (NOT IMPLEMENTED)
|
||||
* locale_path <string>: absolue path to the locale folder
|
||||
* site_locale <string>: what locale to load
|
||||
* site_domain <string>: what domain (locale file name) to use
|
||||
*
|
||||
* @param array<string,mixed> $options Options array from class load
|
||||
* @return bool True on ok, False on failure
|
||||
*/
|
||||
private function loginSetOptions(array $options): bool
|
||||
{
|
||||
// target and debug flag
|
||||
if (
|
||||
empty($options['target'])
|
||||
) {
|
||||
$options['target'] = 'test';
|
||||
}
|
||||
if (
|
||||
empty($options['debug']) ||
|
||||
!is_bool($options['debug'])
|
||||
) {
|
||||
$options['debug'] = false;
|
||||
}
|
||||
|
||||
// AUTO LOGIN
|
||||
if (
|
||||
!isset($options['auto_login']) ||
|
||||
!is_bool($options['auto_login'])
|
||||
) {
|
||||
// if set to true will run login call during class construction
|
||||
$options['auto_login'] = false;
|
||||
}
|
||||
|
||||
// DB SCHEMA
|
||||
if (
|
||||
empty($options['db_schema']) ||
|
||||
// TODO more strict check
|
||||
is_string($options['db_schema'])
|
||||
) {
|
||||
// get scham from db, else fallback to public
|
||||
if (!empty($this->db->dbGetSchema(true))) {
|
||||
$options['db_schema'] = $this->db->dbGetSchema(true);
|
||||
} else {
|
||||
$options['db_schema'] = 'public';
|
||||
}
|
||||
}
|
||||
if ($this->db->dbGetSchema() != $options['db_schema']) {
|
||||
$this->db->dbSetSchema($options['db_schema']);
|
||||
}
|
||||
|
||||
// MIN PASSWORD LENGTH
|
||||
// can only be in length of current defined min/max
|
||||
if (
|
||||
!empty($options['password_min_lenght']) &&
|
||||
!is_numeric($options['password_min_length']) &&
|
||||
$options['password_min_length'] >= self::PASSWORD_MIN_LENGTH &&
|
||||
$options['password_min_length'] <= self::PASSWORD_MAX_LENGTH
|
||||
) {
|
||||
if (
|
||||
false === $this->loginSetPasswordMinLength(
|
||||
(int)$options['password_min_length']
|
||||
)
|
||||
) {
|
||||
$options['password_min_length'] = self::PASSWORD_MIN_LENGTH;
|
||||
}
|
||||
}
|
||||
|
||||
// DEFAULT ACL LEVEL
|
||||
if (
|
||||
!isset($options['default_acl_level']) ||
|
||||
!is_numeric($options['default_acl_level']) ||
|
||||
$options['default_acl_level'] < 0 || $options['default_acl_level'] > 100
|
||||
) {
|
||||
$options['default_acl_level'] = 0;
|
||||
if (defined('DEFAULT_ACL_LEVEL')) {
|
||||
trigger_error(
|
||||
'loginMainCall: DEFAULT_ACL_LEVEL should not be used',
|
||||
E_USER_DEPRECATED
|
||||
);
|
||||
$options['default_acl_level'] = DEFAULT_ACL_LEVEL;
|
||||
}
|
||||
}
|
||||
$this->default_acl_level = (int)$options['default_acl_level'];
|
||||
|
||||
// LOGOUT TARGET
|
||||
if (!isset($options['logout_target'])) {
|
||||
if (defined('LOGOUT_TARGET')) {
|
||||
trigger_error(
|
||||
'loginMainCall: LOGOUT_TARGET should not be used',
|
||||
E_USER_DEPRECATED
|
||||
);
|
||||
$options['logout_target'] = LOGOUT_TARGET;
|
||||
$this->logout_target = $options['logout_target'];
|
||||
}
|
||||
}
|
||||
|
||||
// *** PASSWORD SETTINGS
|
||||
// User can change password
|
||||
if (
|
||||
!isset($options['can_change']) ||
|
||||
!is_bool($options['can_change'])
|
||||
) {
|
||||
$options['can_change'] = false;
|
||||
}
|
||||
$this->password_change = $options['can_change'];
|
||||
// User can trigger a forgot password flow
|
||||
if (
|
||||
!isset($options['forgot_flow']) ||
|
||||
!is_bool($options['forgot_flow'])
|
||||
) {
|
||||
$options['forgot_flow'] = false;
|
||||
}
|
||||
$this->password_forgot = $options['forgot_flow'];
|
||||
|
||||
// *** LANGUAGE
|
||||
// LANG: LOCALE PATH
|
||||
if (empty($options['locale_path'])) {
|
||||
// trigger deprecation error
|
||||
trigger_error(
|
||||
'loginSetOptions: misssing locale_path entry is deprecated',
|
||||
E_USER_DEPRECATED
|
||||
);
|
||||
// set path
|
||||
$options['locale_path'] = BASE . INCLUDES . LOCALE;
|
||||
$_SESSION['LOCALE_PATH'] = $options['locale_path'];
|
||||
}
|
||||
// LANG: LOCALE
|
||||
if (empty($options['site_locale'])) {
|
||||
trigger_error(
|
||||
'loginMainCall: SITE_LOCALE or DEFAULT_LOCALE should not be used',
|
||||
E_USER_DEPRECATED
|
||||
);
|
||||
$options['site_locale'] = defined('SITE_LOCALE') && !empty(SITE_LOCALE) ?
|
||||
SITE_LOCALE : 'en.UTF-8';
|
||||
}
|
||||
// LANG: DOMAIN
|
||||
if (empty($options['site_domain'])) {
|
||||
// we need to get domain set from outside
|
||||
$options['site_domain'] = 'admin';
|
||||
if (
|
||||
defined('SITE_DOMAIN')
|
||||
) {
|
||||
// trigger deprecation error
|
||||
trigger_error(
|
||||
'loginSetOptions: misssing site_domain entry is deprecated (SITE_DOMAIN)',
|
||||
E_USER_DEPRECATED
|
||||
);
|
||||
// set domain
|
||||
$options['site_domain'] = SITE_DOMAIN;
|
||||
$_SESSION['DEFAULT_DOMAIN'] = $options['site_domain'];
|
||||
} elseif (
|
||||
defined('CONTENT_PATH')
|
||||
) {
|
||||
// trigger deprecation error
|
||||
trigger_error(
|
||||
'loginSetOptions: misssing site_domain entry is deprecated (CONTENT_PATH)',
|
||||
E_USER_DEPRECATED
|
||||
);
|
||||
$options['set_domain'] = str_replace(DIRECTORY_SEPARATOR, '', CONTENT_PATH);
|
||||
}
|
||||
}
|
||||
|
||||
// write array to options
|
||||
$this->options = $options;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks for all flags and sets error codes for each
|
||||
* In order:
|
||||
@@ -980,6 +1194,34 @@ class Login
|
||||
// $this->debug('ACL', $this->print_ar($this->acl));
|
||||
}
|
||||
|
||||
/**
|
||||
* set locale and load mo translator
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function loginSetLocale(): void
|
||||
{
|
||||
// ** LANGUAGE SET AFTER LOGIN **
|
||||
// set the locale
|
||||
if (
|
||||
!empty($_SESSION['DEFAULT_LOCALE'])
|
||||
) {
|
||||
$locale = $_SESSION['DEFAULT_LOCALE'];
|
||||
} else {
|
||||
$locale = $this->options['site_locale'];
|
||||
}
|
||||
$this->locale = [
|
||||
'locale' => $locale,
|
||||
'domain' => $this->options['site_domain'],
|
||||
'path' => $this->options['locale_path'],
|
||||
];
|
||||
$this->l = new \CoreLibs\Language\L10n(
|
||||
$this->locale['locale'],
|
||||
$this->locale['domain'],
|
||||
$this->locale['path']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* checks if the password is in a valid format
|
||||
*
|
||||
@@ -1513,50 +1755,9 @@ EOM;
|
||||
echo '<b>No active session found</b>';
|
||||
$this->loginTerminate(2000);
|
||||
}
|
||||
|
||||
// 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
|
||||
/** @phpstan-ignore-next-line */
|
||||
if (defined('LOGIN_DB_SCHEMA') && !empty(LOGIN_DB_SCHEMA)) {
|
||||
$SCHEMA = LOGIN_DB_SCHEMA;
|
||||
} elseif (!empty($this->db->dbGetSchema(true))) {
|
||||
$SCHEMA = $this->db->dbGetSchema(true);
|
||||
} elseif (defined('PUBLIC_SCHEMA')) {
|
||||
$SCHEMA = PUBLIC_SCHEMA;
|
||||
} else {
|
||||
$SCHEMA = 'public';
|
||||
}
|
||||
// set schema if schema differs to schema set in db conneciton
|
||||
if ($this->db->dbGetSchema() != $SCHEMA) {
|
||||
$this->db->dbExec("SET search_path TO " . $SCHEMA);
|
||||
}
|
||||
|
||||
// set internal page name
|
||||
$this->page_name = $this->loginReadPageName();
|
||||
|
||||
// set default ACL Level
|
||||
if (defined('DEFAULT_ACL_LEVEL')) {
|
||||
$this->default_acl_level = DEFAULT_ACL_LEVEL;
|
||||
}
|
||||
|
||||
if (defined('PASSWORD_MIN_LENGTH')) {
|
||||
$this->password_min_length = PASSWORD_MIN_LENGTH;
|
||||
$this->password_min_length_max = PASSWORD_MIN_LENGTH;
|
||||
}
|
||||
if (defined('PASSWORD_MIN_LENGTH')) {
|
||||
$this->password_max_length = PASSWORD_MAX_LENGTH;
|
||||
}
|
||||
|
||||
// pre-check that password min/max lengths are inbetween 1 and 255;
|
||||
if ($this->password_max_length > 255) {
|
||||
$this->password_max_length = 255;
|
||||
}
|
||||
if ($this->password_min_length < 1) {
|
||||
$this->password_min_length = 1;
|
||||
}
|
||||
|
||||
// set global is ajax page for if we show the data directly,
|
||||
// or need to pass it back
|
||||
// to the continue AJAX class for output back to the user
|
||||
@@ -1608,20 +1809,8 @@ EOM;
|
||||
$this->pw_old_password = $_POST['pw_old_password'] ?? '';
|
||||
$this->pw_new_password = $_POST['pw_new_password'] ?? '';
|
||||
$this->pw_new_password_confirm = $_POST['pw_new_password_confirm'] ?? '';
|
||||
// logout target (from config)
|
||||
if (defined('LOGOUT_TARGET')) {
|
||||
$this->logout_target = LOGOUT_TARGET;
|
||||
}
|
||||
// disallow user list for password change
|
||||
$this->pw_change_deny_users = ['admin'];
|
||||
// set flag if password change is okay
|
||||
if (defined('PASSWORD_CHANGE')) {
|
||||
$this->password_change = PASSWORD_CHANGE;
|
||||
}
|
||||
// NOTE: forgot password flow with email
|
||||
if (defined('PASSWORD_FORGOT')) {
|
||||
$this->password_forgot = PASSWORD_FORGOT;
|
||||
}
|
||||
// max login counts before error reporting
|
||||
$this->max_login_error_count = 10;
|
||||
// users that never get locked, even if they are set strict
|
||||
@@ -1634,26 +1823,7 @@ EOM;
|
||||
// logsout user
|
||||
$this->loginLogoutUser();
|
||||
// ** LANGUAGE SET AFTER LOGIN **
|
||||
// set the locale
|
||||
if (
|
||||
$this->session->checkActiveSession() === true &&
|
||||
!empty($_SESSION['DEFAULT_LOCALE'])
|
||||
) {
|
||||
$locale = $_SESSION['DEFAULT_LOCALE'];
|
||||
} else {
|
||||
$locale = (defined('SITE_LOCALE') && !empty(SITE_LOCALE)) ?
|
||||
SITE_LOCALE :
|
||||
/** @phpstan-ignore-next-line DEFAULT_LOCALE could be empty */
|
||||
((defined('DEFAULT_LOCALE') && !empty(DEFAULT_LOCALE)) ?
|
||||
DEFAULT_LOCALE : 'en.UTF-8');
|
||||
}
|
||||
// set domain
|
||||
if (defined('CONTENT_PATH')) {
|
||||
$domain = str_replace('/', '', CONTENT_PATH);
|
||||
} else {
|
||||
$domain = 'admin';
|
||||
}
|
||||
$this->l = new \CoreLibs\Language\L10n($locale, $domain);
|
||||
$this->loginSetLocale();
|
||||
// if the password change flag is okay, run the password change method
|
||||
if ($this->password_change) {
|
||||
$this->loginPasswordChange();
|
||||
@@ -1669,18 +1839,21 @@ EOM;
|
||||
// if variable AJAX flag is not set, show output
|
||||
// else pass through for ajax work
|
||||
if ($this->login_is_ajax_page === false) {
|
||||
// the login screen if we hav no login permission & login screen html data
|
||||
// the login screen if we hav no login permission and
|
||||
// login screen html data
|
||||
if ($this->login_html !== null) {
|
||||
// echo $this->login_html;
|
||||
$this->loginPrintLogin();
|
||||
}
|
||||
// do not go anywhere, quit processing here
|
||||
// do something with possible debug data?
|
||||
if (TARGET == 'live' || TARGET == 'remote') {
|
||||
if (
|
||||
in_array($this->options['target'], ['live', 'remove'])
|
||||
) {
|
||||
// login
|
||||
$this->log->setLogLevelAll('debug', DEBUG ? true : false);
|
||||
$this->log->setLogLevelAll('debug', $this->options['debug']);
|
||||
$this->log->setLogLevelAll('echo', false);
|
||||
$this->log->setLogLevelAll('print', DEBUG ? true : false);
|
||||
$this->log->setLogLevelAll('print', $this->options['debug']);
|
||||
}
|
||||
$status_msg = $this->log->printErrorMsg();
|
||||
// if ($this->echo_output_all) {
|
||||
@@ -1802,7 +1975,7 @@ EOM;
|
||||
if (
|
||||
$length >= $this->password_min_length_max &&
|
||||
$length <= $this->password_max_length &&
|
||||
$length <= 255
|
||||
$length <= self::PASSWORD_MAX_LENGTH
|
||||
) {
|
||||
$this->password_min_length = $length;
|
||||
return true;
|
||||
|
||||
@@ -128,7 +128,8 @@ class Backend
|
||||
\CoreLibs\Debug\Logging $log,
|
||||
\CoreLibs\Create\Session $session,
|
||||
\CoreLibs\Language\L10n $l10n,
|
||||
array $locale
|
||||
array $locale,
|
||||
?int $set_default_acl_level = null
|
||||
) {
|
||||
// attach db class
|
||||
$this->db = $db;
|
||||
@@ -156,7 +157,14 @@ class Backend
|
||||
$this->$_action = $_POST[$_action] ?? '';
|
||||
}
|
||||
|
||||
$this->default_acl = DEFAULT_ACL_LEVEL;
|
||||
if ($set_default_acl_level === null) {
|
||||
/** @deprecated Admin::__construct missing default_acl_level parameter */
|
||||
trigger_error(
|
||||
'Calling Admin::__construct without default_acl_level parameter is deprecated',
|
||||
E_USER_DEPRECATED
|
||||
);
|
||||
}
|
||||
$this->default_acl = $set_default_acl_level ?? DEFAULT_ACL_LEVEL;
|
||||
|
||||
// queue key
|
||||
if (preg_match("/^(add|save|delete|remove|move|up|down|push_live)$/", $this->action)) {
|
||||
@@ -190,35 +198,34 @@ class Backend
|
||||
* @param string $event any kind of event description,
|
||||
* @param string|array<mixed> $data any kind of data related to that event
|
||||
* @param string $write_type write type can bei STRING or BINARY
|
||||
* @param string|null $db_schema override target schema
|
||||
* @return void
|
||||
*/
|
||||
public function adbEditLog(
|
||||
string $event = '',
|
||||
string|array $data = '',
|
||||
string $write_type = 'STRING'
|
||||
string $write_type = 'STRING',
|
||||
?string $db_schema = null
|
||||
): void {
|
||||
$data_binary = '';
|
||||
$data_write = '';
|
||||
if ($write_type == 'BINARY') {
|
||||
$data_binary = $this->db->dbEscapeBytea((string)bzcompress(serialize($data)));
|
||||
$data = 'see bzip compressed data_binary field';
|
||||
$data_write = 'see bzip compressed data_binary field';
|
||||
}
|
||||
if ($write_type == 'STRING') {
|
||||
$data_binary = '';
|
||||
$data = $this->db->dbEscapeString(serialize($data));
|
||||
$data_write = $this->db->dbEscapeString(serialize($data));
|
||||
}
|
||||
|
||||
// check schema
|
||||
$SCHEMA = 'public';
|
||||
/** @phpstan-ignore-next-line */
|
||||
if (defined('LOGIN_DB_SCHEMA') && !empty(LOGIN_DB_SCHEMA)) {
|
||||
$SCHEMA = LOGIN_DB_SCHEMA;
|
||||
} elseif ($this->db->dbGetSchema()) {
|
||||
$SCHEMA = $this->db->dbGetSchema();
|
||||
} elseif (defined('PUBLIC_SCHEMA')) {
|
||||
$SCHEMA = PUBLIC_SCHEMA;
|
||||
/** @var string $DB_SCHEMA check schema */
|
||||
$DB_SCHEMA = 'public';
|
||||
if ($db_schema !== null) {
|
||||
$DB_SCHEMA = $db_schema;
|
||||
} elseif (!empty($this->db->dbGetSchema())) {
|
||||
$DB_SCHEMA = $this->db->dbGetSchema();
|
||||
}
|
||||
/** @phpstan-ignore-next-line for whatever reason $SCHEMA is seen as possible array */
|
||||
$q = "INSERT INTO " . $SCHEMA . ".edit_log "
|
||||
$q = "INSERT INTO " . $DB_SCHEMA . ".edit_log "
|
||||
. "(euid, event_date, event, data, data_binary, page, "
|
||||
. "ip, user_agent, referer, script_name, query_string, server_name, http_host, "
|
||||
. "http_accept, http_accept_charset, http_accept_encoding, session_id, "
|
||||
@@ -229,10 +236,12 @@ class Backend
|
||||
'NULL')
|
||||
. ", "
|
||||
. "NOW(), "
|
||||
. "'" . $this->db->dbEscapeString((string)$event) . "', '" . $data . "', "
|
||||
. "'" . $data_binary . "', '" . $this->db->dbEscapeString((string)$this->page_name) . "', "
|
||||
. "'" . @$_SERVER["REMOTE_ADDR"] . "', "
|
||||
. "'" . $this->db->dbEscapeString(@$_SERVER['HTTP_USER_AGENT']) . "', "
|
||||
. "'" . $this->db->dbEscapeString((string)$event) . "', "
|
||||
. "'" . $data_write . "', "
|
||||
. "'" . $data_binary . "', "
|
||||
. "'" . $this->db->dbEscapeString((string)$this->page_name) . "', "
|
||||
. "'" . ($_SERVER["REMOTE_ADDR"] ?? '') . "', "
|
||||
. "'" . $this->db->dbEscapeString($_SERVER['HTTP_USER_AGENT'] ?? '') . "', "
|
||||
. "'" . $this->db->dbEscapeString($_SERVER['HTTP_REFERER'] ?? '') . "', "
|
||||
. "'" . $this->db->dbEscapeString($_SERVER['SCRIPT_FILENAME'] ?? '') . "', "
|
||||
. "'" . $this->db->dbEscapeString($_SERVER['QUERY_STRING'] ?? '') . "', "
|
||||
@@ -282,11 +291,25 @@ class Backend
|
||||
/**
|
||||
* menu creater (from login menu session pages)
|
||||
*
|
||||
* @param int $flag visible flag trigger
|
||||
* @param string|null $set_content_path
|
||||
* @param int $flag visible flag trigger
|
||||
* @return array<mixed> menu array for output on page (smarty)
|
||||
*/
|
||||
public function adbTopMenu(int $flag = 0): array
|
||||
{
|
||||
public function adbTopMenu(
|
||||
?string $set_content_path = null,
|
||||
int $flag = 0,
|
||||
): array {
|
||||
if (
|
||||
$set_content_path === null ||
|
||||
!is_string($set_content_path)
|
||||
) {
|
||||
/** @deprecated adbTopMenu missing set_content_path parameter */
|
||||
trigger_error(
|
||||
'Calling adbTopMenu without set_content_path parameter is deprecated',
|
||||
E_USER_DEPRECATED
|
||||
);
|
||||
}
|
||||
$set_content_path = $set_content_path ?? CONTENT_PATH;
|
||||
if ($this->menu_show_flag) {
|
||||
$flag = $this->menu_show_flag;
|
||||
}
|
||||
@@ -377,7 +400,7 @@ class Backend
|
||||
\CoreLibs\Get\System::getPageName() == $data['filename'] &&
|
||||
(!isset($data['hostname']) || (
|
||||
isset($data['hostname']) &&
|
||||
(!$data['hostname'] || strstr($data['hostname'], CONTENT_PATH) !== false)
|
||||
(!$data['hostname'] || strstr($data['hostname'], $set_content_path) !== false)
|
||||
))
|
||||
) {
|
||||
$selected = 1;
|
||||
@@ -427,69 +450,6 @@ class Backend
|
||||
};
|
||||
return $enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* creates out of a normal db_return array an assoc array
|
||||
*
|
||||
* @param array<mixed> $db_array input array
|
||||
* @param string|int|bool $key key
|
||||
* @param string|int|bool $value value
|
||||
* @return array<mixed> associative array
|
||||
* @deprecated \CoreLibs\Combined\ArrayHandler::genAssocArray()
|
||||
*/
|
||||
public function adbAssocArray(array $db_array, string|int|bool $key, string|int|bool $value): array
|
||||
{
|
||||
trigger_error(
|
||||
'Method ' . __METHOD__ . ' is deprecated: \CoreLibs\Combined\ArrayHandler::genAssocArray',
|
||||
E_USER_DEPRECATED
|
||||
);
|
||||
return \CoreLibs\Combined\ArrayHandler::genAssocArray($db_array, $key, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* converts bytes into formated string with KB, MB, etc
|
||||
*
|
||||
* @param string|int|float $number string or int or number
|
||||
* @return string formatted string
|
||||
* @deprecated \CoreLibs\Convert\Byte::humanReadableByteFormat()
|
||||
*/
|
||||
public function adbByteStringFormat(string|int|float $number): string
|
||||
{
|
||||
trigger_error(
|
||||
'Method ' . __METHOD__ . ' is deprecated: \CoreLibs\Convert\Byte::humanReadableByteFormat()',
|
||||
E_USER_DEPRECATED
|
||||
);
|
||||
return \CoreLibs\Convert\Byte::humanReadableByteFormat($number);
|
||||
}
|
||||
|
||||
/**
|
||||
* converts picture to a thumbnail with max x and max y size
|
||||
*
|
||||
* @param string $pic source image file with or without path
|
||||
* @param int $size_x maximum size width
|
||||
* @param int $size_y maximum size height
|
||||
* @param string $dummy empty, or file_type to show an icon
|
||||
* instead of nothing if file is not found
|
||||
* @param string $path if source start is not ROOT path
|
||||
* if empty ROOT is choosen
|
||||
* @return string|bool thumbnail name, or false for error
|
||||
* @deprecated \CoreLibs\Output\Image::createThumbnail()
|
||||
*/
|
||||
public function adbCreateThumbnail(
|
||||
string $pic,
|
||||
int $size_x,
|
||||
int $size_y,
|
||||
string $dummy = '',
|
||||
string $path = '',
|
||||
string $cache = ''
|
||||
): string|bool {
|
||||
trigger_error(
|
||||
'Method ' . __METHOD__ . ' is deprecated: \CoreLibs\Output\Image::createThumbnail()',
|
||||
E_USER_DEPRECATED
|
||||
);
|
||||
return \CoreLibs\Output\Image::createThumbnail($pic, $size_x, $size_y, $dummy, $path, $cache);
|
||||
}
|
||||
|
||||
/**
|
||||
* wrapper function to fill up the mssages array
|
||||
*
|
||||
@@ -523,15 +483,16 @@ class Backend
|
||||
/**
|
||||
* writes live queue
|
||||
*
|
||||
* @param string $queue_key string to identfy the queue
|
||||
* @param string $type [description]
|
||||
* @param string $target [description]
|
||||
* @param string $data [description]
|
||||
* @param string $key_name [description]
|
||||
* @param string $key_value [description]
|
||||
* @param ?string $associate [description]
|
||||
* @param ?string $file [description]
|
||||
* @return void has no return
|
||||
* @param string $queue_key string to identfy the queue
|
||||
* @param string $type [description]
|
||||
* @param string $target [description]
|
||||
* @param string $data [description]
|
||||
* @param string $key_name [description]
|
||||
* @param string $key_value [description]
|
||||
* @param string|null $associate [description]
|
||||
* @param string|null $file [description]
|
||||
* @param string|null $db_schema override target schema
|
||||
* @return void
|
||||
*/
|
||||
public function adbLiveQueue(
|
||||
string $queue_key,
|
||||
@@ -541,19 +502,17 @@ class Backend
|
||||
string $key_name,
|
||||
string $key_value,
|
||||
string $associate = null,
|
||||
string $file = null
|
||||
string $file = null,
|
||||
string $db_schema = null,
|
||||
): void {
|
||||
/** @phpstan-ignore-next-line */
|
||||
if (defined('GLOBAL_DB_SCHEMA') && !empty(GLOBAL_DB_SCHEMA)) {
|
||||
$SCHEMA = GLOBAL_DB_SCHEMA;
|
||||
} elseif ($this->db->dbGetSchema()) {
|
||||
$SCHEMA = $this->db->dbGetSchema();
|
||||
} elseif (defined('PUBLIC_SCHEMA')) {
|
||||
$SCHEMA = PUBLIC_SCHEMA;
|
||||
} else {
|
||||
$SCHEMA = 'public';
|
||||
/** @var string $DB_SCHEMA check schema */
|
||||
$DB_SCHEMA = 'public';
|
||||
if ($db_schema !== null) {
|
||||
$DB_SCHEMA = $db_schema;
|
||||
} elseif (!empty($this->db->dbGetSchema())) {
|
||||
$DB_SCHEMA = $this->db->dbGetSchema();
|
||||
}
|
||||
$q = "INSERT INTO " . $SCHEMA . ".live_queue ("
|
||||
$q = "INSERT INTO " . $DB_SCHEMA . ".live_queue ("
|
||||
. "queue_key, key_value, key_name, type, target, data, group_key, action, associate, file"
|
||||
. ") VALUES ("
|
||||
. "'" . $this->db->dbEscapeString($queue_key) . "', '" . $this->db->dbEscapeString($key_value) . "', "
|
||||
|
||||
@@ -228,10 +228,14 @@ class EditBase
|
||||
/**
|
||||
* all edit pages
|
||||
*
|
||||
* @param string $set_root
|
||||
* @param string $set_content_path
|
||||
* @return void
|
||||
*/
|
||||
private function editPageFlow(): void
|
||||
{
|
||||
private function editPageFlow(
|
||||
string $set_root,
|
||||
string $set_content_path,
|
||||
): void {
|
||||
// set table width
|
||||
$table_width = '100%';
|
||||
// load call only if id is set
|
||||
@@ -334,7 +338,7 @@ class EditBase
|
||||
$menu_element['filename'] == \CoreLibs\Get\System::getPageName() &&
|
||||
(!isset($menu_element['hostname']) || (
|
||||
isset($menu_element['hostname']) &&
|
||||
(!$menu_element['hostname'] || strstr($menu_element['hostname'], CONTENT_PATH) !== false)
|
||||
(!$menu_element['hostname'] || strstr($menu_element['hostname'], $set_content_path) !== false)
|
||||
))
|
||||
) {
|
||||
$position = $i;
|
||||
@@ -431,7 +435,7 @@ class EditBase
|
||||
$search_glob = [];
|
||||
foreach ($folders as $folder) {
|
||||
// make sure this folder actually exists
|
||||
if (is_dir(ROOT . $folder)) {
|
||||
if (is_dir($set_root . $folder)) {
|
||||
foreach ($files as $file) {
|
||||
$search_glob[] = $folder . $file;
|
||||
}
|
||||
@@ -534,31 +538,74 @@ class EditBase
|
||||
* @throws Exception
|
||||
* @throws SmartyException
|
||||
*/
|
||||
public function editBaseRun(): void
|
||||
{
|
||||
public function editBaseRun(
|
||||
?string $template_dir = null,
|
||||
?string $compile_dir = null,
|
||||
?string $cache_dir = null,
|
||||
?string $set_admin_stylesheet = null,
|
||||
?string $set_default_encoding = null,
|
||||
?string $set_css = null,
|
||||
?string $set_js = null,
|
||||
?string $set_root = null,
|
||||
?string $set_content_path = null
|
||||
): void {
|
||||
// trigger deprecated warning
|
||||
if (
|
||||
$template_dir === null ||
|
||||
$compile_dir === null ||
|
||||
$cache_dir === null ||
|
||||
$set_admin_stylesheet === null ||
|
||||
$set_default_encoding === null ||
|
||||
$set_css === null ||
|
||||
$set_js === null ||
|
||||
$set_root === null ||
|
||||
$set_content_path === null
|
||||
) {
|
||||
/** @deprecated editBaseRun call without parameters */
|
||||
trigger_error(
|
||||
'Calling editBaseRun without paramters is deprecated',
|
||||
E_USER_DEPRECATED
|
||||
);
|
||||
}
|
||||
// set vars (to be deprecated)
|
||||
$template_dir = $template_dir ?? BASE . INCLUDES . TEMPLATES . CONTENT_PATH;
|
||||
$compile_dir = $compile_dir ?? BASE . TEMPLATES_C;
|
||||
$cache_dir = $cache_dir ?? BASE . CACHE;
|
||||
$set_admin_stylesheet = $set_admin_stylesheet ?? ADMIN_STYLESHEET;
|
||||
$set_default_encoding = $set_default_encoding ?? DEFAULT_ENCODING;
|
||||
$set_css = $set_css ?? LAYOUT . CSS;
|
||||
$set_css = $set_js ?? LAYOUT . JS;
|
||||
$set_root = $set_root ?? ROOT;
|
||||
$set_content_path = $set_content_path ?? CONTENT_PATH;
|
||||
|
||||
// set the template dir
|
||||
// WARNING: this has a special check for the mailing tool layout (old layout)
|
||||
if (defined('LAYOUT')) {
|
||||
$this->smarty->setTemplateDir(BASE . INCLUDES . TEMPLATES . CONTENT_PATH);
|
||||
$this->DATA['css'] = LAYOUT . CSS;
|
||||
$this->DATA['js'] = LAYOUT . JS;
|
||||
} else {
|
||||
// WARNING: this has a special check for the mailing tool layout (old no layout folder)
|
||||
if (!defined('LAYOUT')) {
|
||||
trigger_error(
|
||||
'EditBase with unset LAYOUT is deprecated',
|
||||
E_USER_DEPRECATED
|
||||
);
|
||||
$this->smarty->setTemplateDir(TEMPLATES);
|
||||
$this->DATA['css'] = CSS;
|
||||
$this->DATA['js'] = JS;
|
||||
} else {
|
||||
$this->smarty->setTemplateDir($template_dir);
|
||||
$this->DATA['css'] = $set_css;
|
||||
$this->DATA['js'] = $set_js;
|
||||
}
|
||||
$ADMIN_STYLESHEET = 'edit.css';
|
||||
// define all needed smarty stuff for the general HTML/page building
|
||||
$this->HEADER['CSS'] = CSS;
|
||||
$this->HEADER['DEFAULT_ENCODING'] = DEFAULT_ENCODING;
|
||||
/** @phpstan-ignore-next-line because ADMIN_STYLESHEET can be null */
|
||||
$this->HEADER['STYLESHEET'] = $ADMIN_STYLESHEET ?? ADMIN_STYLESHEET;
|
||||
$this->HEADER['CSS'] = $set_css;
|
||||
$this->HEADER['DEFAULT_ENCODING'] = $set_default_encoding;
|
||||
$this->HEADER['STYLESHEET'] = $set_admin_stylesheet;
|
||||
|
||||
// main run
|
||||
if ($this->form->my_page_name == 'edit_order') {
|
||||
$this->editOrderPage();
|
||||
} else {
|
||||
$this->editPageFlow();
|
||||
$this->editPageFlow(
|
||||
$set_root,
|
||||
$set_content_path
|
||||
);
|
||||
}
|
||||
|
||||
// debug data, if DEBUG flag is on, this data is print out
|
||||
@@ -571,11 +618,11 @@ class EditBase
|
||||
foreach ($CONTENT_DATA as $key => $value) {
|
||||
$this->smarty->assign($key, $value);
|
||||
}
|
||||
if (is_dir(BASE . TEMPLATES_C)) {
|
||||
$this->smarty->setCompileDir(BASE . TEMPLATES_C);
|
||||
if (is_dir($compile_dir)) {
|
||||
$this->smarty->setCompileDir($compile_dir);
|
||||
}
|
||||
if (is_dir(BASE . CACHE)) {
|
||||
$this->smarty->setCacheDir(BASE . CACHE);
|
||||
if (is_dir($cache_dir)) {
|
||||
$this->smarty->setCacheDir($cache_dir);
|
||||
}
|
||||
$this->smarty->display(
|
||||
$this->EDIT_TEMPLATE,
|
||||
|
||||
@@ -989,7 +989,7 @@ class Basic
|
||||
int $jpeg_quality = 80
|
||||
) {
|
||||
trigger_error('Method ' . __METHOD__ . ' is deprecated, use \CoreLibs\Output\Image::createThumbnailSimple()', E_USER_DEPRECATED);
|
||||
return \CoreLibs\Output\Image::createThumbnailSimple($filename, $thumb_width, $thumb_height, $thumbnail_path, $create_dummy, $use_cache, $high_quality, $jpeg_quality);
|
||||
return \CoreLibs\Output\Image::createThumbnailSimple($filename, $thumb_width, $thumb_height, $thumbnail_path, null, $create_dummy, $use_cache, $high_quality, $jpeg_quality);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -90,33 +90,6 @@ class Hash
|
||||
{
|
||||
return hash(self::STANDARD_HASH_LONG, $string);
|
||||
}
|
||||
|
||||
/**
|
||||
* create a unique id with the standard hash type defined in __hash
|
||||
*
|
||||
* @return string Unique ID with fixed length of 8 characters
|
||||
* @deprecated Use \CoreLibs\Create\Uids::uniqIdShort() instead
|
||||
*/
|
||||
public static function __uniqId(): string
|
||||
{
|
||||
trigger_error('Method ' . __METHOD__ . ' is deprecated, '
|
||||
. '\CoreLibs\Create\Uids::uniqIdShort() class', E_USER_DEPRECATED);
|
||||
return \CoreLibs\Create\Uids::uniqIdShort();
|
||||
}
|
||||
|
||||
/**
|
||||
* create a unique id with the standard long hash type
|
||||
* defined in __hashLong
|
||||
*
|
||||
* @return string Unique ID with length of current default long hash
|
||||
* @deprecated Use \CoreLibs\Create\Uids::uniqIdLong() instead
|
||||
*/
|
||||
public static function __uniqIdLong(): string
|
||||
{
|
||||
trigger_error('Method ' . __METHOD__ . ' is deprecated, '
|
||||
. '\CoreLibs\Create\Uids::uniqIdLong() class', E_USER_DEPRECATED);
|
||||
return \CoreLibs\Create\Uids::uniqIdLong();
|
||||
}
|
||||
}
|
||||
|
||||
// __END__
|
||||
|
||||
@@ -57,7 +57,7 @@ class ArrayIO extends \CoreLibs\DB\IO
|
||||
* @param array<mixed> $db_config db connection config
|
||||
* @param array<mixed> $table_array table array config
|
||||
* @param string $table_name table name string
|
||||
* @param \CoreLibs\Debug\Logging|null $log Logging class, default set if not set
|
||||
* @param \CoreLibs\Debug\Logging $log Logging class
|
||||
* @param int $base_acl_level Set base acl level, if needed
|
||||
* @param int $acl_admin Flag if this is an admin ACL access level
|
||||
*/
|
||||
@@ -65,12 +65,12 @@ class ArrayIO extends \CoreLibs\DB\IO
|
||||
array $db_config,
|
||||
array $table_array,
|
||||
string $table_name,
|
||||
\CoreLibs\Debug\Logging $log = null,
|
||||
\CoreLibs\Debug\Logging $log,
|
||||
int $base_acl_level = 0,
|
||||
int $acl_admin = 0
|
||||
) {
|
||||
// instance db_io class
|
||||
parent::__construct($db_config, $log ?? new \CoreLibs\Debug\Logging());
|
||||
parent::__construct($db_config, $log);
|
||||
// more error vars for this class
|
||||
$this->error_string['1999'] = 'No table array or table name set';
|
||||
$this->error_string['1021'] = 'No Primary Key given';
|
||||
|
||||
@@ -378,16 +378,16 @@ class IO
|
||||
/**
|
||||
* main DB concstructor with auto connection to DB and failure set on failed connection
|
||||
* @param array<mixed> $db_config DB configuration array
|
||||
* @param \CoreLibs\Debug\Logging|null $log Logging class
|
||||
* @param \CoreLibs\Debug\Logging $log Logging class
|
||||
* @param bool|null $db_debug_override Overrides debug settings in db_config
|
||||
*/
|
||||
public function __construct(
|
||||
array $db_config,
|
||||
?\CoreLibs\Debug\Logging $log = null,
|
||||
\CoreLibs\Debug\Logging $log,
|
||||
?bool $db_debug_override = null
|
||||
) {
|
||||
// attach logger
|
||||
$this->log = $log ?? new \CoreLibs\Debug\Logging();
|
||||
$this->log = $log;
|
||||
// sets the names (for connect/reconnect)
|
||||
$this->db_name = $db_config['db_name'] ?? '';
|
||||
$this->db_user = $db_config['db_user'] ?? '';
|
||||
@@ -3245,114 +3245,6 @@ class IO
|
||||
return $this->dbGetInsertPK();
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the db init error
|
||||
* if failed to connect it is set to true
|
||||
* else false
|
||||
* @return bool connection failure status
|
||||
* @deprecated Use dbGetConnectionStatus() and True means correct connection
|
||||
*/
|
||||
public function getConnectionStatus(): bool
|
||||
{
|
||||
trigger_error('Method ' . __METHOD__ . ' is deprecated, '
|
||||
. 'use dbGetConnectionStatus() with True for successful connection', E_USER_DEPRECATED);
|
||||
// reverse because before it was reverse
|
||||
return $this->dbGetConnectionStatus() ? false : true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets error number that was last
|
||||
* So we always have the last error number stored even if a new one is created
|
||||
* @return int last error number
|
||||
* @deprecated Use dbGetLastError()
|
||||
*/
|
||||
public function getHadError(): int
|
||||
{
|
||||
trigger_error('Method ' . __METHOD__ . ' is deprecated, use dbGetLastError()', E_USER_DEPRECATED);
|
||||
return (int)$this->dbGetLastError();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets warning number that was last
|
||||
* So we always have the last warning number stored even if a new one is created
|
||||
* @return int last error number
|
||||
* @deprecated Use dbGetLastWarning()
|
||||
*/
|
||||
public function getHadWarning(): int
|
||||
{
|
||||
trigger_error('Method ' . __METHOD__ . ' is deprecated, use dbGetLastWarning()', E_USER_DEPRECATED);
|
||||
return (int)$this->dbGetLastWarning();
|
||||
}
|
||||
|
||||
/**
|
||||
* old call for getInserReturnExt
|
||||
* @param string|null $key See above
|
||||
* @return array<mixed>|string|int|bool|null See above
|
||||
* @deprecated use getReturningExt($key = null) instead
|
||||
*/
|
||||
public function getInsertReturn(?string $key = null): array|string|int|bool|null
|
||||
{
|
||||
trigger_error('Method ' . __METHOD__ . ' is deprecated, use getReturningExt($key = null)', E_USER_DEPRECATED);
|
||||
return $this->dbGetReturningExt($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* DEPRECATED: getReturning
|
||||
* @return array<mixed>|string|int|bool|null [DEPRECATED]
|
||||
* @deprecated use dbGetReturning() instead
|
||||
*/
|
||||
public function getReturning(): array|string|int|bool|null
|
||||
{
|
||||
trigger_error('Method ' . __METHOD__ . ' is deprecated, use dbGetReturning()', E_USER_DEPRECATED);
|
||||
return $this->dbGetInsertPK();
|
||||
}
|
||||
|
||||
/**
|
||||
* DEPRECATED: getInsertPK
|
||||
* @return array<mixed>|string|int|bool|null [DEPRECATED]
|
||||
* @deprecated use dbGetInsertPK() instead
|
||||
*/
|
||||
public function getInsertPK(): array|string|int|bool|null
|
||||
{
|
||||
trigger_error('Method ' . __METHOD__ . ' is deprecated, use dbGetInsertPK()', E_USER_DEPRECATED);
|
||||
return $this->dbGetInsertPK();
|
||||
}
|
||||
|
||||
/**
|
||||
* DEPRECATED: getReturningExt
|
||||
* @param string|null $key [DEPRECATED]
|
||||
* @return array<mixed>|string|bool|int|null [DEPRECATED]
|
||||
* @deprecated use dbGetReturningExt($key = null) instead
|
||||
*/
|
||||
public function getReturningExt(?string $key = null): array|string|int|bool|null
|
||||
{
|
||||
trigger_error('Method ' . __METHOD__ . ' is deprecated, use dbGetReturningExt($key = null)', E_USER_DEPRECATED);
|
||||
return $this->dbGetReturningExt($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* DEPRECATED: getCursorExt
|
||||
* @param string|null $q [DEPRECATED]
|
||||
* @return array<mixed>|string|int|\PgSql\Result|null [DEPRECATED]
|
||||
* @deprecated use dbGetCursorExt($q = null) instead
|
||||
*/
|
||||
public function getCursorExt(?string $q = null): array|string|int|\PgSql\Result|null
|
||||
{
|
||||
trigger_error('Method ' . __METHOD__ . ' is deprecated, use dbGetCursorExt($q = null)', E_USER_DEPRECATED);
|
||||
return $this->dbGetCursorExt($q);
|
||||
}
|
||||
|
||||
/**
|
||||
* DEPRECATED: getNumRows
|
||||
* @return int|null [DEPRECATED]
|
||||
* @deprecated use dbGetNumRows() instead
|
||||
*/
|
||||
public function getNumRows(): ?int
|
||||
{
|
||||
trigger_error('Method ' . __METHOD__ . ' is deprecated, use dbGetNumRows()', E_USER_DEPRECATED);
|
||||
return $this->dbGetNumRows();
|
||||
}
|
||||
|
||||
// end if db class
|
||||
}
|
||||
|
||||
|
||||
@@ -75,6 +75,11 @@ class FileWriter
|
||||
empty(self::$debug_folder) &&
|
||||
defined('BASE') && defined('LOG')
|
||||
) {
|
||||
/** @deprecated Do not use this anymore, define path with fsetFolder */
|
||||
trigger_error(
|
||||
'fsetFolder must be set first. Setting via LOG_FILE_ID and LOg constants is deprecated',
|
||||
E_USER_DEPRECATED
|
||||
);
|
||||
self::$debug_folder = BASE . LOG;
|
||||
}
|
||||
if (!is_writeable(self::$debug_folder)) {
|
||||
|
||||
@@ -136,6 +136,11 @@ class Logging
|
||||
$this->log_folder = $this->options['log_folder'] ?? '';
|
||||
// legacy flow, check must set constants
|
||||
if (empty($this->log_folder) && defined('BASE') && defined('LOG')) {
|
||||
/** @deprecated Do not use this anymore, define path on class load */
|
||||
trigger_error(
|
||||
'options: log_folder must be set. Setting via BASE and LOG constants is deprecated',
|
||||
E_USER_DEPRECATED
|
||||
);
|
||||
// make sure this is writeable, else skip
|
||||
$this->log_folder = BASE . LOG;
|
||||
}
|
||||
@@ -175,6 +180,11 @@ class Logging
|
||||
if (!empty($this->options['file_id'])) {
|
||||
$this->setLogId($this->options['file_id']);
|
||||
} elseif (!empty($GLOBALS['LOG_FILE_ID'])) {
|
||||
/** @deprecated Do not use this anymore, define file_id on class load */
|
||||
trigger_error(
|
||||
'options: file_id must be set. Setting via LOG_FILE_ID global variable is deprecated',
|
||||
E_USER_DEPRECATED
|
||||
);
|
||||
// legacy flow, should be removed and only set via options
|
||||
$this->setLogId($GLOBALS['LOG_FILE_ID']);
|
||||
// TODO trigger deprecation error
|
||||
@@ -183,6 +193,11 @@ class Logging
|
||||
// E_USER_DEPRECATED
|
||||
// );
|
||||
} elseif (defined('LOG_FILE_ID')) {
|
||||
/** @deprecated Do not use this anymore, define file_id on class load */
|
||||
trigger_error(
|
||||
'options: file_id must be set. Setting via LOG_FILE_ID constant is deprecated',
|
||||
E_USER_DEPRECATED
|
||||
);
|
||||
// legacy flow, should be removed and only set via options
|
||||
$this->setLogId(LOG_FILE_ID);
|
||||
// trigger deprecation error
|
||||
|
||||
@@ -4,6 +4,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace CoreLibs\Get;
|
||||
|
||||
// NOTE: it is recommended to use gullvek\dotenv instead which is a copy of this
|
||||
|
||||
class DotEnv
|
||||
{
|
||||
/** @var string constant comment char, set to # */
|
||||
@@ -29,11 +31,17 @@ class DotEnv
|
||||
* 1 for file loadable, no data or data already loaded
|
||||
* 2 for file not readable or open failed
|
||||
* 3 for file not found
|
||||
* @deprecated Use composer package gullevek\dotenv instead -> \gullevek\dotenv\DotEnv::readEnvFile(...)
|
||||
*/
|
||||
public static function readEnvFile(
|
||||
string $path = __DIR__,
|
||||
string $env_file = '.env'
|
||||
): int {
|
||||
trigger_error(
|
||||
'\CoreLibs\Get\DotEnv is deprecated in favor for '
|
||||
. 'composer package gullevek\dotenv which is a copy of this',
|
||||
E_USER_DEPRECATED
|
||||
);
|
||||
// default -1;
|
||||
$status = -1;
|
||||
$env_file_target = $path . DIRECTORY_SEPARATOR . $env_file;
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace CoreLibs\Get;
|
||||
|
||||
/**
|
||||
* @deprecated use \CoreLibs\Get\DotEnv instead
|
||||
*/
|
||||
class ReadEnvFile
|
||||
{
|
||||
/**
|
||||
* parses .env file
|
||||
*
|
||||
* Rules for .env file
|
||||
* variable is any alphanumeric string followed by = on the same line
|
||||
* content starts with the first non space part
|
||||
* strings can be contained in "
|
||||
* strings MUST be contained in " if they are multiline
|
||||
* if string starts with " it will match until another " is found
|
||||
* anything AFTER " is ignored
|
||||
* if there are two variables with the same name only the first is used
|
||||
* variables are case sensitive
|
||||
*
|
||||
* @param string $path Folder to file, default is __DIR__
|
||||
* @param string $env_file What file to load, default is .env
|
||||
* @return int -1 other error
|
||||
* 0 for success full load
|
||||
* 1 for file loadable, but no data inside
|
||||
* 2 for file not readable or open failed
|
||||
* 3 for file not found
|
||||
* @deprecated Use \CoreLibs\Get\DotEnv::readEnvFile() instead
|
||||
*/
|
||||
public static function readEnvFile(
|
||||
string $path = __DIR__,
|
||||
string $env_file = '.env'
|
||||
): int {
|
||||
return \CoreLibs\Get\DotEnv::readEnvFile($path, $env_file);
|
||||
}
|
||||
}
|
||||
|
||||
// __END__
|
||||
@@ -1,127 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* deprecated function calls
|
||||
* Language\Encoding::__mbMimeEncode -> Convert\MimeEncode::__mbMimeEncode
|
||||
* Langauge\Encoding::checkConvertEncoding -> Check\Encoding::checkConvertEncoding
|
||||
* Langauge\Encoding::setErrorChar -> Check\Encoding::setErrorChar
|
||||
* Langauge\Encoding::getErrorChar -> Check\Encoding::getErrorChar
|
||||
* Langauge\Encoding::convertEncoding -> Convert\Encoding::convertEncoding
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace CoreLibs\Language;
|
||||
|
||||
class Encoding
|
||||
{
|
||||
/**
|
||||
* wrapper function for mb mime convert
|
||||
* for correct conversion with long strings
|
||||
*
|
||||
* @param string $string string to encode
|
||||
* @param string $encoding target encoding
|
||||
* @param string $line_break default line break is \r\n
|
||||
* @return string encoded string
|
||||
* @deprecated Use \CoreLibs\Convert\MimeEncode::__mbMimeEncode();
|
||||
*/
|
||||
public static function __mbMimeEncode(
|
||||
string $string,
|
||||
string $encoding,
|
||||
string $line_break = "\r\n"
|
||||
): string {
|
||||
return \CoreLibs\Convert\MimeEncode::__mbMimeEncode($string, $encoding, $line_break);
|
||||
}
|
||||
|
||||
/**
|
||||
* set error char
|
||||
*
|
||||
* @param string|int|null $string The character to use to represent
|
||||
* error chars
|
||||
* "long" for long, "none" for none
|
||||
* or a valid code point in int
|
||||
* like 0x2234 (8756, ∴)
|
||||
* default character is ? (63)
|
||||
* if null is set then "none"
|
||||
* @return void
|
||||
* @deprecated Use \CoreLibs\Check\Encoding::setErrorChar();
|
||||
*/
|
||||
public static function setErrorChar(string|int|null $string): void
|
||||
{
|
||||
\CoreLibs\Check\Encoding::setErrorChar($string);
|
||||
}
|
||||
|
||||
/**
|
||||
* get the current set error character
|
||||
*
|
||||
* @param bool $return_substitute_func if set to true return the set
|
||||
* character from the php function
|
||||
* directly
|
||||
* @return string|int Set error character
|
||||
* @deprecated Use \CoreLibs\Check\Encoding::getErrorChar();
|
||||
*/
|
||||
public static function getErrorChar(bool $return_substitute_func = false): string|int
|
||||
{
|
||||
return \CoreLibs\Check\Encoding::getErrorChar($return_substitute_func);
|
||||
}
|
||||
|
||||
/**
|
||||
* test if a string can be safely convert between encodings.
|
||||
* mostly utf8 to shift jis
|
||||
* the default compare has a possibility of failure, especially with windows
|
||||
* it is recommended to the following in the script which uses this method:
|
||||
* mb_substitute_character(0x2234);
|
||||
* $class->mb_error_char = '∴';
|
||||
* if check to Shift JIS
|
||||
* if check to ISO-2022-JP
|
||||
* if check to ISO-2022-JP-MS
|
||||
* set three dots (∴) as wrong character for correct convert error detect
|
||||
* (this char is used, because it is one of the least used ones)
|
||||
*
|
||||
* @param string $string string to test
|
||||
* @param string $from_encoding encoding of string to test
|
||||
* @param string $to_encoding target encoding
|
||||
* @return array<string>|false false if no error or
|
||||
* array with failed characters
|
||||
* @deprecated Use \CoreLibs\Check\Encoding::checkConvertEncoding();
|
||||
*/
|
||||
public static function checkConvertEncoding(
|
||||
string $string,
|
||||
string $from_encoding,
|
||||
string $to_encoding
|
||||
): array|false {
|
||||
return \CoreLibs\Check\Encoding::checkConvertEncoding($string, $from_encoding, $to_encoding);
|
||||
}
|
||||
|
||||
/**
|
||||
* detects the source encoding of the string and if doesn't match
|
||||
* to the given target encoding it convert is
|
||||
* if source encoding is set and auto check is true (default) a second
|
||||
* check is done so that the source string encoding actually matches
|
||||
* will be skipped if source encoding detection is ascii
|
||||
*
|
||||
* @param string $string string to convert
|
||||
* @param string $to_encoding target encoding
|
||||
* @param string $source_encoding optional source encoding, will try to auto detect
|
||||
* @param bool $auto_check default true, if source encoding is set
|
||||
* check that the source is actually matching
|
||||
* to what we sav the source is
|
||||
* @return string encoding converted string
|
||||
* @deprecated Use \CoreLibs\Convert\Encoding::convertEncoding();
|
||||
*/
|
||||
public static function convertEncoding(
|
||||
string $string,
|
||||
string $to_encoding,
|
||||
string $source_encoding = '',
|
||||
bool $auto_check = true
|
||||
): string {
|
||||
return \CoreLibs\Convert\Encoding::convertEncoding(
|
||||
$string,
|
||||
$to_encoding,
|
||||
$source_encoding,
|
||||
$auto_check
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// __END__
|
||||
@@ -14,6 +14,7 @@ class GetLocale
|
||||
/**
|
||||
* returns locale, lang, domain, encoding, path
|
||||
* from either parameter set or from sessions/config variables
|
||||
* NOTE: named constant usage is deprecated and will be removed in future
|
||||
*
|
||||
* @param string|null $locale override auto detect
|
||||
* @param string|null $domain override domain
|
||||
@@ -36,6 +37,10 @@ class GetLocale
|
||||
// parse from session (logged in)
|
||||
$locale = $_SESSION['DEFAULT_LOCALE'];
|
||||
} else {
|
||||
trigger_error(
|
||||
'setLocale: Unset $locale or unset SESSION locale is deprecated',
|
||||
E_USER_DEPRECATED
|
||||
);
|
||||
// else parse from site locale
|
||||
$locale = defined('SITE_LOCALE') && !empty(SITE_LOCALE) ?
|
||||
SITE_LOCALE :
|
||||
@@ -50,8 +55,16 @@ class GetLocale
|
||||
empty($domain) ||
|
||||
!preg_match("/^\w+$/", $domain)
|
||||
) {
|
||||
// if no domain is set, fall back to content path
|
||||
$domain = str_replace('/', '', CONTENT_PATH);
|
||||
if (!empty($_SESSION['DEFAULT_DOMAIN'])) {
|
||||
$domain = $_SESSION['DEFAULT_DOMAIN'];
|
||||
} else {
|
||||
trigger_error(
|
||||
'setLocale: Unset $domain is deprecated',
|
||||
E_USER_DEPRECATED
|
||||
);
|
||||
// if no domain is set, fall back to content path
|
||||
$domain = str_replace(DIRECTORY_SEPARATOR, '', CONTENT_PATH);
|
||||
}
|
||||
}
|
||||
// check that override encoding matches locale encoding
|
||||
// if locale encoding is set
|
||||
@@ -71,6 +84,10 @@ class GetLocale
|
||||
// else set from session
|
||||
$encoding = $_SESSION['DEFAULT_CHARSET'];
|
||||
} else {
|
||||
trigger_error(
|
||||
'setLocale: Short $locale with unset $encoding or unset SESSION encoding is deprecated',
|
||||
E_USER_DEPRECATED
|
||||
);
|
||||
// else set from site encoding
|
||||
$encoding = defined('SITE_ENCODING') && !empty(SITE_ENCODING) ?
|
||||
SITE_ENCODING :
|
||||
@@ -85,7 +102,15 @@ class GetLocale
|
||||
empty($path) ||
|
||||
!is_dir($path)
|
||||
) {
|
||||
$path = BASE . INCLUDES . LOCALE;
|
||||
if (!empty($_SESSION['LOCALE_PATH'])) {
|
||||
$path = $_SESSION['LOCALE_PATH'];
|
||||
} else {
|
||||
trigger_error(
|
||||
'setLocale: Unset $path is deprecated',
|
||||
E_USER_DEPRECATED
|
||||
);
|
||||
$path = BASE . INCLUDES . LOCALE;
|
||||
}
|
||||
}
|
||||
// extract lang & country from locale string, else set to en
|
||||
if (
|
||||
|
||||
@@ -82,10 +82,23 @@ class L10n
|
||||
string $path = ''
|
||||
) {
|
||||
// auto load language only if at least locale and domain is set
|
||||
if (!empty($locale) && !empty($domain)) {
|
||||
// New: path must be set too, or we fall through
|
||||
if (!empty($locale) && !empty($domain) && empty($path)) {
|
||||
/** @deprecated if locale and domain are set, path must be set too */
|
||||
trigger_error(
|
||||
'Empty path parameter is no longer allowed if locale and domain are set',
|
||||
E_USER_DEPRECATED
|
||||
);
|
||||
}
|
||||
if (!empty($locale) && !empty($domain) && !empty($path)) {
|
||||
// check hack if domain and path is switched
|
||||
// Note this can be removed in future versions
|
||||
if (strstr($domain, DIRECTORY_SEPARATOR) !== false) {
|
||||
/** @deprecated domain must be 2nd and path must be third parameter */
|
||||
trigger_error(
|
||||
'L10n constructor parameter switch is no longer supported. domain is 2nd, path is 3rd parameter',
|
||||
E_USER_DEPRECATED
|
||||
);
|
||||
$_domain = $path;
|
||||
$path = $domain;
|
||||
$domain = $_domain;
|
||||
@@ -122,9 +135,9 @@ class L10n
|
||||
/**
|
||||
* loads the mo file base on path, locale and domain set
|
||||
*
|
||||
* @param string $locale language name (optional), fallback is en
|
||||
* @param string $domain override CONTENT_PATH . $encoding name for mo file
|
||||
* @param string $path path, if empty fallback on default internal path
|
||||
* @param string $locale language name, if not set, try previous set
|
||||
* @param string $domain set name for mo file, if not set, try previous set
|
||||
* @param string $path path, if not set try to get from paths array, else self
|
||||
* @return GetTextReader the main gettext reader object
|
||||
*/
|
||||
public function getTranslator(
|
||||
@@ -160,6 +173,11 @@ class L10n
|
||||
} elseif (
|
||||
defined('BASE') && defined('INCLUDES') && defined('LOCALE')
|
||||
) {
|
||||
/** @deprecated Do not use this anymore, define path on class load */
|
||||
trigger_error(
|
||||
'parameter $path must be set. Setting via BASE, INCLUDES and LOCALE constants is deprecated',
|
||||
E_USER_DEPRECATED
|
||||
);
|
||||
// set fallback base path if constant set
|
||||
$this->base_locale_path = BASE . INCLUDES . LOCALE;
|
||||
} else {
|
||||
@@ -240,6 +258,25 @@ class L10n
|
||||
return $this->l10n;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the local as array same to the GetLocale::setLocale return
|
||||
* This does not set from outside, but only what is set in the l10n class
|
||||
*
|
||||
* @return array{locale: string, lang: string|null, domain: string, encoding: string|null, path: string}
|
||||
*/
|
||||
public function getLocaleAsArray(): array
|
||||
{
|
||||
$locale = L10n::parseLocale($this->getLocale());
|
||||
return [
|
||||
'locale' => $this->getLocale(),
|
||||
'lang' => $locale['lang']
|
||||
. (!empty($locale['country']) ? '_' . $locale['country'] : ''),
|
||||
'domain' => $this->getDomain(),
|
||||
'encoding' => $locale['charset'],
|
||||
'path' => $this->getBaseLocalePath(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* parse the locale string for further processing
|
||||
*
|
||||
|
||||
@@ -305,37 +305,28 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
/**
|
||||
* construct form generator
|
||||
*
|
||||
* @param array<mixed> $db_config db config array, mandatory
|
||||
* @param \CoreLibs\Debug\Logging|null $log Logging class, null auto set
|
||||
* @param \CoreLibs\Language\L10n|null $l10n l10n language class, null auto set
|
||||
* @param array<string,string>|null $locale locale array from ::setLocale,
|
||||
* null auto set
|
||||
* @param array<mixed>|null $table_arrays Override table array data
|
||||
* instead of try to load from
|
||||
* include file
|
||||
* @throws \Exception 1: No table_arrays set/no class found for my page name
|
||||
* @param array<mixed> $db_config db config array, mandatory
|
||||
* @param \CoreLibs\Debug\Logging $log Logging class
|
||||
* @param \CoreLibs\Language\L10n $l10n l10n language class
|
||||
* @param array<string,string> $locale locale array from ::setLocale
|
||||
* @param array<mixed>|null $table_arrays Override table array data
|
||||
* instead of try to load from
|
||||
* include file
|
||||
* @throws \Exception 1: No table_arrays set/no class found for my page name
|
||||
*/
|
||||
public function __construct(
|
||||
array $db_config,
|
||||
?\CoreLibs\Debug\Logging $log = null,
|
||||
?\CoreLibs\Language\L10n $l10n = null,
|
||||
?array $locale = null,
|
||||
\CoreLibs\Debug\Logging $log,
|
||||
\CoreLibs\Language\L10n $l10n,
|
||||
array $locale,
|
||||
?array $table_arrays = null,
|
||||
) {
|
||||
// init logger if not set
|
||||
$this->log = $log ?? new \CoreLibs\Debug\Logging();
|
||||
$this->log = $log;
|
||||
// don't log per class
|
||||
$this->log->setLogPer('class', false);
|
||||
// if pass on locale is null
|
||||
if ($locale === null) {
|
||||
$locale = \CoreLibs\Language\GetLocale::setLocale();
|
||||
}
|
||||
// init the language class
|
||||
$this->l = $l10n ?? new \CoreLibs\Language\L10n(
|
||||
$locale['locale'],
|
||||
$locale['domain'],
|
||||
$locale['path'],
|
||||
);
|
||||
$this->l = $l10n;
|
||||
// legacy lang vars set
|
||||
$this->encoding = $locale['encoding'];
|
||||
$this->lang = $locale['lang'];
|
||||
|
||||
@@ -12,6 +12,7 @@ class Image
|
||||
{
|
||||
/**
|
||||
* converts picture to a thumbnail with max x and max y size
|
||||
* TOOD: needs mandatory options for ImageMagic convert, paths, etc folders
|
||||
*
|
||||
* @param string $pic source image file with or without path
|
||||
* @param int $size_x maximum size width
|
||||
@@ -158,25 +159,27 @@ class Image
|
||||
* if both are set, those are the max sizes (aspect ration is always ekpt)
|
||||
* - if path is not given will cache folder for current path set
|
||||
*
|
||||
* @param string $filename source file name with full path
|
||||
* @param int $thumb_width thumbnail width
|
||||
* @param int $thumb_height thumbnail height
|
||||
* @param string|null $thumbnail_path altnerative path for thumbnails
|
||||
* @param bool $create_dummy if we encounter an invalid file
|
||||
* create a dummy image file and return it
|
||||
* @param bool $use_cache default to true, set to false to skip
|
||||
* creating new image if exists
|
||||
* @param bool $high_quality default to true, uses sample version,
|
||||
* set to false to not use (default true)
|
||||
* to use quick but less nice version
|
||||
* @param int $jpeg_quality default 80, set image quality for jpeg only
|
||||
* @return string|false thumbnail with path
|
||||
* @param string $filename source file name with full path
|
||||
* @param int $thumb_width thumbnail width
|
||||
* @param int $thumb_height thumbnail height
|
||||
* @param string|null $cache_folder path for thumbnail cache
|
||||
* @param string|null $web_folder frontend path for output
|
||||
* @param bool $create_dummy if we encounter an invalid file
|
||||
* create a dummy image file and return it
|
||||
* @param bool $use_cache default to true, set to false to skip
|
||||
* creating new image if exists
|
||||
* @param bool $high_quality default to true, uses sample version,
|
||||
* set to false to not use (default true)
|
||||
* to use quick but less nice version
|
||||
* @param int $jpeg_quality default 80, set image quality for jpeg only
|
||||
* @return string|false thumbnail with path
|
||||
*/
|
||||
public static function createThumbnailSimple(
|
||||
string $filename,
|
||||
int $thumb_width = 0,
|
||||
int $thumb_height = 0,
|
||||
?string $thumbnail_path = null,
|
||||
?string $cache_folder = null, // will be not null in future
|
||||
?string $web_folder = null,
|
||||
bool $create_dummy = true,
|
||||
bool $use_cache = true,
|
||||
bool $high_quality = true,
|
||||
@@ -185,233 +188,246 @@ class Image
|
||||
$thumbnail = false;
|
||||
// $this->debug('IMAGE PREPARE', "FILE: $filename (exists "
|
||||
// .(string)file_exists($filename)."), WIDTH: $thumb_width, HEIGHT: $thumb_height");
|
||||
if (
|
||||
$cache_folder === null ||
|
||||
$web_folder === null
|
||||
) {
|
||||
/** @deprecated Do use cache folder and web folder parameters */
|
||||
trigger_error(
|
||||
'params $cache_folder and $web_folder must be set. Setting via constants is deprecated',
|
||||
E_USER_DEPRECATED
|
||||
);
|
||||
// NOTE: we need to depracte this
|
||||
$cache_folder = BASE . LAYOUT . CONTENT_PATH . CACHE . IMAGES;
|
||||
$web_folder = LAYOUT . CACHE . IMAGES;
|
||||
if (!is_dir($cache_folder)) {
|
||||
if (false === mkdir($cache_folder)) {
|
||||
$cache_folder = BASE . LAYOUT . CONTENT_PATH . CACHE;
|
||||
$web_folder = LAYOUT . CACHE;
|
||||
}
|
||||
}
|
||||
}
|
||||
// check that input image exists and is either jpeg or png
|
||||
// also fail if the basic CACHE folder does not exist at all
|
||||
if (
|
||||
file_exists($filename) &&
|
||||
is_dir(BASE . LAYOUT . CONTENT_PATH . CACHE) &&
|
||||
is_writable(BASE . LAYOUT . CONTENT_PATH . CACHE)
|
||||
!file_exists($filename) ||
|
||||
!is_dir($cache_folder) ||
|
||||
!is_writable($cache_folder)
|
||||
) {
|
||||
// $this->debug('IMAGE PREPARE', "FILENAME OK, THUMB WIDTH/HEIGHT OK");
|
||||
[$inc_width, $inc_height, $img_type] = getimagesize($filename) ?: [];
|
||||
$thumbnail_write_path = null;
|
||||
$thumbnail_web_path = null;
|
||||
// path set first
|
||||
if (
|
||||
$img_type == IMAGETYPE_JPEG ||
|
||||
$img_type == IMAGETYPE_PNG ||
|
||||
$create_dummy === true
|
||||
) {
|
||||
// $this->debug('IMAGE PREPARE', "IMAGE TYPE OK: ".$inc_width.'x'.$inc_height);
|
||||
// set thumbnail paths
|
||||
$thumbnail_write_path = BASE . LAYOUT . CONTENT_PATH . CACHE . IMAGES;
|
||||
$thumbnail_web_path = LAYOUT . CACHE . IMAGES;
|
||||
// if images folder in cache does not exist create it, if failed, fall back to base cache folder
|
||||
if (!is_dir($thumbnail_write_path)) {
|
||||
if (false === mkdir($thumbnail_write_path)) {
|
||||
$thumbnail_write_path = BASE . LAYOUT . CONTENT_PATH . CACHE;
|
||||
$thumbnail_web_path = LAYOUT . CACHE;
|
||||
}
|
||||
}
|
||||
return $thumbnail;
|
||||
}
|
||||
// $this->debug('IMAGE PREPARE', "FILENAME OK, THUMB WIDTH/HEIGHT OK");
|
||||
[$inc_width, $inc_height, $img_type] = getimagesize($filename) ?: [];
|
||||
$thumbnail_write_path = null;
|
||||
$thumbnail_web_path = null;
|
||||
// path set first
|
||||
if (
|
||||
$img_type == IMAGETYPE_JPEG ||
|
||||
$img_type == IMAGETYPE_PNG ||
|
||||
$create_dummy === true
|
||||
) {
|
||||
// $this->debug('IMAGE PREPARE', "IMAGE TYPE OK: ".$inc_width.'x'.$inc_height);
|
||||
// set thumbnail paths
|
||||
$thumbnail_write_path = $cache_folder;
|
||||
$thumbnail_web_path = $web_folder;
|
||||
}
|
||||
// do resize or fall back on dummy run
|
||||
if (
|
||||
$img_type == IMAGETYPE_JPEG ||
|
||||
$img_type == IMAGETYPE_PNG
|
||||
) {
|
||||
// if missing width or height in thumb, use the set one
|
||||
if ($thumb_width == 0) {
|
||||
$thumb_width = $inc_width;
|
||||
}
|
||||
// do resize or fall back on dummy run
|
||||
if (
|
||||
$img_type == IMAGETYPE_JPEG ||
|
||||
$img_type == IMAGETYPE_PNG
|
||||
) {
|
||||
// if missing width or height in thumb, use the set one
|
||||
if ($thumb_width == 0) {
|
||||
$thumb_width = $inc_width;
|
||||
}
|
||||
if ($thumb_height == 0) {
|
||||
$thumb_height = $inc_height;
|
||||
}
|
||||
// check resize parameters
|
||||
if ($inc_width > $thumb_width || $inc_height > $thumb_height) {
|
||||
$thumb_width_r = 0;
|
||||
$thumb_height_r = 0;
|
||||
// we need to keep the aspect ration on longest side
|
||||
if (
|
||||
($inc_height > $inc_width &&
|
||||
// and the height is bigger than thumb set
|
||||
$inc_height > $thumb_height) ||
|
||||
// or the height is smaller or equal width
|
||||
// but the width for the thumb is equal to the image height
|
||||
($inc_height <= $inc_width &&
|
||||
$inc_width == $thumb_width
|
||||
)
|
||||
) {
|
||||
// $this->debug('IMAGE PREPARE', 'HEIGHT > WIDTH');
|
||||
$ratio = $inc_height / $thumb_height;
|
||||
$thumb_width_r = (int)ceil($inc_width / $ratio);
|
||||
$thumb_height_r = $thumb_height;
|
||||
} else {
|
||||
// $this->debug('IMAGE PREPARE', 'WIDTH > HEIGHT');
|
||||
$ratio = $inc_width / $thumb_width;
|
||||
$thumb_width_r = $thumb_width;
|
||||
$thumb_height_r = (int)ceil($inc_height / $ratio);
|
||||
}
|
||||
// $this->debug('IMAGE PREPARE', "Ratio: $ratio, Target size $thumb_width_r x $thumb_height_r");
|
||||
// set output thumbnail name
|
||||
$thumbnail = 'thumb-' . pathinfo($filename)['filename'] . '-'
|
||||
. $thumb_width_r . 'x' . $thumb_height_r;
|
||||
if (
|
||||
$use_cache === false ||
|
||||
!file_exists($thumbnail_write_path . $thumbnail)
|
||||
) {
|
||||
// image, copy source image, offset in image, source x/y, new size, source image size
|
||||
$thumb = imagecreatetruecolor($thumb_width_r, $thumb_height_r);
|
||||
if ($thumb === false) {
|
||||
return false;
|
||||
}
|
||||
if ($img_type == IMAGETYPE_PNG) {
|
||||
$imagecolorallocatealpha = imagecolorallocatealpha($thumb, 0, 0, 0, 127);
|
||||
if ($imagecolorallocatealpha === false) {
|
||||
return false;
|
||||
}
|
||||
// preservere transaprency
|
||||
imagecolortransparent(
|
||||
$thumb,
|
||||
$imagecolorallocatealpha
|
||||
);
|
||||
imagealphablending($thumb, false);
|
||||
imagesavealpha($thumb, true);
|
||||
}
|
||||
$source = null;
|
||||
switch ($img_type) {
|
||||
case IMAGETYPE_JPEG:
|
||||
$source = imagecreatefromjpeg($filename);
|
||||
break;
|
||||
case IMAGETYPE_PNG:
|
||||
$source = imagecreatefrompng($filename);
|
||||
break;
|
||||
}
|
||||
// check that we have a source image resource
|
||||
if ($source !== null && $source !== false) {
|
||||
// resize no shift
|
||||
if ($high_quality === true) {
|
||||
imagecopyresized(
|
||||
$thumb,
|
||||
$source,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
$thumb_width_r,
|
||||
$thumb_height_r,
|
||||
$inc_width,
|
||||
$inc_height
|
||||
);
|
||||
} else {
|
||||
imagecopyresampled(
|
||||
$thumb,
|
||||
$source,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
$thumb_width_r,
|
||||
$thumb_height_r,
|
||||
$inc_width,
|
||||
$inc_height
|
||||
);
|
||||
}
|
||||
// write file
|
||||
switch ($img_type) {
|
||||
case IMAGETYPE_JPEG:
|
||||
imagejpeg($thumb, $thumbnail_write_path . $thumbnail, $jpeg_quality);
|
||||
break;
|
||||
case IMAGETYPE_PNG:
|
||||
imagepng($thumb, $thumbnail_write_path . $thumbnail);
|
||||
break;
|
||||
}
|
||||
// free up resources (in case we are called in a loop)
|
||||
imagedestroy($source);
|
||||
imagedestroy($thumb);
|
||||
} else {
|
||||
$thumbnail = false;
|
||||
}
|
||||
}
|
||||
if ($thumb_height == 0) {
|
||||
$thumb_height = $inc_height;
|
||||
}
|
||||
// check resize parameters
|
||||
if ($inc_width > $thumb_width || $inc_height > $thumb_height) {
|
||||
$thumb_width_r = 0;
|
||||
$thumb_height_r = 0;
|
||||
// we need to keep the aspect ration on longest side
|
||||
if (
|
||||
($inc_height > $inc_width &&
|
||||
// and the height is bigger than thumb set
|
||||
$inc_height > $thumb_height) ||
|
||||
// or the height is smaller or equal width
|
||||
// but the width for the thumb is equal to the image height
|
||||
($inc_height <= $inc_width &&
|
||||
$inc_width == $thumb_width
|
||||
)
|
||||
) {
|
||||
// $this->debug('IMAGE PREPARE', 'HEIGHT > WIDTH');
|
||||
$ratio = $inc_height / $thumb_height;
|
||||
$thumb_width_r = (int)ceil($inc_width / $ratio);
|
||||
$thumb_height_r = $thumb_height;
|
||||
} else {
|
||||
// we just copy over the image as is, we never upscale
|
||||
$thumbnail = 'thumb-' . pathinfo($filename)['filename'] . '-' . $inc_width . 'x' . $inc_height;
|
||||
if (
|
||||
$use_cache === false ||
|
||||
!file_exists($thumbnail_write_path . $thumbnail)
|
||||
) {
|
||||
copy($filename, $thumbnail_write_path . $thumbnail);
|
||||
}
|
||||
// $this->debug('IMAGE PREPARE', 'WIDTH > HEIGHT');
|
||||
$ratio = $inc_width / $thumb_width;
|
||||
$thumb_width_r = $thumb_width;
|
||||
$thumb_height_r = (int)ceil($inc_height / $ratio);
|
||||
}
|
||||
// add output path
|
||||
if ($thumbnail !== false) {
|
||||
$thumbnail = $thumbnail_web_path . $thumbnail;
|
||||
}
|
||||
} elseif ($create_dummy === true) {
|
||||
// create dummy image in the thumbnail size
|
||||
// if one side is missing, use the other side to create a square
|
||||
if (!$thumb_width) {
|
||||
$thumb_width = $thumb_height;
|
||||
}
|
||||
if (!$thumb_height) {
|
||||
$thumb_height = $thumb_width;
|
||||
}
|
||||
// do we have an image already?
|
||||
$thumbnail = 'thumb-' . pathinfo($filename)['filename'] . '-' . $thumb_width . 'x' . $thumb_height;
|
||||
// $this->debug('IMAGE PREPARE', "Ratio: $ratio, Target size $thumb_width_r x $thumb_height_r");
|
||||
// set output thumbnail name
|
||||
$thumbnail = 'thumb-' . pathinfo($filename)['filename'] . '-'
|
||||
. $thumb_width_r . 'x' . $thumb_height_r;
|
||||
if (
|
||||
$use_cache === false ||
|
||||
!file_exists($thumbnail_write_path . $thumbnail)
|
||||
) {
|
||||
// if both are unset, set to 250
|
||||
if ($thumb_height == 0) {
|
||||
$thumb_height = 250;
|
||||
}
|
||||
if ($thumb_width == 0) {
|
||||
$thumb_width = 250;
|
||||
}
|
||||
$thumb = imagecreatetruecolor($thumb_width, $thumb_height);
|
||||
// image, copy source image, offset in image, source x/y, new size, source image size
|
||||
$thumb = imagecreatetruecolor($thumb_width_r, $thumb_height_r);
|
||||
if ($thumb === false) {
|
||||
return false;
|
||||
}
|
||||
// add outside border px = 5% (rounded up)
|
||||
// eg 50px -> 2.5px
|
||||
$gray = imagecolorallocate($thumb, 200, 200, 200);
|
||||
$white = imagecolorallocate($thumb, 255, 255, 255);
|
||||
if ($gray === false || $white === false) {
|
||||
return false;
|
||||
if ($img_type == IMAGETYPE_PNG) {
|
||||
$imagecolorallocatealpha = imagecolorallocatealpha($thumb, 0, 0, 0, 127);
|
||||
if ($imagecolorallocatealpha === false) {
|
||||
return false;
|
||||
}
|
||||
// preservere transaprency
|
||||
imagecolortransparent(
|
||||
$thumb,
|
||||
$imagecolorallocatealpha
|
||||
);
|
||||
imagealphablending($thumb, false);
|
||||
imagesavealpha($thumb, true);
|
||||
}
|
||||
// fill gray background
|
||||
imagefill($thumb, 0, 0, $gray);
|
||||
// now create rectangle
|
||||
if (imagesx($thumb) < imagesy($thumb)) {
|
||||
$width = (int)round(imagesx($thumb) / 100 * 5);
|
||||
$source = null;
|
||||
switch ($img_type) {
|
||||
case IMAGETYPE_JPEG:
|
||||
$source = imagecreatefromjpeg($filename);
|
||||
break;
|
||||
case IMAGETYPE_PNG:
|
||||
$source = imagecreatefrompng($filename);
|
||||
break;
|
||||
}
|
||||
// check that we have a source image resource
|
||||
if ($source !== null && $source !== false) {
|
||||
// resize no shift
|
||||
if ($high_quality === true) {
|
||||
imagecopyresized(
|
||||
$thumb,
|
||||
$source,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
$thumb_width_r,
|
||||
$thumb_height_r,
|
||||
$inc_width,
|
||||
$inc_height
|
||||
);
|
||||
} else {
|
||||
imagecopyresampled(
|
||||
$thumb,
|
||||
$source,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
$thumb_width_r,
|
||||
$thumb_height_r,
|
||||
$inc_width,
|
||||
$inc_height
|
||||
);
|
||||
}
|
||||
// write file
|
||||
switch ($img_type) {
|
||||
case IMAGETYPE_JPEG:
|
||||
imagejpeg($thumb, $thumbnail_write_path . $thumbnail, $jpeg_quality);
|
||||
break;
|
||||
case IMAGETYPE_PNG:
|
||||
imagepng($thumb, $thumbnail_write_path . $thumbnail);
|
||||
break;
|
||||
}
|
||||
// free up resources (in case we are called in a loop)
|
||||
imagedestroy($source);
|
||||
imagedestroy($thumb);
|
||||
} else {
|
||||
$width = (int)round(imagesy($thumb) / 100 * 5);
|
||||
$thumbnail = false;
|
||||
}
|
||||
imagefilledrectangle(
|
||||
$thumb,
|
||||
0 + $width,
|
||||
0 + $width,
|
||||
imagesx($thumb) - $width,
|
||||
imagesy($thumb) - $width,
|
||||
$white
|
||||
);
|
||||
// add "No valid images source"
|
||||
// OR add circle
|
||||
// * find center
|
||||
// * width/height is 75% of size - border
|
||||
// smaller size is taken
|
||||
$base_width = imagesx($thumb) > imagesy($thumb) ? imagesy($thumb) : imagesx($thumb);
|
||||
// get 75% width
|
||||
$cross_width = (int)round((($base_width - ($width * 2)) / 100 * 75) / 2);
|
||||
$center_x = (int)round(imagesx($thumb) / 2);
|
||||
$center_y = (int)round(imagesy($thumb) / 2);
|
||||
imagefilledellipse($thumb, $center_x, $center_y, $cross_width, $cross_width, $gray);
|
||||
// find top left and bottom left for first line
|
||||
imagepng($thumb, $thumbnail_write_path . $thumbnail);
|
||||
}
|
||||
// add web path
|
||||
} else {
|
||||
// we just copy over the image as is, we never upscale
|
||||
$thumbnail = 'thumb-' . pathinfo($filename)['filename'] . '-' . $inc_width . 'x' . $inc_height;
|
||||
if (
|
||||
$use_cache === false ||
|
||||
!file_exists($thumbnail_write_path . $thumbnail)
|
||||
) {
|
||||
copy($filename, $thumbnail_write_path . $thumbnail);
|
||||
}
|
||||
}
|
||||
// add output path
|
||||
if ($thumbnail !== false) {
|
||||
$thumbnail = $thumbnail_web_path . $thumbnail;
|
||||
}
|
||||
} elseif ($create_dummy === true) {
|
||||
// create dummy image in the thumbnail size
|
||||
// if one side is missing, use the other side to create a square
|
||||
if (!$thumb_width) {
|
||||
$thumb_width = $thumb_height;
|
||||
}
|
||||
if (!$thumb_height) {
|
||||
$thumb_height = $thumb_width;
|
||||
}
|
||||
// do we have an image already?
|
||||
$thumbnail = 'thumb-' . pathinfo($filename)['filename'] . '-' . $thumb_width . 'x' . $thumb_height;
|
||||
if (
|
||||
$use_cache === false ||
|
||||
!file_exists($thumbnail_write_path . $thumbnail)
|
||||
) {
|
||||
// if both are unset, set to 250
|
||||
if ($thumb_height == 0) {
|
||||
$thumb_height = 250;
|
||||
}
|
||||
if ($thumb_width == 0) {
|
||||
$thumb_width = 250;
|
||||
}
|
||||
$thumb = imagecreatetruecolor($thumb_width, $thumb_height);
|
||||
if ($thumb === false) {
|
||||
return false;
|
||||
}
|
||||
// add outside border px = 5% (rounded up)
|
||||
// eg 50px -> 2.5px
|
||||
$gray = imagecolorallocate($thumb, 200, 200, 200);
|
||||
$white = imagecolorallocate($thumb, 255, 255, 255);
|
||||
if ($gray === false || $white === false) {
|
||||
return false;
|
||||
}
|
||||
// fill gray background
|
||||
imagefill($thumb, 0, 0, $gray);
|
||||
// now create rectangle
|
||||
if (imagesx($thumb) < imagesy($thumb)) {
|
||||
$width = (int)round(imagesx($thumb) / 100 * 5);
|
||||
} else {
|
||||
$width = (int)round(imagesy($thumb) / 100 * 5);
|
||||
}
|
||||
imagefilledrectangle(
|
||||
$thumb,
|
||||
0 + $width,
|
||||
0 + $width,
|
||||
imagesx($thumb) - $width,
|
||||
imagesy($thumb) - $width,
|
||||
$white
|
||||
);
|
||||
// add "No valid images source"
|
||||
// OR add circle
|
||||
// * find center
|
||||
// * width/height is 75% of size - border
|
||||
// smaller size is taken
|
||||
$base_width = imagesx($thumb) > imagesy($thumb) ? imagesy($thumb) : imagesx($thumb);
|
||||
// get 75% width
|
||||
$cross_width = (int)round((($base_width - ($width * 2)) / 100 * 75) / 2);
|
||||
$center_x = (int)round(imagesx($thumb) / 2);
|
||||
$center_y = (int)round(imagesy($thumb) / 2);
|
||||
imagefilledellipse($thumb, $center_x, $center_y, $cross_width, $cross_width, $gray);
|
||||
// find top left and bottom left for first line
|
||||
imagepng($thumb, $thumbnail_write_path . $thumbnail);
|
||||
}
|
||||
// add web path
|
||||
$thumbnail = $thumbnail_web_path . $thumbnail;
|
||||
}
|
||||
// either return false or the thumbnail name + output path web
|
||||
return $thumbnail;
|
||||
|
||||
@@ -161,9 +161,31 @@ class SmartyExtend extends \Smarty
|
||||
*
|
||||
* @param \CoreLibs\Language\L10n $l10n l10n language class
|
||||
* @param array<string,string> $locale locale data read from setLocale
|
||||
* @param string|null $cache_id
|
||||
* @param string|null $compile_id
|
||||
*/
|
||||
public function __construct(\CoreLibs\Language\L10n $l10n, array $locale)
|
||||
{
|
||||
public function __construct(
|
||||
\CoreLibs\Language\L10n $l10n,
|
||||
array $locale,
|
||||
?string $cache_id = null,
|
||||
?string $compile_id = null
|
||||
) {
|
||||
// trigger deprecation
|
||||
if (
|
||||
$cache_id === null ||
|
||||
$compile_id === null
|
||||
) {
|
||||
/** @deprecated SmartyExtend::__construct call without parameters */
|
||||
trigger_error(
|
||||
'Calling SmartyExtend::__construct without paramters is deprecated',
|
||||
E_USER_DEPRECATED
|
||||
);
|
||||
}
|
||||
// set variables (to be deprecated)
|
||||
$cache_id = $cache_id ??
|
||||
(defined('CACHE_ID') ? CACHE_ID : '');
|
||||
$compile_id = $compile_id ??
|
||||
(defined('COMPILE_ID') ? COMPILE_ID : '');
|
||||
// call basic smarty
|
||||
// or Smarty::__construct();
|
||||
parent::__construct();
|
||||
@@ -191,8 +213,8 @@ class SmartyExtend extends \Smarty
|
||||
$this->page_name = \CoreLibs\Get\System::getPageName();
|
||||
|
||||
// set internal settings
|
||||
$this->CACHE_ID = defined('CACHE_ID') ? CACHE_ID : '';
|
||||
$this->COMPILE_ID = defined('COMPILE_ID') ? COMPILE_ID : '';
|
||||
$this->CACHE_ID = $cache_id;
|
||||
$this->COMPILE_ID = $compile_id;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -256,11 +278,70 @@ class SmartyExtend extends \Smarty
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setSmartyPaths(): void
|
||||
{
|
||||
|
||||
/**
|
||||
* sets all internal paths and names that need to be passed on
|
||||
* to the smarty template
|
||||
*
|
||||
* @param string|null $set_includes INCLUDES
|
||||
* @param string|null $set_template_path TEMPLATE_PATH
|
||||
* @param string|null $set_javascript JAVASCRIPT
|
||||
* @param string|null $set_css CSS
|
||||
* @param string|null $set_font FONT
|
||||
* @param string|null $set_pictures PICTURES
|
||||
* @param string|null $set_cache_pictures CACHE_PICTURES
|
||||
* @param string|null $set_cache_pictures_root CACHE_PICTURES_ROOT
|
||||
* @param string|null $set_master_template_name MASTAER_TEMPLATE_NAME
|
||||
* @return void
|
||||
*/
|
||||
public function setSmartyPaths(
|
||||
?string $set_includes = null,
|
||||
?string $set_template_path = null,
|
||||
?string $set_javascript = null,
|
||||
?string $set_css = null,
|
||||
?string $set_font = null,
|
||||
?string $set_pictures = null,
|
||||
?string $set_cache_pictures = null,
|
||||
?string $set_cache_pictures_root = null,
|
||||
?string $set_master_template_name = null,
|
||||
): void {
|
||||
// trigger deprecation
|
||||
if (
|
||||
$set_includes === null ||
|
||||
$set_template_path === null ||
|
||||
$set_javascript === null ||
|
||||
$set_css === null ||
|
||||
$set_font === null ||
|
||||
$set_pictures === null ||
|
||||
$set_cache_pictures === null ||
|
||||
$set_cache_pictures_root === null
|
||||
) {
|
||||
/** @deprecated setSmartyPaths call without parameters */
|
||||
trigger_error(
|
||||
'Calling setSmartyPaths without paramters is deprecated',
|
||||
E_USER_DEPRECATED
|
||||
);
|
||||
}
|
||||
// set variables (to be deprecated)
|
||||
$set_master_template_name = $set_master_template_name ??
|
||||
(defined('MASTER_TEMPLATE_NAME') ? MASTER_TEMPLATE_NAME : '');
|
||||
$set_includes = $set_includes ??
|
||||
BASE . INCLUDES;
|
||||
$set_template_path = $set_template_path ??
|
||||
BASE . INCLUDES . TEMPLATES . CONTENT_PATH;
|
||||
$set_javascript = $set_javascript ?? LAYOUT . JS;
|
||||
$set_css = $set_css ?? LAYOUT . CSS;
|
||||
$set_font = $set_font ?? LAYOUT . FONT;
|
||||
$set_pictures = $set_pictures ?? LAYOUT . IMAGES;
|
||||
$set_cache_pictures = $set_cache_pictures ?? LAYOUT . CACHE;
|
||||
$set_cache_pictures_root = $set_cache_pictures_root ??
|
||||
ROOT . $set_cache_pictures;
|
||||
|
||||
// master template
|
||||
if (empty($this->MASTER_TEMPLATE_NAME)) {
|
||||
$this->MASTER_TEMPLATE_NAME = MASTER_TEMPLATE_NAME;
|
||||
if (
|
||||
empty($this->MASTER_TEMPLATE_NAME)
|
||||
) {
|
||||
$this->MASTER_TEMPLATE_NAME = $set_master_template_name;
|
||||
}
|
||||
|
||||
// set include & template names
|
||||
@@ -276,15 +357,15 @@ class SmartyExtend extends \Smarty
|
||||
$this->CSS_TEMPLATE_NAME = str_replace('.tpl', '.css', $this->CONTENT_INCLUDE);
|
||||
|
||||
// set basic template path (tmp)
|
||||
$this->INCLUDES = BASE . INCLUDES; // no longer in templates, only global
|
||||
$this->TEMPLATE_PATH = BASE . INCLUDES . TEMPLATES . CONTENT_PATH;
|
||||
$this->INCLUDES = $set_includes; // no longer in templates, only global
|
||||
$this->TEMPLATE_PATH = $set_template_path;
|
||||
$this->setTemplateDir($this->TEMPLATE_PATH);
|
||||
$this->JAVASCRIPT = LAYOUT . JS;
|
||||
$this->CSS = LAYOUT . CSS;
|
||||
$this->FONT = LAYOUT . FONT;
|
||||
$this->PICTURES = LAYOUT . IMAGES;
|
||||
$this->CACHE_PICTURES = LAYOUT . CACHE;
|
||||
$this->CACHE_PICTURES_ROOT = ROOT . $this->CACHE_PICTURES;
|
||||
$this->JAVASCRIPT = $set_javascript;
|
||||
$this->CSS = $set_css;
|
||||
$this->FONT = $set_font;
|
||||
$this->PICTURES = $set_pictures;
|
||||
$this->CACHE_PICTURES = $set_cache_pictures;
|
||||
$this->CACHE_PICTURES_ROOT = $set_cache_pictures_root;
|
||||
// check if we have an external file with the template name
|
||||
if (
|
||||
file_exists($this->INCLUDES . $this->INC_TEMPLATE_NAME) &&
|
||||
@@ -305,7 +386,7 @@ class SmartyExtend extends \Smarty
|
||||
// set all the additional CSS/JS parths
|
||||
$this->setSmartCoreIncludeCssJs();
|
||||
// check if template names exist
|
||||
if (!$this->MASTER_TEMPLATE_NAME) {
|
||||
if (empty($this->MASTER_TEMPLATE_NAME)) {
|
||||
exit('MASTER TEMPLATE is not set');
|
||||
} elseif (!file_exists($this->getTemplateDir()[0] . DIRECTORY_SEPARATOR . $this->MASTER_TEMPLATE_NAME)) {
|
||||
// abort if master template could not be found
|
||||
@@ -374,33 +455,191 @@ class SmartyExtend extends \Smarty
|
||||
* wrapper call for setSmartyVars
|
||||
* this is for frontend type and will not set any only admin needed variables
|
||||
*
|
||||
* @param string|null $compile_dir BASE . TEMPLATES_C
|
||||
* @param string|null $cache_dir BASE . CACHE
|
||||
* @param string|null $set_js JS
|
||||
* @param string|null $set_css CSS
|
||||
* @param string|null $set_font FONT
|
||||
* @param string|null $set_default_encoding DEFAULT_ENCODING
|
||||
* @param string|null $set_g_title G_TITLE
|
||||
* @param string|null $set_stylesheet STYLESHEET
|
||||
* @param string|null $set_javascript JAVASCRIPT
|
||||
* @param \CoreLibs\Admin\Backend|null $cms Optinal Admin Backend for
|
||||
* smarty variables merge
|
||||
* @return void
|
||||
*/
|
||||
public function setSmartyVarsFrontend(): void
|
||||
{
|
||||
$this->setSmartyVars();
|
||||
public function setSmartyVarsFrontend(
|
||||
?string $compile_dir = null,
|
||||
?string $cache_dir = null,
|
||||
?string $set_js = null,
|
||||
?string $set_css = null,
|
||||
?string $set_font = null,
|
||||
?string $set_default_encoding = null,
|
||||
?string $set_g_title = null,
|
||||
?string $set_stylesheet = null,
|
||||
?string $set_javascript = null,
|
||||
?\CoreLibs\Admin\Backend $cms = null
|
||||
): void {
|
||||
$this->setSmartyVars(
|
||||
false,
|
||||
$cms,
|
||||
$compile_dir,
|
||||
$cache_dir,
|
||||
$set_js,
|
||||
$set_css,
|
||||
$set_font,
|
||||
$set_default_encoding,
|
||||
$set_g_title,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
$set_stylesheet,
|
||||
$set_javascript
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* wrapper call for setSmartyVars
|
||||
* this is only for admin interface and will set additional variables
|
||||
* @param string|null $compile_dir BASE . TEMPLATES_C
|
||||
* @param string|null $cache_dir BASE . CACHE
|
||||
* @param string|null $set_js JS
|
||||
* @param string|null $set_css CSS
|
||||
* @param string|null $set_font FONT
|
||||
* @param string|null $set_default_encoding DEFAULT_ENCODING
|
||||
* @param string|null $set_g_title G_TITLE
|
||||
* @param string|null $set_admin_stylesheet ADMIN_STYLESHEET
|
||||
* @param string|null $set_admin_javascript ADMIN_JAVASCRIPT
|
||||
* @param string|null $set_page_width PAGE_WIDTH
|
||||
* @param \CoreLibs\Admin\Backend|null $cms Optinal Admin Backend for
|
||||
* smarty variables merge
|
||||
* @return void
|
||||
*/
|
||||
public function setSmartyVarsAdmin(): void
|
||||
{
|
||||
$this->setSmartyVars(true);
|
||||
public function setSmartyVarsAdmin(
|
||||
?string $compile_dir = null,
|
||||
?string $cache_dir = null,
|
||||
?string $set_js = null,
|
||||
?string $set_css = null,
|
||||
?string $set_font = null,
|
||||
?string $set_default_encoding = null,
|
||||
?string $set_g_title = null,
|
||||
?string $set_admin_stylesheet = null,
|
||||
?string $set_admin_javascript = null,
|
||||
?string $set_page_width = null,
|
||||
?\CoreLibs\Admin\Backend $cms = null
|
||||
): void {
|
||||
$this->setSmartyVars(
|
||||
true,
|
||||
$cms,
|
||||
$compile_dir,
|
||||
$cache_dir,
|
||||
$set_js,
|
||||
$set_css,
|
||||
$set_font,
|
||||
$set_g_title,
|
||||
$set_default_encoding,
|
||||
$set_admin_stylesheet,
|
||||
$set_admin_javascript,
|
||||
$set_page_width,
|
||||
null,
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* set smarty pass on variables, sub template names and finally calls the smarty parser
|
||||
* set smarty pass on variables, sub template names and
|
||||
* finally calls the smarty parser
|
||||
*
|
||||
* @param boolean $admin_call default false, will set admin only variables
|
||||
* @param bool $admin_call default false
|
||||
* will set admin only variables
|
||||
* @param \CoreLibs\Admin\Backend|null $cms Optinal Admin Backend for
|
||||
* smarty variables merge
|
||||
* @param string|null $compile_dir BASE . TEMPLATES_C
|
||||
* @param string|null $cache_dir BASE . CACHE
|
||||
* @param string|null $set_js JS
|
||||
* @param string|null $set_css CSS
|
||||
* @param string|null $set_font FONT
|
||||
* @param string|null $set_default_encoding DEFAULT_ENCODING
|
||||
* @param string|null $set_g_title G_TITLE
|
||||
* @param string|null $set_admin_stylesheet ADMIN_STYLESHEET
|
||||
* @param string|null $set_admin_javascript ADMIN_JAVASCRIPT
|
||||
* @param string|null $set_page_width PAGE_WIDTH
|
||||
* @param string|null $set_stylesheet STYLESHEET
|
||||
* @param string|null $set_javascript JAVASCRIPT
|
||||
* @return void
|
||||
*/
|
||||
private function setSmartyVars($admin_call = false): void
|
||||
{
|
||||
/** @var \CoreLibs\Admin\Backend This is an assumption */
|
||||
global $cms;
|
||||
if (is_object($cms)) {
|
||||
private function setSmartyVars(
|
||||
bool $admin_call,
|
||||
?\CoreLibs\Admin\Backend $cms = null,
|
||||
?string $compile_dir = null,
|
||||
?string $cache_dir = null,
|
||||
?string $set_js = null,
|
||||
?string $set_css = null,
|
||||
?string $set_font = null,
|
||||
?string $set_default_encoding = null,
|
||||
?string $set_g_title = null,
|
||||
?string $set_admin_stylesheet = null,
|
||||
?string $set_admin_javascript = null,
|
||||
?string $set_page_width = null,
|
||||
?string $set_stylesheet = null,
|
||||
?string $set_javascript = null
|
||||
): void {
|
||||
// trigger deprecation
|
||||
if (
|
||||
$compile_dir === null ||
|
||||
$cache_dir === null ||
|
||||
$set_css === null ||
|
||||
$set_font === null ||
|
||||
$set_js === null ||
|
||||
$set_default_encoding === null ||
|
||||
$set_g_title === null ||
|
||||
(
|
||||
$admin_call === true && (
|
||||
$set_admin_stylesheet === null ||
|
||||
$set_admin_javascript === null ||
|
||||
$set_page_width === null
|
||||
)
|
||||
) ||
|
||||
(
|
||||
$admin_call === false && (
|
||||
$set_stylesheet === null ||
|
||||
$set_javascript === null
|
||||
)
|
||||
)
|
||||
) {
|
||||
/** @deprecated setSmartyVars call without parameters */
|
||||
trigger_error(
|
||||
'Calling setSmartyVars without paramters is deprecated',
|
||||
E_USER_DEPRECATED
|
||||
);
|
||||
}
|
||||
// set variables (will be deprecated)
|
||||
$compile_dir = $compile_dir ?? BASE . TEMPLATES_C;
|
||||
$cache_dir = $cache_dir ?? BASE . CACHE;
|
||||
$set_css = $set_css ?? CSS;
|
||||
$set_font = $set_font ?? FONT;
|
||||
$set_js = $set_js ?? JS;
|
||||
$set_default_encoding = $set_default_encoding ?? DEFAULT_ENCODING;
|
||||
$set_g_title = $set_g_title ?? G_TITLE;
|
||||
$set_admin_stylesheet = $set_admin_stylesheet ?? ADMIN_STYLESHEET;
|
||||
$set_admin_javascript = $set_admin_javascript ?? ADMIN_JAVASCRIPT;
|
||||
$set_page_width = $set_page_width ?? PAGE_WIDTH;
|
||||
$set_stylesheet = $set_stylesheet ?? STYLESHEET;
|
||||
$set_javascript = $set_javascript ?? JAVASCRIPT;
|
||||
// depreacte call globals cms on null 4mcs
|
||||
if (
|
||||
$cms === null &&
|
||||
isset($GLOBALS['cms'])
|
||||
) {
|
||||
/** @deprecated setSmartyVars globals cms is deprecated */
|
||||
trigger_error(
|
||||
'Calling setSmartyVars without cms parameter when needed is deprecated',
|
||||
E_USER_DEPRECATED
|
||||
);
|
||||
}
|
||||
// this is ugly
|
||||
$cms = $cms ?? $GLOBALS['cms'] ?? null;
|
||||
if ($cms instanceof \CoreLibs\Admin\Backend) {
|
||||
$this->mergeCmsSmartyVars($cms);
|
||||
}
|
||||
|
||||
@@ -431,11 +670,11 @@ class SmartyExtend extends \Smarty
|
||||
|
||||
// default CMS settings
|
||||
// define all needed smarty stuff for the general HTML/page building
|
||||
$this->HEADER['CSS'] = CSS;
|
||||
$this->HEADER['FONT'] = FONT;
|
||||
$this->HEADER['JS'] = JS;
|
||||
$this->HEADER['CSS'] = $set_css;
|
||||
$this->HEADER['FONT'] = $set_font;
|
||||
$this->HEADER['JS'] = $set_js;
|
||||
$this->HEADER['ENCODING'] = $this->encoding;
|
||||
$this->HEADER['DEFAULT_ENCODING'] = DEFAULT_ENCODING;
|
||||
$this->HEADER['DEFAULT_ENCODING'] = $set_default_encoding;
|
||||
|
||||
// form name
|
||||
$this->DATA['FORM_NAME'] = !$this->FORM_NAME ?
|
||||
@@ -445,7 +684,7 @@ class SmartyExtend extends \Smarty
|
||||
// special for admin
|
||||
if ($admin_call === true) {
|
||||
// set ACL extra show
|
||||
if (is_object($cms)) {
|
||||
if ($cms instanceof \CoreLibs\Admin\Backend) {
|
||||
$this->DATA['show_ea_extra'] = $cms->acl['show_ea_extra'] ?? false;
|
||||
$this->DATA['ADMIN'] = $cms->acl['admin'] ?? 0;
|
||||
// top menu
|
||||
@@ -461,11 +700,13 @@ class SmartyExtend extends \Smarty
|
||||
$this->DATA['messages'] = [];
|
||||
}
|
||||
// set style sheets
|
||||
$this->HEADER['STYLESHEET'] = $this->ADMIN_STYLESHEET ? $this->ADMIN_STYLESHEET : ADMIN_STYLESHEET;
|
||||
$this->HEADER['JAVASCRIPT'] = $this->ADMIN_JAVASCRIPT ? $this->ADMIN_JAVASCRIPT : ADMIN_JAVASCRIPT;
|
||||
$this->HEADER['STYLESHEET'] = !empty($this->ADMIN_STYLESHEET) ?
|
||||
$this->ADMIN_STYLESHEET : $set_admin_stylesheet;
|
||||
$this->HEADER['JAVASCRIPT'] = !empty($this->ADMIN_JAVASCRIPT) ?
|
||||
$this->ADMIN_JAVASCRIPT : $set_admin_javascript;
|
||||
// the page name
|
||||
$this->DATA['page_name'] = $this->page_name;
|
||||
$this->DATA['table_width'] = !empty($this->PAGE_WIDTH) ?: PAGE_WIDTH;
|
||||
$this->DATA['table_width'] = !empty($this->PAGE_WIDTH) ?: $set_page_width;
|
||||
$this->DATA['form_name'] = $this->DATA['FORM_NAME'];
|
||||
// for tinymce special
|
||||
$this->DATA['TINYMCE_LANG'] = $this->lang_short;
|
||||
@@ -474,14 +715,16 @@ class SmartyExtend extends \Smarty
|
||||
// debug data, if DEBUG flag is on, this data is print out
|
||||
$this->DEBUG_DATA['DEBUG'] = $this->DEBUG_TMPL;
|
||||
} else {
|
||||
$this->HEADER['STYLESHEET'] = $this->FRONTEND_STYLESHEET ? $this->FRONTEND_STYLESHEET : STYLESHEET;
|
||||
$this->HEADER['JAVASCRIPT'] = $this->FRONTEND_JAVASCRIPT ? $this->FRONTEND_JAVASCRIPT : JAVASCRIPT;
|
||||
$this->HEADER['STYLESHEET'] = !empty($this->FRONTEND_STYLESHEET) ?
|
||||
$this->FRONTEND_STYLESHEET : $set_stylesheet;
|
||||
$this->HEADER['JAVASCRIPT'] = !empty($this->FRONTEND_JAVASCRIPT) ?
|
||||
$this->FRONTEND_JAVASCRIPT : $set_javascript;
|
||||
}
|
||||
// html title
|
||||
// set local page title
|
||||
$this->HEADER['HTML_TITLE'] = !$this->L_TITLE ?
|
||||
ucfirst(str_replace('_', ' ', \CoreLibs\Get\System::getPageName(1)))
|
||||
. (defined('G_TITLE') ? ' - ' . $this->l10n->__(G_TITLE) : '') :
|
||||
. (!empty($set_g_title) ? '-' . $this->l10n->__($set_g_title) : '') :
|
||||
$this->l10n->__($this->L_TITLE);
|
||||
|
||||
// LANG
|
||||
@@ -499,16 +742,16 @@ class SmartyExtend extends \Smarty
|
||||
$this->DATA['JS_TRANSLATE'] = $this->JS_TRANSLATE ?? null;
|
||||
$this->DATA['PAGE_FILE_NAME'] = str_replace('.php', '', $this->page_name) . '.tpl';
|
||||
// render page
|
||||
$this->renderSmarty();
|
||||
$this->renderSmarty($compile_dir, $cache_dir);
|
||||
}
|
||||
|
||||
/**
|
||||
* merge outside object HEADER/DATA/DEBUG_DATA vars into the smarty class
|
||||
*
|
||||
* @param object $cms object that has header/data/debug_data
|
||||
* @param \CoreLibs\Admin\Backend $cms object that has header/data/debug_data
|
||||
* @return void
|
||||
*/
|
||||
public function mergeCmsSmartyVars(object $cms): void
|
||||
public function mergeCmsSmartyVars(\CoreLibs\Admin\Backend $cms): void
|
||||
{
|
||||
// array merge HEADER, DATA, DEBUG DATA
|
||||
foreach (['HEADER', 'DATA', 'DEBUG_DATA'] as $ext_smarty) {
|
||||
@@ -524,21 +767,39 @@ class SmartyExtend extends \Smarty
|
||||
/**
|
||||
* render smarty data (can be called sepparate)
|
||||
*
|
||||
* @param string|null $compile_dir BASE . TEMPLATES_C
|
||||
* @param string|null $cache_dir BASE . CACHE
|
||||
* @return void
|
||||
*/
|
||||
public function renderSmarty(): void
|
||||
{
|
||||
public function renderSmarty(
|
||||
?string $compile_dir = null,
|
||||
?string $cache_dir = null
|
||||
): void {
|
||||
// trigger deprecation
|
||||
if (
|
||||
$compile_dir === null ||
|
||||
$cache_dir === null
|
||||
) {
|
||||
/** @deprecated renderSmarty call without parameters */
|
||||
trigger_error(
|
||||
'Calling renderSmarty without paramters is deprecated',
|
||||
E_USER_DEPRECATED
|
||||
);
|
||||
}
|
||||
// set vars (to be deprecated)
|
||||
$compile_dir = $compile_dir ?? BASE . TEMPLATES_C;
|
||||
$cache_dir = $cache_dir ?? BASE . CACHE;
|
||||
// create main data array
|
||||
$this->CONTENT_DATA = array_merge($this->HEADER, $this->DATA, $this->DEBUG_DATA);
|
||||
// data is 1:1 mapping (all vars, values, etc)
|
||||
foreach ($this->CONTENT_DATA as $key => $value) {
|
||||
$this->assign($key, $value);
|
||||
}
|
||||
if (is_dir(BASE . TEMPLATES_C)) {
|
||||
$this->setCompileDir(BASE . TEMPLATES_C);
|
||||
if (is_dir($compile_dir)) {
|
||||
$this->setCompileDir($compile_dir);
|
||||
}
|
||||
if (is_dir(BASE . CACHE)) {
|
||||
$this->setCacheDir(BASE . CACHE);
|
||||
if (is_dir($cache_dir)) {
|
||||
$this->setCacheDir($cache_dir);
|
||||
}
|
||||
$this->display(
|
||||
$this->MASTER_TEMPLATE_NAME,
|
||||
|
||||
@@ -79,10 +79,13 @@ function MyErrorHandler(
|
||||
}
|
||||
$LOG = 'log' . DIRECTORY_SEPARATOR;
|
||||
// if the log folder is not found, try to create it
|
||||
$error = false;
|
||||
if (!is_dir($ROOT . $LOG) && !is_file($ROOT . LOG)) {
|
||||
$ok = mkdir($ROOT . $LOG);
|
||||
if (!$ok) {
|
||||
$error = true;
|
||||
}
|
||||
}
|
||||
$error = 0;
|
||||
// again, if the folder now exists, else set error flag
|
||||
if (is_dir($ROOT . $LOG)) {
|
||||
$fn = $ROOT . $LOG . 'php_errors-' . date('Y-m-d') . '.log';
|
||||
@@ -94,10 +97,10 @@ function MyErrorHandler(
|
||||
fwrite($fp, '[' . date("Y-m-d H:i:s") . '] ' . $output . "\n");
|
||||
fclose($fp);
|
||||
} else {
|
||||
$error = 1;
|
||||
$error = true;
|
||||
}
|
||||
} else {
|
||||
$error = 1;
|
||||
$error = true;
|
||||
}
|
||||
|
||||
// if the above writing failed
|
||||
|
||||
@@ -17,9 +17,12 @@ class TestDB
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param \CoreLibs\Debug\Logging $log
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
public function __construct(
|
||||
\CoreLibs\Debug\Logging $log
|
||||
) {
|
||||
$this->config = [
|
||||
'db_name' => $_ENV['DB_NAME_TEST'] ?? '',
|
||||
'db_user' => $_ENV['DB_USER_TEST'] ?? '',
|
||||
@@ -31,7 +34,10 @@ class TestDB
|
||||
'db_encoding' => '',
|
||||
'db_ssl' => 'allow'
|
||||
];
|
||||
$this->db = new IO($this->config);
|
||||
$this->db = new IO(
|
||||
$this->config,
|
||||
$log
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,15 +23,16 @@ class Test
|
||||
/** @var DB\TestDB */
|
||||
private $test_db;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
public function __construct(
|
||||
\CoreLibs\Debug\Logging $log
|
||||
) {
|
||||
// calls all tests
|
||||
$this->testPrivate();
|
||||
$this->testProtected();
|
||||
$this->testPublic();
|
||||
|
||||
// call intern
|
||||
$this->test_db = new DB\TestDB();
|
||||
$this->test_db = new DB\TestDB($log);
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<psalm
|
||||
resolveFromConfigFile="true"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="https://getpsalm.org/schema/config"
|
||||
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
|
||||
autoloader="lib/autoloader.php"
|
||||
errorLevel="8"
|
||||
>
|
||||
<extraFiles>
|
||||
<file name="configs/config.master.php" />
|
||||
</extraFiles>
|
||||
<projectFiles>
|
||||
<file name="admin/class_test.php" />
|
||||
<file name="admin/config.php" />
|
||||
<directory name="configs" />
|
||||
<directory name="frontend" />
|
||||
<directory name="includes" />
|
||||
<directory name="lib" />
|
||||
<directory name="layout" />
|
||||
<ignoreFiles>
|
||||
<directory name="vendor" />
|
||||
<directory name="templates_c" />
|
||||
<directory name="cache" />
|
||||
<directory name="tmp" />
|
||||
<directory name="log" />
|
||||
<directory name="media" />
|
||||
<directory name="lib/FileUpload" />
|
||||
<directory name="lib/Smarty" />
|
||||
<directory name="lib/smarty-4.3.0" />
|
||||
<file name="lib/Smarty/Smarty.class.php" />
|
||||
<file name="lib/CoreLibs/Template/SmartyExtend.php" />
|
||||
</ignoreFiles>
|
||||
</projectFiles>
|
||||
|
||||
<issueHandlers>
|
||||
<LessSpecificReturnType errorLevel="error" />
|
||||
|
||||
<!-- level 3 issues - slightly lazy code writing, but provably low false-negatives -->
|
||||
|
||||
<DeprecatedMethod errorLevel="error" />
|
||||
<DeprecatedProperty errorLevel="error" />
|
||||
<DeprecatedClass errorLevel="error" />
|
||||
<DeprecatedConstant errorLevel="error" />
|
||||
<DeprecatedFunction errorLevel="error" />
|
||||
<DeprecatedInterface errorLevel="error" />
|
||||
<DeprecatedTrait errorLevel="error" />
|
||||
|
||||
<InternalMethod errorLevel="error" />
|
||||
<InternalProperty errorLevel="error" />
|
||||
<InternalClass errorLevel="error" />
|
||||
|
||||
<MissingClosureReturnType errorLevel="error" />
|
||||
<MissingReturnType errorLevel="error" />
|
||||
<MissingPropertyType errorLevel="error" />
|
||||
<InvalidDocblock errorLevel="error" />
|
||||
|
||||
<PropertyNotSetInConstructor errorLevel="error" />
|
||||
<MissingConstructor errorLevel="error" />
|
||||
<MissingClosureParamType errorLevel="error" />
|
||||
<MissingParamType errorLevel="error" />
|
||||
|
||||
<RedundantCondition errorLevel="error" />
|
||||
|
||||
<DocblockTypeContradiction errorLevel="error" />
|
||||
<RedundantConditionGivenDocblockType errorLevel="error" />
|
||||
|
||||
<UnresolvableInclude errorLevel="error" />
|
||||
|
||||
<RawObjectIteration errorLevel="error" />
|
||||
|
||||
<InvalidStringClass errorLevel="error" />
|
||||
</issueHandlers>
|
||||
</psalm>
|
||||
3
www/vendor/composer/autoload_classmap.php
vendored
3
www/vendor/composer/autoload_classmap.php
vendored
@@ -16,7 +16,6 @@ return array(
|
||||
'CoreLibs\\Check\\Email' => $baseDir . '/lib/CoreLibs/Check/Email.php',
|
||||
'CoreLibs\\Check\\Encoding' => $baseDir . '/lib/CoreLibs/Check/Encoding.php',
|
||||
'CoreLibs\\Check\\File' => $baseDir . '/lib/CoreLibs/Check/File.php',
|
||||
'CoreLibs\\Check\\Jason' => $baseDir . '/lib/CoreLibs/Check/Jason.php',
|
||||
'CoreLibs\\Check\\Password' => $baseDir . '/lib/CoreLibs/Check/Password.php',
|
||||
'CoreLibs\\Check\\PhpVersion' => $baseDir . '/lib/CoreLibs/Check/PhpVersion.php',
|
||||
'CoreLibs\\Combined\\ArrayHandler' => $baseDir . '/lib/CoreLibs/Combined/ArrayHandler.php',
|
||||
@@ -48,14 +47,12 @@ return array(
|
||||
'CoreLibs\\Debug\\RunningTime' => $baseDir . '/lib/CoreLibs/Debug/RunningTime.php',
|
||||
'CoreLibs\\Debug\\Support' => $baseDir . '/lib/CoreLibs/Debug/Support.php',
|
||||
'CoreLibs\\Get\\DotEnv' => $baseDir . '/lib/CoreLibs/Get/DotEnv.php',
|
||||
'CoreLibs\\Get\\ReadEnvFile' => $baseDir . '/lib/CoreLibs/Get/ReadEnvFile.php',
|
||||
'CoreLibs\\Get\\System' => $baseDir . '/lib/CoreLibs/Get/System.php',
|
||||
'CoreLibs\\Language\\Core\\CachedFileReader' => $baseDir . '/lib/CoreLibs/Language/Core/CachedFileReader.php',
|
||||
'CoreLibs\\Language\\Core\\FileReader' => $baseDir . '/lib/CoreLibs/Language/Core/FileReader.php',
|
||||
'CoreLibs\\Language\\Core\\GetTextReader' => $baseDir . '/lib/CoreLibs/Language/Core/GetTextReader.php',
|
||||
'CoreLibs\\Language\\Core\\StreamReader' => $baseDir . '/lib/CoreLibs/Language/Core/StreamReader.php',
|
||||
'CoreLibs\\Language\\Core\\StringReader' => $baseDir . '/lib/CoreLibs/Language/Core/StringReader.php',
|
||||
'CoreLibs\\Language\\Encoding' => $baseDir . '/lib/CoreLibs/Language/Encoding.php',
|
||||
'CoreLibs\\Language\\GetLocale' => $baseDir . '/lib/CoreLibs/Language/GetLocale.php',
|
||||
'CoreLibs\\Language\\L10n' => $baseDir . '/lib/CoreLibs/Language/L10n.php',
|
||||
'CoreLibs\\Output\\Form\\Elements' => $baseDir . '/lib/CoreLibs/Output/Form/Elements.php',
|
||||
|
||||
2
www/vendor/composer/autoload_psr4.php
vendored
2
www/vendor/composer/autoload_psr4.php
vendored
@@ -6,6 +6,8 @@ $vendorDir = dirname(__DIR__);
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'gullevek\\dotenv\\' => array($vendorDir . '/gullevek/dotenv/src'),
|
||||
'gullevek\\dotEnv\\' => array($vendorDir . '/gullevek/dotenv/src'),
|
||||
'PhpParser\\' => array($vendorDir . '/nikic/php-parser/lib/PhpParser'),
|
||||
'Doctrine\\Instantiator\\' => array($vendorDir . '/doctrine/instantiator/src/Doctrine/Instantiator'),
|
||||
'DeepCopy\\' => array($vendorDir . '/myclabs/deep-copy/src/DeepCopy'),
|
||||
|
||||
2
www/vendor/composer/autoload_real.php
vendored
2
www/vendor/composer/autoload_real.php
vendored
@@ -22,6 +22,8 @@ class ComposerAutoloaderInit10fe8fe2ec4017b8644d2b64bcf398b9
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
require __DIR__ . '/platform_check.php';
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit10fe8fe2ec4017b8644d2b64bcf398b9', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit10fe8fe2ec4017b8644d2b64bcf398b9', 'loadClassLoader'));
|
||||
|
||||
16
www/vendor/composer/autoload_static.php
vendored
16
www/vendor/composer/autoload_static.php
vendored
@@ -12,6 +12,11 @@ class ComposerStaticInit10fe8fe2ec4017b8644d2b64bcf398b9
|
||||
);
|
||||
|
||||
public static $prefixLengthsPsr4 = array (
|
||||
'g' =>
|
||||
array (
|
||||
'gullevek\\dotenv\\' => 16,
|
||||
'gullevek\\dotEnv\\' => 16,
|
||||
),
|
||||
'P' =>
|
||||
array (
|
||||
'PhpParser\\' => 10,
|
||||
@@ -24,6 +29,14 @@ class ComposerStaticInit10fe8fe2ec4017b8644d2b64bcf398b9
|
||||
);
|
||||
|
||||
public static $prefixDirsPsr4 = array (
|
||||
'gullevek\\dotenv\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/gullevek/dotenv/src',
|
||||
),
|
||||
'gullevek\\dotEnv\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/gullevek/dotenv/src',
|
||||
),
|
||||
'PhpParser\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser',
|
||||
@@ -49,7 +62,6 @@ class ComposerStaticInit10fe8fe2ec4017b8644d2b64bcf398b9
|
||||
'CoreLibs\\Check\\Email' => __DIR__ . '/../..' . '/lib/CoreLibs/Check/Email.php',
|
||||
'CoreLibs\\Check\\Encoding' => __DIR__ . '/../..' . '/lib/CoreLibs/Check/Encoding.php',
|
||||
'CoreLibs\\Check\\File' => __DIR__ . '/../..' . '/lib/CoreLibs/Check/File.php',
|
||||
'CoreLibs\\Check\\Jason' => __DIR__ . '/../..' . '/lib/CoreLibs/Check/Jason.php',
|
||||
'CoreLibs\\Check\\Password' => __DIR__ . '/../..' . '/lib/CoreLibs/Check/Password.php',
|
||||
'CoreLibs\\Check\\PhpVersion' => __DIR__ . '/../..' . '/lib/CoreLibs/Check/PhpVersion.php',
|
||||
'CoreLibs\\Combined\\ArrayHandler' => __DIR__ . '/../..' . '/lib/CoreLibs/Combined/ArrayHandler.php',
|
||||
@@ -81,14 +93,12 @@ class ComposerStaticInit10fe8fe2ec4017b8644d2b64bcf398b9
|
||||
'CoreLibs\\Debug\\RunningTime' => __DIR__ . '/../..' . '/lib/CoreLibs/Debug/RunningTime.php',
|
||||
'CoreLibs\\Debug\\Support' => __DIR__ . '/../..' . '/lib/CoreLibs/Debug/Support.php',
|
||||
'CoreLibs\\Get\\DotEnv' => __DIR__ . '/../..' . '/lib/CoreLibs/Get/DotEnv.php',
|
||||
'CoreLibs\\Get\\ReadEnvFile' => __DIR__ . '/../..' . '/lib/CoreLibs/Get/ReadEnvFile.php',
|
||||
'CoreLibs\\Get\\System' => __DIR__ . '/../..' . '/lib/CoreLibs/Get/System.php',
|
||||
'CoreLibs\\Language\\Core\\CachedFileReader' => __DIR__ . '/../..' . '/lib/CoreLibs/Language/Core/CachedFileReader.php',
|
||||
'CoreLibs\\Language\\Core\\FileReader' => __DIR__ . '/../..' . '/lib/CoreLibs/Language/Core/FileReader.php',
|
||||
'CoreLibs\\Language\\Core\\GetTextReader' => __DIR__ . '/../..' . '/lib/CoreLibs/Language/Core/GetTextReader.php',
|
||||
'CoreLibs\\Language\\Core\\StreamReader' => __DIR__ . '/../..' . '/lib/CoreLibs/Language/Core/StreamReader.php',
|
||||
'CoreLibs\\Language\\Core\\StringReader' => __DIR__ . '/../..' . '/lib/CoreLibs/Language/Core/StringReader.php',
|
||||
'CoreLibs\\Language\\Encoding' => __DIR__ . '/../..' . '/lib/CoreLibs/Language/Encoding.php',
|
||||
'CoreLibs\\Language\\GetLocale' => __DIR__ . '/../..' . '/lib/CoreLibs/Language/GetLocale.php',
|
||||
'CoreLibs\\Language\\L10n' => __DIR__ . '/../..' . '/lib/CoreLibs/Language/L10n.php',
|
||||
'CoreLibs\\Output\\Form\\Elements' => __DIR__ . '/../..' . '/lib/CoreLibs/Output/Form/Elements.php',
|
||||
|
||||
87
www/vendor/composer/installed.json
vendored
87
www/vendor/composer/installed.json
vendored
@@ -106,6 +106,63 @@
|
||||
],
|
||||
"install-path": "../egrajp/smarty-extended"
|
||||
},
|
||||
{
|
||||
"name": "gullevek/dotenv",
|
||||
"version": "v2.0.8",
|
||||
"version_normalized": "2.0.8.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/gullevek/dotEnv.git",
|
||||
"reference": "e29f9fcd8853a09bb89b0eb8ee555b754ecee36e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/gullevek/dotEnv/zipball/e29f9fcd8853a09bb89b0eb8ee555b754ecee36e",
|
||||
"reference": "e29f9fcd8853a09bb89b0eb8ee555b754ecee36e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.4.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phan/phan": "^5.4",
|
||||
"phpstan/phpstan": "^1.10",
|
||||
"phpunit/phpunit": "^9"
|
||||
},
|
||||
"time": "2023-03-03T00:32:02+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"gullevek\\dotEnv\\": "src/",
|
||||
"gullevek\\dotenv\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Clemens Schwaighofer",
|
||||
"email": "gullevek@gullevek.org",
|
||||
"homepage": "http://gullevek.org"
|
||||
}
|
||||
],
|
||||
"description": "Simple .env file processing and storing in _ENV array",
|
||||
"homepage": "https://github.com/gullevek/dotEnv",
|
||||
"keywords": [
|
||||
".env",
|
||||
"_ENV",
|
||||
"dotenv",
|
||||
"environment variables"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/gullevek/dotEnv/issues",
|
||||
"source": "https://github.com/gullevek/dotEnv/tree/v2.0.8"
|
||||
},
|
||||
"install-path": "../gullevek/dotenv"
|
||||
},
|
||||
{
|
||||
"name": "myclabs/deep-copy",
|
||||
"version": "1.11.0",
|
||||
@@ -346,24 +403,24 @@
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-code-coverage",
|
||||
"version": "9.2.24",
|
||||
"version_normalized": "9.2.24.0",
|
||||
"version": "9.2.25",
|
||||
"version_normalized": "9.2.25.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
|
||||
"reference": "2cf940ebc6355a9d430462811b5aaa308b174bed"
|
||||
"reference": "0e2b40518197a8c0d4b08bc34dfff1c99c508954"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2cf940ebc6355a9d430462811b5aaa308b174bed",
|
||||
"reference": "2cf940ebc6355a9d430462811b5aaa308b174bed",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/0e2b40518197a8c0d4b08bc34dfff1c99c508954",
|
||||
"reference": "0e2b40518197a8c0d4b08bc34dfff1c99c508954",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-dom": "*",
|
||||
"ext-libxml": "*",
|
||||
"ext-xmlwriter": "*",
|
||||
"nikic/php-parser": "^4.14",
|
||||
"nikic/php-parser": "^4.15",
|
||||
"php": ">=7.3",
|
||||
"phpunit/php-file-iterator": "^3.0.3",
|
||||
"phpunit/php-text-template": "^2.0.2",
|
||||
@@ -381,7 +438,7 @@
|
||||
"ext-pcov": "*",
|
||||
"ext-xdebug": "*"
|
||||
},
|
||||
"time": "2023-01-26T08:26:55+00:00",
|
||||
"time": "2023-02-25T05:32:00+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
@@ -414,7 +471,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
|
||||
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.24"
|
||||
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.25"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -679,17 +736,17 @@
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit",
|
||||
"version": "9.6.3",
|
||||
"version_normalized": "9.6.3.0",
|
||||
"version": "9.6.4",
|
||||
"version_normalized": "9.6.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||
"reference": "e7b1615e3e887d6c719121c6d4a44b0ab9645555"
|
||||
"reference": "9125ee085b6d95e78277dc07aa1f46f9e0607b8d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e7b1615e3e887d6c719121c6d4a44b0ab9645555",
|
||||
"reference": "e7b1615e3e887d6c719121c6d4a44b0ab9645555",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9125ee085b6d95e78277dc07aa1f46f9e0607b8d",
|
||||
"reference": "9125ee085b6d95e78277dc07aa1f46f9e0607b8d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -725,7 +782,7 @@
|
||||
"ext-soap": "*",
|
||||
"ext-xdebug": "*"
|
||||
},
|
||||
"time": "2023-02-04T13:37:15+00:00",
|
||||
"time": "2023-02-27T13:06:37+00:00",
|
||||
"bin": [
|
||||
"phpunit"
|
||||
],
|
||||
@@ -764,7 +821,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.3"
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.4"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
||||
21
www/vendor/composer/installed.php
vendored
21
www/vendor/composer/installed.php
vendored
@@ -37,6 +37,15 @@
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'gullevek/dotenv' => array(
|
||||
'pretty_version' => 'v2.0.8',
|
||||
'version' => '2.0.8.0',
|
||||
'reference' => 'e29f9fcd8853a09bb89b0eb8ee555b754ecee36e',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../gullevek/dotenv',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'myclabs/deep-copy' => array(
|
||||
'pretty_version' => '1.11.0',
|
||||
'version' => '1.11.0.0',
|
||||
@@ -74,9 +83,9 @@
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'phpunit/php-code-coverage' => array(
|
||||
'pretty_version' => '9.2.24',
|
||||
'version' => '9.2.24.0',
|
||||
'reference' => '2cf940ebc6355a9d430462811b5aaa308b174bed',
|
||||
'pretty_version' => '9.2.25',
|
||||
'version' => '9.2.25.0',
|
||||
'reference' => '0e2b40518197a8c0d4b08bc34dfff1c99c508954',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../phpunit/php-code-coverage',
|
||||
'aliases' => array(),
|
||||
@@ -119,9 +128,9 @@
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'phpunit/phpunit' => array(
|
||||
'pretty_version' => '9.6.3',
|
||||
'version' => '9.6.3.0',
|
||||
'reference' => 'e7b1615e3e887d6c719121c6d4a44b0ab9645555',
|
||||
'pretty_version' => '9.6.4',
|
||||
'version' => '9.6.4.0',
|
||||
'reference' => '9125ee085b6d95e78277dc07aa1f46f9e0607b8d',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../phpunit/phpunit',
|
||||
'aliases' => array(),
|
||||
|
||||
26
www/vendor/composer/platform_check.php
vendored
Normal file
26
www/vendor/composer/platform_check.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
// platform_check.php @generated by Composer
|
||||
|
||||
$issues = array();
|
||||
|
||||
if (!(PHP_VERSION_ID >= 80100)) {
|
||||
$issues[] = 'Your Composer dependencies require a PHP version ">= 8.1.0". You are running ' . PHP_VERSION . '.';
|
||||
}
|
||||
|
||||
if ($issues) {
|
||||
if (!headers_sent()) {
|
||||
header('HTTP/1.1 500 Internal Server Error');
|
||||
}
|
||||
if (!ini_get('display_errors')) {
|
||||
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
|
||||
fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
|
||||
} elseif (!headers_sent()) {
|
||||
echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
|
||||
}
|
||||
}
|
||||
trigger_error(
|
||||
'Composer detected issues in your platform: ' . implode(' ', $issues),
|
||||
E_USER_ERROR
|
||||
);
|
||||
}
|
||||
78
www/vendor/gullevek/dotenv/Readme.md
vendored
Normal file
78
www/vendor/gullevek/dotenv/Readme.md
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
# dotenv: readEnvFile()
|
||||
|
||||
A simple implementation of <https://github.com/vlucas/phpdotenv>
|
||||
|
||||
This is not a functional replacement, but a very simple implementation of the basic functions.
|
||||
|
||||
It is recommended to create a `.env.example` example file that is checked into the
|
||||
repository. The `.env` should *NEVER* be checked into anything
|
||||
|
||||
## How to install
|
||||
|
||||
`composer require gullevek/dotEnv`
|
||||
|
||||
## Run it
|
||||
|
||||
Create a `.env` file in the current folder.
|
||||
Create a file like below
|
||||
|
||||
```php
|
||||
require '../vendor/autoload.php';
|
||||
gullevek\dotEnv\DotEnv::readEnvFile(__DIR__);
|
||||
```
|
||||
|
||||
All data will be in the `$_ENV` array
|
||||
|
||||
## How it works
|
||||
|
||||
Put the function where it is needed or put it in a file and load it.
|
||||
|
||||
if not parameter is given it will use `__DIR__` as base path.
|
||||
Second parameter is file name override. Default is `.env`
|
||||
|
||||
Data is loaded into _ENV only.
|
||||
|
||||
If there is already an entry in _ENV then it will not be overwritten.
|
||||
|
||||
## .env file example
|
||||
|
||||
A valid entry has to start with an alphanumeric string, underscores are allowed and
|
||||
then have an equal sign (=). After the equal sign the data block starts. Data can be
|
||||
quoted with double quotes (") and if this is done can stretch over multiple lines.
|
||||
The openeing double quote must be on the same lign as the requal sign (=). If double
|
||||
quoted (") charcters are used it will read each line until another double quote (")
|
||||
character is found. Everything after that is ignored.
|
||||
|
||||
Any spaces before the variable or before and after the equal sign (=) are ignored.
|
||||
|
||||
Line is read until `PHP_EOL`. So any trailing spaces are read too.
|
||||
|
||||
Any line that is not valid is ignored.
|
||||
|
||||
```ini
|
||||
# this line is ignored
|
||||
SOMETHING=A
|
||||
OTHER="A B C"
|
||||
MULTI_LINE="1 2 3
|
||||
4 5 6
|
||||
7 8 9" ; and this is ignored
|
||||
ESCAPE="String \" inside \" other "
|
||||
DOUBLE="I will be used"
|
||||
DOUBLE="This will be ignored"
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
### Phan
|
||||
|
||||
`vendor/bin/phan --analyze-twice`
|
||||
|
||||
### PHPstan
|
||||
|
||||
`vendor/bin/phpstan`
|
||||
|
||||
### PHPUnit
|
||||
|
||||
Unit tests have to be run from base folder with
|
||||
|
||||
`vendor/bin/phpunit test/phpUnitTests/`
|
||||
33
www/vendor/gullevek/dotenv/composer.json
vendored
Normal file
33
www/vendor/gullevek/dotenv/composer.json
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "gullevek/dotenv",
|
||||
"description": "Simple .env file processing and storing in _ENV array",
|
||||
"keywords": [".env", "dotenv", "_ENV", "environment variables"],
|
||||
"type": "library",
|
||||
"license": "MIT",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"gullevek\\dotEnv\\": "src/",
|
||||
"gullevek\\dotenv\\": "src/"
|
||||
}
|
||||
},
|
||||
"authors": [
|
||||
{
|
||||
"name": "Clemens Schwaighofer",
|
||||
"email": "gullevek@gullevek.org",
|
||||
"homepage": "http://gullevek.org"
|
||||
}
|
||||
],
|
||||
"homepage": "https://github.com/gullevek/dotEnv",
|
||||
"minimum-stability": "dev",
|
||||
"require": {
|
||||
"php": ">=7.4.0"
|
||||
},
|
||||
"archive": {
|
||||
"exclude": ["/test/", "/test/*", "/phpstan.neon", "/psalm.xml", "/.phan/", "/.vscode/", "/phpunit.xml"]
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^9",
|
||||
"phpstan/phpstan": "^1.10",
|
||||
"phan/phan": "^5.4"
|
||||
}
|
||||
}
|
||||
110
www/vendor/gullevek/dotenv/src/DotEnv.php
vendored
Normal file
110
www/vendor/gullevek/dotenv/src/DotEnv.php
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace gullevek\dotEnv;
|
||||
|
||||
class DotEnv
|
||||
{
|
||||
/** @var string constant comment char, set to # */
|
||||
private const COMMENT_CHAR = '#';
|
||||
|
||||
/**
|
||||
* parses .env file
|
||||
*
|
||||
* Rules for .env file
|
||||
* variable is any alphanumeric string followed by = on the same line
|
||||
* content starts with the first non space part
|
||||
* strings can be contained in "
|
||||
* strings MUST be contained in " if they are multiline
|
||||
* if string starts with " it will match until another " is found
|
||||
* anything AFTER " is ignored
|
||||
* if there are two variables with the same name only the first is used
|
||||
* variables are case sensitive
|
||||
*
|
||||
* @param string $path Folder to file, default is __DIR__
|
||||
* @param string $env_file What file to load, default is .env
|
||||
* @return int -1 other error
|
||||
* 0 for success full load
|
||||
* 1 for file loadable, no data or data already loaded
|
||||
* 2 for file not readable or open failed
|
||||
* 3 for file not found
|
||||
*/
|
||||
public static function readEnvFile(
|
||||
string $path = __DIR__,
|
||||
string $env_file = '.env'
|
||||
): int {
|
||||
// default -1;
|
||||
$status = -1;
|
||||
$env_file_target = $path . DIRECTORY_SEPARATOR . $env_file;
|
||||
// this is not a file -> abort
|
||||
if (!is_file($env_file_target)) {
|
||||
$status = 3;
|
||||
return $status;
|
||||
}
|
||||
// cannot open file -> abort
|
||||
if (!is_readable($env_file_target)) {
|
||||
$status = 2;
|
||||
return $status;
|
||||
}
|
||||
// open file
|
||||
if (($fp = fopen($env_file_target, 'r')) === false) {
|
||||
$status = 2;
|
||||
return $status;
|
||||
}
|
||||
// set to readable but not yet any data loaded
|
||||
$status = 1;
|
||||
$block = false;
|
||||
$var = '';
|
||||
while ($line = fgets($fp)) {
|
||||
// main match for variable = value part
|
||||
if (preg_match("/^\s*([\w_.]+)\s*=\s*((\"?).*)/", $line, $matches)) {
|
||||
$var = $matches[1];
|
||||
$value = $matches[2];
|
||||
$quotes = $matches[3];
|
||||
// write only if env is not set yet, and write only the first time
|
||||
if (empty($_ENV[$var])) {
|
||||
if (!empty($quotes)) {
|
||||
// match greedy for first to last so we move any " if there are
|
||||
if (preg_match('/^"(.*[^\\\])"/U', $value, $matches)) {
|
||||
$value = $matches[1];
|
||||
} else {
|
||||
// this is a multi line
|
||||
$block = true;
|
||||
// first " in string remove
|
||||
// add removed new line back because this is a multi line
|
||||
$value = ltrim($value, '"') . PHP_EOL;
|
||||
}
|
||||
} else {
|
||||
// strip any quotes at end for unquoted single line
|
||||
// an right hand spaces are removed too
|
||||
$value = false !== ($pos = strpos($value, self::COMMENT_CHAR)) ?
|
||||
rtrim(substr($value, 0, $pos)) : $value;
|
||||
}
|
||||
// if block is set, we strip line of slashes
|
||||
$_ENV[$var] = $block === true ? stripslashes($value) : $value;
|
||||
// set successful load
|
||||
$status = 0;
|
||||
}
|
||||
} elseif ($block === true) {
|
||||
// read line until there is a unescaped "
|
||||
// this also strips everything after the last "
|
||||
if (preg_match("/(.*[^\\\])\"/", $line, $matches)) {
|
||||
$block = false;
|
||||
// strip ending " and EVERYTHING that follows after that
|
||||
$line = $matches[1];
|
||||
}
|
||||
// just be sure it is init before we fill
|
||||
if (!isset($_ENV[$var])) {
|
||||
$_ENV[$var] = '';
|
||||
}
|
||||
// strip line of slashes
|
||||
$_ENV[$var] .= stripslashes($line);
|
||||
}
|
||||
}
|
||||
fclose($fp);
|
||||
return $status;
|
||||
}
|
||||
}
|
||||
|
||||
// __END__
|
||||
@@ -2,6 +2,12 @@
|
||||
|
||||
All notable changes are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
|
||||
|
||||
## [9.2.25] - 2023-02-25
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#981](https://github.com/sebastianbergmann/php-code-coverage/issues/981): `CodeUnitFindingVisitor` does not support DNF types
|
||||
|
||||
## [9.2.24] - 2023-01-26
|
||||
|
||||
### Changed
|
||||
@@ -464,6 +470,7 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
|
||||
|
||||
* This component is no longer supported on PHP 7.1
|
||||
|
||||
[9.2.25]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.24...9.2.25
|
||||
[9.2.24]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.23...9.2.24
|
||||
[9.2.23]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.22...9.2.23
|
||||
[9.2.22]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.21...9.2.22
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
"ext-dom": "*",
|
||||
"ext-libxml": "*",
|
||||
"ext-xmlwriter": "*",
|
||||
"nikic/php-parser": "^4.14",
|
||||
"nikic/php-parser": "^4.15",
|
||||
"phpunit/php-file-iterator": "^3.0.3",
|
||||
"phpunit/php-text-template": "^2.0.2",
|
||||
"sebastian/code-unit-reverse-lookup": "^2.0.2",
|
||||
|
||||
@@ -117,7 +117,7 @@ final class Dashboard extends Renderer
|
||||
private function coverageDistribution(array $classes): array
|
||||
{
|
||||
$result = [
|
||||
'class' => [
|
||||
'class' => [
|
||||
'0%' => 0,
|
||||
'0-10%' => 0,
|
||||
'10-20%' => 0,
|
||||
|
||||
@@ -284,19 +284,19 @@ final class File extends Renderer
|
||||
$buffer .= $this->renderItemTemplate(
|
||||
$template,
|
||||
[
|
||||
'name' => $this->abbreviateClassName($name),
|
||||
'numClasses' => $numClasses,
|
||||
'numTestedClasses' => $numTestedClasses,
|
||||
'numMethods' => $numMethods,
|
||||
'numTestedMethods' => $numTestedMethods,
|
||||
'linesExecutedPercent' => Percentage::fromFractionAndTotal(
|
||||
'name' => $this->abbreviateClassName($name),
|
||||
'numClasses' => $numClasses,
|
||||
'numTestedClasses' => $numTestedClasses,
|
||||
'numMethods' => $numMethods,
|
||||
'numTestedMethods' => $numTestedMethods,
|
||||
'linesExecutedPercent' => Percentage::fromFractionAndTotal(
|
||||
$item['executedLines'],
|
||||
$item['executableLines'],
|
||||
)->asFloat(),
|
||||
'linesExecutedPercentAsString' => $linesExecutedPercentAsString,
|
||||
'numExecutedLines' => $item['executedLines'],
|
||||
'numExecutableLines' => $item['executableLines'],
|
||||
'branchesExecutedPercent' => Percentage::fromFractionAndTotal(
|
||||
'linesExecutedPercentAsString' => $linesExecutedPercentAsString,
|
||||
'numExecutedLines' => $item['executedLines'],
|
||||
'numExecutableLines' => $item['executableLines'],
|
||||
'branchesExecutedPercent' => Percentage::fromFractionAndTotal(
|
||||
$item['executedBranches'],
|
||||
$item['executableBranches'],
|
||||
)->asFloat(),
|
||||
@@ -307,14 +307,14 @@ final class File extends Renderer
|
||||
$item['executedPaths'],
|
||||
$item['executablePaths']
|
||||
)->asFloat(),
|
||||
'pathsExecutedPercentAsString' => $pathsExecutedPercentAsString,
|
||||
'numExecutedPaths' => $item['executedPaths'],
|
||||
'numExecutablePaths' => $item['executablePaths'],
|
||||
'testedMethodsPercent' => $testedMethodsPercentage->asFloat(),
|
||||
'testedMethodsPercentAsString' => $testedMethodsPercentage->asString(),
|
||||
'testedClassesPercent' => $testedClassesPercentage->asFloat(),
|
||||
'testedClassesPercentAsString' => $testedClassesPercentage->asString(),
|
||||
'crap' => $item['crap'],
|
||||
'pathsExecutedPercentAsString' => $pathsExecutedPercentAsString,
|
||||
'numExecutedPaths' => $item['executedPaths'],
|
||||
'numExecutablePaths' => $item['executablePaths'],
|
||||
'testedMethodsPercent' => $testedMethodsPercentage->asFloat(),
|
||||
'testedMethodsPercentAsString' => $testedMethodsPercentage->asString(),
|
||||
'testedClassesPercent' => $testedClassesPercentage->asFloat(),
|
||||
'testedClassesPercentAsString' => $testedClassesPercentage->asString(),
|
||||
'crap' => $item['crap'],
|
||||
]
|
||||
);
|
||||
|
||||
@@ -384,7 +384,7 @@ final class File extends Renderer
|
||||
return $this->renderItemTemplate(
|
||||
$template,
|
||||
[
|
||||
'name' => sprintf(
|
||||
'name' => sprintf(
|
||||
'%s<a href="#%d"><abbr title="%s">%s</abbr></a>',
|
||||
$indent,
|
||||
$item['startLine'],
|
||||
|
||||
@@ -26,6 +26,7 @@ use PhpParser\Node\Stmt\Function_;
|
||||
use PhpParser\Node\Stmt\Interface_;
|
||||
use PhpParser\Node\Stmt\Trait_;
|
||||
use PhpParser\Node\UnionType;
|
||||
use PhpParser\NodeAbstract;
|
||||
use PhpParser\NodeTraverser;
|
||||
use PhpParser\NodeVisitorAbstract;
|
||||
use SebastianBergmann\Complexity\CyclomaticComplexityCalculatingVisitor;
|
||||
@@ -180,8 +181,12 @@ final class CodeUnitFindingVisitor extends NodeVisitorAbstract
|
||||
return '?' . $type->type;
|
||||
}
|
||||
|
||||
if ($type instanceof UnionType || $type instanceof IntersectionType) {
|
||||
return $this->unionOrIntersectionAsString($type);
|
||||
if ($type instanceof UnionType) {
|
||||
return $this->unionTypeAsString($type);
|
||||
}
|
||||
|
||||
if ($type instanceof IntersectionType) {
|
||||
return $this->intersectionTypeAsString($type);
|
||||
}
|
||||
|
||||
return $type->toString();
|
||||
@@ -298,29 +303,43 @@ final class CodeUnitFindingVisitor extends NodeVisitorAbstract
|
||||
return trim(rtrim($namespacedName, $name), '\\');
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-param UnionType|IntersectionType $type
|
||||
*/
|
||||
private function unionOrIntersectionAsString(ComplexType $type): string
|
||||
private function unionTypeAsString(UnionType $node): string
|
||||
{
|
||||
if ($type instanceof UnionType) {
|
||||
$separator = '|';
|
||||
} else {
|
||||
$separator = '&';
|
||||
}
|
||||
|
||||
$types = [];
|
||||
|
||||
foreach ($type->types as $_type) {
|
||||
if ($_type instanceof Name) {
|
||||
$types[] = $_type->toCodeString();
|
||||
} else {
|
||||
assert($_type instanceof Identifier);
|
||||
foreach ($node->types as $type) {
|
||||
if ($type instanceof IntersectionType) {
|
||||
$types[] = '(' . $this->intersectionTypeAsString($type) . ')';
|
||||
|
||||
$types[] = $_type->toString();
|
||||
continue;
|
||||
}
|
||||
|
||||
$types[] = $this->typeAsString($type);
|
||||
}
|
||||
|
||||
return implode($separator, $types);
|
||||
return implode('|', $types);
|
||||
}
|
||||
|
||||
private function intersectionTypeAsString(IntersectionType $node): string
|
||||
{
|
||||
$types = [];
|
||||
|
||||
foreach ($node->types as $type) {
|
||||
$types[] = $this->typeAsString($type);
|
||||
}
|
||||
|
||||
return implode('&', $types);
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-param Identifier|Name $node $node
|
||||
*/
|
||||
private function typeAsString(NodeAbstract $node): string
|
||||
{
|
||||
if ($node instanceof Name) {
|
||||
return $node->toCodeString();
|
||||
}
|
||||
|
||||
return $node->toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ final class Version
|
||||
public static function id(): string
|
||||
{
|
||||
if (self::$version === null) {
|
||||
self::$version = (new VersionId('9.2.24', dirname(__DIR__)))->getVersion();
|
||||
self::$version = (new VersionId('9.2.25', dirname(__DIR__)))->getVersion();
|
||||
}
|
||||
|
||||
return self::$version;
|
||||
|
||||
7
www/vendor/phpunit/phpunit/ChangeLog-8.5.md
vendored
7
www/vendor/phpunit/phpunit/ChangeLog-8.5.md
vendored
@@ -2,6 +2,12 @@
|
||||
|
||||
All notable changes of the PHPUnit 8.5 release series are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
|
||||
|
||||
## [8.5.33] - 2023-02-27
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#5186](https://github.com/sebastianbergmann/phpunit/issues/5186): SBOM does not validate
|
||||
|
||||
## [8.5.32] - 2023-01-26
|
||||
|
||||
### Fixed
|
||||
@@ -262,6 +268,7 @@ All notable changes of the PHPUnit 8.5 release series are documented in this fil
|
||||
* [#3967](https://github.com/sebastianbergmann/phpunit/issues/3967): Cannot double interface that extends interface that extends `\Throwable`
|
||||
* [#3968](https://github.com/sebastianbergmann/phpunit/pull/3968): Test class run in a separate PHP process are passing when `exit` called inside
|
||||
|
||||
[8.5.33]: https://github.com/sebastianbergmann/phpunit/compare/8.5.32...8.5.33
|
||||
[8.5.32]: https://github.com/sebastianbergmann/phpunit/compare/8.5.31...8.5.32
|
||||
[8.5.31]: https://github.com/sebastianbergmann/phpunit/compare/8.5.30...8.5.31
|
||||
[8.5.30]: https://github.com/sebastianbergmann/phpunit/compare/8.5.29...8.5.30
|
||||
|
||||
9
www/vendor/phpunit/phpunit/ChangeLog-9.6.md
vendored
9
www/vendor/phpunit/phpunit/ChangeLog-9.6.md
vendored
@@ -2,6 +2,12 @@
|
||||
|
||||
All notable changes of the PHPUnit 9.6 release series are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
|
||||
|
||||
## [9.6.4] - 2023-02-27
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#5186](https://github.com/sebastianbergmann/phpunit/issues/5186): SBOM does not validate
|
||||
|
||||
## [9.6.3] - 2023-02-04
|
||||
|
||||
### Fixed
|
||||
@@ -19,7 +25,7 @@ All notable changes of the PHPUnit 9.6 release series are documented in this fil
|
||||
### Fixed
|
||||
|
||||
* [#5073](https://github.com/sebastianbergmann/phpunit/issues/5073): `--no-extensions` CLI option only prevents extension PHARs from being loaded
|
||||
* [#5160](https://github.com/sebastianbergmann/phpunit/issues/5160): PHPUnit 9.6 misses deprecations for assertions and constraints removed in PHPUnit 10
|
||||
* [#5160](https://github.com/sebastianbergmann/phpunit/issues/5160): Deprecate `assertClassHasAttribute()`, `assertClassNotHasAttribute()`, `assertClassHasStaticAttribute()`, `assertClassNotHasStaticAttribute()`, `assertObjectHasAttribute()`, `assertObjectNotHasAttribute()`, `classHasAttribute()`, `classHasStaticAttribute()`, and `objectHasAttribute()`
|
||||
|
||||
## [9.6.0] - 2023-02-03
|
||||
|
||||
@@ -30,6 +36,7 @@ All notable changes of the PHPUnit 9.6 release series are documented in this fil
|
||||
* [#5064](https://github.com/sebastianbergmann/phpunit/issues/5064): Deprecate `PHPUnit\Framework\TestCase::getMockClass()`
|
||||
* [#5132](https://github.com/sebastianbergmann/phpunit/issues/5132): Deprecate `Test` suffix for abstract test case classes
|
||||
|
||||
[9.6.4]: https://github.com/sebastianbergmann/phpunit/compare/9.6.3...9.6.4
|
||||
[9.6.3]: https://github.com/sebastianbergmann/phpunit/compare/9.6.2...9.6.3
|
||||
[9.6.2]: https://github.com/sebastianbergmann/phpunit/compare/9.6.1...9.6.2
|
||||
[9.6.1]: https://github.com/sebastianbergmann/phpunit/compare/9.6.0...9.6.1
|
||||
|
||||
28
www/vendor/phpunit/phpunit/SECURITY.md
vendored
28
www/vendor/phpunit/phpunit/SECURITY.md
vendored
@@ -1,11 +1,33 @@
|
||||
# Security Policy
|
||||
|
||||
PHPUnit is a framework for writing as well as a commandline tool for running tests. Writing and running tests is a development-time activity. There is no reason why PHPUnit should be installed on a webserver.
|
||||
If you believe you have found a security vulnerability in PHPUnit, please report it to us through coordinated disclosure.
|
||||
|
||||
**Please do not report security vulnerabilities through public GitHub issues, discussions, or pull requests.**
|
||||
|
||||
Instead, please email `sebastian@phpunit.de`.
|
||||
|
||||
Please include as much of the information listed below as you can to help us better understand and resolve the issue:
|
||||
|
||||
* The type of issue
|
||||
* Full paths of source file(s) related to the manifestation of the issue
|
||||
* The location of the affected source code (tag/branch/commit or direct URL)
|
||||
* Any special configuration required to reproduce the issue
|
||||
* Step-by-step instructions to reproduce the issue
|
||||
* Proof-of-concept or exploit code (if possible)
|
||||
* Impact of the issue, including how an attacker might exploit the issue
|
||||
|
||||
This information will help us triage your report more quickly.
|
||||
|
||||
## Web Context
|
||||
|
||||
PHPUnit is a framework for writing as well as a command-line tool for running tests. Writing and running tests is a development-time activity. There is no reason why PHPUnit should be installed on a webserver and/or in a production environment.
|
||||
|
||||
**If you upload PHPUnit to a webserver then your deployment process is broken. On a more general note, if your `vendor` directory is publicly accessible on your webserver then your deployment process is also broken.**
|
||||
|
||||
Please note that if you upload PHPUnit to a webserver "bad things" may happen. [You have been warned.](https://thephp.cc/articles/phpunit-a-security-risk)
|
||||
|
||||
## Security Contact Information
|
||||
PHPUnit is developed with a focus on development environments and the command-line. No specific testing or hardening with regard to using PHPUnit in an HTTP or web context or with untrusted input data is performed. PHPUnit might also contain functionality that intentionally exposes internal application data for debugging purposes.
|
||||
|
||||
After the above, if you still would like to report a security vulnerability, please email `sebastian@phpunit.de`.
|
||||
If PHPUnit is used in a web application, the application developer is responsible for filtering inputs or escaping outputs as necessary and for verifying that the used functionality is safe for use within the intended context.
|
||||
|
||||
Vulnerabilities specific to the use outside a development context will be fixed as applicable, provided that the fix does not have an averse effect on the primary use case for development purposes.
|
||||
|
||||
@@ -41,7 +41,7 @@ final class Version
|
||||
}
|
||||
|
||||
if (self::$version === '') {
|
||||
self::$version = (new VersionId('9.6.3', dirname(__DIR__, 2)))->getVersion();
|
||||
self::$version = (new VersionId('9.6.4', dirname(__DIR__, 2)))->getVersion();
|
||||
}
|
||||
|
||||
return self::$version;
|
||||
|
||||
Reference in New Issue
Block a user