diff --git a/www/admin/class_test.array.php b/www/admin/class_test.array.php
new file mode 100644
index 00000000..57ae270c
--- /dev/null
+++ b/www/admin/class_test.array.php
@@ -0,0 +1,82 @@
+
TEST CLASS: ARRAY HANDLER";
+print "";
+print '';
+
+// recursive array search
+$test_array = array(
+ 'foo' => 'bar',
+ 'input' => array(
+ 'element_a' => array(
+ 'type' => 'text'
+ ),
+ 'element_b' => array(
+ 'type' => 'email'
+ ),
+ 'element_c' => array(
+ 'type' => 'email'
+ )
+ )
+);
+
+echo "SOURCE ARRAY: ".$basic->printAr($test_array)."
";
+echo "FOUND ELEMENTS [base]: ".$basic->printAr(ArrayHandler::arraySearchRecursive('email', $test_array, 'type'))."
";
+echo "FOUND ELEMENTS [input]: ".$basic->printAr(ArrayHandler::arraySearchRecursive('email', $test_array['input'], 'type'))."
";
+
+$array_1 = [
+ 'foo' => 'bar'
+];
+$array_2 = [
+ 1, 2, 3
+];
+$array_3 = [
+ 'alpha' => [
+ 'beta' => 4
+ ]
+];
+print "ARRAYMERGERECURSIVE: ".$basic->printAr(ArrayHandler::arrayMergeRecursive($array_1, $array_2, $array_3))."
";
+
+// DEPRECATED
+// print "ARRAYMERGERECURSIVE: ".$basic->printAr($basic->arrayMergeRecursive($array_1, $array_2, $array_3))."
";
+
+// error message
+print $basic->printErrorMsg();
+
+print "";
+
+// __END__
diff --git a/www/admin/class_test.byte.php b/www/admin/class_test.byte.php
new file mode 100644
index 00000000..cecb7c92
--- /dev/null
+++ b/www/admin/class_test.byte.php
@@ -0,0 +1,100 @@
+TEST CLASS: BYTE CONVERT";
+print "";
+print '';
+
+// class
+$byte = 254779258;
+$string = '242.98 MB';
+print "BYTE TO: $byte: ".$_byte->humanReadableByteFormat($byte)."
";
+print "BYTE FROM: $string: ".$_byte->stringByteFormat($string)."
";
+// static
+print "S::BYTE TO: $byte: ".$byte_class::humanReadableByteFormat($byte)."
";
+print "S::BYTE FROM: $string: ".$byte_class::stringByteFormat($string)."
";
+
+// *** BYTES TEST ***
+$bytes = array(
+ -123123123,
+ 999999, // KB-1
+ 999999999, // MB-1
+ 254779258, // MB-n
+ 999999999999999, // TB-1
+ 588795544887632, // TB-n
+ 999999999999999999, // PB-1
+ 9223372036854775807, // MAX INT
+ 999999999999999999999, // EB-1
+);
+print "BYTE FORMAT TESTS
";
+foreach ($bytes as $byte) {
+ print '';
+ //
+ print '
';
+ print "(".number_format($byte)."/".$byte.") bytes :";
+ $_bytes = Byte::humanReadableByteFormat($byte);
+ print '
'.$_bytes;
+ print '
';
+ print Byte::stringByteFormat($_bytes);
+ print "
";
+ //
+ print "
";
+ //
+ print '';
+ //
+ print '
';
+ print "bytes [si]:";
+ $_bytes = Byte::humanReadableByteFormat($byte, Byte::BYTE_FORMAT_SI);
+ print '
'.$_bytes;
+ print '
';
+ print Byte::stringByteFormat($_bytes);
+ print "
";
+ //
+ print "
";
+}
+
+// DEPRECATED
+/* $byte = 254779258;
+$string = '242.98 MB';
+print "BYTE TO: $byte: ".$basic->humanReadableByteFormat($byte)."
";
+print "BYTE FROM: $string: ".$basic->stringByteFormat($string)."
"; */
+
+// error message
+print $basic->printErrorMsg();
+
+print "";
+
+// __END__
diff --git a/www/admin/class_test.colors.php b/www/admin/class_test.colors.php
new file mode 100644
index 00000000..73dc31ee
--- /dev/null
+++ b/www/admin/class_test.colors.php
@@ -0,0 +1,64 @@
+TEST CLASS: COLORS";
+print "";
+print '';
+
+// A(out of bounds)
+print "C::S/COLOR invalid rgb->hex (gray 125): -1, -1, -1: ".CoreLibs\Convert\Colors::rgb2hex(-1, -1, -1)."
";
+print "\$C::S/COLOR invalid rgb->hex (gary 125): -1, -1, -1: ".$color_class::rgb2hex(-1, -1, -1)."
";
+// B(valid)
+$rgb = [10, 20, 30];
+$hex = '#0a141e';
+$hsb = [210, 67, 12];
+$hsl = [210, 50, 7.8];
+print "C/COLOR rgb->hex: $rgb[0], $rgb[1], $rgb[2]: ".$color->rgb2hex($rgb[0], $rgb[1], $rgb[2])."
";
+print "C/COLOR hex->rgb: $hex: ".$basic->printAr($color->hex2rgb($hex))."
";
+print "C::S/COLOR rgb->hext: $hex: ".$basic->printAr(CoreLibs\Convert\Colors::hex2rgb($hex))."
";
+// C(to hsb/hsl)
+print "C/COLOR rgb->hsb: $rgb[0], $rgb[1], $rgb[2]: ".$basic->printAr($color->rgb2hsb($rgb[0], $rgb[1], $rgb[2]))."
";
+print "C/COLOR rgb->hsl: $rgb[0], $rgb[1], $rgb[2]: ".$basic->printAr($color->rgb2hsl($rgb[0], $rgb[1], $rgb[2]))."
";
+// D(from hsb/hsl) Note that param 2 + 3 is always 0-100 divided
+print "C/COLOR hsb->rgb: $hsb[0], $hsb[1], $hsb[2]: ".$basic->printAr($color->hsb2rgb($hsb[0], $hsb[1], $hsb[2]))."
";
+print "C/COLOR hsl->rgb: $hsl[0], $hsl[1], $hsl[2]: ".$basic->printAr($color->hsl2rgb($hsl[0], $hsl[1], $hsl[2]))."
";
+
+// TODO: run compare check input must match output
+
+// error message
+print $basic->printErrorMsg();
+
+print "";
+
+// __END__
diff --git a/www/admin/class_test.datetime.php b/www/admin/class_test.datetime.php
new file mode 100644
index 00000000..363d1bfd
--- /dev/null
+++ b/www/admin/class_test.datetime.php
@@ -0,0 +1,152 @@
+TEST CLASS: DATE/TIME";
+print "";
+print '';
+
+// class
+$timestamp = 1622788315.123456;
+print "C->DATESTRINGFORMAT(sm:0): $timestamp: ".$_datetime->dateStringFormat($timestamp)."
";
+// static
+print "S::DATESTRINGFORMAT(sm:0): $timestamp: ".$datetime_class::dateStringFormat($timestamp)."
";
+
+// time string thest
+$timestamp = 5887998.33445;
+$time_string = DateTime::timeStringFormat($timestamp);
+print "PLANE TIME STRING: ".$timestamp."
";
+print "TIME STRING TEST: ".$time_string."
";
+print "REVERSE TIME STRING: ".DateTime::stringToTime($time_string)."
";
+if (round($timestamp, 4) == DateTime::stringToTime($time_string)) {
+ print "REVERSE TIME STRING MATCH
";
+} else {
+ print "REVERSE TRIME STRING DO NOT MATCH
";
+}
+print "ZERO TIME STRING: ".DateTime::timeStringFormat(0, true)."
";
+print "ZERO TIME STRING: ".DateTime::timeStringFormat(0.0, true)."
";
+print "ZERO TIME STRING: ".DateTime::timeStringFormat(1.005, true)."
";
+
+$timestamps = [
+ 1622788315.123456,
+ -1622788315.456789
+];
+foreach ($timestamps as $timestamp) {
+ print "DATESTRINGFORMAT(sm:0): $timestamp: ".DateTime::dateStringFormat($timestamp)."
";
+ print "DATESTRINGFORMAT(sm:1): $timestamp: ".DateTime::dateStringFormat($timestamp, true)."
";
+}
+$intervals = [
+ 788315.123456,
+ -123.456
+];
+foreach ($intervals as $interval) {
+ print "TIMESTRINGFORMAT(sm:0): $interval: ".DateTime::timeStringFormat($interval, false)."
";
+ $reverse_interval = DateTime::timeStringFormat($interval);
+ print "TIMESTRINGFORMAT(sm:1): $interval: ".$reverse_interval."
";
+ print "STRINGTOTIME: $reverse_interval: ".DateTime::stringToTime($reverse_interval)."
";
+}
+$check_dates = [
+ '2021-05-01',
+ '2021-05-40'
+];
+foreach ($check_dates as $check_date) {
+ print "CHECKDATE: $check_date: ".(string)DateTime::checkDate($check_date)."
";
+}
+$check_datetimes = [
+ '2021-05-01',
+ '2021-05-40',
+ '2021-05-01 12:13:14',
+ '2021-05-40 12:13:14',
+ '2021-05-01 25:13:14',
+];
+foreach ($check_datetimes as $check_datetime) {
+ print "CHECKDATETIME: $check_datetime: ".(string)DateTime::checkDateTime($check_datetime)."
";
+}
+$compare_dates = [
+ [ '2021-05-01', '2021-05-02', ],
+ [ '2021-05-02', '2021-05-01', ],
+ [ '2021-05-02', '2021-05-02', ],
+ [ '2017/1/5', '2017-01-05', ],
+];
+// compareDate
+foreach ($compare_dates as $compare_date) {
+ print "COMPAREDATE: $compare_date[0] = $compare_date[1]: ".(string)DateTime::compareDate($compare_date[0], $compare_date[1])."
";
+}
+$compare_datetimes = [
+ [ '2021-05-01', '2021-05-02', ],
+ [ '2021-05-02', '2021-05-01', ],
+ [ '2021-05-02', '2021-05-02', ],
+ [ '2021-05-01 10:00:00', '2021-05-01 11:00:00', ],
+ [ '2021-05-01 11:00:00', '2021-05-01 10:00:00', ],
+ [ '2021-05-01 10:00:00', '2021-05-01 10:00:00', ],
+];
+foreach ($compare_datetimes as $compare_datetime) {
+ print "COMPAREDATE: $compare_datetime[0] = $compare_datetime[1]: ".(string)DateTime::compareDateTime($compare_datetime[0], $compare_datetime[1])."
";
+}
+$compare_dates = [
+ [ '2021-05-01', '2021-05-10', ],
+ [ '2021-05-10', '2021-05-01', ],
+ [ '2021-05-02', '2021-05-01', ],
+ [ '2021-05-02', '2021-05-02', ],
+];
+foreach ($compare_dates as $compare_date) {
+ print "CALCDAYSINTERVAL: $compare_date[0] = $compare_date[1]: ".$basic->printAr(DateTime::calcDaysInterval($compare_date[0], $compare_date[1]))."
";
+ print "CALCDAYSINTERVAL(named): $compare_date[0] = $compare_date[1]: ".$basic->printAr(DateTime::calcDaysInterval($compare_date[0], $compare_date[1], true))."
";
+}
+
+// DEPRECATED
+/* $timestamp = 1622788315.123456;
+print "C->DATESTRINGFORMAT(sm:0): $timestamp: ".$basic->dateStringFormat($timestamp)."
";
+$interval = 788315.123456;
+$reverse_interval = $basic->timeStringFormat($interval);
+print "TIMESTRINGFORMAT(sm:1): $interval: ".$reverse_interval."
";
+print "STRINGTOTIME: $reverse_interval: ".$basic->stringToTime($reverse_interval)."
";
+$check_date = '2021-05-01';
+print "CHECKDATE: $check_date: ".(string)$basic->checkDate($check_date)."
";
+$check_datetime = '2021-05-01 12:13:14';
+print "CHECKDATETIME: $check_datetime: ".(string)$basic->checkDateTime($check_datetime)."
";
+$compare_date = ['2021-05-01', '2021-05-02'];
+print "COMPAREDATE: $compare_date[0] = $compare_date[1]: ".(string)$basic->compareDate($compare_date[0], $compare_date[1])."
";
+$compare_datetime = ['2021-05-01 10:00:00', '2021-05-01 11:00:00'];
+print "COMPAREDATE: $compare_datetime[0] = $compare_datetime[1]: ".(string)$basic->compareDateTime($compare_datetime[0], $compare_datetime[1])."
";
+$compare_date = ['2021-05-01', '2021-05-10'];
+print "CALCDAYSINTERVAL(named): $compare_date[0] = $compare_date[1]: ".$basic->printAr($basic->calcDaysInterval($compare_date[0], $compare_date[1], true))."
"; */
+
+// error message
+print $basic->printErrorMsg();
+
+print "";
+
+// __END__
diff --git a/www/admin/class_test.db.php b/www/admin/class_test.db.php
new file mode 100644
index 00000000..4e0175d9
--- /dev/null
+++ b/www/admin/class_test.db.php
@@ -0,0 +1,209 @@
+TEST CLASS: DB";
+print "";
+print '';
+
+print "DBINFO: ".$basic->dbInfo()."
";
+echo "DB_CONFIG_SET constant: ".print_r(DB_CONFIG, true)."
";
+
+// DB client encoding
+print "DB Client encoding: ".$basic->dbGetEncoding()."
";
+
+while ($res = $basic->dbReturn("SELECT * FROM max_test", 0, true)) {
+ print "TIME: ".$res['time']."
";
+}
+print "CACHED DATA: ".print_r($basic->cursor_ext, true)."
";
+while ($res = $basic->dbReturn("SELECT * FROM max_test")) {
+ print "[CACHED] TIME: ".$res['time']."
";
+}
+
+print "";
+$status = $basic->dbExec("INSERT INTO foo (test) VALUES ('FOO TEST ".time()."') RETURNING test");
+print "DIRECT INSERT STATUS: $status | "
+ ."PRIMARY KEY: ".$basic->dbGetInsertPK()." | "
+ ."RETURNING EXT: ".print_r($basic->dbGetReturningExt(), true)." | "
+ ."RETURNING ARRAY: ".print_r($basic->dbGetReturningArray(), true)."
";
+
+// should throw deprecated error
+// $basic->getReturningExt();
+print "DIRECT INSERT PREVIOUS INSERTED: ".print_r($basic->dbReturnRow("SELECT foo_id, test FROM foo WHERE foo_id = ".$basic->dbGetInsertPK()), true)."
";
+$basic->dbPrepare("ins_foo", "INSERT INTO foo (test) VALUES ($1)");
+$status = $basic->dbExecute("ins_foo", array('BAR TEST '.time()));
+print "PREPARE INSERT STATUS: $status | "
+ ."PRIMARY KEY: ".$basic->dbGetInsertPK()." | "
+ ."RETURNING EXT: ".print_r($basic->dbGetReturningExt(), true)." | "
+ ."RETURNING RETURN: ".print_r($basic->dbGetReturningArray(), true)."
";
+
+print "PREPARE INSERT PREVIOUS INSERTED: ".print_r($basic->dbReturnRow("SELECT foo_id, test FROM foo WHERE foo_id = ".$basic->dbGetInsertPK()), true)."
";
+// returning test with multiple entries
+// $status = $basic->db_exec("INSERT INTO foo (test) values ('BAR 1 ".time()."'), ('BAR 2 ".time()."'), ('BAR 3 ".time()."') RETURNING foo_id");
+$status = $basic->dbExec("INSERT INTO foo (test) values ('BAR 1 ".time()."'), ('BAR 2 ".time()."'), ('BAR 3 ".time()."') RETURNING foo_id, test");
+print "DIRECT MULTIPLE INSERT STATUS: $status | "
+ ."PRIMARY KEYS: ".print_r($basic->dbGetInsertPK(), true)." | "
+ ."RETURNING EXT: ".print_r($basic->dbGetReturningExt(), true)." | "
+ ."RETURNING ARRAY: ".print_r($basic->dbGetReturningArray(), true)."
";
+
+// no returning, but not needed ;
+$status = $basic->dbExec("INSERT INTO foo (test) VALUES ('FOO; TEST ".time()."');");
+print "DIRECT INSERT STATUS: $status | "
+ ."PRIMARY KEY: ".$basic->dbGetInsertPK()." | "
+ ."RETURNING EXT: ".print_r($basic->dbGetReturningExt(), true)." | "
+ ."RETURNING ARRAY: ".print_r($basic->dbGetReturningArray(), true)."
";
+
+// UPDATE WITH RETURNING
+$status = $basic->dbExec("UPDATE foo SET test = 'SOMETHING DIFFERENT' WHERE foo_id = 3688452 RETURNING test");
+print "UPDATE STATUS: $status | "
+ ."RETURNING EXT: ".print_r($basic->dbGetReturningExt(), true)." | "
+ ."RETURNING ARRAY: ".print_r($basic->dbGetReturningArray(), true)."
";
+print "";
+
+// REEAD PREPARE
+if ($basic->dbPrepare('sel_foo', "SELECT foo_id, test, some_bool, string_a, number_a, number_a_numeric, some_time FROM foo ORDER BY foo_id DESC LIMIT 5") === false) {
+ print "Error in sel_foo prepare
";
+} else {
+ $max_rows = 6;
+ // do not run this in dbFetchArray directly as
+ // dbFetchArray(dbExecute(...))
+ // this will end in an endless loop
+ $cursor = $basic->dbExecute('sel_foo', []);
+ $i = 1;
+ while (($res = $basic->dbFetchArray($cursor, true)) !== false) {
+ print "DB PREP EXEC FETCH ARR: ".$i.": ".print_r($res, true)."
";
+ $i ++;
+ }
+}
+
+
+# db write class test
+$table = 'foo';
+print "TABLE META DATA: ".$basic->printAr($basic->dbShowTableMetaData($table))."
";
+$primary_key = ''; # unset
+$db_write_table = array('test', 'string_a', 'number_a', 'some_bool');
+// $db_write_table = array('test');
+$object_fields_not_touch = array();
+$object_fields_not_update = array();
+$data = array('test' => 'BOOL TEST SOMETHING '.time(), 'string_a' => 'SOME TEXT', 'number_a' => 5);
+$primary_key = $basic->dbWriteDataExt($db_write_table, $primary_key, $table, $object_fields_not_touch, $object_fields_not_update, $data);
+print "Wrote to DB tabel $table and got primary key $primary_key
";
+$data = array('test' => 'BOOL TEST ON '.time(), 'string_a' => '', 'number_a' => 0, 'some_bool' => 1);
+$primary_key = $basic->dbWriteDataExt($db_write_table, $primary_key, $table, $object_fields_not_touch, $object_fields_not_update, $data);
+print "Wrote to DB tabel $table and got primary key $primary_key
";
+$data = array('test' => 'BOOL TEST OFF '.time(), 'string_a' => null, 'number_a' => null, 'some_bool' => 0);
+$primary_key = $basic->dbWriteDataExt($db_write_table, $primary_key, $table, $object_fields_not_touch, $object_fields_not_update, $data);
+print "Wrote to DB tabel $table and got primary key $primary_key
";
+$data = array('test' => 'BOOL TEST UNSET '.time());
+$primary_key = $basic->dbWriteDataExt($db_write_table, $primary_key, $table, $object_fields_not_touch, $object_fields_not_update, $data);
+print "Wrote to DB tabel $table and got primary key $primary_key
";
+
+// return Array Test
+$query = "SELECT type, sdate, integer FROM foobar";
+$data = $basic->dbReturnArray($query, true);
+print "Full foobar list:
".print_r($data, true)."
";
+
+# async test queries
+/* $basic->dbExecAsync("SELECT test FROM foo, (SELECT pg_sleep(10)) as sub WHERE foo_id IN (27, 50, 67, 44, 10)");
+echo "WAITING FOR ASYNC: ";
+$chars = array('|', '/', '-', '\\');
+while (($ret = $basic->dbCheckAsync()) === true)
+{
+ if ((list($_, $char) = each($chars)) === FALSE)
+ {
+ reset($chars);
+ list($_, $char) = each($chars);
+ }
+ print $char;
+ sleep(1);
+ flush();
+}
+print "
END STATUS: ".$ret."
";
+// while ($res = $basic->dbFetchArray($ret))
+while ($res = $basic->dbFetchArray())
+{
+ echo "RES: ".$res['test']."
";
+}
+# test async insert
+$basic->dbExecAsync("INSERT INTO foo (Test) VALUES ('ASYNC TEST ".time()."')");
+echo "WAITING FOR ASYNC INSERT: ";
+while (($ret = $basic->dbCheckAsync()) === true)
+{
+ print ".";
+ sleep(1);
+ flush();
+}
+print "
END STATUS: ".$ret." | PK: ".$basic->insert_id."
";
+print "ASYNC PREVIOUS INSERTED: ".print_r($basic->dbReturnRow("SELECT foo_id, test FROM foo WHERE foo_id = ".$basic->insert_id), true)."
"; */
+
+$to_db_version = '9.1.9';
+print "VERSION DB: ".$basic->dbVersion()."
";
+print "DB Version smaller $to_db_version: ".$basic->dbCompareVersion('<'.$to_db_version)."
";
+print "DB Version smaller than $to_db_version: ".$basic->dbCompareVersion('<='.$to_db_version)."
";
+print "DB Version equal $to_db_version: ".$basic->dbCompareVersion('='.$to_db_version)."
";
+print "DB Version bigger than $to_db_version: ".$basic->dbCompareVersion('>='.$to_db_version)."
";
+print "DB Version bigger $to_db_version: ".$basic->dbCompareVersion('>'.$to_db_version)."
";
+
+/* $q = "SELECT FOO FRO BAR";
+// $q = "Select * from foo";
+$foo = $basic->dbExecAsync($q);
+print "[ERR] Query: ".$q."
";
+print "[ERR] RESOURCE: $foo
";
+while (($ret = $basic->dbCheckAsync()) === true)
+{
+ print "[ERR]: $ret
";
+ sleep(5);
+} */
+
+// search path check
+$q = "SHOW search_path";
+$cursor = $basic->dbExec($q);
+$data = $basic->dbFetchArray($cursor)['search_path'];
+print "RETURN DATA FOR search_path: ".$data."
";
+// print "RETURN DATA FOR search_path: ".$basic->printAr($data)."
";
+// insert something into test.schema_test and see if we get the PK back
+$status = $basic->dbExec("INSERT INTO test.schema_test (contents, id) VALUES ('TIME: ".time()."', ".rand(1, 10).")");
+print "OTHER SCHEMA INSERT STATUS: ".$status." | PK NAME: ".$basic->pk_name.", PRIMARY KEY: ".$basic->insert_id."
";
+
+print "NULL TEST DB READ
";
+$q = "SELECT uid, null_varchar, null_int FROM test_null_data WHERE uid = 'A'";
+$res = $basic->dbReturnRow($q);
+var_dump($res);
+print "RES: ".$basic->printAr($res)."
";
+print "ISSET: ".isset($res['null_varchar'])."
";
+print "EMPTY: ".empty($res['null_varchar'])."
";
+
+// error message
+print $basic->printErrorMsg();
+
+print "";
+
+// __END__
diff --git a/www/admin/class_test.email.php b/www/admin/class_test.email.php
new file mode 100644
index 00000000..ffe06c68
--- /dev/null
+++ b/www/admin/class_test.email.php
@@ -0,0 +1,62 @@
+TEST CLASS: HTML/ELEMENTS";
+print "";
+print '';
+
+$email = [
+ 'foo@bar.org',
+ 'foo@i.softbank.ne.jp'
+];
+foreach ($email as $s_email) {
+ print "EMAIL: $s_email: ".$_email->getEmailType($s_email)."
";
+ print "EMAIL SHORT: $s_email: ".$_email->getEmailType($s_email, true)."
";
+}
+foreach ($email as $s_email) {
+ print "S-EMAIL: $s_email: ".$email_class::getEmailType($s_email)."
";
+ print "S-EMAIL SHORT: $s_email: ".$email_class::getEmailType($s_email, true)."
";
+}
+// DEPRECATED
+/* foreach ($email as $s_email) {
+ print "D/S-EMAIL: $s_email: ".$basic->getEmailType($s_email)."
";
+ print "D/S-EMAIL SHORT: $s_email: ".$basic->getEmailType($s_email, true)."
";
+} */
+
+// error message
+print $basic->printErrorMsg();
+
+print "";
+
+// __END__
diff --git a/www/admin/class_test.encoding.php b/www/admin/class_test.encoding.php
new file mode 100644
index 00000000..b0119f73
--- /dev/null
+++ b/www/admin/class_test.encoding.php
@@ -0,0 +1,96 @@
+TEST CLASS: ENCODING";
+print "";
+print '';
+
+// print "Valid encoding: ".$basic->printAr(mb_list_encodings())."
";
+
+$mime_encodes = [
+ ['Simple string UTF8', 'UTF-8'],
+ ['Simple string ISO-2022-JP-MS', 'ISO-2022-JP-MS'],
+ ['日本語ながい', 'UTF-8'],
+ ['日本語ながい', 'ISO-2022-JP-MS'],
+ ['日本語ながい日本語ながい日本語ながい日本語ながい日本語ながい日本語ながい日本語ながい', 'ISO-2022-JP-MS'],
+];
+foreach ($mime_encodes as $mime_encode) {
+ print "__MBMIMEENCODE: $mime_encode[0]: ".Encoding::__mbMimeEncode($mime_encode[0], $mime_encode[1])."
";
+}
+
+$enc_strings = [
+ 'Normal Text',
+ '日本語',
+ // unworkable
+ ''
+];
+// class
+$_encoding->setErrorChar('∴');
+foreach ($enc_strings as $_string) {
+ $string = $_encoding->checkConvertEncoding($_string, 'UTF-8', 'ISO-2022-JP-MS');
+ print "ENC CHECK: $_string: ".($string === false ? '-OK-' : $string)."
";
+ print "CONV ENCODING: $_string: ".$_encoding->convertEncoding($_string, 'ISO-2022-JP')."
";
+ print "CONV ENCODING (s): $_string: ".$_encoding->convertEncoding($_string, 'ISO-2022-JP', 'UTF-8')."
";
+ print "CONV ENCODING (s,a-false): $_string: ".$_encoding->convertEncoding($_string, 'ISO-2022-JP', 'UTF-8', false)."
";
+}
+print "ERROR CHAR: ".$_encoding->getErrorChar()."
";
+// static
+$encoding_class::setErrorChar('∴');
+foreach ($enc_strings as $_string) {
+ $string = $encoding_class::checkConvertEncoding($_string, 'UTF-8', 'ISO-2022-JP-MS');
+ print "S::ENC CHECK: $_string: ".($string === false ? '-OK-' : $string)."
";
+ print "S::CONV ENCODING: $_string: ".$encoding_class::convertEncoding($_string, 'ISO-2022-JP')."
";
+ print "S::CONV ENCODING (s): $_string: ".$encoding_class::convertEncoding($_string, 'ISO-2022-JP', 'UTF-8')."
";
+ print "S::CONV ENCODING (s,a-false): $_string: ".$encoding_class::convertEncoding($_string, 'ISO-2022-JP', 'UTF-8', false)."
";
+}
+print "S::ERROR CHAR: ".$encoding_class::getErrorChar()."
";
+// static use
+$_string = $enc_strings[1];
+$string = Encoding::checkConvertEncoding($_string, 'UTF-8', 'ISO-2022-JP-MS');
+print "S::ENC CHECK: $_string: ".($string === false ? '-OK-' : $string)."
";
+
+// DEPRECATED
+/* $string = $basic->checkConvertEncoding($_string, 'UTF-8', 'ISO-2022-JP-MS');
+print "ENC CHECK: $_string: ".($string === false ? '-OK-' : $string)."
";
+print "CONV ENCODING: $_string: ".$basic->convertEncoding($_string, 'ISO-2022-JP')."
";
+print "D/__MBMIMEENCODE: ".$basic->__mbMimeEncode('Some Text', 'UTF-8')."
"; */
+
+// error message
+print $basic->printErrorMsg();
+
+print "";
+
+// __END__
diff --git a/www/admin/class_test.file.php b/www/admin/class_test.file.php
new file mode 100644
index 00000000..7a2702e1
--- /dev/null
+++ b/www/admin/class_test.file.php
@@ -0,0 +1,51 @@
+TEST CLASS: FILE";
+print "";
+print '';
+
+$file = '/some/path/to/some/file.txt';
+print "GETFILENAMEENDING: $file: ".File::getFilenameEnding($file)."
";
+$file = getcwd().DIRECTORY_SEPARATOR.'class_test.file.php';
+print "GETLINESFROMFILE: $file: ".File::getLinesFromFile($file)."
";
+
+// error message
+print $basic->printErrorMsg();
+
+print "";
+
+// __END__
diff --git a/www/admin/class_test.hash.php b/www/admin/class_test.hash.php
new file mode 100644
index 00000000..865ae1c6
--- /dev/null
+++ b/www/admin/class_test.hash.php
@@ -0,0 +1,71 @@
+TEST CLASS: HASH";
+print "";
+print '';
+
+$to_crc = 'Some text block';
+// class
+print "__CRC32B: $to_crc: ".$_hash->__crc32b($to_crc)."
";
+print "__SHA1SHORT(off): $to_crc: ".$_hash->__sha1short($to_crc)."
";
+print "__SHA1SHORT(on): $to_crc: ".$_hash->__sha1short($to_crc, true)."
";
+print "__hash(d): $to_crc: ".$_hash->__hash($to_crc)."
";
+foreach (['adler32', 'fnv132', 'fnv1a32', 'joaat'] as $__hash_c) {
+ print "__hash($__hash_c): $to_crc: ".$_hash->__hash($to_crc, $__hash_c)."
";
+}
+// static
+print "S::__CRC32B: $to_crc: ".$hash_class::__crc32b($to_crc)."
";
+print "S::__SHA1SHORT(off): $to_crc: ".$hash_class::__sha1short($to_crc)."
";
+print "S::__SHA1SHORT(on): $to_crc: ".$hash_class::__sha1short($to_crc, true)."
";
+print "S::__hash(d): $to_crc: ".$hash_class::__hash($to_crc)."
";
+foreach (['adler32', 'fnv132', 'fnv1a32', 'joaat'] as $__hash_c) {
+ print "S::__hash($__hash_c): $to_crc: ".$hash_class::__hash($to_crc, $__hash_c)."
";
+}
+// static use
+print "U-S::__CRC32B: $to_crc: ".Hash::__crc32b($to_crc)."
";
+
+// DEPRECATED
+/* print "D/__CRC32B: $to_crc: ".$basic->__crc32b($to_crc)."
";
+print "D/__SHA1SHORT(off): $to_crc: ".$basic->__sha1short($to_crc)."
";
+print "D/__hash(d): $to_crc: ".$basic->__hash($to_crc)."
"; */
+
+// error message
+print $basic->printErrorMsg();
+
+print "";
+
+// __END__
diff --git a/www/admin/class_test.html.php b/www/admin/class_test.html.php
new file mode 100644
index 00000000..0c010a66
--- /dev/null
+++ b/www/admin/class_test.html.php
@@ -0,0 +1,102 @@
+TEST CLASS: HTML/ELEMENTS";
+print "";
+print '';
+
+$string = "Something < = > Other
Next line";
+print "HTMLENT: ".Html::htmlent($string).": ".$_html->htmlent($string)."
";
+print "REMOVELB: ".Html::htmlent($string).": ".$_html->removeLB($string)."
";
+$date_str = [2021, 5, 1, 11, 10];
+print "PRINTDATETIME: ".$_elements->printDateTime($date_str[0], $date_str[1], $date_str[2], $date_str[3], $date_str[4])."
";
+// STATIC
+$string = "Something < = > Other
Next line";
+print "S::HTMLENT: ".Html::htmlent($string).": ".$html_class::htmlent($string)."
";
+print "S::REMOVELB: ".Html::htmlent($string).": ".$html_class::removeLB($string)."
";
+$date_str = [2021, 5, 1, 11, 10];
+print "S::PRINTDATETIME: ".$elements_class::printDateTime($date_str[0], $date_str[1], $date_str[2], $date_str[3], $date_str[4])."
";
+
+// STATIC use
+echo "U-S::HTML ENT INT: ".Html::htmlent(5)."
";
+echo "U-S::HTML ENT STRING: ".Html::htmlent('5<<>')."
";
+echo "U-S::HTML ENT NULL: ".Html::htmlent(null)."
";
+
+// check convert
+$checked_list = [
+ ['foo', 'foo'],
+ ['foo', 'bar'],
+ ['foo', ['foo', 'bar']],
+ ['foo', ['bar']],
+];
+foreach ($checked_list as $check) {
+ print "CHECKED(0): $check[0]: ".Html::checked($check[1], $check[0])."
";
+ print "CHECKED(1): $check[0]: ".Html::checked($check[1], $check[0], 1)."
";
+}
+
+// magic link creation test
+$magic_links = [
+ 'mailto:user@bubu.at',
+ 'user@bubu.at',
+ 'user@bubu.at|Send me email|',
+ 'http://www.somelink.com/?with=1234',
+ 'http://www.somelink.com/?with=1234|Some Title|',
+ 'http://www.somelink.com/?with=1234
Some Title',
+];
+foreach ($magic_links as $magic_link) {
+ print "MAGICLINK: ".Html::htmlent($magic_link).": ".Html::htmlent(Elements::magicLinks($magic_link))."
";
+}
+
+// DEPREACTED
+/* $string = "Deprecated Something < = > Other
Deprecated Next line";
+print "D/HTMLENT: $string: ".$basic->htmlent($string)."
";
+print "D/REMOVELB: $string: ".$basic->removeLB($string)."
";
+$date_str = [2021, 5, 1, 11, 10];
+print "D/PRINTDATETIME: ".$basic->printDateTime($date_str[0], $date_str[1], $date_str[2], $date_str[3], $date_str[4])."
";
+$magic_link = 'http://www.somelink.com/?with=1234|Some Title|';
+print "D/MAGICLINK: ".Html::htmlent($basic->magicLinks($magic_link))."
";
+*/
+
+
+// error message
+print $basic->printErrorMsg();
+
+print "";
+
+// __END__
diff --git a/www/admin/class_test.image.php b/www/admin/class_test.image.php
new file mode 100644
index 00000000..cf5965f3
--- /dev/null
+++ b/www/admin/class_test.image.php
@@ -0,0 +1,106 @@
+TEST CLASS: IMAGE";
+print "";
+print '';
+
+// thumb sizes
+$thumb_width = 250;
+$thumb_height = 300;
+// class
+$image = BASE.LAYOUT.CONTENT_PATH.IMAGES.'no_picture_square.jpg';
+// rotate image first
+$_image->correctImageOrientation($image);
+// thumbnail tests
+echo "CLASS->CREATETHUMBNAILSIMPLE: ".basename($image).": WIDTH: $thumb_width
.)
";
+// static
+$image = BASE.LAYOUT.CONTENT_PATH.IMAGES.'no_picture.jpg';
+// rotate image first
+$image_class::correctImageOrientation($image);
+// thumbnail tests
+echo "S::CREATETHUMBNAILSIMPLE: ".basename($image).": WIDTH: $thumb_width
.)
";
+
+echo "U-STATIC VARIOUS:
";
+// image thumbnail
+$images = array(
+ // height bigger
+ // 'no_picture.jpg',
+ // 'no_picture.png',
+ // width bigger
+ // 'no_picture_width_bigger.jpg',
+ // 'no_picture_width_bigger.png',
+ // square
+ // 'no_picture_square.jpg',
+ // 'no_picture_square.png',
+ // other sample images
+ // '5c501af48da6c.jpg',
+ // Apple HEIC files
+ // 'img_2145.heic',
+ // Photoshop
+ 'photoshop_test.psd',
+);
+// return mime type ala mimetype
+$finfo = new finfo(FILEINFO_MIME_TYPE);
+foreach ($images as $image) {
+ $image = BASE.LAYOUT.CONTENT_PATH.IMAGES.$image;
+ list ($height, $width, $img_type) = getimagesize($image);
+ echo "IMAGE INFO: ".$height."x".$width.", TYPE: ".$img_type." [".$finfo->file($image)."]
";
+ // rotate image first
+ Image::correctImageOrientation($image);
+ // thumbnail tests
+ echo "".basename($image).": WIDTH: $thumb_width
.)
";
+ echo "".basename($image).": HEIGHT: $thumb_height
.)
";
+ echo "".basename($image).": WIDTH/HEIGHT: $thumb_width x $thumb_height
.)
";
+ // test with dummy
+ echo "".basename($image).": WIDTH/HEIGHT: $thumb_width x $thumb_height (+DUMMY)
.)
";
+ echo "
";
+}
+
+// DEPRECATED
+// static
+/* $image = BASE.LAYOUT.CONTENT_PATH.IMAGES.'no_picture.jpg';
+// rotate image first
+$basic->correctImageOrientation($image);
+// thumbnail tests
+echo "S::CREATETHUMBNAILSIMPLE: ".basename($image).": WIDTH: $thumb_width
.)
"; */
+
+// error message
+print $basic->printErrorMsg();
+
+print "";
+
+// __END__
diff --git a/www/admin/class_test.json.php b/www/admin/class_test.json.php
new file mode 100644
index 00000000..56fa784e
--- /dev/null
+++ b/www/admin/class_test.json.php
@@ -0,0 +1,71 @@
+TEST CLASS: JSON";
+print "";
+print '';
+
+$json = '{"foo": "bar"}';
+$output = $_json->jsonConvertToArray($json);
+print "JSON: $json: ".$basic->printAr($output)."
";
+print "JSON ERROR: ".$_json->jsonGetLastError().": ".$_json->jsonGetLastError(true)."
";
+
+$json = '["f: {b"""ar}]';
+$output = $_json->jsonConvertToArray($json);
+print "E-JSON: $json: ".$basic->printAr($output)."
";
+print "E-JSON ERROR: ".$_json->jsonGetLastError().": ".$_json->jsonGetLastError(true)."
";
+
+// direct
+$json = '{"direct": "static function call"}';
+$output = $json_class::jsonConvertToArray($json);
+print "S::JSON: $json: ".$basic->printAr($output)."
";
+print "S::JSON ERROR: ".$json_class::jsonGetLastError().": ".$json_class::jsonGetLastError(true)."
";
+
+$json = '["f: {b"""ar}]';
+$output = $json_class::jsonConvertToArray($json);
+print "S::E-JSON: $json: ".$basic->printAr($output)."
";
+print "S::E-JSON ERROR: ".$json_class::jsonGetLastError().": ".$json_class::jsonGetLastError(true)."
";
+
+// DEPRECATE TEST
+/* $json = '["f: {b"""ar}]';
+$output = $basic->jsonConvertToArray($json);
+print "E-JSON: $json: ".$basic->printAr($output)."
";
+print "E-JSON ERROR: ".$basic->jsonGetLastError().": ".$basic->jsonGetLastError(true)."
"; */
+
+// error message
+print $basic->printErrorMsg();
+
+print "";
+
+// __END__
diff --git a/www/admin/class_test.math.php b/www/admin/class_test.math.php
new file mode 100644
index 00000000..5688e550
--- /dev/null
+++ b/www/admin/class_test.math.php
@@ -0,0 +1,57 @@
+TEST CLASS: MATH";
+print "";
+print '';
+
+print "FCEIL: ".$_math->fceil(5.1234567890, 5)."
";
+print "FLOORP: ".$_math->floorp(5123456, -3)."
";
+print "INITNUMERIC: ".$_math->initNumeric('123')."
";
+
+print "S-FCEIL: ".$math_class::fceil(5.1234567890, 5)."
";
+print "S-FLOORP: ".$math_class::floorp(5123456, -3)."
";
+print "S-INITNUMERIC: ".$math_class::initNumeric('123')."
";
+
+// DEPRECATED
+/* print "FCEIL: ".$basic->fceil(5.1234567890, 5)."
";
+print "FLOORP: ".$basic->floorp(5123456, -3)."
";
+print "INITNUMERIC: ".$basic->initNumeric('123')."
"; */
+
+// error message
+print $basic->printErrorMsg();
+
+print "";
+
+// __END__
diff --git a/www/admin/class_test.mime.php b/www/admin/class_test.mime.php
new file mode 100644
index 00000000..e136d2a4
--- /dev/null
+++ b/www/admin/class_test.mime.php
@@ -0,0 +1,60 @@
+TEST CLASS: MIME";
+print "";
+print '';
+
+$mime = 'application/illustrator';
+print "MIME $mime: ".$_mime->mimeGetAppName($mime)."
";
+$mime = 'fake/mime';
+$_mime->mimeSetAppName($mime, 'This is a fake mime');
+print "MIME $mime: ".$_mime->mimeGetAppName($mime)."
";
+
+// mime test
+$mime = 'application/vnd.ms-excel';
+print "App for mime $mime: ".$_mime->mimeGetAppName($mime)."
";
+$_mime->mimeSetAppName($mime, 'Microsoft (better) Excel');
+print "App for mime changed $mime: ".$_mime->mimeGetAppName($mime)."
";
+
+// DEPRECATED
+/* $mime = 'application/illustrator';
+print "MIME $mime: ".$basic->mimeGetAppName($mime)."
";
+$mime = 'fake/mime';
+$basic->mimeSetAppName($mime, 'This is a fake mime');
+print "MIME $mime: ".$basic->mimeGetAppName($mime)."
"; */
+
+print $basic->printErrorMsg();
+
+print "";
+
+// __END__
diff --git a/www/admin/class_test.password.php b/www/admin/class_test.password.php
new file mode 100644
index 00000000..e1527009
--- /dev/null
+++ b/www/admin/class_test.password.php
@@ -0,0 +1,63 @@
+TEST CLASS: PASSWORD";
+print "";
+print '';
+
+$password = 'something1234';
+$enc_password = $_password->passwordSet($password);
+print "PASSWORD: $password: ".$enc_password."
";
+print "PASSWORD VERIFY: ".(string)$_password->passwordVerify($password, $enc_password)."
";
+print "PASSWORD REHASH: ".(string)$_password->passwordRehashCheck($enc_password)."
";
+// static verify
+$password = 'othername7890';
+$enc_password = $password_class::passwordSet($password);
+print "PASSWORD: $password: ".$enc_password."
";
+print "S-PASSWORD VERIFY: ".(string)$password_class::passwordVerify($password, $enc_password)."
";
+print "PASSWORD REHASH: ".(string)$password_class::passwordRehashCheck($enc_password)."
";
+
+// DEPRECATED
+/* $password = 'deprecated4567';
+$enc_password = $basic->passwordSet($password);
+print "PASSWORD: $password: ".$enc_password."
";
+print "PASSWORD VERIFY: ".(string)$basic->passwordVerify($password, $enc_password)."
";
+print "PASSWORD REHASH: ".(string)$basic->passwordRehashCheck($enc_password)."
"; */
+
+// error message
+print $basic->printErrorMsg();
+
+print "";
+
+// __END__
diff --git a/www/admin/class_test.php b/www/admin/class_test.php
index 6f5782b7..40ce39e3 100644
--- a/www/admin/class_test.php
+++ b/www/admin/class_test.php
@@ -31,7 +31,27 @@ $basic = new CoreLibs\Admin\Backend(DB_CONFIG);
$basic->dbInfo(true);
ob_end_flush();
-echo "DB_CONFIG_SET constant: ".print_r(DB_CONFIG, true)."
";
+print "TEST CLASS";
+print "";
+
+print '';
+print '';
+print '';
+print '';
+print '';
+print '';
+print '';
+print '';
+print '';
+print '';
+print '';
+print '';
+print '';
+print '';
+print '';
+print '';
+print '';
+print '';
$basic->hrRunningTime();
$basic->runningTime();
@@ -43,10 +63,6 @@ $basic->hrRunningTime();
echo "RANDOM KEY [default]: ".$basic->randomKeyGen()."
";
echo "TIMED [hr]: ".$basic->hrRunningTime()."
";
-// color
-print "COLOR: -1, -1, -1: ".$basic->rgb2hex(-1, -1, -1)."
";
-print "COLOR: 10, 20, 30: ".$basic->rgb2hex(10, 20, 30)."
";
-
// set + check edit access id
$edit_access_id = 3;
if (is_object($login) && isset($login->acl['unit'])) {
@@ -63,8 +79,6 @@ if (is_object($login) && isset($login->acl['unit'])) {
// $basic->debug('SESSION', $basic->print_ar($_SESSION));
-print "TEST CLASS";
-print "";
print '