Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8de112ba7e | ||
|
|
ad070ebdf4 | ||
|
|
9edfc2acb6 |
@@ -36,7 +36,7 @@ if [ -n "${2}" ] && [ -z "${php_bin}" ]; then
|
|||||||
fi;
|
fi;
|
||||||
|
|
||||||
# Note 4dev/tests/bootstrap.php has to be set as bootstrap file in phpunit.xml
|
# Note 4dev/tests/bootstrap.php has to be set as bootstrap file in phpunit.xml
|
||||||
phpunit_call="${php_bin}${base}tools/phpunit ${opt_testdox} -c ${base}phpunit.xml ${base}4dev/tests/";
|
phpunit_call="${php_bin}${base}vendor/bin/phpunit ${opt_testdox} -c ${base}phpunit.xml ${base}4dev/tests/";
|
||||||
|
|
||||||
${phpunit_call};
|
${phpunit_call};
|
||||||
|
|
||||||
|
|||||||
@@ -319,6 +319,36 @@ final class CoreLibsConvertMathTest extends TestCase
|
|||||||
[6, 12, 18],
|
[6, 12, 18],
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
'inblanaced [2x2,3] x [3x2]' => [
|
||||||
|
'a' => [
|
||||||
|
[1, 2, 3],
|
||||||
|
[4, 5]
|
||||||
|
],
|
||||||
|
'b' => [
|
||||||
|
[6, 7],
|
||||||
|
[8, 9],
|
||||||
|
[10, 11]
|
||||||
|
],
|
||||||
|
'result' => [
|
||||||
|
[52, 58],
|
||||||
|
[64, 73],
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'inblanaced [2x3] x [3x1,2]' => [
|
||||||
|
'a' => [
|
||||||
|
[1, 2, 3],
|
||||||
|
[4, 5, 7]
|
||||||
|
],
|
||||||
|
'b' => [
|
||||||
|
[7, 8],
|
||||||
|
[9, 10],
|
||||||
|
[11]
|
||||||
|
],
|
||||||
|
'result' => [
|
||||||
|
[58, 28],
|
||||||
|
[150, 82],
|
||||||
|
]
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,11 +7,11 @@
|
|||||||
"php": ">=8.3"
|
"php": ">=8.3"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpstan/phpstan": "^1.12",
|
"phpstan/phpstan": "^2.0",
|
||||||
"phan/phan": "^5.4",
|
"phpstan/phpstan-deprecation-rules": "^2.0",
|
||||||
"phpstan/extension-installer": "^1.4",
|
"phpstan/extension-installer": "^1.4",
|
||||||
|
"phan/phan": "^5.4",
|
||||||
"phpunit/phpunit": "^9",
|
"phpunit/phpunit": "^9",
|
||||||
"phpstan/phpstan-deprecation-rules": "^1.2",
|
|
||||||
"yamadashy/phpstan-friendly-formatter": "^1.1"
|
"yamadashy/phpstan-friendly-formatter": "^1.1"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
includes:
|
includes:
|
||||||
- phpstan-conditional.php
|
- phpstan-conditional.php
|
||||||
#- ./vendor/yamadashy/phpstan-friendly-formatter/extension.neon
|
#- ./vendor/yamadashy/phpstan-friendly-formatter/extension.neon
|
||||||
|
# - phar://phpstan.phar/conf/bleedingEdge.neon
|
||||||
parameters:
|
parameters:
|
||||||
tmpDir: %currentWorkingDirectory%/tmp/phpstan-corelibs
|
tmpDir: %currentWorkingDirectory%/tmp/phpstan-corelibs
|
||||||
#errorFormat: friendly
|
#errorFormat: friendly
|
||||||
|
|||||||
@@ -115,9 +115,6 @@ print "ARRAYFLATFORKEY: " . DgS::printAr(ArrayHandler::arrayFlatForKey($test_arr
|
|||||||
*/
|
*/
|
||||||
function rec(string $pre, string $cur, array $node = [])
|
function rec(string $pre, string $cur, array $node = [])
|
||||||
{
|
{
|
||||||
if (!is_array($node)) {
|
|
||||||
$node = [];
|
|
||||||
}
|
|
||||||
print "<div style='color: green;'>#### PRE: " . $pre . ", CUR: " . $cur . ", N-c: "
|
print "<div style='color: green;'>#### PRE: " . $pre . ", CUR: " . $cur . ", N-c: "
|
||||||
. count($node) . " [" . join('|', array_keys($node)) . "]</div>";
|
. count($node) . " [" . join('|', array_keys($node)) . "]</div>";
|
||||||
if (!$pre) {
|
if (!$pre) {
|
||||||
|
|||||||
@@ -70,8 +70,7 @@ for ($i = 1; $i <= 6; $i++) {
|
|||||||
print $i . ") " . $cache_flag . ": "
|
print $i . ") " . $cache_flag . ": "
|
||||||
. "res: " . (is_bool($res) ?
|
. "res: " . (is_bool($res) ?
|
||||||
"<b>Bool:</b> " . Support::prBl($res) :
|
"<b>Bool:</b> " . Support::prBl($res) :
|
||||||
(is_array($res) ?
|
"Array: Yes"
|
||||||
"Array: " . Support::prBl(is_array($res)) : '{-}')
|
|
||||||
) . ", "
|
) . ", "
|
||||||
. "cursor_ext: <pre>" . Support::printAr(
|
. "cursor_ext: <pre>" . Support::printAr(
|
||||||
SetVarType::setArray($db->dbGetCursorExt($q_db_ret))
|
SetVarType::setArray($db->dbGetCursorExt($q_db_ret))
|
||||||
@@ -89,8 +88,7 @@ for ($i = 1; $i <= 6; $i++) {
|
|||||||
print $i . ") " . $cache_flag . ": "
|
print $i . ") " . $cache_flag . ": "
|
||||||
. "res: " . (is_bool($res) ?
|
. "res: " . (is_bool($res) ?
|
||||||
"<b>Bool:</b> " . Support::prBl($res) :
|
"<b>Bool:</b> " . Support::prBl($res) :
|
||||||
(is_array($res) ?
|
"Array: Yes"
|
||||||
"Array: " . Support::prBl(is_array($res)) : '{-}')
|
|
||||||
) . ", "
|
) . ", "
|
||||||
. "cursor_ext: <pre>" . Support::printAr(
|
. "cursor_ext: <pre>" . Support::printAr(
|
||||||
SetVarType::setArray($db->dbGetCursorExt($q_db_ret))
|
SetVarType::setArray($db->dbGetCursorExt($q_db_ret))
|
||||||
@@ -108,8 +106,7 @@ for ($i = 1; $i <= 6; $i++) {
|
|||||||
print $i . ") " . $cache_flag . ": "
|
print $i . ") " . $cache_flag . ": "
|
||||||
. "res: " . (is_bool($res) ?
|
. "res: " . (is_bool($res) ?
|
||||||
"<b>Bool:</b> " . Support::prBl($res) :
|
"<b>Bool:</b> " . Support::prBl($res) :
|
||||||
(is_array($res) ?
|
"Array: Yes"
|
||||||
"Array: " . Support::prBl(is_array($res)) : '{-}')
|
|
||||||
) . ", "
|
) . ", "
|
||||||
. "cursor_ext: <pre>" . Support::printAr(
|
. "cursor_ext: <pre>" . Support::printAr(
|
||||||
SetVarType::setArray($db->dbGetCursorExt($q_db_ret))
|
SetVarType::setArray($db->dbGetCursorExt($q_db_ret))
|
||||||
@@ -127,8 +124,7 @@ for ($i = 1; $i <= 6; $i++) {
|
|||||||
print $i . ") " . $cache_flag . ": "
|
print $i . ") " . $cache_flag . ": "
|
||||||
. "res: " . (is_bool($res) ?
|
. "res: " . (is_bool($res) ?
|
||||||
"<b>Bool:</b> " . Support::prBl($res) :
|
"<b>Bool:</b> " . Support::prBl($res) :
|
||||||
(is_array($res) ?
|
"Array: Yes"
|
||||||
"Array: " . Support::prBl(is_array($res)) : '{-}')
|
|
||||||
) . ", "
|
) . ", "
|
||||||
. "cursor_ext: <pre>" . Support::printAr(
|
. "cursor_ext: <pre>" . Support::printAr(
|
||||||
SetVarType::setArray($db->dbGetCursorExt($q_db_ret))
|
SetVarType::setArray($db->dbGetCursorExt($q_db_ret))
|
||||||
@@ -146,8 +142,7 @@ for ($i = 1; $i <= 6; $i++) {
|
|||||||
print $i . ") " . $cache_flag . ": "
|
print $i . ") " . $cache_flag . ": "
|
||||||
. "res: " . (is_bool($res) ?
|
. "res: " . (is_bool($res) ?
|
||||||
"<b>Bool:</b> " . Support::prBl($res) :
|
"<b>Bool:</b> " . Support::prBl($res) :
|
||||||
(is_array($res) ?
|
"Array: Yes"
|
||||||
"Array: " . Support::prBl(is_array($res)) : '{-}')
|
|
||||||
) . ", "
|
) . ", "
|
||||||
. "cursor_ext: <pre>" . Support::printAr(
|
. "cursor_ext: <pre>" . Support::printAr(
|
||||||
SetVarType::setArray($db->dbGetCursorExt($q_db_ret))
|
SetVarType::setArray($db->dbGetCursorExt($q_db_ret))
|
||||||
|
|||||||
@@ -316,7 +316,8 @@ print "EOM STRING EXEC RETURN TEST: " . print_r(
|
|||||||
$db->dbReturnRowParams(
|
$db->dbReturnRowParams(
|
||||||
$query_select,
|
$query_select,
|
||||||
[$__last_insert_id]
|
[$__last_insert_id]
|
||||||
)
|
),
|
||||||
|
true
|
||||||
) . "<br>";
|
) . "<br>";
|
||||||
// B
|
// B
|
||||||
$status = $db->dbExecParams(
|
$status = $db->dbExecParams(
|
||||||
@@ -345,7 +346,8 @@ print "EOM STRING EXEC RETURN TEST: " . print_r(
|
|||||||
$db->dbReturnRowParams(
|
$db->dbReturnRowParams(
|
||||||
$query_select,
|
$query_select,
|
||||||
[$__last_insert_id]
|
[$__last_insert_id]
|
||||||
)
|
),
|
||||||
|
true
|
||||||
) . "<br>";
|
) . "<br>";
|
||||||
// params > 10 for debug
|
// params > 10 for debug
|
||||||
// error catcher
|
// error catcher
|
||||||
@@ -674,7 +676,7 @@ echo "<hr>";
|
|||||||
|
|
||||||
print "COMPOSITE ELEMENT READ<br>";
|
print "COMPOSITE ELEMENT READ<br>";
|
||||||
$res = $db->dbReturnRow("SELECT item, count, (item).name, (item).price, (item).supplier_id FROM on_hand");
|
$res = $db->dbReturnRow("SELECT item, count, (item).name, (item).price, (item).supplier_id FROM on_hand");
|
||||||
print "ROW: <pre>" . print_r($res) . "</pre>";
|
print "ROW: <pre>" . print_r($res, true) . "</pre>";
|
||||||
var_dump($res);
|
var_dump($res);
|
||||||
print "Field Name/Types: <pre>" . print_r($db->dbGetFieldNameTypes(), true) . "</pre>";
|
print "Field Name/Types: <pre>" . print_r($db->dbGetFieldNameTypes(), true) . "</pre>";
|
||||||
echo "<hr>";
|
echo "<hr>";
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
require 'config.php';
|
require 'config.php'; /** @phpstan-ignore-line Is path, is symlinked */
|
||||||
|
|
||||||
// should be utf8
|
// should be utf8
|
||||||
header("Content-type: text/html; charset=" . DEFAULT_ENCODING);
|
header("Content-type: text/html; charset=" . DEFAULT_ENCODING);
|
||||||
|
|||||||
@@ -960,10 +960,7 @@ class Login
|
|||||||
. "AND ear.edit_access_right_id = epa.edit_access_right_id "
|
. "AND ear.edit_access_right_id = epa.edit_access_right_id "
|
||||||
. "AND epa.enabled = 1 AND epa.edit_group_id = " . $res["edit_group_id"] . " "
|
. "AND epa.enabled = 1 AND epa.edit_group_id = " . $res["edit_group_id"] . " "
|
||||||
. "ORDER BY ep.order_number";
|
. "ORDER BY ep.order_number";
|
||||||
while ($res = $this->db->dbReturn($q)) {
|
while (is_array($res = $this->db->dbReturn($q))) {
|
||||||
if (!is_array($res)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// page id array for sub data readout
|
// page id array for sub data readout
|
||||||
$edit_page_ids[$res['edit_page_id']] = $res['cuid'];
|
$edit_page_ids[$res['edit_page_id']] = $res['cuid'];
|
||||||
// create the array for pages
|
// create the array for pages
|
||||||
@@ -1303,11 +1300,9 @@ class Login
|
|||||||
{
|
{
|
||||||
$is_valid_password = true;
|
$is_valid_password = true;
|
||||||
// check for valid in regex arrays in list
|
// check for valid in regex arrays in list
|
||||||
if (is_array($this->password_valid_chars)) {
|
foreach ($this->password_valid_chars as $password_valid_chars) {
|
||||||
foreach ($this->password_valid_chars as $password_valid_chars) {
|
if (!preg_match("/$password_valid_chars/", $password)) {
|
||||||
if (!preg_match("/$password_valid_chars/", $password)) {
|
$is_valid_password = false;
|
||||||
$is_valid_password = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// check for min length
|
// check for min length
|
||||||
|
|||||||
@@ -425,10 +425,7 @@ class Backend
|
|||||||
?string $set_content_path = null,
|
?string $set_content_path = null,
|
||||||
int $flag = 0,
|
int $flag = 0,
|
||||||
): array {
|
): array {
|
||||||
if (
|
if ($set_content_path === null) {
|
||||||
$set_content_path === null ||
|
|
||||||
!is_string($set_content_path)
|
|
||||||
) {
|
|
||||||
/** @deprecated adbTopMenu missing set_content_path parameter */
|
/** @deprecated adbTopMenu missing set_content_path parameter */
|
||||||
trigger_error(
|
trigger_error(
|
||||||
'Calling adbTopMenu without set_content_path parameter is deprecated',
|
'Calling adbTopMenu without set_content_path parameter is deprecated',
|
||||||
|
|||||||
@@ -119,6 +119,13 @@ class Colors
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* check if html/css color string is valid
|
* check if html/css color string is valid
|
||||||
|
*
|
||||||
|
* TODO: update check for correct validate values
|
||||||
|
* - space instead of ","
|
||||||
|
* - / opcatiy checks
|
||||||
|
* - loose numeric values
|
||||||
|
* - lab/lch,oklab/oklch validation too
|
||||||
|
*
|
||||||
* @param string $color A color string of any format
|
* @param string $color A color string of any format
|
||||||
* @param int $flags defaults to ALL, else use | to combined from
|
* @param int $flags defaults to ALL, else use | to combined from
|
||||||
* HEX_RGB, HEX_RGBA, RGB, RGBA, HSL, HSLA
|
* HEX_RGB, HEX_RGBA, RGB, RGBA, HSL, HSLA
|
||||||
@@ -168,9 +175,9 @@ class Colors
|
|||||||
if (preg_match("/$regex/", $color)) {
|
if (preg_match("/$regex/", $color)) {
|
||||||
// if valid regex, we now need to check if the content is actually valid
|
// if valid regex, we now need to check if the content is actually valid
|
||||||
// only for rgb/hsl type
|
// only for rgb/hsl type
|
||||||
/** @var int|false */
|
/** @var int<0, max>|false */
|
||||||
$rgb_flag = strpos($color, 'rgb');
|
$rgb_flag = strpos($color, 'rgb');
|
||||||
/** @var int|false */
|
/** @var int<0, max>|false */
|
||||||
$hsl_flag = strpos($color, 'hsl');
|
$hsl_flag = strpos($color, 'hsl');
|
||||||
// if both not match, return true
|
// if both not match, return true
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -246,7 +246,7 @@ class CieXyz
|
|||||||
self::convertArray(array_map(
|
self::convertArray(array_map(
|
||||||
fn ($k, $v) => $v * $d50[$k],
|
fn ($k, $v) => $v * $d50[$k],
|
||||||
array_keys($xyz),
|
array_keys($xyz),
|
||||||
array_values($xyz),
|
$xyz,
|
||||||
)),
|
)),
|
||||||
options: ["whitepoint" => 'D50']
|
options: ["whitepoint" => 'D50']
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -158,6 +158,8 @@ class Math
|
|||||||
* [0, 0, 0] <- automatically added
|
* [0, 0, 0] <- automatically added
|
||||||
* ]
|
* ]
|
||||||
*
|
*
|
||||||
|
* The same is done for unbalanced entries, they are filled with 0
|
||||||
|
*
|
||||||
* @param array<float|int|array<int|float>> $a m x n matrice
|
* @param array<float|int|array<int|float>> $a m x n matrice
|
||||||
* @param array<float|int|array<int|float>> $b n x p matrice
|
* @param array<float|int|array<int|float>> $b n x p matrice
|
||||||
*
|
*
|
||||||
@@ -186,7 +188,7 @@ class Math
|
|||||||
// so that we can multiply row by row
|
// so that we can multiply row by row
|
||||||
$bCols = array_map(
|
$bCols = array_map(
|
||||||
callback: fn ($k) => array_map(
|
callback: fn ($k) => array_map(
|
||||||
(fn ($i) => is_array($i) ? $i[$k] : 0),
|
(fn ($i) => is_array($i) ? $i[$k] ?? 0 : 0),
|
||||||
$b,
|
$b,
|
||||||
),
|
),
|
||||||
array: array_keys($b[0]),
|
array: array_keys($b[0]),
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class Uids
|
|||||||
$uniqid_length++;
|
$uniqid_length++;
|
||||||
}
|
}
|
||||||
/** @var int<1,max> make sure that internal this is correct */
|
/** @var int<1,max> make sure that internal this is correct */
|
||||||
$random_bytes_length = ($uniqid_length - ($uniqid_length % 2)) / 2;
|
$random_bytes_length = (int)(($uniqid_length - ($uniqid_length % 2)) / 2);
|
||||||
$uniqid = bin2hex(random_bytes($random_bytes_length));
|
$uniqid = bin2hex(random_bytes($random_bytes_length));
|
||||||
// if not forced shorten return next lower length
|
// if not forced shorten return next lower length
|
||||||
if (!$force_length) {
|
if (!$force_length) {
|
||||||
|
|||||||
@@ -374,7 +374,7 @@ class ArrayIO extends \CoreLibs\DB\IO
|
|||||||
public function dbDelete(array $table_array = [], bool $acl_limit = false): array
|
public function dbDelete(array $table_array = [], bool $acl_limit = false): array
|
||||||
{
|
{
|
||||||
// is array and has values, override set and set new
|
// is array and has values, override set and set new
|
||||||
if (is_array($table_array) && count($table_array)) {
|
if (count($table_array)) {
|
||||||
$this->table_array = $table_array;
|
$this->table_array = $table_array;
|
||||||
}
|
}
|
||||||
if (!$this->dbCheckPkSet()) {
|
if (!$this->dbCheckPkSet()) {
|
||||||
@@ -440,7 +440,7 @@ class ArrayIO extends \CoreLibs\DB\IO
|
|||||||
public function dbRead(bool $edit = false, array $table_array = []): array
|
public function dbRead(bool $edit = false, array $table_array = []): array
|
||||||
{
|
{
|
||||||
// if array give, overrules internal array
|
// if array give, overrules internal array
|
||||||
if (is_array($table_array) && count($table_array)) {
|
if (count($table_array)) {
|
||||||
$this->table_array = $table_array;
|
$this->table_array = $table_array;
|
||||||
}
|
}
|
||||||
if (!$this->dbCheckPkSet()) {
|
if (!$this->dbCheckPkSet()) {
|
||||||
|
|||||||
@@ -914,7 +914,7 @@ class IO
|
|||||||
if ($cursor !== false) {
|
if ($cursor !== false) {
|
||||||
[$db_prefix, $db_error_string] = $this->db_functions->__dbPrintError($cursor);
|
[$db_prefix, $db_error_string] = $this->db_functions->__dbPrintError($cursor);
|
||||||
}
|
}
|
||||||
if ($cursor === false && method_exists($this->db_functions, '__dbPrintError')) {
|
if ($cursor === false && method_exists($this->db_functions, '__dbPrintError')) { /** @phpstan-ignore-line */
|
||||||
[$db_prefix, $db_error_string] = $this->db_functions->__dbPrintError();
|
[$db_prefix, $db_error_string] = $this->db_functions->__dbPrintError();
|
||||||
}
|
}
|
||||||
// prefix the master if not the same
|
// prefix the master if not the same
|
||||||
@@ -1737,7 +1737,7 @@ class IO
|
|||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
!empty($this->dbh) &&
|
!empty($this->dbh) &&
|
||||||
$this->dbh instanceof \PgSql\Connection
|
$this->dbh instanceof \PgSql\Connection /** @phpstan-ignore-line future could be other */
|
||||||
) {
|
) {
|
||||||
// reset any client encodings set
|
// reset any client encodings set
|
||||||
$this->dbResetEncoding();
|
$this->dbResetEncoding();
|
||||||
|
|||||||
@@ -190,7 +190,6 @@ class GetTextReader
|
|||||||
private function loadTables(): void
|
private function loadTables(): void
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
is_array($this->cache_translations) &&
|
|
||||||
is_array($this->table_originals) &&
|
is_array($this->table_originals) &&
|
||||||
is_array($this->table_translations)
|
is_array($this->table_translations)
|
||||||
) {
|
) {
|
||||||
@@ -318,10 +317,7 @@ class GetTextReader
|
|||||||
|
|
||||||
if ($this->enable_cache) {
|
if ($this->enable_cache) {
|
||||||
// Caching enabled, get translated string from cache
|
// Caching enabled, get translated string from cache
|
||||||
if (
|
if (array_key_exists($string, $this->cache_translations)) {
|
||||||
is_array($this->cache_translations) &&
|
|
||||||
array_key_exists($string, $this->cache_translations)
|
|
||||||
) {
|
|
||||||
return $this->cache_translations[$string];
|
return $this->cache_translations[$string];
|
||||||
} else {
|
} else {
|
||||||
return $string;
|
return $string;
|
||||||
@@ -481,7 +477,7 @@ class GetTextReader
|
|||||||
$key = $single . chr(0) . $plural;
|
$key = $single . chr(0) . $plural;
|
||||||
|
|
||||||
if ($this->enable_cache) {
|
if ($this->enable_cache) {
|
||||||
if (is_array($this->cache_translations) && !array_key_exists($key, $this->cache_translations)) {
|
if (!array_key_exists($key, $this->cache_translations)) {
|
||||||
return ($number != 1) ? $plural : $single;
|
return ($number != 1) ? $plural : $single;
|
||||||
} else {
|
} else {
|
||||||
$result = $this->cache_translations[$key];
|
$result = $this->cache_translations[$key];
|
||||||
|
|||||||
@@ -474,7 +474,7 @@ class Generate
|
|||||||
$page_name_camel_case
|
$page_name_camel_case
|
||||||
);
|
);
|
||||||
try {
|
try {
|
||||||
/** @var TableArrays\Interface\TableArraysInterface|false $class */
|
/** @var TableArrays\Interface\TableArraysInterface $class */
|
||||||
$class = new $class_string($this);
|
$class = new $class_string($this);
|
||||||
} catch (\Throwable $t) {
|
} catch (\Throwable $t) {
|
||||||
$this->log->critical('CLASS LOADING: Failed loading: ' . $class_string . ' => ' . $t->getMessage());
|
$this->log->critical('CLASS LOADING: Failed loading: ' . $class_string . ' => ' . $t->getMessage());
|
||||||
@@ -1757,14 +1757,9 @@ class Generate
|
|||||||
$this->dba->setTableArrayEntry($this->dba->getTableArray()[$key]['preset'], $key, 'value');
|
$this->dba->setTableArrayEntry($this->dba->getTableArray()[$key]['preset'], $key, 'value');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (is_array($this->reference_array)) {
|
reset($this->reference_array);
|
||||||
if (!is_array($this->reference_array)) {
|
foreach ($this->reference_array as $key => $value) {
|
||||||
$this->reference_array = [];
|
unset($this->reference_array[$key]['selected']);
|
||||||
}
|
|
||||||
reset($this->reference_array);
|
|
||||||
foreach ($this->reference_array as $key => $value) {
|
|
||||||
unset($this->reference_array[$key]['selected']);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$this->warning = 1;
|
$this->warning = 1;
|
||||||
$this->msg = $this->l->__('Cleared for new Dataset!');
|
$this->msg = $this->l->__('Cleared for new Dataset!');
|
||||||
@@ -1787,20 +1782,15 @@ class Generate
|
|||||||
$this->dba->unsetTableArrayEntry($key, 'input_value');
|
$this->dba->unsetTableArrayEntry($key, 'input_value');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($this->reference_array)) {
|
// load each reference_table
|
||||||
// load each reference_table
|
reset($this->reference_array);
|
||||||
if (!is_array($this->reference_array)) {
|
foreach ($this->reference_array as $key => $value) {
|
||||||
$this->reference_array = [];
|
unset($this->reference_array[$key]['selected']);
|
||||||
}
|
$q = 'SELECT ' . $this->reference_array[$key]['other_table_pk']
|
||||||
reset($this->reference_array);
|
. ' FROM ' . $this->reference_array[$key]['table_name']
|
||||||
foreach ($this->reference_array as $key => $value) {
|
. ' WHERE ' . $this->int_pk_name . ' = ' . $this->dba->getTableArray()[$this->int_pk_name]['value'];
|
||||||
unset($this->reference_array[$key]['selected']);
|
while (is_array($res = $this->dba->dbReturn($q))) {
|
||||||
$q = 'SELECT ' . $this->reference_array[$key]['other_table_pk']
|
$this->reference_array[$key]['selected'][] = $res[$this->reference_array[$key]['other_table_pk']];
|
||||||
. ' FROM ' . $this->reference_array[$key]['table_name']
|
|
||||||
. ' WHERE ' . $this->int_pk_name . ' = ' . $this->dba->getTableArray()[$this->int_pk_name]['value'];
|
|
||||||
while (is_array($res = $this->dba->dbReturn($q))) {
|
|
||||||
$this->reference_array[$key]['selected'][] = $res[$this->reference_array[$key]['other_table_pk']];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->warning = 1;
|
$this->warning = 1;
|
||||||
@@ -1979,24 +1969,19 @@ class Generate
|
|||||||
// write the object
|
// write the object
|
||||||
$this->dba->dbWrite($addslashes, [], true);
|
$this->dba->dbWrite($addslashes, [], true);
|
||||||
// write reference array (s) if necessary
|
// write reference array (s) if necessary
|
||||||
if (is_array($this->reference_array)) {
|
reset($this->reference_array);
|
||||||
if (!is_array($this->reference_array)) {
|
foreach ($this->reference_array as $reference_array) {
|
||||||
$this->reference_array = [];
|
$q = 'DELETE FROM ' . $reference_array['table_name']
|
||||||
|
. ' WHERE ' . $this->int_pk_name . ' = ' . $this->dba->getTableArray()[$this->int_pk_name]['value'];
|
||||||
|
$this->dba->dbExec($q);
|
||||||
|
$q = 'INSERT INTO ' . $reference_array['table_name']
|
||||||
|
. ' (' . $reference_array['other_table_pk'] . ', ' . $this->int_pk_name . ') VALUES ';
|
||||||
|
for ($i = 0, $i_max = count($reference_array['selected']); $i < $i_max; $i++) {
|
||||||
|
$t_q = '(' . $reference_array['selected'][$i] . ', '
|
||||||
|
. $this->dba->getTableArray()[$this->int_pk_name]['value'] . ')';
|
||||||
|
$this->dba->dbExec($q . $t_q);
|
||||||
}
|
}
|
||||||
reset($this->reference_array);
|
} // foreach reference arrays
|
||||||
foreach ($this->reference_array as $reference_array) {
|
|
||||||
$q = 'DELETE FROM ' . $reference_array['table_name']
|
|
||||||
. ' WHERE ' . $this->int_pk_name . ' = ' . $this->dba->getTableArray()[$this->int_pk_name]['value'];
|
|
||||||
$this->dba->dbExec($q);
|
|
||||||
$q = 'INSERT INTO ' . $reference_array['table_name']
|
|
||||||
. ' (' . $reference_array['other_table_pk'] . ', ' . $this->int_pk_name . ') VALUES ';
|
|
||||||
for ($i = 0, $i_max = count($reference_array['selected']); $i < $i_max; $i++) {
|
|
||||||
$t_q = '(' . $reference_array['selected'][$i] . ', '
|
|
||||||
. $this->dba->getTableArray()[$this->int_pk_name]['value'] . ')';
|
|
||||||
$this->dba->dbExec($q . $t_q);
|
|
||||||
}
|
|
||||||
} // foreach reference arrays
|
|
||||||
} // if reference arrays
|
|
||||||
// write element list
|
// write element list
|
||||||
if (!empty($this->element_list)) {
|
if (!empty($this->element_list)) {
|
||||||
$type = [];
|
$type = [];
|
||||||
@@ -2230,16 +2215,11 @@ class Generate
|
|||||||
public function formDeleteTableArray()
|
public function formDeleteTableArray()
|
||||||
{
|
{
|
||||||
// remove any reference arrays
|
// remove any reference arrays
|
||||||
if (is_array($this->reference_array)) {
|
reset($this->reference_array);
|
||||||
if (!is_array($this->reference_array)) {
|
foreach ($this->reference_array as $reference_array) {
|
||||||
$this->reference_array = [];
|
$q = 'DELETE FROM ' . $reference_array['table_name']
|
||||||
}
|
. ' WHERE ' . $this->int_pk_name . ' = ' . $this->dba->getTableArray()[$this->int_pk_name]['value'];
|
||||||
reset($this->reference_array);
|
$this->dba->dbExec($q);
|
||||||
foreach ($this->reference_array as $reference_array) {
|
|
||||||
$q = 'DELETE FROM ' . $reference_array['table_name']
|
|
||||||
. ' WHERE ' . $this->int_pk_name . ' = ' . $this->dba->getTableArray()[$this->int_pk_name]['value'];
|
|
||||||
$this->dba->dbExec($q);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// remove any element list references
|
// remove any element list references
|
||||||
if (!empty($this->element_list)) {
|
if (!empty($this->element_list)) {
|
||||||
|
|||||||
@@ -256,8 +256,8 @@ class Image
|
|||||||
}
|
}
|
||||||
// check resize parameters
|
// check resize parameters
|
||||||
if ($inc_width > $thumb_width || $inc_height > $thumb_height) {
|
if ($inc_width > $thumb_width || $inc_height > $thumb_height) {
|
||||||
$thumb_width_r = 0;
|
$thumb_width_r = 1;
|
||||||
$thumb_height_r = 0;
|
$thumb_height_r = 1;
|
||||||
// we need to keep the aspect ration on longest side
|
// we need to keep the aspect ration on longest side
|
||||||
if (
|
if (
|
||||||
($inc_height > $inc_width &&
|
($inc_height > $inc_width &&
|
||||||
@@ -288,6 +288,12 @@ class Image
|
|||||||
!file_exists($thumbnail_write_path . $thumbnail)
|
!file_exists($thumbnail_write_path . $thumbnail)
|
||||||
) {
|
) {
|
||||||
// image, copy source image, offset in image, source x/y, new size, source image size
|
// image, copy source image, offset in image, source x/y, new size, source image size
|
||||||
|
if ($thumb_width_r < 1) {
|
||||||
|
$thumb_width_r = 1;
|
||||||
|
}
|
||||||
|
if ($thumb_height_r < 1) {
|
||||||
|
$thumb_height_r = 1;
|
||||||
|
}
|
||||||
$thumb = imagecreatetruecolor($thumb_width_r, $thumb_height_r);
|
$thumb = imagecreatetruecolor($thumb_width_r, $thumb_height_r);
|
||||||
if ($thumb === false) {
|
if ($thumb === false) {
|
||||||
throw new \RuntimeException(
|
throw new \RuntimeException(
|
||||||
@@ -380,9 +386,7 @@ class Image
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// add output path
|
// add output path
|
||||||
if ($thumbnail !== false) {
|
$thumbnail = $thumbnail_web_path . $thumbnail;
|
||||||
$thumbnail = $thumbnail_web_path . $thumbnail;
|
|
||||||
}
|
|
||||||
} elseif ($create_dummy === true) {
|
} elseif ($create_dummy === true) {
|
||||||
// create dummy image in the thumbnail size
|
// create dummy image in the thumbnail size
|
||||||
// if one side is missing, use the other side to create a square
|
// if one side is missing, use the other side to create a square
|
||||||
@@ -399,10 +403,10 @@ class Image
|
|||||||
!file_exists($thumbnail_write_path . $thumbnail)
|
!file_exists($thumbnail_write_path . $thumbnail)
|
||||||
) {
|
) {
|
||||||
// if both are unset, set to 250
|
// if both are unset, set to 250
|
||||||
if ($thumb_height == 0) {
|
if ($thumb_height < 1) {
|
||||||
$thumb_height = 250;
|
$thumb_height = 250;
|
||||||
}
|
}
|
||||||
if ($thumb_width == 0) {
|
if ($thumb_width < 1) {
|
||||||
$thumb_width = 250;
|
$thumb_width = 250;
|
||||||
}
|
}
|
||||||
$thumb = imagecreatetruecolor($thumb_width, $thumb_height);
|
$thumb = imagecreatetruecolor($thumb_width, $thumb_height);
|
||||||
|
|||||||
@@ -599,7 +599,7 @@ class Curl implements Interface\RequestsInterface
|
|||||||
// for post we set POST option
|
// for post we set POST option
|
||||||
if ($type == "post") {
|
if ($type == "post") {
|
||||||
curl_setopt($handle, CURLOPT_POST, true);
|
curl_setopt($handle, CURLOPT_POST, true);
|
||||||
} elseif (in_array($type, self::CUSTOM_REQUESTS)) {
|
} elseif (!empty($type) && in_array($type, self::CUSTOM_REQUESTS)) {
|
||||||
curl_setopt($handle, CURLOPT_CUSTOMREQUEST, strtoupper($type));
|
curl_setopt($handle, CURLOPT_CUSTOMREQUEST, strtoupper($type));
|
||||||
}
|
}
|
||||||
// set body data if not null, will send empty [] for empty data
|
// set body data if not null, will send empty [] for empty data
|
||||||
@@ -700,12 +700,12 @@ class Curl implements Interface\RequestsInterface
|
|||||||
// if we have a timeout signal
|
// if we have a timeout signal
|
||||||
if (!empty($this->config['timeout'])) {
|
if (!empty($this->config['timeout'])) {
|
||||||
$timeout_requires_no_signal = $this->config['timeout'] < 1;
|
$timeout_requires_no_signal = $this->config['timeout'] < 1;
|
||||||
curl_setopt($handle, CURLOPT_TIMEOUT_MS, $this->config['timeout'] * 1000);
|
curl_setopt($handle, CURLOPT_TIMEOUT_MS, (int)round($this->config['timeout'] * 1000));
|
||||||
}
|
}
|
||||||
if (!empty($this->config['connection_timeout'])) {
|
if (!empty($this->config['connection_timeout'])) {
|
||||||
$timeout_requires_no_signal = $timeout_requires_no_signal ||
|
$timeout_requires_no_signal = $timeout_requires_no_signal ||
|
||||||
$this->config['connection_timeout'] < 1;
|
$this->config['connection_timeout'] < 1;
|
||||||
curl_setopt($handle, CURLOPT_CONNECTTIMEOUT_MS, $this->config['connection_timeout'] * 1000);
|
curl_setopt($handle, CURLOPT_CONNECTTIMEOUT_MS, (int)round($this->config['connection_timeout'] * 1000, 1));
|
||||||
}
|
}
|
||||||
if ($timeout_requires_no_signal && strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
|
if ($timeout_requires_no_signal && strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
|
||||||
curl_setopt($handle, CURLOPT_NOSIGNAL, true);
|
curl_setopt($handle, CURLOPT_NOSIGNAL, true);
|
||||||
|
|||||||
Reference in New Issue
Block a user