Compare commits
2 Commits
1b5437b675
...
v9.16.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5cec54d508 | ||
|
|
8e60c992f1 |
@@ -39,6 +39,11 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
|
|||||||
'str' => 'OK',
|
'str' => 'OK',
|
||||||
'expected' => 'ok',
|
'expected' => 'ok',
|
||||||
],
|
],
|
||||||
|
'success' => [
|
||||||
|
'level' => 'success',
|
||||||
|
'str' => 'SUCCESS',
|
||||||
|
'expected' => 'success',
|
||||||
|
],
|
||||||
'info' => [
|
'info' => [
|
||||||
'level' => 'info',
|
'level' => 'info',
|
||||||
'str' => 'INFO',
|
'str' => 'INFO',
|
||||||
|
|||||||
@@ -39,9 +39,9 @@ parameters:
|
|||||||
- www/vendor
|
- www/vendor
|
||||||
# ignore errores with
|
# ignore errores with
|
||||||
ignoreErrors:
|
ignoreErrors:
|
||||||
- # in the class_test tree we allow deprecated calls
|
# - # in the class_test tree we allow deprecated calls
|
||||||
message: "#^Call to deprecated method #"
|
# message: "#^Call to deprecated method #"
|
||||||
path: %currentWorkingDirectory%/www/admin/class_test.*.php
|
# path: %currentWorkingDirectory%/www/admin/class_test.*.php
|
||||||
# - '#Expression in empty\(\) is always falsy.#'
|
# - '#Expression in empty\(\) is always falsy.#'
|
||||||
# -
|
# -
|
||||||
# message: '#Reflection error: [a-zA-Z0-9\\_]+ not found.#'
|
# message: '#Reflection error: [a-zA-Z0-9\\_]+ not found.#'
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
|||||||
|
|
||||||
$string = "Something < = > Other <br> Next line and Quotes '\"";
|
$string = "Something < = > Other <br> Next line and Quotes '\"";
|
||||||
echo "String: <pre>$string</pre><br>";
|
echo "String: <pre>$string</pre><br>";
|
||||||
|
$log->debug('HTMLENT', Html::htmlent($string));
|
||||||
print "HTMLENT: " . Html::htmlent($string) . ": " . $_html->htmlent($string) . " (" . htmlentities($string) . ")<br>";
|
print "HTMLENT: " . Html::htmlent($string) . ": " . $_html->htmlent($string) . " (" . htmlentities($string) . ")<br>";
|
||||||
print "REMOVELB: " . Html::htmlent($string) . ": " . $_html->removeLB($string) . "<br>";
|
print "REMOVELB: " . Html::htmlent($string) . ": " . $_html->removeLB($string) . "<br>";
|
||||||
$date_str = [2021, 5, 1, 11, 10];
|
$date_str = [2021, 5, 1, 11, 10];
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ $log->debug('SOME MARK', 'Some error output');
|
|||||||
print "EDIT ACCESS ID: " . $backend->edit_access_id . "<br>";
|
print "EDIT ACCESS ID: " . $backend->edit_access_id . "<br>";
|
||||||
if (is_object($login)) {
|
if (is_object($login)) {
|
||||||
// print "ACL: <br>".$backend->print_ar($login->loginGetAcl())."<br>";
|
// print "ACL: <br>".$backend->print_ar($login->loginGetAcl())."<br>";
|
||||||
$log->debug('ACL', "ACL: " . \CoreLibs\Debug\Support::dumpVar($login->loginGetAcl()));
|
// $log->debug('ACL', "ACL: " . \CoreLibs\Debug\Support::dumpVar($login->loginGetAcl()));
|
||||||
// print "DEFAULT ACL: <br>".$backend->print_ar($login->default_acl_list)."<br>";
|
// print "DEFAULT ACL: <br>".$backend->print_ar($login->default_acl_list)."<br>";
|
||||||
// print "DEFAULT ACL: <br>".$backend->print_ar($login->default_acl_list)."<br>";
|
// print "DEFAULT ACL: <br>".$backend->print_ar($login->default_acl_list)."<br>";
|
||||||
// $result = array_flip(
|
// $result = array_flip(
|
||||||
|
|||||||
@@ -931,7 +931,7 @@ function rel(base) // eslint-disable-line no-unused-vars
|
|||||||
/**
|
/**
|
||||||
* searches and removes style from css array
|
* searches and removes style from css array
|
||||||
* @param {Object} _element element to work one
|
* @param {Object} _element element to work one
|
||||||
* @param {String css style sheet to remove (name)
|
* @param {String} css style sheet to remove (name)
|
||||||
* @return {Object} returns full element
|
* @return {Object} returns full element
|
||||||
*/
|
*/
|
||||||
function rcssel(_element, css)
|
function rcssel(_element, css)
|
||||||
|
|||||||
@@ -504,9 +504,9 @@ class Backend
|
|||||||
string $data,
|
string $data,
|
||||||
string $key_name,
|
string $key_name,
|
||||||
string $key_value,
|
string $key_value,
|
||||||
string $associate = null,
|
?string $associate = null,
|
||||||
string $file = null,
|
?string $file = null,
|
||||||
string $db_schema = null,
|
?string $db_schema = null,
|
||||||
): void {
|
): void {
|
||||||
/** @var string $DB_SCHEMA check schema */
|
/** @var string $DB_SCHEMA check schema */
|
||||||
$DB_SCHEMA = 'public';
|
$DB_SCHEMA = 'public';
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ class Basic
|
|||||||
* @deprecated DO NOT USE Class\Basic anymore. Use dedicated logger and sub classes
|
* @deprecated DO NOT USE Class\Basic anymore. Use dedicated logger and sub classes
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
\CoreLibs\Logging\Logging $log = null,
|
?\CoreLibs\Logging\Logging $log = null,
|
||||||
?string $session_name = null
|
?string $session_name = null
|
||||||
) {
|
) {
|
||||||
trigger_error('Class \CoreLibs\Basic is deprected', E_USER_DEPRECATED);
|
trigger_error('Class \CoreLibs\Basic is deprected', E_USER_DEPRECATED);
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class SetVarTypeMain
|
|||||||
*/
|
*/
|
||||||
protected static function makeStrMain(
|
protected static function makeStrMain(
|
||||||
mixed $val,
|
mixed $val,
|
||||||
string $default = null,
|
?string $default = null,
|
||||||
bool $to_null = false
|
bool $to_null = false
|
||||||
): ?string {
|
): ?string {
|
||||||
// int/float/string/bool/null, everything else is ignored
|
// int/float/string/bool/null, everything else is ignored
|
||||||
@@ -113,7 +113,7 @@ class SetVarTypeMain
|
|||||||
*/
|
*/
|
||||||
protected static function makeIntMain(
|
protected static function makeIntMain(
|
||||||
mixed $val,
|
mixed $val,
|
||||||
int $default = null,
|
?int $default = null,
|
||||||
bool $to_null = false
|
bool $to_null = false
|
||||||
): ?int {
|
): ?int {
|
||||||
// if we can filter it to a valid int, we can convert it
|
// if we can filter it to a valid int, we can convert it
|
||||||
@@ -167,7 +167,7 @@ class SetVarTypeMain
|
|||||||
*/
|
*/
|
||||||
protected static function makeFloatMain(
|
protected static function makeFloatMain(
|
||||||
mixed $val,
|
mixed $val,
|
||||||
float $default = null,
|
?float $default = null,
|
||||||
bool $to_null = false
|
bool $to_null = false
|
||||||
): ?float {
|
): ?float {
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class SetVarTypeNull extends Extends\SetVarTypeMain
|
|||||||
* @param string|null $default Default override value
|
* @param string|null $default Default override value
|
||||||
* @return string|null Input value as string or default as string/null
|
* @return string|null Input value as string or default as string/null
|
||||||
*/
|
*/
|
||||||
public static function makeStr(mixed $val, string $default = null): ?string
|
public static function makeStr(mixed $val, ?string $default = null): ?string
|
||||||
{
|
{
|
||||||
return SetVarTypeMain::makeStrMain($val, $default, true);
|
return SetVarTypeMain::makeStrMain($val, $default, true);
|
||||||
}
|
}
|
||||||
@@ -60,7 +60,7 @@ class SetVarTypeNull extends Extends\SetVarTypeMain
|
|||||||
* @param int|null $default Default override value
|
* @param int|null $default Default override value
|
||||||
* @return int|null Input value as int or default as int/null
|
* @return int|null Input value as int or default as int/null
|
||||||
*/
|
*/
|
||||||
public static function makeInt(mixed $val, int $default = null): ?int
|
public static function makeInt(mixed $val, ?int $default = null): ?int
|
||||||
{
|
{
|
||||||
return SetVarTypeMain::makeIntMain($val, $default, true);
|
return SetVarTypeMain::makeIntMain($val, $default, true);
|
||||||
}
|
}
|
||||||
@@ -84,7 +84,7 @@ class SetVarTypeNull extends Extends\SetVarTypeMain
|
|||||||
* @param float|null $default Default override value
|
* @param float|null $default Default override value
|
||||||
* @return float|null Input value as float or default as float/null
|
* @return float|null Input value as float or default as float/null
|
||||||
*/
|
*/
|
||||||
public static function makeFloat(mixed $val, float $default = null): ?float
|
public static function makeFloat(mixed $val, ?float $default = null): ?float
|
||||||
{
|
{
|
||||||
return SetVarTypeMain::makeFloatMain($val, $default, true);
|
return SetVarTypeMain::makeFloatMain($val, $default, true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1896,7 +1896,12 @@ class IO
|
|||||||
$matches = [];
|
$matches = [];
|
||||||
// compare has =, >, < prefix, and gets stripped
|
// compare has =, >, < prefix, and gets stripped
|
||||||
// if the rest is not X.Y format then error
|
// if the rest is not X.Y format then error
|
||||||
preg_match("/^([<>=]{1,})(\d{1,})\.(\d{1,})/", $compare, $matches);
|
if (!preg_match("/^([<>=]{1,})(\d{1,})\.(\d{1,})/", $compare, $matches)) {
|
||||||
|
$this->log->error('Could not regex match compare version string', [
|
||||||
|
"compare" => $compare
|
||||||
|
]);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
$compare = $matches[1];
|
$compare = $matches[1];
|
||||||
$to_master = $matches[2];
|
$to_master = $matches[2];
|
||||||
$to_minor = $matches[3];
|
$to_minor = $matches[3];
|
||||||
@@ -1908,11 +1913,18 @@ class IO
|
|||||||
}
|
}
|
||||||
// db_version can return X.Y.Z
|
// db_version can return X.Y.Z
|
||||||
// we only compare the first two
|
// we only compare the first two
|
||||||
preg_match(
|
if (
|
||||||
"/^(\d{1,})\.(\d{1,})\.?(\d{1,})?/",
|
!preg_match(
|
||||||
$this->dbVersion(),
|
"/^(\d{1,})\.(\d{1,})\.?(\d{1,})?/",
|
||||||
$matches
|
$this->dbVersion(),
|
||||||
);
|
$matches
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
$this->log->error('Could not regex match dbVersion string', [
|
||||||
|
"dbVersion" => $this->dbVersion()
|
||||||
|
]);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
$master = $matches[1];
|
$master = $matches[1];
|
||||||
$minor = $matches[2];
|
$minor = $matches[2];
|
||||||
$version = $master . ($minor < 10 ? '0' : '') . $minor;
|
$version = $master . ($minor < 10 ? '0' : '') . $minor;
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ class System
|
|||||||
* and retuns them in an array with index of io source
|
* and retuns them in an array with index of io source
|
||||||
* if address source has addresses with "," will add "-array" with these as array block
|
* if address source has addresses with "," will add "-array" with these as array block
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array<string,string|array<string>>
|
||||||
*/
|
*/
|
||||||
public static function getIpAddresses(): array
|
public static function getIpAddresses(): array
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ class GetLocale
|
|||||||
$matches
|
$matches
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
$lang = ($matches['lang'] ?? 'en')
|
$lang = $matches['lang']
|
||||||
// add country only if set
|
// add country only if set
|
||||||
. (!empty($matches['country']) ? '_' . $matches['country'] : '');
|
. (!empty($matches['country']) ? '_' . $matches['country'] : '');
|
||||||
} else {
|
} else {
|
||||||
@@ -235,7 +235,7 @@ class GetLocale
|
|||||||
$matches
|
$matches
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
$lang = ($matches['lang'] ?? 'en')
|
$lang = $matches['lang']
|
||||||
// add country only if set
|
// add country only if set
|
||||||
. (!empty($matches['country']) ? '_' . $matches['country'] : '');
|
. (!empty($matches['country']) ? '_' . $matches['country'] : '');
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ namespace CoreLibs\Logging\Logger;
|
|||||||
enum MessageLevel: int
|
enum MessageLevel: int
|
||||||
{
|
{
|
||||||
case ok = 100;
|
case ok = 100;
|
||||||
|
case success = 110; // special for file uploads
|
||||||
case info = 200;
|
case info = 200;
|
||||||
case notice = 250;
|
case notice = 250;
|
||||||
case warn = 300;
|
case warn = 300;
|
||||||
@@ -30,6 +31,7 @@ enum MessageLevel: int
|
|||||||
{
|
{
|
||||||
return match (strtolower($name)) {
|
return match (strtolower($name)) {
|
||||||
'ok' => self::ok,
|
'ok' => self::ok,
|
||||||
|
'success' => self::success,
|
||||||
'info' => self::info,
|
'info' => self::info,
|
||||||
'notice' => self::notice,
|
'notice' => self::notice,
|
||||||
'warn', 'warning' => self::warn,
|
'warn', 'warning' => self::warn,
|
||||||
|
|||||||
@@ -194,13 +194,13 @@ class Elements
|
|||||||
"/(mailto:)?(\>)?\b([\w\.-]+)@([\w\.\-]+)\.([a-zA-Z]{2,4})\b(\|([^\||^#]+)(#([^\|]+))?\|)?/",
|
"/(mailto:)?(\>)?\b([\w\.-]+)@([\w\.\-]+)\.([a-zA-Z]{2,4})\b(\|([^\||^#]+)(#([^\|]+))?\|)?/",
|
||||||
function ($matches) {
|
function ($matches) {
|
||||||
return self::createEmail(
|
return self::createEmail(
|
||||||
$matches[1] ?? '',
|
$matches[1],
|
||||||
$matches[2] ?? '',
|
$matches[2],
|
||||||
$matches[3] ?? '',
|
$matches[3],
|
||||||
$matches[4] ?? '',
|
$matches[4],
|
||||||
$matches[5] ?? '',
|
$matches[5],
|
||||||
$matches[7] ?? '',
|
$matches[7] ?? '',
|
||||||
$matches[9] ?? ''
|
$matches[9] ?? '',
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
$output
|
$output
|
||||||
|
|||||||
@@ -236,10 +236,6 @@ class Block
|
|||||||
* @param array{tag:string,id:string,name:string,content:string,css:array<string>,options:array<string,string>,sub:array<mixed>} $tree
|
* @param array{tag:string,id:string,name:string,content:string,css:array<string>,options:array<string,string>,sub:array<mixed>} $tree
|
||||||
* @param bool $add_nl [default=false]
|
* @param bool $add_nl [default=false]
|
||||||
* @return string
|
* @return string
|
||||||
*
|
|
||||||
* @param array $tree
|
|
||||||
* @param bool $add_nl
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public static function phfo(array $tree, bool $add_nl = false): string
|
public static function phfo(array $tree, bool $add_nl = false): string
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -401,7 +401,7 @@ class Element
|
|||||||
* @param bool $add_nl [default=false] Optional output string line breaks
|
* @param bool $add_nl [default=false] Optional output string line breaks
|
||||||
* @return string HTML as string
|
* @return string HTML as string
|
||||||
*/
|
*/
|
||||||
public function buildHtml(Element $tree = null, bool $add_nl = false): string
|
public function buildHtml(?Element $tree = null, bool $add_nl = false): string
|
||||||
{
|
{
|
||||||
// print "D01: " . microtime(true) . "<br>";
|
// print "D01: " . microtime(true) . "<br>";
|
||||||
if ($tree === null) {
|
if ($tree === null) {
|
||||||
@@ -533,7 +533,7 @@ class Element
|
|||||||
* @return string build html as string
|
* @return string build html as string
|
||||||
* @deprecated Do not use, use Element->buildHtml() instead
|
* @deprecated Do not use, use Element->buildHtml() instead
|
||||||
*/
|
*/
|
||||||
public static function printHtmlFromObject(Element $tree = null, bool $add_nl = false): string
|
public static function printHtmlFromObject(?Element $tree = null, bool $add_nl = false): string
|
||||||
{
|
{
|
||||||
// nothing ->bad
|
// nothing ->bad
|
||||||
if ($tree === null) {
|
if ($tree === null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user