Compare commits
42 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
51e700cd10 | ||
|
|
71a431d5aa | ||
|
|
6970e6221b | ||
|
|
831f3be1a8 | ||
|
|
f2aba8c466 | ||
|
|
f085ccaa38 | ||
|
|
6c3c1a908d | ||
|
|
388b90913a | ||
|
|
07aea9d7b2 | ||
|
|
edcdbee523 | ||
|
|
43b51895f0 | ||
|
|
d0e294ecf5 | ||
|
|
3c35341e8b | ||
|
|
daf1f9263c | ||
|
|
805c695d68 | ||
|
|
ffdd45e32a | ||
|
|
316ca106fd | ||
|
|
fd9b201346 | ||
|
|
667dc4de8e | ||
|
|
fed67e990d | ||
|
|
c181a83b48 | ||
|
|
c830a32962 | ||
|
|
82bc99b181 | ||
|
|
556cabca38 | ||
|
|
6f4c5e36e6 | ||
|
|
a3c49e408a | ||
|
|
cc77d7e031 | ||
|
|
d553c1364f | ||
|
|
3f374a2cd7 | ||
|
|
9e99275db5 | ||
|
|
330e2baf39 | ||
|
|
5a81626e8c | ||
|
|
41cff5e3c6 | ||
|
|
e463f48ad4 | ||
|
|
f8ee6044f9 | ||
|
|
4b0e9b44c3 | ||
|
|
e5309b5dbc | ||
|
|
aad2e9b11b | ||
|
|
d6baf58231 | ||
|
|
c464a7d884 | ||
|
|
60613bf311 | ||
|
|
2a583e525c |
@@ -95,7 +95,7 @@ return [
|
|||||||
'www/vendor',
|
'www/vendor',
|
||||||
'www/tests',
|
'www/tests',
|
||||||
'www/lib/Smarty',
|
'www/lib/Smarty',
|
||||||
'www/lib/smarty-3.1.30',
|
'www/lib/smarty-4.1.0',
|
||||||
'www/templates_c',
|
'www/templates_c',
|
||||||
'www/log',
|
'www/log',
|
||||||
'www/tmp',
|
'www/tmp',
|
||||||
@@ -117,11 +117,7 @@ return [
|
|||||||
'www/admin/qq_file_upload_front.php',
|
'www/admin/qq_file_upload_front.php',
|
||||||
'www/admin/qq_file_upload_ajax.php',
|
'www/admin/qq_file_upload_ajax.php',
|
||||||
// symlink ignore
|
// symlink ignore
|
||||||
'www/lib/smarty-3.1.30/SmartyBC.class.php',
|
'www/lib/smarty-4.1.0/libs/Smarty.class.php'
|
||||||
'www/lib/htmlMimeMail-2.5.1/HtmlMimeMailCreate.php',
|
|
||||||
// current not checking smarty4 test file
|
|
||||||
'www/lib/CoreLibs/Template/SmartyExtend4.php',
|
|
||||||
'www/admin/class_test.smarty4.php',
|
|
||||||
],
|
],
|
||||||
|
|
||||||
// what not to show as problem
|
// what not to show as problem
|
||||||
|
|||||||
14
4dev/bin/create_mo.sh
Executable file
14
4dev/bin/create_mo.sh
Executable file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
base_folder='/var/www/html/developers/clemens/core_data/php_libraries/trunk/www/';
|
||||||
|
|
||||||
|
# locale gettext po to mo translator master
|
||||||
|
for file in $(ls -1 ${base_folder}../4dev/locale/*.po); do
|
||||||
|
file=$(basename $file .po);
|
||||||
|
echo "Translate language ${file}";
|
||||||
|
locale=$(echo "${file}" | cut -d "-" -f 1);
|
||||||
|
domain=$(echo "${file}" | cut -d "-" -f 2);
|
||||||
|
msgfmt -o ${base_folder}/includes/locale/${locale}/LC_MESSAGES/${domain}.mo ${base_folder}../4dev/locale/${locale}-${domain}.po;
|
||||||
|
done;
|
||||||
|
|
||||||
|
# __END__
|
||||||
@@ -1,4 +1,42 @@
|
|||||||
base="/storage/var/www/html/developers/clemens/core_data/php_libraries/trunk/";
|
base="/storage/var/www/html/developers/clemens/core_data/php_libraries/trunk/";
|
||||||
# -c phpunit.xml
|
# -c phpunit.xml
|
||||||
# --testdox
|
# --testdox
|
||||||
${base}www/vendor/bin/phpunit -c ${base}phpunit.xml ${base}4dev/tests/
|
# call with "t" to give verbose testdox output
|
||||||
|
# SUPPORTED: https://www.php.net/supported-versions.php
|
||||||
|
# call with 7.3, 7.4, 8.0, 8.1 to force a certain php version
|
||||||
|
|
||||||
|
opt_testdox="";
|
||||||
|
if [ "${1}" = "t" ] || [ "${2}" = "t" ]; then
|
||||||
|
opt_testdox="--testdox";
|
||||||
|
fi;
|
||||||
|
php_bin="";
|
||||||
|
if [ ! -z "${1}" ]; then
|
||||||
|
case "${1}" in
|
||||||
|
# "7.3") php_bin="/usr/bin/php7.3 "; ;;
|
||||||
|
"7.4") php_bin="/usr/bin/php7.4 "; ;;
|
||||||
|
"8.0") php_bin="/usr/bin/php8.0 "; ;;
|
||||||
|
"8.1") php_bin="/usr/bin/php8.1 "; ;;
|
||||||
|
*) echo "Not support PHP: ${1}"; exit; ;;
|
||||||
|
esac;
|
||||||
|
fi;
|
||||||
|
if [ ! -z "${2}" ] && [ -z "${php_bin}" ]; then
|
||||||
|
case "${2}" in
|
||||||
|
# "7.3") php_bin="/usr/bin/php7.3 "; ;;
|
||||||
|
"7.4") php_bin="/usr/bin/php7.4 "; ;;
|
||||||
|
"8.0") php_bin="/usr/bin/php8.0 "; ;;
|
||||||
|
"8.1") php_bin="/usr/bin/php8.1 "; ;;
|
||||||
|
*) echo "Not support PHP: ${1}"; exit; ;;
|
||||||
|
esac;
|
||||||
|
fi;
|
||||||
|
|
||||||
|
phpunit_call="${php_bin}${base}www/vendor/bin/phpunit ${opt_testdox} -c ${base}phpunit.xml ${base}4dev/tests/";
|
||||||
|
|
||||||
|
${phpunit_call};
|
||||||
|
|
||||||
|
if [ ! -z "${php_bin}" ]; then
|
||||||
|
echo "CALLED WITH PHP: ${php_bin}"$(${php_bin} --version);
|
||||||
|
else
|
||||||
|
echo "Default PHP used: "$(php --version);
|
||||||
|
fi;
|
||||||
|
|
||||||
|
# __END__
|
||||||
|
|||||||
@@ -68,9 +68,10 @@ INSERT INTO edit_scheme (name, header_color, enabled) VALUES ('Visitor', 'B0C4B3
|
|||||||
INSERT INTO edit_scheme (name, header_color, enabled) VALUES ('User', '1E789E', 1);
|
INSERT INTO edit_scheme (name, header_color, enabled) VALUES ('User', '1E789E', 1);
|
||||||
|
|
||||||
-- edit language
|
-- edit language
|
||||||
|
-- iso_name = encoding
|
||||||
DELETE FROM edit_language;
|
DELETE FROM edit_language;
|
||||||
INSERT INTO edit_language (short_name, long_name, iso_name, order_number, enabled, lang_default) VALUES ('en', 'English', 'UTF-8', 1, 1, 1);
|
INSERT INTO edit_language (long_name, short_name, iso_name, order_number, enabled, lang_default) VALUES ('English', 'en_US', 'UTF-8', 1, 1, 1);
|
||||||
INSERT INTO edit_language (short_name, long_name, iso_name, order_number, enabled, lang_default) VALUES ('ja', 'Japanese', 'UTF-8', 2, 1, 0);
|
INSERT INTO edit_language (long_name, short_name, long_name, iso_name, order_number, enabled, lang_default) VALUES ('Japanese', 'ja_JP', 'UTF-8', 2, 1, 0);
|
||||||
|
|
||||||
-- edit group
|
-- edit group
|
||||||
DELETE FROM edit_group;
|
DELETE FROM edit_group;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ CREATE TABLE edit_language (
|
|||||||
enabled SMALLINT NOT NULL DEFAULT 0,
|
enabled SMALLINT NOT NULL DEFAULT 0,
|
||||||
lang_default SMALLINT NOT NULL DEFAULT 0,
|
lang_default SMALLINT NOT NULL DEFAULT 0,
|
||||||
long_name VARCHAR,
|
long_name VARCHAR,
|
||||||
short_name VARCHAR,
|
short_name VARCHAR, -- en_US, en or en_US@latin without encoding
|
||||||
iso_name VARCHAR,
|
iso_name VARCHAR, -- should actually be encoding
|
||||||
order_number INT
|
order_number INT
|
||||||
) INHERITS (edit_generic) WITHOUT OIDS;
|
) INHERITS (edit_generic) WITHOUT OIDS;
|
||||||
|
|||||||
55
4dev/locale/Readme.md
Normal file
55
4dev/locale/Readme.md
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
# Translation files
|
||||||
|
|
||||||
|
## Source file name convetion
|
||||||
|
|
||||||
|
Locale Name . Domain . Encoding .po
|
||||||
|
|
||||||
|
## Name parte explenations
|
||||||
|
|
||||||
|
### Locale Name Examples
|
||||||
|
|
||||||
|
If underscore in name the long version is checked first, then the short version:
|
||||||
|
en_US@latin -> en_US -> en
|
||||||
|
|
||||||
|
* en
|
||||||
|
* en_US
|
||||||
|
* en_US.UTF-8
|
||||||
|
* en_US@latin
|
||||||
|
|
||||||
|
### Domain
|
||||||
|
|
||||||
|
For current case auto set CONTENT_PATH is used
|
||||||
|
|
||||||
|
* admin
|
||||||
|
* frontend
|
||||||
|
|
||||||
|
### Encoding
|
||||||
|
|
||||||
|
if not set UTF-8 is assumed. Any other utf8 encoding is changed to UTF-8
|
||||||
|
|
||||||
|
* UTF-8
|
||||||
|
* SJIS
|
||||||
|
* EUC
|
||||||
|
|
||||||
|
## File name example source
|
||||||
|
|
||||||
|
`ja-admin.po`
|
||||||
|
|
||||||
|
First part is LOCALE, second part is domain. Separator is `-`
|
||||||
|
|
||||||
|
## Folder layout
|
||||||
|
|
||||||
|
`includes/locale/ja/LC_MESSAGES/frontend.mo`
|
||||||
|
|
||||||
|
ALTERNATE LOCALE NAMES:
|
||||||
|
* ja
|
||||||
|
* ja_JP
|
||||||
|
* ja.UTF-8
|
||||||
|
* ja_JP.UTF-8
|
||||||
|
|
||||||
|
ja_JP.UTF-8: Locale Name
|
||||||
|
frontend: dmain (CONTENT_PATH)
|
||||||
|
|
||||||
|
## command
|
||||||
|
|
||||||
|
`msgfmt -o www/includes/locale/ja/LC_MESSAGES/frontend.mo 4dev/lang/ja.admin.po`
|
||||||
56
4dev/locale/en-admin.po
Normal file
56
4dev/locale/en-admin.po
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
# ********************************************************************
|
||||||
|
# AUTHOR: Clemens Schwaighofer
|
||||||
|
# CREATED: 2005/08/09
|
||||||
|
# SHORT DESCRIPTION:
|
||||||
|
# Backend English Messages file for gettext
|
||||||
|
# ********************************************************************/
|
||||||
|
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: en.UTF-8 LC_MESSAGES admin\n"
|
||||||
|
"Report-Msgid-Bugs-To: clemens.schwaighofer@egplusww.com\n"
|
||||||
|
"POT-Creation-Date: 2018-03-28 10:40+0900\n"
|
||||||
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
|
"Last-Translator: clemens.schwaighofer@egplusww.co\n"
|
||||||
|
"Language-Team: E-GRAPHICS COMMUNICATIONS Japan <info.jp@egplusww.com>\n"
|
||||||
|
"Language: en\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||||
|
|
||||||
|
msgid "Year"
|
||||||
|
msgstr "Year"
|
||||||
|
|
||||||
|
msgid "Month"
|
||||||
|
msgstr "Month"
|
||||||
|
|
||||||
|
msgid "INPUT TEST"
|
||||||
|
msgstr "OUTPUT TEST ADMIN EN"
|
||||||
|
|
||||||
|
# testing multi
|
||||||
|
msgid "single"
|
||||||
|
msgid_plural "multi"
|
||||||
|
msgstr[0] "Multi Admin en 0"
|
||||||
|
msgstr[1] "Multi Admin en 1"
|
||||||
|
msgstr[2] "Multi Admin en 2"
|
||||||
|
|
||||||
|
msgctxt "month name"
|
||||||
|
msgid "May"
|
||||||
|
msgstr "May Admin en"
|
||||||
|
|
||||||
|
msgctxt "month name"
|
||||||
|
msgid "single"
|
||||||
|
msgid_plural "multi"
|
||||||
|
msgstr[0] "Multi Admin month en 0"
|
||||||
|
msgstr[1] "Multi Admin month en 1"
|
||||||
|
msgstr[2] "Multi Admin month en 2"
|
||||||
|
|
||||||
|
msgid "I should be translated"
|
||||||
|
msgstr "I should be translated: I WAS TRANSLATED"
|
||||||
|
|
||||||
|
msgid "Are we translated?"
|
||||||
|
msgstr "Are we translated? Yes, we are!"
|
||||||
|
|
||||||
|
msgid "Original with string: %1"
|
||||||
|
msgstr "Translated with: %1"
|
||||||
@@ -2,34 +2,28 @@
|
|||||||
# AUTHOR: Clemens Schwaighofer
|
# AUTHOR: Clemens Schwaighofer
|
||||||
# CREATED: 2005/08/09
|
# CREATED: 2005/08/09
|
||||||
# SHORT DESCRIPTION:
|
# SHORT DESCRIPTION:
|
||||||
# Backned English Messages file for gettext
|
# Frontend English Messages file for gettext
|
||||||
# to craete: msgfmt -o ja.mo messages_en.po
|
|
||||||
# HISTORY:
|
|
||||||
# ********************************************************************/
|
# ********************************************************************/
|
||||||
|
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Project Version\n"
|
"Project-Id-Version: en.UTF-8 LC_MESSAGES frontend\n"
|
||||||
"Report-Msgid-Bugs-To: clemens.schwaighofer@egplusww.com\n"
|
"Report-Msgid-Bugs-To: clemens.schwaighofer@egplusww.com\n"
|
||||||
"POT-Creation-Date: 2018-03-28 10:40+0900\n"
|
"POT-Creation-Date: 2018-03-28 10:40+0900\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: \n"
|
"Last-Translator: clemens.schwaighofer@egplusww.co\n"
|
||||||
"Language-Team: E-GRAPHICS COMMUNICATIONS Japan <info.jp@egplusww.com>\n"
|
"Language-Team: E-GRAPHICS COMMUNICATIONS Japan <info.jp@egplusww.com>\n"
|
||||||
|
"Language: en\n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||||
msgid "Year"
|
|
||||||
msgstr "Year"
|
|
||||||
|
|
||||||
msgid "Month"
|
|
||||||
msgstr "Month"
|
|
||||||
|
|
||||||
msgid "INPUT TEST"
|
msgid "INPUT TEST"
|
||||||
msgstr "OUTPUT TEST EN"
|
msgstr "OUTPUT TEST FRONTEND EN"
|
||||||
|
|
||||||
msgid "I should be translated"
|
msgid "single"
|
||||||
msgstr "I should be translated: I WAS TRANSLATED"
|
msgid_plural "multi"
|
||||||
|
msgstr[0] "Multi frontend en 0"
|
||||||
msgid "Are we translated?"
|
msgstr[1] "Multi frontend en 1"
|
||||||
msgstr "Are we translated? Yes, we are!"
|
msgstr[2] "Multi frontend en 2"
|
||||||
@@ -2,22 +2,22 @@
|
|||||||
# AUTHOR: Clemens Schwaighofer
|
# AUTHOR: Clemens Schwaighofer
|
||||||
# CREATED: 2018/03/28
|
# CREATED: 2018/03/28
|
||||||
# SHORT DESCRIPTION:
|
# SHORT DESCRIPTION:
|
||||||
# Backend Japanese Messages file for gettext
|
# Backend Japanese Messages file for gettext>
|
||||||
# to craete: msgfmt -o ja.mo messages_ja.po
|
|
||||||
# HISTORY:
|
|
||||||
# ********************************************************************/
|
# ********************************************************************/
|
||||||
|
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Project Version\n"
|
"Project-Id-Version: ja.UTF-8 LC_MESSAGES admin\n"
|
||||||
"Report-Msgid-Bugs-To: clemens.schwaighofer@egplusww.com\n"
|
"Report-Msgid-Bugs-To: clemens.schwaighofer@egplusww.com\n"
|
||||||
"POT-Creation-Date: 2018-03-28 10:40+0900\n"
|
"POT-Creation-Date: 2018-03-28 10:40+0900\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: \n"
|
"Last-Translator: clemens.schwaighofer@egplusww.com\n"
|
||||||
"Language-Team: E-GRAPHICS COMMUNICATIONS Japan <info.jp@egplusww.com>\n"
|
"Language-Team: E-GRAPHICS COMMUNICATIONS Japan <info.jp@egplusww.com>\n"
|
||||||
|
"Language: ja\n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
|
||||||
|
|
||||||
msgid "Yes"
|
msgid "Yes"
|
||||||
msgstr "はい"
|
msgstr "はい"
|
||||||
@@ -63,7 +63,25 @@ msgid "Sun"
|
|||||||
msgstr "日"
|
msgstr "日"
|
||||||
|
|
||||||
msgid "INPUT TEST"
|
msgid "INPUT TEST"
|
||||||
msgstr "OUTPUT TEST JA"
|
msgstr "OUTPUT TEST ADMIN JA"
|
||||||
|
|
||||||
|
# testing multi
|
||||||
|
msgid "single"
|
||||||
|
msgid_plural "multi"
|
||||||
|
msgstr[0] "Multi Admin ja 0"
|
||||||
|
msgstr[1] "Multi Admin ja 1"
|
||||||
|
msgstr[2] "Multi Admin ja 2"
|
||||||
|
|
||||||
|
msgctxt "month name"
|
||||||
|
msgid "May"
|
||||||
|
msgstr "May Admin ja"
|
||||||
|
|
||||||
|
msgctxt "month name"
|
||||||
|
msgid "single"
|
||||||
|
msgid_plural "multi"
|
||||||
|
msgstr[0] "Multi Admin month ja 0"
|
||||||
|
msgstr[1] "Multi Admin month ja 1"
|
||||||
|
msgstr[2] "Multi Admin month ja 2"
|
||||||
|
|
||||||
# login string
|
# login string
|
||||||
msgid "Hello %s"
|
msgid "Hello %s"
|
||||||
@@ -75,3 +93,5 @@ msgstr "「スマーティー」これは正しいです"
|
|||||||
msgid "Are we translated?"
|
msgid "Are we translated?"
|
||||||
msgstr "「クラス」これは翻訳です?"
|
msgstr "「クラス」これは翻訳です?"
|
||||||
|
|
||||||
|
msgid "Original with string: %1"
|
||||||
|
msgstr "%1と翻訳した"
|
||||||
29
4dev/locale/ja-frontend.po
Normal file
29
4dev/locale/ja-frontend.po
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
# ********************************************************************
|
||||||
|
# AUTHOR: Clemens Schwaighofer
|
||||||
|
# CREATED: 2005/08/09
|
||||||
|
# SHORT DESCRIPTION:
|
||||||
|
# Frontend Japanese Messages file for gettext
|
||||||
|
# ********************************************************************/
|
||||||
|
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: ja.UTF-8 LC_MESSAGES frontend\n"
|
||||||
|
"Report-Msgid-Bugs-To: clemens.schwaighofer@egplusww.com\n"
|
||||||
|
"POT-Creation-Date: 2018-03-28 10:40+0900\n"
|
||||||
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
|
"Last-Translator: clemens.schwaighofer@egplusww.com\n"
|
||||||
|
"Language-Team: E-GRAPHICS COMMUNICATIONS Japan <info.jp@egplusww.com>\n"
|
||||||
|
"Language: ja\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
|
||||||
|
|
||||||
|
msgid "INPUT TEST"
|
||||||
|
msgstr "OUTPUT TEST FRONTEND JA"
|
||||||
|
|
||||||
|
msgid "single"
|
||||||
|
msgid_plural "multi"
|
||||||
|
msgstr[0] "Multi frontend ja 0"
|
||||||
|
msgstr[1] "Multi frontend ja 1"
|
||||||
|
msgstr[2] "Multi frontend ja 2"
|
||||||
@@ -13,18 +13,73 @@ use PHPUnit\Framework\TestCase;
|
|||||||
*/
|
*/
|
||||||
final class CoreLibsACLLoginTest extends TestCase
|
final class CoreLibsACLLoginTest extends TestCase
|
||||||
{
|
{
|
||||||
|
private static $db;
|
||||||
|
private static $log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Undocumented function
|
* start DB conneciton, setup DB, etc
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function setUp(): void
|
public static function setUpBeforeClass(): void
|
||||||
{
|
{
|
||||||
if (!extension_loaded('pgsql')) {
|
if (!extension_loaded('pgsql')) {
|
||||||
$this->markTestSkipped(
|
self::markTestSkipped(
|
||||||
'The PgSQL extension is not available.'
|
'The PgSQL extension is not available.'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
// logger is always needed
|
||||||
|
// define basic connection set valid and one invalid
|
||||||
|
self::$log = new \CoreLibs\Debug\Logging([
|
||||||
|
// 'log_folder' => __DIR__ . DIRECTORY_SEPARATOR . 'log',
|
||||||
|
'log_folder' => DIRECTORY_SEPARATOR . 'tmp',
|
||||||
|
'file_id' => 'CoreLibs-ACL-Login-Test',
|
||||||
|
'debug_all' => false,
|
||||||
|
'echo_all' => false,
|
||||||
|
'print_all' => false,
|
||||||
|
]);
|
||||||
|
// if we do have pgsql, we need to create a test DB or check that one
|
||||||
|
// exists and clean the table to zero state
|
||||||
|
self::$db = new \CoreLibs\DB\IO(
|
||||||
|
[
|
||||||
|
'db_name' => 'corelibs_acl_login_test',
|
||||||
|
'db_user' => 'corelibs_acl_login_test',
|
||||||
|
'db_pass' => 'corelibs_acl_login_test',
|
||||||
|
'db_host' => 'localhost',
|
||||||
|
'db_port' => 5432,
|
||||||
|
'db_schema' => 'public',
|
||||||
|
'db_type' => 'pgsql',
|
||||||
|
'db_encoding' => '',
|
||||||
|
'db_ssl' => 'allow', // allow, disable, require, prefer
|
||||||
|
'db_debug' => true,
|
||||||
|
],
|
||||||
|
self::$log
|
||||||
|
);
|
||||||
|
if (!self::$db->dbGetConnectionStatus()) {
|
||||||
|
self::markTestSkipped(
|
||||||
|
'Cannot connect to valid Test DB for ACL\Login test.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
// check if they already exist, drop them
|
||||||
|
if ($db->dbShowTableMetaData('table_with_primary_key') !== false) {
|
||||||
|
$db->dbExec("DROP TABLE table_with_primary_key");
|
||||||
|
$db->dbExec("DROP TABLE table_without_primary_key");
|
||||||
|
$db->dbExec("DROP TABLE test_meta");
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* close db
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function tearDownAfterClass(): void
|
||||||
|
{
|
||||||
|
if (self::$db->dbGetConnectionStatus()) {
|
||||||
|
self::$db->dbClose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,6 +95,8 @@ final class CoreLibsACLLoginTest extends TestCase
|
|||||||
$this->markTestIncomplete(
|
$this->markTestIncomplete(
|
||||||
'ACL\Login Tests have not yet been implemented'
|
'ACL\Login Tests have not yet been implemented'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$login = new \CoreLibs\ACL\Login(self::$db, self::$log);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
117
4dev/tests/CoreLibsCheckEncodingTest.php
Normal file
117
4dev/tests/CoreLibsCheckEncodingTest.php
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace tests;
|
||||||
|
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test class for Check\Encoding
|
||||||
|
* @coversDefaultClass \CoreLibs\Check\Encoding
|
||||||
|
* @testdox \CoreLibs\Check\Encoding method tests
|
||||||
|
*/
|
||||||
|
final class CoreLibsCheckEncodingTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Undocumented function
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function checkConvertEncodingProvider(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
// 0: string to test
|
||||||
|
// 1: source encoding
|
||||||
|
// 2: target encoding
|
||||||
|
// 3: substitue character
|
||||||
|
// 4: false for ok, array with error list
|
||||||
|
'valid test UTF-8 to SJIS (default)' => [
|
||||||
|
'日本語',
|
||||||
|
'UTF-8',
|
||||||
|
'SJIS',
|
||||||
|
null,
|
||||||
|
false
|
||||||
|
],
|
||||||
|
'invalid test UTF-8 to SJIS (dots as code point)' => [
|
||||||
|
'❶',
|
||||||
|
'UTF-8',
|
||||||
|
'SJIS',
|
||||||
|
0x2234,
|
||||||
|
['❶']
|
||||||
|
],
|
||||||
|
'invalid test UTF-8 to SJIS (dots as string)' => [
|
||||||
|
'❶',
|
||||||
|
'UTF-8',
|
||||||
|
'SJIS',
|
||||||
|
'∴',
|
||||||
|
['❶']
|
||||||
|
],
|
||||||
|
'invalid test UTF-8 to SJIS (none)' => [
|
||||||
|
'❶',
|
||||||
|
'UTF-8',
|
||||||
|
'SJIS',
|
||||||
|
'none',
|
||||||
|
['❶']
|
||||||
|
],
|
||||||
|
'invalid test UTF-8 to SJIS (long)' => [
|
||||||
|
'❶',
|
||||||
|
'UTF-8',
|
||||||
|
'SJIS',
|
||||||
|
'long',
|
||||||
|
['❶']
|
||||||
|
],
|
||||||
|
'invalid test UTF-8 to SJIS (entity)' => [
|
||||||
|
'❶',
|
||||||
|
'UTF-8',
|
||||||
|
'SJIS',
|
||||||
|
'entity',
|
||||||
|
['❶']
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Undocumented function
|
||||||
|
*
|
||||||
|
* @covers ::checkConvertEncoding
|
||||||
|
* @dataProvider checkConvertEncodingProvider
|
||||||
|
* @testdox check encoding convert from $from_encoding to $to_encoding [$_dataName]
|
||||||
|
*
|
||||||
|
* @param string $input
|
||||||
|
* @param string $from_encoding
|
||||||
|
* @param string $to_encoding
|
||||||
|
* @param string|int|null $error_char
|
||||||
|
* @param array|bool $expected
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testCheckConvertEncoding(
|
||||||
|
string $input,
|
||||||
|
string $from_encoding,
|
||||||
|
string $to_encoding,
|
||||||
|
$error_char,
|
||||||
|
$expected
|
||||||
|
): void {
|
||||||
|
if ($error_char !== null) {
|
||||||
|
\CoreLibs\Check\Encoding::setErrorChar($error_char);
|
||||||
|
if (!in_array($error_char, ['none', 'long', 'entity'])) {
|
||||||
|
$this->assertEquals(
|
||||||
|
\IntlChar::chr($error_char),
|
||||||
|
\CoreLibs\Check\Encoding::getErrorChar()
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$this->assertEquals(
|
||||||
|
$error_char,
|
||||||
|
\CoreLibs\Check\Encoding::getErrorChar()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$return = \CoreLibs\Check\Encoding::checkConvertEncoding($input, $from_encoding, $to_encoding);
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected,
|
||||||
|
$return
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// __END__
|
||||||
@@ -11,7 +11,7 @@ use PHPUnit\Framework\TestCase;
|
|||||||
* @coversDefaultClass \CoreLibs\Check\PHPVersion
|
* @coversDefaultClass \CoreLibs\Check\PHPVersion
|
||||||
* @testdox \CoreLibs\Check\PHPVersion method tests
|
* @testdox \CoreLibs\Check\PHPVersion method tests
|
||||||
*/
|
*/
|
||||||
final class CoreLibsCheckPHPVersionTest extends TestCase
|
final class CoreLibsCheckPhpVersionTest extends TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* NOTE: The checks must be adapted to the PHP version or they will fail
|
* NOTE: The checks must be adapted to the PHP version or they will fail
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace tests;
|
namespace tests;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -274,7 +275,6 @@ final class CoreLibsCombinedArrayHandlerTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: create provider for n array merge
|
|
||||||
* provides array listing for the merge test
|
* provides array listing for the merge test
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
@@ -282,6 +282,61 @@ final class CoreLibsCombinedArrayHandlerTest extends TestCase
|
|||||||
public function arrayMergeRecursiveProvider(): array
|
public function arrayMergeRecursiveProvider(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
// 0: expected
|
||||||
|
// 1..n: to merge arrays
|
||||||
|
// n+1: trigger for handle keys as string
|
||||||
|
'two arrays' => [
|
||||||
|
['a' => 1, 'b' => 2, 'c' => 3],
|
||||||
|
['a' => 1, 'b' => 2],
|
||||||
|
['b' => 2, 'c' => 3],
|
||||||
|
],
|
||||||
|
'two arrays, string flag' => [
|
||||||
|
['a' => 1, 'b' => 2, 'c' => 3],
|
||||||
|
['a' => 1, 'b' => 2],
|
||||||
|
['b' => 2, 'c' => 3],
|
||||||
|
true,
|
||||||
|
],
|
||||||
|
// non hash arrays
|
||||||
|
'non hash array merge, no string flag' => [
|
||||||
|
[3, 4, 5],
|
||||||
|
[1, 2, 3],
|
||||||
|
[3, 4, 5],
|
||||||
|
],
|
||||||
|
'non hash array merge, string flag' => [
|
||||||
|
[1, 2, 3, 3, 4, 5],
|
||||||
|
[1, 2, 3],
|
||||||
|
[3, 4, 5],
|
||||||
|
true
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* for warning checks
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function arrayMergeRecursiveProviderWarning(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
// error <2 arguments
|
||||||
|
'too view arguments' => [
|
||||||
|
'arrayMergeRecursive needs two or more array arguments',
|
||||||
|
[1]
|
||||||
|
],
|
||||||
|
// error <2 arrays
|
||||||
|
'only one array' => [
|
||||||
|
'arrayMergeRecursive needs two or more array arguments',
|
||||||
|
[1],
|
||||||
|
true,
|
||||||
|
],
|
||||||
|
// error element is not array
|
||||||
|
'non array between array' => [
|
||||||
|
'arrayMergeRecursive encountered a non array argument',
|
||||||
|
[1],
|
||||||
|
'string',
|
||||||
|
[2]
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -626,21 +681,43 @@ final class CoreLibsCombinedArrayHandlerTest extends TestCase
|
|||||||
* Undocumented function
|
* Undocumented function
|
||||||
*
|
*
|
||||||
* @covers ::arrayMergeRecursive
|
* @covers ::arrayMergeRecursive
|
||||||
* @#dataProvider arrayMergeRecursiveProvider
|
* @dataProvider arrayMergeRecursiveProvider
|
||||||
* @testdox arrayMergeRecursive ... will be $expected [$_dataName]
|
* @testdox arrayMergeRecursive ... [$_dataName]
|
||||||
*
|
*
|
||||||
* @param array $input nested array set as each parameter
|
|
||||||
* @param bool $flag
|
|
||||||
* @param bool|array $expected
|
|
||||||
* @return void
|
* @return void
|
||||||
* array $input, bool $flag, $expected
|
*
|
||||||
*/
|
*/
|
||||||
public function testArrayMergeRecursive(): void
|
public function testArrayMergeRecursive(): void
|
||||||
{
|
{
|
||||||
$this->assertTrue(true, 'Implement proper test run');
|
$arrays = func_get_args();
|
||||||
$this->markTestIncomplete(
|
// first is expected array, always
|
||||||
'testArrayMergeRecursive has not been implemented yet.'
|
$expected = array_shift($arrays);
|
||||||
|
$output = \CoreLibs\Combined\ArrayHandler::arrayMergeRecursive(
|
||||||
|
...$arrays
|
||||||
);
|
);
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected,
|
||||||
|
$output
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Undocumented function
|
||||||
|
*
|
||||||
|
* @covers ::arrayMergeRecursive
|
||||||
|
* @dataProvider arrayMergeRecursiveProviderWarning
|
||||||
|
* @testdox arrayMergeRecursive with E_USER_WARNING [$_dataName]
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testArrayMergeRecursiveWarningA(): void
|
||||||
|
{
|
||||||
|
$arrays = func_get_args();
|
||||||
|
// first is expected warning
|
||||||
|
$warning = array_shift($arrays);
|
||||||
|
$this->expectWarning();
|
||||||
|
$this->expectWarningMessage($warning);
|
||||||
|
\CoreLibs\Combined\ArrayHandler::arrayMergeRecursive(...$arrays);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ final class CoreLibsConvertColorsTest extends TestCase
|
|||||||
],
|
],
|
||||||
'valid color' => [
|
'valid color' => [
|
||||||
'rgb' => [10, 100, 200],
|
'rgb' => [10, 100, 200],
|
||||||
'hsb' => [212, 95, 78],
|
'hsb' => [212, 95, 78.0],
|
||||||
'hsb_rgb' => [10, 98, 199], // should be rgb, but rounding error
|
'hsb_rgb' => [10, 98, 199], // should be rgb, but rounding error
|
||||||
'hsl' => [211.6, 90.5, 41.2],
|
'hsl' => [211.6, 90.5, 41.2],
|
||||||
'valid' => true,
|
'valid' => true,
|
||||||
@@ -327,13 +327,13 @@ final class CoreLibsConvertColorsTest extends TestCase
|
|||||||
* @dataProvider hsb2rgbColorProvider
|
* @dataProvider hsb2rgbColorProvider
|
||||||
* @testdox hsb2rgb $input_h,$input_s,$input_b will be $expected [$_dataName]
|
* @testdox hsb2rgb $input_h,$input_s,$input_b will be $expected [$_dataName]
|
||||||
*
|
*
|
||||||
* @param integer $input_h
|
* @param float $input_h
|
||||||
* @param integer $input_s
|
* @param float $input_s
|
||||||
* @param integer $input_b
|
* @param float $input_b
|
||||||
* @param array|bool $expected
|
* @param array|bool $expected
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testHsb2rgb(int $input_h, int $input_s, int $input_b, $expected): void
|
public function testHsb2rgb(float $input_h, float $input_s, float $input_b, $expected): void
|
||||||
{
|
{
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
$expected,
|
$expected,
|
||||||
|
|||||||
102
4dev/tests/CoreLibsConvertEncodingTest.php
Normal file
102
4dev/tests/CoreLibsConvertEncodingTest.php
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace tests;
|
||||||
|
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test class for Convert\Encoding
|
||||||
|
* @coversDefaultClass \CoreLibs\Convert\Encoding
|
||||||
|
* @testdox \CoreLibs\Convert\Encoding method tests
|
||||||
|
*/
|
||||||
|
final class CoreLibsConvertEncodingTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Undocumented function
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function convertEncodingProvider(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
// 0: original string
|
||||||
|
// 1: target encoding
|
||||||
|
// 2: optional source encoding
|
||||||
|
// 3: auto check (not used)
|
||||||
|
// 4: expected string
|
||||||
|
// 5: expected string encoding
|
||||||
|
'simple from UTF-8 to SJIS' => [
|
||||||
|
'input string',
|
||||||
|
'SJIS',
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
'input string',
|
||||||
|
'SJIS'
|
||||||
|
],
|
||||||
|
'kanji from UTF-8 to SJIS' => [
|
||||||
|
'日本語',
|
||||||
|
'SJIS',
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
'日本語',
|
||||||
|
'SJIS'
|
||||||
|
],
|
||||||
|
'kanji from UTF-8 to SJIS with source' => [
|
||||||
|
'日本語',
|
||||||
|
'SJIS',
|
||||||
|
'UTF-8',
|
||||||
|
null,
|
||||||
|
'日本語',
|
||||||
|
'SJIS'
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Undocumented function
|
||||||
|
*
|
||||||
|
* @covers ::convertEncoding
|
||||||
|
* @dataProvider convertEncodingProvider
|
||||||
|
* @testdox convert encoding $target_encoding, source: $source_encoding, auto: $auto_check [$_dataName]
|
||||||
|
*
|
||||||
|
* @param string $input
|
||||||
|
* @param string $target_encoding
|
||||||
|
* @param string $source_encoding
|
||||||
|
* @param bool $auto_check
|
||||||
|
* @param string $expected
|
||||||
|
* @param string $expected_encoding
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testConvertEncoding(
|
||||||
|
string $input,
|
||||||
|
string $target_encoding,
|
||||||
|
?string $source_encoding,
|
||||||
|
?bool $auto_check,
|
||||||
|
string $expected,
|
||||||
|
string $expected_encoding
|
||||||
|
): void {
|
||||||
|
if ($source_encoding === null and $auto_check === null) {
|
||||||
|
$string = \CoreLibs\Convert\Encoding::convertEncoding($input, $target_encoding);
|
||||||
|
} elseif ($auto_check === null) {
|
||||||
|
$string = \CoreLibs\Convert\Encoding::convertEncoding($input, $target_encoding, $source_encoding);
|
||||||
|
} else {
|
||||||
|
$string = \CoreLibs\Convert\Encoding::convertEncoding(
|
||||||
|
$input,
|
||||||
|
$target_encoding,
|
||||||
|
$source_encoding,
|
||||||
|
$auto_check
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// because we can't store encoding in here anyway
|
||||||
|
$target = mb_convert_encoding($expected, $expected_encoding, 'UTF-8');
|
||||||
|
// print "IN: $input, $target_encoding\n";
|
||||||
|
$this->assertEquals(
|
||||||
|
$target,
|
||||||
|
$string
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// __END__
|
||||||
@@ -11,7 +11,7 @@ use PHPUnit\Framework\TestCase;
|
|||||||
* @coversDefaultClass \CoreLibs\Convert\Json
|
* @coversDefaultClass \CoreLibs\Convert\Json
|
||||||
* @testdox \CoreLibs\Convert\Json method tests
|
* @testdox \CoreLibs\Convert\Json method tests
|
||||||
*/
|
*/
|
||||||
final class CoreLibsCheckJsonTest extends TestCase
|
final class CoreLibsConvertJsonTest extends TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
101
4dev/tests/CoreLibsConvertMimeEncodeTest.php
Normal file
101
4dev/tests/CoreLibsConvertMimeEncodeTest.php
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace tests;
|
||||||
|
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test class for Convert\MimeEncode
|
||||||
|
* @coversDefaultClass \CoreLibs\Convert\MimeEncode
|
||||||
|
* @testdox \CoreLibs\Convert\MimeEncode method tests
|
||||||
|
*/
|
||||||
|
final class CoreLibsConvertMimeEncodeTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Undocumented function
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function mbMimeEncodeProvider(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
// 0: input string
|
||||||
|
// 1: encoding
|
||||||
|
// 2: expected
|
||||||
|
'standard UTF-8' => [
|
||||||
|
'Test string',
|
||||||
|
'UTF-8',
|
||||||
|
'Test string'
|
||||||
|
],
|
||||||
|
'long text UTF-8' => [
|
||||||
|
'The quick brown fox jumps over the lazy sheep that sleeps in the ravine '
|
||||||
|
. 'and has no idea what is going on here',
|
||||||
|
'UTF-8',
|
||||||
|
'The quick brown fox jumps over the lazy sheep that sleeps in the ravine '
|
||||||
|
. 'and has no idea what is going on here'
|
||||||
|
],
|
||||||
|
'standard with special chars UTF-8' => [
|
||||||
|
'This is ümläßtと漢字もカタカナ!!^$%&',
|
||||||
|
'UTF-8',
|
||||||
|
'This is =?UTF-8?B?w7xtbMOkw59044Go5ryi5a2X44KC44Kr44K/44Kr44OK77yBIV4k?='
|
||||||
|
. "\r\n"
|
||||||
|
. ' =?UTF-8?B?JQ==?=&'
|
||||||
|
],
|
||||||
|
'35 chars and space at the end UTF-8' => [
|
||||||
|
'12345678901234567890123456789012345 '
|
||||||
|
. 'is there a space?',
|
||||||
|
'UTF-8',
|
||||||
|
'12345678901234567890123456789012345 '
|
||||||
|
. 'is there a =?UTF-8?B?c3BhY2U/?='
|
||||||
|
],
|
||||||
|
'36 chars and space at the end UTF-8' => [
|
||||||
|
'123456789012345678901234567890123456 '
|
||||||
|
. 'is there a space?',
|
||||||
|
'UTF-8',
|
||||||
|
'123456789012345678901234567890123456 '
|
||||||
|
. 'is there a =?UTF-8?B?c3BhY2U/?='
|
||||||
|
],
|
||||||
|
'36 kanji and space UTF-8' => [
|
||||||
|
'カタカナカタカナかなカタカナカタカナかなカタカナカタカナかなカタカナカタ '
|
||||||
|
. 'is there a space?',
|
||||||
|
'UTF-8',
|
||||||
|
"=?UTF-8?B?44Kr44K/44Kr44OK44Kr44K/44Kr44OK44GL44Gq44Kr44K/44Kr44OK44Kr?=\r\n"
|
||||||
|
. " =?UTF-8?B?44K/44Kr44OK?=\r\n"
|
||||||
|
. " =?UTF-8?B?44GL44Gq44Kr44K/44Kr44OK44Kr44K/44Kr44OK44GL44Gq44Kr44K/44Kr?=\r\n"
|
||||||
|
. " =?UTF-8?B?44OK44Kr44K/?= is there a =?UTF-8?B?c3BhY2U/?="
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mb mime header encoding test
|
||||||
|
*
|
||||||
|
* @covers ::__mbMimeEncode
|
||||||
|
* @dataProvider mbMimeEncodeProvider
|
||||||
|
* @testdox mb encoding target $encoding [$_dataName]
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testUuMbMimeEncode(string $input, string $encoding, string $expected): void
|
||||||
|
{
|
||||||
|
// encode string first
|
||||||
|
$encoded = \CoreLibs\Convert\MimeEncode::__mbMimeEncode($input, $encoding);
|
||||||
|
// print "MIME: -" . $encoded . "-\n";
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected,
|
||||||
|
$encoded
|
||||||
|
);
|
||||||
|
$decoded = mb_decode_mimeheader($encoded);
|
||||||
|
// print "INPUT : " . $input . "\n";
|
||||||
|
// print "DECODED: " . $decoded . "\n";
|
||||||
|
// back compare decoded
|
||||||
|
$this->assertEquals(
|
||||||
|
$input,
|
||||||
|
$decoded
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// __END__
|
||||||
@@ -68,6 +68,7 @@ final class CoreLibsCreateSessionTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testStartSession(string $input, string $type, $expected_n, $expected_i): void
|
public function testStartSession(string $input, string $type, $expected_n, $expected_i): void
|
||||||
{
|
{
|
||||||
|
// NEEDS MOCKING
|
||||||
/* $session_id = '';
|
/* $session_id = '';
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'p':
|
case 'p':
|
||||||
@@ -97,7 +98,8 @@ final class CoreLibsCreateSessionTest extends TestCase
|
|||||||
if ($type == 'g') {
|
if ($type == 'g') {
|
||||||
unset($GLOBALS['SET_SESSION_NAME']);
|
unset($GLOBALS['SET_SESSION_NAME']);
|
||||||
} */
|
} */
|
||||||
$this->markTestSkipped('No implementation for Create\Session. Cannot run session_start in CLI');
|
$this->markTestSkipped('[CoreLibsCreateSessionTest] No implementation '
|
||||||
|
. 'for Create\Session. Cannot run session_start in CLI');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
);
|
);
|
||||||
if (!$db->dbGetConnectionStatus()) {
|
if (!$db->dbGetConnectionStatus()) {
|
||||||
self::markTestSkipped(
|
self::markTestSkipped(
|
||||||
'Cannot connect to valid Test DB.'
|
'Cannot connect to valid Test DB for DB\IO test.'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// check if they already exist, drop them
|
// check if they already exist, drop them
|
||||||
@@ -347,6 +347,7 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns test list for dbCompareVersion check
|
* Returns test list for dbCompareVersion check
|
||||||
|
* NOTE: unless we fully mock the =version check needs to be updated
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
@@ -357,16 +358,16 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
return [
|
return [
|
||||||
'compare = ok' => [ '=13.6.0', true ],
|
'compare = ok' => [ '=13.6.0', true ],
|
||||||
'compare = bad' => [ '=9.2.0', false ],
|
'compare = bad' => [ '=9.2.0', false ],
|
||||||
'compare < ok' => [ '<20.0.0', true ],
|
'compare < ok' => [ '<99.0.0', true ],
|
||||||
'compare < bad' => [ '<9.2.0', false ],
|
'compare < bad' => [ '<9.2.0', false ],
|
||||||
'compare <= ok a' => [ '<=20.0.0', true ],
|
'compare <= ok a' => [ '<=99.0.0', true ],
|
||||||
'compare <= ok b' => [ '<=13.6.0', true ],
|
'compare <= ok b' => [ '<=13.6.0', true ],
|
||||||
'compare <= false' => [ '<=9.2.0', false ],
|
'compare <= false' => [ '<=9.2.0', false ],
|
||||||
'compare > ok' => [ '>9.2.0', true ],
|
'compare > ok' => [ '>9.2.0', true ],
|
||||||
'compare > bad' => [ '>20.2.0', false ],
|
'compare > bad' => [ '>99.2.0', false ],
|
||||||
'compare >= ok a' => [ '>=13.6.0', true ],
|
'compare >= ok a' => [ '>=13.6.0', true ],
|
||||||
'compare >= ok b' => [ '>=9.2.0', true ],
|
'compare >= ok b' => [ '>=9.2.0', true ],
|
||||||
'compare >= bad' => [ '>=20.0.0', false ],
|
'compare >= bad' => [ '>=99.0.0', false ],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -565,7 +566,7 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
public function testDbSetDebug(
|
public function testDbSetDebug(
|
||||||
string $connection,
|
string $connection,
|
||||||
?bool $set,
|
?bool $set,
|
||||||
bool $expected,
|
bool $expected
|
||||||
): void {
|
): void {
|
||||||
$db = new \CoreLibs\DB\IO(
|
$db = new \CoreLibs\DB\IO(
|
||||||
self::$db_config[$connection],
|
self::$db_config[$connection],
|
||||||
@@ -598,7 +599,7 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
public function testDbToggleDebug(
|
public function testDbToggleDebug(
|
||||||
string $connection,
|
string $connection,
|
||||||
?bool $toggle,
|
?bool $toggle,
|
||||||
bool $expected,
|
bool $expected
|
||||||
): void {
|
): void {
|
||||||
$db = new \CoreLibs\DB\IO(
|
$db = new \CoreLibs\DB\IO(
|
||||||
self::$db_config[$connection],
|
self::$db_config[$connection],
|
||||||
@@ -1733,7 +1734,7 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
$expected,
|
$expected,
|
||||||
string $warning,
|
string $warning,
|
||||||
string $error,
|
string $error,
|
||||||
string $insert_data,
|
string $insert_data
|
||||||
): void {
|
): void {
|
||||||
// self::$log->setLogLevelAll('debug', true);
|
// self::$log->setLogLevelAll('debug', true);
|
||||||
// self::$log->setLogLevelAll('print', true);
|
// self::$log->setLogLevelAll('print', true);
|
||||||
@@ -1870,7 +1871,7 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
$expected,
|
$expected,
|
||||||
string $warning,
|
string $warning,
|
||||||
string $error,
|
string $error,
|
||||||
string $insert_data,
|
string $insert_data
|
||||||
): void {
|
): void {
|
||||||
// self::$log->setLogLevelAll('debug', true);
|
// self::$log->setLogLevelAll('debug', true);
|
||||||
// self::$log->setLogLevelAll('print', true);
|
// self::$log->setLogLevelAll('print', true);
|
||||||
@@ -2033,7 +2034,7 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
array $cursor_ext_checks,
|
array $cursor_ext_checks,
|
||||||
string $warning,
|
string $warning,
|
||||||
string $error,
|
string $error,
|
||||||
string $insert_data,
|
string $insert_data
|
||||||
): void {
|
): void {
|
||||||
// self::$log->setLogLevelAll('debug', true);
|
// self::$log->setLogLevelAll('debug', true);
|
||||||
// self::$log->setLogLevelAll('print', true);
|
// self::$log->setLogLevelAll('print', true);
|
||||||
@@ -2355,7 +2356,7 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
string $error_execute,
|
string $error_execute,
|
||||||
string $expected_data_query,
|
string $expected_data_query,
|
||||||
array $expected_data,
|
array $expected_data,
|
||||||
string $insert_data,
|
string $insert_data
|
||||||
): void {
|
): void {
|
||||||
// self::$log->setLogLevelAll('debug', true);
|
// self::$log->setLogLevelAll('debug', true);
|
||||||
// self::$log->setLogLevelAll('print', true);
|
// self::$log->setLogLevelAll('print', true);
|
||||||
@@ -2646,7 +2647,8 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
'level' => 'error',
|
'level' => 'error',
|
||||||
'id' => '51',
|
'id' => '51',
|
||||||
'error' => 'Max query call needs to be set to at least 1',
|
'error' => 'Max query call needs to be set to at least 1',
|
||||||
'source' => 'main::run::run::run::run::run::run::runBare::runTest::testDbErrorHandling::dbSetMaxQueryCall',
|
// run:: can be +1 if called in set and not direct
|
||||||
|
'source' => "/^main::run::run::run::run::run::run::(run::)?runBare::runTest::testDbErrorHandling::dbSetMaxQueryCall$/",
|
||||||
'pg_error' => '',
|
'pg_error' => '',
|
||||||
'msg' => '',
|
'msg' => '',
|
||||||
]
|
]
|
||||||
@@ -2707,7 +2709,8 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
// comarep all, except timestamp that is a regex
|
// comarep all, except timestamp that is a regex
|
||||||
foreach ($expected_history as $key => $value) {
|
foreach ($expected_history as $key => $value) {
|
||||||
// check if starts with / because this is regex (timestamp)
|
// check if starts with / because this is regex (timestamp)
|
||||||
if (strpos($value, "/") === 0) {
|
// if (substr($expected_2, 0, 1) == '/) {
|
||||||
|
if (strpos($value, '/') === 0) {
|
||||||
// this is regex
|
// this is regex
|
||||||
$this->assertMatchesRegularExpression(
|
$this->assertMatchesRegularExpression(
|
||||||
$value,
|
$value,
|
||||||
@@ -3007,7 +3010,7 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
string $insert,
|
string $insert,
|
||||||
?string $pk_name,
|
?string $pk_name,
|
||||||
string $table,
|
string $table,
|
||||||
string $primary_key,
|
string $primary_key
|
||||||
): void {
|
): void {
|
||||||
// self::$log->setLogLevelAll('debug', true);
|
// self::$log->setLogLevelAll('debug', true);
|
||||||
// self::$log->setLogLevelAll('print', true);
|
// self::$log->setLogLevelAll('print', true);
|
||||||
@@ -3386,8 +3389,37 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
|
|
||||||
// if this is a select query, db dbReturn, dbReturnRow, dbReturnArray too
|
// if this is a select query, db dbReturn, dbReturnRow, dbReturnArray too
|
||||||
if (preg_match("/^(select|show|with) /i", $query)) {
|
if (preg_match("/^(select|show|with) /i", $query)) {
|
||||||
// TODO also tst dbReturnRow and dbReturnArray
|
// dbReturn
|
||||||
$res = $db->dbReturn($query);
|
$db->dbReturn($query);
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected_rows,
|
||||||
|
$db->dbGetNumRows()
|
||||||
|
);
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected_cols,
|
||||||
|
$db->dbGetNumFields()
|
||||||
|
);
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected_col_names,
|
||||||
|
$db->dbGetFieldNames()
|
||||||
|
);
|
||||||
|
// dbReturnRow
|
||||||
|
// will return ALL rows there, but returns only the first
|
||||||
|
$db->dbReturnRow($query);
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected_rows,
|
||||||
|
$db->dbGetNumRows()
|
||||||
|
);
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected_cols,
|
||||||
|
$db->dbGetNumFields()
|
||||||
|
);
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected_col_names,
|
||||||
|
$db->dbGetFieldNames()
|
||||||
|
);
|
||||||
|
// dbReturnArray
|
||||||
|
$db->dbReturnArray($query);
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
$expected_rows,
|
$expected_rows,
|
||||||
$db->dbGetNumRows()
|
$db->dbGetNumRows()
|
||||||
|
|||||||
@@ -54,14 +54,16 @@ final class CoreLibsDebugLoggingTest extends TestCase
|
|||||||
'no options set, constant set' => [
|
'no options set, constant set' => [
|
||||||
null,
|
null,
|
||||||
[
|
[
|
||||||
'log_folder' => '/tmp/',
|
'log_folder' => str_replace('/configs', '', __DIR__)
|
||||||
|
. DIRECTORY_SEPARATOR . 'log/',
|
||||||
'debug_all' => false,
|
'debug_all' => false,
|
||||||
'print_all' => false,
|
'print_all' => false,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'constant' => [
|
'constant' => [
|
||||||
'BASE' => '/tmp',
|
'BASE' => str_replace('/configs', '', __DIR__)
|
||||||
'LOG' => '/'
|
. DIRECTORY_SEPARATOR,
|
||||||
|
'LOG' => 'log/'
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
@@ -728,7 +730,7 @@ final class CoreLibsDebugLoggingTest extends TestCase
|
|||||||
bool $expected_debug,
|
bool $expected_debug,
|
||||||
string $expected_file,
|
string $expected_file,
|
||||||
string $expected_string_start,
|
string $expected_string_start,
|
||||||
string $expected_string_contains,
|
string $expected_string_contains
|
||||||
): void {
|
): void {
|
||||||
// must run with below matrix
|
// must run with below matrix
|
||||||
// level | debug | print | echo | debug() | printErrorMsg() | file
|
// level | debug | print | echo | debug() | printErrorMsg() | file
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php // phpcs:disable Generic.Files.LineLength
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
@@ -255,18 +255,27 @@ final class CoreLibsDebugSupportTest extends TestCase
|
|||||||
* Undocumented function
|
* Undocumented function
|
||||||
*
|
*
|
||||||
* @cover ::getCallerMethodList
|
* @cover ::getCallerMethodList
|
||||||
* @testWith [["main", "run", "run", "run", "run", "run", "run", "runBare", "runTest", "testGetCallerMethodList"]]
|
* @testWith [["main", "run", "run", "run", "run", "run", "run", "runBare", "runTest", "testGetCallerMethodList"],["main", "run", "run", "run", "run", "run", "run", "run", "runBare", "runTest", "testGetCallerMethodList"]]
|
||||||
* @testdox getCallerMethodList check if it returns $expected [$_dataName]
|
* @testdox getCallerMethodList check if it returns $expected [$_dataName]
|
||||||
*
|
*
|
||||||
* @param array $expected
|
* @param array $expected
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testGetCallerMethodList(array $expected): void
|
public function testGetCallerMethodList(array $expected, array $expected_group): void
|
||||||
{
|
{
|
||||||
$this->assertEquals(
|
$compare = \CoreLibs\Debug\Support::getCallerMethodList();
|
||||||
$expected,
|
// if we direct call we have 10, if we call as folder we get 11
|
||||||
\CoreLibs\Debug\Support::getCallerMethodList()
|
if (count($compare) == 10) {
|
||||||
);
|
$this->assertEquals(
|
||||||
|
$expected,
|
||||||
|
\CoreLibs\Debug\Support::getCallerMethodList()
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected_group,
|
||||||
|
\CoreLibs\Debug\Support::getCallerMethodList()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -90,11 +90,16 @@ final class CoreLibsGetSystemTest extends TestCase
|
|||||||
public function getPageNameProvider(): array
|
public function getPageNameProvider(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
// 0: input
|
||||||
|
// 1: expected default/WITH_EXTENSION
|
||||||
|
// 2: expected NO_EXTENSION
|
||||||
|
// 3: expected FULL_PATH, if first and last character are / use regex
|
||||||
'original set' => [
|
'original set' => [
|
||||||
0 => null, // input
|
0 => null,
|
||||||
1 => 'phpunit',
|
1 => 'phpunit',
|
||||||
2 => 'phpunit',
|
2 => 'phpunit',
|
||||||
3 => 'www/vendor/bin/phpunit', // NOTE: this can change
|
// NOTE: this can change, so it is a regex check
|
||||||
|
3 => "/^(\/?.*\/?)?www\/vendor\/bin\/phpunit$/",
|
||||||
],
|
],
|
||||||
'some path with extension' => [
|
'some path with extension' => [
|
||||||
0 => '/some/path/to/file.txt',
|
0 => '/some/path/to/file.txt',
|
||||||
@@ -147,11 +152,13 @@ final class CoreLibsGetSystemTest extends TestCase
|
|||||||
list ($host, $port) = \CoreLibs\Get\System::getHostName();
|
list ($host, $port) = \CoreLibs\Get\System::getHostName();
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
$expected_host,
|
$expected_host,
|
||||||
$host
|
$host,
|
||||||
|
'failed expected host assert'
|
||||||
);
|
);
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
$expected_port,
|
$expected_port,
|
||||||
$port
|
$port,
|
||||||
|
'faile expected port assert'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,20 +183,38 @@ final class CoreLibsGetSystemTest extends TestCase
|
|||||||
// default 0,
|
// default 0,
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
$expected_0,
|
$expected_0,
|
||||||
\CoreLibs\Get\System::getPageName()
|
\CoreLibs\Get\System::getPageName(),
|
||||||
|
'failed default assert'
|
||||||
);
|
);
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
$expected_0,
|
$expected_0,
|
||||||
\CoreLibs\Get\System::getPageName(\CoreLibs\Get\System::WITH_EXTENSION)
|
\CoreLibs\Get\System::getPageName(\CoreLibs\Get\System::WITH_EXTENSION),
|
||||||
|
'failed WITH_EXTESION assert'
|
||||||
);
|
);
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
$expected_1,
|
$expected_1,
|
||||||
\CoreLibs\Get\System::getPageName(\CoreLibs\Get\System::NO_EXTENSION)
|
\CoreLibs\Get\System::getPageName(\CoreLibs\Get\System::NO_EXTENSION),
|
||||||
);
|
'failed NO_EXTENSION assert'
|
||||||
$this->assertEquals(
|
|
||||||
$expected_2,
|
|
||||||
\CoreLibs\Get\System::getPageName(\CoreLibs\Get\System::FULL_PATH)
|
|
||||||
);
|
);
|
||||||
|
// FULL PATH check can be equals or regex
|
||||||
|
$page_name_full_path = \CoreLibs\Get\System::getPageName(\CoreLibs\Get\System::FULL_PATH);
|
||||||
|
if (
|
||||||
|
substr($expected_2, 0, 1) == '/' &&
|
||||||
|
substr($expected_2, -1, 1) == '/'
|
||||||
|
) {
|
||||||
|
// this is regex
|
||||||
|
$this->assertMatchesRegularExpression(
|
||||||
|
$expected_2,
|
||||||
|
$page_name_full_path,
|
||||||
|
'failed FULL_PATH assert regex'
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected_2,
|
||||||
|
$page_name_full_path,
|
||||||
|
'failed FULL_PATH assert equals'
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace tests;
|
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test class for Language\Encoding
|
|
||||||
* @coversDefaultClass \CoreLibs\Language\Encoding
|
|
||||||
* @testdox \CoreLibs\Language\Encoding method tests
|
|
||||||
*/
|
|
||||||
final class CoreLibsLanguageEncodingTest extends TestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Undocumented function
|
|
||||||
*
|
|
||||||
* @testdox Language\Encoding Class tests
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testLanguageEncoding()
|
|
||||||
{
|
|
||||||
$this->assertTrue(true, 'Language Encoding Tests not implemented');
|
|
||||||
$this->markTestIncomplete(
|
|
||||||
'Language\Encoding Tests have not yet been implemented'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// __END__
|
|
||||||
310
4dev/tests/CoreLibsLanguageGetLocaleTest.php
Normal file
310
4dev/tests/CoreLibsLanguageGetLocaleTest.php
Normal file
@@ -0,0 +1,310 @@
|
|||||||
|
<?php // phpcs:disable Generic.Files.LineLength
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace tests;
|
||||||
|
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test class for Language\GetLocale
|
||||||
|
*
|
||||||
|
* @coversDefaultClass \CoreLibs\Language\GetLocale
|
||||||
|
* @testdox \CoreLibs\Language\GetLocale method tests
|
||||||
|
*/
|
||||||
|
final class CoreLibsLanguageGetLocaleTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* set all constant variables that must be set before call
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function setUpBeforeClass(): void
|
||||||
|
{
|
||||||
|
// default web page encoding setting
|
||||||
|
if (!defined('DEFAULT_ENCODING')) {
|
||||||
|
define('DEFAULT_ENCODING', 'UTF-8');
|
||||||
|
}
|
||||||
|
if (!defined('DEFAULT_LOCALE')) {
|
||||||
|
// default lang + encoding
|
||||||
|
define('DEFAULT_LOCALE', 'en_US.UTF-8');
|
||||||
|
}
|
||||||
|
// site
|
||||||
|
if (!defined('SITE_ENCODING')) {
|
||||||
|
define('SITE_ENCODING', DEFAULT_ENCODING);
|
||||||
|
}
|
||||||
|
if (!defined('SITE_LOCALE')) {
|
||||||
|
define('SITE_LOCALE', DEFAULT_LOCALE);
|
||||||
|
}
|
||||||
|
// just set
|
||||||
|
if (!defined('BASE')) {
|
||||||
|
define('BASE', str_replace('/configs', '', __DIR__) . DIRECTORY_SEPARATOR);
|
||||||
|
}
|
||||||
|
if (!defined('INCLUDES')) {
|
||||||
|
define('INCLUDES', 'includes' . DIRECTORY_SEPARATOR);
|
||||||
|
}
|
||||||
|
if (!defined('LANG')) {
|
||||||
|
define('LANG', 'lang' . DIRECTORY_SEPARATOR);
|
||||||
|
}
|
||||||
|
if (!defined('LOCALE')) {
|
||||||
|
define('LOCALE', 'locale' . DIRECTORY_SEPARATOR);
|
||||||
|
}
|
||||||
|
if (!defined('CONTENT_PATH')) {
|
||||||
|
define('CONTENT_PATH', 'frontend' . DIRECTORY_SEPARATOR);
|
||||||
|
}
|
||||||
|
// array session
|
||||||
|
$_SESSION = [];
|
||||||
|
global $_SESSION;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* all the test data
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function setLocaleProvider(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
// 0: locale
|
||||||
|
// 1: domain
|
||||||
|
// 2: encoding
|
||||||
|
// 3: path
|
||||||
|
// 4: SESSION: DEFAULT_LOCALE
|
||||||
|
// 5: SESSION: DEFAULT_CHARSET
|
||||||
|
// 6: expected array
|
||||||
|
'no params, all default constants' => [
|
||||||
|
// lang, domain, encoding, path
|
||||||
|
null, null, null, null,
|
||||||
|
// SESSION DEFAULT_LOCALE, SESSION: DEFAULT_CHARSET
|
||||||
|
null, null,
|
||||||
|
// return array
|
||||||
|
[
|
||||||
|
'locale' => 'en_US.UTF-8',
|
||||||
|
'lang' => 'en_US',
|
||||||
|
'domain' => 'frontend',
|
||||||
|
'encoding' => 'UTF-8',
|
||||||
|
'path' => "/^\/(.*\/)?includes\/locale\/$/",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'no params, session charset and lang' => [
|
||||||
|
// lang, domain, encoding, path
|
||||||
|
null, null, null, null,
|
||||||
|
// SESSION DEFAULT_LOCALE, SESSION: DEFAULT_CHARSET
|
||||||
|
'ja_JP', 'UTF-8',
|
||||||
|
// return array
|
||||||
|
[
|
||||||
|
'locale' => 'ja_JP',
|
||||||
|
'lang' => 'ja_JP',
|
||||||
|
'domain' => 'frontend',
|
||||||
|
'encoding' => 'UTF-8',
|
||||||
|
'path' => "/^\/(.*\/)?includes\/locale\/$/",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'no params, session charset and lang short' => [
|
||||||
|
// lang, domain, encoding, path
|
||||||
|
null, null, null, null,
|
||||||
|
// SESSION DEFAULT_LOCALE, SESSION: DEFAULT_CHARSET
|
||||||
|
'ja', 'UTF-8',
|
||||||
|
// return array
|
||||||
|
[
|
||||||
|
'locale' => 'ja',
|
||||||
|
'lang' => 'ja',
|
||||||
|
'domain' => 'frontend',
|
||||||
|
'encoding' => 'UTF-8',
|
||||||
|
'path' => "/^\/(.*\/)?includes\/locale\/$/",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
// param lang (no sessions)
|
||||||
|
'locale param only, no sessions' => [
|
||||||
|
// lang, domain, encoding, path
|
||||||
|
'ja.UTF-8', null, null, null,
|
||||||
|
// SESSION DEFAULT_LOCALE, SESSION: DEFAULT_CHARSET
|
||||||
|
null, null,
|
||||||
|
// return array
|
||||||
|
[
|
||||||
|
'locale' => 'ja.UTF-8',
|
||||||
|
'lang' => 'ja',
|
||||||
|
'domain' => 'frontend',
|
||||||
|
'encoding' => 'UTF-8',
|
||||||
|
'path' => "/^\/(.*\/)?includes\/locale\/$/",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
// different locale setting
|
||||||
|
'locale complex param only, no sessions' => [
|
||||||
|
// lang, domain, encoding, path
|
||||||
|
'ja_JP.SJIS', null, null, null,
|
||||||
|
// SESSION DEFAULT_LOCALE, SESSION: DEFAULT_CHARSET
|
||||||
|
null, null,
|
||||||
|
// return array
|
||||||
|
[
|
||||||
|
'locale' => 'ja_JP.SJIS',
|
||||||
|
'lang' => 'ja_JP',
|
||||||
|
'domain' => 'frontend',
|
||||||
|
'encoding' => 'SJIS',
|
||||||
|
'path' => "/^\/(.*\/)?includes\/locale\/$/",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
// param lang and domain (no override)
|
||||||
|
'locale, domain params, no sessions' => [
|
||||||
|
// lang, domain, encoding, path
|
||||||
|
'ja.UTF-8', 'admin', null, null,
|
||||||
|
// SESSION DEFAULT_LOCALE, SESSION: DEFAULT_CHARSET
|
||||||
|
null, null,
|
||||||
|
// return array
|
||||||
|
[
|
||||||
|
'locale' => 'ja.UTF-8',
|
||||||
|
'lang' => 'ja',
|
||||||
|
'domain' => 'admin',
|
||||||
|
'encoding' => 'UTF-8',
|
||||||
|
'path' => "/^\/(.*\/)?includes\/locale\/$/",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
// param lang and domain (no override)
|
||||||
|
'locale, domain, encoding params, no sessions' => [
|
||||||
|
// lang, domain, encoding, path
|
||||||
|
'ja.UTF-8', 'admin', 'UTF-8', null,
|
||||||
|
// SESSION DEFAULT_LOCALE, SESSION: DEFAULT_CHARSET
|
||||||
|
null, null,
|
||||||
|
// return array
|
||||||
|
[
|
||||||
|
'locale' => 'ja.UTF-8',
|
||||||
|
'lang' => 'ja',
|
||||||
|
'domain' => 'admin',
|
||||||
|
'encoding' => 'UTF-8',
|
||||||
|
'path' => "/^\/(.*\/)?includes\/locale\/$/",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
// lang, domain, path (no override)
|
||||||
|
'locale, domain and path, no sessions' => [
|
||||||
|
// lang, domain, encoding, path
|
||||||
|
'ja.UTF-8', 'admin', '', __DIR__ . '/locale_other/',
|
||||||
|
// SESSION DEFAULT_LOCALE, SESSION: DEFAULT_CHARSET
|
||||||
|
null, null,
|
||||||
|
// return array
|
||||||
|
[
|
||||||
|
'locale' => 'ja.UTF-8',
|
||||||
|
'lang' => 'ja',
|
||||||
|
'domain' => 'admin',
|
||||||
|
'encoding' => 'UTF-8',
|
||||||
|
'path' => "/^\/(.*\/)?locale_other\/$/",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
// all params set (no override)
|
||||||
|
'all parameter, no sessions' => [
|
||||||
|
// lang, domain, encoding, path
|
||||||
|
'ja', 'admin', 'UTF-8', __DIR__ . '/locale_other/',
|
||||||
|
// SESSION DEFAULT_LOCALE, SESSION: DEFAULT_CHARSET
|
||||||
|
null, null,
|
||||||
|
// return array
|
||||||
|
[
|
||||||
|
'locale' => 'ja',
|
||||||
|
'lang' => 'ja',
|
||||||
|
'domain' => 'admin',
|
||||||
|
'encoding' => 'UTF-8',
|
||||||
|
'path' => "/^\/(.*\/)?locale_other\/$/",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
// param lang and domain (no override)
|
||||||
|
'long locale, domain, encoding params, no sessions' => [
|
||||||
|
// lang, domain, encoding, path
|
||||||
|
'de_CH.UTF-8@euro', 'admin', 'UTF-8', null,
|
||||||
|
// SESSION DEFAULT_LOCALE, SESSION: DEFAULT_CHARSET
|
||||||
|
null, null,
|
||||||
|
// return array
|
||||||
|
[
|
||||||
|
'locale' => 'de_CH.UTF-8@euro',
|
||||||
|
'lang' => 'de_CH',
|
||||||
|
'domain' => 'admin',
|
||||||
|
'encoding' => 'UTF-8',
|
||||||
|
'path' => "/^\/(.*\/)?includes\/locale\/$/",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
// TODO invalid params (bad path) (no override)
|
||||||
|
// TODO param calls, but with override set
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Undocumented function
|
||||||
|
*
|
||||||
|
* @covers ::setLocale
|
||||||
|
* @dataProvider setLocaleProvider
|
||||||
|
* @testdox lang settings lang $language, domain $domain, encoding $encoding, path $path; session lang: $SESSION_DEFAULT_LOCALE, session char: $SESSION_DEFAULT_CHARSET [$_dataName]
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testsetLocale(
|
||||||
|
?string $language,
|
||||||
|
?string $domain,
|
||||||
|
?string $encoding,
|
||||||
|
?string $path,
|
||||||
|
?string $SESSION_DEFAULT_LOCALE,
|
||||||
|
?string $SESSION_DEFAULT_CHARSET,
|
||||||
|
array $expected
|
||||||
|
): void {
|
||||||
|
$return_lang_settings = [];
|
||||||
|
global $_SESSION;
|
||||||
|
// set override
|
||||||
|
if ($SESSION_DEFAULT_LOCALE !== null) {
|
||||||
|
$_SESSION['DEFAULT_LOCALE'] = $SESSION_DEFAULT_LOCALE;
|
||||||
|
}
|
||||||
|
if ($SESSION_DEFAULT_CHARSET !== null) {
|
||||||
|
$_SESSION['DEFAULT_CHARSET'] = $SESSION_DEFAULT_CHARSET;
|
||||||
|
}
|
||||||
|
// function call
|
||||||
|
if ($language === null && $domain === null && $encoding === null && $path === null) {
|
||||||
|
$return_lang_settings = \CoreLibs\Language\GetLocale::setLocale();
|
||||||
|
} elseif ($language !== null && $domain === null && $encoding === null && $path === null) {
|
||||||
|
$return_lang_settings = \CoreLibs\Language\GetLocale::setLocale(
|
||||||
|
$language
|
||||||
|
);
|
||||||
|
} elseif ($language !== null && $domain !== null && $encoding === null && $path === null) {
|
||||||
|
$return_lang_settings = \CoreLibs\Language\GetLocale::setLocale(
|
||||||
|
$language,
|
||||||
|
$domain
|
||||||
|
);
|
||||||
|
} elseif ($language !== null && $domain !== null && $encoding !== null && $path === null) {
|
||||||
|
$return_lang_settings = \CoreLibs\Language\GetLocale::setLocale(
|
||||||
|
$language,
|
||||||
|
$domain,
|
||||||
|
$encoding
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$return_lang_settings = \CoreLibs\Language\GetLocale::setLocale(
|
||||||
|
$language,
|
||||||
|
$domain,
|
||||||
|
$encoding,
|
||||||
|
$path
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// print "RETURN: " . print_r($return_lang_settings, true) . "\n";
|
||||||
|
|
||||||
|
foreach (
|
||||||
|
[
|
||||||
|
'locale', 'lang', 'domain', 'encoding', 'path'
|
||||||
|
] as $key
|
||||||
|
) {
|
||||||
|
$value = $expected[$key];
|
||||||
|
if (strpos($value, "/") === 0) {
|
||||||
|
// this is regex
|
||||||
|
$this->assertMatchesRegularExpression(
|
||||||
|
$value,
|
||||||
|
$return_lang_settings[$key],
|
||||||
|
'assert regex failed for ' . $key
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// assert equal
|
||||||
|
$this->assertEquals(
|
||||||
|
$value,
|
||||||
|
$return_lang_settings[$key],
|
||||||
|
'assert equal failed for ' . $key
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// unset all vars
|
||||||
|
$_SESSION = [];
|
||||||
|
unset($GLOBALS['OVERRIDE_LANG']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// __END__
|
||||||
File diff suppressed because it is too large
Load Diff
16
4dev/tests/includes/create_po.sh
Executable file
16
4dev/tests/includes/create_po.sh
Executable file
@@ -0,0 +1,16 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# if we don't have one base file we are in the wrong folder
|
||||||
|
if [ ! -f "locale/en_US/LC_MESSAGES/admin.mo" ]; then
|
||||||
|
echo "Locale file is missing, wrong base folder?"
|
||||||
|
echo "Should be: 4dev/tests/includes/"
|
||||||
|
exit;
|
||||||
|
fi;
|
||||||
|
|
||||||
|
for file in $(ls -1 locale/*.po); do
|
||||||
|
echo $file;
|
||||||
|
file=$(basename $file .po);
|
||||||
|
locale=$(echo "${file}" | cut -d "-" -f 1);
|
||||||
|
domain=$(echo "${file}" | cut -d "-" -f 2);
|
||||||
|
msgfmt -o locale/${locale}/LC_MESSAGES/${domain}.mo locale/${locale}-${domain}.po;
|
||||||
|
done;
|
||||||
34
4dev/tests/includes/locale/en_US-admin.po
Normal file
34
4dev/tests/includes/locale/en_US-admin.po
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: en_US.UTF-8 LC_MESSAGES admin\n"
|
||||||
|
"Report-Msgid-Bugs-To: clemens.schwaighofer@egplusww.com\n"
|
||||||
|
"POT-Creation-Date: 2018-03-28 10:40+0900\n"
|
||||||
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
|
"Last-Translator: clemens.schwaighofer@egplusww.co\n"
|
||||||
|
"Language-Team: E-GRAPHICS COMMUNICATIONS Japan <info.jp@egplusww.com>\n"
|
||||||
|
"Language: en_US\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||||
|
|
||||||
|
msgid "Original"
|
||||||
|
msgstr "Translated admin en_US"
|
||||||
|
|
||||||
|
msgid "single"
|
||||||
|
msgid_plural "multi"
|
||||||
|
msgstr[0] "Multi admin en_US 0"
|
||||||
|
msgstr[1] "Multi admin en_US 1"
|
||||||
|
msgstr[2] "Multi admin en_US 2"
|
||||||
|
|
||||||
|
msgctxt "context"
|
||||||
|
msgid "Original"
|
||||||
|
msgstr "Original context admin en_US"
|
||||||
|
|
||||||
|
msgctxt "context"
|
||||||
|
msgid "single"
|
||||||
|
msgid_plural "multi"
|
||||||
|
msgstr[0] "Multi context admin en_US 0"
|
||||||
|
msgstr[1] "Multi context admin en_US 1"
|
||||||
|
msgstr[2] "Multi context admin en_US 2"
|
||||||
34
4dev/tests/includes/locale/en_US-frontend.po
Normal file
34
4dev/tests/includes/locale/en_US-frontend.po
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: en_US.UTF-8 LC_MESSAGES frontend\n"
|
||||||
|
"Report-Msgid-Bugs-To: clemens.schwaighofer@egplusww.com\n"
|
||||||
|
"POT-Creation-Date: 2018-03-28 10:40+0900\n"
|
||||||
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
|
"Last-Translator: clemens.schwaighofer@egplusww.co\n"
|
||||||
|
"Language-Team: E-GRAPHICS COMMUNICATIONS Japan <info.jp@egplusww.com>\n"
|
||||||
|
"Language: en_US\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||||
|
|
||||||
|
msgid "Original"
|
||||||
|
msgstr "Translated frontend en_US"
|
||||||
|
|
||||||
|
msgid "single"
|
||||||
|
msgid_plural "multi"
|
||||||
|
msgstr[0] "Multi frontend en_US 0"
|
||||||
|
msgstr[1] "Multi frontend en_US 1"
|
||||||
|
msgstr[2] "Multi frontend en_US 2"
|
||||||
|
|
||||||
|
msgctxt "context"
|
||||||
|
msgid "Original"
|
||||||
|
msgstr "Original context frontend en_US"
|
||||||
|
|
||||||
|
msgctxt "context"
|
||||||
|
msgid "single"
|
||||||
|
msgid_plural "multi"
|
||||||
|
msgstr[0] "Multi context frontend en_US 0"
|
||||||
|
msgstr[1] "Multi context frontend en_US 1"
|
||||||
|
msgstr[2] "Multi context frontend en_US 2"
|
||||||
BIN
4dev/tests/includes/locale/en_US/LC_MESSAGES/admin.mo
Normal file
BIN
4dev/tests/includes/locale/en_US/LC_MESSAGES/admin.mo
Normal file
Binary file not shown.
BIN
4dev/tests/includes/locale/en_US/LC_MESSAGES/frontend.mo
Normal file
BIN
4dev/tests/includes/locale/en_US/LC_MESSAGES/frontend.mo
Normal file
Binary file not shown.
35
4dev/tests/includes/locale/ja_JP-admin.po
Normal file
35
4dev/tests/includes/locale/ja_JP-admin.po
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: ja_JP.UTF-8 LC_MESSAGES admin\n"
|
||||||
|
"Report-Msgid-Bugs-To: clemens.schwaighofer@egplusww.com\n"
|
||||||
|
"POT-Creation-Date: 2018-03-28 10:40+0900\n"
|
||||||
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
|
"Last-Translator: clemens.schwaighofer@egplusww.co\n"
|
||||||
|
"Language-Team: E-GRAPHICS COMMUNICATIONS Japan <info.jp@egplusww.com>\n"
|
||||||
|
"Language: ja\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2;\n"
|
||||||
|
# 0, 1, 2 plural
|
||||||
|
|
||||||
|
msgid "Original"
|
||||||
|
msgstr "Translated admin ja_JP"
|
||||||
|
|
||||||
|
msgid "single"
|
||||||
|
msgid_plural "multi"
|
||||||
|
msgstr[0] "Multi admin ja_JP 0"
|
||||||
|
msgstr[1] "Multi admin ja_JP 1"
|
||||||
|
msgstr[2] "Multi admin ja_JP 2"
|
||||||
|
|
||||||
|
msgctxt "context"
|
||||||
|
msgid "Original"
|
||||||
|
msgstr "Original context admin ja_JP"
|
||||||
|
|
||||||
|
msgctxt "context"
|
||||||
|
msgid "single"
|
||||||
|
msgid_plural "multi"
|
||||||
|
msgstr[0] "Multi context admin ja_JP 0"
|
||||||
|
msgstr[1] "Multi context admin ja_JP 1"
|
||||||
|
msgstr[2] "Multi context admin ja_JP 2"
|
||||||
35
4dev/tests/includes/locale/ja_JP-frontend.po
Normal file
35
4dev/tests/includes/locale/ja_JP-frontend.po
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: ja_JP.UTF-8 LC_MESSAGES frontend\n"
|
||||||
|
"Report-Msgid-Bugs-To: clemens.schwaighofer@egplusww.com\n"
|
||||||
|
"POT-Creation-Date: 2018-03-28 10:40+0900\n"
|
||||||
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
|
"Last-Translator: clemens.schwaighofer@egplusww.co\n"
|
||||||
|
"Language-Team: E-GRAPHICS COMMUNICATIONS Japan <info.jp@egplusww.com>\n"
|
||||||
|
"Language: ja\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2;\n"
|
||||||
|
# 0, 1, 2 plural
|
||||||
|
|
||||||
|
msgid "Original"
|
||||||
|
msgstr "Translated frontend ja_JP"
|
||||||
|
|
||||||
|
msgid "single"
|
||||||
|
msgid_plural "multi"
|
||||||
|
msgstr[0] "Multi frontend ja_JP 0"
|
||||||
|
msgstr[1] "Multi frontend ja_JP 1"
|
||||||
|
msgstr[2] "Multi frontend ja_JP 2"
|
||||||
|
|
||||||
|
msgctxt "context"
|
||||||
|
msgid "Original"
|
||||||
|
msgstr "Original context frontend ja_JP"
|
||||||
|
|
||||||
|
msgctxt "context"
|
||||||
|
msgid "single"
|
||||||
|
msgid_plural "multi"
|
||||||
|
msgstr[0] "Multi context frontend ja_JP 0"
|
||||||
|
msgstr[1] "Multi context frontend ja_JP 1"
|
||||||
|
msgstr[2] "Multi context frontend ja_JP 2"
|
||||||
BIN
4dev/tests/includes/locale/ja_JP/LC_MESSAGES/admin.mo
Normal file
BIN
4dev/tests/includes/locale/ja_JP/LC_MESSAGES/admin.mo
Normal file
Binary file not shown.
BIN
4dev/tests/includes/locale/ja_JP/LC_MESSAGES/frontend.mo
Normal file
BIN
4dev/tests/includes/locale/ja_JP/LC_MESSAGES/frontend.mo
Normal file
Binary file not shown.
@@ -1,58 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace test;
|
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
|
||||||
|
|
||||||
final class TemplateMethodsTest extends TestCase
|
|
||||||
{
|
|
||||||
public static function setUpBeforeClass(): void
|
|
||||||
{
|
|
||||||
fwrite(STDOUT, __METHOD__ . "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
fwrite(STDOUT, __METHOD__ . "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function assertPreConditions(): void
|
|
||||||
{
|
|
||||||
fwrite(STDOUT, __METHOD__ . "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testOne(): void
|
|
||||||
{
|
|
||||||
fwrite(STDOUT, __METHOD__ . "\n");
|
|
||||||
$this->assertTrue(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testTwo(): void
|
|
||||||
{
|
|
||||||
fwrite(STDOUT, __METHOD__ . "\n");
|
|
||||||
$this->assertTrue(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function assertPostConditions(): void
|
|
||||||
{
|
|
||||||
fwrite(STDOUT, __METHOD__ . "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function tearDown(): void
|
|
||||||
{
|
|
||||||
fwrite(STDOUT, __METHOD__ . "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function tearDownAfterClass(): void
|
|
||||||
{
|
|
||||||
fwrite(STDOUT, __METHOD__ . "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function onNotSuccessfulTest(\Throwable $t): void
|
|
||||||
{
|
|
||||||
fwrite(STDOUT, __METHOD__ . "\n");
|
|
||||||
throw $t;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -44,9 +44,24 @@ $db = new CoreLibs\DB\IO(DB_CONFIG, $log);
|
|||||||
// login & page access check
|
// login & page access check
|
||||||
$login = new CoreLibs\ACL\Login($db, $log);
|
$login = new CoreLibs\ACL\Login($db, $log);
|
||||||
```
|
```
|
||||||
|
* update language class
|
||||||
|
```php
|
||||||
|
// pre auto detect language after login
|
||||||
|
$locale = \CoreLibs\Language\GetLocale::setLocale();
|
||||||
|
// set lang and pass to smarty/backend
|
||||||
|
$l10n = new \CoreLibs\Language\L10n(
|
||||||
|
$locale['locale'],
|
||||||
|
$locale['domain'],
|
||||||
|
$locale['path'],
|
||||||
|
);
|
||||||
|
```
|
||||||
|
* smarty needs language
|
||||||
|
```php
|
||||||
|
$smarty = new CoreLibs\Template\SmartyExtend($l10n, $locale);
|
||||||
|
```
|
||||||
* admin backend also needs logger
|
* admin backend also needs logger
|
||||||
```php
|
```php
|
||||||
$cms = new CoreLibs\Admin\Backend($db, $log);
|
$cms = new CoreLibs\Admin\Backend($db, $log, $l10n, $locale);
|
||||||
```
|
```
|
||||||
* update and `$cms` or similar calls so db is in `$cms->db->...` and log are in `$cms->log->...`
|
* update and `$cms` or similar calls so db is in `$cms->db->...` and log are in `$cms->log->...`
|
||||||
* update all `config.*.php` files where needed
|
* update all `config.*.php` files where needed
|
||||||
@@ -60,6 +75,12 @@ require BASE . LIB . 'autoloader.php';
|
|||||||
```
|
```
|
||||||
**UPDATE:**
|
**UPDATE:**
|
||||||
```php
|
```php
|
||||||
|
// po langs [DEPRECAED: use LOCALE]
|
||||||
|
define('LANG', 'lang' . DIRECTORY_SEPARATOR);
|
||||||
|
// po locale file
|
||||||
|
define('LOCALE', 'locale' . DIRECTORY_SEPARATOR);
|
||||||
|
```
|
||||||
|
```php
|
||||||
// SSL host name
|
// SSL host name
|
||||||
// define('SSL_HOST', $_ENV['SSL_HOST'] ?? '');
|
// define('SSL_HOST', $_ENV['SSL_HOST'] ?? '');
|
||||||
```
|
```
|
||||||
@@ -85,6 +106,13 @@ define('CONTENT_WIDTH', '100%');
|
|||||||
define('BASE_NAME', preg_replace('/[^A-Za-z0-9]/', '', $_ENV['BASE_NAME'] ?? ''));
|
define('BASE_NAME', preg_replace('/[^A-Za-z0-9]/', '', $_ENV['BASE_NAME'] ?? ''));
|
||||||
```
|
```
|
||||||
```php
|
```php
|
||||||
|
/************* LANGUAGE / ENCODING *******/
|
||||||
|
// default lang + encoding
|
||||||
|
define('DEFAULT_LOCALE', 'en_US.UTF-8');
|
||||||
|
// default web page encoding setting
|
||||||
|
define('DEFAULT_ENCODING', 'UTF-8');
|
||||||
|
```
|
||||||
|
```php
|
||||||
// BAIL ON MISSING DB CONFIG:
|
// BAIL ON MISSING DB CONFIG:
|
||||||
// we have either no db selction for this host but have db config entries
|
// we have either no db selction for this host but have db config entries
|
||||||
// or we have a db selection but no db config as array or empty
|
// or we have a db selection but no db config as array or empty
|
||||||
@@ -104,6 +132,10 @@ if (
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
```php
|
```php
|
||||||
|
// remove SITE_LANG
|
||||||
|
define('SITE_LOCALE', $SITE_CONFIG[HOST_NAME]['site_locale'] ?? DEFAULT_LOCALE);
|
||||||
|
define('SITE_ENCODING', $SITE_CONFIG[HOST_NAME]['site_encoding'] ?? DEFAULT_ENCODING);
|
||||||
|
```
|
||||||
```php
|
```php
|
||||||
/************* GENERAL PAGE TITLE ********/
|
/************* GENERAL PAGE TITLE ********/
|
||||||
define('G_TITLE', $_ENV['G_TITLE'] ?? '');
|
define('G_TITLE', $_ENV['G_TITLE'] ?? '');
|
||||||
@@ -118,6 +150,15 @@ In the config then
|
|||||||
```php
|
```php
|
||||||
'db_name' => $_ENV['DB_NAME.TEST'] ?? '',
|
'db_name' => $_ENV['DB_NAME.TEST'] ?? '',
|
||||||
```
|
```
|
||||||
|
* config.host.php update
|
||||||
|
must add site_locale (site_lang + site_encoding)
|
||||||
|
remove site_lang
|
||||||
|
```php
|
||||||
|
// lang + encoding
|
||||||
|
'site_locale' => 'en_US.UTF-8',
|
||||||
|
// site language
|
||||||
|
'site_encoding' => 'UTF-8',
|
||||||
|
```
|
||||||
* copy `layout/admin/javascript/edit.jq.js`
|
* copy `layout/admin/javascript/edit.jq.js`
|
||||||
* check other javacsript files if needed (`edit.jq.js`)
|
* check other javacsript files if needed (`edit.jq.js`)
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,72 @@
|
|||||||
parameters:
|
parameters:
|
||||||
ignoreErrors:
|
ignoreErrors:
|
||||||
-
|
-
|
||||||
message: "#^Parameter \\#1 \\$result of function pg_result_error expects resource, object\\|resource\\|true given\\.$#"
|
message: "#^Parameter \\#1 \\$connection of function pg_connection_busy expects PgSql\\\\Connection, object\\|resource given\\.$#"
|
||||||
|
count: 3
|
||||||
|
path: www/lib/CoreLibs/DB/SQL/PgSQL.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Parameter \\#1 \\$connection of function pg_connection_status expects PgSql\\\\Connection, object\\|resource given\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: www/lib/CoreLibs/DB/SQL/PgSQL.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Parameter \\#1 \\$connection of function pg_get_result expects PgSql\\\\Connection, object\\|resource given\\.$#"
|
||||||
|
count: 2
|
||||||
|
path: www/lib/CoreLibs/DB/SQL/PgSQL.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Parameter \\#1 \\$connection of function pg_meta_data expects PgSql\\\\Connection, object\\|resource given\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: www/lib/CoreLibs/DB/SQL/PgSQL.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Parameter \\#1 \\$connection of function pg_send_query expects PgSql\\\\Connection, object\\|resource given\\.$#"
|
||||||
|
count: 2
|
||||||
|
path: www/lib/CoreLibs/DB/SQL/PgSQL.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Parameter \\#1 \\$connection of function pg_socket expects PgSql\\\\Connection, object\\|resource given\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: www/lib/CoreLibs/DB/SQL/PgSQL.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Parameter \\#1 \\$connection of function pg_version expects PgSql\\\\Connection\\|null, object\\|resource given\\.$#"
|
||||||
|
count: 2
|
||||||
|
path: www/lib/CoreLibs/DB/SQL/PgSQL.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Parameter \\#1 \\$result of function pg_affected_rows expects PgSql\\\\Result, object\\|resource given\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: www/lib/CoreLibs/DB/SQL/PgSQL.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Parameter \\#1 \\$result of function pg_fetch_all expects PgSql\\\\Result, object\\|resource given\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: www/lib/CoreLibs/DB/SQL/PgSQL.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Parameter \\#1 \\$result of function pg_fetch_array expects PgSql\\\\Result, object\\|resource given\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: www/lib/CoreLibs/DB/SQL/PgSQL.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Parameter \\#1 \\$result of function pg_field_name expects PgSql\\\\Result, object\\|resource given\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: www/lib/CoreLibs/DB/SQL/PgSQL.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Parameter \\#1 \\$result of function pg_num_fields expects PgSql\\\\Result, object\\|resource given\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: www/lib/CoreLibs/DB/SQL/PgSQL.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Parameter \\#1 \\$result of function pg_num_rows expects PgSql\\\\Result, object\\|resource given\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: www/lib/CoreLibs/DB/SQL/PgSQL.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Parameter \\#1 \\$result of function pg_result_error expects PgSql\\\\Result, object\\|resource given\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
path: www/lib/CoreLibs/DB/SQL/PgSQL.php
|
path: www/lib/CoreLibs/DB/SQL/PgSQL.php
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
// sets the _SERVER['HTTP_HOST'] var so we can have DB detection
|
// sets the _SERVER['HTTP_HOST'] var so we can have DB detection
|
||||||
$_SERVER['HTTP_HOST'] = 'soba.tokyo.tequila.jp';
|
$_SERVER['HTTP_HOST'] = 'soba.tokyo.tequila.jp';
|
||||||
// so www/includes/edit_base.php works
|
// so www/includes/edit_base.php works
|
||||||
require_once('www/lib/Smarty/SmartyBC.class.php');
|
// require_once('www/lib/Smarty/SmartyBC.class.php');
|
||||||
// for whatever reason it does not load that from the confing.master.php
|
// for whatever reason it does not load that from the confing.master.php
|
||||||
// for includes/admin_header.php
|
// for includes/admin_header.php
|
||||||
define('BASE_NAME', '');
|
define('BASE_NAME', '');
|
||||||
|
|||||||
12
phpstan.neon
12
phpstan.neon
@@ -24,7 +24,9 @@ parameters:
|
|||||||
# do not check old qq file uploader tests
|
# do not check old qq file uploader tests
|
||||||
- www/admin/qq_file_upload_*.php
|
- www/admin/qq_file_upload_*.php
|
||||||
# ignore all test files
|
# ignore all test files
|
||||||
- www/admin/class_test*php
|
- www/admin/class_test*.php
|
||||||
|
# extra in sub folder
|
||||||
|
- www/admin/subfolder/class_test*.php
|
||||||
- www/admin/error_test.php
|
- www/admin/error_test.php
|
||||||
# admin synlink files
|
# admin synlink files
|
||||||
- www/admin/edit_*.php
|
- www/admin/edit_*.php
|
||||||
@@ -45,14 +47,14 @@ parameters:
|
|||||||
- www/lib/smarty-*/
|
- www/lib/smarty-*/
|
||||||
# ignore composer
|
# ignore composer
|
||||||
- www/vendor
|
- www/vendor
|
||||||
# temp ignore smarty 4
|
|
||||||
- www/lib/CoreLibs/Template/SmartyExtend4.php
|
|
||||||
- www/admin/class_test.smarty4.php
|
|
||||||
# ignore errores with
|
# ignore errores with
|
||||||
ignoreErrors:
|
ignoreErrors:
|
||||||
- # this error is ignore because of the PHP 8.0 to 8.1 change for pg_*
|
- # this error is ignore because of the PHP 8.0 to 8.1 change for pg_*, only for 8.0 or lower
|
||||||
message: "#^Parameter \\#1 \\$(result|connection) of function pg_\\w+ expects resource(\\|null)?, object\\|resource(\\|bool)? given\\.$#"
|
message: "#^Parameter \\#1 \\$(result|connection) of function pg_\\w+ expects resource(\\|null)?, object\\|resource(\\|bool)? given\\.$#"
|
||||||
path: %currentWorkingDirectory%/www/lib/CoreLibs/DB/SQL/PgSQL.php
|
path: %currentWorkingDirectory%/www/lib/CoreLibs/DB/SQL/PgSQL.php
|
||||||
|
- # this is for 8.1 or newer
|
||||||
|
message: "#^Parameter \\#1 \\$(result|connection) of function pg_\\w+ expects PgSql\\\\(Result|Connection(\\|null)?), object\\|resource given\\.$#"
|
||||||
|
path: %currentWorkingDirectory%/www/lib/CoreLibs/DB/SQL/PgSQL.php
|
||||||
# this is ignored for now
|
# this is ignored for now
|
||||||
# - '#Expression in empty\(\) is always falsy.#'
|
# - '#Expression in empty\(\) is always falsy.#'
|
||||||
# -
|
# -
|
||||||
|
|||||||
@@ -43,18 +43,25 @@ $log = new CoreLibs\Debug\Logging([
|
|||||||
]);
|
]);
|
||||||
// db config with logger
|
// db config with logger
|
||||||
$db = new CoreLibs\DB\IO(DB_CONFIG, $log);
|
$db = new CoreLibs\DB\IO(DB_CONFIG, $log);
|
||||||
$backend = new CoreLibs\Admin\Backend($db, $log);
|
$locale = \CoreLibs\Language\GetLocale::setLocale();
|
||||||
|
$l10n = new \CoreLibs\Language\L10n(
|
||||||
|
$locale['locale'],
|
||||||
|
$locale['domain'],
|
||||||
|
$locale['path'],
|
||||||
|
);
|
||||||
|
$backend = new CoreLibs\Admin\Backend($db, $log, $l10n, $locale);
|
||||||
|
|
||||||
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>TEST CLASS: ADMIN BACKEND</title><head>";
|
print "<html><head><title>TEST CLASS: ADMIN BACKEND</title><head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
|
|
||||||
// set acl, from eg login acl
|
// set acl, from eg login acl
|
||||||
print "SETACL[]: " . $backend->setACL([]) . "<br>";
|
print "SETACL[]: " . $backend->setACL(['EMPTY' => 'EMPTY']) . "<br>";
|
||||||
print "ADBEDITLOG: " . $backend->adbEditLog('CLASSTEST-ADMIN', 'Some info stirng') . "<br>";
|
print "ADBEDITLOG: " . $backend->adbEditLog('CLASSTEST-ADMIN', 'Some info stirng') . "<br>";
|
||||||
print "ADBTOPMENU(0): " . \CoreLibs\Debug\Support::printAr($backend->adbTopMenu()) . "<br>";
|
print "ADBTOPMENU(0): " . \CoreLibs\Debug\Support::printAr($backend->adbTopMenu()) . "<br>";
|
||||||
print "ADBMSG: " . $backend->adbMsg('info', 'Message: %1$d', [1]) . "<br>";
|
print "ADBMSG: " . $backend->adbMsg('info', 'Message: %1$d', [1]) . "<br>";
|
||||||
print "Messaes: " . \CoreLibs\Debug\Support::printAr($this->messages) . "<br>";
|
print "Messaes: " . \CoreLibs\Debug\Support::printAr($backend->messages) . "<br>";
|
||||||
print "ADBPRINTDATETIME:<br>" . $backend->adbPrintDateTime(2021, 6, 21, 6, 38, '_test') . "<br>";
|
print "ADBPRINTDATETIME:<br>" . $backend->adbPrintDateTime(2021, 6, 21, 6, 38, '_test') . "<br>";
|
||||||
|
|
||||||
// error message
|
// error message
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ $log = new CoreLibs\Debug\Logging([
|
|||||||
// $_array = new CoreLibs\Combined\ArrayHandler();
|
// $_array = new CoreLibs\Combined\ArrayHandler();
|
||||||
// $array_class = 'CoreLibs\Combination\ArrayHandler';
|
// $array_class = 'CoreLibs\Combination\ArrayHandler';
|
||||||
|
|
||||||
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>TEST CLASS: ARRAY HANDLER</title><head>";
|
print "<html><head><title>TEST CLASS: ARRAY HANDLER</title><head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ ob_end_flush();
|
|||||||
|
|
||||||
use CoreLibs\Convert\Byte;
|
use CoreLibs\Convert\Byte;
|
||||||
|
|
||||||
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>TEST CLASS: AUTOLOADER</title><head>";
|
print "<html><head><title>TEST CLASS: AUTOLOADER</title><head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ $log = new CoreLibs\Debug\Logging([
|
|||||||
]);
|
]);
|
||||||
$byte_class = 'CoreLibs\Convert\Byte';
|
$byte_class = 'CoreLibs\Convert\Byte';
|
||||||
|
|
||||||
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>TEST CLASS: BYTE CONVERT</title><head>";
|
print "<html><head><title>TEST CLASS: BYTE CONVERT</title><head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ $log = new CoreLibs\Debug\Logging([
|
|||||||
]);
|
]);
|
||||||
$color_class = 'CoreLibs\Convert\Colors';
|
$color_class = 'CoreLibs\Convert\Colors';
|
||||||
|
|
||||||
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>TEST CLASS: COLORS</title><head>";
|
print "<html><head><title>TEST CLASS: COLORS</title><head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
@@ -57,6 +58,7 @@ print "\$C::S/COLOR invalid rgb->hex (gray 125): -1, -1, -1: " . $color_class::r
|
|||||||
$rgb = [10, 20, 30];
|
$rgb = [10, 20, 30];
|
||||||
$hex = '#0a141e';
|
$hex = '#0a141e';
|
||||||
$hsb = [210, 67, 12];
|
$hsb = [210, 67, 12];
|
||||||
|
$hsb_f = [210.5, 67.5, 12.5];
|
||||||
$hsl = [210, 50, 7.8];
|
$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 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 "S::COLOR hex->rgb: $hex: " . DgS::printAr(Colors::hex2rgb($hex)) . "<br>";
|
||||||
@@ -69,6 +71,8 @@ print "S::COLOR rgb->hsl: $rgb[0], $rgb[1], $rgb[2]: "
|
|||||||
// D(from hsb/hsl) Note that param 2 + 3 is always 0-100 divided
|
// 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]: "
|
print "S::COLOR hsb->rgb: $hsb[0], $hsb[1], $hsb[2]: "
|
||||||
. DgS::printAr(Colors::hsb2rgb($hsb[0], $hsb[1], $hsb[2])) . "<br>";
|
. 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>";
|
||||||
print "S::COLOR hsl->rgb: $hsl[0], $hsl[1], $hsl[2]: "
|
print "S::COLOR hsl->rgb: $hsl[0], $hsl[1], $hsl[2]: "
|
||||||
. DgS::printAr(Colors::hsl2rgb($hsl[0], $hsl[1], $hsl[2])) . "<br>";
|
. DgS::printAr(Colors::hsl2rgb($hsl[0], $hsl[1], $hsl[2])) . "<br>";
|
||||||
|
|
||||||
@@ -76,6 +80,15 @@ $hsb = [0, 0, 5];
|
|||||||
print "S::COLOR hsb->rgb: $hsb[0], $hsb[1], $hsb[2]: "
|
print "S::COLOR hsb->rgb: $hsb[0], $hsb[1], $hsb[2]: "
|
||||||
. DgS::printAr(Colors::hsb2rgb($hsb[0], $hsb[1], $hsb[2])) . "<br>";
|
. DgS::printAr(Colors::hsb2rgb($hsb[0], $hsb[1], $hsb[2])) . "<br>";
|
||||||
|
|
||||||
|
// Random text
|
||||||
|
$h = rand(0, 359);
|
||||||
|
$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>";
|
||||||
|
|
||||||
// TODO: run compare check input must match output
|
// TODO: run compare check input must match output
|
||||||
|
|
||||||
// error message
|
// error message
|
||||||
|
|||||||
58
www/admin/class_test.config.direct.php
Normal file
58
www/admin/class_test.config.direct.php
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
<?php // phpcs:ignore warning
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
||||||
|
*/
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
// basic class test file
|
||||||
|
define('USE_DATABASE', false);
|
||||||
|
// sample config
|
||||||
|
require '../configs/config.php';
|
||||||
|
// define log file id
|
||||||
|
$LOG_FILE_ID = 'classTest-config-direct';
|
||||||
|
ob_end_flush();
|
||||||
|
|
||||||
|
$log = new CoreLibs\Debug\Logging([
|
||||||
|
'log_folder' => BASE . LOG,
|
||||||
|
'file_id' => $LOG_FILE_ID,
|
||||||
|
// 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,
|
||||||
|
]);
|
||||||
|
|
||||||
|
print "<!DOCTYPE html>";
|
||||||
|
print "<html><head><title>TEST CLASS: CONFIG DIRECT</title><head>";
|
||||||
|
print "<body>";
|
||||||
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
|
print '<div><b>CONFIG DIRECT</b></div>';
|
||||||
|
|
||||||
|
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>";
|
||||||
|
print "DB Name: " . DB_CONFIG_NAME . "<br>";
|
||||||
|
print "DB Config: " . \CoreLibs\Debug\Support::printAr(DB_CONFIG) . "<br>";
|
||||||
|
|
||||||
|
// error message
|
||||||
|
print $log->printErrorMsg();
|
||||||
|
|
||||||
|
print "</body></html>";
|
||||||
|
|
||||||
|
// __END__
|
||||||
58
www/admin/class_test.config.link.php
Normal file
58
www/admin/class_test.config.link.php
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
<?php // phpcs:ignore warning
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
||||||
|
*/
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
// basic class test file
|
||||||
|
define('USE_DATABASE', false);
|
||||||
|
// sample config
|
||||||
|
require 'config.php';
|
||||||
|
// define log file id
|
||||||
|
$LOG_FILE_ID = 'classTest-config-link';
|
||||||
|
ob_end_flush();
|
||||||
|
|
||||||
|
$log = new CoreLibs\Debug\Logging([
|
||||||
|
'log_folder' => BASE . LOG,
|
||||||
|
'file_id' => $LOG_FILE_ID,
|
||||||
|
// 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,
|
||||||
|
]);
|
||||||
|
|
||||||
|
print "<!DOCTYPE html>";
|
||||||
|
print "<html><head><title>TEST CLASS: CONFIG LINK</title><head>";
|
||||||
|
print "<body>";
|
||||||
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
|
print '<div><b>CONFIG LINK</b></div>';
|
||||||
|
|
||||||
|
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>";
|
||||||
|
print "DB Name: " . DB_CONFIG_NAME . "<br>";
|
||||||
|
print "DB Config: " . \CoreLibs\Debug\Support::printAr(DB_CONFIG) . "<br>";
|
||||||
|
|
||||||
|
// error message
|
||||||
|
print $log->printErrorMsg();
|
||||||
|
|
||||||
|
print "</body></html>";
|
||||||
|
|
||||||
|
// __END__
|
||||||
@@ -44,6 +44,7 @@ $log = new CoreLibs\Debug\Logging([
|
|||||||
]);
|
]);
|
||||||
$datetime_class = 'CoreLibs\Combined\DateTime';
|
$datetime_class = 'CoreLibs\Combined\DateTime';
|
||||||
|
|
||||||
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>TEST CLASS: DATE/TIME</title><head>";
|
print "<html><head><title>TEST CLASS: DATE/TIME</title><head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ $log = new CoreLibs\Debug\Logging([
|
|||||||
$db = new CoreLibs\DB\IO(DB_CONFIG, $log);
|
$db = new CoreLibs\DB\IO(DB_CONFIG, $log);
|
||||||
$db->log->debug('START', '=============================>');
|
$db->log->debug('START', '=============================>');
|
||||||
|
|
||||||
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>TEST CLASS: DB</title><head>";
|
print "<html><head><title>TEST CLASS: DB</title><head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ $debug = new CoreLibs\Debug\Logging([
|
|||||||
$debug_support_class = 'CoreLibs\Debug\Support';
|
$debug_support_class = 'CoreLibs\Debug\Support';
|
||||||
$debug_logging_class = 'CoreLibs\Debug\Logging';
|
$debug_logging_class = 'CoreLibs\Debug\Logging';
|
||||||
|
|
||||||
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>TEST CLASS: DEBUG</title><head>";
|
print "<html><head><title>TEST CLASS: DEBUG</title><head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
@@ -67,6 +68,9 @@ print "S::DEBUSTRING(s): " . DebugSupport::debugString('SET') . "<br>";
|
|||||||
print "S::DEBUSTRING(''): " . DebugSupport::debugString('') . "<br>";
|
print "S::DEBUSTRING(''): " . DebugSupport::debugString('') . "<br>";
|
||||||
print "S::DEBUSTRING(,s): " . DebugSupport::debugString(null, '{-}') . "<br>";
|
print "S::DEBUSTRING(,s): " . DebugSupport::debugString(null, '{-}') . "<br>";
|
||||||
|
|
||||||
|
// get test
|
||||||
|
print "LOG FOLDER: " . $debug->getSetting('log_folder') . "<br>";
|
||||||
|
|
||||||
// debug
|
// debug
|
||||||
print "C->DEBUG: " . $debug->debug('CLASS-TEST-DEBUG', 'Class Test Debug') . "<br>";
|
print "C->DEBUG: " . $debug->debug('CLASS-TEST-DEBUG', 'Class Test Debug') . "<br>";
|
||||||
print "C->DEBUG(html): " . $debug->debug('CLASS-TEST-DEBUG', 'HTML TAG<br><b>BOLD</b>') . "<br>";
|
print "C->DEBUG(html): " . $debug->debug('CLASS-TEST-DEBUG', 'HTML TAG<br><b>BOLD</b>') . "<br>";
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ $log = new CoreLibs\Debug\Logging([
|
|||||||
'print_all' => $PRINT_ALL ?? false,
|
'print_all' => $PRINT_ALL ?? false,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>TEST CLASS: HTML/ELEMENTS</title><head>";
|
print "<html><head><title>TEST CLASS: HTML/ELEMENTS</title><head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
|
|||||||
@@ -29,7 +29,9 @@ if (!defined('SET_SESSION_NAME')) {
|
|||||||
$LOG_FILE_ID = 'classTest-encoding';
|
$LOG_FILE_ID = 'classTest-encoding';
|
||||||
ob_end_flush();
|
ob_end_flush();
|
||||||
|
|
||||||
use CoreLibs\Language\Encoding;
|
use CoreLibs\Convert\Encoding as ConEnc;
|
||||||
|
use CoreLibs\Check\Encoding as ChkEnc;
|
||||||
|
use CoreLibs\Convert\MimeEncode;
|
||||||
|
|
||||||
$log = new CoreLibs\Debug\Logging([
|
$log = new CoreLibs\Debug\Logging([
|
||||||
'log_folder' => BASE . LOG,
|
'log_folder' => BASE . LOG,
|
||||||
@@ -41,10 +43,13 @@ $log = new CoreLibs\Debug\Logging([
|
|||||||
'echo_all' => $ECHO_ALL ?? false,
|
'echo_all' => $ECHO_ALL ?? false,
|
||||||
'print_all' => $PRINT_ALL ?? false,
|
'print_all' => $PRINT_ALL ?? false,
|
||||||
]);
|
]);
|
||||||
$_encoding = new CoreLibs\Language\Encoding();
|
// class type
|
||||||
$encoding_class = 'CoreLibs\Language\Encoding';
|
$_chk_enc = new CoreLibs\Check\Encoding();
|
||||||
|
$_con_enc = new CoreLibs\Convert\Encoding();
|
||||||
|
$chk_enc = 'CoreLibs\Check\Encoding';
|
||||||
|
|
||||||
print "<html><head><title>TEST CLASS: ENCODING</title><head>";
|
print "<!DOCTYPE html>";
|
||||||
|
print "<html><head><title>TEST CLASS: ENCODING (CHECK/CONVERT/MIME)</title><head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
|
|
||||||
@@ -58,41 +63,47 @@ $mime_encodes = [
|
|||||||
['日本語ながい日本語ながい日本語ながい日本語ながい日本語ながい日本語ながい日本語ながい', 'ISO-2022-JP-MS'],
|
['日本語ながい日本語ながい日本語ながい日本語ながい日本語ながい日本語ながい日本語ながい', 'ISO-2022-JP-MS'],
|
||||||
];
|
];
|
||||||
foreach ($mime_encodes as $mime_encode) {
|
foreach ($mime_encodes as $mime_encode) {
|
||||||
print "__MBMIMEENCODE: $mime_encode[0]: " . Encoding::__mbMimeEncode($mime_encode[0], $mime_encode[1]) . "<br>";
|
print "__MBMIMEENCODE: $mime_encode[0]: " . MimeEncode::__mbMimeEncode($mime_encode[0], $mime_encode[1]) . "<br>";
|
||||||
}
|
}
|
||||||
|
echo "<br>";
|
||||||
|
|
||||||
$enc_strings = [
|
$enc_strings = [
|
||||||
'Normal Text',
|
'Normal Text',
|
||||||
'日本語',
|
'日本語',
|
||||||
|
// bad
|
||||||
|
'❶',
|
||||||
// unworkable
|
// unworkable
|
||||||
''
|
''
|
||||||
];
|
];
|
||||||
// class
|
// class
|
||||||
$_encoding->setErrorChar('∴');
|
$_chk_enc->setErrorChar(0x2234);
|
||||||
|
$_chk_enc->setErrorChar('∴');
|
||||||
|
print "ERROR CHAR: " . $_chk_enc->getErrorChar() . "<br>";
|
||||||
foreach ($enc_strings as $_string) {
|
foreach ($enc_strings as $_string) {
|
||||||
$string = $_encoding->checkConvertEncoding($_string, 'UTF-8', 'ISO-2022-JP-MS');
|
$string = $_chk_enc->checkConvertEncoding($_string, 'UTF-8', 'ISO-2022-JP-MS');
|
||||||
print "ENC CHECK: $_string: " . ($string === false ? '-OK-' : $string) . "<br>";
|
print "ENC CHECK: $_string: " . ($string === false ? '<b>-OK-</b>' : print_r($string, true)) . "<br>";
|
||||||
print "CONV ENCODING: $_string: " . $_encoding->convertEncoding($_string, 'ISO-2022-JP') . "<br>";
|
print "CONV ENCODING: $_string: " . $_con_enc->convertEncoding($_string, 'ISO-2022-JP') . "<br>";
|
||||||
print "CONV ENCODING (s): $_string: " . $_encoding->convertEncoding($_string, 'ISO-2022-JP', 'UTF-8') . "<br>";
|
print "CONV ENCODING (s): $_string: " . $_con_enc->convertEncoding($_string, 'ISO-2022-JP', 'UTF-8') . "<br>";
|
||||||
print "CONV ENCODING (s,a-false): $_string: "
|
print "CONV ENCODING (s,a-false): $_string: "
|
||||||
. $_encoding->convertEncoding($_string, 'ISO-2022-JP', 'UTF-8', false) . "<br>";
|
. $_con_enc->convertEncoding($_string, 'ISO-2022-JP', 'UTF-8', false) . "<br>";
|
||||||
}
|
}
|
||||||
print "ERROR CHAR: " . $_encoding->getErrorChar() . "<br>";
|
echo "<br>";
|
||||||
// static
|
// static
|
||||||
$encoding_class::setErrorChar('∴');
|
// ChkEnc::setErrorChar('∴');
|
||||||
|
ChkEnc::setErrorChar(0x2234);
|
||||||
|
print "S::ERROR CHAR: " . ChkEnc::getErrorChar() . "<br>";
|
||||||
foreach ($enc_strings as $_string) {
|
foreach ($enc_strings as $_string) {
|
||||||
$string = $encoding_class::checkConvertEncoding($_string, 'UTF-8', 'ISO-2022-JP-MS');
|
$string = ChkEnc::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 ? '<b>-OK-</b>' : print_r($string, true)) . "<br>";
|
||||||
print "S::CONV ENCODING: $_string: " . $encoding_class::convertEncoding($_string, 'ISO-2022-JP') . "<br>";
|
print "S::CONV ENCODING: $_string: " . ConEnc::convertEncoding($_string, 'ISO-2022-JP') . "<br>";
|
||||||
print "S::CONV ENCODING (s): $_string: "
|
print "S::CONV ENCODING (s): $_string: "
|
||||||
. $encoding_class::convertEncoding($_string, 'ISO-2022-JP', 'UTF-8') . "<br>";
|
. ConEnc::convertEncoding($_string, 'ISO-2022-JP', 'UTF-8') . "<br>";
|
||||||
print "S::CONV ENCODING (s,a-false): $_string: "
|
print "S::CONV ENCODING (s,a-false): $_string: "
|
||||||
. $encoding_class::convertEncoding($_string, 'ISO-2022-JP', 'UTF-8', false) . "<br>";
|
. ConEnc::convertEncoding($_string, 'ISO-2022-JP', 'UTF-8', false) . "<br>";
|
||||||
}
|
}
|
||||||
print "S::ERROR CHAR: " . $encoding_class::getErrorChar() . "<br>";
|
|
||||||
// static use
|
// static use
|
||||||
$_string = $enc_strings[1];
|
$_string = $enc_strings[1];
|
||||||
$string = Encoding::checkConvertEncoding($_string, 'UTF-8', 'ISO-2022-JP-MS');
|
$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-' : $string) . "<br>";
|
||||||
|
|
||||||
// error message
|
// error message
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ $log = new CoreLibs\Debug\Logging([
|
|||||||
'print_all' => $PRINT_ALL ?? false,
|
'print_all' => $PRINT_ALL ?? false,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>TEST CLASS: FILE</title><head>";
|
print "<html><head><title>TEST CLASS: FILE</title><head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ $hash_class = 'CoreLibs\Create\Hash';
|
|||||||
|
|
||||||
// define a list of from to color sets for conversion test
|
// define a list of from to color sets for conversion test
|
||||||
|
|
||||||
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>TEST CLASS: HASH</title><head>";
|
print "<html><head><title>TEST CLASS: HASH</title><head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ $elements_class = 'CoreLibs\Output\Form\Elements';
|
|||||||
|
|
||||||
// define a list of from to color sets for conversion test
|
// define a list of from to color sets for conversion test
|
||||||
|
|
||||||
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>TEST CLASS: HTML/ELEMENTS</title><head>";
|
print "<html><head><title>TEST CLASS: HTML/ELEMENTS</title><head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ $image_class = 'CoreLibs\Output\Image';
|
|||||||
|
|
||||||
// define a list of from to color sets for conversion test
|
// define a list of from to color sets for conversion test
|
||||||
|
|
||||||
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>TEST CLASS: IMAGE</title><head>";
|
print "<html><head><title>TEST CLASS: IMAGE</title><head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ $json_class = 'CoreLibs\Convert\Json';
|
|||||||
|
|
||||||
// define a list of from to color sets for conversion test
|
// define a list of from to color sets for conversion test
|
||||||
|
|
||||||
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>TEST CLASS: JSON</title><head>";
|
print "<html><head><title>TEST CLASS: JSON</title><head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
|
|||||||
@@ -19,8 +19,6 @@ ob_start();
|
|||||||
|
|
||||||
// basic class test file
|
// basic class test file
|
||||||
define('USE_DATABASE', false);
|
define('USE_DATABASE', false);
|
||||||
// init language
|
|
||||||
$lang = 'en_utf8';
|
|
||||||
// sample config
|
// sample config
|
||||||
require 'config.php';
|
require 'config.php';
|
||||||
// set session name
|
// set session name
|
||||||
@@ -29,28 +27,158 @@ if (!defined('SET_SESSION_NAME')) {
|
|||||||
}
|
}
|
||||||
// define log file id
|
// define log file id
|
||||||
$LOG_FILE_ID = 'classTest-lang';
|
$LOG_FILE_ID = 'classTest-lang';
|
||||||
|
|
||||||
$l = new CoreLibs\Language\L10n($lang);
|
|
||||||
ob_end_flush();
|
ob_end_flush();
|
||||||
|
|
||||||
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>TEST CLASS: LANG</title><head>";
|
print "<html><head><title>TEST CLASS: LANG</title><head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
|
|
||||||
|
use CoreLibs\Language\L10n;
|
||||||
|
use CoreLibs\Debug\Support;
|
||||||
|
|
||||||
|
echo "<br><b>LIST LOCALES</b><br>";
|
||||||
|
|
||||||
|
$locale = 'en_US.UTF-8';
|
||||||
|
$locales = CoreLibs\Language\L10n::listLocales($locale);
|
||||||
|
print "[" . $locale . "] LOCALES: " . Support::printAr($locales) . "<br>";
|
||||||
|
$locale = 'en.UTF-8';
|
||||||
|
$locales = CoreLibs\Language\L10n::listLocales($locale);
|
||||||
|
print "[" . $locale . "] LOCALES: " . Support::printAr($locales) . "<br>";
|
||||||
|
|
||||||
|
echo "<br><b>LOCALE INFO</b><br>";
|
||||||
|
$locale = 'en_US.UTF-8';
|
||||||
|
$locale_info = CoreLibs\Language\L10n::parseLocale($locale);
|
||||||
|
print "[" . $locale . "] INFO: " . Support::printAr($locale_info) . "<br>";
|
||||||
|
$locale = 'en.UTF-8';
|
||||||
|
$locale_info = CoreLibs\Language\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');
|
||||||
|
print "[OVERRIDE]: " . Support::printAr($get_locale) . "<br>";
|
||||||
|
|
||||||
|
// try to load non existing
|
||||||
|
echo "<br><b>NEW TYPE</b><br>";
|
||||||
|
// translate string
|
||||||
$string = 'INPUT TEST';
|
$string = 'INPUT TEST';
|
||||||
|
// new path test
|
||||||
echo "LANGUAGE SET: " . $l->__getLang() . "<br>";
|
$lang = 'ja';
|
||||||
echo "LANGUAGE FILE: " . $l->__getMoFile() . "<br>";
|
$domain = 'admin';
|
||||||
|
$encoding = 'UTF-8';
|
||||||
|
$path = BASE . INCLUDES . LOCALE;
|
||||||
|
// load direct
|
||||||
|
$l = new CoreLibs\Language\L10n($lang, $domain, $path);
|
||||||
|
echo "*<br>";
|
||||||
|
echo "LANGUAGE WANT/SET: " . $lang . '/' . $l->getLocale() . "<br>";
|
||||||
|
echo "DOMAIN WANT/SET: " . $domain . '/' . $l->getDomain() . "<br>";
|
||||||
|
echo "LANGUAGE FILE: " . $l->getMoFile() . "<br>";
|
||||||
|
echo "CONTENT PATH: " . $l->getBaseContentPath() . "<br>";
|
||||||
|
echo "DOMAIN PATH: " . $l->getTextDomain($domain) . "<br>";
|
||||||
|
echo "BASE PATH: " . $l->getBaseLocalePath() . "<br>";
|
||||||
|
echo "LOAD ERROR: " . $l->getLoadError() . "<br>";
|
||||||
echo "INPUT TEST: " . $string . " => " . $l->__($string) . "<br>";
|
echo "INPUT TEST: " . $string . " => " . $l->__($string) . "<br>";
|
||||||
|
echo "TROUGH LOAD: " . $l->getTranslatorClass()->gettext($string) . "<br>";
|
||||||
// switch to other language
|
$single_string = 'single';
|
||||||
$lang = 'ja_utf8';
|
$multi_string = 'multi';
|
||||||
$l->l10nReloadMOfile($lang);
|
for ($n = 0; $n <= 3; $n++) {
|
||||||
|
echo "MULTI TEST $n: " . $single_string . "/" . $multi_string . " => "
|
||||||
echo "LANGUAGE SET: " . $l->__getLang() . "<br>";
|
. $l->__n($single_string, $multi_string, $n) . "<br>";
|
||||||
echo "LANGUAGE FILE: " . $l->__getMoFile() . "<br>";
|
}
|
||||||
|
$context = "month name";
|
||||||
|
$context_string = "May";
|
||||||
|
echo "CONTEXT TRANSLATION: " . $context_string . " => " . $l->__p($context, $context_string) . "<br>";
|
||||||
|
$single_string = 'single';
|
||||||
|
$multi_string = 'multi';
|
||||||
|
for ($n = 0; $n <= 3; $n++) {
|
||||||
|
echo "CONTEXT MULTI TEST $n: " . $single_string . "/" . $multi_string . " => "
|
||||||
|
. $l->__np($context, $single_string, $multi_string, $n) . "<br>";
|
||||||
|
}
|
||||||
|
// change domain
|
||||||
|
$domain = 'frontend';
|
||||||
|
$l->getTranslator('', $domain, $path);
|
||||||
|
echo "*<br>";
|
||||||
|
echo "LANGUAGE WANT/SET: " . $lang . '/' . $l->getLocale() . "<br>";
|
||||||
|
echo "DOMAIN WANT/SET: " . $domain . '/' . $l->getDomain() . "<br>";
|
||||||
|
echo "LANGUAGE FILE: " . $l->getMoFile() . "<br>";
|
||||||
|
echo "CONTENT PATH: " . $l->getBaseContentPath() . "<br>";
|
||||||
|
echo "DOMAIN PATH: " . $l->getTextDomain($domain) . "<br>";
|
||||||
|
echo "BASE PATH: " . $l->getBaseLocalePath() . "<br>";
|
||||||
|
echo "LOAD ERROR: " . $l->getLoadError() . "<br>";
|
||||||
echo "INPUT TEST: " . $string . " => " . $l->__($string) . "<br>";
|
echo "INPUT TEST: " . $string . " => " . $l->__($string) . "<br>";
|
||||||
// TODO: run compare check input must match output
|
echo "TROUGH LOAD: " . $l->getTranslatorClass()->gettext($string) . "<br>";
|
||||||
|
// change language short type
|
||||||
|
$lang = 'en';
|
||||||
|
$domain = 'admin';
|
||||||
|
$l->getTranslator($lang, $domain, $path);
|
||||||
|
echo "*<br>";
|
||||||
|
echo "LANGUAGE WANT/SET: " . $lang . '/' . $l->getLocale() . "<br>";
|
||||||
|
echo "DOMAIN WANT/SET: " . $domain . '/' . $l->getDomain() . "<br>";
|
||||||
|
echo "LANGUAGE FILE: " . $l->getMoFile() . "<br>";
|
||||||
|
echo "CONTENT PATH: " . $l->getBaseContentPath() . "<br>";
|
||||||
|
echo "DOMAIN PATH: " . $l->getTextDomain($domain) . "<br>";
|
||||||
|
echo "BASE PATH: " . $l->getBaseLocalePath() . "<br>";
|
||||||
|
echo "LOAD ERROR: " . $l->getLoadError() . "<br>";
|
||||||
|
echo "INPUT TEST: " . $string . " => " . $l->__($string) . "<br>";
|
||||||
|
echo "TROUGH LOAD: " . $l->getTranslatorClass()->gettext($string) . "<br>";
|
||||||
|
// chang to wrong language
|
||||||
|
$lang = 'tr';
|
||||||
|
$l->getTranslator($lang, $domain, $path);
|
||||||
|
echo "*<br>";
|
||||||
|
echo "LANGUAGE WANT/SET: " . $lang . '/' . $l->getLocale() . "<br>";
|
||||||
|
echo "DOMAIN WANT/SET: " . $domain . '/' . $l->getDomain() . "<br>";
|
||||||
|
echo "LANGUAGE FILE: " . $l->getMoFile() . "<br>";
|
||||||
|
echo "CONTENT PATH: " . $l->getBaseContentPath() . "<br>";
|
||||||
|
echo "DOMAIN PATH: " . $l->getTextDomain($domain) . "<br>";
|
||||||
|
echo "BASE PATH: " . $l->getBaseLocalePath() . "<br>";
|
||||||
|
echo "LOAD ERROR: " . $l->getLoadError() . "<br>";
|
||||||
|
echo "INPUT TEST: " . $string . " => " . $l->__($string) . "<br>";
|
||||||
|
echo "TROUGH LOAD: " . $l->getTranslatorClass()->gettext($string) . "<br>";
|
||||||
|
|
||||||
|
$lang = 'en';
|
||||||
|
$domain = 'admin';
|
||||||
|
echo "<br><b>STATIC TYPE TEST</b><br>";
|
||||||
|
// static tests from l10n_load
|
||||||
|
L10n::getInstance()->setLocale($lang);
|
||||||
|
echo "SET LOCALE: " . L10n::getInstance()->getLocale() . "<br>";
|
||||||
|
L10n::getInstance()->setDomain($domain);
|
||||||
|
echo "SET DOMAIN: " . L10n::getInstance()->getDomain() . "<br>";
|
||||||
|
L10n::getInstance()->setTextDomain($domain, $path);
|
||||||
|
echo "SET TEXT DOMAIN: " . L10n::getInstance()->getTextDomain($domain) . "<br>";
|
||||||
|
// null call __bind_textdomain_codeset
|
||||||
|
echo "INPUT TEST: " . $string . " => " . L10n::getInstance()->getTranslator()->gettext($string) . "<br>";
|
||||||
|
|
||||||
|
echo "<br><b>FUNCTIONS</b><br>";
|
||||||
|
// real statisc test
|
||||||
|
L10n::loadFunctions();
|
||||||
|
$locale = 'ja';
|
||||||
|
_setlocale(LC_MESSAGES, $locale);
|
||||||
|
_textdomain($domain);
|
||||||
|
_bindtextdomain($domain, $path);
|
||||||
|
_bind_textdomain_codeset($domain, $encoding);
|
||||||
|
echo "INPUT TEST $locale: " . $string . " => " . __($string) . "<br>";
|
||||||
|
$single_string = 'single';
|
||||||
|
$multi_string = 'multi';
|
||||||
|
for ($n = 0; $n <= 3; $n++) {
|
||||||
|
echo "MULTI TEST $n: " . $single_string . "/" . $multi_string . " => "
|
||||||
|
. _ngettext($single_string, $multi_string, $n) . "<br>";
|
||||||
|
}
|
||||||
|
|
||||||
|
$locale = 'en_US.UTF-8';
|
||||||
|
_setlocale(LC_MESSAGES, $locale);
|
||||||
|
_textdomain($domain);
|
||||||
|
_bindtextdomain($domain, $path);
|
||||||
|
_bind_textdomain_codeset($domain, $encoding);
|
||||||
|
echo "INPUT TEST $locale: " . $string . " => " . __($string) . "<br>";
|
||||||
|
$single_string = 'single';
|
||||||
|
$multi_string = 'multi';
|
||||||
|
for ($n = 0; $n <= 3; $n++) {
|
||||||
|
echo "MULTI TEST $n: " . $single_string . "/" . $multi_string . " => "
|
||||||
|
. _ngettext($single_string, $multi_string, $n) . "<br>";
|
||||||
|
}
|
||||||
|
|
||||||
print "</body></html>";
|
print "</body></html>";
|
||||||
|
|
||||||
|
|||||||
61
www/admin/class_test.login.php
Normal file
61
www/admin/class_test.login.php
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
<?php // phpcs:ignore warning
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
||||||
|
*/
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
// basic class test file
|
||||||
|
define('USE_DATABASE', false);
|
||||||
|
// sample config
|
||||||
|
require 'config.php';
|
||||||
|
// set session name
|
||||||
|
if (!defined('SET_SESSION_NAME')) {
|
||||||
|
define('SET_SESSION_NAME', EDIT_SESSION_NAME);
|
||||||
|
}
|
||||||
|
// define log file id
|
||||||
|
$LOG_FILE_ID = 'classTest-login';
|
||||||
|
// init login & backend class
|
||||||
|
$log = new CoreLibs\Debug\Logging([
|
||||||
|
'log_folder' => BASE . LOG,
|
||||||
|
'file_id' => $LOG_FILE_ID,
|
||||||
|
// 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,
|
||||||
|
]);
|
||||||
|
$db = new CoreLibs\DB\IO(DB_CONFIG, $log);
|
||||||
|
$login = new CoreLibs\ACL\Login($db, $log);
|
||||||
|
ob_end_flush();
|
||||||
|
|
||||||
|
print "<!DOCTYPE html>";
|
||||||
|
print "<html><head><title>TEST CLASS: LOGIN</title><head>";
|
||||||
|
print "<body>";
|
||||||
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
|
|
||||||
|
echo "CHECK PERMISSION: " . ($login->loginCheckPermissions() ? 'OK' : 'BAD') . "<br>";
|
||||||
|
echo "IS ADMIN: " . ($login->loginIsAdmin() ? 'OK' : 'BAD') . "<br>";
|
||||||
|
echo "MIN ACCESS BASE: " . ($login->loginCheckAccessBase('admin') ? 'OK' : 'BAD') . "<br>";
|
||||||
|
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>";
|
||||||
|
|
||||||
|
// error message
|
||||||
|
print $log->printErrorMsg();
|
||||||
|
|
||||||
|
print "</body></html>";
|
||||||
@@ -44,6 +44,7 @@ $math_class = 'CoreLibs\Convert\Math';
|
|||||||
|
|
||||||
// define a list of from to color sets for conversion test
|
// define a list of from to color sets for conversion test
|
||||||
|
|
||||||
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>TEST CLASS: MATH</title><head>";
|
print "<html><head><title>TEST CLASS: MATH</title><head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ $log = new CoreLibs\Debug\Logging([
|
|||||||
]);
|
]);
|
||||||
$_mime = new CoreLibs\Convert\MimeAppName();
|
$_mime = new CoreLibs\Convert\MimeAppName();
|
||||||
|
|
||||||
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>TEST CLASS: MIME</title><head>";
|
print "<html><head><title>TEST CLASS: MIME</title><head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ $log = new CoreLibs\Debug\Logging([
|
|||||||
]);
|
]);
|
||||||
$form = new CoreLibs\Output\Form\Generate(DB_CONFIG, $log);
|
$form = new CoreLibs\Output\Form\Generate(DB_CONFIG, $log);
|
||||||
|
|
||||||
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>TEST CLASS: FORM GENERATE</title><head>";
|
print "<html><head><title>TEST CLASS: FORM GENERATE</title><head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ $password_class = 'CoreLibs\Check\Password';
|
|||||||
|
|
||||||
// define a list of from to color sets for conversion test
|
// define a list of from to color sets for conversion test
|
||||||
|
|
||||||
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>TEST CLASS: PASSWORD</title><head>";
|
print "<html><head><title>TEST CLASS: PASSWORD</title><head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
|
|||||||
@@ -41,10 +41,17 @@ $log = new CoreLibs\Debug\Logging([
|
|||||||
]);
|
]);
|
||||||
$db = new CoreLibs\DB\IO(DB_CONFIG, $log);
|
$db = new CoreLibs\DB\IO(DB_CONFIG, $log);
|
||||||
$login = new CoreLibs\ACL\Login($db, $log);
|
$login = new CoreLibs\ACL\Login($db, $log);
|
||||||
$backend = new CoreLibs\Admin\Backend($db, $log);
|
$locale = \CoreLibs\Language\GetLocale::setLocale();
|
||||||
|
$l10n = new \CoreLibs\Language\L10n(
|
||||||
|
$locale['locale'],
|
||||||
|
$locale['domain'],
|
||||||
|
$locale['path'],
|
||||||
|
);
|
||||||
|
$backend = new CoreLibs\Admin\Backend($db, $log, $l10n, $locale);
|
||||||
$backend->db->dbInfo(true);
|
$backend->db->dbInfo(true);
|
||||||
ob_end_flush();
|
ob_end_flush();
|
||||||
|
|
||||||
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>TEST CLASS</title><head>";
|
print "<html><head><title>TEST CLASS</title><head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
|
|
||||||
@@ -60,7 +67,7 @@ print '<div><a href="class_test.email.php">Class Test: EMAIL</a></div>';
|
|||||||
print '<div><a href="class_test.uids.php">Class Test: UIDS</a></div>';
|
print '<div><a href="class_test.uids.php">Class Test: UIDS</a></div>';
|
||||||
print '<div><a href="class_test.phpv.php">Class Test: PHP VERSION</a></div>';
|
print '<div><a href="class_test.phpv.php">Class Test: PHP VERSION</a></div>';
|
||||||
print '<div><a href="class_test.hash.php">Class Test: HASH</a></div>';
|
print '<div><a href="class_test.hash.php">Class Test: HASH</a></div>';
|
||||||
print '<div><a href="class_test.encoding.php">Class Test: ENCODING</a></div>';
|
print '<div><a href="class_test.encoding.php">Class Test: ENCODING (CHECK/CONVERT/MIME)</a></div>';
|
||||||
print '<div><a href="class_test.image.php">Class Test: IMAGE</a></div>';
|
print '<div><a href="class_test.image.php">Class Test: IMAGE</a></div>';
|
||||||
print '<div><a href="class_test.byte.php">Class Test: BYTE CONVERT</a></div>';
|
print '<div><a href="class_test.byte.php">Class Test: BYTE CONVERT</a></div>';
|
||||||
print '<div><a href="class_test.datetime.php">Class Test: DATE/TIME</a></div>';
|
print '<div><a href="class_test.datetime.php">Class Test: DATE/TIME</a></div>';
|
||||||
@@ -72,15 +79,20 @@ print '<div><a href="class_test.readenvfile.php">Class Test: READ ENV FILE</a></
|
|||||||
print '<div><a href="class_test.runningtime.php">Class Test: RUNNING TIME</a></div>';
|
print '<div><a href="class_test.runningtime.php">Class Test: RUNNING TIME</a></div>';
|
||||||
print '<div><a href="class_test.debug.php">Class Test: DEBUG</a></div>';
|
print '<div><a href="class_test.debug.php">Class Test: DEBUG</a></div>';
|
||||||
print '<div><a href="class_test.output.form.php">Class Test: OUTPUT FORM</a></div>';
|
print '<div><a href="class_test.output.form.php">Class Test: OUTPUT FORM</a></div>';
|
||||||
print '<div><a href="class_test.backend.php">Class Test: BACKEND ADMIN CLASS</a></div>';
|
print '<div><a href="class_test.admin.backend.php">Class Test: BACKEND ADMIN CLASS</a></div>';
|
||||||
print '<div><a href="class_test.lang.php">Class Test: LANG/L10n</a></div>';
|
print '<div><a href="class_test.lang.php">Class Test: LANG/L10n</a></div>';
|
||||||
print '<div><a href="class_test.smarty.php">Class Test: SMARTY</a></div>';
|
print '<div><a href="class_test.smarty.php">Class Test: SMARTY</a></div>';
|
||||||
|
print '<div><a href="class_test.login.php">Class Test: LOGIN</a></div>';
|
||||||
print '<div><a href="class_test.autoloader.php">Class Test: AUTOLOADER</a></div>';
|
print '<div><a href="class_test.autoloader.php">Class Test: AUTOLOADER</a></div>';
|
||||||
|
print '<div><a href="class_test.config.link.php">Class Test: CONFIG LINK</a></div>';
|
||||||
|
print '<div><a href="class_test.config.direct.php">Class Test: CONFIG DIRECT</a></div>';
|
||||||
|
print '<div><a href="subfolder/class_test.config.direct.php">Class Test: CONFIG DIRECT SUB</a></div>';
|
||||||
|
|
||||||
print "<hr>";
|
print "<hr>";
|
||||||
|
print "L: " . CoreLibs\Debug\Support::printAr($locale) . "<br>";
|
||||||
// print all _ENV vars set
|
// print all _ENV vars set
|
||||||
print "<div>READ _ENV ARRAY:</div>";
|
print "<div>READ _ENV ARRAY:</div>";
|
||||||
print "<pre>" . print_r(array_map('htmlentities', $_ENV), true) . "</pre>";
|
print CoreLibs\Debug\Support::printAr(array_map('htmlentities', $_ENV));
|
||||||
// set + check edit access id
|
// set + check edit access id
|
||||||
$edit_access_id = 3;
|
$edit_access_id = 3;
|
||||||
if (is_object($login) && isset($login->acl['unit'])) {
|
if (is_object($login) && isset($login->acl['unit'])) {
|
||||||
@@ -145,9 +157,7 @@ print "BASE: " . BASE . "<br>";
|
|||||||
print "ROOT: " . ROOT . "<br>";
|
print "ROOT: " . ROOT . "<br>";
|
||||||
print "HOST: " . HOST_NAME . " => DB HOST: " . DB_CONFIG_NAME . " => " . print_r(DB_CONFIG, true) . "<br>";
|
print "HOST: " . HOST_NAME . " => DB HOST: " . DB_CONFIG_NAME . " => " . print_r(DB_CONFIG, true) . "<br>";
|
||||||
|
|
||||||
$ds = defined('DS') ? DS : DIRECTORY_SEPARATOR;
|
print "DS is: " . DIRECTORY_SEPARATOR . "<br>";
|
||||||
$du = DS ?? DIRECTORY_SEPARATOR;
|
|
||||||
print "DS is: " . $ds . "<br>";
|
|
||||||
print "SERVER HOST: " . $_SERVER['HTTP_HOST'] . "<br>";
|
print "SERVER HOST: " . $_SERVER['HTTP_HOST'] . "<br>";
|
||||||
|
|
||||||
// print error messages
|
// print error messages
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ $phpv_class = 'CoreLibs\Check\PhpVersion';
|
|||||||
|
|
||||||
// define a list of from to color sets for conversion test
|
// define a list of from to color sets for conversion test
|
||||||
|
|
||||||
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>TEST CLASS: PHP VERSION</title><head>";
|
print "<html><head><title>TEST CLASS: PHP VERSION</title><head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ $log = new CoreLibs\Debug\Logging([
|
|||||||
]);
|
]);
|
||||||
$array_class = 'CoreLibs\Create\RandomKey';
|
$array_class = 'CoreLibs\Create\RandomKey';
|
||||||
|
|
||||||
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>TEST CLASS: RANDOM KEY</title><head>";
|
print "<html><head><title>TEST CLASS: RANDOM KEY</title><head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ $log = new CoreLibs\Debug\Logging([
|
|||||||
]);
|
]);
|
||||||
$ref_class = 'CoreLibs\Get\ReadEnvFile';
|
$ref_class = 'CoreLibs\Get\ReadEnvFile';
|
||||||
|
|
||||||
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>TEST CLASS: READ ENV FILE</title><head>";
|
print "<html><head><title>TEST CLASS: READ ENV FILE</title><head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ $log = new CoreLibs\Debug\Logging([
|
|||||||
'print_all' => $PRINT_ALL ?? false,
|
'print_all' => $PRINT_ALL ?? false,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>TEST CLASS: RUNNING IMTE</title><head>";
|
print "<html><head><title>TEST CLASS: RUNNING IMTE</title><head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
|
|||||||
@@ -19,8 +19,6 @@ ob_start();
|
|||||||
|
|
||||||
// basic class test file
|
// basic class test file
|
||||||
define('USE_DATABASE', true);
|
define('USE_DATABASE', true);
|
||||||
// set language
|
|
||||||
$lang = 'en_utf8';
|
|
||||||
// sample config
|
// sample config
|
||||||
require 'config.php';
|
require 'config.php';
|
||||||
// override ECHO ALL FALSE
|
// override ECHO ALL FALSE
|
||||||
@@ -43,9 +41,15 @@ $log = new CoreLibs\Debug\Logging([
|
|||||||
'echo_all' => $ECHO_ALL ?? false,
|
'echo_all' => $ECHO_ALL ?? false,
|
||||||
'print_all' => $PRINT_ALL ?? false,
|
'print_all' => $PRINT_ALL ?? false,
|
||||||
]);
|
]);
|
||||||
$smarty = new CoreLibs\Template\SmartyExtend();
|
$locale = \CoreLibs\Language\GetLocale::setLocale();
|
||||||
$l = new CoreLibs\Language\L10n($lang);
|
$l10n = new \CoreLibs\Language\L10n(
|
||||||
|
$locale['locale'],
|
||||||
|
$locale['domain'],
|
||||||
|
$locale['path'],
|
||||||
|
);
|
||||||
|
$smarty = new CoreLibs\Template\SmartyExtend($l10n, $locale);
|
||||||
|
|
||||||
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>TEST CLASS: SMARTY</title><head>";
|
print "<html><head><title>TEST CLASS: SMARTY</title><head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
@@ -65,16 +69,27 @@ if ($smarty->USE_PROTOTYPE) {
|
|||||||
$smarty->JS_SPECIAL_TEMPLATE_NAME = 'jquery.test.js';
|
$smarty->JS_SPECIAL_TEMPLATE_NAME = 'jquery.test.js';
|
||||||
}
|
}
|
||||||
$smarty->PAGE_WIDTH = '100%';
|
$smarty->PAGE_WIDTH = '100%';
|
||||||
// require BASE.INCLUDES.'admin_set_paths.php';
|
|
||||||
$smarty->setSmartyPaths();
|
$smarty->setSmartyPaths();
|
||||||
|
|
||||||
// smarty test
|
// smarty test
|
||||||
$smarty->DATA['SMARTY_TEST'] = 'Test Data';
|
$smarty->DATA['SMARTY_TEST'] = 'Test Data';
|
||||||
$smarty->DATA['TRANSLATE_TEST'] = $l->__('Are we translated?');
|
$smarty->DATA['TRANSLATE_TEST'] = $l10n->__('Are we translated?');
|
||||||
|
$smarty->DATA['TRANSLATE_TEST_FUNCTION'] = _gettext('Are we translated?');
|
||||||
$smarty->DATA['TRANSLATE_TEST_SMARTY'] = $smarty->l10n->__('Are we translated?');
|
$smarty->DATA['TRANSLATE_TEST_SMARTY'] = $smarty->l10n->__('Are we translated?');
|
||||||
|
$smarty->DATA['replace'] = 'Replaced';
|
||||||
|
// variable variables
|
||||||
|
$smarty->DATA['test'] = 'foo';
|
||||||
|
$smarty->DATA['foo'] = 'bar';
|
||||||
|
// loop
|
||||||
|
$smarty->DATA['loop_start'] = 5;
|
||||||
// drop down test with optgroups
|
// drop down test with optgroups
|
||||||
$options = [
|
$smarty->DATA['drop_down_test'] = [
|
||||||
|
'foo' => 'Foo',
|
||||||
|
'bar' => 'Bar',
|
||||||
|
'foobar' => 'Foo Bar',
|
||||||
|
];
|
||||||
|
$smarty->DATA['drop_down_test_selected'] = 'bar';
|
||||||
|
$smarty->DATA['drop_down_test_nested'] = [
|
||||||
'' => '選択してください',
|
'' => '選択してください',
|
||||||
'4/25(木)' => [
|
'4/25(木)' => [
|
||||||
'4/25(木) 11:00-11:50' => '4/25(木) 11:00-11:50',
|
'4/25(木) 11:00-11:50' => '4/25(木) 11:00-11:50',
|
||||||
@@ -89,11 +104,26 @@ $options = [
|
|||||||
'4/27(土) 12:20-13:00' => '4/27(土) 12:20-13:00'
|
'4/27(土) 12:20-13:00' => '4/27(土) 12:20-13:00'
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
$smarty->DATA['drop_down_test_nested_selected'] = '';
|
||||||
|
$smarty->DATA['radio_test'] = [
|
||||||
|
'0' => 'On',
|
||||||
|
'1' => 'Off',
|
||||||
|
'-1' => 'Undefined'
|
||||||
|
];
|
||||||
|
$smarty->DATA['radio_test_selected'] = -1;
|
||||||
|
$smarty->DATA['checkbox_test'] = [
|
||||||
|
'0' => 'On',
|
||||||
|
'1' => 'Off',
|
||||||
|
'-1' => 'Undefined'
|
||||||
|
];
|
||||||
|
$smarty->DATA['checkbox_test_pos'] = [
|
||||||
|
'0' => 'A',
|
||||||
|
'1' => 'B'
|
||||||
|
];
|
||||||
|
$smarty->DATA['checkbox_test_selected'] = ['1', '-1'];
|
||||||
|
$smarty->DATA['checkbox_test_pos_selected'] = ['0', '-1'];
|
||||||
|
|
||||||
|
|
||||||
$smarty->DATA['drop_down_test'] = $options;
|
|
||||||
$smarty->DATA['drop_down_test_selected'] = '';
|
|
||||||
$smarty->DATA['loop_start'] = 2;
|
|
||||||
// require BASE.INCLUDES.'admin_smarty.php';
|
|
||||||
$smarty->setSmartyVarsAdmin();
|
$smarty->setSmartyVarsAdmin();
|
||||||
|
|
||||||
// error message
|
// error message
|
||||||
|
|||||||
@@ -1,105 +0,0 @@
|
|||||||
<?php // phpcs:ignore warning
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
|
||||||
*/
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
|
||||||
$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', true);
|
|
||||||
// set language
|
|
||||||
$lang = 'en_utf8';
|
|
||||||
// sample config
|
|
||||||
require 'config.php';
|
|
||||||
// override ECHO ALL FALSE
|
|
||||||
$ECHO_ALL = true;
|
|
||||||
// set session name
|
|
||||||
if (!defined('SET_SESSION_NAME')) {
|
|
||||||
define('SET_SESSION_NAME', EDIT_SESSION_NAME);
|
|
||||||
}
|
|
||||||
// define log file id
|
|
||||||
$LOG_FILE_ID = 'classTest-smarty';
|
|
||||||
ob_end_flush();
|
|
||||||
|
|
||||||
$log = new CoreLibs\Debug\Logging([
|
|
||||||
'log_folder' => BASE . LOG,
|
|
||||||
'file_id' => $LOG_FILE_ID,
|
|
||||||
// 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,
|
|
||||||
]);
|
|
||||||
$basic = new CoreLibs\Basic($log);
|
|
||||||
$smarty = new CoreLibs\Template\SmartyExtend4();
|
|
||||||
$l = new CoreLibs\Language\L10n($lang);
|
|
||||||
|
|
||||||
print "<html><head><title>TEST CLASS: SMARTY</title><head>";
|
|
||||||
print "<body>";
|
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
|
||||||
|
|
||||||
$smarty->DATA['JS_DEBUG'] = DEBUG;
|
|
||||||
$smarty->MASTER_TEMPLATE_NAME = 'main_body4.tpl';
|
|
||||||
$smarty->TEMPLATE_NAME = 'smarty_test4.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['drop_down_test_selected'] = '';
|
|
||||||
$smarty->DATA['loop_start'] = 2;
|
|
||||||
// require BASE.INCLUDES.'admin_smarty.php';
|
|
||||||
$smarty->setSmartyVarsAdmin();
|
|
||||||
|
|
||||||
// error message
|
|
||||||
print $log->printErrorMsg();
|
|
||||||
|
|
||||||
print "</body></html>";
|
|
||||||
|
|
||||||
// __END__
|
|
||||||
@@ -42,8 +42,8 @@ $log = new CoreLibs\Debug\Logging([
|
|||||||
'echo_all' => $ECHO_ALL ?? false,
|
'echo_all' => $ECHO_ALL ?? false,
|
||||||
'print_all' => $PRINT_ALL ?? false,
|
'print_all' => $PRINT_ALL ?? false,
|
||||||
]);
|
]);
|
||||||
$basic = new CoreLibs\Basic($log);
|
|
||||||
|
|
||||||
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>TEST CLASS: SYSTEM</title><head>";
|
print "<html><head><title>TEST CLASS: SYSTEM</title><head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ $log = new CoreLibs\Debug\Logging([
|
|||||||
$_token = new CoreLibs\Output\Form\Token();
|
$_token = new CoreLibs\Output\Form\Token();
|
||||||
$token_class = 'CoreLibs\Output\Form\Token';
|
$token_class = 'CoreLibs\Output\Form\Token';
|
||||||
|
|
||||||
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>TEST CLASS: FORM TOKEN</title><head>";
|
print "<html><head><title>TEST CLASS: FORM TOKEN</title><head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ $_uids = new CoreLibs\Create\Uids();
|
|||||||
use CoreLibs\Create\Uids;
|
use CoreLibs\Create\Uids;
|
||||||
$uids_class = 'CoreLibs\Create\Uids';
|
$uids_class = 'CoreLibs\Create\Uids';
|
||||||
|
|
||||||
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>TEST CLASS: UIDS</title><head>";
|
print "<html><head><title>TEST CLASS: UIDS</title><head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
|
|||||||
58
www/admin/subfolder/class_test.config.direct.php
Normal file
58
www/admin/subfolder/class_test.config.direct.php
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
<?php // phpcs:ignore warning
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
||||||
|
*/
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
// basic class test file
|
||||||
|
define('USE_DATABASE', false);
|
||||||
|
// sample config
|
||||||
|
require '../../configs/config.php';
|
||||||
|
// define log file id
|
||||||
|
$LOG_FILE_ID = 'classTest-config-direct';
|
||||||
|
ob_end_flush();
|
||||||
|
|
||||||
|
$log = new CoreLibs\Debug\Logging([
|
||||||
|
'log_folder' => BASE . LOG,
|
||||||
|
'file_id' => $LOG_FILE_ID,
|
||||||
|
// 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,
|
||||||
|
]);
|
||||||
|
|
||||||
|
print "<!DOCTYPE html>";
|
||||||
|
print "<html><head><title>TEST CLASS: CONFIG DIRECT SUB</title><head>";
|
||||||
|
print "<body>";
|
||||||
|
print '<div><a href="../class_test.php">Class Test Master</a></div>';
|
||||||
|
print '<div><b>CONFIG DIRECT SUB</b></div>';
|
||||||
|
|
||||||
|
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>";
|
||||||
|
print "DB Name: " . DB_CONFIG_NAME . "<br>";
|
||||||
|
print "DB Config: " . \CoreLibs\Debug\Support::printAr(DB_CONFIG) . "<br>";
|
||||||
|
|
||||||
|
// error message
|
||||||
|
print $log->printErrorMsg();
|
||||||
|
|
||||||
|
print "</body></html>";
|
||||||
|
|
||||||
|
// __END__
|
||||||
@@ -27,7 +27,8 @@ $__LOCAL_CONFIG = [
|
|||||||
'db_host' => 'test',
|
'db_host' => 'test',
|
||||||
'location' => 'test',
|
'location' => 'test',
|
||||||
'debug_flag' => true,
|
'debug_flag' => true,
|
||||||
'site_lang' => 'en_utf8',
|
'site_locale' => 'en_US.UTF-8',
|
||||||
|
'site_encoding' => 'UTF-8',
|
||||||
'login_enabled' => true
|
'login_enabled' => true
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -44,8 +45,10 @@ $SITE_CONFIG = [
|
|||||||
'location' => 'test',
|
'location' => 'test',
|
||||||
// show DEBUG override
|
// show DEBUG override
|
||||||
'debug_flag' => true,
|
'debug_flag' => true,
|
||||||
// site language
|
// site locale
|
||||||
'site_lang' => 'en_utf8',
|
'site_locale' => 'en_US.UTF-8',
|
||||||
|
// site encoding
|
||||||
|
'site_encoding' => 'UTF-8',
|
||||||
// enable/disable login override
|
// enable/disable login override
|
||||||
'login_enabled' => true
|
'login_enabled' => true
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -11,72 +11,72 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
/************* PATHS *********************/
|
/************* PATHS *********************/
|
||||||
// directory seperator
|
// [DEPRECATED] directory seperator
|
||||||
define('DS', DIRECTORY_SEPARATOR);
|
define('DS', DIRECTORY_SEPARATOR);
|
||||||
// ** NEW/BETTER DIR DECLARATIONS **
|
// ** NEW/BETTER DIR DECLARATIONS **
|
||||||
// path to original file (if symlink)
|
// path to original file (if symlink)
|
||||||
define('DIR', __DIR__ . DS);
|
define('DIR', __DIR__ . DIRECTORY_SEPARATOR);
|
||||||
// base dir root folder level
|
// base dir root folder level
|
||||||
define('BASE', str_replace('/configs', '', __DIR__) . DS);
|
define('BASE', str_replace('/configs', '', __DIR__) . DIRECTORY_SEPARATOR);
|
||||||
|
|
||||||
// ** OLD DIR DECLARATIONS **
|
// ** OLD DIR DECLARATIONS **
|
||||||
// path to document root of file called
|
// path to document root of file called
|
||||||
define('ROOT', getcwd() . DS);
|
define('ROOT', getcwd() . DIRECTORY_SEPARATOR);
|
||||||
// libs path
|
// libs path
|
||||||
define('LIB', 'lib' . DS);
|
define('LIB', 'lib' . DIRECTORY_SEPARATOR);
|
||||||
define('LIBS', 'lib' . DS);
|
define('LIBS', 'lib' . DIRECTORY_SEPARATOR);
|
||||||
// configs folder
|
// configs folder
|
||||||
define('CONFIGS', 'configs' . DS);
|
define('CONFIGS', 'configs' . DIRECTORY_SEPARATOR);
|
||||||
// includes (strings, arrays for static, etc)
|
// includes (strings, arrays for static, etc)
|
||||||
define('INCLUDES', 'includes' . DS);
|
define('INCLUDES', 'includes' . DIRECTORY_SEPARATOR);
|
||||||
// data folder (mostly in includes, or root for internal data)
|
// data folder (mostly in includes, or root for internal data)
|
||||||
define('DATA', 'data' . DS);
|
define('DATA', 'data' . DIRECTORY_SEPARATOR);
|
||||||
// layout base path
|
// layout base path
|
||||||
define('LAYOUT', 'layout' . DS);
|
define('LAYOUT', 'layout' . DIRECTORY_SEPARATOR);
|
||||||
// pic-root (compatible to CMS)
|
// pic-root (compatible to CMS)
|
||||||
define('PICTURES', 'images' . DS);
|
define('PICTURES', 'images' . DIRECTORY_SEPARATOR);
|
||||||
// images
|
// images
|
||||||
define('IMAGES', 'images' . DS);
|
define('IMAGES', 'images' . DIRECTORY_SEPARATOR);
|
||||||
// icons (below the images/ folder)
|
// icons (below the images/ folder)
|
||||||
define('ICONS', 'icons' . DS);
|
define('ICONS', 'icons' . DIRECTORY_SEPARATOR);
|
||||||
// media (accessable from outside)
|
// media (accessable from outside)
|
||||||
define('MEDIA', 'media' . DS);
|
define('MEDIA', 'media' . DIRECTORY_SEPARATOR);
|
||||||
// uploads (anything to keep or data)
|
// uploads (anything to keep or data)
|
||||||
define('UPLOADS', 'uploads' . DS);
|
define('UPLOADS', 'uploads' . DIRECTORY_SEPARATOR);
|
||||||
// files (binaries) (below media or data)
|
// files (binaries) (below media or data)
|
||||||
define('BINARIES', 'binaries' . DS);
|
define('BINARIES', 'binaries' . DIRECTORY_SEPARATOR);
|
||||||
// files (videos) (below media or data)
|
// files (videos) (below media or data)
|
||||||
define('VIDEOS', 'videos' . DS);
|
define('VIDEOS', 'videos' . DIRECTORY_SEPARATOR);
|
||||||
// files (documents) (below media or data)
|
// files (documents) (below media or data)
|
||||||
define('DOCUMENTS', 'documents' . DS);
|
define('DOCUMENTS', 'documents' . DIRECTORY_SEPARATOR);
|
||||||
// files (pdfs) (below media or data)
|
// files (pdfs) (below media or data)
|
||||||
define('PDFS', 'documents' . DS);
|
define('PDFS', 'documents' . DIRECTORY_SEPARATOR);
|
||||||
// files (general) (below media or data)
|
// files (general) (below media or data)
|
||||||
define('FILES', 'files' . DS);
|
define('FILES', 'files' . DIRECTORY_SEPARATOR);
|
||||||
// CSV
|
// CSV
|
||||||
define('CSV', 'csv' . DS);
|
define('CSV', 'csv' . DIRECTORY_SEPARATOR);
|
||||||
// css
|
// css
|
||||||
define('CSS', 'css' . DS);
|
define('CSS', 'css' . DIRECTORY_SEPARATOR);
|
||||||
// font (web)
|
// font (web)
|
||||||
define('FONT', 'font' . DS);
|
define('FONT', 'font' . DIRECTORY_SEPARATOR);
|
||||||
// js
|
// js
|
||||||
define('JS', 'javascript' . DS);
|
define('JS', 'javascript' . DIRECTORY_SEPARATOR);
|
||||||
// table arrays
|
// table arrays
|
||||||
define('TABLE_ARRAYS', 'table_arrays' . DS);
|
define('TABLE_ARRAYS', 'table_arrays' . DIRECTORY_SEPARATOR);
|
||||||
// smarty libs path
|
// smarty libs path
|
||||||
define('SMARTY', 'Smarty' . DS);
|
define('SMARTY', 'Smarty' . DIRECTORY_SEPARATOR);
|
||||||
// po langs
|
// po locale file
|
||||||
define('LANG', 'lang' . DS);
|
define('LOCALE', 'locale' . DIRECTORY_SEPARATOR);
|
||||||
// cache path
|
// cache path
|
||||||
define('CACHE', 'cache' . DS);
|
define('CACHE', 'cache' . DIRECTORY_SEPARATOR);
|
||||||
// temp path
|
// temp path
|
||||||
define('TMP', 'tmp' . DS);
|
define('TMP', 'tmp' . DIRECTORY_SEPARATOR);
|
||||||
// log files
|
// log files
|
||||||
define('LOG', 'log' . DS);
|
define('LOG', 'log' . DIRECTORY_SEPARATOR);
|
||||||
// compiled template folder
|
// compiled template folder
|
||||||
define('TEMPLATES_C', 'templates_c' . DS);
|
define('TEMPLATES_C', 'templates_c' . DIRECTORY_SEPARATOR);
|
||||||
// template base
|
// template base
|
||||||
define('TEMPLATES', 'templates' . DS);
|
define('TEMPLATES', 'templates' . DIRECTORY_SEPARATOR);
|
||||||
|
|
||||||
/************* HASH / ACL DEFAULT / ERROR SETTINGS / SMARTY *************/
|
/************* HASH / ACL DEFAULT / ERROR SETTINGS / SMARTY *************/
|
||||||
// default hash type
|
// default hash type
|
||||||
@@ -158,7 +158,8 @@ define('CACHE_ID', 'CACHE_' . BASE_NAME . '_' . SERVER_NAME_HASH);
|
|||||||
define('COMPILE_ID', 'COMPILE_' . BASE_NAME . '_' . SERVER_NAME_HASH);
|
define('COMPILE_ID', 'COMPILE_' . BASE_NAME . '_' . SERVER_NAME_HASH);
|
||||||
|
|
||||||
/************* LANGUAGE / ENCODING *******/
|
/************* LANGUAGE / ENCODING *******/
|
||||||
define('DEFAULT_LANG', 'en_utf8');
|
// default lang + encoding
|
||||||
|
define('DEFAULT_LOCALE', 'en_US.UTF-8');
|
||||||
// default web page encoding setting
|
// default web page encoding setting
|
||||||
define('DEFAULT_ENCODING', 'UTF-8');
|
define('DEFAULT_ENCODING', 'UTF-8');
|
||||||
|
|
||||||
@@ -256,10 +257,12 @@ $GLOBALS['DB_CONFIG'] = DB_CONFIG;
|
|||||||
// where global tables are that are used by all schemas (eg queue tables for online, etc)
|
// where global tables are that are used by all schemas (eg queue tables for online, etc)
|
||||||
// define('GLOBAL_DB_SCHEMA', PUBLIC_SCHEMA);
|
// define('GLOBAL_DB_SCHEMA', PUBLIC_SCHEMA);
|
||||||
// debug settings, site lang, etc
|
// debug settings, site lang, etc
|
||||||
define('TARGET', $SITE_CONFIG[HOST_NAME]['location']);
|
define('TARGET', $SITE_CONFIG[HOST_NAME]['location'] ?? 'test');
|
||||||
define('DEBUG', $SITE_CONFIG[HOST_NAME]['debug_flag']);
|
define('DEBUG', $SITE_CONFIG[HOST_NAME]['debug_flag'] ?? false);
|
||||||
define('SITE_LANG', $SITE_CONFIG[HOST_NAME]['site_lang']);
|
define('SITE_LOCALE', $SITE_CONFIG[HOST_NAME]['site_locale'] ?? DEFAULT_LOCALE);
|
||||||
define('LOGIN_ENABLED', $SITE_CONFIG[HOST_NAME]['login_enabled']);
|
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);
|
||||||
// paths
|
// paths
|
||||||
// define('CSV_PATH', $PATHS[TARGET]['csv_path']);
|
// define('CSV_PATH', $PATHS[TARGET]['csv_path']);
|
||||||
// define('EXPORT_SCRIPT', $PATHS[TARGET]['perl_bin']);
|
// define('EXPORT_SCRIPT', $PATHS[TARGET]['perl_bin']);
|
||||||
|
|||||||
@@ -21,9 +21,12 @@ $paths = [
|
|||||||
];
|
];
|
||||||
// find convert
|
// find convert
|
||||||
foreach ($paths as $path) {
|
foreach ($paths as $path) {
|
||||||
if (file_exists($path . DS . 'convert') && is_file($path . DS . 'convert')) {
|
if (
|
||||||
|
file_exists($path . DIRECTORY_SEPARATOR . 'convert') &&
|
||||||
|
is_file($path . DIRECTORY_SEPARATOR . 'convert')
|
||||||
|
) {
|
||||||
// image magick convert location
|
// image magick convert location
|
||||||
define('CONVERT', $path . DS . 'convert');
|
define('CONVERT', $path . DIRECTORY_SEPARATOR . 'convert');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,51 +11,68 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
define('CONFIG_PATH', 'configs' . DIRECTORY_SEPARATOR);
|
define('CONFIG_PATH', 'configs' . DIRECTORY_SEPARATOR);
|
||||||
// config path prefix search, start with 0, got down each level __DIR__ has, if nothing found -> bail
|
// config path prefix search, start with 0, got down each level __DIR__ has,
|
||||||
|
// if nothing found -> bail
|
||||||
$CONFIG_PATH_PREFIX = '';
|
$CONFIG_PATH_PREFIX = '';
|
||||||
|
// base path for loads
|
||||||
|
$__DIR__PATH = __DIR__ . DIRECTORY_SEPARATOR;
|
||||||
|
// don't load autoloader twice
|
||||||
$end_autoload = false;
|
$end_autoload = false;
|
||||||
for ($dir_pos = 0, $dir_max = count(explode(DIRECTORY_SEPARATOR, __DIR__)); $dir_pos <= $dir_max; $dir_pos++) {
|
for (
|
||||||
|
$dir_pos = 0, $dir_max = count(explode(DIRECTORY_SEPARATOR, __DIR__));
|
||||||
|
$dir_pos <= $dir_max;
|
||||||
|
$dir_pos++
|
||||||
|
) {
|
||||||
$CONFIG_PATH_PREFIX .= '..' . DIRECTORY_SEPARATOR;
|
$CONFIG_PATH_PREFIX .= '..' . DIRECTORY_SEPARATOR;
|
||||||
if ($end_autoload === false) {
|
if ($end_autoload === false) {
|
||||||
/************* AUTO LOADER *******************/
|
/************* AUTO LOADER *******************/
|
||||||
// read auto loader for lib only
|
// composer auto loader, in composer.json file add classmap for lib/:
|
||||||
// It is recommended to setup basic composer and use just one auto loader
|
|
||||||
// if (is_file($CONFIG_PATH_PREFIX . 'lib' . DIRECTORY_SEPARATOR . 'autoloader.php')) {
|
|
||||||
// require $CONFIG_PATH_PREFIX . 'lib' . DIRECTORY_SEPARATOR . 'autoloader.php';
|
|
||||||
// $end_autoload = true;
|
|
||||||
// }
|
|
||||||
// composer auto loader, IF composer.json file includes classmap for lib/:
|
|
||||||
// "autoload": {
|
// "autoload": {
|
||||||
// "classmap": [
|
// "classmap": [
|
||||||
// "lib/"
|
// "lib/"
|
||||||
// ]
|
// ]
|
||||||
// },
|
// },
|
||||||
// NOTE: MUST RUN composer dump-autoload if file/class names are changed or added
|
// NOTE: MUST RUN composer dump-autoload if file/class names are
|
||||||
// load auto loader
|
// changed or new ones are added
|
||||||
if (is_file($CONFIG_PATH_PREFIX . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php')) {
|
if (
|
||||||
require $CONFIG_PATH_PREFIX . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
|
is_file(
|
||||||
|
$__DIR__PATH . $CONFIG_PATH_PREFIX
|
||||||
|
. 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
require $__DIR__PATH . $CONFIG_PATH_PREFIX
|
||||||
|
. 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
|
||||||
$end_autoload = true;
|
$end_autoload = true;
|
||||||
}
|
}
|
||||||
// load enviorment file if it exists
|
|
||||||
\CoreLibs\Get\ReadEnvFile::readEnvFile($CONFIG_PATH_PREFIX . CONFIG_PATH);
|
|
||||||
}
|
}
|
||||||
/************* MASTER CONFIG *******************/
|
/************* MASTER CONFIG *******************/
|
||||||
if (is_file($CONFIG_PATH_PREFIX . CONFIG_PATH . 'config.master.php')) {
|
if (
|
||||||
|
is_file($__DIR__PATH . $CONFIG_PATH_PREFIX . CONFIG_PATH . 'config.master.php')
|
||||||
|
) {
|
||||||
|
// load enviorment file if it exists
|
||||||
|
\CoreLibs\Get\ReadEnvFile::readEnvFile(
|
||||||
|
$__DIR__PATH . $CONFIG_PATH_PREFIX . CONFIG_PATH
|
||||||
|
);
|
||||||
// load master config file that loads all other config files
|
// load master config file that loads all other config files
|
||||||
require $CONFIG_PATH_PREFIX . CONFIG_PATH . 'config.master.php';
|
require $__DIR__PATH . $CONFIG_PATH_PREFIX . CONFIG_PATH . 'config.master.php';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// fail if no base DS is not set
|
// fail if no base DIR is not set
|
||||||
if (!defined('DS')) {
|
if (!defined('DIR')) {
|
||||||
exit('Base config unloadable');
|
exit('Base config could not be loaded');
|
||||||
}
|
}
|
||||||
// find trigger name "admin/" or "frontend/" in the getcwd() folder
|
// find trigger name "admin/" or "frontend/" in the getcwd() folder
|
||||||
foreach (['admin', 'frontend'] as $folder) {
|
foreach (['admin', 'frontend'] as $folder) {
|
||||||
if (strstr(getcwd() ?: '', DIRECTORY_SEPARATOR . $folder)) {
|
if (strstr(getcwd() ?: '', DIRECTORY_SEPARATOR . $folder)) {
|
||||||
define('CONTENT_PATH', $folder . DIRECTORY_SEPARATOR);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// if content path is empty, fallback is default
|
||||||
|
/** @phpstan-ignore-next-line can be empty */
|
||||||
|
if (empty($folder)) {
|
||||||
|
$folder = 'default';
|
||||||
|
}
|
||||||
|
define('CONTENT_PATH', $folder . DIRECTORY_SEPARATOR);
|
||||||
|
|
||||||
// __END__
|
// __END__
|
||||||
|
|||||||
@@ -1,77 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/********************************************************************
|
|
||||||
* AUTHOR: Clemens Schwaighofer
|
|
||||||
* CREATED: 2005/07/19
|
|
||||||
* SHORT DESCRIPTION:
|
|
||||||
* preset date variables
|
|
||||||
* HISTORY:
|
|
||||||
*********************************************************************/
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
/******
|
|
||||||
All moved to CoreLibs\Combined\DateTime
|
|
||||||
DAY_SHORT
|
|
||||||
DAY_LONG
|
|
||||||
MONTH_LONG
|
|
||||||
MONTH_SHORT
|
|
||||||
*******/
|
|
||||||
trigger_error(
|
|
||||||
'Date.VArs.php is deprecated. '
|
|
||||||
. 'Use CoreLibs\Combined\DateTime:: with upper case old variable name',
|
|
||||||
E_USER_DEPRECATED
|
|
||||||
);
|
|
||||||
|
|
||||||
$day_short = [
|
|
||||||
1 => 'Mon',
|
|
||||||
2 => 'Tue',
|
|
||||||
3 => 'Wed',
|
|
||||||
4 => 'Thu',
|
|
||||||
5 => 'Fri',
|
|
||||||
6 => 'Sat',
|
|
||||||
7 => 'Sun'
|
|
||||||
];
|
|
||||||
|
|
||||||
$day_long = [
|
|
||||||
1 => 'Monday',
|
|
||||||
2 => 'Tuesday',
|
|
||||||
3 => 'Wednesday',
|
|
||||||
4 => 'Thursday',
|
|
||||||
5 => 'Friday',
|
|
||||||
6 => 'Saturday',
|
|
||||||
7 => 'Sunday'
|
|
||||||
];
|
|
||||||
|
|
||||||
// months
|
|
||||||
$month_long = [
|
|
||||||
1 => 'January',
|
|
||||||
2 => 'February',
|
|
||||||
3 => 'March',
|
|
||||||
4 => 'April',
|
|
||||||
5 => 'May',
|
|
||||||
6 => 'June',
|
|
||||||
7 => 'July',
|
|
||||||
8 => 'August',
|
|
||||||
9 => 'September',
|
|
||||||
10 => 'October',
|
|
||||||
11 => 'November',
|
|
||||||
12 => 'December'
|
|
||||||
];
|
|
||||||
|
|
||||||
$month_short = [
|
|
||||||
1 => 'Jan',
|
|
||||||
2 => 'Feb',
|
|
||||||
3 => 'Mar',
|
|
||||||
4 => 'Apr',
|
|
||||||
5 => 'May',
|
|
||||||
6 => 'Jun',
|
|
||||||
7 => 'Jul',
|
|
||||||
8 => 'Aug',
|
|
||||||
9 => 'Sep',
|
|
||||||
10 => 'Oct',
|
|
||||||
11 => 'Nov',
|
|
||||||
12 => 'Dec'
|
|
||||||
];
|
|
||||||
|
|
||||||
// __END__
|
|
||||||
@@ -72,10 +72,19 @@ if (
|
|||||||
$db = new CoreLibs\DB\IO(DB_CONFIG, $log);
|
$db = new CoreLibs\DB\IO(DB_CONFIG, $log);
|
||||||
// login & page access check
|
// login & page access check
|
||||||
$login = new CoreLibs\ACL\Login($db, $log);
|
$login = new CoreLibs\ACL\Login($db, $log);
|
||||||
|
// lang, path, domain
|
||||||
|
// pre auto detect language after login
|
||||||
|
$locale = \CoreLibs\Language\GetLocale::setLocale();
|
||||||
|
// set lang and pass to smarty/backend
|
||||||
|
$l10n = new \CoreLibs\Language\L10n(
|
||||||
|
$locale['locale'],
|
||||||
|
$locale['domain'],
|
||||||
|
$locale['path'],
|
||||||
|
);
|
||||||
// create smarty object
|
// create smarty object
|
||||||
$smarty = new CoreLibs\Template\SmartyExtend();
|
$smarty = new CoreLibs\Template\SmartyExtend($l10n, $locale);
|
||||||
// create new Backend class with db and loger attached
|
// create new Backend class with db and loger attached
|
||||||
$cms = new CoreLibs\Admin\Backend($db, $log);
|
$cms = new CoreLibs\Admin\Backend($db, $log, $l10n, $locale);
|
||||||
// the menu show flag (what menu to show)
|
// the menu show flag (what menu to show)
|
||||||
$cms->menu_show_flag = 'main';
|
$cms->menu_show_flag = 'main';
|
||||||
// db info
|
// db info
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/********************************************************************
|
|
||||||
* AUTHOR: Clemens Schwaighofer
|
|
||||||
* CREATED: 2007/09/03
|
|
||||||
* SHORT DESCRIPTION:
|
|
||||||
* set paths & language variables
|
|
||||||
* HISTORY:
|
|
||||||
*********************************************************************/
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
/******
|
|
||||||
NOTE THAT THIS INCLUDE IS OBSOLETE
|
|
||||||
USE THE BELOW FUNCTION CALL IN THE SCRIPT ITSELF
|
|
||||||
*******/
|
|
||||||
trigger_error('admin_set_paths.php is deprecated. Use SmartyExtended->setSmartyPaths();', E_USER_DEPRECATED);
|
|
||||||
if ($smarty) {
|
|
||||||
$smarty->setSmartyPaths();
|
|
||||||
}
|
|
||||||
|
|
||||||
// __END__
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/********************************************************************
|
|
||||||
* AUTHOR: Clemens Schwaighofer
|
|
||||||
* CREATED: 2005/07/12
|
|
||||||
* SHORT DESCRIPTION:
|
|
||||||
* default smarty vars, and create output template for smarty
|
|
||||||
* HISTORY:
|
|
||||||
*********************************************************************/
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
/******
|
|
||||||
NOTE THAT THIS INCLUDE IS OBSOLETE
|
|
||||||
USE THE BELOW FUNCTION CALL IN THE SCRIPT ITSELF
|
|
||||||
*******/
|
|
||||||
trigger_error(
|
|
||||||
'admin_smarty.php is deprecated. Use SmartyExtended->setSmartyVarsAdmin(); or setSmartyVarsFrontend();',
|
|
||||||
E_USER_DEPRECATED
|
|
||||||
);
|
|
||||||
$smarty->setSmartyVarsAdmin();
|
|
||||||
|
|
||||||
// __END__
|
|
||||||
@@ -61,18 +61,27 @@ $log = new CoreLibs\Debug\Logging([
|
|||||||
$db = new CoreLibs\DB\IO(DB_CONFIG, $log);
|
$db = new CoreLibs\DB\IO(DB_CONFIG, $log);
|
||||||
// login page
|
// login page
|
||||||
$login = new CoreLibs\ACL\Login($db, $log);
|
$login = new CoreLibs\ACL\Login($db, $log);
|
||||||
|
// lang, path, domain
|
||||||
|
// pre auto detect language after login
|
||||||
|
$locale = \CoreLibs\Language\GetLocale::setLocale();
|
||||||
|
// set lang and pass to smarty/backend
|
||||||
|
$l10n = new \CoreLibs\Language\L10n(
|
||||||
|
$locale['locale'],
|
||||||
|
$locale['domain'],
|
||||||
|
$locale['path'],
|
||||||
|
);
|
||||||
// flush and start
|
// flush and start
|
||||||
ob_end_flush();
|
ob_end_flush();
|
||||||
// turn off set log per class
|
// turn off set log per class
|
||||||
$log->setLogPer('class', false);
|
$log->setLogPer('class', false);
|
||||||
// create form class
|
// create form class
|
||||||
$form = new CoreLibs\Output\Form\Generate(DB_CONFIG, $log);
|
$form = new CoreLibs\Output\Form\Generate(DB_CONFIG, $log, $l10n, $locale);
|
||||||
if ($form->mobile_phone) {
|
if ($form->mobile_phone) {
|
||||||
echo "I am sorry, but this page cannot be viewed by a mobile phone";
|
echo "I am sorry, but this page cannot be viewed by a mobile phone";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
// smarty template engine (extended Translation version)
|
// smarty template engine (extended Translation version)
|
||||||
$smarty = new CoreLibs\Template\SmartyExtend();
|
$smarty = new CoreLibs\Template\SmartyExtend($l10n, $locale);
|
||||||
|
|
||||||
// $form->log->debug('POST', $form->log->prAr($_POST));
|
// $form->log->debug('POST', $form->log->prAr($_POST));
|
||||||
|
|
||||||
@@ -437,16 +446,15 @@ if ($form->my_page_name == 'edit_order') {
|
|||||||
$t_q = '';
|
$t_q = '';
|
||||||
foreach ($output as $output_file) {
|
foreach ($output as $output_file) {
|
||||||
// split the ouput into folder and file
|
// split the ouput into folder and file
|
||||||
// eg ../admin/test.php is ../admin/ and test.php
|
$pathinfo = pathinfo($output_file);
|
||||||
preg_match("/([\.\/\w]+\/)+(\w+\.\w{1,})$/", $output_file, $matches);
|
if (!empty($pathinfo['dirname'])) {
|
||||||
// if named config.php, skip
|
$pathinfo['dirname'] .= DIRECTORY_SEPARATOR;
|
||||||
if ($matches[2] != 'config.php') {
|
|
||||||
if ($t_q) {
|
|
||||||
$t_q .= ', ';
|
|
||||||
}
|
|
||||||
$t_q .= "('" . $form->dbEscapeString($matches[1]) . "', '"
|
|
||||||
. $form->dbEscapeString($matches[2]) . "')";
|
|
||||||
}
|
}
|
||||||
|
if ($t_q) {
|
||||||
|
$t_q .= ', ';
|
||||||
|
}
|
||||||
|
$t_q .= "('" . $form->dbEscapeString($pathinfo['dirname']) . "', '"
|
||||||
|
. $form->dbEscapeString($pathinfo['basename']) . "')";
|
||||||
}
|
}
|
||||||
$form->dbExec($q . $t_q, 'NULL');
|
$form->dbExec($q . $t_q, 'NULL');
|
||||||
$elements[] = $form->formCreateElement('filename');
|
$elements[] = $form->formCreateElement('filename');
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
BIN
www/includes/locale/en/LC_MESSAGES/admin.mo
Normal file
BIN
www/includes/locale/en/LC_MESSAGES/admin.mo
Normal file
Binary file not shown.
BIN
www/includes/locale/en/LC_MESSAGES/frontend.mo
Normal file
BIN
www/includes/locale/en/LC_MESSAGES/frontend.mo
Normal file
Binary file not shown.
BIN
www/includes/locale/ja/LC_MESSAGES/admin.mo
Normal file
BIN
www/includes/locale/ja/LC_MESSAGES/admin.mo
Normal file
Binary file not shown.
BIN
www/includes/locale/ja/LC_MESSAGES/frontend.mo
Normal file
BIN
www/includes/locale/ja/LC_MESSAGES/frontend.mo
Normal file
Binary file not shown.
@@ -33,26 +33,26 @@ function pop(theURL, winName, features) {
|
|||||||
<!-- ERROR MSG END //-->
|
<!-- ERROR MSG END //-->
|
||||||
<!-- TOP MENU START //-->
|
<!-- TOP MENU START //-->
|
||||||
<tr>
|
<tr>
|
||||||
<td width="{$table_width}" class="menu_bgcolor" valign="top">
|
<td width="{$table_width}" class="menu_bgcolor" valign="top">
|
||||||
<table width="100%" border="0" cellpadding="2" cellspacing="1">
|
<table width="100%" border="0" cellpadding="2" cellspacing="1">
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<tr>
|
<tr>
|
||||||
<td bgcolor="{$HEADER_COLOR}" class="normal">
|
<td bgcolor="{$HEADER_COLOR}" class="normal">
|
||||||
Hello <b>{$USER_NAME|upper}</b> [{$EUID}] from the group <b>{$GROUP_NAME}</b> with Access Level <b>{$GROUP_LEVEL}</b>
|
Hello <b>{$USER_NAME|upper}</b> [{$EUID}] from the group <b>{$GROUP_NAME}</b> with Access Level <b>{$GROUP_LEVEL}</b>
|
||||||
</td>
|
</td>
|
||||||
<td bgcolor="{$HEADER_COLOR}" class="normal" align="right">
|
<td bgcolor="{$HEADER_COLOR}" class="normal" align="right">
|
||||||
<input type="submit" name="login_logout" value="Logout">
|
<input type="submit" name="login_logout" value="Logout">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</form>
|
</form>
|
||||||
</table>
|
</table>
|
||||||
<table width="100%" border="0" cellpadding="2" cellspacing="1">
|
<table width="100%" border="0" cellpadding="2" cellspacing="1">
|
||||||
<tr>
|
<tr>
|
||||||
{* foreach menu *}
|
{* foreach menu *}
|
||||||
{foreach from=$menu_data item=menu_element}
|
{foreach from=$menu_data item=menu_element}
|
||||||
{* if split factor is reached *}
|
{* if split factor is reached *}
|
||||||
{if $menu_element.splitfactor_in}
|
{if $menu_element.splitfactor_in}
|
||||||
<td class="menu_fgcolor" class="small" valign="top">
|
<td class="menu_fgcolor" class="small" valign="top">
|
||||||
{/if}
|
{/if}
|
||||||
{if $menu_element.position}
|
{if $menu_element.position}
|
||||||
<b><a href="{$menu_element.filename}">{$menu_element.pagename}</a></b><br>
|
<b><a href="{$menu_element.filename}">{$menu_element.pagename}</a></b><br>
|
||||||
@@ -67,22 +67,22 @@ function pop(theURL, winName, features) {
|
|||||||
</td>
|
</td>
|
||||||
{/if}
|
{/if}
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<table width="100%" border="0" cellpadding="10" cellspacing="1">
|
<table width="100%" border="0" cellpadding="10" cellspacing="1">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="edit_fgcolor_alt" class="headline" align="center">
|
<td class="edit_fgcolor_alt" class="headline" align="center">
|
||||||
{$page_name}
|
{$page_name}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- TOP MENU END //-->
|
<!-- TOP MENU END //-->
|
||||||
<tr>
|
<tr>
|
||||||
<td width="{$table_width}" class="edit_bgcolor">
|
<td width="{$table_width}" class="edit_bgcolor">
|
||||||
<form method="post" name="edit_form" style="margin-block-end: 0em;">
|
<form method="post" name="edit_form" style="margin-block-end: 0em;">
|
||||||
<table width="100%" border="0" cellpadding="2" cellspacing="1">
|
<table width="100%" border="0" cellpadding="2" cellspacing="1">
|
||||||
<!-- LOAD START //-->
|
<!-- LOAD START //-->
|
||||||
{include file="edit_load.tpl"}
|
{include file="edit_load.tpl"}
|
||||||
<!-- LOAD END //-->
|
<!-- LOAD END //-->
|
||||||
@@ -93,23 +93,23 @@ function pop(theURL, winName, features) {
|
|||||||
{if $form_yes}
|
{if $form_yes}
|
||||||
{include file="edit_save_delete.tpl"}
|
{include file="edit_save_delete.tpl"}
|
||||||
{if $form_my_page_name == "edit_pages" && $filename_exist}
|
{if $form_my_page_name == "edit_pages" && $filename_exist}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="edit_fgcolor" class="normal">
|
<td class="edit_fgcolor" class="normal">
|
||||||
Filename:
|
Filename:
|
||||||
</td>
|
</td>
|
||||||
<td class="edit_fgcolor" class="normal">
|
<td class="edit_fgcolor" class="normal">
|
||||||
{$filename}
|
{$filename}
|
||||||
<input type="hidden" name="filename" value="{$filename}">
|
<input type="hidden" name="filename" value="{$filename}">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/if}
|
{/if}
|
||||||
{include file="edit_elements.tpl"}
|
{include file="edit_elements.tpl"}
|
||||||
{include file="edit_hidden.tpl"}
|
{include file="edit_hidden.tpl"}
|
||||||
{include file="edit_save_delete.tpl"}
|
{include file="edit_save_delete.tpl"}
|
||||||
{/if}
|
{/if}
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -8,16 +8,16 @@
|
|||||||
********************************************************************
|
********************************************************************
|
||||||
*}
|
*}
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="edit_fgcolor_alt" class="normal">
|
<td class="edit_fgcolor_alt" class="normal">
|
||||||
{t}Create new media:{/t}
|
{t}Create new media:{/t}
|
||||||
</td>
|
</td>
|
||||||
<td class="edit_fgcolor_alt" class="normal">
|
<td class="edit_fgcolor_alt" class="normal">
|
||||||
{if $new.show_checkbox}
|
{if $new.show_checkbox}
|
||||||
<input type="checkbox" name="really_new" value="yes"> {t}really{/t}
|
<input type="checkbox" name="really_new" value="yes"> {t}really{/t}
|
||||||
{else}
|
{else}
|
||||||
<input type="hidden" name="really_new" value="yes">
|
<input type="hidden" name="really_new" value="yes">
|
||||||
{/if}
|
{/if}
|
||||||
<input type="submit" name="new" value="{$new.new_name}">
|
<input type="submit" name="new" value="{$new.new_name}">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
<!-- ERROR MSG END //-->
|
<!-- ERROR MSG END //-->
|
||||||
<!-- BODY START //-->
|
<!-- BODY START //-->
|
||||||
<tr>
|
<tr>
|
||||||
<td class="edit_bgcolor">
|
<td class="edit_bgcolor">
|
||||||
<table width="100%" border="0" cellpadding="2" cellspacing="1">
|
<table width="100%" border="0" cellpadding="2" cellspacing="1">
|
||||||
<!-- ANFANG Neu //-->
|
<!-- ANFANG Neu //-->
|
||||||
<form method="post" enctype="multipart/form-data">
|
<form method="post" enctype="multipart/form-data">
|
||||||
@@ -68,7 +68,7 @@
|
|||||||
</form>
|
</form>
|
||||||
<!-- ENDE FOOTER //-->
|
<!-- ENDE FOOTER //-->
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- BODY END //-->
|
<!-- BODY END //-->
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
<input type="submit" name="delete" value="{t}Delete{/t}">
|
<input type="submit" name="delete" value="{t}Delete{/t}">
|
||||||
{else}
|
{else}
|
||||||
<td class="edit_fgcolor_alt" class="normal">
|
<td class="edit_fgcolor_alt" class="normal">
|
||||||
|
|
||||||
{/if}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -1,16 +1,33 @@
|
|||||||
<div>
|
<div>
|
||||||
{$SMARTY_TEST}
|
SMARTY_TEST: {$SMARTY_TEST}
|
||||||
|
</div>
|
||||||
|
<div {popup width="250" caption="Info" text="Text block<br>Control"} style="border: 1px solid black; margin: 5px 0 5px 0; padding: 5px;">
|
||||||
|
POPUP HERE (hover mouse)
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
TRANSLATION CLASS (OUT): {$TRANSLATE_TEST}
|
<b>Outside translation test</b><br>
|
||||||
|
TRANSLATION CLASS (OUT): {$TRANSLATE_TEST}<br>
|
||||||
|
TRANSLATION CLASS (OUT FUNCTION): {$TRANSLATE_TEST_FUNCTION}<br>
|
||||||
|
TRANSLATION CLASS (SMARTY): {$TRANSLATE_TEST_SMARTY}<br>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
TRANSLATION CLASS (SMARTY): {$TRANSLATE_TEST_SMARTY}
|
<b>Translate Test with replace:</b><br>
|
||||||
|
ORIGINAL: Original with string: %1 ({$replace})<br>
|
||||||
|
TRANSLATED: {t 1=$replace}Original with string: %1{/t}<br>
|
||||||
|
TRANSLATED (escape): {t escape=on 1=$replace}Original with string: %1{/t}<br>
|
||||||
|
{capture assign="extra_title"}{t}INPUT TEST{/t}{/capture}
|
||||||
|
Capture test: {$extra_title}<br>
|
||||||
|
{section name=plural_test start=0 loop=3}
|
||||||
|
Plural test {$smarty.section.plural_test.index}: {t count=$smarty.section.plural_test.index plural="multi"}single{/t}<br>
|
||||||
|
{/section}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<select id="drop_down_test" name="drop_down_test">
|
<b>Variable variables:</b><br>
|
||||||
{html_options options=$drop_down_test selected=$drop_down_test_selected}
|
Test: {$test}<br>
|
||||||
</select>
|
Foo: {$foo}<br>
|
||||||
|
{assign var="bar" value="test"}
|
||||||
|
vFoo ($test = $foo = bar): {$test|getvar}<br>
|
||||||
|
vFoo ($bar = $test = foo): {$bar|getvar}
|
||||||
</div>
|
</div>
|
||||||
<div class="jq-container">
|
<div class="jq-container">
|
||||||
<div id="jq-test" class="jp-test">
|
<div id="jq-test" class="jp-test">
|
||||||
@@ -23,11 +40,30 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="loop-test">
|
<div class="loop-test">
|
||||||
<div>LOOP TEST</div>
|
<div><b>LOOP TEST</b></div>
|
||||||
{section name=page_list start=1 loop=$loop_start+1}
|
{section name=page_list start=1 loop=$loop_start+1}
|
||||||
<div>LOOP OUTPUT: {$smarty.section.page_list.index}</div>
|
<div>LOOP OUTPUT: {$smarty.section.page_list.index}</div>
|
||||||
{/section}
|
{/section}
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<select id="drop_down_test" name="drop_down_test">
|
||||||
|
{html_options options=$drop_down_test selected=$drop_down_test_selected}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<select id="drop_down_test_nested" name="drop_down_test_nested">
|
||||||
|
{html_options options=$drop_down_test_nested selected=$drop_down_test_nested_selected}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{html_radios name="radio_test" options=$radio_test selected=$radio_test_selected}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{html_checkboxes name="checkbox_test" options=$checkbox_test selected=$checkbox_test_selected}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{html_checkboxes name="checkbox_test_pos" options=$checkbox_test selected=$checkbox_test_pos_selected pos=$checkbox_test_pos}
|
||||||
|
</div>
|
||||||
{* progresss indicator *}
|
{* progresss indicator *}
|
||||||
<div id="indicator"></div>
|
<div id="indicator"></div>
|
||||||
{* the action confirm box *}
|
{* the action confirm box *}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user