Fixes for array ( calls, fixes for phan warning reports
Renamed all array ( to array( that where left over Fixed various minor bugs for phan level 0 reporting
This commit is contained in:
@@ -43,7 +43,7 @@ return [
|
||||
|
||||
// Only emit critical issues to start with
|
||||
// (0 is low severity, 5 is normal severity, 10 is critical)
|
||||
"minimum_severity" => 5,
|
||||
"minimum_severity" => 0,
|
||||
|
||||
// default false for include path check
|
||||
"enable_include_path_checks" => true,
|
||||
@@ -113,6 +113,7 @@ return [
|
||||
// what not to show as problem
|
||||
'suppress_issue_types' => [
|
||||
// 'PhanUndeclaredMethod',
|
||||
'PhanEmptyFile',
|
||||
],
|
||||
|
||||
// Override to hardcode existence and types of (non-builtin) globals in the global scope.
|
||||
|
||||
@@ -204,7 +204,7 @@ if ((!isset($SITE_CONFIG[$HOST_NAME]['db_host']) && count($DB_CONFIG)) ||
|
||||
)
|
||||
) {
|
||||
echo 'No matching DB config found for: "'.$HOST_NAME.'". Contact Administrator';
|
||||
exit -1;
|
||||
exit;
|
||||
}
|
||||
// set HOST name
|
||||
DEFINE('HOST_NAME', $HOST_NAME);
|
||||
|
||||
@@ -68,6 +68,10 @@ if (TARGET == 'live' || TARGET == 'remote') {
|
||||
}
|
||||
// space for setting special debug flags
|
||||
$login->debug_output_all = 1;
|
||||
// set smarty arrays
|
||||
$HEADER = array();
|
||||
$DATA = array();
|
||||
$DEBUG_DATA = array();
|
||||
// set the template dir
|
||||
// WARNING: this has a special check for the mailing tool layout (old layout)
|
||||
if (defined('LAYOUT')) {
|
||||
@@ -153,6 +157,7 @@ if ($form->my_page_name == 'edit_order') {
|
||||
}
|
||||
$q .= "ORDER BY order_number";
|
||||
|
||||
$row_data = array();
|
||||
while ($res = $form->dbReturn($q)) {
|
||||
$row_data[] = array(
|
||||
"id" => $res[$table_name."_id"],
|
||||
@@ -226,6 +231,7 @@ if ($form->my_page_name == 'edit_order') {
|
||||
|
||||
$DATA['table_width'] = $table_width;
|
||||
|
||||
$messages = array();
|
||||
// write out error / status messages
|
||||
$messages[] = $form->formPrintMsg();
|
||||
$DATA['form_error_msg'] = $messages;
|
||||
|
||||
@@ -324,7 +324,6 @@ class Backend extends \CoreLibs\DB\IO
|
||||
* @param int $size_y maximum size height
|
||||
* @param string $dummy empty, or file_type to show an icon instead of nothing if file is not found
|
||||
* @param string $path if source start is not ROOT path, if empty ROOT is choosen
|
||||
* @param string $cache_source cache path, if not given TMP is used
|
||||
* @return string|bool thumbnail name, or false for error
|
||||
*/
|
||||
public function adbCreateThumbnail($pic, $size_x, $size_y, $dummy = '', $path = "", $cache = "")
|
||||
@@ -400,8 +399,8 @@ class Backend extends \CoreLibs\DB\IO
|
||||
$q .= "'".$this->dbEscapeString($queue_key)."', '".$this->dbEscapeString($key_value)."', ";
|
||||
$q .= "'".$this->dbEscapeString($key_name)."', '".$this->dbEscapeString($type)."', ";
|
||||
$q .= "'".$this->dbEscapeString($target)."', '".$this->dbEscapeString($data)."', ";
|
||||
$q .= "'".$this->queue_key."', '".$this->action."', '".$this->dbEscapeString($associate)."', ";
|
||||
$q .= "'".$this->dbEscapeString($file)."')";
|
||||
$q .= "'".$this->queue_key."', '".$this->action."', '".$this->dbEscapeString((string)$associate)."', ";
|
||||
$q .= "'".$this->dbEscapeString((string)$file)."')";
|
||||
$this->dbExec($q);
|
||||
}
|
||||
|
||||
|
||||
@@ -426,8 +426,9 @@ class Basic
|
||||
* CLASS_OFF_COMPATIBLE_MODE: 2 -> if set turns of auto set for unset variables
|
||||
* 3 -> sets error on unset and does not set variable (strict)
|
||||
* @param int $set_control_flag control flag as 0/1/2/3
|
||||
* @return void
|
||||
*/
|
||||
private function __setControlFlag(int $set_control_flag)
|
||||
private function __setControlFlag(int $set_control_flag): void
|
||||
{
|
||||
// is there either a constant or global set to override the control flag
|
||||
if (defined('CLASS_VARIABLE_ERROR_MODE')) {
|
||||
@@ -453,17 +454,17 @@ class Basic
|
||||
* if strict mode is set, throws an error if the class variable is not set
|
||||
* if compatible mode is set, also auto sets variable even if not declared
|
||||
* default is strict mode false and compatible mode on
|
||||
* @param mixed $name class variable name
|
||||
* @param mixed $value class varaible value
|
||||
* @param mixed $name class variable name
|
||||
* @return void
|
||||
*/
|
||||
public function __set($name, $value)
|
||||
public function __set($name, $value): void
|
||||
{
|
||||
if ($this->set_strict_mode === true && !property_exists($this, $name)) {
|
||||
trigger_error('Undefined property via __set(): '.$name, E_USER_NOTICE);
|
||||
}
|
||||
// use this for fallback as to work like before to set unset
|
||||
if ($this->set_compatible === true) {
|
||||
return $this->{$name} = $value;
|
||||
$this->{$name} = $value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -471,9 +472,9 @@ class Basic
|
||||
* if strict mode is set, throws an error if the class variable is not set
|
||||
* default is strict mode false
|
||||
* @param mixed $name class variable name
|
||||
* @return void no return
|
||||
* @return void
|
||||
*/
|
||||
public function __get($name)
|
||||
public function __get($name): void
|
||||
{
|
||||
if ($this->set_strict_mode === true && !property_exists($this, $name)) {
|
||||
trigger_error('Undefined property via __get(): '.$name, E_USER_NOTICE);
|
||||
@@ -488,7 +489,7 @@ class Basic
|
||||
* sets the internal log file prefix id
|
||||
* string must be a alphanumeric string
|
||||
* if non valid string is given it returns the previous set one only
|
||||
* @param string $string log file id string value
|
||||
* @param string $string log file id string value
|
||||
* @return string returns the set log file id string
|
||||
*/
|
||||
public function basicSetLogId(string $string): string
|
||||
@@ -859,7 +860,7 @@ class Basic
|
||||
public function resetErrorMsg(string $level = ''): void
|
||||
{
|
||||
if (!$level) {
|
||||
unset($this->error_msg);
|
||||
$this->error_msg = array();
|
||||
} elseif (isset($this->error_msg[$level])) {
|
||||
unset($this->error_msg[$level]);
|
||||
}
|
||||
@@ -951,7 +952,7 @@ class Basic
|
||||
return join(
|
||||
'',
|
||||
array_map(
|
||||
function () {
|
||||
function ($value) {
|
||||
return $this->key_range[rand(0, $this->one_key_length - 1)];
|
||||
},
|
||||
range(1, $use_key_length)
|
||||
@@ -2314,8 +2315,8 @@ class Basic
|
||||
* converts the rgb values from int data to the valid rgb html hex string
|
||||
* optional can turn of leading #
|
||||
* @param int $red red 0-255
|
||||
* @param int $green blue 0-255
|
||||
* @param int $blue green 0-255
|
||||
* @param int $green green 0-255
|
||||
* @param int $blue blue 0-255
|
||||
* @param bool $hex_prefix default true, prefix with "#"
|
||||
* @return string rgb in hex values with leading # if set
|
||||
*/
|
||||
@@ -2338,10 +2339,10 @@ class Basic
|
||||
|
||||
/**
|
||||
* converts and int RGB to the HTML color string in hex format
|
||||
* @param int $red [description]
|
||||
* @param int $green [description]
|
||||
* @param int $blue [description]
|
||||
* @return [type] [description]
|
||||
* @param int $red red 0-255
|
||||
* @param int $green green 0-255
|
||||
* @param int $blue blue 0-255
|
||||
* @return string hex rgb string
|
||||
* @deprecated use rgb2hex instead
|
||||
*/
|
||||
public static function rgb2html(int $red, int $green, int $blue): string
|
||||
|
||||
@@ -234,7 +234,7 @@ class ArrayIO extends \CoreLibs\DB\IO
|
||||
$q .= ' AND '.$q_where;
|
||||
}
|
||||
// if 0, error
|
||||
unset($this->pk_id);
|
||||
$this->pk_id = null;
|
||||
if (!$this->dbExec($q)) {
|
||||
$this->error_id = 92;
|
||||
$this->__dbError();
|
||||
|
||||
@@ -443,7 +443,7 @@ class IO extends \CoreLibs\Basic
|
||||
{
|
||||
if (isset($this->dbh) && $this->dbh) {
|
||||
$this->db_functions->__dbClose();
|
||||
unset($this->dbh);
|
||||
$this->dbh = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -559,7 +559,7 @@ class IO extends \CoreLibs\Basic
|
||||
public function __dbError($cursor = false, string $msg = ''): void
|
||||
{
|
||||
$pg_error_string = '';
|
||||
$where_called = $this->getCallerMethod();
|
||||
$where_called = (string)$this->getCallerMethod();
|
||||
if ($cursor) {
|
||||
$pg_error_string = $this->db_functions->__dbPrintError($cursor);
|
||||
}
|
||||
@@ -890,7 +890,7 @@ class IO extends \CoreLibs\Basic
|
||||
{
|
||||
if ($this->dbh) {
|
||||
$this->db_functions->__dbClose();
|
||||
unset($this->dbh);
|
||||
$this->dbh = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -358,7 +358,7 @@ class PgSQL
|
||||
$this->last_error_query = '';
|
||||
$cursor = pg_get_result($this->dbh);
|
||||
}
|
||||
if (pg_result_error($cursor)) {
|
||||
if ($cursor && pg_result_error($cursor)) {
|
||||
return "<span style=\"color: red;\"><b>-PostgreSQL-Error-></b> ".pg_result_error($cursor)."</span><br>";
|
||||
} else {
|
||||
return '';
|
||||
|
||||
@@ -60,7 +60,7 @@ class GetTextReader
|
||||
* Reads a 32bit Integer from the Stream
|
||||
*
|
||||
* @access private
|
||||
* @return Integer from the Stream
|
||||
* @return int Integer from the Stream
|
||||
*/
|
||||
private function readint()
|
||||
{
|
||||
@@ -75,6 +75,11 @@ class GetTextReader
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* read bytes
|
||||
* @param int $bytes byte length to read
|
||||
* @return string return data, possible string
|
||||
*/
|
||||
public function read($bytes)
|
||||
{
|
||||
return $this->STREAM->read($bytes);
|
||||
@@ -83,8 +88,8 @@ class GetTextReader
|
||||
/**
|
||||
* Reads an array of Integers from the Stream
|
||||
*
|
||||
* @param int count How many elements should be read
|
||||
* @return Array of Integers
|
||||
* @param int $count How many elements should be read
|
||||
* @return array Array of Integers
|
||||
*/
|
||||
public function readintarray($count)
|
||||
{
|
||||
@@ -100,8 +105,8 @@ class GetTextReader
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param object Reader the StreamReader object
|
||||
* @param boolean enable_cache Enable or disable caching of strings (default on)
|
||||
* @param object $Reader the StreamReader object
|
||||
* @param bool $enable_cache Enable or disable caching of strings (default on)
|
||||
*/
|
||||
public function __construct($Reader, $enable_cache = true)
|
||||
{
|
||||
@@ -177,8 +182,8 @@ class GetTextReader
|
||||
* Returns a string from the "originals" table
|
||||
*
|
||||
* @access private
|
||||
* @param int num Offset number of original string
|
||||
* @return string Requested string if found, otherwise ''
|
||||
* @param int $num Offset number of original string
|
||||
* @return string Requested string if found, otherwise ''
|
||||
*/
|
||||
private function get_original_string($num)
|
||||
{
|
||||
@@ -196,8 +201,8 @@ class GetTextReader
|
||||
* Returns a string from the "translations" table
|
||||
*
|
||||
* @access private
|
||||
* @param int num Offset number of original string
|
||||
* @return string Requested string if found, otherwise ''
|
||||
* @param int $num Offset number of original string
|
||||
* @return string Requested string if found, otherwise ''
|
||||
*/
|
||||
private function get_translation_string($num)
|
||||
{
|
||||
@@ -215,10 +220,10 @@ class GetTextReader
|
||||
* Binary search for string
|
||||
*
|
||||
* @access private
|
||||
* @param string string
|
||||
* @param int start (internally used in recursive function)
|
||||
* @param int end (internally used in recursive function)
|
||||
* @return int string number (offset in originals table)
|
||||
* @param string $string string to find
|
||||
* @param int $start (internally used in recursive function)
|
||||
* @param int $end (internally used in recursive function)
|
||||
* @return int|string|float (offset in originals table)
|
||||
*/
|
||||
private function find_string($string, $start = -1, $end = -1)
|
||||
{
|
||||
@@ -259,8 +264,8 @@ class GetTextReader
|
||||
* Translates a string
|
||||
*
|
||||
* @access public
|
||||
* @param string string to be translated
|
||||
* @return string translated string (or original, if not found)
|
||||
* @param string $string to be translated
|
||||
* @return string translated string (or original, if not found)
|
||||
*/
|
||||
public function translate($string)
|
||||
{
|
||||
@@ -291,7 +296,8 @@ class GetTextReader
|
||||
* Sanitize plural form expression for use in PHP eval call.
|
||||
*
|
||||
* @access private
|
||||
* @return string sanitized plural form expression
|
||||
* @param string $expr an expression to match
|
||||
* @return string sanitized plural form expression
|
||||
*/
|
||||
private function sanitize_plural_expression($expr)
|
||||
{
|
||||
@@ -327,7 +333,8 @@ class GetTextReader
|
||||
* Parse full PO header and extract only plural forms line.
|
||||
*
|
||||
* @access private
|
||||
* @return string verbatim plural form header field
|
||||
* @param string $header header search in plurals
|
||||
* @return string verbatim plural form header field
|
||||
*/
|
||||
private function extract_plural_forms_header_from_po_header($header)
|
||||
{
|
||||
@@ -368,8 +375,8 @@ class GetTextReader
|
||||
* Detects which plural form to take
|
||||
*
|
||||
* @access private
|
||||
* @param string count
|
||||
* @return int array index of the right plural form
|
||||
* @param string $n count
|
||||
* @return int array index of the right plural form
|
||||
*/
|
||||
private function select_string($n)
|
||||
{
|
||||
@@ -392,9 +399,9 @@ class GetTextReader
|
||||
* Plural version of gettext
|
||||
*
|
||||
* @access public
|
||||
* @param string single
|
||||
* @param string plural
|
||||
* @param string number
|
||||
* @param string $single
|
||||
* @param string $plural
|
||||
* @param string $number
|
||||
* @return string plural form
|
||||
*/
|
||||
public function ngettext($single, $plural, $number)
|
||||
@@ -433,6 +440,12 @@ class GetTextReader
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* p get text
|
||||
* @param string $context [description]
|
||||
* @param string $msgid [description]
|
||||
* @return string [description]
|
||||
*/
|
||||
public function pgettext($context, $msgid)
|
||||
{
|
||||
$key = $context.chr(4).$msgid;
|
||||
@@ -444,6 +457,14 @@ class GetTextReader
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* np get text
|
||||
* @param string $context [description]
|
||||
* @param string $singular [description]
|
||||
* @param string $plural [description]
|
||||
* @param string $number [description]
|
||||
* @return string [description]
|
||||
*/
|
||||
public function npgettext($context, $singular, $plural, $number)
|
||||
{
|
||||
$key = $context.chr(4).$singular;
|
||||
|
||||
@@ -719,6 +719,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
*/
|
||||
public function formCreateElement(string $element_name, ?string $query = null): array
|
||||
{
|
||||
$data = array();
|
||||
// special 2nd color for 'binary' attribut
|
||||
if ($this->table_array[$element_name]['type'] == 'binary' && !isset($this->table_array[$element_name]['value'])) {
|
||||
$EDIT_FGCOLOR_T = 'edit_fgcolor_no';
|
||||
@@ -806,7 +807,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
$query = "SELECT ".((isset($this->table_array[$element_name]['select_distinct']) && $this->table_array[$element_name]['select_distinct']) ? "DISTINCT" : '');
|
||||
$query .= " ".$this->table_array[$element_name]['pk_name'].", ".$this->table_array[$element_name]['input_name']." ";
|
||||
if (!empty($this->table_array[$element_name]['order_by'])) {
|
||||
$query .", ".$this->table_array[$element_name]['order_by']." ";
|
||||
$query .= ", ".$this->table_array[$element_name]['order_by']." ";
|
||||
}
|
||||
$query .= "FROM ".$this->table_array[$element_name]['table_name'];
|
||||
// possible where statements
|
||||
@@ -1107,8 +1108,13 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
// $this->debug('edit_error_chk', 'K: '.$_POST[$prfx.$key].' | '.$_POST[$prfx.$key][0]);
|
||||
}
|
||||
$this->debug('POST ARRAY', $this->printAr($_POST));
|
||||
// init variables before inner loop run
|
||||
$mand_okay = 0;
|
||||
$mand_name = '';
|
||||
$row_okay = array();
|
||||
$default_wrong = array();
|
||||
$error = array();
|
||||
$element_set = array();
|
||||
# check each row
|
||||
for ($i = 0; $i < $max; $i ++) {
|
||||
// either one of the post pks is set, or the mandatory
|
||||
@@ -1221,7 +1227,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
*/
|
||||
public function formUnsetTableArray(): void
|
||||
{
|
||||
unset($this->pk_id);
|
||||
$this->pk_id = null;
|
||||
if (!is_array($this->table_array)) {
|
||||
$this->table_array = array();
|
||||
}
|
||||
@@ -1670,6 +1676,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
// DESC : creates the multiple select part for a reference_table
|
||||
public function formCreateElementReferenceTable($table_name)
|
||||
{
|
||||
$data = array();
|
||||
$output_name = $this->reference_array[$table_name]['output_name'];
|
||||
if ($this->reference_array[$table_name]['mandatory']) {
|
||||
$output_name .= ' *';
|
||||
@@ -1698,6 +1705,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
*/
|
||||
public function formCreateElementListTable(string $table_name): array
|
||||
{
|
||||
$data = array();
|
||||
// output name for the viewable left table td box, prefixed with * if mandatory
|
||||
$output_name = $this->element_list[$table_name]['output_name'];
|
||||
if (isset($this->element_list[$table_name]['mandatory'])) {
|
||||
|
||||
Reference in New Issue
Block a user