Switch all array init calles to no space before bracket
Also bug fix in Form General for load int PK calls with non int types
This commit is contained in:
@@ -78,33 +78,33 @@ class Login extends \CoreLibs\DB\IO
|
||||
private $pw_old_password;
|
||||
private $pw_new_password;
|
||||
private $pw_new_password_confirm;
|
||||
private $pw_change_deny_users = array (); // array of users for which the password change is forbidden
|
||||
private $pw_change_deny_users = array(); // array of users for which the password change is forbidden
|
||||
private $logout_target;
|
||||
private $max_login_error_count = -1;
|
||||
private $lock_deny_users = array ();
|
||||
private $lock_deny_users = array();
|
||||
|
||||
// if we have password change we need to define some rules
|
||||
private $password_min_length = PASSWORD_MIN_LENGTH;
|
||||
// max length is fixed as 255 (for input type max), if set highter, it will be set back to 255
|
||||
private $password_max_length = PASSWORD_MAX_LENGTH;
|
||||
// can have several regexes, if nothing set, all is ok
|
||||
private $password_valid_chars = array (
|
||||
private $password_valid_chars = array(
|
||||
// '^(?=.*\d)(?=.*[A-Za-z])[0-9A-Za-z!@#$%]{8,}$',
|
||||
// '^(?.*(\pL)u)(?=.*(\pN)u)(?=.*([^\pL\pN])u).{8,}',
|
||||
);
|
||||
|
||||
// all possible login error conditions
|
||||
private $login_error_msg = array ();
|
||||
private $login_error_msg = array();
|
||||
// this is an array holding all strings & templates passed from the outside (translation)
|
||||
private $login_template = array (
|
||||
'strings' => array (),
|
||||
private $login_template = array(
|
||||
'strings' => array(),
|
||||
'password_change' => '',
|
||||
'template' => ''
|
||||
);
|
||||
|
||||
// acl vars
|
||||
public $acl = array ();
|
||||
public $default_acl_list = array ();
|
||||
public $acl = array();
|
||||
public $default_acl_list = array();
|
||||
|
||||
// language
|
||||
public $l;
|
||||
@@ -207,7 +207,7 @@ class Login extends \CoreLibs\DB\IO
|
||||
// logout target (from config)
|
||||
$this->logout_target = LOGOUT_TARGET;
|
||||
// disallow user list for password change
|
||||
$this->pw_change_deny_users = array ('admin');
|
||||
$this->pw_change_deny_users = array('admin');
|
||||
// set flag if password change is okay
|
||||
if (defined('PASSWORD_CHANGE')) {
|
||||
$this->password_change = PASSWORD_CHANGE;
|
||||
@@ -219,15 +219,15 @@ class Login extends \CoreLibs\DB\IO
|
||||
// max login counts before error reporting
|
||||
$this->max_login_error_count = 10;
|
||||
// users that never get locked, even if they are set strict
|
||||
$this->lock_deny_users = array ('admin');
|
||||
$this->lock_deny_users = array('admin');
|
||||
|
||||
// init default ACL list array
|
||||
$_SESSION['DEFAULT_ACL_LIST'] = array ();
|
||||
$_SESSION['DEFAULT_ACL_LIST'] = array();
|
||||
// read the current edit_access_right list into an array
|
||||
$q = "SELECT level, type, name FROM edit_access_right WHERE level >= 0 ORDER BY level";
|
||||
while ($res = $this->dbReturn($q)) {
|
||||
// level to description format (numeric)
|
||||
$this->default_acl_list[$res['level']] = array (
|
||||
$this->default_acl_list[$res['level']] = array(
|
||||
'type' => $res['type'],
|
||||
'name' => $res['name']
|
||||
);
|
||||
@@ -428,7 +428,7 @@ class Login extends \CoreLibs\DB\IO
|
||||
}
|
||||
$edit_page_ids = array();
|
||||
$pages = array();
|
||||
$pages_acl = array ();
|
||||
$pages_acl = array();
|
||||
// set pages access
|
||||
$q = "SELECT ep.edit_page_id, ep.cuid, epca.cuid AS content_alias_uid, ep.filename, ep.name AS edit_page_name, ep.order_number AS edit_page_order, ep.menu, ";
|
||||
$q .= "ep.popup, ep.popup_x, ep.popup_y, ep.online, ear.level, ear.type ";
|
||||
@@ -442,7 +442,7 @@ class Login extends \CoreLibs\DB\IO
|
||||
// page id array for sub data readout
|
||||
$edit_page_ids[$res['edit_page_id']] = $res['cuid'];
|
||||
// create the array for pages
|
||||
$pages[$res['cuid']] = array (
|
||||
$pages[$res['cuid']] = array(
|
||||
'edit_page_id' => $res['edit_page_id'],
|
||||
'cuid' => $res['cuid'],
|
||||
'content_alias_uid' => $res['content_alias_uid'], // for reference of content data on a differen page
|
||||
@@ -456,8 +456,8 @@ class Login extends \CoreLibs\DB\IO
|
||||
'online' => $res['online'],
|
||||
'acl_level' => $res['level'],
|
||||
'acl_type' => $res['type'],
|
||||
'query' => array (),
|
||||
'visible' => array ()
|
||||
'query' => array(),
|
||||
'visible' => array()
|
||||
);
|
||||
// make reference filename -> level
|
||||
$pages_acl[$res['filename']] = $res['level'];
|
||||
@@ -477,7 +477,7 @@ class Login extends \CoreLibs\DB\IO
|
||||
$q .= "WHERE enabled = 1 AND edit_page_id IN (".join(', ', array_keys($edit_page_ids)).") ";
|
||||
$q .= "ORDER BY eqs.edit_page_id";
|
||||
while ($res = $this->dbReturn($q)) {
|
||||
$pages[$edit_page_ids[$res['edit_page_id']]]['query'][] = array (
|
||||
$pages[$edit_page_ids[$res['edit_page_id']]]['query'][] = array(
|
||||
'name' => $res['name'],
|
||||
'value' => $res['value'],
|
||||
'dynamic' => $res['dynamic']
|
||||
@@ -491,7 +491,7 @@ class Login extends \CoreLibs\DB\IO
|
||||
$q .= "epc.edit_page_id IN (".join(', ', array_keys($edit_page_ids)).") ";
|
||||
$q .= "ORDER BY epc.order_number";
|
||||
while ($res = $this->dbReturn($q)) {
|
||||
$pages[$edit_page_ids[$res['edit_page_id']]]['content'][$res['uid']] = array (
|
||||
$pages[$edit_page_ids[$res['edit_page_id']]]['content'][$res['uid']] = array(
|
||||
'name' => $res['name'],
|
||||
'uid' => $res['uid'],
|
||||
'online' => $res['online'],
|
||||
@@ -516,12 +516,12 @@ class Login extends \CoreLibs\DB\IO
|
||||
while ($res = $this->dbReturn($q)) {
|
||||
// read edit access data fields and drop them into the unit access array
|
||||
$q_sub ="SELECT name, value FROM edit_access_data WHERE enabled = 1 AND edit_access_id = ".$res['edit_access_id'];
|
||||
$ea_data = array ();
|
||||
$ea_data = array();
|
||||
while ($res_sub = $this->dbReturn($q_sub)) {
|
||||
$ea_data[$res_sub['name']] = $res_sub['value'];
|
||||
}
|
||||
// build master unit array
|
||||
$unit_access[$res['edit_access_id']] = array (
|
||||
$unit_access[$res['edit_access_id']] = array(
|
||||
'id' => $res['edit_access_id'],
|
||||
'acl_level' => $res['level'],
|
||||
'acl_type' => $res['type'],
|
||||
@@ -721,7 +721,7 @@ class Login extends \CoreLibs\DB\IO
|
||||
}
|
||||
}
|
||||
// detail name/level set
|
||||
$this->acl['unit_detail'][$ea_id] = array (
|
||||
$this->acl['unit_detail'][$ea_id] = array(
|
||||
'name' => $unit['name'],
|
||||
'uid' => $unit['uid'],
|
||||
'level' => $this->default_acl_list[$this->acl['unit'][$ea_id]]['name'],
|
||||
@@ -906,10 +906,10 @@ class Login extends \CoreLibs\DB\IO
|
||||
// if true, return error ajax
|
||||
global $AJAX_PAGE;
|
||||
if ($AJAX_PAGE === true) {
|
||||
$data = array (
|
||||
$data = array(
|
||||
'status' => 'error',
|
||||
'error_code' => $this->login_error,
|
||||
'msg' => array (
|
||||
'msg' => array(
|
||||
'level' => 'error',
|
||||
'str' => $this->l->__('Login necessary')
|
||||
)
|
||||
@@ -1020,7 +1020,7 @@ class Login extends \CoreLibs\DB\IO
|
||||
*/
|
||||
private function loginSetTemplates()
|
||||
{
|
||||
$strings = array (
|
||||
$strings = array(
|
||||
'HTML_TITLE' => $this->l->__('LOGIN'),
|
||||
'TITLE' => $this->l->__('LOGIN'),
|
||||
'USERNAME' => $this->l->__('Username'),
|
||||
@@ -1031,7 +1031,7 @@ class Login extends \CoreLibs\DB\IO
|
||||
'PASSWORD_CHANGE_BUTTON_VALUE' => $this->l->__('Change Password')
|
||||
);
|
||||
|
||||
$error_msgs = array (
|
||||
$error_msgs = array(
|
||||
'100' => $this->l->__('Fatal Error: <b>[EUID] came in as GET/POST!</b>'), // actually obsolete
|
||||
'1010' => $this->l->__('Fatal Error: <b>Login Failed - Wrong Username or Password</b>'), // user not found
|
||||
'1011' => $this->l->__('Fatal Error: <b>Login Failed - Wrong Username or Password</b>'), // blowfish password wrong
|
||||
@@ -1054,7 +1054,7 @@ class Login extends \CoreLibs\DB\IO
|
||||
|
||||
// if password change is okay
|
||||
if ($this->password_change) {
|
||||
$strings = array_merge($strings, array (
|
||||
$strings = array_merge($strings, array(
|
||||
'TITLE_PASSWORD_CHANGE' => 'Change Password for User',
|
||||
'OLD_PASSWORD' => $this->l->__('Old Password'),
|
||||
'NEW_PASSWORD' => $this->l->__('New Password'),
|
||||
@@ -1081,7 +1081,7 @@ EOM;
|
||||
if ($this->password_forgot) {
|
||||
}
|
||||
if (!$this->password_change && !$this->password_forgot) {
|
||||
$strings = array_merge($strings, array (
|
||||
$strings = array_merge($strings, array(
|
||||
'JS_SHOW_HIDE' => '',
|
||||
'PASSWORD_CHANGE_BUTTON' => '',
|
||||
'PASSWORD_CHANGE_DIV' => ''
|
||||
@@ -1186,7 +1186,7 @@ EOM;
|
||||
} else {
|
||||
$this->action = '';
|
||||
}
|
||||
$_data_binary = array (
|
||||
$_data_binary = array(
|
||||
'_SESSION' => $_SESSION,
|
||||
'_GET' => $_GET,
|
||||
'_POST' => $_POST,
|
||||
|
||||
@@ -30,7 +30,7 @@ class Backend extends \CoreLibs\DB\IO
|
||||
public $menu = array();
|
||||
public $menu_show_flag = 0; // top menu flag (mostly string)
|
||||
// action ids
|
||||
public $action_list = array ('action', 'action_id', 'action_sub_id', 'action_yes', 'action_flag', 'action_menu', 'action_value', 'action_error', 'action_loaded');
|
||||
public $action_list = array('action', 'action_id', 'action_sub_id', 'action_yes', 'action_flag', 'action_menu', 'action_value', 'action_error', 'action_loaded');
|
||||
public $action;
|
||||
public $action_id;
|
||||
public $action_sub_id;
|
||||
@@ -41,14 +41,14 @@ class Backend extends \CoreLibs\DB\IO
|
||||
public $action_value;
|
||||
public $action_error;
|
||||
// ACL array variable if we want to set acl data from outisde
|
||||
public $acl = array ();
|
||||
public $acl = array();
|
||||
public $default_acl;
|
||||
// queue key
|
||||
public $queue_key;
|
||||
// the current active edit access id
|
||||
public $edit_access_id;
|
||||
// error/warning/info messages
|
||||
public $messages = array ();
|
||||
public $messages = array();
|
||||
public $error = 0;
|
||||
public $warning = 0;
|
||||
public $info = 0;
|
||||
@@ -195,9 +195,9 @@ class Backend extends \CoreLibs\DB\IO
|
||||
// get the session pages array
|
||||
$PAGES = $_SESSION['PAGES'];
|
||||
if (!isset($PAGES) || !is_array($PAGES)) {
|
||||
$PAGES = array ();
|
||||
$PAGES = array();
|
||||
}
|
||||
$pages = array ();
|
||||
$pages = array();
|
||||
foreach ($PAGES as $PAGE_CUID => $PAGE_DATA) {
|
||||
$pages[] = $PAGE_DATA;
|
||||
}
|
||||
@@ -340,12 +340,12 @@ class Backend extends \CoreLibs\DB\IO
|
||||
* @param array $vars optional data for a possible printf formated msg
|
||||
* @return void has no return
|
||||
*/
|
||||
public function adbMsg(string $level, string $msg, array $vars = array ()): void
|
||||
public function adbMsg(string $level, string $msg, array $vars = array()): void
|
||||
{
|
||||
if (!preg_match("/^info|warning|error$/", $level)) {
|
||||
$level = "info";
|
||||
}
|
||||
$this->messages[] = array (
|
||||
$this->messages[] = array(
|
||||
'msg' => vsprintf($this->l->__($msg), $vars),
|
||||
'class' => $level
|
||||
);
|
||||
|
||||
@@ -112,7 +112,7 @@ class Basic
|
||||
public $host_port;
|
||||
// internal error reporting vars
|
||||
protected $error_id; // error ID for errors in classes
|
||||
protected $error_msg = array (); // the "connection" to the outside errors
|
||||
protected $error_msg = array(); // the "connection" to the outside errors
|
||||
// debug output prefix
|
||||
public $error_msg_prefix = ''; // prefix to the error string (the class name)
|
||||
// debug flags
|
||||
@@ -152,14 +152,14 @@ class Basic
|
||||
private $script_starttime;
|
||||
|
||||
// email valid checks
|
||||
public $email_regex_check = array ();
|
||||
public $mobile_email_type = array ();
|
||||
public $mobile_email_type_short = array ();
|
||||
public $email_regex_check = array();
|
||||
public $mobile_email_type = array();
|
||||
public $mobile_email_type_short = array();
|
||||
public $email_regex; // regex var for email check
|
||||
public $keitai_email_regex; // regex var for email check
|
||||
|
||||
// data path for files
|
||||
public $data_path = array ();
|
||||
public $data_path = array();
|
||||
|
||||
// error char for the char conver
|
||||
public $mbErrorChar;
|
||||
@@ -170,12 +170,12 @@ class Basic
|
||||
public $cryptIterationCost = 7; // this is for staying backwards compatible with the old ones
|
||||
public $cryptSaltSize = 22; // default 22 chars for blowfish, 2 for STD DES, 8 for MD5,
|
||||
// new better password management
|
||||
protected $password_options = array ();
|
||||
protected $password_options = array();
|
||||
// session name
|
||||
private $session_name = '';
|
||||
private $session_id = '';
|
||||
// key generation
|
||||
private $key_range = array ();
|
||||
private $key_range = array();
|
||||
private $one_key_length;
|
||||
private $key_length;
|
||||
private $max_key_length = 256; // max allowed length
|
||||
@@ -233,7 +233,7 @@ class Basic
|
||||
}
|
||||
|
||||
// set the paths matching to the valid file types
|
||||
$this->data_path = array (
|
||||
$this->data_path = array(
|
||||
'P' => PICTURES,
|
||||
'F' => FLASH,
|
||||
'V' => VIDEOS,
|
||||
@@ -299,7 +299,7 @@ class Basic
|
||||
// set the regex for checking emails
|
||||
$this->email_regex = "^[A-Za-z0-9!#$%&'*+\-\/=?^_`{|}~][A-Za-z0-9!#$%:\(\)&'*+\-\/=?^_`{|}~\.]{0,63}@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]{1,})*\.([a-zA-Z]{2,}){1}$";
|
||||
// this is for error check parts in where the email regex failed
|
||||
$this->email_regex_check = array (
|
||||
$this->email_regex_check = array(
|
||||
1 => "@(.*)@(.*)", // double @
|
||||
2 => "^[A-Za-z0-9!#$%&'*+-\/=?^_`{|}~][A-Za-z0-9!#$%:\(\)&'*+-\/=?^_`{|}~\.]{0,63}@", // wrong part before @
|
||||
3 => "@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]{1,})*\.([a-zA-Z]{2,}){1}$", // wrong part after @
|
||||
@@ -309,7 +309,7 @@ class Basic
|
||||
7 => "@.*\.$" // ends with a dot, top level, domain missing
|
||||
);
|
||||
// the array with the mobile types that are valid
|
||||
$this->mobile_email_type = array (
|
||||
$this->mobile_email_type = array(
|
||||
'.*@docomo\.ne\.jp$' => 'keitai_docomo',
|
||||
'.*@([a-z0-9]{2}\.)?ezweb\.ne\.jp$' => 'keitai_kddi_ezweb', # correct are a[2-4], b2, c[1-9], e[2-9], h[2-4], t[1-9]
|
||||
'.*@(ez[a-j]{1}\.)?ido\.ne\.jp$' => 'keitai_kddi_ido', # ez[a-j] or nothing
|
||||
@@ -335,7 +335,7 @@ class Basic
|
||||
'.*@emobile-s\.ne\.jp$' => 'keitai_willcom_emnet' # e-mobile, group will willcom
|
||||
);
|
||||
// short list for mobile email types
|
||||
$this->mobile_email_type_short = array (
|
||||
$this->mobile_email_type_short = array(
|
||||
'keitai_docomo' => 'docomo',
|
||||
'keitai_kddi_ezweb' => 'kddi',
|
||||
'keitai_kddi' => 'kddi',
|
||||
@@ -738,10 +738,10 @@ class Basic
|
||||
* @param array $error_msg error array
|
||||
* @return void has no return
|
||||
*/
|
||||
public function mergeErrors(array $error_msg = array ()): void
|
||||
public function mergeErrors(array $error_msg = array()): void
|
||||
{
|
||||
if (!is_array($error_msg)) {
|
||||
$error_msg = array ();
|
||||
$error_msg = array();
|
||||
}
|
||||
foreach ($error_msg as $level => $msg) {
|
||||
$this->error_msg[$level] .= $msg;
|
||||
@@ -1171,7 +1171,7 @@ class Basic
|
||||
*/
|
||||
public static function arraySearchRecursive($needle, array $haystack, $key_lookin = ''): ?array
|
||||
{
|
||||
$path = array ();
|
||||
$path = array();
|
||||
if (!is_array($haystack)) {
|
||||
$haystack = array();
|
||||
}
|
||||
@@ -1211,10 +1211,10 @@ class Basic
|
||||
$path['level'] = 0;
|
||||
}
|
||||
if (!isset($path['work'])) {
|
||||
$path['work'] = array ();
|
||||
$path['work'] = array();
|
||||
}
|
||||
if (!is_array($haystack)) {
|
||||
$haystack = array ();
|
||||
$haystack = array();
|
||||
}
|
||||
|
||||
// go through the array,
|
||||
@@ -1245,7 +1245,7 @@ class Basic
|
||||
|
||||
/**
|
||||
* array search simple. looks for key, value combination, 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
|
||||
@@ -1253,7 +1253,7 @@ class Basic
|
||||
public static function arraySearchSimple(array $array, $key, $value): bool
|
||||
{
|
||||
if (!is_array($array)) {
|
||||
$array = array ();
|
||||
$array = array();
|
||||
}
|
||||
foreach ($array as $_key => $_value) {
|
||||
// if value is an array, we search
|
||||
@@ -1342,7 +1342,7 @@ class Basic
|
||||
if (!is_array($haystack)) {
|
||||
return false;
|
||||
}
|
||||
$found = array ();
|
||||
$found = array();
|
||||
foreach ($needle as $element) {
|
||||
if (in_array($element, $haystack)) {
|
||||
$found[] = $element;
|
||||
@@ -1365,7 +1365,7 @@ class Basic
|
||||
*/
|
||||
public static function genAssocArray(array $db_array, $key, $value, bool $set_only = false): array
|
||||
{
|
||||
$ret_array = array ();
|
||||
$ret_array = array();
|
||||
// do this to only run count once
|
||||
for ($i = 0, $iMax = count($db_array); $i < $iMax; $i ++) {
|
||||
// if no key then we make an order reference
|
||||
@@ -1395,7 +1395,7 @@ class Basic
|
||||
{
|
||||
trigger_error('Method '.__METHOD__.' is deprecated, use join()', E_USER_DEPRECATED);
|
||||
if (!is_array($array)) {
|
||||
$array = array ();
|
||||
$array = array();
|
||||
}
|
||||
return join($connect_char, $array);
|
||||
}
|
||||
@@ -1408,7 +1408,7 @@ class Basic
|
||||
*/
|
||||
public static function flattenArray(array $array): array
|
||||
{
|
||||
$return = array ();
|
||||
$return = array();
|
||||
array_walk_recursive(
|
||||
$array,
|
||||
function ($value) use (&$return) {
|
||||
@@ -1423,9 +1423,9 @@ class Basic
|
||||
* @param array $array multidemnsional array to flatten
|
||||
* @return array flattened keys array
|
||||
*/
|
||||
public static function flattenArrayKey(array $array/*, array $return = array ()*/): array
|
||||
public static function flattenArrayKey(array $array/*, array $return = array()*/): array
|
||||
{
|
||||
$return = array ();
|
||||
$return = array();
|
||||
array_walk_recursive(
|
||||
$array,
|
||||
function ($value, $key) use (&$return) {
|
||||
@@ -1438,14 +1438,14 @@ 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
|
||||
*/
|
||||
public static function arrayFlatForKey(array $array, $search): array
|
||||
{
|
||||
if (!is_array($array)) {
|
||||
$array = array ();
|
||||
$array = array();
|
||||
}
|
||||
foreach ($array as $key => $value) {
|
||||
// if it is not an array do just nothing
|
||||
@@ -1600,8 +1600,8 @@ class Basic
|
||||
if (!preg_match("/(h|m|s|ms)/", (string)$timestamp)) {
|
||||
$ms = 0;
|
||||
list ($timestamp, $ms) = explode('.', (string)round($timestamp, 4));
|
||||
$timegroups = array (86400, 3600, 60, 1);
|
||||
$labels = array ('d', 'h', 'm', 's');
|
||||
$timegroups = array(86400, 3600, 60, 1);
|
||||
$labels = array('d', 'h', 'm', 's');
|
||||
$time_string = '';
|
||||
for ($i = 0, $iMax = count($timegroups); $i < $iMax; $i ++) {
|
||||
$output = floor((float)$timestamp / $timegroups[$i]);
|
||||
@@ -1636,8 +1636,8 @@ class Basic
|
||||
$timestamp = 0;
|
||||
if (preg_match("/(d|h|m|s|ms)/", $timestring)) {
|
||||
// pos for preg match read + multiply factor
|
||||
$timegroups = array (2 => 86400, 4 => 3600, 6 => 60, 8 => 1);
|
||||
$matches = array ();
|
||||
$timegroups = array(2 => 86400, 4 => 3600, 6 => 60, 8 => 1);
|
||||
$matches = array();
|
||||
// preg match: 0: full strsing
|
||||
// 2, 4, 6, 8 are the to need values
|
||||
preg_match("/^((\d+)d ?)?((\d+)h ?)?((\d+)m ?)?((\d+)s ?)?((\d+)ms)?$/", $timestring, $matches);
|
||||
@@ -1785,7 +1785,7 @@ class Basic
|
||||
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 = array();
|
||||
$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
|
||||
@@ -1806,7 +1806,7 @@ class Basic
|
||||
}
|
||||
}
|
||||
if ($return_named === true) {
|
||||
return array (
|
||||
return array(
|
||||
'overall' => $days[0],
|
||||
'weekday' => $days[1],
|
||||
'weekend' => $days[2]
|
||||
@@ -1830,7 +1830,7 @@ class Basic
|
||||
public static function createThumbnail(string $pic, int $size_x, int $size_y, string $dummy = '', string $path = '', string $cache_source = '', bool $clear_cache = false)
|
||||
{
|
||||
// get image type flags
|
||||
$image_types = array (
|
||||
$image_types = array(
|
||||
1 => 'gif',
|
||||
2 => 'jpg',
|
||||
3 => 'png'
|
||||
@@ -1956,7 +1956,7 @@ class Basic
|
||||
$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 = array();
|
||||
// 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);
|
||||
@@ -2161,9 +2161,9 @@ class Basic
|
||||
// a-z is 97,122
|
||||
// 0-9 is 48,57
|
||||
// ./ is 46,47 (so first lower limit is 46)
|
||||
$min = array (46, 65, 97);
|
||||
$max = array (57, 90, 122);
|
||||
$chars = array ();
|
||||
$min = array(46, 65, 97);
|
||||
$max = array(57, 90, 122);
|
||||
$chars = array();
|
||||
for ($i = 0, $iMax = count($min); $i < $iMax; $i ++) {
|
||||
for ($j = $min[$i]; $j <= $max[$i]; $j ++) {
|
||||
$chars[] = chr($j);
|
||||
@@ -2224,7 +2224,7 @@ class Basic
|
||||
private function passwordInit(): void
|
||||
{
|
||||
// set default password cost: use default set automatically
|
||||
$this->password_options = array (
|
||||
$this->password_options = array(
|
||||
// 'cost' => PASSWORD_BCRYPT_DEFAULT_COST
|
||||
);
|
||||
}
|
||||
@@ -2325,7 +2325,7 @@ class Basic
|
||||
if ($hex_prefix === true) {
|
||||
$hex_color = '#';
|
||||
}
|
||||
foreach (array ('red', 'green', 'blue') as $color) {
|
||||
foreach (array('red', 'green', 'blue') as $color) {
|
||||
// if not valid, set to gray
|
||||
if ($$color < 0 || $$color > 255) {
|
||||
$$color = 125;
|
||||
|
||||
@@ -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
|
||||
*
|
||||
@@ -189,7 +189,7 @@ class ArrayIO extends \CoreLibs\DB\IO
|
||||
* set this as new table array too
|
||||
* @return array returns the table array that was deleted
|
||||
*/
|
||||
public function dbDelete($table_array = array ())
|
||||
public function dbDelete($table_array = array())
|
||||
{
|
||||
// is array and has values, override set and set new
|
||||
if (is_array($table_array) && count($table_array)) {
|
||||
@@ -248,7 +248,7 @@ class ArrayIO extends \CoreLibs\DB\IO
|
||||
* @param array $table_array optional table array, overwrites internal set array
|
||||
* @return array set table array with values
|
||||
*/
|
||||
public function dbRead($edit = false, $table_array = array ())
|
||||
public function dbRead($edit = false, $table_array = array())
|
||||
{
|
||||
// if array give, overrules internal array
|
||||
if (is_array($table_array) && count($table_array)) {
|
||||
@@ -321,7 +321,7 @@ class ArrayIO extends \CoreLibs\DB\IO
|
||||
* @param array $table_array optional table array, overwrites internal one
|
||||
* @return array table array or null
|
||||
*/
|
||||
public function dbWrite($addslashes = false, $table_array = array ())
|
||||
public function dbWrite($addslashes = false, $table_array = array())
|
||||
{
|
||||
if (is_array($table_array) && count($table_array)) {
|
||||
$this->table_array = $table_array;
|
||||
|
||||
@@ -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
|
||||
@@ -134,7 +134,7 @@
|
||||
* - correctly escapes string for db insert
|
||||
* $string db_boolean(string)
|
||||
* - if the string value is 't' or 'f' it returns correct TRUE/FALSE for php
|
||||
* $primary_key db_write_data($write_array, $not_write_array, $primary_key, $table, $data = array ())
|
||||
* $primary_key db_write_data($write_array, $not_write_array, $primary_key, $table, $data = array())
|
||||
* - writes into one table based on arrays of columns to write and not write, reads data from global vars or optional array
|
||||
* $boolean db_set_schema(schema)
|
||||
* - sets search path to a schema
|
||||
@@ -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)
|
||||
@@ -270,7 +270,7 @@ class IO extends \CoreLibs\Basic
|
||||
public $cursor; // actual cursor (DBH)
|
||||
public $num_rows; // how many rows have been found
|
||||
public $num_fields; // how many fields has the query
|
||||
public $field_names = array (); // array with the field names of the current query
|
||||
public $field_names = array(); // array with the field names of the current query
|
||||
public $insert_id; // last inserted ID
|
||||
public $insert_id_ext; // extended insert ID (for data outside only primary key)
|
||||
private $temp_sql;
|
||||
@@ -288,14 +288,14 @@ class IO extends \CoreLibs\Basic
|
||||
|
||||
// endless loop protection
|
||||
private $MAX_QUERY_CALL;
|
||||
private $query_called = array ();
|
||||
private $query_called = array();
|
||||
// error string
|
||||
protected $error_string = array ();
|
||||
protected $error_string = array();
|
||||
// prepared list
|
||||
public $prepare_cursor = array ();
|
||||
public $prepare_cursor = array();
|
||||
// primary key per table list
|
||||
// format is 'table' => 'pk_name'
|
||||
public $pk_name_table = array ();
|
||||
public $pk_name_table = array();
|
||||
// internal primary key name, for cross calls in async
|
||||
public $pk_name;
|
||||
// if we use RETURNING in the INSERT call
|
||||
@@ -314,7 +314,7 @@ class IO extends \CoreLibs\Basic
|
||||
parent::__construct($set_control_flag);
|
||||
// dummy init array for db config if not array
|
||||
if (!is_array($db_config)) {
|
||||
$db_config = array ();
|
||||
$db_config = array();
|
||||
}
|
||||
// sets the names (for connect/reconnect)
|
||||
$this->db_name = $db_config['db_name'] ?? '';
|
||||
@@ -508,7 +508,7 @@ class IO extends \CoreLibs\Basic
|
||||
{
|
||||
$string = '';
|
||||
if (!is_array($array)) {
|
||||
$array = array ();
|
||||
$array = array();
|
||||
}
|
||||
foreach ($array as $key => $value) {
|
||||
$string .= $this->nbsp.'<b>'.$key.'</b> => ';
|
||||
@@ -765,7 +765,7 @@ class IO extends \CoreLibs\Basic
|
||||
// count the fields
|
||||
$this->num_fields = $this->db_functions->__dbNumFields($this->cursor);
|
||||
// set field names
|
||||
$this->field_names = array ();
|
||||
$this->field_names = array();
|
||||
for ($i = 0; $i < $this->num_fields; $i ++) {
|
||||
$this->field_names[] = $this->db_functions->__dbFieldName($this->cursor, $i);
|
||||
}
|
||||
@@ -781,8 +781,8 @@ class IO extends \CoreLibs\Basic
|
||||
if (!$this->returning_id) {
|
||||
$this->insert_id = $this->db_functions->__dbInsertId($this->query, $this->pk_name);
|
||||
} else {
|
||||
$this->insert_id = array ();
|
||||
$this->insert_id_ext = array ();
|
||||
$this->insert_id = array();
|
||||
$this->insert_id_ext = array();
|
||||
// echo "** PREPARE RETURNING FOR CURSOR: ".$this->cursor."<br>";
|
||||
// we have returning, now we need to check if we get one or many returned
|
||||
// we'll need to loop this, if we have multiple insert_id returns
|
||||
@@ -1033,7 +1033,7 @@ class IO extends \CoreLibs\Basic
|
||||
$md5 = md5($query);
|
||||
// pre declare array
|
||||
if (!isset($this->cursor_ext[$md5])) {
|
||||
$this->cursor_ext[$md5] = array (
|
||||
$this->cursor_ext[$md5] = array(
|
||||
'query' => '',
|
||||
'pos' => 0,
|
||||
'cursor' => 0,
|
||||
@@ -1135,7 +1135,7 @@ class IO extends \CoreLibs\Basic
|
||||
$return = false;
|
||||
} else {
|
||||
// unset return value ...
|
||||
$return = array ();
|
||||
$return = array();
|
||||
for ($i = 0; $i < $this->cursor_ext[$md5]['num_fields']; $i ++) {
|
||||
// create mixed return array
|
||||
if ($assoc_only === false && isset($this->cursor_ext[$md5]['data'][$this->cursor_ext[$md5]['pos']][$i])) {
|
||||
@@ -1171,7 +1171,7 @@ class IO extends \CoreLibs\Basic
|
||||
$this->cursor_ext[$md5]['read_rows'] ++;
|
||||
// if reset is <3 caching is done, else no
|
||||
if ($reset < 3) {
|
||||
$temp = array ();
|
||||
$temp = array();
|
||||
foreach ($return as $field_name => $data) {
|
||||
$temp[$field_name] = $data;
|
||||
}
|
||||
@@ -1361,9 +1361,9 @@ class IO extends \CoreLibs\Basic
|
||||
return false;
|
||||
}
|
||||
$cursor = $this->dbExec($query);
|
||||
$rows = array ();
|
||||
$rows = array();
|
||||
while ($res = $this->dbFetchArray($cursor, $assoc_only)) {
|
||||
$data = array ();
|
||||
$data = array();
|
||||
for ($i = 0; $i < $this->num_fields; $i ++) {
|
||||
$data[$this->field_names[$i]] = $res[$this->field_names[$i]];
|
||||
}
|
||||
@@ -1547,8 +1547,8 @@ class IO extends \CoreLibs\Basic
|
||||
if (!$this->prepare_cursor[$stm_name]['returning_id']) {
|
||||
$this->insert_id = $this->db_functions->__dbInsertId($this->prepare_cursor[$stm_name]['query'], $this->prepare_cursor[$stm_name]['pk_name']);
|
||||
} elseif ($result) {
|
||||
$this->insert_id = array ();
|
||||
$this->insert_id_ext = array ();
|
||||
$this->insert_id = array();
|
||||
$this->insert_id_ext = array();
|
||||
// we have returning, now we need to check if we get one or many returned
|
||||
// we'll need to loop this, if we have multiple insert_id returns
|
||||
while ($_insert_id = $this->db_functions->__dbFetchArray(
|
||||
@@ -1738,18 +1738,18 @@ class IO extends \CoreLibs\Basic
|
||||
* @param array $data data array to override _POST data
|
||||
* @return int|bool primary key
|
||||
*/
|
||||
public function dbWriteData(array $write_array, array $not_write_array, $primary_key, string $table, $data = array ())
|
||||
public function dbWriteData(array $write_array, array $not_write_array, $primary_key, string $table, $data = array())
|
||||
{
|
||||
if (!is_array($write_array)) {
|
||||
$write_array = array ();
|
||||
$write_array = array();
|
||||
}
|
||||
if (!is_array($not_write_array)) {
|
||||
$not_write_array = array ();
|
||||
$not_write_array = array();
|
||||
}
|
||||
if (is_array($table)) {
|
||||
return false;
|
||||
}
|
||||
$not_write_update_array = array ();
|
||||
$not_write_update_array = array();
|
||||
return $this->dbWriteDataExt($write_array, $primary_key, $table, $not_write_array, $not_write_update_array, $data);
|
||||
}
|
||||
|
||||
@@ -1757,7 +1757,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
|
||||
@@ -1770,12 +1770,12 @@ class IO extends \CoreLibs\Basic
|
||||
array $write_array,
|
||||
$primary_key,
|
||||
string $table,
|
||||
array $not_write_array = array (),
|
||||
array $not_write_update_array = array (),
|
||||
array $data = array ()
|
||||
array $not_write_array = array(),
|
||||
array $not_write_update_array = array(),
|
||||
array $data = array()
|
||||
) {
|
||||
if (!is_array($primary_key)) {
|
||||
$primary_key = array (
|
||||
$primary_key = array(
|
||||
'row' => $table.'_id',
|
||||
'value' => $primary_key
|
||||
);
|
||||
@@ -1895,7 +1895,7 @@ class IO extends \CoreLibs\Basic
|
||||
*/
|
||||
public function dbArrayParse(string $text): array
|
||||
{
|
||||
$output = array ();
|
||||
$output = array();
|
||||
return $this->db_functions->__dbArrayParse($text, $output);
|
||||
}
|
||||
|
||||
|
||||
@@ -444,7 +444,7 @@ class PgSQL
|
||||
{
|
||||
if (false === $limit) {
|
||||
$limit = strlen($text) - 1;
|
||||
$output = array ();
|
||||
$output = array();
|
||||
}
|
||||
if ('{}' != $text) {
|
||||
do {
|
||||
|
||||
@@ -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 = array(); // original -> translation mapping
|
||||
|
||||
|
||||
/* Methods */
|
||||
@@ -161,7 +161,7 @@ class GetTextReader
|
||||
}
|
||||
|
||||
if ($this->enable_cache) {
|
||||
$this->cache_translations = array ();
|
||||
$this->cache_translations = array();
|
||||
/* read all strings in the cache */
|
||||
for ($i = 0; $i < $this->total; $i++) {
|
||||
$this->STREAM->seekto($this->table_originals[$i * 2 + 2]);
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
* 'order_by' => 'order bY' string for drop_down_db(_input) if no query given but fields set
|
||||
* 'query' => for drop_down_db/array if no outer query given
|
||||
* 'preset' => value to preset when array is unset (available for all types)
|
||||
* 'element_list' => array ( 'true', 'false') - MUST (!) be set for binary
|
||||
* 'element_list' => array( 'true', 'false') - MUST (!) be set for binary
|
||||
* 'length' => 'nr' - only available for 'text' (maxlength)
|
||||
* 'size' => 'nr' - only available for 'text' (size of input field)
|
||||
* 'rows' => 'nr' - only available for 'textarea'
|
||||
@@ -69,7 +69,7 @@
|
||||
* array(
|
||||
* 'name' => 'name_of_col_in_query' - col from the query that should be shown
|
||||
* 'before_value' => 'text' - if set this text will be put in FRONT of the value from the col
|
||||
* 'binary' => array ('true','false') - for 1/0 fields in DB changes it int human readable format
|
||||
* 'binary' => array('true','false') - for 1/0 fields in DB changes it int human readable format
|
||||
* ),
|
||||
* ...
|
||||
* ),
|
||||
@@ -215,7 +215,7 @@ namespace CoreLibs\Output\Form;
|
||||
class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
{
|
||||
// rest
|
||||
public $field_array = array (); // for the load statetment describes which elements from the load query should be shown and i which format
|
||||
public $field_array = array(); // for the load statetment describes which elements from the load query should be shown and i which format
|
||||
public $load_query; // the query needed for loading a data set (one row in the table)
|
||||
public $col_name; // the name of the columen (before _<type>) [used for order button]
|
||||
public $yes; // the yes flag that triggers the template to show ALL and not only new/load
|
||||
@@ -224,9 +224,9 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
public $warning; // warning flag, for information (saved, loaded, etc)
|
||||
public $archive_pk_name; // the pk name for the load select form
|
||||
private $int_pk_name; // primary key, only internal usage
|
||||
public $reference_array = array (); // reference arrays -> stored in $this->reference_array[$table_name]=>array();
|
||||
public $reference_array = array(); // reference arrays -> stored in $this->reference_array[$table_name]=>array();
|
||||
public $element_list; // element list for elements next to each other as a special sub group
|
||||
public $table_array = array ();
|
||||
public $table_array = array();
|
||||
public $my_page_name; // the name of the page without .php extension
|
||||
public $mobile_phone = false;
|
||||
// buttons and checkboxes
|
||||
@@ -246,7 +246,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
public $l;
|
||||
|
||||
// now some default error msgs (english)
|
||||
public $language_array = array ();
|
||||
public $language_array = array();
|
||||
|
||||
/**
|
||||
* construct form generator
|
||||
@@ -277,8 +277,8 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
$config_array = ${$this->my_page_name};
|
||||
} else {
|
||||
// dummy created
|
||||
$config_array = array (
|
||||
'table_array' => array (),
|
||||
$config_array = array(
|
||||
'table_array' => array(),
|
||||
'table_name' => '',
|
||||
);
|
||||
}
|
||||
@@ -326,7 +326,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
if (!isset($config_array['security_level']) || !is_array($config_array['security_level']) ||
|
||||
(is_array($config_array['security_level']) && count($config_array['security_level']) < 4)
|
||||
) {
|
||||
$config_array['security_level'] = array (
|
||||
$config_array['security_level'] = array(
|
||||
'load' => 100,
|
||||
'new' => 100,
|
||||
'save' => 100,
|
||||
@@ -355,7 +355,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
public function formDumpTableArray()
|
||||
{
|
||||
if (!is_array($this->table_array)) {
|
||||
$this->table_array = array ();
|
||||
$this->table_array = array();
|
||||
}
|
||||
reset($this->table_array);
|
||||
$string = '<b>TABLE ARRAY DUMP:</b> '.$this->table_name.'<br>';
|
||||
@@ -376,7 +376,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
public function formGetColNameFromKey(string $want_key, ?string $key_value = null): ?string
|
||||
{
|
||||
if (!is_array($this->table_array)) {
|
||||
$this->table_array = array ();
|
||||
$this->table_array = array();
|
||||
}
|
||||
reset($this->table_array);
|
||||
foreach ($this->table_array as $key => $value) {
|
||||
@@ -400,7 +400,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
{
|
||||
$key_array = array();
|
||||
if (!is_array($this->table_array)) {
|
||||
$this->table_array = array ();
|
||||
$this->table_array = array();
|
||||
}
|
||||
reset($this->table_array);
|
||||
foreach ($this->table_array as $key => $value) {
|
||||
@@ -427,7 +427,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
if ($this->warning) {
|
||||
$class = 'warning';
|
||||
}
|
||||
return array (
|
||||
return array(
|
||||
'msg' => $this->msg,
|
||||
'width' => $this->table_width,
|
||||
'class' => $class
|
||||
@@ -437,10 +437,10 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
// next for functions are pre_test fkts for easier default new,load, etc handling
|
||||
/**
|
||||
* default load procedure
|
||||
* @param int $archive_id archive id to load
|
||||
* @return void has no return
|
||||
* @param string $archive_id archive id to load
|
||||
* @return void has no return
|
||||
*/
|
||||
public function formProcedureLoad(int $archive_id): void
|
||||
public function formProcedureLoad(string $archive_id): void
|
||||
{
|
||||
if ($this->archive && $archive_id && $this->base_acl_level >= $this->security_level['load']) {
|
||||
$this->formLoadTableArray($archive_id);
|
||||
@@ -520,7 +520,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
!$this->error
|
||||
) {
|
||||
if (!is_array($element_list)) {
|
||||
$element_list = array ();
|
||||
$element_list = array();
|
||||
}
|
||||
for ($i = 0, $i_max = count($element_list); $i < $i_max; $i ++) {
|
||||
// $this->debug('form_error', 'Array: '.is_array($this->element_list[$element_list[$i]]['read_data']).' | '.$this->element_list[$element_list[$i]]['delete']);
|
||||
@@ -551,7 +551,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
!$this->element_list[$element_list[$i]]['delete']
|
||||
) {
|
||||
if (!isset($_POST[$id])) {
|
||||
$_POST[$id] = array ();
|
||||
$_POST[$id] = array();
|
||||
}
|
||||
for ($j = 0, $j_max = count($_POST[$id]); $j < $j_max; $j ++) {
|
||||
// if it is not activated
|
||||
@@ -594,8 +594,8 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
{
|
||||
$pk_selected = '';
|
||||
$t_pk_name = '';
|
||||
$pk_names = array ();
|
||||
$pk_ids = array ();
|
||||
$pk_names = array();
|
||||
$pk_ids = array();
|
||||
// when security level is okay ...
|
||||
if ($this->base_acl_level >= $this->security_level['load']) {
|
||||
$t_pk_name = $this->archive_pk_name;
|
||||
@@ -626,7 +626,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
$pk_names[] = $t_string;
|
||||
}
|
||||
} // show it at all
|
||||
return array (
|
||||
return array(
|
||||
't_pk_name' => $t_pk_name,
|
||||
'pk_ids' => $pk_ids,
|
||||
'pk_names' => $pk_names,
|
||||
@@ -655,7 +655,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
$new_name = $this->l->__('New');
|
||||
}
|
||||
} // security level okay
|
||||
return array (
|
||||
return array(
|
||||
'new_name' => $new_name,
|
||||
'show_checkbox' => $show_checkbox
|
||||
);
|
||||
@@ -742,8 +742,9 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
$data['value'][] = $i;
|
||||
$data['output'][] = $this->table_array[$element_name]['element_list'][$i];
|
||||
$data['name'] = $element_name;
|
||||
if (($i && isset($this->table_array[$element_name]['value'])) ||
|
||||
(!$i && !isset($this->table_array[$element_name]['value']))
|
||||
if (isset($this->table_array[$element_name]['value']) &&
|
||||
(($i && $this->table_array[$element_name]['value']) ||
|
||||
(!$i && !$this->table_array[$element_name]['value']))
|
||||
) {
|
||||
$data['checked'] = $this->table_array[$element_name]['value'];
|
||||
}
|
||||
@@ -927,7 +928,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
public function formErrorCheck(): void
|
||||
{
|
||||
if (!is_array($this->table_array)) {
|
||||
$this->table_array = array ();
|
||||
$this->table_array = array();
|
||||
}
|
||||
reset($this->table_array);
|
||||
foreach ($this->table_array as $key => $value) {
|
||||
@@ -1068,7 +1069,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->reference_array = array ();
|
||||
$this->reference_array = array();
|
||||
}
|
||||
// $this->debug('edit_error', 'QS: <pre>'.print_r($_POST, true).'</pre>');
|
||||
if (is_array($this->element_list)) {
|
||||
@@ -1076,7 +1077,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
// if mandatory, check that at least on pk exists or if at least the mandatory field is filled
|
||||
foreach ($this->element_list as $table_name => $reference_array) {
|
||||
if (!is_array($reference_array)) {
|
||||
$reference_array = array ();
|
||||
$reference_array = array();
|
||||
}
|
||||
// set pk/fk id for this
|
||||
$_pk_name = '';
|
||||
@@ -1222,7 +1223,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
{
|
||||
unset($this->pk_id);
|
||||
if (!is_array($this->table_array)) {
|
||||
$this->table_array = array ();
|
||||
$this->table_array = array();
|
||||
}
|
||||
reset($this->table_array);
|
||||
foreach ($this->table_array as $key => $value) {
|
||||
@@ -1235,7 +1236,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
}
|
||||
if (is_array($this->reference_array)) {
|
||||
if (!is_array($this->reference_array)) {
|
||||
$this->reference_array = array ();
|
||||
$this->reference_array = array();
|
||||
}
|
||||
reset($this->reference_array);
|
||||
foreach ($this->reference_array as $key => $value) {
|
||||
@@ -1248,10 +1249,10 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
|
||||
/**
|
||||
* load a table & reference
|
||||
* @param int|null $pk_id overrule pk_id
|
||||
* @return void has no return
|
||||
* @param string|null $pk_id overrule pk_id
|
||||
* @return void has no return
|
||||
*/
|
||||
public function formLoadTableArray(?int $pk_id = null): void
|
||||
public function formLoadTableArray(?string $pk_id = null): void
|
||||
{
|
||||
if ($pk_id) {
|
||||
$this->pk_id = $pk_id;
|
||||
@@ -1260,7 +1261,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
|
||||
// reset all temp fields
|
||||
if (!is_array($this->table_array)) {
|
||||
$this->table_array = array ();
|
||||
$this->table_array = array();
|
||||
}
|
||||
reset($this->table_array);
|
||||
foreach ($this->table_array as $key => $value) {
|
||||
@@ -1270,7 +1271,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
if (is_array($this->reference_array)) {
|
||||
// load each reference_table
|
||||
if (!is_array($this->reference_array)) {
|
||||
$this->reference_array = array ();
|
||||
$this->reference_array = array();
|
||||
}
|
||||
reset($this->reference_array);
|
||||
foreach ($this->reference_array as $key => $value) {
|
||||
@@ -1297,7 +1298,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
// for drop_down_db_input check if text field is filled and if, if not yet in db ...
|
||||
// and upload files
|
||||
if (!is_array($this->table_array)) {
|
||||
$this->table_array = array ();
|
||||
$this->table_array = array();
|
||||
}
|
||||
reset($this->table_array);
|
||||
foreach ($this->table_array as $key => $value) {
|
||||
@@ -1408,7 +1409,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
// write reference array(s) if necessary
|
||||
if (is_array($this->reference_array)) {
|
||||
if (!is_array($this->reference_array)) {
|
||||
$this->reference_array = array ();
|
||||
$this->reference_array = array();
|
||||
}
|
||||
reset($this->reference_array);
|
||||
foreach ($this->reference_array as $reference_array) {
|
||||
@@ -1423,18 +1424,18 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
} // if reference arrays
|
||||
// write element list
|
||||
if (isset($this->element_list) && is_array($this->element_list)) {
|
||||
$type = array ();
|
||||
$type = array();
|
||||
reset($this->element_list);
|
||||
foreach ($this->element_list as $table_name => $reference_array) {
|
||||
// init arrays
|
||||
$q_begin = array ();
|
||||
$q_middle = array ();
|
||||
$q_end = array ();
|
||||
$q_names = array ();
|
||||
$q_data = array ();
|
||||
$q_values = array ();
|
||||
$no_write = array ();
|
||||
$block_write = array ();
|
||||
$q_begin = array();
|
||||
$q_middle = array();
|
||||
$q_end = array();
|
||||
$q_names = array();
|
||||
$q_data = array();
|
||||
$q_values = array();
|
||||
$no_write = array();
|
||||
$block_write = array();
|
||||
// get the number of keys from the elements array
|
||||
$keys = array_keys($reference_array['elements']);
|
||||
// element prefix name
|
||||
@@ -1596,7 +1597,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
// remove any reference arrays
|
||||
if (is_array($this->reference_array)) {
|
||||
if (!is_array($this->reference_array)) {
|
||||
$this->reference_array = array ();
|
||||
$this->reference_array = array();
|
||||
}
|
||||
reset($this->reference_array);
|
||||
foreach ($this->reference_array as $reference_array) {
|
||||
@@ -1607,7 +1608,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
// remove any element list references
|
||||
if (is_array($this->element_list)) {
|
||||
if (!is_array($this->element_list)) {
|
||||
$this->element_list = array ();
|
||||
$this->element_list = array();
|
||||
}
|
||||
reset($this->element_list);
|
||||
foreach ($this->element_list as $table_name => $data_array) {
|
||||
@@ -1617,7 +1618,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
}
|
||||
// unlink ALL files
|
||||
if (!is_array($this->table_array)) {
|
||||
$this->table_array = array ();
|
||||
$this->table_array = array();
|
||||
}
|
||||
reset($this->table_array);
|
||||
foreach ($this->table_array as $key => $value) {
|
||||
@@ -1635,11 +1636,11 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
// PARAMS: $hidden_array
|
||||
// RETURN: the input fields (html)
|
||||
// DESC : creates HTML hidden input fields out of an hash array
|
||||
public function formCreateHiddenFields($hidden_array = array ())
|
||||
public function formCreateHiddenFields($hidden_array = array())
|
||||
{
|
||||
$hidden = array ();
|
||||
$hidden = array();
|
||||
if (!is_array($this->table_array)) {
|
||||
$this->table_array = array ();
|
||||
$this->table_array = array();
|
||||
}
|
||||
reset($this->table_array);
|
||||
foreach ($this->table_array as $key => $value) {
|
||||
@@ -1728,13 +1729,13 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
|
||||
// build the select part
|
||||
if (!isset($this->element_list[$table_name]['elements']) || !is_array($this->element_list[$table_name]['elements'])) {
|
||||
$this->element_list[$table_name]['elements'] = array ();
|
||||
$this->element_list[$table_name]['elements'] = array();
|
||||
}
|
||||
reset($this->element_list[$table_name]['elements']);
|
||||
// generic data read in (counts for all rows)
|
||||
// visible list data output
|
||||
$q_select = array ();
|
||||
$proto = array ();
|
||||
$q_select = array();
|
||||
$proto = array();
|
||||
foreach ($this->element_list[$table_name]['elements'] as $el_name => $data_array) {
|
||||
// $this->debug('CFG', 'El: '.$el_name.' -> '.$this->printAr($data_array));
|
||||
// if the element name matches the read array, then set the table as a name prefix
|
||||
@@ -1798,7 +1799,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
if (isset($this->element_list[$table_name]['read_data'])) {
|
||||
// we need a second one for the query build only
|
||||
// prefix all elements with the $table name
|
||||
$_q_select = array ();
|
||||
$_q_select = array();
|
||||
foreach ($q_select as $_pos => $element) {
|
||||
$_q_select[$_pos] = $table_name.'.'.$element;
|
||||
}
|
||||
@@ -1844,7 +1845,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
$pos = 0; // position in while for overwrite if needed
|
||||
// read out the list and add the selected data if needed
|
||||
while ($res = $this->dbReturn($q)) {
|
||||
$_data = array ();
|
||||
$_data = array();
|
||||
$prfx = $data['prefix']; // short
|
||||
// go through each res
|
||||
for ($i = 0, $i_max = count($q_select); $i < $i_max; $i ++) {
|
||||
@@ -1895,7 +1896,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
// set if we need more open entries or if we do not have any entries yet
|
||||
if (($missing_empty_count < $this->element_list[$table_name]['max_empty']) || $element_count == 0) {
|
||||
for ($pos = $element_count, $pos_max = $this->element_list[$table_name]['max_empty'] + $element_count; $pos <= $pos_max; $pos ++) {
|
||||
$_data = array ();
|
||||
$_data = array();
|
||||
// the fields that need to be filled are in data->type array:
|
||||
// pk fields are unfilled
|
||||
// fk fields are filled with the fk_id 'int_pk_name' value
|
||||
@@ -1911,7 +1912,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
}
|
||||
}
|
||||
$data['content'][] = $_data;
|
||||
$data['pos'][] = array (0 => $pos); // this is for the checkboxes
|
||||
$data['pos'][] = array(0 => $pos); // this is for the checkboxes
|
||||
// $this->debug('CFG ELEMENT LIST FILL', 'Pos: '.$pos.'/'.$pos_max.', Content: '.count($data['content']).', Pos: '.count($data['pos']));
|
||||
}
|
||||
}
|
||||
@@ -1921,13 +1922,13 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
if (isset($data['delete_name']) && !empty($data['delete_name'])) {
|
||||
$data['content'][] = $proto;
|
||||
// we also need the pos add or we through an error in smarty
|
||||
$data['pos'][] = array (
|
||||
$data['pos'][] = array(
|
||||
0 => isset($data['pos']) ? count($data['pos']) : 0
|
||||
);
|
||||
}
|
||||
// $this->debug('CFG ELEMENT LIST FILL', 'Data array: '.$this->printAr($data));
|
||||
$type = 'element_list';
|
||||
return array (
|
||||
return array(
|
||||
'output_name' => $output_name,
|
||||
'type' => $type,
|
||||
'color' => 'edit_fgcolor',
|
||||
|
||||
@@ -157,7 +157,7 @@ class ProgressBar
|
||||
$pixel = $bar - ($this->pedding * 2);
|
||||
}
|
||||
|
||||
$position = array ();
|
||||
$position = array();
|
||||
switch ($this->direction) {
|
||||
case 'right':
|
||||
$position['left'] = $this->pedding;
|
||||
@@ -212,7 +212,7 @@ class ProgressBar
|
||||
*/
|
||||
public function setFrame(int $width = 0, int $height = 0): void
|
||||
{
|
||||
$this->frame = array (
|
||||
$this->frame = array(
|
||||
'show' => true,
|
||||
'left' => 20,
|
||||
'top' => 35,
|
||||
|
||||
@@ -32,7 +32,7 @@ function MyErrorHandler($type, $message, $file, $line, $context)
|
||||
return;
|
||||
}
|
||||
// ERROR LEVEL
|
||||
$error_level = array (
|
||||
$error_level = array(
|
||||
1 => 'E_ERROR',
|
||||
2 => 'E_WARNING',
|
||||
4 => 'E_PARSE',
|
||||
|
||||
Reference in New Issue
Block a user