diff --git a/www/configs/config.php b/www/configs/config.php index 1d498336..e7b15849 100755 --- a/www/configs/config.php +++ b/www/configs/config.php @@ -1,4 +1,5 @@ -login) { // 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') && !$DEBUG_ALL_OVERRIDE) { foreach (['debug', 'echo', 'print'] as $target) { - $login->log->setLogLevelAll($type, false); - $cms->log->setLogLevelAll($type, false); + $login->log->setLogLevelAll($target, false); + $cms->log->setLogLevelAll($target, false); } } $smarty->DATA['JS_DEBUG'] = DEBUG; diff --git a/www/lib/CoreLibs/Basic.php b/www/lib/CoreLibs/Basic.php index 15b860e2..8fbb2c0d 100644 --- a/www/lib/CoreLibs/Basic.php +++ b/www/lib/CoreLibs/Basic.php @@ -646,7 +646,7 @@ class Basic /** * array search simple. looks for key, value Combined, if found, returns true - * @param array $array array(search in) + * @param array $array array (search in) * @param string|int $key key (key to search in) * @param string|int $value value (what to find) * @return bool true on found, false on not found @@ -731,7 +731,7 @@ class Basic { trigger_error('Method '.__METHOD__.' is deprecated, use join()', E_USER_DEPRECATED); if (!is_array($array)) { - $array = array(); + $array = []; } return join($connect_char, $array); } @@ -755,7 +755,7 @@ class Basic * @return array flattened keys array * @deprecated Use \CoreLibs\Combined\ArrayHandler::flattenArrayKey() instead */ - public static function flattenArrayKey(array $array/*, array $return = array()*/): array + public static function flattenArrayKey(array $array/*, array $return = []*/): array { trigger_error('Method '.__METHOD__.' is deprecated, use \CoreLibs\Combined\ArrayHandler::flattenArrayKey()', E_USER_DEPRECATED); return \CoreLibs\Combined\ArrayHandler::flattenArrayKey($array); @@ -764,7 +764,7 @@ class Basic /** * searches for key -> value in an array tree and writes the value one level up * this will remove this leaf will all other values - * @param array $array array(nested) + * @param array $array array (nested) * @param string|int $search key to find that has no sub leaf and will be pushed up * @return array modified, flattened array * @deprecated Use \CoreLibs\Combined\ArrayHandler::arrayFlatForKey() instead @@ -1229,9 +1229,9 @@ class Basic { trigger_error('Method '.__METHOD__.' has been removed', E_USER_DEPRECATED); /* // set default password cost: use default set automatically - $this->password_options = array( + $this->password_options = [ // 'cost' => PASSWORD_BCRYPT_DEFAULT_COST - ); */ + ]; */ } /** diff --git a/www/lib/CoreLibs/Combined/ArrayHandler.php b/www/lib/CoreLibs/Combined/ArrayHandler.php index 2f93b775..e554407a 100644 --- a/www/lib/CoreLibs/Combined/ArrayHandler.php +++ b/www/lib/CoreLibs/Combined/ArrayHandler.php @@ -122,7 +122,7 @@ class ArrayHandler /** * array search simple. looks for key, value combination, if found, returns true - * @param array $array array(search in) + * @param array $array search in as array * @param string|int $key key (key to search in) * @param string|int $value value (what to find) * @return bool true on found, false on not found @@ -313,7 +313,7 @@ class ArrayHandler /** * searches for key -> value in an array tree and writes the value one level up * this will remove this leaf will all other values - * @param array $array array(nested) + * @param array $array nested array * @param string|int $search key to find that has no sub leaf and will be pushed up * @return array modified, flattened array */ diff --git a/www/lib/CoreLibs/Combined/DateTime.php b/www/lib/CoreLibs/Combined/DateTime.php index dcabdeaa..a2899b15 100644 --- a/www/lib/CoreLibs/Combined/DateTime.php +++ b/www/lib/CoreLibs/Combined/DateTime.php @@ -190,8 +190,8 @@ class DateTime list ($start_year, $start_month, $start_day) = array_pad(preg_split('/[\/-]/', $start_date), 3, null); list ($end_year, $end_month, $end_day) = array_pad(preg_split('/[\/-]/', $end_date), 3, null); // check that month & day are two digits and then combine - foreach (array('start', 'end') as $prefix) { - foreach (array('month', 'day') as $date_part) { + foreach (['start', 'end'] as $prefix) { + foreach (['month', 'day'] as $date_part) { $_date = $prefix.'_'.$date_part; if (isset($$_date) && $$_date < 10 && !preg_match("/^0/", $$_date)) { $$_date = '0'.$$_date; @@ -199,7 +199,7 @@ class DateTime } $_date = $prefix.'_date'; $$_date = ''; - foreach (array('year', 'month', 'day') as $date_part) { + foreach (['year', 'month', 'day'] as $date_part) { $_sub_date = $prefix.'_'.$date_part; $$_date .= $$_sub_date; } @@ -254,7 +254,7 @@ class DateTime public static function calcDaysInterval($start_date, $end_date, bool $return_named = false): array { // pos 0 all, pos 1 weekday, pos 2 weekend - $days = array(); + $days = []; $start = new \DateTime($start_date); $end = new \DateTime($end_date); // so we include the last day too, we need to add +1 second in the time @@ -275,11 +275,11 @@ class DateTime } } if ($return_named === true) { - return array( + return [ 'overall' => $days[0], 'weekday' => $days[1], 'weekend' => $days[2] - ); + ]; } else { return $days; } diff --git a/www/lib/CoreLibs/Convert/Byte.php b/www/lib/CoreLibs/Convert/Byte.php index 8fcef428..86e8aa42 100644 --- a/www/lib/CoreLibs/Convert/Byte.php +++ b/www/lib/CoreLibs/Convert/Byte.php @@ -65,7 +65,7 @@ class Byte return $bytes.'B'; } // labels in order of size [Y, Z] - $labels = array('', 'K', 'M', 'G', 'T', 'P', 'E'); + $labels = ['', 'K', 'M', 'G', 'T', 'P', 'E']; // exp position calculation $exp = floor(log($abs_bytes, $unit)); // avoid printing out anything larger than max labels diff --git a/www/lib/CoreLibs/Convert/Colors.php b/www/lib/CoreLibs/Convert/Colors.php index 971d7ae7..267f3c77 100644 --- a/www/lib/CoreLibs/Convert/Colors.php +++ b/www/lib/CoreLibs/Convert/Colors.php @@ -24,7 +24,7 @@ class Colors public static function hex2rgb(string $hexStr, bool $returnAsString = false, string $seperator = ',') { $hexStr = preg_replace("/[^0-9A-Fa-f]/", '', $hexStr); // Gets a proper hex string - $rgbArray = array(); + $rgbArray = []; if (strlen($hexStr) == 6) { // If a proper hex code, convert using bitwise operation. No overhead... faster $colorVal = hexdec($hexStr); @@ -59,7 +59,7 @@ class Colors if ($hex_prefix === true) { $hex_color = '#'; } - foreach (array('red', 'green', 'blue') as $color) { + foreach (['red', 'green', 'blue'] as $color) { // if not valid, set to gray if ($$color < 0 || $$color > 255) { $$color = 125; @@ -82,7 +82,7 @@ class Colors public static function rgb2hsb(int $red, int $green, int $blue): array { // check that rgb is from 0 to 255 - foreach (array('red', 'green', 'blue') as $c) { + foreach (['red', 'green', 'blue'] as $c) { if ($$c < 0 || $$c > 255) { $$c = 0; } @@ -94,7 +94,7 @@ class Colors $HUE = 0; if ($MAX == $MIN) { - return array(0, 0, round($MAX * 100)); + return [0, 0, round($MAX * 100)]; } if ($red == $MAX) { $HUE = ($green - $blue) / ($MAX - $MIN); @@ -108,11 +108,11 @@ class Colors $HUE += 360; } - return array( + return [ (int)round($HUE), (int)round((($MAX - $MIN) / $MAX) * 100), (int)round($MAX * 100) - ); + ]; } /** @@ -140,7 +140,7 @@ class Colors $V /= 100; if ($S == 0) { - return array($V * 255, $V * 255, $V * 255); + return [$V * 255, $V * 255, $V * 255]; } $Hi = floor($H / 60); @@ -186,11 +186,11 @@ class Colors $blue = 0; } - return array( + return [ (int)round($red * 255), (int)round($green * 255), (int)round($blue * 255) - ); + ]; } /** @@ -205,7 +205,7 @@ class Colors public static function rgb2hsl(int $red, int $green, int $blue): array { // check that rgb is from 0 to 255 - foreach (array('red', 'green', 'blue') as $c) { + foreach (['red', 'green', 'blue'] as $c) { if ($$c < 0 || $$c > 255) { $$c = 0; } @@ -270,7 +270,7 @@ class Colors $lum /= 100; // if saturation is 0 if ($sat == 0) { - return array($lum * 255, $lum * 255, $lum * 255); + return [$lum * 255, $lum * 255, $lum * 255]; } else { $m2 = $lum < 0.5 ? $lum * ($sat + 1) : ($lum + $sat) - ($lum * $sat); $m1 = $lum * 2 - $m2; @@ -292,11 +292,11 @@ class Colors return $m1; }; - return array( + return [ (int)round(255 * $hueue($hue + (1 / 3))), (int)round(255 * $hueue($hue)), (int)round(255 * $hueue($hue - (1 / 3))) - ); + ]; } } } diff --git a/www/lib/CoreLibs/Convert/Html.php b/www/lib/CoreLibs/Convert/Html.php index 0bcfeda7..55b21194 100644 --- a/www/lib/CoreLibs/Convert/Html.php +++ b/www/lib/CoreLibs/Convert/Html.php @@ -30,7 +30,7 @@ class Html */ public static function removeLB(string $string, string $replace = ' '): string { - return str_replace(array("\r", "\n"), $replace, $string); + return str_replace(["\r", "\n"], $replace, $string); } /** diff --git a/www/lib/CoreLibs/DB/Extended/ArrayIO.php b/www/lib/CoreLibs/DB/Extended/ArrayIO.php index c6e58604..d872dd07 100644 --- a/www/lib/CoreLibs/DB/Extended/ArrayIO.php +++ b/www/lib/CoreLibs/DB/Extended/ArrayIO.php @@ -6,7 +6,7 @@ * RELEASED LICENSE: GNU GPL 3 * SHORT DESC :RIPTION: * DB Array IO Class: -* writes, reads or deletes a complete array(one data set) in/out a +* writes, reads or deletes a complete array (one data set) in/out a * table from the connected DB. * you don't have to write any SQL queries, worry over update/insert * diff --git a/www/lib/CoreLibs/DB/IO.php b/www/lib/CoreLibs/DB/IO.php index b6232b7f..fa492268 100644 --- a/www/lib/CoreLibs/DB/IO.php +++ b/www/lib/CoreLibs/DB/IO.php @@ -41,7 +41,7 @@ * $class_name * - the name of the class * $class_version -* - the version as an array(major, minor, patchlvl, daypatch) +* - the version as an array [major, minor, patchlvl, daypatch] * $class_last_changed * - date (mysql format) for the last change * $class_created @@ -147,7 +147,7 @@ * _db_error() * - INTERNAL ONLY!! error that occured during execution * $string _print_array($array) -* - returns string of an array(only for interal use) +* - returns string of an array (only for interal use) * 1/0 _connect_to_db() * - returns 1 for successfull DB connection or 0 for none * 1/0 _check_query_for_select($query) @@ -643,7 +643,7 @@ class IO extends \CoreLibs\Basic } else { preg_match("/(INSERT INTO|DELETE FROM|UPDATE) (([\w_]+)\.)?([\w_]+) /i", $query, $matches); } - return array($matches[3], $matches[4]); + return [$matches[3], $matches[4]]; } /** @@ -1871,7 +1871,7 @@ class IO extends \CoreLibs\Basic * writes into one table based on array of table columns * PARAM INFO: $primary key * this can be a plain string/int and will be internal transformed into the array form - * or it takes the array form of array(row => column, value => pk value) + * or it takes the array form of array [row => column, value => pk value] * @param array $write_array list of elements to write * @param int|string|array $primary_key primary key string or array set * @param string $table name for the target table diff --git a/www/lib/CoreLibs/Debug/Logging.php b/www/lib/CoreLibs/Debug/Logging.php index 42230d43..14eee29d 100644 --- a/www/lib/CoreLibs/Debug/Logging.php +++ b/www/lib/CoreLibs/Debug/Logging.php @@ -569,6 +569,16 @@ class Logging unset($this->error_msg[$level]); } } + + /** + * Get current error message array + * + * @return array error messages collected + */ + public function getErrorMsg(): array + { + return $this->error_msg; + } } // __END__ diff --git a/www/lib/CoreLibs/Language/Core/GetTextReader.php b/www/lib/CoreLibs/Language/Core/GetTextReader.php index 4f4a9ea3..5bc79e1d 100755 --- a/www/lib/CoreLibs/Language/Core/GetTextReader.php +++ b/www/lib/CoreLibs/Language/Core/GetTextReader.php @@ -50,7 +50,7 @@ class GetTextReader private $total = 0; // total string count private $table_originals = null; // table for original strings (offsets) private $table_translations = null; // table for translated strings (offsets) - private $cache_translations = array(); // original -> translation mapping + private $cache_translations = []; // original -> translation mapping /* Methods */ @@ -166,7 +166,7 @@ class GetTextReader } if ($this->enable_cache) { - $this->cache_translations = array(); + $this->cache_translations = []; /* read all strings in the cache */ for ($i = 0; $i < $this->total; $i++) { $this->STREAM->seekto($this->table_originals[$i * 2 + 2]); diff --git a/www/lib/CoreLibs/Language/Encoding.php b/www/lib/CoreLibs/Language/Encoding.php index 439c622c..03f7fd26 100644 --- a/www/lib/CoreLibs/Language/Encoding.php +++ b/www/lib/CoreLibs/Language/Encoding.php @@ -89,7 +89,7 @@ class Encoding $compare = mb_convert_encoding($temp, $from_encoding, $to_encoding); // if string does not match anymore we have a convert problem if ($string != $compare) { - $failed = array(); + $failed = []; // go through each character and find the ones that do not match for ($i = 0, $iMax = mb_strlen($string, $from_encoding); $i < $iMax; $i ++) { $char = mb_substr($string, $i, 1, $from_encoding); diff --git a/www/lib/CoreLibs/Output/Form/Elements.php b/www/lib/CoreLibs/Output/Form/Elements.php index 50780415..250d1954 100644 --- a/www/lib/CoreLibs/Output/Form/Elements.php +++ b/www/lib/CoreLibs/Output/Form/Elements.php @@ -121,7 +121,7 @@ class Elements public static function magicLinks(string $string, string $target = "_blank"): string { $output = $string; - $protList = array("http", "https", "ftp", "news", "nntp"); + $protList = ["http", "https", "ftp", "news", "nntp"]; // find urls w/o protocol $output = preg_replace("/([^\/])www\.([\w\.-]+)\.([a-zA-Z]{2,4})/", "\\1http://www.\\2.\\3", $output); diff --git a/www/lib/CoreLibs/Output/Form/Generate.php b/www/lib/CoreLibs/Output/Form/Generate.php index cacfc456..d7444aea 100644 --- a/www/lib/CoreLibs/Output/Form/Generate.php +++ b/www/lib/CoreLibs/Output/Form/Generate.php @@ -1516,7 +1516,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO // echo "PK NAME: ".$this->pk_name."/".$this->int_pk_name.": ".$this->table_array[$this->pk_name]['value']."/".$this->table_array[$this->int_pk_name]['value']."
"; // write the object $this->dbWrite($addslashes); - // write reference array(s) if necessary + // write reference array (s) if necessary if (is_array($this->reference_array)) { if (!is_array($this->reference_array)) { $this->reference_array = []; diff --git a/www/lib/CoreLibs/Output/Image.php b/www/lib/CoreLibs/Output/Image.php index 45f99a79..a206e61b 100644 --- a/www/lib/CoreLibs/Output/Image.php +++ b/www/lib/CoreLibs/Output/Image.php @@ -29,11 +29,11 @@ class Image bool $clear_cache = false ) { // get image type flags - $image_types = array( + $image_types = [ 1 => 'gif', 2 => 'jpg', 3 => 'png' - ); + ]; $return_data = false; $CONVERT = ''; // if CONVERT is not defined, abort diff --git a/www/lib/Error.Handling.php b/www/lib/Error.Handling.php index 366d9dec..46ff8b03 100644 --- a/www/lib/Error.Handling.php +++ b/www/lib/Error.Handling.php @@ -34,7 +34,7 @@ function MyErrorHandler(int $type, string $message, string $file, int $line, arr return false; } // ERROR LEVEL - $error_level = array( + $error_level = [ 1 => 'E_ERROR', 2 => 'E_WARNING', 4 => 'E_PARSE', @@ -51,7 +51,7 @@ function MyErrorHandler(int $type, string $message, string $file, int $line, arr 8192 => 'E_DEPRICATED', 16384 => 'E_USER_DEPRICATED', 30719 => 'E_ALL' - ); + ]; // get the current page name (strip path) $page_temp = explode(DIRECTORY_SEPARATOR, $_SERVER["PHP_SELF"]);