diff --git a/4dev/lang/admin/messages_en_utf8.po b/4dev/lang/admin/messages_en_utf8.po
index fa3b2d7b..dbae943e 100644
--- a/4dev/lang/admin/messages_en_utf8.po
+++ b/4dev/lang/admin/messages_en_utf8.po
@@ -27,3 +27,9 @@ msgstr "Month"
msgid "INPUT TEST"
msgstr "OUTPUT TEST EN"
+
+msgid "I should be translated"
+msgstr "I should be translated: I WAS TRANSLATED"
+
+msgid "Are we translated?"
+msgstr "Are we translated? Yes, we are!"
diff --git a/www/admin/class_test.admin.backend.php b/www/admin/class_test.admin.backend.php
new file mode 100644
index 00000000..00be130f
--- /dev/null
+++ b/www/admin/class_test.admin.backend.php
@@ -0,0 +1,52 @@
+
TEST CLASS: ADMIN BACKEND ";
+print "";
+print '';
+
+// set acl, from eg login acl
+print "SETACL[]: ".$backend->setACL([])." ";
+print "ADBEDITLOG: ".$backend->adbEditLog('CLASSTEST-ADMIN', 'Some info stirng')." ";
+print "ADBTOPMENU(0): ".\CoreLibs\Debug\Support::printAr($backend->adbTopMenu())." ";
+print "ADBMSG: ".$backend->adbMsg('info', 'Message: %1$d', [1])." ";
+print "Messaes: ".\CoreLibs\Debug\Support::printAr($this->messages)." ";
+print "ADBPRINTDATETIME: ".$backend->adbPrintDateTime(2021, 6, 21, 6, 38, '_test')." ";
+
+// error message
+print $basic->log->printErrorMsg();
+
+print "";
+
+// __END__
diff --git a/www/admin/class_test.array.php b/www/admin/class_test.array.php
index 3dcc7412..b9d986b6 100644
--- a/www/admin/class_test.array.php
+++ b/www/admin/class_test.array.php
@@ -1,4 +1,5 @@
-arrayMergeRecursive($array_1, $array_2, $array_3))." ";
+/**
+ * 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
+ */
+function rec(string $pre, string $cur, array $node = [])
+{
+ if (!is_array($node)) {
+ $node = [];
+ }
+ print "#### PRE: ".$pre.", CUR: ".$cur.", N-c: ".count($node)." [".join('|', array_keys($node))."]
";
+ if (!$pre) {
+ print "** NEW ";
+ $node[$cur] = [];
+ } else {
+ if (array_key_exists($pre, $node)) {
+ print "+ KEY FOUND: ".$pre.", add: ".$cur." ";
+ $node[$pre][$cur] = [];
+ } else {
+ print "- NOT FOUND: loop ";
+ foreach ($node as $_pre => $_cur) {
+ print "> TRY: ".$_pre." => ".count($_cur)." [".join('|', array_keys($_cur))."] ";
+ if (count($_cur) > 0) {
+ $node[$_pre] = rec($pre, $cur, $_cur);
+ }
+ }
+ }
+ }
+ return $node;
+}
+
+/**
+ * flatten array down to own level
+ *
+ * @param array $array
+ * @param array $return
+ * @return array
+ */
+function flattenArrayKey(array $array, array $return = [])
+{
+ foreach ($array as $key => $sub) {
+ $return[] = $key;
+ if (count($sub) > 0) {
+ $return = flattenArrayKey($sub, $return);
+ }
+ }
+ return $return;
+}
+
+// $test = [
+// 'A' => [
+// 'B' => [],
+// 'C' => [
+// 'D' => [],
+// 'E' => [
+// 'F' => []
+// ]
+// ]
+// ],
+// '1' => [],
+// '2' => [],
+// '3' => [
+// 'G' => []
+// ]
+// ];
+
+// build a tested array for flatten
+$test = [];
+// core
+$test = rec('', 'A', $test);
+$test = rec('', '1', $test);
+$test = rec('', '2', $test);
+$test = rec('', '3', $test);
+$test = rec('3', 'G', $test);
+$test = rec('A', 'B', $test);
+$test = rec('A', 'C', $test);
+$test = rec('C', 'D', $test);
+$test = rec('C', 'E', $test);
+$test = rec('E', 'F', $test);
+// new
+$test = rec('C', 'U', $test);
+$test = rec('F', 'U', $test);
+$test = rec('', 'Al', $test);
+$test = rec('B', 'B1', $test);
+print "ORIGINAL: ".\CoreLibs\Debug\Support::printAr($test)." ";
+print "FLATTEN: ".\CoreLibs\Debug\Support::printAr(flattenArrayKey($test))." ";
+
// error message
print $basic->log->printErrorMsg();
diff --git a/www/admin/class_test.colors.php b/www/admin/class_test.colors.php
index d4d8b742..f28768a2 100644
--- a/www/admin/class_test.colors.php
+++ b/www/admin/class_test.colors.php
@@ -1,4 +1,5 @@
-log = $logger;
+// $db = new CoreLibs\DB\IO(DB_CONFIG, $basic->log);
print "TEST CLASS: DB ";
print "";
print '';
-print "DBINFO: ".$basic->dbInfo()." ";
+print "DBINFO: ".$db->dbInfo()." ";
echo "DB_CONFIG_SET constant: ".print_r(DB_CONFIG, true)." ";
// DB client encoding
-print "DB Client encoding: ".$basic->dbGetEncoding()." ";
+print "DB Client encoding: ".$db->dbGetEncoding()." ";
-while ($res = $basic->dbReturn("SELECT * FROM max_test", 0, true)) {
+while ($res = $db->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 DATA: ".print_r($db->cursor_ext, true)." ";
+while ($res = $db->dbReturn("SELECT * FROM max_test")) {
print "[CACHED] TIME: ".$res['time']." ";
}
print "";
-$status = $basic->dbExec("INSERT INTO foo (test) VALUES ('FOO TEST ".time()."') RETURNING test");
+$status = $db->dbExec("INSERT INTO foo (test) VALUES ('FOO TEST ".time()."') RETURNING test");
print "DIRECT INSERT STATUS: $status | "
- ."PRIMARY KEY: ".$basic->dbGetInsertPK()." | "
- ."RETURNING EXT: ".print_r($basic->dbGetReturningExt(), true)." | "
- ."RETURNING ARRAY: ".print_r($basic->dbGetReturningArray(), true)." ";
+ ."PRIMARY KEY: ".$db->dbGetInsertPK()." | "
+ ."RETURNING EXT: ".print_r($db->dbGetReturningExt(), true)." | "
+ ."RETURNING ARRAY: ".print_r($db->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()));
+// $db->getReturningExt();
+print "DIRECT INSERT PREVIOUS INSERTED: ".print_r($db->dbReturnRow("SELECT foo_id, test FROM foo WHERE foo_id = ".$db->dbGetInsertPK()), true)." ";
+$db->dbPrepare("ins_foo", "INSERT INTO foo (test) VALUES ($1)");
+$status = $db->dbExecute("ins_foo", array('BAR TEST '.time()));
print "PREPARE INSERT STATUS: $status | "
- ."PRIMARY KEY: ".$basic->dbGetInsertPK()." | "
- ."RETURNING EXT: ".print_r($basic->dbGetReturningExt(), true)." | "
- ."RETURNING RETURN: ".print_r($basic->dbGetReturningArray(), true)." ";
+ ."PRIMARY KEY: ".$db->dbGetInsertPK()." | "
+ ."RETURNING EXT: ".print_r($db->dbGetReturningExt(), true)." | "
+ ."RETURNING RETURN: ".print_r($db->dbGetReturningArray(), true)." ";
-print "PREPARE INSERT PREVIOUS INSERTED: ".print_r($basic->dbReturnRow("SELECT foo_id, test FROM foo WHERE foo_id = ".$basic->dbGetInsertPK()), true)." ";
+print "PREPARE INSERT PREVIOUS INSERTED: ".print_r($db->dbReturnRow("SELECT foo_id, test FROM foo WHERE foo_id = ".$db->dbGetInsertPK()), true)." ";
// returning test with multiple entries
-// $status = $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");
+// $status = $db->db_exec("INSERT INTO foo (test) values ('BAR 1 ".time()."'), ('BAR 2 ".time()."'), ('BAR 3 ".time()."') RETURNING foo_id");
+$status = $db->dbExec("INSERT INTO foo (test) values ('BAR 1 ".time()."'), ('BAR 2 ".time()."'), ('BAR 3 ".time()."') RETURNING foo_id, test");
print "DIRECT MULTIPLE INSERT STATUS: $status | "
- ."PRIMARY KEYS: ".print_r($basic->dbGetInsertPK(), true)." | "
- ."RETURNING EXT: ".print_r($basic->dbGetReturningExt(), true)." | "
- ."RETURNING ARRAY: ".print_r($basic->dbGetReturningArray(), true)." ";
+ ."PRIMARY KEYS: ".print_r($db->dbGetInsertPK(), true)." | "
+ ."RETURNING EXT: ".print_r($db->dbGetReturningExt(), true)." | "
+ ."RETURNING ARRAY: ".print_r($db->dbGetReturningArray(), true)." ";
// no returning, but not needed ;
-$status = $basic->dbExec("INSERT INTO foo (test) VALUES ('FOO; TEST ".time()."');");
+$status = $db->dbExec("INSERT INTO foo (test) VALUES ('FOO; TEST ".time()."');");
print "DIRECT INSERT STATUS: $status | "
- ."PRIMARY KEY: ".$basic->dbGetInsertPK()." | "
- ."RETURNING EXT: ".print_r($basic->dbGetReturningExt(), true)." | "
- ."RETURNING ARRAY: ".print_r($basic->dbGetReturningArray(), true)." ";
+ ."PRIMARY KEY: ".$db->dbGetInsertPK()." | "
+ ."RETURNING EXT: ".print_r($db->dbGetReturningExt(), true)." | "
+ ."RETURNING ARRAY: ".print_r($db->dbGetReturningArray(), true)." ";
// UPDATE WITH RETURNING
-$status = $basic->dbExec("UPDATE foo SET test = 'SOMETHING DIFFERENT' WHERE foo_id = 3688452 RETURNING test");
+$status = $db->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)." ";
+ ."RETURNING EXT: ".print_r($db->dbGetReturningExt(), true)." | "
+ ."RETURNING ARRAY: ".print_r($db->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) {
+if ($db->dbPrepare('sel_foo', "SELECT foo_id, test, some_bool, string_a, number_a, number_a_numeric, some_time FROM foo ORDER BY foo_id DESC LIMIT 5") === false) {
print "Error in sel_foo prepare ";
} else {
$max_rows = 6;
// do not run this in dbFetchArray directly as
// dbFetchArray(dbExecute(...))
// this will end in an endless loop
- $cursor = $basic->dbExecute('sel_foo', []);
+ $cursor = $db->dbExecute('sel_foo', []);
$i = 1;
- while (($res = $basic->dbFetchArray($cursor, true)) !== false) {
+ while (($res = $db->dbFetchArray($cursor, true)) !== false) {
print "DB PREP EXEC FETCH ARR: ".$i.": ".print_r($res, true)." ";
$i ++;
}
@@ -107,35 +117,35 @@ if ($basic->dbPrepare('sel_foo', "SELECT foo_id, test, some_bool, string_a, numb
# db write class test
$table = 'foo';
-print "TABLE META DATA: ".DgS::printAr($basic->dbShowTableMetaData($table))." ";
+print "TABLE META DATA: ".DgS::printAr($db->dbShowTableMetaData($table))." ";
$primary_key = ''; # unset
$db_write_table = array('test', 'string_a', 'number_a', 'some_bool');
// $db_write_table = array('test');
$object_fields_not_touch = array();
$object_fields_not_update = array();
$data = array('test' => 'BOOL TEST SOMETHING '.time(), 'string_a' => 'SOME TEXT', 'number_a' => 5);
-$primary_key = $basic->dbWriteDataExt($db_write_table, $primary_key, $table, $object_fields_not_touch, $object_fields_not_update, $data);
+$primary_key = $db->dbWriteDataExt($db_write_table, $primary_key, $table, $object_fields_not_touch, $object_fields_not_update, $data);
print "Wrote to DB tabel $table and got primary key $primary_key ";
$data = array('test' => 'BOOL TEST ON '.time(), 'string_a' => '', 'number_a' => 0, 'some_bool' => 1);
-$primary_key = $basic->dbWriteDataExt($db_write_table, $primary_key, $table, $object_fields_not_touch, $object_fields_not_update, $data);
+$primary_key = $db->dbWriteDataExt($db_write_table, $primary_key, $table, $object_fields_not_touch, $object_fields_not_update, $data);
print "Wrote to DB tabel $table and got primary key $primary_key ";
$data = array('test' => 'BOOL TEST OFF '.time(), 'string_a' => null, 'number_a' => null, 'some_bool' => 0);
-$primary_key = $basic->dbWriteDataExt($db_write_table, $primary_key, $table, $object_fields_not_touch, $object_fields_not_update, $data);
+$primary_key = $db->dbWriteDataExt($db_write_table, $primary_key, $table, $object_fields_not_touch, $object_fields_not_update, $data);
print "Wrote to DB tabel $table and got primary key $primary_key ";
$data = array('test' => 'BOOL TEST UNSET '.time());
-$primary_key = $basic->dbWriteDataExt($db_write_table, $primary_key, $table, $object_fields_not_touch, $object_fields_not_update, $data);
+$primary_key = $db->dbWriteDataExt($db_write_table, $primary_key, $table, $object_fields_not_touch, $object_fields_not_update, $data);
print "Wrote to DB tabel $table and got primary key $primary_key ";
// return Array Test
$query = "SELECT type, sdate, integer FROM foobar";
-$data = $basic->dbReturnArray($query, true);
+$data = $db->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)");
+/* $db->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)
+while (($ret = $db->dbCheckAsync()) === true)
{
if ((list($_, $char) = each($chars)) === FALSE)
{
@@ -147,37 +157,37 @@ while (($ret = $basic->dbCheckAsync()) === true)
flush();
}
print " END STATUS: ".$ret." ";
-// while ($res = $basic->dbFetchArray($ret))
-while ($res = $basic->dbFetchArray())
+// while ($res = $db->dbFetchArray($ret))
+while ($res = $db->dbFetchArray())
{
echo "RES: ".$res['test']." ";
}
# test async insert
-$basic->dbExecAsync("INSERT INTO foo (Test) VALUES ('ASYNC TEST ".time()."')");
+$db->dbExecAsync("INSERT INTO foo (Test) VALUES ('ASYNC TEST ".time()."')");
echo "WAITING FOR ASYNC INSERT: ";
-while (($ret = $basic->dbCheckAsync()) === true)
+while (($ret = $db->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)." "; */
+print " END STATUS: ".$ret." | PK: ".$db->insert_id." ";
+print "ASYNC PREVIOUS INSERTED: ".print_r($db->dbReturnRow("SELECT foo_id, test FROM foo WHERE foo_id = ".$db->insert_id), true)." "; */
$to_db_version = '9.1.9';
-print "VERSION DB: ".$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)." ";
+print "VERSION DB: ".$db->dbVersion()." ";
+print "DB Version smaller $to_db_version: ".$db->dbCompareVersion('<'.$to_db_version)." ";
+print "DB Version smaller than $to_db_version: ".$db->dbCompareVersion('<='.$to_db_version)." ";
+print "DB Version equal $to_db_version: ".$db->dbCompareVersion('='.$to_db_version)." ";
+print "DB Version bigger than $to_db_version: ".$db->dbCompareVersion('>='.$to_db_version)." ";
+print "DB Version bigger $to_db_version: ".$db->dbCompareVersion('>'.$to_db_version)." ";
/* $q = "SELECT FOO FRO BAR";
// $q = "Select * from foo";
-$foo = $basic->dbExecAsync($q);
+$foo = $db->dbExecAsync($q);
print "[ERR] Query: ".$q." ";
print "[ERR] RESOURCE: $foo ";
-while (($ret = $basic->dbCheckAsync()) === true)
+while (($ret = $db->dbCheckAsync()) === true)
{
print "[ERR]: $ret ";
sleep(5);
@@ -185,17 +195,17 @@ while (($ret = $basic->dbCheckAsync()) === true)
// search path check
$q = "SHOW search_path";
-$cursor = $basic->dbExec($q);
-$data = $basic->dbFetchArray($cursor)['search_path'];
+$cursor = $db->dbExec($q);
+$data = $db->dbFetchArray($cursor)['search_path'];
print "RETURN DATA FOR search_path: ".$data." ";
// print "RETURN DATA FOR search_path: ".DgS::printAr($data)." ";
// 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." ";
+$status = $db->dbExec("INSERT INTO test.schema_test (contents, id) VALUES ('TIME: ".time()."', ".rand(1, 10).")");
+print "OTHER SCHEMA INSERT STATUS: ".$status." | PK NAME: ".$db->pk_name.", PRIMARY KEY: ".$db->insert_id." ";
print "NULL TEST DB READ ";
$q = "SELECT uid, null_varchar, null_int FROM test_null_data WHERE uid = 'A'";
-$res = $basic->dbReturnRow($q);
+$res = $db->dbReturnRow($q);
var_dump($res);
print "RES: ".DgS::printAr($res)." ";
print "ISSET: ".isset($res['null_varchar'])." ";
diff --git a/www/admin/class_test.debug.php b/www/admin/class_test.debug.php
index 490c5863..7571552c 100644
--- a/www/admin/class_test.debug.php
+++ b/www/admin/class_test.debug.php
@@ -121,6 +121,26 @@ class AttachOutside
$ao = new AttachOutside($basic->log);
print "AO-CLASS: DEBUG: ".$ao->test()." ";
+// @codingStandardsIgnoreLine
+class AttachFull
+{
+ public $main;
+ public function __construct(object $class)
+ {
+ $this->main = $class;
+ }
+ public function test()
+ {
+ // should trigger deprecated
+ return $this->main->rgb2hex(2, 3, 4);
+ }
+}
+
+$af = new AttachFull($basic);
+// should trigger deprecated
+print "DEPREACTEDTEST: ".$af->test()." ";
+
+
print "GETCALLERCLASS(NON CLASS): ".\CoreLibs\Debug\Support::getCallerClass()." ";
// fdebug
diff --git a/www/admin/class_test.html.php b/www/admin/class_test.html.php
index 4827a21a..b7190046 100644
--- a/www/admin/class_test.html.php
+++ b/www/admin/class_test.html.php
@@ -1,4 +1,5 @@
-magicLinks($magic_link))." ";
*/
+$text = 'I am some text
+with some
+line breaks
+in there. Theis
+is sucky';
+
+print "LB remove: ".\CoreLibs\Convert\Html::removeLB($text)." ";
+print "LB remove: ".\CoreLibs\Convert\Html::removeLB($text, '##BR##')." ";
// error message
print $basic->log->printErrorMsg();
diff --git a/www/admin/class_test.lang.php b/www/admin/class_test.lang.php
new file mode 100644
index 00000000..71ead5c5
--- /dev/null
+++ b/www/admin/class_test.lang.php
@@ -0,0 +1,58 @@
+TEST CLASS: LANG ";
+print "";
+print '';
+
+$string = 'INPUT TEST';
+
+echo "LANGUAGE SET: ".$l->__getLang()." ";
+echo "LANGUAGE FILE: ".$l->__getMoFile()." ";
+echo "INPUT TEST: ".$string." => ".$l->__($string)." ";
+
+// switch to other language
+$lang = 'ja_utf8';
+$l->l10nReloadMOfile($lang);
+
+echo "LANGUAGE SET: ".$l->__getLang()." ";
+echo "LANGUAGE FILE: ".$l->__getMoFile()." ";
+echo "INPUT TEST: ".$string." => ".$l->__($string)." ";
+// TODO: run compare check input must match output
+
+// error message
+print $basic->log->printErrorMsg();
+
+print "";
+
+// __END__
diff --git a/www/admin/class_test.output.form.php b/www/admin/class_test.output.form.php
new file mode 100644
index 00000000..f90455f2
--- /dev/null
+++ b/www/admin/class_test.output.form.php
@@ -0,0 +1,47 @@
+log);
+
+print "TEST CLASS: FORM GENERATE ";
+print "";
+print '';
+
+print "TODO ";
+
+// error message
+print $basic->log->printErrorMsg();
+
+print "";
+
+// __END__
diff --git a/www/admin/class_test.php b/www/admin/class_test.php
index cac7bd43..66e75369 100644
--- a/www/admin/class_test.php
+++ b/www/admin/class_test.php
@@ -1,4 +1,5 @@
-Class Test: RANDOM KEY '
print '';
print '';
print '';
+print '';
+print '';
+print '';
+print '';
// set + check edit access id
$edit_access_id = 3;
@@ -104,6 +109,17 @@ if (is_object($login)) {
// $basic->adbSetACL($login->acl);
}
+print "THIS HOST: ".HOST_NAME.", with PROTOCOL: ".HOST_PROTOCOL." is running SSL: ".HOST_SSL." ";
+print "DIR: ".DIR." ";
+print "BASE: ".BASE." ";
+print "ROOT: ".ROOT." ";
+print "HOST: ".HOST_NAME." => DB HOST: ".DB_CONFIG_NAME." => ".print_r(DB_CONFIG, true)." ";
+
+$ds = defined('DS') ? DS : DIRECTORY_SEPARATOR;
+$du = DS ?? DIRECTORY_SEPARATOR;
+print "DS is: ".$ds." ";
+print "SERVER HOST: ".$_SERVER['HTTP_HOST']." ";
+
// print error messages
// print $login->log->printErrorMsg();
print $basic->log->printErrorMsg();
diff --git a/www/admin/class_test.smarty.php b/www/admin/class_test.smarty.php
new file mode 100644
index 00000000..ea337dea
--- /dev/null
+++ b/www/admin/class_test.smarty.php
@@ -0,0 +1,94 @@
+TEST CLASS: SMARTY ";
+print "";
+print '';
+
+$smarty->DATA['JS_DEBUG'] = DEBUG;
+$smarty->MASTER_TEMPLATE_NAME = 'main_body.tpl';
+$smarty->TEMPLATE_NAME = 'smarty_test.tpl';
+$smarty->CSS_SPECIAL_TEMPLATE_NAME = 'smart_test.css';
+$smarty->USE_PROTOTYPE = false;
+$smarty->USE_JQUERY = true;
+$smarty->JS_DATEPICKR = false;
+if ($smarty->USE_PROTOTYPE) {
+ $smarty->ADMIN_JAVASCRIPT = 'edit.pt.js';
+ $smarty->JS_SPECIAL_TEMPLATE_NAME = 'prototype.test.js';
+} elseif ($smarty->USE_JQUERY) {
+ $smarty->ADMIN_JAVASCRIPT = 'edit.jq.js';
+ $smarty->JS_SPECIAL_TEMPLATE_NAME = 'jquery.test.js';
+}
+$smarty->PAGE_WIDTH = '100%';
+// require BASE.INCLUDES.'admin_set_paths.php';
+$smarty->setSmartyPaths();
+
+// smarty test
+$smarty->DATA['SMARTY_TEST'] = 'Test Data';
+$smarty->DATA['TRANSLATE_TEST'] = $l->__('Are we translated?');
+$smarty->DATA['TRANSLATE_TEST_SMARTY'] = $smarty->l10n->__('Are we translated?');
+
+// drop down test with optgroups
+$options = [
+ '' => '選択してください',
+ '4/25(木)' => [
+ '4/25(木) 11:00-11:50' => '4/25(木) 11:00-11:50',
+ '4/25(木) 12:20-13:00' => '4/25(木) 12:20-13:00'
+ ],
+ '4/26(金)' => [
+ '4/26(金) 11:00-11:50' => '4/26(金) 11:00-11:50',
+ '4/26(金) 12:20-13:00' => '4/26(金) 12:20-13:00'
+ ],
+ '4/27(土)' => [
+ '4/27(土) 11:00-11:50' => '4/27(土) 11:00-11:50',
+ '4/27(土) 12:20-13:00' => '4/27(土) 12:20-13:00'
+ ],
+];
+
+$smarty->DATA['drop_down_test'] = $options;
+$smarty->DATA['loop_start'] = 2;
+// require BASE.INCLUDES.'admin_smarty.php';
+$smarty->setSmartyVarsAdmin();
+
+// error message
+print $basic->log->printErrorMsg();
+
+print "";
+
+// __END__
diff --git a/www/admin/l10n_test.php b/www/admin/l10n_test.php
deleted file mode 100755
index 014d66b7..00000000
--- a/www/admin/l10n_test.php
+++ /dev/null
@@ -1,29 +0,0 @@
-__getLang()." ";
-echo "LANGUAGE FILE: ".$l->__getMoFile()." ";
-echo "INPUT TEST: ".$string." => ".$l->__($string)." ";
-
-// switch to other language
-$lang = 'ja_utf8';
-$l->l10nReloadMOfile($lang);
-
-echo "LANGUAGE SET: ".$l->__getLang()." ";
-echo "LANGUAGE FILE: ".$l->__getMoFile()." ";
-echo "INPUT TEST: ".$string." => ".$l->__($string)." ";
-
-// __END__
diff --git a/www/admin/namespace_test.php b/www/admin/namespace_test.php
deleted file mode 100755
index 8975562c..00000000
--- a/www/admin/namespace_test.php
+++ /dev/null
@@ -1,41 +0,0 @@
-ROOT: ".ROOT." BASE: ".BASE." ";
-
-$base = new CoreLibs\Admin\Backend(DB_CONFIG);
-ob_end_flush();
-if ($base->getConnectionStatus()) {
- die("Cannot connect to database");
-}
-
-print "Start time: ".\CoreLibs\Debug\RunningTime::runningTime()." ";
-print "HumanReadableByteFormat: ".\CoreLibs\Convert\Byte::HumanReadableByteFormat(1234567.12)." ";
-print "humanReadableByteFormat: ".\CoreLibs\Convert\Byte::humanReadableByteFormat(1234567.12)." ";
-print "getPageName: ". \CoreLibs\Get\System::getPageName()." ";
-
-print "DB Info: ".$base->dbInfo(true)." ";
-
-
-print "End Time: ".\CoreLibs\Debug\RunningTime::runningTime()." ";
-print "Start Time: ".\CoreLibs\Debug\RunningTime::runningTime()." ";
-
-print "Lang: ".$base->l->__getLang().", MO File: ".$base->l->__getMoFile()." ";
-print "Translate test: Year -> ".$base->l->__('Year')." ";
-
-print "End Time: ".\CoreLibs\Debug\RunningTime::runningTime()." ";
-// end error print
-print $base->log->printErrorMsg();
-
-# __END__
diff --git a/www/admin/other_test.php b/www/admin/other_test.php
deleted file mode 100755
index cf34cade..00000000
--- a/www/admin/other_test.php
+++ /dev/null
@@ -1,34 +0,0 @@
-foo = 'BAR';
- }
-
- public function otherBarBar($wrong)
- {
- echo "B: $wrong ";
- }
-
- public function barBar($wrong)
- {
- echo "B: $wrong ";
- }
-}
-
-$foo = $bar ?? 'EMPTY';
-echo "BAR: ".$foo." ";
-// define('DS', DIRECTORY_SEPARATOR);
-$ds = defined('DS') ? DS : DIRECTORY_SEPARATOR;
-$du = DS ?? DIRECTORY_SEPARATOR;
-echo "DS is: ".$ds." ";
-
-echo "SERVER HOST: ".$_SERVER['HTTP_HOST']." ";
-
-// __END__
diff --git a/www/admin/smarty_test.php b/www/admin/smarty_test.php
deleted file mode 100755
index 6be829e4..00000000
--- a/www/admin/smarty_test.php
+++ /dev/null
@@ -1,59 +0,0 @@
-MASTER_TEMPLATE_NAME = 'main_body.tpl';
- $smarty->TEMPLATE_NAME = 'smarty_test.tpl';
- $smarty->CSS_SPECIAL_TEMPLATE_NAME = 'smart_test.css';
- $smarty->USE_PROTOTYPE = false;
- $smarty->USE_JQUERY = true;
- $smarty->JS_DATEPICKR = false;
- if ($smarty->USE_PROTOTYPE) {
- $smarty->ADMIN_JAVASCRIPT = 'edit.pt.js';
- $smarty->JS_SPECIAL_TEMPLATE_NAME = 'prototype.test.js';
- } elseif ($smarty->USE_JQUERY) {
- $smarty->ADMIN_JAVASCRIPT = 'edit.jq.js';
- $smarty->JS_SPECIAL_TEMPLATE_NAME = 'jquery.test.js';
- }
- $smarty->PAGE_WIDTH = '100%';
- // require BASE.INCLUDES.'admin_set_paths.php';
- $smarty->setSmartyPaths();
-
- // smarty test
- $smarty->DATA['SMARTY_TEST'] = 'Test Data';
- $smarty->DATA['TRANSLATE_TEST'] = $cms->l->__('Are we translated?');
-}
-
-// drop down test with optgroups
-$options = array (
- '' => '選択してください',
- '4/25(木)' => array (
- '4/25(木) 11:00-11:50' => '4/25(木) 11:00-11:50',
- '4/25(木) 12:20-13:00' => '4/25(木) 12:20-13:00'
- ),
- '4/26(金)' => array (
- '4/26(金) 11:00-11:50' => '4/26(金) 11:00-11:50',
- '4/26(金) 12:20-13:00' => '4/26(金) 12:20-13:00'
- ),
- '4/27(土)' => array (
- '4/27(土) 11:00-11:50' => '4/27(土) 11:00-11:50',
- '4/27(土) 12:20-13:00' => '4/27(土) 12:20-13:00'
- )
-);
-
-if (is_object($smarty)) {
- $smarty->DATA['drop_down_test'] = $options;
- $smarty->DATA['loop_start'] = 2;
- // require BASE.INCLUDES.'admin_smarty.php';
- $smarty->setSmartyVarsAdmin();
-}
-require BASE.INCLUDES.'admin_footer.php';
diff --git a/www/admin/various_class_test.php b/www/admin/various_class_test.php
deleted file mode 100755
index e8de0c47..00000000
--- a/www/admin/various_class_test.php
+++ /dev/null
@@ -1,111 +0,0 @@
-";
-print "DIR: ".DIR." ";
-print "BASE: ".BASE." ";
-print "ROOT: ".ROOT." ";
-print "HOST: ".HOST_NAME." => DB HOST: ".DB_CONFIG_NAME." => ".print_r(DB_CONFIG, true)." ";
-
-$text = 'I am some text
-with some
-line breaks
-in there. Theis
-is sucky';
-
-print "LB remove: ".\CoreLibs\Convert\Html::removeLB($text)." ";
-print "LB remove: ".\CoreLibs\Convert\Html::removeLB($text, '##BR##')." ";
-
-// $test = array (
-// 'A' => array (
-// 'B' => array (),
-// 'C' => array (
-// 'D' => array (),
-// 'E' => array (
-// 'F' => array ()
-// )
-// )
-// ),
-// '1' => array (),
-// '2' => array (),
-// '3' => array (
-// 'G' => array ()
-// )
-// );
-
-// $base->log->debug('ARRAY', \CoreLibs\Debug\Support::printAr($test));
-
-function rec($pre, $cur, $node = array ())
-{
- if (!is_array($node)) {
- $node = array ();
- }
- print "#### PRE: ".$pre.", CUR: ".$cur.", N-c: ".count($node)." [".join('|', array_keys($node))."]
";
- if (!$pre) {
- print "** NEW ";
- $node[$cur] = array ();
- } else {
- if (array_key_exists($pre, $node)) {
- print "+ KEY FOUND: ".$pre.", add: ".$cur." ";
- $node[$pre][$cur] = array ();
- } else {
- print "- NOT FOUND: loop ";
- foreach ($node as $_pre => $_cur) {
- print "> TRY: ".$_pre." => ".count($_cur)." [".join('|', array_keys($_cur))."] ";
- if (count($_cur) > 0) {
- $node[$_pre] = rec($pre, $cur, $_cur);
- }
- }
- }
- }
- return $node;
-}
-
-function flattenArrayKey(array $array, array $return = array ())
-{
- foreach ($array as $key => $sub) {
- $return[] = $key;
- if (count($sub) > 0) {
- $return = flattenArrayKey($sub, $return);
- }
- }
- return $return;
-}
-
-$test = array ();
-// core
-$test = rec('', 'A', $test);
-$test = rec('', '1', $test);
-$test = rec('', '2', $test);
-$test = rec('', '3', $test);
-$test = rec('3', 'G', $test);
-$test = rec('A', 'B', $test);
-$test = rec('A', 'C', $test);
-$test = rec('C', 'D', $test);
-$test = rec('C', 'E', $test);
-$test = rec('E', 'F', $test);
-// new
-$test = rec('C', 'U', $test);
-$test = rec('F', 'U', $test);
-$test = rec('', 'Al', $test);
-$test = rec('B', 'B1', $test);
-$base->log->debug('REC', \CoreLibs\Debug\Support::printAr($test));
-print "FLATTEN: ".\CoreLibs\Debug\Support::printAr(flattenArrayKey($test))." ";
-
-print $base->log->printErrorMsg();
-
-// __END__
diff --git a/www/configs/config.db.php b/www/configs/config.db.php
index 1c963bf0..b5f51467 100755
--- a/www/configs/config.db.php
+++ b/www/configs/config.db.php
@@ -10,9 +10,9 @@
// please be VERY carefull only to change the right side
$DB_CONFIG = [
'test' => [
- 'db_name' => 'gullevek',
- 'db_user' => 'gullevek',
- 'db_pass' => 'gullevek',
+ 'db_name' => 'clemens',
+ 'db_user' => 'clemens',
+ 'db_pass' => 'clemens',
'db_host' => 'db.tokyo.tequila.jp',
'db_port' => 5432,
'db_schema' => 'public',
diff --git a/www/includes/admin_footer.php b/www/includes/admin_footer.php
index 3e4cb7ab..96c50d9e 100644
--- a/www/includes/admin_footer.php
+++ b/www/includes/admin_footer.php
@@ -10,5 +10,6 @@
// print debug messages
echo $login->log->printErrorMsg();
echo $cms->log->printErrorMsg();
+$cms->log->debug('DEBUGEND', '==================================== [END]');
// __END__
diff --git a/www/includes/edit_base.php b/www/includes/edit_base.php
index ad225bda..9127bde3 100644
--- a/www/includes/edit_base.php
+++ b/www/includes/edit_base.php
@@ -17,9 +17,9 @@
* 2003-06-10: creation of this page
*********************************************************************/
-$DEBUG_ALL = 1;
-$PRINT_ALL = 1;
-$DB_DEBUG = 1;
+$DEBUG_ALL = true;
+$PRINT_ALL = true;
+$DB_DEBUG = true;
// TODO: only extract _POST data that is needed
extract($_POST, EXTR_SKIP);
@@ -30,10 +30,10 @@ require 'config.php';
$SET_SESSION_NAME = EDIT_SESSION_NAME;
// overrride debug flags
if (!DEBUG) {
- $DEBUG_ALL = 0;
- $PRINT_ALL = 0;
- $DB_DEBUG = 0;
- $ECHO_ALL = 0;
+ $DEBUG_ALL = false;
+ $PRINT_ALL = false;
+ $DB_DEBUG = false;
+ $ECHO_ALL = false;
}
// should be utf8
diff --git a/www/includes/lang/admin/en_utf8.mo b/www/includes/lang/admin/en_utf8.mo
index ce0b0578..e4bc893d 100644
Binary files a/www/includes/lang/admin/en_utf8.mo and b/www/includes/lang/admin/en_utf8.mo differ
diff --git a/www/includes/templates/admin/smarty_test.tpl b/www/includes/templates/admin/smarty_test.tpl
index 002e9fae..a8dc8660 100755
--- a/www/includes/templates/admin/smarty_test.tpl
+++ b/www/includes/templates/admin/smarty_test.tpl
@@ -2,7 +2,10 @@
{$SMARTY_TEST}
- TRANSLATION CLASS: {$TRANSLATE_TEST}
+ TRANSLATION CLASS (OUT): {$TRANSLATE_TEST}
+
+
+ TRANSLATION CLASS (SMARTY): {$TRANSLATE_TEST_SMARTY}
diff --git a/www/lib/CoreLibs/Admin/Backend.php b/www/lib/CoreLibs/Admin/Backend.php
index 95fb0825..bce0072f 100644
--- a/www/lib/CoreLibs/Admin/Backend.php
+++ b/www/lib/CoreLibs/Admin/Backend.php
@@ -10,6 +10,10 @@
* - menu creation
* - array vars for smarty
*
+* CHANGE PLAN:
+* loads DB\IO + Logger and returns one group object
+* also checks all missing CONFIG vars from Basic class
+*
* PUBLIC VARIABLES
*
* PRIVATE VARIABLES
@@ -224,14 +228,14 @@ class Backend extends \CoreLibs\DB\IO
$PAGES = [];
}
$pages = [];
- foreach ($PAGES as $PAGE_CUID => $PAGE_DATA) {
+ foreach ($PAGES as $PAGE_DATA) {
$pages[] = $PAGE_DATA;
}
// $this->debug('pages', $this->print_ar($pages));
// if flag is 0, then we show all, else, we show only the matching flagges array points
// array is already sorted after correct order
reset($pages);
- foreach ($pages as $i => $data) {
+ foreach ($pages as $data) {
// for ($i = 0, $iMax = count($pages); $i < $iMax; $i ++) {
$show = 0;
// is it visible in the menu & is it online
@@ -329,11 +333,12 @@ class Backend extends \CoreLibs\DB\IO
}
/**
+ * ONLY USED IN adbTopMenu
* checks if this filename is in the current situation (user id, etc) available
* @param string|null $filename filename
* @return bool true for visible/accessable menu point, false for not
*/
- public function adbShowMenuPoint(?string $filename): bool
+ private function adbShowMenuPoint(?string $filename): bool
{
$enabled = false;
if ($filename === null) {
diff --git a/www/lib/CoreLibs/Check/Email.php b/www/lib/CoreLibs/Check/Email.php
index 263b31a7..28ebf6d4 100644
--- a/www/lib/CoreLibs/Check/Email.php
+++ b/www/lib/CoreLibs/Check/Email.php
@@ -30,7 +30,6 @@ class Email
'.*@disney\.ne\.jp$' => 'keitai_softbank_disney', # (kids)
'.*@willcom\.ne\.jp$' => 'keitai_willcom',
'.*@willcom\.com$' => 'keitai_willcom', # new for pdx.ne.jp address
- '.*@willcom\.com$' => 'keitai_willcom', # new for pdx.ne.jp address
'.*@wcm\.ne\.jp$' => 'keitai_willcom', # old willcom wcm.ne.jp
'.*@pdx\.ne\.jp$' => 'keitai_willcom_pdx', # old pdx address for willcom
'.*@bandai\.jp$' => 'keitai_willcom_bandai', # willcom paipo! (kids)
diff --git a/www/lib/CoreLibs/DB/IO.php b/www/lib/CoreLibs/DB/IO.php
index 6c63ca7b..b6232b7f 100644
--- a/www/lib/CoreLibs/DB/IO.php
+++ b/www/lib/CoreLibs/DB/IO.php
@@ -307,7 +307,7 @@ class IO extends \CoreLibs\Basic
/**
* main DB concstructor with auto connection to DB and failure set on failed connection
- * @param array $db_config DB configuration array
+ * @param array $db_config DB configuration array
*/
public function __construct(array $db_config)
{
@@ -317,6 +317,7 @@ class IO extends \CoreLibs\Basic
if (!is_array($db_config)) {
$db_config = [];
}
+ // TODO: check must set CONSTANTS
// sets the names (for connect/reconnect)
$this->db_name = $db_config['db_name'] ?? '';
$this->db_user = $db_config['db_user'] ?? '';
@@ -396,7 +397,7 @@ class IO extends \CoreLibs\Basic
public function __destruct()
{
$this->__closeDB();
- parent::__destruct();
+ // parent::__destruct();
}
// *************************************************************
@@ -547,7 +548,7 @@ class IO extends \CoreLibs\Basic
if ($prefix) {
$prefix .= '- ';
}
- $this->log->debug($debug_id, $prefix.$error_string, true);
+ $this->log->debug($debug_id, $error_string, true, $prefix);
}
/**
@@ -869,6 +870,24 @@ class IO extends \CoreLibs\Basic
return $this->db_debug;
}
+ /**
+ * Switches db debug flag on or off
+ * OR
+ * with the optional parameter fix sets debug
+ * returns current set stats
+ * @param bool|null $debug Flag to turn debug on off
+ * @return bool True for debug is on, False for off
+ */
+ public function dbToggleDebug(?bool $debug = null)
+ {
+ if ($debug !== null) {
+ $this->db_debug = $debug;
+ } else {
+ $this->db_debug = $this->db_debug ? false : true;
+ }
+ return $this->db_debug;
+ }
+
/**
* set max query calls, set to --1 to disable loop
* protection. this will generate a warning
@@ -1048,19 +1067,21 @@ class IO extends \CoreLibs\Basic
public function dbInfo(bool $show = true): string
{
$string = '';
- $string .= '-DB-info-> Connected to db \''.$this->db_name.'\' ';
- $string .= 'with schema \''.$this->db_schema.'\' ';
- $string .= 'as user \''.$this->db_user.'\' ';
- $string .= 'at host \''.$this->db_host.'\' ';
- $string .= 'on port \''.$this->db_port.'\' ';
- $string .= 'with ssl mode \''.$this->db_ssl.'\' ';
- $string .= '-DB-info-> DB IO Class debug output: '.($this->db_debug ? 'Yes' : 'No').' ';
+ $string .= '{b}-DB-info->{/b} Connected to db {b}\''.$this->db_name.'\'{/b} ';
+ $string .= 'with schema {b}\''.$this->db_schema.'\'{/b} ';
+ $string .= 'as user {b}\''.$this->db_user.'\'{/b} ';
+ $string .= 'at host {b}\''.$this->db_host.'\'{/b} ';
+ $string .= 'on port {b}\''.$this->db_port.'\'{/b} ';
+ $string .= 'with ssl mode {b}\''.$this->db_ssl.'\'{/b}{br}';
+ $string .= '{b}-DB-info->{/b} DB IO Class debug output: {b}'.($this->db_debug ? 'Yes' : 'No').'{/b}';
if ($show === true) {
- $this->__dbDebug('db', $string, 'dbInfo');
+ // if debug, remove / change b
+ $this->__dbDebug('db', str_replace(['{b}', '{/b}', '{br}'], ['', '', ' **** '], $string), 'dbInfo');
} else {
- $string = $string.' ';
+ $string = $string.'{br}';
}
- return $string;
+ // for direct print, change to html
+ return str_replace(['{b}', '{/b}', '{br}'], ['', ' ', ' '], $string);
}
/**
@@ -2125,24 +2146,6 @@ class IO extends \CoreLibs\Basic
return $this->num_rows ?? null;
}
- /**
- * Switches db debug flag on or off
- * OR
- * with the optional parameter fix sets debug
- * returns current set stats
- * @param bool|null $debug Flag to turn debug on off
- * @return bool True for debug is on, False for off
- */
- public function dbToggleDebug(?bool $debug = null)
- {
- if ($debug !== null) {
- $this->db_debug = $debug;
- } else {
- $this->db_debug = $this->db_debug ? false : true;
- }
- return $this->db_debug;
- }
-
// DEPEREACTED CALLS
/**
diff --git a/www/lib/CoreLibs/Debug/Logging.php b/www/lib/CoreLibs/Debug/Logging.php
index 7d7e1a4a..42230d43 100644
--- a/www/lib/CoreLibs/Debug/Logging.php
+++ b/www/lib/CoreLibs/Debug/Logging.php
@@ -45,6 +45,7 @@ class Logging
// debug flags/settings
private $running_uid = ''; // unique ID set on class init and used in logging as prefix
// log file name
+ private $log_folder = '';
private $log_file_name_ext = 'log'; // use this for date rotate
private $log_max_filesize = 0; // set in kilobytes
private $log_print_file = 'error_msg##LOGID####LEVEL####CLASS####PAGENAME####DATE##';
@@ -60,6 +61,14 @@ class Logging
public function __construct()
{
+ // check must set constants
+ if (defined('BASE') && defined('LOG')) {
+ $this->log_folder = BASE.LOG;
+ } else {
+ // fallback + warning
+ trigger_error('constant BASE or LOG are not defined, fallback to getcwd()', E_USER_WARNING);
+ $this->log_folder = getcwd().DS;
+ }
// running time start for script
$this->script_starttime = microtime(true);
// set per run UID for logging
@@ -205,7 +214,7 @@ class Logging
// init output variable
$output = $error_string; // output formated error string to output file
// init base file path
- $fn = BASE.LOG.$this->log_print_file.'.'.$this->log_file_name_ext;
+ $fn = $this->log_folder.$this->log_print_file.'.'.$this->log_file_name_ext;
// log ID prefix settings, if not valid, replace with empty
if (preg_match("/^[A-Za-z0-9]+$/", $this->log_file_id)) {
$rpl_string = '_'.$this->log_file_id;
@@ -434,9 +443,12 @@ class Logging
* @param bool $strip default on false, if set to true,
* all html tags will be stripped and changed to \n
* this is only used for debug output
+ * @param string $prefix Attach some block before $string. Will not be stripped even
+ * when strip is true
+ * if strip is false, recommended to add that to $string
* @return bool True if logged, false if not logged
*/
- public function debug(string $level, string $string, bool $strip = false): bool
+ public function debug(string $level, string $string, bool $strip = false, string $prefix = ''): bool
{
if (!$this->doDebugTrigger('debug', $level)) {
return false;
@@ -463,8 +475,8 @@ class Logging
($strip ?
// find any and replace them with \n
// strip rest of html elements (base only)
- preg_replace("/(<\/?)(\w+)([^>]*>)/", '', str_replace(' ', "\n", $string)) :
- $string
+ preg_replace("/(<\/?)(\w+)([^>]*>)/", '', str_replace(' ', "\n", $prefix.$string)) :
+ $prefix.$string
)
)
."\n"
@@ -483,6 +495,8 @@ class Logging
.'['.$this->page_name.' ] '
.'['.$this->running_uid.' ] '
.'{'.$class.' } - '
+ // as is prefix, allow HTML
+ .$prefix
// we replace special HTMLPRE with entries
.preg_replace("/{##HTMLPRE##}((.|\n)*?){##\/HTMLPRE##}/m", "\\1 ", \CoreLibs\Convert\Html::htmlent($string))
." ";
diff --git a/www/lib/CoreLibs/Debug/Support.php b/www/lib/CoreLibs/Debug/Support.php
index 1014d9e1..358bccd3 100644
--- a/www/lib/CoreLibs/Debug/Support.php
+++ b/www/lib/CoreLibs/Debug/Support.php
@@ -68,6 +68,12 @@ class Support
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) ?? [['class' => get_called_class()]];
$class = null;
while ($class === null) {
+ // if current is
+ // [function] => debug
+ // [class] => CoreLibs\Debug\Logging
+ // then return
+ // (OUTSIDE) because it was not called from a class method
+ // or return file name
$class = array_pop($backtrace)['class'] ?? null;
}
return $class ?? '';
diff --git a/www/lib/CoreLibs/Template/SmartyExtend.php b/www/lib/CoreLibs/Template/SmartyExtend.php
index a1551f58..042ec7bc 100644
--- a/www/lib/CoreLibs/Template/SmartyExtend.php
+++ b/www/lib/CoreLibs/Template/SmartyExtend.php
@@ -311,7 +311,9 @@ class SmartyExtend extends SmartyBC
private function setSmartyVars($admin_call = false): void
{
global $cms;
- $this->mergeCmsSmartyVars($cms);
+ if (is_object($cms)) {
+ $this->mergeCmsSmartyVars($cms);
+ }
// trigger flags
$this->HEADER['USE_PROTOTYPE'] = $this->USE_PROTOTYPE;
@@ -349,16 +351,24 @@ class SmartyExtend extends SmartyBC
// special for admin
if ($admin_call === true) {
// set ACL extra show
- $this->DATA['show_ea_extra'] = $cms->acl['show_ea_extra'] ?? false;
- $this->DATA['ADMIN'] = !empty($cms->acl['admin']) ? $cms->acl['admin'] : 0;
+ if (is_object($cms)) {
+ $this->DATA['show_ea_extra'] = $cms->acl['show_ea_extra'] ?? false;
+ $this->DATA['ADMIN'] = $cms->acl['admin'] ?? 0;
+ // top menu
+ $this->DATA['nav_menu'] = $cms->adbTopMenu() ?? [];
+ $this->DATA['nav_menu_count'] = is_array($this->DATA['nav_menu']) ? count($this->DATA['nav_menu']) : 0;
+ // messages = ['msg' =>, 'class' => 'error/warning/...']
+ $this->DATA['messages'] = $cms->messages ?? [];
+ } else {
+ $this->DATA['show_ea_extra'] = false;
+ $this->DATA['ADMIN'] = 0;
+ $this->DATA['nav_menu'] = [];
+ $this->DATA['nav_menu_count'] = 0;
+ $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;
- // top menu
- $this->DATA['nav_menu'] = $cms->adbTopMenu();
- $this->DATA['nav_menu_count'] = is_array($this->DATA['nav_menu']) ? count($this->DATA['nav_menu']) : 0;
- // messages = ['msg' =>, 'class' => 'error/warning/...']
- $this->DATA['messages'] = $cms->messages ?? [];
// the page name
$this->DATA['page_name'] = $this->page_name;
$this->DATA['table_width'] = $this->PAGE_WIDTH ?? PAGE_WIDTH;