diff --git a/www/includes/admin_header.php b/www/includes/admin_header.php index 9d5dd8f4..ba9ff347 100644 --- a/www/includes/admin_header.php +++ b/www/includes/admin_header.php @@ -59,7 +59,11 @@ $log = new CoreLibs\Debug\Logging([ // automatic hide for DEBUG messages on live server // can be overridden when setting DEBUG_ALL_OVERRIDE on top of the script // (for emergency debugging of one page only) -if ((TARGET == 'live' || TARGET == 'remote') && !empty($DEBUG_ALL_OVERRIDE)) { +if ( + (TARGET == 'live' || TARGET == 'remote') && + DEBUG === true && + !empty($DEBUG_ALL_OVERRIDE) +) { foreach (['debug', 'echo', 'print'] as $target) { $log->setLogLevelAll($target, false); } diff --git a/www/layout/admin/javascript/edit.jq.js b/www/layout/admin/javascript/edit.jq.js index 10d4e503..4475104a 100644 --- a/www/layout/admin/javascript/edit.jq.js +++ b/www/layout/admin/javascript/edit.jq.js @@ -300,6 +300,22 @@ function randomIdF() // eslint-disable-line no-unused-vars return Math.random().toString(36).substring(2); } +/** + * generate a number between min/max + * with min/max inclusive. + * eg: 1,5 will create a number ranging from 1 o 5 + * @param {Number} min minimum int number inclusive + * @param {Number} max maximumg int number inclusive + * @return {Number} Random number + */ +function getRandomIntInclusive(min, max) // eslint-disable-line no-unused-vars +{ + min = Math.ceil(min); + max = Math.floor(max); + // The maximum is inclusive and the minimum is inclusive + return Math.floor(Math.random() * (max - min + 1) + min); +} + /** * check if name is a function * @param {string} name Name of function to check if exists diff --git a/www/lib/CoreLibs/DB/IO.php b/www/lib/CoreLibs/DB/IO.php index 845b5945..59d47849 100644 --- a/www/lib/CoreLibs/DB/IO.php +++ b/www/lib/CoreLibs/DB/IO.php @@ -1044,7 +1044,7 @@ class IO } /** - * set max query calls, set to --1 to disable loop + * set max query calls, set to -1 to disable loop * protection. this will generate a warning * empty call (null) will reset to default * @param int|null $max_calls Set the max loops allowed @@ -1052,7 +1052,6 @@ class IO */ public function dbSetMaxQueryCall(?int $max_calls = null): bool { - $success = false; // if null then reset to default if ($max_calls === null) { $max_calls = self::DEFAULT_MAX_QUERY_CALL; @@ -1071,14 +1070,8 @@ class IO return false; } // ok entry, set - if ( - $max_calls == -1 || - $max_calls > 0 - ) { - $this->MAX_QUERY_CALL = $max_calls; - $success = true; - } - return $success; + $this->MAX_QUERY_CALL = $max_calls; + return true; } /** @@ -2408,6 +2401,7 @@ class IO } else { // find in all inside the array $__arr = array_column($this->insert_id_arr, $key); + /** @phpstan-ignore-next-line [Why is this always true?] */ if (count($__arr)) { return $__arr; } else {