Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
51e700cd10 | ||
|
|
71a431d5aa | ||
|
|
6970e6221b | ||
|
|
831f3be1a8 | ||
|
|
f2aba8c466 | ||
|
|
f085ccaa38 | ||
|
|
6c3c1a908d | ||
|
|
388b90913a | ||
|
|
07aea9d7b2 | ||
|
|
edcdbee523 | ||
|
|
43b51895f0 | ||
|
|
d0e294ecf5 | ||
|
|
3c35341e8b | ||
|
|
daf1f9263c | ||
|
|
805c695d68 | ||
|
|
ffdd45e32a | ||
|
|
316ca106fd | ||
|
|
fd9b201346 | ||
|
|
667dc4de8e |
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__
|
||||||
|
|||||||
@@ -2,8 +2,7 @@
|
|||||||
# AUTHOR: Clemens Schwaighofer
|
# AUTHOR: Clemens Schwaighofer
|
||||||
# CREATED: 2005/08/09
|
# CREATED: 2005/08/09
|
||||||
# SHORT DESCRIPTION:
|
# SHORT DESCRIPTION:
|
||||||
# Backned English Messages file for gettext
|
# Backend English Messages file for gettext
|
||||||
# to craete: msgfmt -o <output.po> <input.mo>
|
|
||||||
# ********************************************************************/
|
# ********************************************************************/
|
||||||
|
|
||||||
msgid ""
|
msgid ""
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
# to craete: msgfmt -o <output.po> <input.mo>
|
# ********************************************************************
|
||||||
|
# AUTHOR: Clemens Schwaighofer
|
||||||
|
# CREATED: 2005/08/09
|
||||||
|
# SHORT DESCRIPTION:
|
||||||
|
# Frontend English Messages file for gettext
|
||||||
|
# ********************************************************************/
|
||||||
|
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|||||||
@@ -2,8 +2,7 @@
|
|||||||
# 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 <output.po> <input.mo>
|
|
||||||
# ********************************************************************/
|
# ********************************************************************/
|
||||||
|
|
||||||
msgid ""
|
msgid ""
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
# to craete: msgfmt -o <output.po> <input.mo>
|
# ********************************************************************
|
||||||
|
# AUTHOR: Clemens Schwaighofer
|
||||||
|
# CREATED: 2005/08/09
|
||||||
|
# SHORT DESCRIPTION:
|
||||||
|
# Frontend Japanese Messages file for gettext
|
||||||
|
# ********************************************************************/
|
||||||
|
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -566,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],
|
||||||
@@ -599,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],
|
||||||
@@ -1734,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);
|
||||||
@@ -1871,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);
|
||||||
@@ -2034,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);
|
||||||
@@ -2356,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);
|
||||||
@@ -2709,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,
|
||||||
@@ -3009,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);
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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'
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,17 +22,36 @@ final class CoreLibsLanguageGetLocaleTest extends TestCase
|
|||||||
public static function setUpBeforeClass(): void
|
public static function setUpBeforeClass(): void
|
||||||
{
|
{
|
||||||
// default web page encoding setting
|
// default web page encoding setting
|
||||||
define('DEFAULT_ENCODING', 'UTF-8');
|
if (!defined('DEFAULT_ENCODING')) {
|
||||||
// default lang + encoding
|
define('DEFAULT_ENCODING', 'UTF-8');
|
||||||
define('DEFAULT_LOCALE', 'en_US.UTF-8');
|
}
|
||||||
|
if (!defined('DEFAULT_LOCALE')) {
|
||||||
|
// default lang + encoding
|
||||||
|
define('DEFAULT_LOCALE', 'en_US.UTF-8');
|
||||||
|
}
|
||||||
// site
|
// site
|
||||||
define('SITE_ENCODING', DEFAULT_ENCODING);
|
if (!defined('SITE_ENCODING')) {
|
||||||
define('SITE_LOCALE', DEFAULT_LOCALE);
|
define('SITE_ENCODING', DEFAULT_ENCODING);
|
||||||
|
}
|
||||||
|
if (!defined('SITE_LOCALE')) {
|
||||||
|
define('SITE_LOCALE', DEFAULT_LOCALE);
|
||||||
|
}
|
||||||
// just set
|
// just set
|
||||||
define('BASE', str_replace('/configs', '', __DIR__) . DIRECTORY_SEPARATOR);
|
if (!defined('BASE')) {
|
||||||
define('INCLUDES', 'includes' . DIRECTORY_SEPARATOR);
|
define('BASE', str_replace('/configs', '', __DIR__) . DIRECTORY_SEPARATOR);
|
||||||
define('LOCALE', 'locale' . DIRECTORY_SEPARATOR);
|
}
|
||||||
define('CONTENT_PATH', 'frontend' . 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
|
// array session
|
||||||
$_SESSION = [];
|
$_SESSION = [];
|
||||||
global $_SESSION;
|
global $_SESSION;
|
||||||
@@ -221,7 +240,7 @@ final class CoreLibsLanguageGetLocaleTest extends TestCase
|
|||||||
?string $path,
|
?string $path,
|
||||||
?string $SESSION_DEFAULT_LOCALE,
|
?string $SESSION_DEFAULT_LOCALE,
|
||||||
?string $SESSION_DEFAULT_CHARSET,
|
?string $SESSION_DEFAULT_CHARSET,
|
||||||
array $expected,
|
array $expected
|
||||||
): void {
|
): void {
|
||||||
$return_lang_settings = [];
|
$return_lang_settings = [];
|
||||||
global $_SESSION;
|
global $_SESSION;
|
||||||
|
|||||||
@@ -1,325 +0,0 @@
|
|||||||
<?php // phpcs:disable Generic.Files.LineLength
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace tests;
|
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test class for Language\GetSettings
|
|
||||||
*
|
|
||||||
* @coversDefaultClass \CoreLibs\Language\GetSettings
|
|
||||||
* @testdox \CoreLibs\Language\GetSettings method tests
|
|
||||||
*/
|
|
||||||
final class CoreLibsLanguageGetSettingsTest extends TestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* set all constant variables that must be set before call
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public static function setUpBeforeClass(): void
|
|
||||||
{
|
|
||||||
define('DEFAULT_LANG', 'en_US');
|
|
||||||
// default web page encoding setting
|
|
||||||
define('DEFAULT_ENCODING', 'UTF-8');
|
|
||||||
// default lang + encoding
|
|
||||||
define('DEFAULT_LOCALE', 'en_US.UTF-8');
|
|
||||||
// site
|
|
||||||
define('SITE_LANG', DEFAULT_LANG);
|
|
||||||
// just set
|
|
||||||
define('BASE', str_replace('/configs', '', __DIR__) . DIRECTORY_SEPARATOR);
|
|
||||||
define('INCLUDES', 'includes' . DIRECTORY_SEPARATOR);
|
|
||||||
define('LANG', 'lang' . DIRECTORY_SEPARATOR);
|
|
||||||
define('CONTENT_PATH', 'frontend' . DIRECTORY_SEPARATOR);
|
|
||||||
// array session
|
|
||||||
$_SESSION = [];
|
|
||||||
global $_SESSION;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* all the test data
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function setLangEncodingProvider(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
// 0: locale/lang
|
|
||||||
// 1: domain
|
|
||||||
// 2: path
|
|
||||||
// 3: SESSION DEFAULT_CHARSE
|
|
||||||
// 4: GLOBALS: OVERRIDE_LANG
|
|
||||||
// 5: SESSION: DEFAULT_LANG
|
|
||||||
// 6: expected array
|
|
||||||
'no params, all default constants' => [
|
|
||||||
// lang, domain, path
|
|
||||||
null, null, null,
|
|
||||||
// global set no session
|
|
||||||
// SESSION: DEFAULT_CHARSET, GLOBALS: OVERRIDE_LANG, SESSION: DEFAULT_LANG
|
|
||||||
null, null, null,
|
|
||||||
// return array
|
|
||||||
[
|
|
||||||
0 => 'UTF-8',
|
|
||||||
1 => 'en_US',
|
|
||||||
2 => 'en',
|
|
||||||
3 => 'frontend',
|
|
||||||
4 => "/^\/(.*\/)?includes\/lang\/frontend\/$/",
|
|
||||||
'encoding' => 'UTF-8',
|
|
||||||
'lang' => 'en_US',
|
|
||||||
'lang_short' => 'en',
|
|
||||||
'domain' => 'frontend',
|
|
||||||
'path' => "/^\/(.*\/)?includes\/lang\/frontend\/$/",
|
|
||||||
],
|
|
||||||
],
|
|
||||||
'no params, session charset and lang' => [
|
|
||||||
// lang, domain, path
|
|
||||||
null, null, null,
|
|
||||||
// global set no session
|
|
||||||
// SESSION: DEFAULT_CHARSET, GLOBALS: OVERRIDE_LANG, SESSION: DEFAULT_LANG
|
|
||||||
'UTF-8', null, 'ja_JP',
|
|
||||||
// return array
|
|
||||||
[
|
|
||||||
0 => 'UTF-8',
|
|
||||||
1 => 'ja_JP',
|
|
||||||
2 => 'ja',
|
|
||||||
3 => 'frontend',
|
|
||||||
4 => "/^\/(.*\/)?includes\/lang\/frontend\/$/",
|
|
||||||
'encoding' => 'UTF-8',
|
|
||||||
'lang' => 'ja_JP',
|
|
||||||
'lang_short' => 'ja',
|
|
||||||
'domain' => 'frontend',
|
|
||||||
'path' => "/^\/(.*\/)?includes\/lang\/frontend\/$/",
|
|
||||||
],
|
|
||||||
],
|
|
||||||
'no params, session charset and lang short' => [
|
|
||||||
// lang, domain, path
|
|
||||||
null, null, null,
|
|
||||||
// global set no session
|
|
||||||
// SESSION: DEFAULT_CHARSET, GLOBALS: OVERRIDE_LANG, SESSION: DEFAULT_LANG
|
|
||||||
'UTF-8', null, 'ja',
|
|
||||||
// return array
|
|
||||||
[
|
|
||||||
0 => 'UTF-8',
|
|
||||||
1 => 'ja',
|
|
||||||
2 => 'ja',
|
|
||||||
3 => 'frontend',
|
|
||||||
4 => "/^\/(.*\/)?includes\/lang\/frontend\/$/",
|
|
||||||
'encoding' => 'UTF-8',
|
|
||||||
'lang' => 'ja',
|
|
||||||
'lang_short' => 'ja',
|
|
||||||
'domain' => 'frontend',
|
|
||||||
'path' => "/^\/(.*\/)?includes\/lang\/frontend\/$/",
|
|
||||||
],
|
|
||||||
],
|
|
||||||
// globals override lang
|
|
||||||
'no params, session charset and lang, default lang override' => [
|
|
||||||
// lang, domain, path
|
|
||||||
null, null, null,
|
|
||||||
// global set no session
|
|
||||||
// SESSION: DEFAULT_CHARSET, GLOBALS: OVERRIDE_LANG, SESSION: DEFAULT_LANG
|
|
||||||
'UTF-8', 'en_US', 'ja_JP',
|
|
||||||
// return array
|
|
||||||
[
|
|
||||||
0 => 'UTF-8',
|
|
||||||
1 => 'en_US',
|
|
||||||
2 => 'en',
|
|
||||||
3 => 'frontend',
|
|
||||||
4 => "/^\/(.*\/)?includes\/lang\/frontend\/$/",
|
|
||||||
'encoding' => 'UTF-8',
|
|
||||||
'lang' => 'en_US',
|
|
||||||
'lang_short' => 'en',
|
|
||||||
'domain' => 'frontend',
|
|
||||||
'path' => "/^\/(.*\/)?includes\/lang\/frontend\/$/",
|
|
||||||
],
|
|
||||||
],
|
|
||||||
// globals override lang short
|
|
||||||
'no params, session charset and lang, default lang short override' => [
|
|
||||||
// lang, domain, path
|
|
||||||
null, null, null,
|
|
||||||
// global set no session
|
|
||||||
// SESSION: DEFAULT_CHARSET, GLOBALS: OVERRIDE_LANG, SESSION: DEFAULT_LANG
|
|
||||||
'UTF-8', 'en', 'ja_JP',
|
|
||||||
// return array
|
|
||||||
[
|
|
||||||
0 => 'UTF-8',
|
|
||||||
1 => 'en',
|
|
||||||
2 => 'en',
|
|
||||||
3 => 'frontend',
|
|
||||||
4 => "/^\/(.*\/)?includes\/lang\/frontend\/$/",
|
|
||||||
'encoding' => 'UTF-8',
|
|
||||||
'lang' => 'en',
|
|
||||||
'lang_short' => 'en',
|
|
||||||
'domain' => 'frontend',
|
|
||||||
'path' => "/^\/(.*\/)?includes\/lang\/frontend\/$/",
|
|
||||||
],
|
|
||||||
],
|
|
||||||
// param lang (no override)
|
|
||||||
'locale param only, no override' => [
|
|
||||||
// lang, domain, path
|
|
||||||
'ja.UTF-8', null, null,
|
|
||||||
// global set no session
|
|
||||||
// SESSION: DEFAULT_CHARSET, GLOBALS: OVERRIDE_LANG, SESSION: DEFAULT_LANG
|
|
||||||
null, null, null,
|
|
||||||
// return array
|
|
||||||
[
|
|
||||||
0 => 'UTF-8',
|
|
||||||
1 => 'ja',
|
|
||||||
2 => 'ja',
|
|
||||||
3 => 'frontend',
|
|
||||||
4 => "/^\/(.*\/)?includes\/lang\/frontend\/$/",
|
|
||||||
'encoding' => 'UTF-8',
|
|
||||||
'lang' => 'ja',
|
|
||||||
'lang_short' => 'ja',
|
|
||||||
'domain' => 'frontend',
|
|
||||||
'path' => "/^\/(.*\/)?includes\/lang\/frontend\/$/",
|
|
||||||
],
|
|
||||||
],
|
|
||||||
// different locale setting
|
|
||||||
'locale complex param only, no override' => [
|
|
||||||
// lang, domain, path
|
|
||||||
'ja_JP.SJIS', null, null,
|
|
||||||
// global set no session
|
|
||||||
// SESSION: DEFAULT_CHARSET, GLOBALS: OVERRIDE_LANG, SESSION: DEFAULT_LANG
|
|
||||||
null, null, null,
|
|
||||||
// return array
|
|
||||||
[
|
|
||||||
0 => 'SJIS',
|
|
||||||
1 => 'ja_JP',
|
|
||||||
2 => 'ja',
|
|
||||||
3 => 'frontend',
|
|
||||||
4 => "/^\/(.*\/)?includes\/lang\/frontend\/$/",
|
|
||||||
'encoding' => 'SJIS',
|
|
||||||
'lang' => 'ja_JP',
|
|
||||||
'lang_short' => 'ja',
|
|
||||||
'domain' => 'frontend',
|
|
||||||
'path' => "/^\/(.*\/)?includes\/lang\/frontend\/$/",
|
|
||||||
],
|
|
||||||
],
|
|
||||||
// param lang and domain (no override)
|
|
||||||
'locale, domain params, no override' => [
|
|
||||||
// lang, domain, path
|
|
||||||
'ja.UTF-8', 'admin', null,
|
|
||||||
// global set no session
|
|
||||||
// SESSION: DEFAULT_CHARSET, GLOBALS: OVERRIDE_LANG, SESSION: DEFAULT_LANG
|
|
||||||
null, null, null,
|
|
||||||
// return array
|
|
||||||
[
|
|
||||||
0 => 'UTF-8',
|
|
||||||
1 => 'ja',
|
|
||||||
2 => 'ja',
|
|
||||||
3 => 'admin',
|
|
||||||
4 => "/^\/(.*\/)?includes\/lang\/frontend\/$/",
|
|
||||||
'encoding' => 'UTF-8',
|
|
||||||
'lang' => 'ja',
|
|
||||||
'lang_short' => 'ja',
|
|
||||||
'domain' => 'admin',
|
|
||||||
'path' => "/^\/(.*\/)?includes\/lang\/frontend\/$/",
|
|
||||||
],
|
|
||||||
],
|
|
||||||
// all params set (no override)
|
|
||||||
'all params, no override' => [
|
|
||||||
// lang, domain, path
|
|
||||||
'ja.UTF-8', 'admin', __DIR__ . '/locale_other/',
|
|
||||||
// global set no session
|
|
||||||
// SESSION: DEFAULT_CHARSET, GLOBALS: OVERRIDE_LANG, SESSION: DEFAULT_LANG
|
|
||||||
null, null, null,
|
|
||||||
// return array
|
|
||||||
[
|
|
||||||
0 => 'UTF-8',
|
|
||||||
1 => 'ja',
|
|
||||||
2 => 'ja',
|
|
||||||
3 => 'admin',
|
|
||||||
4 => "/^\/(.*\/)?locale_other\/$/",
|
|
||||||
'encoding' => 'UTF-8',
|
|
||||||
'lang' => 'ja',
|
|
||||||
'lang_short' => 'ja',
|
|
||||||
'domain' => 'admin',
|
|
||||||
'path' => "/^\/(.*\/)?locale_other\/$/",
|
|
||||||
],
|
|
||||||
],
|
|
||||||
// TODO invalid params (bad path) (no override)
|
|
||||||
// TODO param calls, but with override set
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Undocumented function
|
|
||||||
*
|
|
||||||
* @covers ::setLangEncoding
|
|
||||||
* @dataProvider setLangEncodingProvider
|
|
||||||
* @testdox lang settings lang $language, domain $domain, path $path; null session char: $SESSION_DEFAULT_CHARSET, null global lang: $GLOBAL_OVERRIDE_LANG, null session lang: $SESSION_DEFAULT_LANG [$_dataName]
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testSetLangEncoding(
|
|
||||||
?string $language,
|
|
||||||
?string $domain,
|
|
||||||
?string $path,
|
|
||||||
?string $SESSION_DEFAULT_CHARSET,
|
|
||||||
?string $GLOBAL_OVERRIDE_LANG,
|
|
||||||
?string $SESSION_DEFAULT_LANG,
|
|
||||||
array $expected,
|
|
||||||
): void {
|
|
||||||
$return_lang_settings = [];
|
|
||||||
global $_SESSION;
|
|
||||||
// set override
|
|
||||||
if ($SESSION_DEFAULT_CHARSET !== null) {
|
|
||||||
$_SESSION['DEFAULT_CHARSET'] = $SESSION_DEFAULT_CHARSET;
|
|
||||||
}
|
|
||||||
if ($GLOBAL_OVERRIDE_LANG !== null) {
|
|
||||||
$GLOBALS['OVERRIDE_LANG'] = $GLOBAL_OVERRIDE_LANG;
|
|
||||||
}
|
|
||||||
if ($SESSION_DEFAULT_LANG !== null) {
|
|
||||||
$_SESSION['DEFAULT_LANG'] = $SESSION_DEFAULT_LANG;
|
|
||||||
}
|
|
||||||
// function call
|
|
||||||
if ($language === null && $domain === null && $path === null) {
|
|
||||||
$return_lang_settings = \CoreLibs\Language\GetSettings::setLangEncoding();
|
|
||||||
} elseif ($language !== null && $domain === null && $path === null) {
|
|
||||||
$return_lang_settings = \CoreLibs\Language\GetSettings::setLangEncoding(
|
|
||||||
$language
|
|
||||||
);
|
|
||||||
} elseif ($language !== null && $domain !== null && $path === null) {
|
|
||||||
$return_lang_settings = \CoreLibs\Language\GetSettings::setLangEncoding(
|
|
||||||
$language,
|
|
||||||
$domain
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
$return_lang_settings = \CoreLibs\Language\GetSettings::setLangEncoding(
|
|
||||||
$language,
|
|
||||||
$domain,
|
|
||||||
$path
|
|
||||||
);
|
|
||||||
}
|
|
||||||
// print "RETURN: " . print_r($return_lang_settings, true) . "\n";
|
|
||||||
|
|
||||||
foreach (
|
|
||||||
[
|
|
||||||
0, 1, 2, 3, 4,
|
|
||||||
'encoding', 'lang', 'lang_short', 'domain', 'path'
|
|
||||||
] as $key
|
|
||||||
) {
|
|
||||||
$value = $expected[$key];
|
|
||||||
if (strpos($value, "/") === 0) {
|
|
||||||
// this is regex
|
|
||||||
$this->assertMatchesRegularExpression(
|
|
||||||
$value,
|
|
||||||
$return_lang_settings[$key]
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
// assert equal
|
|
||||||
$this->assertEquals(
|
|
||||||
$value,
|
|
||||||
$return_lang_settings[$key],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// unset all vars
|
|
||||||
$_SESSION = [];
|
|
||||||
unset($GLOBALS['OVERRIDE_LANG']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// __END__
|
|
||||||
@@ -22,19 +22,37 @@ final class CoreLibsLanguageL10nTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public static function setUpBeforeClass(): void
|
public static function setUpBeforeClass(): void
|
||||||
{
|
{
|
||||||
define('DEFAULT_LANG', 'en_US');
|
|
||||||
// default web page encoding setting
|
// default web page encoding setting
|
||||||
define('DEFAULT_ENCODING', 'UTF-8');
|
if (!defined('DEFAULT_ENCODING')) {
|
||||||
// default lang + encoding
|
define('DEFAULT_ENCODING', 'UTF-8');
|
||||||
define('DEFAULT_LOCALE', 'en_US.UTF-8');
|
}
|
||||||
|
if (!defined('DEFAULT_LOCALE')) {
|
||||||
|
// default lang + encoding
|
||||||
|
define('DEFAULT_LOCALE', 'en_US.UTF-8');
|
||||||
|
}
|
||||||
// site
|
// site
|
||||||
define('SITE_LANG', DEFAULT_LANG);
|
if (!defined('SITE_ENCODING')) {
|
||||||
|
define('SITE_ENCODING', DEFAULT_ENCODING);
|
||||||
|
}
|
||||||
|
if (!defined('SITE_LOCALE')) {
|
||||||
|
define('SITE_LOCALE', DEFAULT_LOCALE);
|
||||||
|
}
|
||||||
// just set
|
// just set
|
||||||
define('BASE', str_replace('/configs', '', __DIR__) . DIRECTORY_SEPARATOR);
|
if (!defined('BASE')) {
|
||||||
define('INCLUDES', 'includes' . DIRECTORY_SEPARATOR);
|
define('BASE', str_replace('/configs', '', __DIR__) . DIRECTORY_SEPARATOR);
|
||||||
define('LANG', 'lang' . DIRECTORY_SEPARATOR);
|
}
|
||||||
define('LOCALE', 'locale' . DIRECTORY_SEPARATOR);
|
if (!defined('INCLUDES')) {
|
||||||
define('CONTENT_PATH', 'frontend' . DIRECTORY_SEPARATOR);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -91,10 +109,11 @@ final class CoreLibsLanguageL10nTest extends TestCase
|
|||||||
// 2: encoding
|
// 2: encoding
|
||||||
// 3: path
|
// 3: path
|
||||||
// 4: locale expected
|
// 4: locale expected
|
||||||
// 5: domain exepcted
|
// 5: locale set expected
|
||||||
// 6: context (null for none)
|
// 6: domain exepcted
|
||||||
// 7: test string in
|
// 7: context (null for none)
|
||||||
// 8: test translated
|
// 8: test string in
|
||||||
|
// 9: test translated
|
||||||
// new style load
|
// new style load
|
||||||
'gettext load en' => [
|
'gettext load en' => [
|
||||||
'en_US.UTF-8',
|
'en_US.UTF-8',
|
||||||
@@ -102,6 +121,7 @@ final class CoreLibsLanguageL10nTest extends TestCase
|
|||||||
__DIR__ . 'includes/locale/',
|
__DIR__ . 'includes/locale/',
|
||||||
//
|
//
|
||||||
'en_US.UTF-8',
|
'en_US.UTF-8',
|
||||||
|
'en_US',
|
||||||
'frontend',
|
'frontend',
|
||||||
null,
|
null,
|
||||||
'Original',
|
'Original',
|
||||||
@@ -113,6 +133,7 @@ final class CoreLibsLanguageL10nTest extends TestCase
|
|||||||
__DIR__ . 'includes/locale/',
|
__DIR__ . 'includes/locale/',
|
||||||
//
|
//
|
||||||
'en_US.UTF-8',
|
'en_US.UTF-8',
|
||||||
|
'en_US',
|
||||||
'frontend',
|
'frontend',
|
||||||
'context',
|
'context',
|
||||||
'Original',
|
'Original',
|
||||||
@@ -124,6 +145,7 @@ final class CoreLibsLanguageL10nTest extends TestCase
|
|||||||
__DIR__ . 'includes/locale/',
|
__DIR__ . 'includes/locale/',
|
||||||
//
|
//
|
||||||
'ja_JP.UTF-8',
|
'ja_JP.UTF-8',
|
||||||
|
'ja_JP',
|
||||||
'admin',
|
'admin',
|
||||||
null,
|
null,
|
||||||
'Original',
|
'Original',
|
||||||
@@ -136,6 +158,7 @@ final class CoreLibsLanguageL10nTest extends TestCase
|
|||||||
'frontend',
|
'frontend',
|
||||||
//
|
//
|
||||||
'en_US.UTF-8',
|
'en_US.UTF-8',
|
||||||
|
'en_US',
|
||||||
'frontend',
|
'frontend',
|
||||||
'context',
|
'context',
|
||||||
'Original',
|
'Original',
|
||||||
@@ -149,6 +172,7 @@ final class CoreLibsLanguageL10nTest extends TestCase
|
|||||||
//
|
//
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
|
'',
|
||||||
null,
|
null,
|
||||||
'Original',
|
'Original',
|
||||||
'Original',
|
'Original',
|
||||||
@@ -167,6 +191,7 @@ final class CoreLibsLanguageL10nTest extends TestCase
|
|||||||
* @param string|null $domain
|
* @param string|null $domain
|
||||||
* @param string|null $path
|
* @param string|null $path
|
||||||
* @param string $locale_expected
|
* @param string $locale_expected
|
||||||
|
* @param string $locale_set_expected
|
||||||
* @param string $domain_expected
|
* @param string $domain_expected
|
||||||
* @param ?string $context
|
* @param ?string $context
|
||||||
* @param string $original
|
* @param string $original
|
||||||
@@ -178,10 +203,11 @@ final class CoreLibsLanguageL10nTest extends TestCase
|
|||||||
?string $domain,
|
?string $domain,
|
||||||
?string $path,
|
?string $path,
|
||||||
string $locale_expected,
|
string $locale_expected,
|
||||||
|
string $locale_set_expected,
|
||||||
string $domain_expected,
|
string $domain_expected,
|
||||||
?string $context,
|
?string $context,
|
||||||
string $original,
|
string $original,
|
||||||
string $translated,
|
string $translated
|
||||||
): void {
|
): void {
|
||||||
if ($locale === null) {
|
if ($locale === null) {
|
||||||
$l10n = new \CoreLibs\Language\L10n();
|
$l10n = new \CoreLibs\Language\L10n();
|
||||||
@@ -199,6 +225,11 @@ final class CoreLibsLanguageL10nTest extends TestCase
|
|||||||
$l10n->getLocale(),
|
$l10n->getLocale(),
|
||||||
'Locale assert failed'
|
'Locale assert failed'
|
||||||
);
|
);
|
||||||
|
$this->assertEquals(
|
||||||
|
$locale_set_expected,
|
||||||
|
$l10n->getLocaleSet(),
|
||||||
|
'Locale set assert failed'
|
||||||
|
);
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
$domain_expected,
|
$domain_expected,
|
||||||
$l10n->getDomain(),
|
$l10n->getDomain(),
|
||||||
@@ -237,15 +268,17 @@ final class CoreLibsLanguageL10nTest extends TestCase
|
|||||||
// 3: load error
|
// 3: load error
|
||||||
// 4: input string to translated
|
// 4: input string to translated
|
||||||
// 5: expected locale
|
// 5: expected locale
|
||||||
// 6: expected domain
|
// 6: expected locale set
|
||||||
// 7: expected translation
|
// 7: expected domain
|
||||||
// 8: change locale
|
// 8: expected translation
|
||||||
// 9: change domain
|
// 9: change locale
|
||||||
// 10: change path
|
// 10: change domain
|
||||||
// 11: change load error
|
// 11: change path
|
||||||
// 12: expected locale
|
// 12: change load error
|
||||||
// 13: expected domain
|
// 13: expected locale
|
||||||
// 14: expected translation
|
// 14: expected locale set
|
||||||
|
// 15: expected domain
|
||||||
|
// 16: expected translation
|
||||||
'load and change (en->ja)' => [
|
'load and change (en->ja)' => [
|
||||||
// set 0-2
|
// set 0-2
|
||||||
'en_US.UTF-8',
|
'en_US.UTF-8',
|
||||||
@@ -257,6 +290,7 @@ final class CoreLibsLanguageL10nTest extends TestCase
|
|||||||
'Original',
|
'Original',
|
||||||
// check setter 5-7
|
// check setter 5-7
|
||||||
'en_US.UTF-8',
|
'en_US.UTF-8',
|
||||||
|
'en_US',
|
||||||
'frontend',
|
'frontend',
|
||||||
'Translated frontend en_US',
|
'Translated frontend en_US',
|
||||||
// set new 8-10
|
// set new 8-10
|
||||||
@@ -267,6 +301,7 @@ final class CoreLibsLanguageL10nTest extends TestCase
|
|||||||
false,
|
false,
|
||||||
// check new setter 12-14
|
// check new setter 12-14
|
||||||
'ja_JP.UTF-8',
|
'ja_JP.UTF-8',
|
||||||
|
'ja_JP',
|
||||||
'frontend',
|
'frontend',
|
||||||
'Translated frontend ja_JP',
|
'Translated frontend ja_JP',
|
||||||
],
|
],
|
||||||
@@ -282,6 +317,7 @@ final class CoreLibsLanguageL10nTest extends TestCase
|
|||||||
// check setter 5-7
|
// check setter 5-7
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
|
'',
|
||||||
'Original',
|
'Original',
|
||||||
// set new 8-10
|
// set new 8-10
|
||||||
'en_US.UTF-8',
|
'en_US.UTF-8',
|
||||||
@@ -291,6 +327,7 @@ final class CoreLibsLanguageL10nTest extends TestCase
|
|||||||
false,
|
false,
|
||||||
// check new setter 12-14
|
// check new setter 12-14
|
||||||
'en_US.UTF-8',
|
'en_US.UTF-8',
|
||||||
|
'en_US',
|
||||||
'frontend',
|
'frontend',
|
||||||
'Translated frontend en_US',
|
'Translated frontend en_US',
|
||||||
]
|
]
|
||||||
@@ -311,12 +348,14 @@ final class CoreLibsLanguageL10nTest extends TestCase
|
|||||||
* @param bool $load_error
|
* @param bool $load_error
|
||||||
* @param string $original
|
* @param string $original
|
||||||
* @param string $locale_expected_a
|
* @param string $locale_expected_a
|
||||||
|
* @param string $locale_set_expected_a
|
||||||
* @param string $domain_expected_a
|
* @param string $domain_expected_a
|
||||||
* @param string $translated_a
|
* @param string $translated_a
|
||||||
* @param string|null $locale_new
|
* @param string|null $locale_new
|
||||||
* @param string|null $domain_new
|
* @param string|null $domain_new
|
||||||
* @param string|null $path_new
|
* @param string|null $path_new
|
||||||
* @param bool $load_error_new
|
* @param bool $load_error_new
|
||||||
|
* @param string $locale_set_expected_b
|
||||||
* @param string $locale_expected_b
|
* @param string $locale_expected_b
|
||||||
* @param string $domain_expected_b
|
* @param string $domain_expected_b
|
||||||
* @param string $translated_b
|
* @param string $translated_b
|
||||||
@@ -333,6 +372,7 @@ final class CoreLibsLanguageL10nTest extends TestCase
|
|||||||
string $original,
|
string $original,
|
||||||
// 5-7
|
// 5-7
|
||||||
string $locale_expected_a,
|
string $locale_expected_a,
|
||||||
|
string $locale_set_expected_a,
|
||||||
string $domain_expected_a,
|
string $domain_expected_a,
|
||||||
string $translated_a,
|
string $translated_a,
|
||||||
// 8-10
|
// 8-10
|
||||||
@@ -343,8 +383,9 @@ final class CoreLibsLanguageL10nTest extends TestCase
|
|||||||
bool $load_error_new,
|
bool $load_error_new,
|
||||||
// 12-14
|
// 12-14
|
||||||
string $locale_expected_b,
|
string $locale_expected_b,
|
||||||
|
string $locale_set_expected_b,
|
||||||
string $domain_expected_b,
|
string $domain_expected_b,
|
||||||
string $translated_b,
|
string $translated_b
|
||||||
): void {
|
): void {
|
||||||
if ($locale === null) {
|
if ($locale === null) {
|
||||||
$l10n = new \CoreLibs\Language\L10n();
|
$l10n = new \CoreLibs\Language\L10n();
|
||||||
@@ -366,6 +407,10 @@ final class CoreLibsLanguageL10nTest extends TestCase
|
|||||||
$locale_expected_a,
|
$locale_expected_a,
|
||||||
$l10n->getLocale(),
|
$l10n->getLocale(),
|
||||||
'Locale init assert failed'
|
'Locale init assert failed'
|
||||||
|
);$this->assertEquals(
|
||||||
|
$locale_set_expected_a,
|
||||||
|
$l10n->getLocaleSet(),
|
||||||
|
'Locale Set init assert failed'
|
||||||
);
|
);
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
$domain_expected_a,
|
$domain_expected_a,
|
||||||
@@ -417,6 +462,11 @@ final class CoreLibsLanguageL10nTest extends TestCase
|
|||||||
$l10n->getLocale(),
|
$l10n->getLocale(),
|
||||||
'Locale change assert failed'
|
'Locale change assert failed'
|
||||||
);
|
);
|
||||||
|
$this->assertEquals(
|
||||||
|
$locale_set_expected_b,
|
||||||
|
$l10n->getLocaleSet(),
|
||||||
|
'Locale Set change assert failed'
|
||||||
|
);
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
$domain_expected_b,
|
$domain_expected_b,
|
||||||
$l10n->getDomain(),
|
$l10n->getDomain(),
|
||||||
@@ -527,7 +577,7 @@ final class CoreLibsLanguageL10nTest extends TestCase
|
|||||||
} else {
|
} else {
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
$expected,
|
$expected,
|
||||||
$l10n->__pn($context, $original_single, $original_plural, $n),
|
$l10n->__np($context, $original_single, $original_plural, $n),
|
||||||
'assert failed for plural: ' . $n . ' in context: ' . $context
|
'assert failed for plural: ' . $n . ' in context: ' . $context
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -713,7 +763,7 @@ final class CoreLibsLanguageL10nTest extends TestCase
|
|||||||
string $type,
|
string $type,
|
||||||
string $var,
|
string $var,
|
||||||
string $value,
|
string $value,
|
||||||
string $expected,
|
string $expected
|
||||||
): void {
|
): void {
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'global':
|
case 'global':
|
||||||
@@ -949,7 +999,7 @@ final class CoreLibsLanguageL10nTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* fuctions check
|
* fuctions check
|
||||||
* TODO: others d/dn/dp/dpn gettext functions
|
* TODO: others d/dn/dp/dnp gettext functions
|
||||||
*
|
*
|
||||||
* @covers __setlocale
|
* @covers __setlocale
|
||||||
* @covers __bindtextdomain
|
* @covers __bindtextdomain
|
||||||
@@ -976,10 +1026,10 @@ final class CoreLibsLanguageL10nTest extends TestCase
|
|||||||
string $translated
|
string $translated
|
||||||
): void {
|
): void {
|
||||||
\CoreLibs\Language\L10n::loadFunctions();
|
\CoreLibs\Language\L10n::loadFunctions();
|
||||||
__setlocale(LC_MESSAGES, $locale);
|
_setlocale(LC_MESSAGES, $locale);
|
||||||
__textdomain($domain);
|
_textdomain($domain);
|
||||||
__bindtextdomain($domain, $path);
|
_bindtextdomain($domain, $path);
|
||||||
__bind_textdomain_codeset($domain, $encoding);
|
_bind_textdomain_codeset($domain, $encoding);
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
$translated,
|
$translated,
|
||||||
__($original),
|
__($original),
|
||||||
@@ -987,7 +1037,7 @@ final class CoreLibsLanguageL10nTest extends TestCase
|
|||||||
);
|
);
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
$translated,
|
$translated,
|
||||||
__gettext($original),
|
_gettext($original),
|
||||||
'function gettext assert failed'
|
'function gettext assert failed'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -47,9 +49,12 @@ parameters:
|
|||||||
- www/vendor
|
- www/vendor
|
||||||
# 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.#'
|
||||||
# -
|
# -
|
||||||
|
|||||||
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__
|
||||||
@@ -68,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>";
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ $single_string = 'single';
|
|||||||
$multi_string = 'multi';
|
$multi_string = 'multi';
|
||||||
for ($n = 0; $n <= 3; $n++) {
|
for ($n = 0; $n <= 3; $n++) {
|
||||||
echo "CONTEXT MULTI TEST $n: " . $single_string . "/" . $multi_string . " => "
|
echo "CONTEXT MULTI TEST $n: " . $single_string . "/" . $multi_string . " => "
|
||||||
. $l->__pn($context, $single_string, $multi_string, $n) . "<br>";
|
. $l->__np($context, $single_string, $multi_string, $n) . "<br>";
|
||||||
}
|
}
|
||||||
// change domain
|
// change domain
|
||||||
$domain = 'frontend';
|
$domain = 'frontend';
|
||||||
@@ -138,6 +138,7 @@ 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>";
|
echo "TROUGH LOAD: " . $l->getTranslatorClass()->gettext($string) . "<br>";
|
||||||
|
|
||||||
|
$lang = 'en';
|
||||||
$domain = 'admin';
|
$domain = 'admin';
|
||||||
echo "<br><b>STATIC TYPE TEST</b><br>";
|
echo "<br><b>STATIC TYPE TEST</b><br>";
|
||||||
// static tests from l10n_load
|
// static tests from l10n_load
|
||||||
@@ -154,18 +155,30 @@ echo "<br><b>FUNCTIONS</b><br>";
|
|||||||
// real statisc test
|
// real statisc test
|
||||||
L10n::loadFunctions();
|
L10n::loadFunctions();
|
||||||
$locale = 'ja';
|
$locale = 'ja';
|
||||||
__setlocale(LC_MESSAGES, $locale);
|
_setlocale(LC_MESSAGES, $locale);
|
||||||
__textdomain($domain);
|
_textdomain($domain);
|
||||||
__bindtextdomain($domain, $path);
|
_bindtextdomain($domain, $path);
|
||||||
__bind_textdomain_codeset($domain, $encoding);
|
_bind_textdomain_codeset($domain, $encoding);
|
||||||
echo "INPUT TEST $locale: " . $string . " => " . __($string) . "<br>";
|
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';
|
$locale = 'en_US.UTF-8';
|
||||||
__setlocale(LC_MESSAGES, $locale);
|
_setlocale(LC_MESSAGES, $locale);
|
||||||
__textdomain($domain);
|
_textdomain($domain);
|
||||||
__bindtextdomain($domain, $path);
|
_bindtextdomain($domain, $path);
|
||||||
__bind_textdomain_codeset($domain, $encoding);
|
_bind_textdomain_codeset($domain, $encoding);
|
||||||
echo "INPUT TEST $locale: " . $string . " => " . __($string) . "<br>";
|
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>";
|
||||||
@@ -82,7 +82,11 @@ print '<div><a href="class_test.output.form.php">Class Test: OUTPUT FORM</a></di
|
|||||||
print '<div><a href="class_test.admin.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 "L: " . CoreLibs\Debug\Support::printAr($locale) . "<br>";
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ $smarty->setSmartyPaths();
|
|||||||
// smarty test
|
// smarty test
|
||||||
$smarty->DATA['SMARTY_TEST'] = 'Test Data';
|
$smarty->DATA['SMARTY_TEST'] = 'Test Data';
|
||||||
$smarty->DATA['TRANSLATE_TEST'] = $l10n->__('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';
|
$smarty->DATA['replace'] = 'Replaced';
|
||||||
// variable variables
|
// variable variables
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ $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 "<!DOCTYPE html>";
|
||||||
print "<html><head><title>TEST CLASS: SYSTEM</title><head>";
|
print "<html><head><title>TEST CLASS: SYSTEM</title><head>";
|
||||||
|
|||||||
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,9 +27,8 @@ $__LOCAL_CONFIG = [
|
|||||||
'db_host' => 'test',
|
'db_host' => 'test',
|
||||||
'location' => 'test',
|
'location' => 'test',
|
||||||
'debug_flag' => true,
|
'debug_flag' => true,
|
||||||
'site_lang' => 'en_US',
|
|
||||||
'site_encoding' => 'UTF-8',
|
|
||||||
'site_locale' => 'en_US.UTF-8',
|
'site_locale' => 'en_US.UTF-8',
|
||||||
|
'site_encoding' => 'UTF-8',
|
||||||
'login_enabled' => true
|
'login_enabled' => true
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -46,11 +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_US',
|
|
||||||
'site_encoding' => 'UTF-8',
|
|
||||||
// lang + encoding
|
|
||||||
'site_locale' => 'en_US.UTF-8',
|
'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
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -65,8 +65,6 @@ define('JS', 'javascript' . DIRECTORY_SEPARATOR);
|
|||||||
define('TABLE_ARRAYS', 'table_arrays' . DIRECTORY_SEPARATOR);
|
define('TABLE_ARRAYS', 'table_arrays' . DIRECTORY_SEPARATOR);
|
||||||
// smarty libs path
|
// smarty libs path
|
||||||
define('SMARTY', 'Smarty' . DIRECTORY_SEPARATOR);
|
define('SMARTY', 'Smarty' . DIRECTORY_SEPARATOR);
|
||||||
// po langs [DEPRECAED: use LOCALE]
|
|
||||||
define('LANG', 'lang' . DIRECTORY_SEPARATOR);
|
|
||||||
// po locale file
|
// po locale file
|
||||||
define('LOCALE', 'locale' . DIRECTORY_SEPARATOR);
|
define('LOCALE', 'locale' . DIRECTORY_SEPARATOR);
|
||||||
// cache path
|
// cache path
|
||||||
@@ -160,11 +158,10 @@ 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_US');
|
|
||||||
// default web page encoding setting
|
|
||||||
define('DEFAULT_ENCODING', 'UTF-8');
|
|
||||||
// default lang + encoding
|
// default lang + encoding
|
||||||
define('DEFAULT_LOCALE', 'en_US.UTF-8');
|
define('DEFAULT_LOCALE', 'en_US.UTF-8');
|
||||||
|
// default web page encoding setting
|
||||||
|
define('DEFAULT_ENCODING', 'UTF-8');
|
||||||
|
|
||||||
/************* LOGGING *******************/
|
/************* LOGGING *******************/
|
||||||
// below two can be defined here, but they should be
|
// below two can be defined here, but they should be
|
||||||
@@ -262,9 +259,8 @@ $GLOBALS['DB_CONFIG'] = DB_CONFIG;
|
|||||||
// debug settings, site lang, etc
|
// debug settings, site lang, etc
|
||||||
define('TARGET', $SITE_CONFIG[HOST_NAME]['location'] ?? 'test');
|
define('TARGET', $SITE_CONFIG[HOST_NAME]['location'] ?? 'test');
|
||||||
define('DEBUG', $SITE_CONFIG[HOST_NAME]['debug_flag'] ?? false);
|
define('DEBUG', $SITE_CONFIG[HOST_NAME]['debug_flag'] ?? false);
|
||||||
define('SITE_LANG', $SITE_CONFIG[HOST_NAME]['site_lang'] ?? DEFAULT_LANG);
|
|
||||||
define('SITE_ENCODING', $SITE_CONFIG[HOST_NAME]['site_encoding'] ?? DEFAULT_ENCODING);
|
|
||||||
define('SITE_LOCALE', $SITE_CONFIG[HOST_NAME]['site_locale'] ?? DEFAULT_LOCALE);
|
define('SITE_LOCALE', $SITE_CONFIG[HOST_NAME]['site_locale'] ?? DEFAULT_LOCALE);
|
||||||
|
define('SITE_ENCODING', $SITE_CONFIG[HOST_NAME]['site_encoding'] ?? DEFAULT_ENCODING);
|
||||||
define('LOGIN_ENABLED', $SITE_CONFIG[HOST_NAME]['login_enabled'] ?? false);
|
define('LOGIN_ENABLED', $SITE_CONFIG[HOST_NAME]['login_enabled'] ?? false);
|
||||||
define('AUTH', $SITE_CONFIG[HOST_NAME]['auth'] ?? false);
|
define('AUTH', $SITE_CONFIG[HOST_NAME]['auth'] ?? false);
|
||||||
// paths
|
// paths
|
||||||
|
|||||||
@@ -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 DIR is not set
|
// fail if no base DIR is not set
|
||||||
if (!defined('DIR')) {
|
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__
|
||||||
|
|||||||
@@ -446,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');
|
||||||
|
|||||||
@@ -7,13 +7,19 @@
|
|||||||
<div>
|
<div>
|
||||||
<b>Outside translation test</b><br>
|
<b>Outside translation test</b><br>
|
||||||
TRANSLATION CLASS (OUT): {$TRANSLATE_TEST}<br>
|
TRANSLATION CLASS (OUT): {$TRANSLATE_TEST}<br>
|
||||||
TRANSLATION CLASS (SMARTY): {$TRANSLATE_TEST_SMARTY}
|
TRANSLATION CLASS (OUT FUNCTION): {$TRANSLATE_TEST_FUNCTION}<br>
|
||||||
|
TRANSLATION CLASS (SMARTY): {$TRANSLATE_TEST_SMARTY}<br>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<b>Translate Test with replace:</b><br>
|
<b>Translate Test with replace:</b><br>
|
||||||
ORIGINAL: Original with string: %1 ({$replace})<br>
|
ORIGINAL: Original with string: %1 ({$replace})<br>
|
||||||
TRANSLATED: {t 1=$replace}Original with string: %1{/t}<br>
|
TRANSLATED: {t 1=$replace}Original with string: %1{/t}<br>
|
||||||
TRANSLATED (escape): {t escape=on 1=$replace}Original with string: %1{/t}
|
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>
|
||||||
<b>Variable variables:</b><br>
|
<b>Variable variables:</b><br>
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
<div>
|
|
||||||
{$SMARTY_TEST}
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
TRANSLATION CLASS (OUT): {$TRANSLATE_TEST}
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
TRANSLATION CLASS (SMARTY): {$TRANSLATE_TEST_SMARTY}
|
|
||||||
</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 class="jq-container">
|
|
||||||
<div id="jq-test" class="jp-test">
|
|
||||||
<div id="test-div" class="test-div">
|
|
||||||
Some content here or asdfasdfasf
|
|
||||||
</div>
|
|
||||||
<div id="translate-div">
|
|
||||||
{* TRANSLATION SMARTY: {t}I should be translated{/t} *}
|
|
||||||
TRANSLATION SMARTY: I should be translated
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="loop-test">
|
|
||||||
<div>LOOP TEST</div>
|
|
||||||
{section name=page_list start=1 loop=$loop_start+1}
|
|
||||||
<div>LOOP OUTPUT: {$smarty.section.page_list.index}</div>
|
|
||||||
{/section}
|
|
||||||
</div>
|
|
||||||
{* progresss indicator *}
|
|
||||||
<div id="indicator"></div>
|
|
||||||
{* the action confirm box *}
|
|
||||||
<div id="actionBox" class="actionBoxElement"></div>
|
|
||||||
{* The Overlay box *}
|
|
||||||
<div id="overlayBox" class="overlayBoxElement"></div>
|
|
||||||
@@ -164,7 +164,9 @@ class Login
|
|||||||
public $l;
|
public $l;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* constructor, does ALL, opens db, works through connection checks, closes itself
|
* constructor, does ALL, opens db, works through connection checks,
|
||||||
|
* finishes itself
|
||||||
|
*
|
||||||
* @param \CoreLibs\DB\IO $db Database connection class
|
* @param \CoreLibs\DB\IO $db Database connection class
|
||||||
* @param \CoreLibs\Debug\Logging $log Logging class
|
* @param \CoreLibs\Debug\Logging $log Logging class
|
||||||
*/
|
*/
|
||||||
@@ -191,6 +193,7 @@ class Login
|
|||||||
// check if session exists and could be created
|
// check if session exists and could be created
|
||||||
// TODO: move session creation and check to outside?
|
// TODO: move session creation and check to outside?
|
||||||
if (Session::startSession() === false) {
|
if (Session::startSession() === false) {
|
||||||
|
$this->login_error = 1;
|
||||||
echo '<b>Session not started or could not be started!</b><br>'
|
echo '<b>Session not started or could not be started!</b><br>'
|
||||||
. 'Use \'\CoreLibs\Create\Session::startSession();\'.<br>'
|
. 'Use \'\CoreLibs\Create\Session::startSession();\'.<br>'
|
||||||
. 'For less problems with other session, you can set a '
|
. 'For less problems with other session, you can set a '
|
||||||
@@ -200,12 +203,10 @@ class Login
|
|||||||
|
|
||||||
// pre-check that password min/max lengths are inbetween 1 and 255;
|
// pre-check that password min/max lengths are inbetween 1 and 255;
|
||||||
if ($this->password_max_length > 255) {
|
if ($this->password_max_length > 255) {
|
||||||
echo '<b>Settings problem</b> PMaL<br>';
|
$this->password_max_length = 255;
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
if ($this->password_min_length < 1) {
|
if ($this->password_min_length < 1) {
|
||||||
echo '<b>Settings problem</b> PMiL<br>';
|
$this->password_min_length = 1;
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// set global is ajax page for if we show the data directly,
|
// set global is ajax page for if we show the data directly,
|
||||||
@@ -267,7 +268,8 @@ class Login
|
|||||||
// init default ACL list array
|
// init default ACL list array
|
||||||
$_SESSION['DEFAULT_ACL_LIST'] = [];
|
$_SESSION['DEFAULT_ACL_LIST'] = [];
|
||||||
// read the current edit_access_right list into an array
|
// read the current edit_access_right list into an array
|
||||||
$q = "SELECT level, type, name FROM edit_access_right WHERE level >= 0 ORDER BY level";
|
$q = "SELECT level, type, name FROM edit_access_right "
|
||||||
|
. "WHERE level >= 0 ORDER BY level";
|
||||||
while (is_array($res = $this->db->dbReturn($q))) {
|
while (is_array($res = $this->db->dbReturn($q))) {
|
||||||
// level to description format (numeric)
|
// level to description format (numeric)
|
||||||
$this->default_acl_list[$res['level']] = [
|
$this->default_acl_list[$res['level']] = [
|
||||||
@@ -286,7 +288,10 @@ class Login
|
|||||||
$this->loginLogoutUser();
|
$this->loginLogoutUser();
|
||||||
// ** LANGUAGE SET AFTER LOGIN **
|
// ** LANGUAGE SET AFTER LOGIN **
|
||||||
// set the locale
|
// set the locale
|
||||||
if (Session::getSessionId() !== false && !empty($_SESSION['DEFAULT_LANG'])) {
|
if (
|
||||||
|
Session::getSessionId() !== false &&
|
||||||
|
!empty($_SESSION['DEFAULT_LANG'])
|
||||||
|
) {
|
||||||
$locale = $_SESSION['DEFAULT_LOCALE'] ?? '';
|
$locale = $_SESSION['DEFAULT_LOCALE'] ?? '';
|
||||||
} else {
|
} else {
|
||||||
$locale = defined('SITE_LOCALE') && !empty(SITE_LOCALE) ?
|
$locale = defined('SITE_LOCALE') && !empty(SITE_LOCALE) ?
|
||||||
@@ -314,7 +319,8 @@ class Login
|
|||||||
$this->login_html = $this->loginPrintLogin();
|
$this->login_html = $this->loginPrintLogin();
|
||||||
// closing all connections, depending on error status, exit
|
// closing all connections, depending on error status, exit
|
||||||
if (!$this->loginCloseClass()) {
|
if (!$this->loginCloseClass()) {
|
||||||
// if variable AJAX flag is not set, show output, else pass through for ajax work
|
// if variable AJAX flag is not set, show output
|
||||||
|
// else pass through for ajax work
|
||||||
if ($this->login_is_ajax_page !== true) {
|
if ($this->login_is_ajax_page !== true) {
|
||||||
// the login screen if we hav no login permission & login screen html data
|
// the login screen if we hav no login permission & login screen html data
|
||||||
if ($this->login_html !== null) {
|
if ($this->login_html !== null) {
|
||||||
@@ -360,8 +366,13 @@ class Login
|
|||||||
// NO OP
|
// NO OP
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// *************************************************************************
|
||||||
|
// **** PRIVATE INTERNAL
|
||||||
|
// *************************************************************************
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* checks if password is valid, sets internal error login variable
|
* checks if password is valid, sets internal error login variable
|
||||||
|
*
|
||||||
* @param string $hash password hash
|
* @param string $hash password hash
|
||||||
* @param string $password submitted password
|
* @param string $password submitted password
|
||||||
* @return bool true or false on password ok or not
|
* @return bool true or false on password ok or not
|
||||||
@@ -418,7 +429,9 @@ class Login
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* if user pressed login button this script is called, but only if there is no preview euid set]
|
* if user pressed login button this script is called,
|
||||||
|
* but only if there is no preview euid set
|
||||||
|
*
|
||||||
* @return void has not return
|
* @return void has not return
|
||||||
*/
|
*/
|
||||||
private function loginLoginUser(): void
|
private function loginLoginUser(): void
|
||||||
@@ -702,88 +715,6 @@ class Login
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* for every page the user access this script checks if he is allowed to do so
|
|
||||||
* @return bool permission okay as true/false
|
|
||||||
*/
|
|
||||||
public function loginCheckPermissions(): bool
|
|
||||||
{
|
|
||||||
if ($this->euid && $this->login_error != 103) {
|
|
||||||
$q = "SELECT filename "
|
|
||||||
. "FROM edit_page ep, edit_page_access epa, edit_group eg, edit_user eu "
|
|
||||||
. "WHERE ep.edit_page_id = epa.edit_page_id "
|
|
||||||
. "AND eg.edit_group_id = epa.edit_group_id "
|
|
||||||
. "AND eg.edit_group_id = eu.edit_group_id "
|
|
||||||
. "AND eu.edit_user_id = " . $this->euid . " "
|
|
||||||
. "AND filename = '" . $this->page_name . "' "
|
|
||||||
. "AND eg.enabled = 1 AND epa.enabled = 1";
|
|
||||||
$res = $this->db->dbReturnRow($q);
|
|
||||||
if (!is_array($res)) {
|
|
||||||
$this->login_error = 109;
|
|
||||||
$this->permission_okay = false;
|
|
||||||
return $this->permission_okay;
|
|
||||||
}
|
|
||||||
if (isset($res['filename']) && $res['filename'] == $this->page_name) {
|
|
||||||
$this->permission_okay = true;
|
|
||||||
} else {
|
|
||||||
$this->login_error = 103;
|
|
||||||
$this->permission_okay = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// if called from public, so we can check if the permissions are ok
|
|
||||||
return $this->permission_okay;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* if a user pressed on logout, destroyes session and unsets all global vars
|
|
||||||
* @return void has no return
|
|
||||||
*/
|
|
||||||
public function loginLogoutUser(): void
|
|
||||||
{
|
|
||||||
// must be either logout or error
|
|
||||||
if (!$this->logout && !$this->login_error) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// unregister and destroy session vars
|
|
||||||
foreach (
|
|
||||||
// TODO move this into some global array for easier update
|
|
||||||
[
|
|
||||||
'ADMIN',
|
|
||||||
'BASE_ACL_LEVEL',
|
|
||||||
'DB_DEBUG',
|
|
||||||
'DEBUG_ALL',
|
|
||||||
'DEFAULT_ACL_LIST',
|
|
||||||
'DEFAULT_CHARSET',
|
|
||||||
'DEFAULT_LANG',
|
|
||||||
'DEFAULT_LOCALE',
|
|
||||||
'EAID',
|
|
||||||
'EUID',
|
|
||||||
'GROUP_ACL_LEVEL',
|
|
||||||
'GROUP_ACL_TYPE',
|
|
||||||
'GROUP_NAME',
|
|
||||||
'HEADER_COLOR',
|
|
||||||
'LANG',
|
|
||||||
'PAGES_ACL_LEVEL',
|
|
||||||
'PAGES',
|
|
||||||
'TEMPLATE',
|
|
||||||
'UNIT_ACL_LEVEL',
|
|
||||||
'UNIT_DEFAULT',
|
|
||||||
'UNIT',
|
|
||||||
'USER_ACL_LEVEL',
|
|
||||||
'USER_ACL_TYPE',
|
|
||||||
'USER_NAME',
|
|
||||||
] as $session_var
|
|
||||||
) {
|
|
||||||
unset($_SESSION[$session_var]);
|
|
||||||
}
|
|
||||||
// final unset all
|
|
||||||
session_unset();
|
|
||||||
// final destroy session
|
|
||||||
session_destroy();
|
|
||||||
// then prints the login screen again
|
|
||||||
$this->permission_okay = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sets all the basic ACLs
|
* sets all the basic ACLs
|
||||||
* init set the basic acl the user has, based on the following rules
|
* init set the basic acl the user has, based on the following rules
|
||||||
@@ -799,6 +730,7 @@ class Login
|
|||||||
* - if an account ACL is set, set this parallel, account ACL overrides user ACL if it applies
|
* - if an account ACL is set, set this parallel, account ACL overrides user ACL if it applies
|
||||||
* - if edit access ACL level is set, use this, else use page
|
* - if edit access ACL level is set, use this, else use page
|
||||||
* set all base ACL levels as a list keyword -> ACL number
|
* set all base ACL levels as a list keyword -> ACL number
|
||||||
|
*
|
||||||
* @return void has no return
|
* @return void has no return
|
||||||
*/
|
*/
|
||||||
private function loginSetAcl(): void
|
private function loginSetAcl(): void
|
||||||
@@ -837,10 +769,10 @@ class Login
|
|||||||
$_SESSION['BASE_ACL_LEVEL'] = $this->acl['base'];
|
$_SESSION['BASE_ACL_LEVEL'] = $this->acl['base'];
|
||||||
|
|
||||||
// set the current page acl
|
// set the current page acl
|
||||||
// start with default acl
|
// start with base acl
|
||||||
// set group if not -1, overrides default
|
// set group if not -1, overrides default
|
||||||
// set page if not -1, overrides group set
|
// set page if not -1, overrides group set
|
||||||
$this->acl['page'] = DEFAULT_ACL_LEVEL;
|
$this->acl['page'] = $this->acl['base'];
|
||||||
if ($_SESSION['GROUP_ACL_LEVEL'] != -1) {
|
if ($_SESSION['GROUP_ACL_LEVEL'] != -1) {
|
||||||
$this->acl['page'] = $_SESSION['GROUP_ACL_LEVEL'];
|
$this->acl['page'] = $_SESSION['GROUP_ACL_LEVEL'];
|
||||||
}
|
}
|
||||||
@@ -885,37 +817,47 @@ class Login
|
|||||||
$this->acl['show_ea_extra'] = false;
|
$this->acl['show_ea_extra'] = false;
|
||||||
}
|
}
|
||||||
// set the default edit access
|
// set the default edit access
|
||||||
$this->acl['default_edit_access'] = $_SESSION['UNIT_DEFAULT'];
|
$this->acl['default_edit_access'] = $_SESSION['UNIT_DEFAULT'] ?? null;
|
||||||
|
$this->acl['min'] = [];
|
||||||
// integrate the type acl list, but only for the keyword -> level
|
// integrate the type acl list, but only for the keyword -> level
|
||||||
foreach ($this->default_acl_list as $level => $data) {
|
foreach ($this->default_acl_list as $level => $data) {
|
||||||
$this->acl['min'][$data['type']] = $level;
|
$this->acl['min'][$data['type']] = $level;
|
||||||
}
|
}
|
||||||
// set the full acl list too
|
// set the full acl list too
|
||||||
$this->acl['acl_list'] = $_SESSION['DEFAULT_ACL_LIST'];
|
$this->acl['acl_list'] = $_SESSION['DEFAULT_ACL_LIST'] ?? [];
|
||||||
// debug
|
// debug
|
||||||
// $this->debug('ACL', $this->print_ar($this->acl));
|
// $this->debug('ACL', $this->print_ar($this->acl));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* checks if this edit access id is valid
|
* Check if source (page, base) is matching to the given min access string
|
||||||
* @param int|null $edit_access_id access id pk to check
|
* min access string must be valid access level string (eg read, mod, write)
|
||||||
* @return bool true/false: if the edit access is not
|
* This does not take in account admin flag set
|
||||||
* in the valid list: false
|
*
|
||||||
|
* @param string $source a valid base level string eg base, page
|
||||||
|
* @param string $min_access a valid min level string, eg read, mod, siteadmin
|
||||||
|
* @return bool True for valid access, False for invalid
|
||||||
*/
|
*/
|
||||||
public function loginCheckEditAccess($edit_access_id): bool
|
public function loginCheckAccess(string $source, string $min_access): bool
|
||||||
{
|
{
|
||||||
if ($edit_access_id === null) {
|
$source = 'base';
|
||||||
|
if (
|
||||||
|
empty($this->acl['min'][$min_access]) ||
|
||||||
|
empty($this->acl[$source])
|
||||||
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (array_key_exists($edit_access_id, $this->acl['unit'])) {
|
// phan claims $this->acl['min'] can be null, but above should skip
|
||||||
|
/** @phan-suppress-next-line PhanTypeArraySuspiciousNullable */
|
||||||
|
if ($this->acl[$source] >= $this->acl['min'][$min_access]) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* checks if the password is in a valid format
|
* checks if the password is in a valid format
|
||||||
|
*
|
||||||
* @param string $password the new password
|
* @param string $password the new password
|
||||||
* @return bool true or false if valid password or not
|
* @return bool true or false if valid password or not
|
||||||
*/
|
*/
|
||||||
@@ -939,6 +881,7 @@ class Login
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* dummy declare for password forget
|
* dummy declare for password forget
|
||||||
|
*
|
||||||
* @return void has no return
|
* @return void has no return
|
||||||
*/
|
*/
|
||||||
private function loginPasswordForgot(): void
|
private function loginPasswordForgot(): void
|
||||||
@@ -946,25 +889,9 @@ class Login
|
|||||||
// will do some password recovert, eg send email
|
// will do some password recovert, eg send email
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* sets the minium length and checks on valid
|
|
||||||
* @param int $length set the minimum length
|
|
||||||
* @return bool true/false on success
|
|
||||||
*/
|
|
||||||
public function loginSetPasswordMinLength(int $length): bool
|
|
||||||
{
|
|
||||||
// check that numeric, positive numeric, not longer than max input string lenght
|
|
||||||
// and not short than min password length
|
|
||||||
if (is_numeric($length) && $length >= PASSWORD_MIN_LENGTH && $length <= $this->password_max_length) {
|
|
||||||
$this->password_min_length = $length;
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* changes a user password
|
* changes a user password
|
||||||
|
*
|
||||||
* @return void has no return
|
* @return void has no return
|
||||||
*/
|
*/
|
||||||
private function loginPasswordChange(): void
|
private function loginPasswordChange(): void
|
||||||
@@ -1065,6 +992,7 @@ class Login
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* prints out login html part if no permission (error) is set
|
* prints out login html part if no permission (error) is set
|
||||||
|
*
|
||||||
* @return string|null html data for login page, or null for nothing
|
* @return string|null html data for login page, or null for nothing
|
||||||
*/
|
*/
|
||||||
private function loginPrintLogin()
|
private function loginPrintLogin()
|
||||||
@@ -1170,6 +1098,7 @@ class Login
|
|||||||
/**
|
/**
|
||||||
* last function called, writes log and prints out error msg and
|
* last function called, writes log and prints out error msg and
|
||||||
* exists script if permission 0
|
* exists script if permission 0
|
||||||
|
*
|
||||||
* @return bool true on permission ok, false on permission wrong
|
* @return bool true on permission ok, false on permission wrong
|
||||||
*/
|
*/
|
||||||
private function loginCloseClass(): bool
|
private function loginCloseClass(): bool
|
||||||
@@ -1208,6 +1137,7 @@ class Login
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* checks if there are external templates, if not uses internal fallback ones
|
* checks if there are external templates, if not uses internal fallback ones
|
||||||
|
*
|
||||||
* @return void has no return
|
* @return void has no return
|
||||||
*/
|
*/
|
||||||
private function loginSetTemplates(): void
|
private function loginSetTemplates(): void
|
||||||
@@ -1389,6 +1319,7 @@ EOM;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* writes detailed data into the edit user log table (keep log what user does)
|
* writes detailed data into the edit user log table (keep log what user does)
|
||||||
|
*
|
||||||
* @param string $event string of what has been done
|
* @param string $event string of what has been done
|
||||||
* @param string $data data information (id, etc)
|
* @param string $data data information (id, etc)
|
||||||
* @param string|int $error error id (mostly an int)
|
* @param string|int $error error id (mostly an int)
|
||||||
@@ -1449,11 +1380,190 @@ EOM;
|
|||||||
$this->db->dbExec($q, 'NULL');
|
$this->db->dbExec($q, 'NULL');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// *************************************************************************
|
||||||
|
// **** PUBLIC INTERNAL
|
||||||
|
// *************************************************************************
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sets the minium length and checks on valid
|
||||||
|
*
|
||||||
|
* @param int $length set the minimum length
|
||||||
|
* @return bool true/false on success
|
||||||
|
*/
|
||||||
|
public function loginSetPasswordMinLength(int $length): bool
|
||||||
|
{
|
||||||
|
// check that numeric, positive numeric, not longer than max input string lenght
|
||||||
|
// and not short than min password length
|
||||||
|
if (is_numeric($length) && $length >= PASSWORD_MIN_LENGTH && $length <= $this->password_max_length) {
|
||||||
|
$this->password_min_length = $length;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* if a user pressed on logout, destroyes session and unsets all global vars
|
||||||
|
*
|
||||||
|
* @return void has no return
|
||||||
|
*/
|
||||||
|
public function loginLogoutUser(): void
|
||||||
|
{
|
||||||
|
// must be either logout or error
|
||||||
|
if (!$this->logout && !$this->login_error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// unregister and destroy session vars
|
||||||
|
foreach (
|
||||||
|
// TODO move this into some global array for easier update
|
||||||
|
[
|
||||||
|
'ADMIN',
|
||||||
|
'BASE_ACL_LEVEL',
|
||||||
|
'DB_DEBUG',
|
||||||
|
'DEBUG_ALL',
|
||||||
|
'DEFAULT_ACL_LIST',
|
||||||
|
'DEFAULT_CHARSET',
|
||||||
|
'DEFAULT_LANG',
|
||||||
|
'DEFAULT_LOCALE',
|
||||||
|
'EAID',
|
||||||
|
'EUID',
|
||||||
|
'GROUP_ACL_LEVEL',
|
||||||
|
'GROUP_ACL_TYPE',
|
||||||
|
'GROUP_NAME',
|
||||||
|
'HEADER_COLOR',
|
||||||
|
'LANG',
|
||||||
|
'PAGES_ACL_LEVEL',
|
||||||
|
'PAGES',
|
||||||
|
'TEMPLATE',
|
||||||
|
'UNIT_ACL_LEVEL',
|
||||||
|
'UNIT_DEFAULT',
|
||||||
|
'UNIT',
|
||||||
|
'USER_ACL_LEVEL',
|
||||||
|
'USER_ACL_TYPE',
|
||||||
|
'USER_NAME',
|
||||||
|
] as $session_var
|
||||||
|
) {
|
||||||
|
unset($_SESSION[$session_var]);
|
||||||
|
}
|
||||||
|
// final unset all
|
||||||
|
session_unset();
|
||||||
|
// final destroy session
|
||||||
|
session_destroy();
|
||||||
|
// then prints the login screen again
|
||||||
|
$this->permission_okay = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* for every page the user access this script checks if he is allowed to do so
|
||||||
|
*
|
||||||
|
* @return bool permission okay as true/false
|
||||||
|
*/
|
||||||
|
public function loginCheckPermissions(): bool
|
||||||
|
{
|
||||||
|
// start with not allowed
|
||||||
|
$this->permission_okay = false;
|
||||||
|
// bail for no euid (no login)
|
||||||
|
if (!$this->euid) {
|
||||||
|
return $this->permission_okay;
|
||||||
|
}
|
||||||
|
// bail for previous wrong page match, eg if method is called twice
|
||||||
|
if ($this->login_error == 103) {
|
||||||
|
return $this->permission_okay;
|
||||||
|
}
|
||||||
|
// if ($this->euid && $this->login_error != 103) {
|
||||||
|
$q = "SELECT filename "
|
||||||
|
. "FROM edit_page ep, edit_page_access epa, edit_group eg, edit_user eu "
|
||||||
|
. "WHERE ep.edit_page_id = epa.edit_page_id "
|
||||||
|
. "AND eg.edit_group_id = epa.edit_group_id "
|
||||||
|
. "AND eg.edit_group_id = eu.edit_group_id "
|
||||||
|
. "AND eu.edit_user_id = " . $this->euid . " "
|
||||||
|
. "AND filename = '" . $this->page_name . "' "
|
||||||
|
. "AND eg.enabled = 1 AND epa.enabled = 1";
|
||||||
|
$res = $this->db->dbReturnRow($q);
|
||||||
|
if (!is_array($res)) {
|
||||||
|
$this->login_error = 109;
|
||||||
|
return $this->permission_okay;
|
||||||
|
}
|
||||||
|
if (isset($res['filename']) && $res['filename'] == $this->page_name) {
|
||||||
|
$this->permission_okay = true;
|
||||||
|
} else {
|
||||||
|
$this->login_error = 103;
|
||||||
|
}
|
||||||
|
// if called from public, so we can check if the permissions are ok
|
||||||
|
return $this->permission_okay;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return ACL array as is
|
||||||
|
*
|
||||||
|
* @return array<mixed>
|
||||||
|
*/
|
||||||
|
public function loginGetAcl(): array
|
||||||
|
{
|
||||||
|
return $this->acl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* checks if this edit access id is valid
|
||||||
|
*
|
||||||
|
* @param int|null $edit_access_id access id pk to check
|
||||||
|
* @return bool true/false: if the edit access is not
|
||||||
|
* in the valid list: false
|
||||||
|
*/
|
||||||
|
public function loginCheckEditAccess($edit_access_id): bool
|
||||||
|
{
|
||||||
|
if ($edit_access_id === null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (array_key_exists($edit_access_id, $this->acl['unit'])) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if admin flag is set
|
||||||
|
*
|
||||||
|
* @return bool True if admin flag set
|
||||||
|
*/
|
||||||
|
public function loginIsAdmin(): bool
|
||||||
|
{
|
||||||
|
if (!empty($this->acl['admin'])) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* check if min accesss string (eg, read, mod, etc) is matchable
|
||||||
|
* EQUAL to BASE set right
|
||||||
|
*
|
||||||
|
* @param string $min_access
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function loginCheckAccessBase(string $min_access): bool
|
||||||
|
{
|
||||||
|
return $this->loginCheckAccess('base', $min_access);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* check if min accesss string (eg, read, mod, etc) is matchable
|
||||||
|
* EQUAL to PAGE set right
|
||||||
|
*
|
||||||
|
* @param string $min_access
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function loginCheckAccessPage(string $min_access): bool
|
||||||
|
{
|
||||||
|
return $this->loginCheckAccess('page', $min_access);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* checks that the given edit access id is valid for this user
|
* checks that the given edit access id is valid for this user
|
||||||
|
*
|
||||||
* @param int|null $edit_access_id edit access id to check
|
* @param int|null $edit_access_id edit access id to check
|
||||||
* @return int|null same edit access id if ok
|
* @return int|null same edit access id if ok
|
||||||
* or the default edit access id if given one is not valid
|
* or the default edit access id
|
||||||
|
* if given one is not valid
|
||||||
*/
|
*/
|
||||||
public function loginCheckEditAccessId(?int $edit_access_id): ?int
|
public function loginCheckEditAccessId(?int $edit_access_id): ?int
|
||||||
{
|
{
|
||||||
@@ -1463,15 +1573,15 @@ EOM;
|
|||||||
is_array($_SESSION['UNIT']) &&
|
is_array($_SESSION['UNIT']) &&
|
||||||
!array_key_exists($edit_access_id, $_SESSION['UNIT'])
|
!array_key_exists($edit_access_id, $_SESSION['UNIT'])
|
||||||
) {
|
) {
|
||||||
return (int)$_SESSION['UNIT_DEFAULT'];
|
return $_SESSION['UNIT_DEFAULT'] ?? null;
|
||||||
} else {
|
|
||||||
return $edit_access_id;
|
|
||||||
}
|
}
|
||||||
|
return $edit_access_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* retunrn a set entry from the UNIT session for an edit access_id
|
* retunrn a set entry from the UNIT session for an edit access_id
|
||||||
* if not found return false
|
* if not found return false
|
||||||
|
*
|
||||||
* @param int $edit_access_id edit access id
|
* @param int $edit_access_id edit access id
|
||||||
* @param string|int $data_key key value to search for
|
* @param string|int $data_key key value to search for
|
||||||
* @return bool|string false for not found or string for found data
|
* @return bool|string false for not found or string for found data
|
||||||
@@ -1480,9 +1590,8 @@ EOM;
|
|||||||
{
|
{
|
||||||
if (!isset($_SESSION['UNIT'][$edit_access_id]['data'][$data_key])) {
|
if (!isset($_SESSION['UNIT'][$edit_access_id]['data'][$data_key])) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
|
||||||
return $_SESSION['UNIT'][$edit_access_id]['data'][$data_key];
|
|
||||||
}
|
}
|
||||||
|
return $_SESSION['UNIT'][$edit_access_id]['data'][$data_key];
|
||||||
}
|
}
|
||||||
// close class
|
// close class
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,11 +85,13 @@ class Basic
|
|||||||
* main Basic constructor to init and check base settings
|
* main Basic constructor to init and check base settings
|
||||||
* @param \CoreLibs\Debug\Logging|null $log Logging class
|
* @param \CoreLibs\Debug\Logging|null $log Logging class
|
||||||
* @param string|null $session_name Set session name
|
* @param string|null $session_name Set session name
|
||||||
|
* @deprecated DO NOT USE Class\Basic anymore. Use dedicated logger and sub classes
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
\CoreLibs\Debug\Logging $log = null,
|
\CoreLibs\Debug\Logging $log = null,
|
||||||
?string $session_name = null
|
?string $session_name = null
|
||||||
) {
|
) {
|
||||||
|
trigger_error('Class \CoreLibs\Basic is deprected', E_USER_DEPRECATED);
|
||||||
// TODO make check dynamic for entries we MUST have depending on load type
|
// TODO make check dynamic for entries we MUST have depending on load type
|
||||||
// before we start any work, we should check that all MUST constants are defined
|
// before we start any work, we should check that all MUST constants are defined
|
||||||
$abort = false;
|
$abort = false;
|
||||||
|
|||||||
@@ -218,7 +218,8 @@ class ArrayHandler
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
foreach ($array as $key => $value) {
|
foreach ($array as $key => $value) {
|
||||||
// if string or if key is assumed to be string do key match else add new entry
|
// if string or if key is assumed to be string do key match
|
||||||
|
// else add new entry
|
||||||
if (is_string($key) || $key_is_string === false) {
|
if (is_string($key) || $key_is_string === false) {
|
||||||
if (is_array($value) && array_key_exists($key, $merged) && is_array($merged[$key])) {
|
if (is_array($value) && array_key_exists($key, $merged) && is_array($merged[$key])) {
|
||||||
// $merged[$key] = call_user_func(__METHOD__, $merged[$key], $value, $key_is_string);
|
// $merged[$key] = call_user_func(__METHOD__, $merged[$key], $value, $key_is_string);
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class DateTime
|
|||||||
4 => 'Thu',
|
4 => 'Thu',
|
||||||
5 => 'Fri',
|
5 => 'Fri',
|
||||||
6 => 'Sat',
|
6 => 'Sat',
|
||||||
7 => 'Sun'
|
7 => 'Sun',
|
||||||
];
|
];
|
||||||
/** @var array<int,string> */
|
/** @var array<int,string> */
|
||||||
public const DAY_LONG = [
|
public const DAY_LONG = [
|
||||||
@@ -30,7 +30,7 @@ class DateTime
|
|||||||
4 => 'Thursday',
|
4 => 'Thursday',
|
||||||
5 => 'Friday',
|
5 => 'Friday',
|
||||||
6 => 'Saturday',
|
6 => 'Saturday',
|
||||||
7 => 'Sunday'
|
7 => 'Sunday',
|
||||||
];
|
];
|
||||||
/** @var array<int,string> */
|
/** @var array<int,string> */
|
||||||
public const MONTH_LONG = [
|
public const MONTH_LONG = [
|
||||||
@@ -45,7 +45,7 @@ class DateTime
|
|||||||
9 => 'September',
|
9 => 'September',
|
||||||
10 => 'October',
|
10 => 'October',
|
||||||
11 => 'November',
|
11 => 'November',
|
||||||
12 => 'December'
|
12 => 'December',
|
||||||
];
|
];
|
||||||
/** @var array<int,string> */
|
/** @var array<int,string> */
|
||||||
public const MONTH_SHORT = [
|
public const MONTH_SHORT = [
|
||||||
@@ -60,7 +60,7 @@ class DateTime
|
|||||||
9 => 'Sep',
|
9 => 'Sep',
|
||||||
10 => 'Oct',
|
10 => 'Oct',
|
||||||
11 => 'Nov',
|
11 => 'Nov',
|
||||||
12 => 'Dec'
|
12 => 'Dec',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -349,7 +349,7 @@ class DateTime
|
|||||||
try {
|
try {
|
||||||
$start = new \DateTime($start_date);
|
$start = new \DateTime($start_date);
|
||||||
$end = new \DateTime($end_date);
|
$end = new \DateTime($end_date);
|
||||||
} catch (Exception) {
|
} catch (Exception $e) {
|
||||||
if ($return_named === true) {
|
if ($return_named === true) {
|
||||||
return [
|
return [
|
||||||
'overall' => 0,
|
'overall' => 0,
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class ArrayIO extends \CoreLibs\DB\IO
|
|||||||
/** @var string */
|
/** @var string */
|
||||||
public $table_name; // the table_name
|
public $table_name; // the table_name
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public $pk_name; // the primary key from this table
|
public $pk_name = ''; // the primary key from this table
|
||||||
/** @var int|string|null */
|
/** @var int|string|null */
|
||||||
public $pk_id; // the PK id
|
public $pk_id; // the PK id
|
||||||
|
|
||||||
@@ -503,7 +503,7 @@ class ArrayIO extends \CoreLibs\DB\IO
|
|||||||
// max id, falls INSERT
|
// max id, falls INSERT
|
||||||
$q = 'SELECT MAX(' . $this->pk_name . ') + 1 AS pk_id FROM ' . $this->table_name;
|
$q = 'SELECT MAX(' . $this->pk_name . ') + 1 AS pk_id FROM ' . $this->table_name;
|
||||||
if (is_array($res = $this->dbReturnRow($q))) {
|
if (is_array($res = $this->dbReturnRow($q))) {
|
||||||
$pk_id = $res['pkd_id'];
|
$pk_id = $res['pk_id'];
|
||||||
} else {
|
} else {
|
||||||
$pk_id = 1;
|
$pk_id = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -604,7 +604,7 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
// extract element
|
// extract element
|
||||||
$return_string = pg_version($this->dbh)[$parameter] ?? '';
|
$return_string = (string)(pg_version($this->dbh)[$parameter] ?? '');
|
||||||
// for version, strip if requested
|
// for version, strip if requested
|
||||||
if (
|
if (
|
||||||
in_array($parameter, ['server']) &&
|
in_array($parameter, ['server']) &&
|
||||||
|
|||||||
@@ -401,10 +401,10 @@ class Logging
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Temporary method to read all class variables for testing purpose
|
* Temporary method to read all class variables for testing purpose
|
||||||
* @param string $name
|
* @param string $name what variable to return
|
||||||
* @return mixed can be anything, bool, string, int, array
|
* @return mixed can be anything, bool, string, int, array
|
||||||
*/
|
*/
|
||||||
public function getSetting(string $name): mixed
|
public function getSetting(string $name) //:mixed DOES not work with PHP 7.4
|
||||||
{
|
{
|
||||||
// for debug purpose only
|
// for debug purpose only
|
||||||
return $this->{$name};
|
return $this->{$name};
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
* Language\Encoding::__mbMimeEncode -> Convert\MimeEncode::__mbMimeEncode
|
* Language\Encoding::__mbMimeEncode -> Convert\MimeEncode::__mbMimeEncode
|
||||||
* Langauge\Encoding::checkConvertEncoding -> Check\Encoding::checkConvertEncoding
|
* Langauge\Encoding::checkConvertEncoding -> Check\Encoding::checkConvertEncoding
|
||||||
* Langauge\Encoding::setErrorChar -> Check\Encoding::setErrorChar
|
* Langauge\Encoding::setErrorChar -> Check\Encoding::setErrorChar
|
||||||
* Langauge\Encoding::getErrorChar -> Encoding::getErrorChar
|
* Langauge\Encoding::getErrorChar -> Check\Encoding::getErrorChar
|
||||||
* Langauge\Encoding::convertEncoding -> Convert\Encoding::convertEncoding
|
* Langauge\Encoding::convertEncoding -> Convert\Encoding::convertEncoding
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -1,141 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Internal function for getting languange and encodig settings
|
|
||||||
*/
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace CoreLibs\Language;
|
|
||||||
|
|
||||||
class GetSettings
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Sets encoding and language
|
|
||||||
* Can be overridden with language + path to mo file
|
|
||||||
* If locale is set it must be in the format of:
|
|
||||||
* <lang>.<encoding>
|
|
||||||
* <lang>_<country>.<encoding>
|
|
||||||
* <lang>_<country>.<encoding>@<subset>
|
|
||||||
* If no encoding is set in the is, UTF-8 is assumed
|
|
||||||
*
|
|
||||||
* Returned is an array with array indes and dictionary index
|
|
||||||
* 0~4 array are
|
|
||||||
* encoding: 0
|
|
||||||
* lang: 1
|
|
||||||
* lang_short: 2
|
|
||||||
* domain: 3
|
|
||||||
* path: 4
|
|
||||||
*
|
|
||||||
* @param string|null $locale A valid locale name
|
|
||||||
* @param string|null $path A valid path where the mo files will be based
|
|
||||||
* @return array<int|string,string> Settings as array/dictionary
|
|
||||||
* @deprecated Use CoreLibs\Language\GetLocale::setLocale()
|
|
||||||
*/
|
|
||||||
public static function setLangEncoding(
|
|
||||||
?string $locale = null,
|
|
||||||
?string $domain = null,
|
|
||||||
?string $path = null
|
|
||||||
): array {
|
|
||||||
$lang = '';
|
|
||||||
$lang_short = '';
|
|
||||||
$encoding = '';
|
|
||||||
// if is is set, extract
|
|
||||||
if (!empty($locale)) {
|
|
||||||
preg_match(
|
|
||||||
// language code
|
|
||||||
'/^(?P<lang>[a-z]{2,3})'
|
|
||||||
// _ country code
|
|
||||||
. '(?:_(?P<country>[A-Z]{2}))?'
|
|
||||||
// . charset
|
|
||||||
. '(?:\\.(?P<charset>[-A-Za-z0-9_]+))?'
|
|
||||||
// @ modifier
|
|
||||||
. '(?:@(?P<modifier>[-A-Za-z0-9_]+))?$/',
|
|
||||||
$locale,
|
|
||||||
$matches
|
|
||||||
);
|
|
||||||
// lang short part
|
|
||||||
$lang_short = $matches['lang'] ?? '';
|
|
||||||
$lang = $lang_short;
|
|
||||||
// lang + country if country is set
|
|
||||||
if (!empty($matches['country'])) {
|
|
||||||
$lang = sprintf('%s_%s', $lang_short, $matches['country']);
|
|
||||||
}
|
|
||||||
// encoding if set
|
|
||||||
$encoding = strtoupper($matches['charset'] ?? 'UTF-8');
|
|
||||||
}
|
|
||||||
// if domain is set, must be alphanumeric, if not unset
|
|
||||||
if (
|
|
||||||
!empty($domain) &&
|
|
||||||
!preg_match("/^\w+$/", $domain)
|
|
||||||
) {
|
|
||||||
$domain = '';
|
|
||||||
}
|
|
||||||
// path checks if set, if not valid path unset
|
|
||||||
if (
|
|
||||||
!empty($path) &&
|
|
||||||
!is_dir($path)
|
|
||||||
) {
|
|
||||||
$path = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
// just emergency fallback for language
|
|
||||||
// set encoding
|
|
||||||
if (empty($encoding)) {
|
|
||||||
if (!empty($_SESSION['DEFAULT_CHARSET'])) {
|
|
||||||
$encoding = $_SESSION['DEFAULT_CHARSET'];
|
|
||||||
} else {
|
|
||||||
$encoding = DEFAULT_ENCODING;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// gobal override
|
|
||||||
if (empty($lang)) {
|
|
||||||
if (!empty($GLOBALS['OVERRIDE_LANG'])) {
|
|
||||||
$lang = $GLOBALS['OVERRIDE_LANG'];
|
|
||||||
} elseif (!empty($_SESSION['DEFAULT_LANG'])) {
|
|
||||||
// session (login)
|
|
||||||
$lang = $_SESSION['DEFAULT_LANG'];
|
|
||||||
} else {
|
|
||||||
// mostly default SITE LANG or DEFAULT LANG
|
|
||||||
$lang = defined('SITE_LANG') && !empty(SITE_LANG) ?
|
|
||||||
SITE_LANG :
|
|
||||||
DEFAULT_LANG;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// create the char lang encoding
|
|
||||||
if (empty($lang_short)) {
|
|
||||||
$lang_short = substr($lang, 0, 2);
|
|
||||||
}
|
|
||||||
// set the language folder
|
|
||||||
if (empty($path)) {
|
|
||||||
// LEGACY
|
|
||||||
$path = BASE . INCLUDES . LANG . CONTENT_PATH;
|
|
||||||
// will be BASE . INCLUDES . LANG . $language . /LC_MESSAGES/
|
|
||||||
// so CONTENT_PATH has to be removed
|
|
||||||
}
|
|
||||||
// if no domain is set, fall back to content path
|
|
||||||
if (empty($domain)) {
|
|
||||||
$domain = str_replace('/', '', CONTENT_PATH);
|
|
||||||
}
|
|
||||||
// return
|
|
||||||
return [
|
|
||||||
// as array
|
|
||||||
0 => $encoding,
|
|
||||||
1 => $lang,
|
|
||||||
2 => $lang_short,
|
|
||||||
3 => $domain,
|
|
||||||
4 => $path,
|
|
||||||
// with index name
|
|
||||||
// encoding
|
|
||||||
'encoding' => $encoding,
|
|
||||||
// language full string, eg en_US
|
|
||||||
'lang' => $lang,
|
|
||||||
// lang short, if eg en_US only en
|
|
||||||
'lang_short' => $lang_short,
|
|
||||||
// translation domain (CONTENT_PATH)
|
|
||||||
'domain' => $domain,
|
|
||||||
// folder BASE ONLY
|
|
||||||
'path' => $path,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* __ : returns string (translated or original if not found)
|
* __ : returns string (translated or original if not found)
|
||||||
* __n : plural string
|
* __n : plural string
|
||||||
* __p : string with context
|
* __p : string with context
|
||||||
* __pb: string with context and plural
|
* __np: string with context and plural
|
||||||
*
|
*
|
||||||
* HISTORY:
|
* HISTORY:
|
||||||
* 2022/4/15 (cs) drop all old folder layout support, new folder base
|
* 2022/4/15 (cs) drop all old folder layout support, new folder base
|
||||||
@@ -34,6 +34,8 @@ class L10n
|
|||||||
{
|
{
|
||||||
/** @var string the current locale */
|
/** @var string the current locale */
|
||||||
private $locale = '';
|
private $locale = '';
|
||||||
|
/** @var string the SET locale as WHERE the domain file is */
|
||||||
|
private $locale_set = '';
|
||||||
/** @var string the default selected/active domain */
|
/** @var string the default selected/active domain */
|
||||||
private $domain = '';
|
private $domain = '';
|
||||||
/** @var array<string,array<string,GetTextReader>> locale > domain = translator */
|
/** @var array<string,array<string,GetTextReader>> locale > domain = translator */
|
||||||
@@ -77,7 +79,7 @@ class L10n
|
|||||||
public function __construct(
|
public function __construct(
|
||||||
string $locale = '',
|
string $locale = '',
|
||||||
string $domain = '',
|
string $domain = '',
|
||||||
string $path = '',
|
string $path = ''
|
||||||
) {
|
) {
|
||||||
// auto load language only if at least locale and domain is set
|
// auto load language only if at least locale and domain is set
|
||||||
if (!empty($locale) && !empty($domain)) {
|
if (!empty($locale) && !empty($domain)) {
|
||||||
@@ -141,6 +143,7 @@ class L10n
|
|||||||
// store old settings
|
// store old settings
|
||||||
$old_mofile = $this->mofile;
|
$old_mofile = $this->mofile;
|
||||||
$old_lang = $this->locale;
|
$old_lang = $this->locale;
|
||||||
|
$old_lang_set = $this->locale_set;
|
||||||
$old_domain = $this->domain;
|
$old_domain = $this->domain;
|
||||||
$old_base_locale_path = $this->base_locale_path;
|
$old_base_locale_path = $this->base_locale_path;
|
||||||
$old_base_content_path = $this->base_content_path;
|
$old_base_content_path = $this->base_content_path;
|
||||||
@@ -172,6 +175,7 @@ class L10n
|
|||||||
. $this->base_content_path
|
. $this->base_content_path
|
||||||
. $domain . '.mo';
|
. $domain . '.mo';
|
||||||
if (file_exists($this->mofile)) {
|
if (file_exists($this->mofile)) {
|
||||||
|
$this->locale_set = $_locale;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -202,6 +206,7 @@ class L10n
|
|||||||
// else fall back to the old ones
|
// else fall back to the old ones
|
||||||
$this->mofile = $old_mofile;
|
$this->mofile = $old_mofile;
|
||||||
$this->locale = $old_lang;
|
$this->locale = $old_lang;
|
||||||
|
$this->locale_set = $old_lang_set;
|
||||||
$this->domain = $old_domain;
|
$this->domain = $old_domain;
|
||||||
$this->base_locale_path = $old_base_locale_path;
|
$this->base_locale_path = $old_base_locale_path;
|
||||||
$this->base_content_path = $old_base_content_path;
|
$this->base_content_path = $old_base_content_path;
|
||||||
@@ -454,7 +459,7 @@ class L10n
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get current set locale
|
* get current set locale (want locale)
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
@@ -463,6 +468,16 @@ class L10n
|
|||||||
return $this->locale;
|
return $this->locale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* current set locale where mo file is located
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getLocaleSet(): string
|
||||||
|
{
|
||||||
|
return $this->locale_set;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get current set language
|
* get current set language
|
||||||
*
|
*
|
||||||
@@ -601,7 +616,7 @@ class L10n
|
|||||||
* @param int $number number value
|
* @param int $number number value
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function __pn(string $context, string $single, string $plural, int $number): string
|
public function __np(string $context, string $single, string $plural, int $number): string
|
||||||
{
|
{
|
||||||
if ($this->l10n === null) {
|
if ($this->l10n === null) {
|
||||||
return $number > 1 ? $plural : $single;
|
return $number > 1 ? $plural : $single;
|
||||||
|
|||||||
@@ -1,8 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
* Original: https://github.com/phpmyadmin/motranslator
|
||||||
|
* Has the same function names, but uses a different base system
|
||||||
|
* setlocale -> setLocale
|
||||||
|
* bindtextdomain -> setTextDomain
|
||||||
|
* textdomain -> setDomain
|
||||||
|
*********************************************************************/
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use CoreLibs\Language\L10n;
|
use CoreLibs\Language\L10n as Loader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a requested locale.
|
* Sets a requested locale.
|
||||||
@@ -12,9 +20,9 @@ use CoreLibs\Language\L10n;
|
|||||||
*
|
*
|
||||||
* @return string Set or current locale
|
* @return string Set or current locale
|
||||||
*/
|
*/
|
||||||
function __setlocale(int $category, string $locale): string
|
function _setlocale(int $category, string $locale): string
|
||||||
{
|
{
|
||||||
return L10n::getInstance()->setLocale($locale);
|
return Loader::getInstance()->setLocale($locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -23,9 +31,9 @@ function __setlocale(int $category, string $locale): string
|
|||||||
* @param string $domain Domain name
|
* @param string $domain Domain name
|
||||||
* @param string $path Path where to find locales
|
* @param string $path Path where to find locales
|
||||||
*/
|
*/
|
||||||
function __bindtextdomain(string $domain, string $path): void
|
function _bindtextdomain(string $domain, string $path): void
|
||||||
{
|
{
|
||||||
L10n::getInstance()->setTextDomain($domain, $path);
|
Loader::getInstance()->setTextDomain($domain, $path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,7 +47,7 @@ function __bindtextdomain(string $domain, string $path): void
|
|||||||
* @param string $domain Domain where to set character set
|
* @param string $domain Domain where to set character set
|
||||||
* @param string $codeset Character set to set
|
* @param string $codeset Character set to set
|
||||||
*/
|
*/
|
||||||
function __bind_textdomain_codeset(string $domain, string $codeset): void
|
function _bind_textdomain_codeset(string $domain, string $codeset): void
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,9 +56,9 @@ function __bind_textdomain_codeset(string $domain, string $codeset): void
|
|||||||
*
|
*
|
||||||
* @param string $domain Domain name
|
* @param string $domain Domain name
|
||||||
*/
|
*/
|
||||||
function __textdomain(string $domain): void
|
function _textdomain(string $domain): void
|
||||||
{
|
{
|
||||||
L10n::getInstance()->setDomain($domain);
|
Loader::getInstance()->setDomain($domain);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -60,9 +68,9 @@ function __textdomain(string $domain): void
|
|||||||
*
|
*
|
||||||
* @return string translated string (or original, if not found)
|
* @return string translated string (or original, if not found)
|
||||||
*/
|
*/
|
||||||
function __gettext(string $msgid): string
|
function _gettext(string $msgid): string
|
||||||
{
|
{
|
||||||
return L10n::getInstance()->getTranslator()->gettext(
|
return Loader::getInstance()->getTranslator()->gettext(
|
||||||
$msgid
|
$msgid
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -76,7 +84,7 @@ function __gettext(string $msgid): string
|
|||||||
*/
|
*/
|
||||||
function __(string $msgid): string
|
function __(string $msgid): string
|
||||||
{
|
{
|
||||||
return L10n::getInstance()->getTranslator()->gettext(
|
return Loader::getInstance()->getTranslator()->gettext(
|
||||||
$msgid
|
$msgid
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -90,9 +98,9 @@ function __(string $msgid): string
|
|||||||
*
|
*
|
||||||
* @return string translated plural form
|
* @return string translated plural form
|
||||||
*/
|
*/
|
||||||
function __ngettext(string $msgid, string $msgidPlural, int $number): string
|
function _ngettext(string $msgid, string $msgidPlural, int $number): string
|
||||||
{
|
{
|
||||||
return L10n::getInstance()->getTranslator()->ngettext(
|
return Loader::getInstance()->getTranslator()->ngettext(
|
||||||
$msgid,
|
$msgid,
|
||||||
$msgidPlural,
|
$msgidPlural,
|
||||||
$number
|
$number
|
||||||
@@ -107,9 +115,9 @@ function __ngettext(string $msgid, string $msgidPlural, int $number): string
|
|||||||
*
|
*
|
||||||
* @return string translated plural form
|
* @return string translated plural form
|
||||||
*/
|
*/
|
||||||
function __pgettext(string $msgctxt, string $msgid): string
|
function _pgettext(string $msgctxt, string $msgid): string
|
||||||
{
|
{
|
||||||
return L10n::getInstance()->getTranslator()->pgettext(
|
return Loader::getInstance()->getTranslator()->pgettext(
|
||||||
$msgctxt,
|
$msgctxt,
|
||||||
$msgid
|
$msgid
|
||||||
);
|
);
|
||||||
@@ -125,9 +133,9 @@ function __pgettext(string $msgctxt, string $msgid): string
|
|||||||
*
|
*
|
||||||
* @return string translated plural form
|
* @return string translated plural form
|
||||||
*/
|
*/
|
||||||
function __npgettext(string $msgctxt, string $msgid, string $msgidPlural, int $number): string
|
function _npgettext(string $msgctxt, string $msgid, string $msgidPlural, int $number): string
|
||||||
{
|
{
|
||||||
return L10n::getInstance()->getTranslator()->npgettext(
|
return Loader::getInstance()->getTranslator()->npgettext(
|
||||||
$msgctxt,
|
$msgctxt,
|
||||||
$msgid,
|
$msgid,
|
||||||
$msgidPlural,
|
$msgidPlural,
|
||||||
@@ -143,9 +151,9 @@ function __npgettext(string $msgctxt, string $msgid, string $msgidPlural, int $n
|
|||||||
*
|
*
|
||||||
* @return string translated string (or original, if not found)
|
* @return string translated string (or original, if not found)
|
||||||
*/
|
*/
|
||||||
function __dgettext(string $domain, string $msgid): string
|
function _dgettext(string $domain, string $msgid): string
|
||||||
{
|
{
|
||||||
return L10n::getInstance()->getTranslator('', '', $domain)->gettext(
|
return Loader::getInstance()->getTranslator('', '', $domain)->gettext(
|
||||||
$msgid
|
$msgid
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -160,9 +168,9 @@ function __dgettext(string $domain, string $msgid): string
|
|||||||
*
|
*
|
||||||
* @return string translated plural form
|
* @return string translated plural form
|
||||||
*/
|
*/
|
||||||
function __dngettext(string $domain, string $msgid, string $msgidPlural, int $number): string
|
function _dngettext(string $domain, string $msgid, string $msgidPlural, int $number): string
|
||||||
{
|
{
|
||||||
return L10n::getInstance()->getTranslator('', '', $domain)->ngettext(
|
return Loader::getInstance()->getTranslator('', '', $domain)->ngettext(
|
||||||
$msgid,
|
$msgid,
|
||||||
$msgidPlural,
|
$msgidPlural,
|
||||||
$number
|
$number
|
||||||
@@ -178,9 +186,9 @@ function __dngettext(string $domain, string $msgid, string $msgidPlural, int $nu
|
|||||||
*
|
*
|
||||||
* @return string translated plural form
|
* @return string translated plural form
|
||||||
*/
|
*/
|
||||||
function __dpgettext(string $domain, string $msgctxt, string $msgid): string
|
function _dpgettext(string $domain, string $msgctxt, string $msgid): string
|
||||||
{
|
{
|
||||||
return L10n::getInstance()->getTranslator('', '', $domain)->pgettext(
|
return Loader::getInstance()->getTranslator('', '', $domain)->pgettext(
|
||||||
$msgctxt,
|
$msgctxt,
|
||||||
$msgid
|
$msgid
|
||||||
);
|
);
|
||||||
@@ -197,9 +205,9 @@ function __dpgettext(string $domain, string $msgctxt, string $msgid): string
|
|||||||
*
|
*
|
||||||
* @return string translated plural form
|
* @return string translated plural form
|
||||||
*/
|
*/
|
||||||
function __dnpgettext(string $domain, string $msgctxt, string $msgid, string $msgidPlural, int $number): string
|
function _dnpgettext(string $domain, string $msgctxt, string $msgid, string $msgidPlural, int $number): string
|
||||||
{
|
{
|
||||||
return L10n::getInstance()->getTranslator('', '', $domain)->npgettext(
|
return Loader::getInstance()->getTranslator('', '', $domain)->npgettext(
|
||||||
$msgctxt,
|
$msgctxt,
|
||||||
$msgid,
|
$msgid,
|
||||||
$msgidPlural,
|
$msgidPlural,
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ class SmartyExtend extends \Smarty
|
|||||||
/** @var string */
|
/** @var string */
|
||||||
public $lang;
|
public $lang;
|
||||||
/** @var string */
|
/** @var string */
|
||||||
|
public $locale_set;
|
||||||
|
/** @var string */
|
||||||
public $lang_short;
|
public $lang_short;
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public $domain;
|
public $domain;
|
||||||
@@ -164,16 +166,22 @@ class SmartyExtend extends \Smarty
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
// iinit lang
|
// iinit lang
|
||||||
$this->l10n = $l10n;
|
$this->l10n = $l10n;
|
||||||
// opt load functions so we can use legacy init for smarty run perhaps
|
|
||||||
$this->l10n->loadFunctions();
|
|
||||||
// parse and read, legacy stuff
|
// parse and read, legacy stuff
|
||||||
$this->encoding = $locale['encoding'];
|
$this->encoding = $locale['encoding'];
|
||||||
$this->lang = $locale['lang'];
|
$this->lang = $locale['lang'];
|
||||||
// get first part from lang
|
// get first part from lang
|
||||||
$this->lang_short = explode('_', $locale['lang'])[0];
|
$this->lang_short = explode('_', $locale['lang'])[0];
|
||||||
$this->domain = $this->l10n->getDomain();
|
$this->domain = $this->l10n->getDomain();
|
||||||
|
$this->locale_set = $this->l10n->getLocaleSet();
|
||||||
$this->lang_dir = $this->l10n->getBaseLocalePath();
|
$this->lang_dir = $this->l10n->getBaseLocalePath();
|
||||||
|
|
||||||
|
// opt load functions so we can use legacy init for smarty run perhaps
|
||||||
|
\CoreLibs\Language\L10n::loadFunctions();
|
||||||
|
_setlocale(LC_MESSAGES, $locale['locale']);
|
||||||
|
_textdomain($this->domain);
|
||||||
|
_bindtextdomain($this->domain, $this->lang_dir);
|
||||||
|
_bind_textdomain_codeset($this->domain, $this->encoding);
|
||||||
|
|
||||||
// register smarty variable
|
// register smarty variable
|
||||||
$this->registerPlugin('modifier', 'getvar', [&$this, 'getTemplateVars']);
|
$this->registerPlugin('modifier', 'getvar', [&$this, 'getTemplateVars']);
|
||||||
|
|
||||||
@@ -307,16 +315,24 @@ class SmartyExtend extends \Smarty
|
|||||||
}
|
}
|
||||||
// javascript translate data as template for auto translate
|
// javascript translate data as template for auto translate
|
||||||
if (empty($this->TEMPLATE_TRANSLATE)) {
|
if (empty($this->TEMPLATE_TRANSLATE)) {
|
||||||
$this->TEMPLATE_TRANSLATE = 'jsTranslate_' . $this->lang . '.tpl';
|
$this->TEMPLATE_TRANSLATE = 'jsTranslate_'
|
||||||
|
. $this->locale_set . '.' . $this->encoding
|
||||||
|
. '.tpl';
|
||||||
} else {
|
} else {
|
||||||
// we assume we have some fixed set
|
// we assume we have some fixed set
|
||||||
// we must add _<$this->lang>
|
// we must add _<$this->lang>
|
||||||
// if .tpl, put before .tpl
|
// if .tpl, put before .tpl
|
||||||
// if not .tpl, add _<$this->lang>.tpl
|
// if not .tpl, add _<$this->lang>.tpl
|
||||||
if (strpos($this->TEMPLATE_TRANSLATE, '.tpl')) {
|
if (strpos($this->TEMPLATE_TRANSLATE, '.tpl')) {
|
||||||
$this->TEMPLATE_TRANSLATE = str_replace('.tpl', '_' . $this->lang . '.tpl', $this->TEMPLATE_TRANSLATE);
|
$this->TEMPLATE_TRANSLATE = str_replace(
|
||||||
|
'.tpl',
|
||||||
|
'-' . $this->locale_set . '.' . $this->encoding . '.tpl',
|
||||||
|
$this->TEMPLATE_TRANSLATE
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$this->TEMPLATE_TRANSLATE .= '_' . $this->lang . '.tpl';
|
$this->TEMPLATE_TRANSLATE .= '_'
|
||||||
|
. $this->locale_set . '.' . $this->encoding
|
||||||
|
. '.tpl';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if we can't find it, dump it
|
// if we can't find it, dump it
|
||||||
|
|||||||
@@ -3,30 +3,19 @@
|
|||||||
/**
|
/**
|
||||||
* smarty-gettext.php - Gettext support for smarty
|
* smarty-gettext.php - Gettext support for smarty
|
||||||
*
|
*
|
||||||
* ------------------------------------------------------------------------- *
|
|
||||||
* This library is free software; you can redistribute it and/or *
|
|
||||||
* modify it under the terms of the GNU Lesser General Public *
|
|
||||||
* License as published by the Free Software Foundation; either *
|
|
||||||
* version 2.1 of the License, or (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* This library is distributed in the hope that it will be useful, *
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
|
||||||
* Lesser General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the GNU Lesser General Public *
|
|
||||||
* License along with this library; if not, write to the Free Software *
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
|
|
||||||
* ------------------------------------------------------------------------- *
|
|
||||||
*
|
|
||||||
* To register as a smarty block function named 't', use:
|
* To register as a smarty block function named 't', use:
|
||||||
* $smarty->register_block('t', 'smarty_translate');
|
* $smarty->register_block('t', 'smarty_translate');
|
||||||
*
|
*
|
||||||
|
* NOTE: native php support for conext sensitive does not exist
|
||||||
|
* Those jumps are disabled
|
||||||
|
*
|
||||||
* @package smarty-gettext
|
* @package smarty-gettext
|
||||||
* @version $Id: block.t.php 4738 2022-05-06 01:28:48Z clemens $
|
* @version $Id: block.t.php 4738 2022-05-06 01:28:48Z clemens $
|
||||||
* @link http://smarty-gettext.sf.net/
|
* @link http://smarty-gettext.sf.net/
|
||||||
* @author Sagi Bashari <sagi@boom.org.il>
|
* @author Sagi Bashari <sagi@boom.org.il>
|
||||||
* @copyright 2004 Sagi Bashari
|
* @copyright 2004 Sagi Bashari
|
||||||
|
* @copyright Elan Ruusamäe
|
||||||
|
* @copyright Clemens Schwaighofer
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,7 +28,7 @@
|
|||||||
*/
|
*/
|
||||||
function smarty_gettext_strarg($str/*, $varargs... */)
|
function smarty_gettext_strarg($str/*, $varargs... */)
|
||||||
{
|
{
|
||||||
$tr = array();
|
$tr = [];
|
||||||
$p = 0;
|
$p = 0;
|
||||||
|
|
||||||
$nargs = func_num_args();
|
$nargs = func_num_args();
|
||||||
@@ -68,14 +57,18 @@ function smarty_gettext_strarg($str/*, $varargs... */)
|
|||||||
* - escape - sets escape mode:
|
* - escape - sets escape mode:
|
||||||
* - 'html' for HTML escaping, this is the default.
|
* - 'html' for HTML escaping, this is the default.
|
||||||
* - 'js' for javascript escaping.
|
* - 'js' for javascript escaping.
|
||||||
|
* - 'url' for url escaping.
|
||||||
* - 'no'/'off'/0 - turns off escaping
|
* - 'no'/'off'/0 - turns off escaping
|
||||||
* - plural - The plural version of the text (2nd parameter of ngettext())
|
* - plural - The plural version of the text (2nd parameter of ngettext())
|
||||||
* - count - The item count for plural mode (3rd parameter of ngettext())
|
* - count - The item count for plural mode (3rd parameter of ngettext())
|
||||||
|
* - domain - Textdomain to be used, default if skipped (dgettext() instead of gettext())
|
||||||
|
* - context - gettext context. reserved for future use.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// cs modified: __ calls instead of direct gettext calls
|
// cs modified: __ calls instead of direct gettext calls
|
||||||
|
|
||||||
function smarty_block_t($params, $text, $template, &$repeat)
|
function smarty_block_t($params, $text)
|
||||||
{
|
{
|
||||||
if (!isset($text)) {
|
if (!isset($text)) {
|
||||||
return $text;
|
return $text;
|
||||||
@@ -101,11 +94,75 @@ function smarty_block_t($params, $text, $template, &$repeat)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// get domain param
|
||||||
|
if (isset($params['domain'])) {
|
||||||
|
$domain = $params['domain'];
|
||||||
|
unset($params['domain']);
|
||||||
|
} else {
|
||||||
|
$domain = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get context param
|
||||||
|
if (isset($params['context'])) {
|
||||||
|
$context = $params['context'];
|
||||||
|
unset($params['context']);
|
||||||
|
} else {
|
||||||
|
$context = null;
|
||||||
|
}
|
||||||
|
|
||||||
// use plural if required parameters are set
|
// use plural if required parameters are set
|
||||||
if (isset($count) && isset($plural)) {
|
if (isset($count) && isset($plural)) {
|
||||||
$text = $template->l10n->__ngettext($text, $plural, $count);
|
if (isset($domain) && isset($context)) {
|
||||||
|
if (is_callable('_dnpgettext')) {
|
||||||
|
$text = _dnpgettext($domain, $context, $text, $plural, $count);
|
||||||
|
}/* elseif (is_callable('dnpgettext')) {
|
||||||
|
$text = dnpgettext($domain, $context, $text, $plural, $count);
|
||||||
|
} */
|
||||||
|
} elseif (isset($domain)) {
|
||||||
|
if (is_callable('_dngettext')) {
|
||||||
|
$text = _dngettext($domain, $text, $plural, $count);
|
||||||
|
} elseif (is_callable('dngettext')) {
|
||||||
|
$text = dngettext($domain, $text, $plural, $count);
|
||||||
|
}
|
||||||
|
} elseif (isset($context)) {
|
||||||
|
if (is_callable('_npgettext')) {
|
||||||
|
$text = _npgettext($context, $text, $plural, $count);
|
||||||
|
}/* elseif (is_callable('npgettext')) {
|
||||||
|
$text = npgettext($context, $text, $plural, $count);
|
||||||
|
} */
|
||||||
|
} else {
|
||||||
|
if (is_callable('_ngettext')) {
|
||||||
|
$text = _ngettext($text, $plural, $count);
|
||||||
|
} elseif (is_callable('ngettext')) {
|
||||||
|
$text = ngettext($text, $plural, $count);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else { // use normal
|
} else { // use normal
|
||||||
$text = $template->l10n->__($text);
|
if (isset($domain) && isset($context)) {
|
||||||
|
if (is_callable('_dpgettext')) {
|
||||||
|
$text = _dpgettext($domain, $context, $text);
|
||||||
|
}/* elseif (is_callable('dpgettext')) {
|
||||||
|
$text = dpgettext($domain, $context, $text);
|
||||||
|
} */
|
||||||
|
} elseif (isset($domain)) {
|
||||||
|
if (is_callable('_dgettext')) {
|
||||||
|
$text = _dgettext($domain, $text);
|
||||||
|
} elseif (is_callable('dpgettext')) {
|
||||||
|
$text = dgettext($domain, $text);
|
||||||
|
}
|
||||||
|
} elseif (isset($context)) {
|
||||||
|
if (is_callable('_pgettext')) {
|
||||||
|
$text = _pgettext($context, $text);
|
||||||
|
}/* elseif (is_callable('pgettext')) {
|
||||||
|
$text = pgettext($context, $text);
|
||||||
|
} */
|
||||||
|
} else {
|
||||||
|
if (is_callable('_gettext')) {
|
||||||
|
$text = _gettext($text);
|
||||||
|
} elseif (is_callable('gettext')) {
|
||||||
|
$text = gettext($text);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// run strarg if there are parameters
|
// run strarg if there are parameters
|
||||||
@@ -115,6 +172,7 @@ function smarty_block_t($params, $text, $template, &$repeat)
|
|||||||
|
|
||||||
switch ($escape) {
|
switch ($escape) {
|
||||||
case 'html':
|
case 'html':
|
||||||
|
// default
|
||||||
$text = nl2br(htmlspecialchars($text));
|
$text = nl2br(htmlspecialchars($text));
|
||||||
break;
|
break;
|
||||||
case 'javascript':
|
case 'javascript':
|
||||||
@@ -122,13 +180,29 @@ function smarty_block_t($params, $text, $template, &$repeat)
|
|||||||
// javascript escape
|
// javascript escape
|
||||||
$text = strtr(
|
$text = strtr(
|
||||||
$text,
|
$text,
|
||||||
array('\\' => '\\\\', "'" => "\\'", '"' => '\\"', "\r" => '\\r', "\n" => '\\n', '</' => '<\/')
|
[
|
||||||
|
'\\' => '\\\\',
|
||||||
|
"'" => "\\'",
|
||||||
|
'"' => '\\"',
|
||||||
|
"\r" => '\\r',
|
||||||
|
"\n" => '\\n',
|
||||||
|
'</' => '<\/'
|
||||||
|
]
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'url':
|
case 'url':
|
||||||
// url escape
|
// url escape
|
||||||
$text = urlencode($text);
|
$text = urlencode($text);
|
||||||
break;
|
break;
|
||||||
|
// below is a list for explicit OFF
|
||||||
|
case 'no':
|
||||||
|
case 'off':
|
||||||
|
case 'false':
|
||||||
|
case '0':
|
||||||
|
case 0:
|
||||||
|
// explicit OFF
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $text;
|
return $text;
|
||||||
|
|||||||
1
www/vendor/composer/autoload_classmap.php
vendored
1
www/vendor/composer/autoload_classmap.php
vendored
@@ -48,7 +48,6 @@ return array(
|
|||||||
'CoreLibs\\Language\\Core\\StringReader' => $baseDir . '/lib/CoreLibs/Language/Core/StringReader.php',
|
'CoreLibs\\Language\\Core\\StringReader' => $baseDir . '/lib/CoreLibs/Language/Core/StringReader.php',
|
||||||
'CoreLibs\\Language\\Encoding' => $baseDir . '/lib/CoreLibs/Language/Encoding.php',
|
'CoreLibs\\Language\\Encoding' => $baseDir . '/lib/CoreLibs/Language/Encoding.php',
|
||||||
'CoreLibs\\Language\\GetLocale' => $baseDir . '/lib/CoreLibs/Language/GetLocale.php',
|
'CoreLibs\\Language\\GetLocale' => $baseDir . '/lib/CoreLibs/Language/GetLocale.php',
|
||||||
'CoreLibs\\Language\\GetSettings' => $baseDir . '/lib/CoreLibs/Language/GetSettings.php',
|
|
||||||
'CoreLibs\\Language\\L10n' => $baseDir . '/lib/CoreLibs/Language/L10n.php',
|
'CoreLibs\\Language\\L10n' => $baseDir . '/lib/CoreLibs/Language/L10n.php',
|
||||||
'CoreLibs\\Output\\Form\\Elements' => $baseDir . '/lib/CoreLibs/Output/Form/Elements.php',
|
'CoreLibs\\Output\\Form\\Elements' => $baseDir . '/lib/CoreLibs/Output/Form/Elements.php',
|
||||||
'CoreLibs\\Output\\Form\\Generate' => $baseDir . '/lib/CoreLibs/Output/Form/Generate.php',
|
'CoreLibs\\Output\\Form\\Generate' => $baseDir . '/lib/CoreLibs/Output/Form/Generate.php',
|
||||||
|
|||||||
1
www/vendor/composer/autoload_static.php
vendored
1
www/vendor/composer/autoload_static.php
vendored
@@ -113,7 +113,6 @@ class ComposerStaticInit10fe8fe2ec4017b8644d2b64bcf398b9
|
|||||||
'CoreLibs\\Language\\Core\\StringReader' => __DIR__ . '/../..' . '/lib/CoreLibs/Language/Core/StringReader.php',
|
'CoreLibs\\Language\\Core\\StringReader' => __DIR__ . '/../..' . '/lib/CoreLibs/Language/Core/StringReader.php',
|
||||||
'CoreLibs\\Language\\Encoding' => __DIR__ . '/../..' . '/lib/CoreLibs/Language/Encoding.php',
|
'CoreLibs\\Language\\Encoding' => __DIR__ . '/../..' . '/lib/CoreLibs/Language/Encoding.php',
|
||||||
'CoreLibs\\Language\\GetLocale' => __DIR__ . '/../..' . '/lib/CoreLibs/Language/GetLocale.php',
|
'CoreLibs\\Language\\GetLocale' => __DIR__ . '/../..' . '/lib/CoreLibs/Language/GetLocale.php',
|
||||||
'CoreLibs\\Language\\GetSettings' => __DIR__ . '/../..' . '/lib/CoreLibs/Language/GetSettings.php',
|
|
||||||
'CoreLibs\\Language\\L10n' => __DIR__ . '/../..' . '/lib/CoreLibs/Language/L10n.php',
|
'CoreLibs\\Language\\L10n' => __DIR__ . '/../..' . '/lib/CoreLibs/Language/L10n.php',
|
||||||
'CoreLibs\\Output\\Form\\Elements' => __DIR__ . '/../..' . '/lib/CoreLibs/Output/Form/Elements.php',
|
'CoreLibs\\Output\\Form\\Elements' => __DIR__ . '/../..' . '/lib/CoreLibs/Output/Form/Elements.php',
|
||||||
'CoreLibs\\Output\\Form\\Generate' => __DIR__ . '/../..' . '/lib/CoreLibs/Output/Form/Generate.php',
|
'CoreLibs\\Output\\Form\\Generate' => __DIR__ . '/../..' . '/lib/CoreLibs/Output/Form/Generate.php',
|
||||||
|
|||||||
Reference in New Issue
Block a user