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:
Clemens Schwaighofer
2019-09-20 11:10:13 +09:00
parent 8ade113070
commit ef1df6f171
26 changed files with 398 additions and 397 deletions

View File

@@ -8,8 +8,8 @@
*********************************************************************/ *********************************************************************/
// please be VERY carefull only to change the right side // please be VERY carefull only to change the right side
$DB_CONFIG = array ( $DB_CONFIG = array(
'test' => array ( 'test' => array(
'db_name' => 'gullevek', 'db_name' => 'gullevek',
'db_user' => 'gullevek', 'db_user' => 'gullevek',
'db_pass' => 'gullevek', 'db_pass' => 'gullevek',

View File

@@ -13,9 +13,9 @@
*********************************************************************/ *********************************************************************/
// each host has a different db_host // each host has a different db_host
$SITE_CONFIG = array ( $SITE_CONFIG = array(
// development host // development host
'soba.tokyo.tequila.jp' => array ( 'soba.tokyo.tequila.jp' => array(
// db config selection // db config selection
'db_host' => 'test', 'db_host' => 'test',
// other db connections // other db connections

View File

@@ -172,14 +172,14 @@ if (file_exists(BASE.CONFIGS.'config.host.php')) {
require BASE.CONFIGS.'config.host.php'; require BASE.CONFIGS.'config.host.php';
} }
if (!isset($SITE_CONFIG)) { if (!isset($SITE_CONFIG)) {
$SITE_CONFIG = array (); $SITE_CONFIG = array();
} }
/************* DB ACCESS *****************/ /************* DB ACCESS *****************/
if (file_exists(BASE.CONFIGS.'config.db.php')) { if (file_exists(BASE.CONFIGS.'config.db.php')) {
require BASE.CONFIGS.'config.db.php'; require BASE.CONFIGS.'config.db.php';
} }
if (!isset($DB_CONFIG)) { if (!isset($DB_CONFIG)) {
$DB_CONFIG = array (); $DB_CONFIG = array();
} }
/************* OTHER PATHS *****************/ /************* OTHER PATHS *****************/
if (file_exists(BASE.CONFIGS.'config.path.php')) { if (file_exists(BASE.CONFIGS.'config.path.php')) {
@@ -219,7 +219,7 @@ if ((array_key_exists('HTTPS', $_SERVER) && !empty($_SERVER['HTTPS']) && $_SERVE
} }
// define the db config set name, the db config and the db schema // define the db config set name, the db config and the db schema
DEFINE('DB_CONFIG_NAME', $SITE_CONFIG[$HOST_NAME]['db_host']); DEFINE('DB_CONFIG_NAME', $SITE_CONFIG[$HOST_NAME]['db_host']);
DEFINE('DB_CONFIG', isset($DB_CONFIG[DB_CONFIG_NAME]) ? $DB_CONFIG[DB_CONFIG_NAME] : array ()); DEFINE('DB_CONFIG', isset($DB_CONFIG[DB_CONFIG_NAME]) ? $DB_CONFIG[DB_CONFIG_NAME] : array());
// DEFINE('DB_CONFIG_TARGET', SITE_CONFIG[$HOST_NAME]['db_host_target']); // DEFINE('DB_CONFIG_TARGET', SITE_CONFIG[$HOST_NAME]['db_host_target']);
// DEFINE('DB_CONFIG_OTHER', SITE_CONFIG[$HOST_NAME]['db_host_other']); // DEFINE('DB_CONFIG_OTHER', SITE_CONFIG[$HOST_NAME]['db_host_other']);
// override for login and global schemas // override for login and global schemas
@@ -253,7 +253,7 @@ DEFINE('JAVASCRIPT', 'frontend.js');
// DEFINE('SOME_ID', <SOME VALUE>); // DEFINE('SOME_ID', <SOME VALUE>);
/************* CONVERT *******************/ /************* CONVERT *******************/
$paths = array ( $paths = array(
'/bin', '/bin',
'/usr/bin', '/usr/bin',
'/usr/local/bin' '/usr/local/bin'

View File

@@ -10,8 +10,8 @@
// File and Folder paths // File and Folder paths
// ID is TARGET (first array element) // ID is TARGET (first array element)
/*$PATHS = array ( /*$PATHS = array(
'test' => array ( 'test' => array(
'csv_path' => '', 'csv_path' => '',
'perl_bin' => '', 'perl_bin' => '',
'other_url' => '', 'other_url' => '',

View File

@@ -22,7 +22,7 @@ if (!defined('DS')) {
exit('Base config unloadable'); exit('Base config unloadable');
} }
// find trigger name "admin/" or "frontend/" in the getcwd() folder // find trigger name "admin/" or "frontend/" in the getcwd() folder
foreach (array ('admin', 'frontend') as $folder) { foreach (array('admin', 'frontend') as $folder) {
if (strstr(getcwd(), DS.$folder)) { if (strstr(getcwd(), DS.$folder)) {
define('CONTENT_PATH', $folder.DS); define('CONTENT_PATH', $folder.DS);
break; break;

View File

@@ -7,7 +7,7 @@
* HISTORY: * HISTORY:
*********************************************************************/ *********************************************************************/
$day_short = array ( $day_short = array(
1 => 'Mon', 1 => 'Mon',
2 => 'Tue', 2 => 'Tue',
3 => 'Wed', 3 => 'Wed',
@@ -17,7 +17,7 @@ $day_short = array (
7 => 'Sun' 7 => 'Sun'
); );
$day_long = array ( $day_long = array(
1 => 'Monday', 1 => 'Monday',
2 => 'Tuesday', 2 => 'Tuesday',
3 => 'Wednesday', 3 => 'Wednesday',
@@ -28,7 +28,7 @@ $day_long = array (
); );
// months // months
$month_long = array ( $month_long = array(
1 => 'January', 1 => 'January',
2 => 'February', 2 => 'February',
3 => 'March', 3 => 'March',
@@ -43,7 +43,7 @@ $month_long = array (
12 => 'December' 12 => 'December'
); );
$month_short = array ( $month_short = array(
1 => 'Jan', 1 => 'Jan',
2 => 'Feb', 2 => 'Feb',
3 => 'Mar', 3 => 'Mar',

View File

@@ -14,7 +14,7 @@ if ($DEBUG_ALL && $ENABLE_ERROR_HANDLING) {
} }
// predefine vars // predefine vars
$lang = ''; $lang = '';
$messages = array (); $messages = array();
// import all POST vars // import all POST vars
extract($_POST, EXTR_SKIP); extract($_POST, EXTR_SKIP);
//------------------------------ variable init end //------------------------------ variable init end
@@ -70,7 +70,7 @@ ob_end_flush();
//------------------------------ logging start //------------------------------ logging start
// log backend data // log backend data
// data part creation // data part creation
$data = array ( $data = array(
'_SESSION' => $_SESSION, '_SESSION' => $_SESSION,
'_GET' => $_GET, '_GET' => $_GET,
'_POST' => $_POST, '_POST' => $_POST,

View File

@@ -94,13 +94,13 @@ if ($form->my_page_name == 'edit_order') {
// order name is _always_ order_number for the edit interface // order name is _always_ order_number for the edit interface
// follwing arrays do exist here: // follwing arrays do exist here:
// $position ... has the positions of the array (0..max), cause in a <select> // $position ... has the positions of the array(0..max), cause in a <select>
// I can't put an number into the array field, in this array, // I can't put an number into the array field, in this array,
// there are the POSITION stored, that should CHANGE there order (up/down) // there are the POSITION stored, that should CHANGE there order (up/down)
// $row_data_id ... has ALL ids from the sorting part // $row_data_id ... has ALL ids from the sorting part
// $row_data_order ... has ALL order positions from the soirting part // $row_data_order ... has ALL order positions from the soirting part
if (!isset($position)) { if (!isset($position)) {
$position = array (); $position = array();
} }
$row_data_id = $_POST['row_data_id']; $row_data_id = $_POST['row_data_id'];
$original_id = $row_data_id; $original_id = $row_data_id;
@@ -154,7 +154,7 @@ if ($form->my_page_name == 'edit_order') {
$q .= "ORDER BY order_number"; $q .= "ORDER BY order_number";
while ($res = $form->dbReturn($q)) { while ($res = $form->dbReturn($q)) {
$row_data[] = array ( $row_data[] = array(
"id" => $res[$table_name."_id"], "id" => $res[$table_name."_id"],
"name" => $res["name"], "name" => $res["name"],
"order" => $res["order_number"] "order" => $res["order_number"]
@@ -164,22 +164,22 @@ if ($form->my_page_name == 'edit_order') {
// html title // html title
$HEADER['HTML_TITLE'] = $form->l->__('Edit Order'); $HEADER['HTML_TITLE'] = $form->l->__('Edit Order');
$messages = array (); $messages = array();
// error msg // error msg
if (isset($error)) { if (isset($error)) {
if (!isset($msg)) { if (!isset($msg)) {
$msg = array (); $msg = array();
} }
$messages[] = array ('msg' => $msg, 'class' => 'error', 'width' => '100%'); $messages[] = array('msg' => $msg, 'class' => 'error', 'width' => '100%');
} }
$DATA['form_error_msg'] = $messages; $DATA['form_error_msg'] = $messages;
// all the row data // all the row data
$options_id = array (); $options_id = array();
$options_name = array (); $options_name = array();
$options_selected = array (); $options_selected = array();
if (!isset($row_data) || !is_array($row_data)) { if (!isset($row_data) || !is_array($row_data)) {
$row_data = array (); $row_data = array();
} }
for ($i = 0; $i < count($row_data); $i ++) { for ($i = 0; $i < count($row_data); $i ++) {
$options_id[] = $i; $options_id[] = $i;
@@ -197,8 +197,8 @@ if ($form->my_page_name == 'edit_order') {
$DATA['options_selected'] = $options_selected; $DATA['options_selected'] = $options_selected;
// hidden list for the data (id, order number) // hidden list for the data (id, order number)
$row_data_id = array (); $row_data_id = array();
$row_data_order = array (); $row_data_order = array();
for ($i = 0; $i < count($row_data); $i++) { for ($i = 0; $i < count($row_data); $i++) {
$row_data_id[] = $row_data[$i]['id']; $row_data_id[] = $row_data[$i]['id'];
$row_data_order[] = $row_data[$i]['order']; $row_data_order[] = $row_data[$i]['order'];
@@ -247,9 +247,9 @@ if ($form->my_page_name == 'edit_order') {
// build nav from $PAGES ... // build nav from $PAGES ...
if (!isset($PAGES) || !is_array($PAGES)) { if (!isset($PAGES) || !is_array($PAGES)) {
$PAGES = array (); $PAGES = array();
} }
$menuarray = array (); $menuarray = array();
foreach ($PAGES as $PAGE_CUID => $PAGE_DATA) { foreach ($PAGES as $PAGE_CUID => $PAGE_DATA) {
if ($PAGE_DATA['menu'] && $PAGE_DATA['online']) { if ($PAGE_DATA['menu'] && $PAGE_DATA['online']) {
$menuarray[] = $PAGE_DATA; $menuarray[] = $PAGE_DATA;
@@ -268,7 +268,7 @@ if ($form->my_page_name == 'edit_order') {
} }
$position = 0; $position = 0;
$menu_data = array (); $menu_data = array();
for ($i = 1; $i <= count($menuarray); $i ++) { for ($i = 1; $i <= count($menuarray); $i ++) {
// do that for new array // do that for new array
$j = $i - 1; $j = $i - 1;
@@ -319,7 +319,7 @@ if ($form->my_page_name == 'edit_order') {
$DATA['form_my_page_name'] = $form->my_page_name; $DATA['form_my_page_name'] = $form->my_page_name;
$DATA['filename_exist'] = 0; $DATA['filename_exist'] = 0;
$DATA['drop_down_input'] = 0; $DATA['drop_down_input'] = 0;
$elements = array (); $elements = array();
// depending on the "getPageName()" I show different stuff // depending on the "getPageName()" I show different stuff
switch ($form->my_page_name) { switch ($form->my_page_name) {
case 'edit_users': case 'edit_users':

View File

@@ -1,25 +1,25 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
$edit_access = array ( $edit_access = array(
'table_array' => array ( 'table_array' => array(
'edit_access_id' => array ( 'edit_access_id' => array(
'value' => isset($GLOBALS['edit_access_id']) ? $GLOBALS['edit_access_id'] : '', 'value' => isset($GLOBALS['edit_access_id']) ? $GLOBALS['edit_access_id'] : '',
'type' => 'hidden', 'type' => 'hidden',
'pk' => 1 'pk' => 1
), ),
'name' => array ( 'name' => array(
'value' => isset($GLOBALS['name']) ? $GLOBALS['name'] : '', 'value' => isset($GLOBALS['name']) ? $GLOBALS['name'] : '',
'output_name' => 'Access Group Name', 'output_name' => 'Access Group Name',
'mandatory' => 1, 'mandatory' => 1,
'type' => 'text', 'type' => 'text',
'error_check' => 'alphanumericspace|unique' 'error_check' => 'alphanumericspace|unique'
), ),
'description' => array ( 'description' => array(
'value' => isset($GLOBALS['description']) ? $GLOBALS['description'] : '', 'value' => isset($GLOBALS['description']) ? $GLOBALS['description'] : '',
'output_name' => 'Description', 'output_name' => 'Description',
'type' => 'textarea' 'type' => 'textarea'
), ),
'color' => array ( 'color' => array(
'value' => isset($GLOBALS['color']) ? $GLOBALS['color'] : '', 'value' => isset($GLOBALS['color']) ? $GLOBALS['color'] : '',
'output_name' => 'Color', 'output_name' => 'Color',
'mandatory' => 0, 'mandatory' => 0,
@@ -30,27 +30,27 @@ $edit_access = array (
'error_regex' => "/[\dA-Fa-f]{6}/", 'error_regex' => "/[\dA-Fa-f]{6}/",
'error_example' => 'F6A544' 'error_example' => 'F6A544'
), ),
'enabled' => array ( 'enabled' => array(
'value' => isset($GLOBALS['enabled']) ? $GLOBALS['enabled'] : 0, 'value' => isset($GLOBALS['enabled']) ? $GLOBALS['enabled'] : 0,
'output_name' => 'Enabled', 'output_name' => 'Enabled',
'type' => 'binary', 'type' => 'binary',
'int' => 1, // OR 'bool' => 1 'int' => 1, // OR 'bool' => 1
'element_list' => array ( 'element_list' => array(
'1' => 'Yes', '1' => 'Yes',
'0' => 'No' '0' => 'No'
) )
), ),
'protected' => array ( 'protected' => array(
'value' => isset($GLOBALS['protected']) ? $GLOBALS['protected'] : 0, 'value' => isset($GLOBALS['protected']) ? $GLOBALS['protected'] : 0,
'output_name' => 'Protected', 'output_name' => 'Protected',
'type' => 'binary', 'type' => 'binary',
'int' => 1, 'int' => 1,
'element_list' => array ( 'element_list' => array(
'1' => 'Yes', '1' => 'Yes',
'0' => 'No' '0' => 'No'
) )
), ),
'additional_acl' => array ( 'additional_acl' => array(
'value' => isset($GLOBALS['additional_acl']) ? $GLOBALS['additional_acl'] : '', 'value' => isset($GLOBALS['additional_acl']) ? $GLOBALS['additional_acl'] : '',
'output_name' => 'Additional ACL (as JSON)', 'output_name' => 'Additional ACL (as JSON)',
'type' => 'textarea', 'type' => 'textarea',
@@ -61,41 +61,41 @@ $edit_access = array (
), ),
'table_name' => 'edit_access', 'table_name' => 'edit_access',
"load_query" => "SELECT edit_access_id, name FROM edit_access ORDER BY name", "load_query" => "SELECT edit_access_id, name FROM edit_access ORDER BY name",
'show_fields' => array ( 'show_fields' => array(
array ( array(
'name' => 'name' 'name' => 'name'
) )
), ),
'element_list' => array ( 'element_list' => array(
'edit_access_data' => array ( 'edit_access_data' => array(
'output_name' => 'Edit Access Data', 'output_name' => 'Edit Access Data',
'delete_name' => 'remove_edit_access_data', 'delete_name' => 'remove_edit_access_data',
// 'type' => 'reference_data', # is not a sub table read and connect, but only a sub table with data // 'type' => 'reference_data', # is not a sub table read and connect, but only a sub table with data
'max_empty' => 5, # maxium visible if no data is set, if filled add this number to visible 'max_empty' => 5, # maxium visible if no data is set, if filled add this number to visible
'prefix' => 'ead', 'prefix' => 'ead',
'elements' => array ( 'elements' => array(
'name' => array ( 'name' => array(
'type' => 'text', 'type' => 'text',
'error_check' => 'alphanumeric|unique', 'error_check' => 'alphanumeric|unique',
'output_name' => 'Name', 'output_name' => 'Name',
'mandatory' => 1 'mandatory' => 1
), ),
'value' => array ( 'value' => array(
'type' => 'text', 'type' => 'text',
'output_name' => 'Value' 'output_name' => 'Value'
), ),
'enabled' => array ( 'enabled' => array(
'type' => 'checkbox', 'type' => 'checkbox',
'output_name' => 'Activate', 'output_name' => 'Activate',
'int' => 1, 'int' => 1,
'element_list' => array(1) 'element_list' => array(1)
), ),
/*'edit_access_id' => array ( /*'edit_access_id' => array(
'int' => 1, 'int' => 1,
'type' => 'hidden', 'type' => 'hidden',
'fk_id' => 1 # reference main key from master table above 'fk_id' => 1 # reference main key from master table above
),*/ ),*/
'edit_access_data_id' => array ( 'edit_access_data_id' => array(
'type' => 'hidden', 'type' => 'hidden',
'int' => 1, 'int' => 1,
'pk_id' => 1 'pk_id' => 1

View File

@@ -1,29 +1,29 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
$edit_groups = array ( $edit_groups = array(
'table_array' => array ( 'table_array' => array(
'edit_group_id' => array ( 'edit_group_id' => array(
'value' => isset($GLOBALS['edit_group_id']) ? $GLOBALS['edit_group_id'] : '', 'value' => isset($GLOBALS['edit_group_id']) ? $GLOBALS['edit_group_id'] : '',
'pk' => 1, 'pk' => 1,
'type' => 'hidden' 'type' => 'hidden'
), ),
'enabled' => array ( 'enabled' => array(
'value' => isset($GLOBALS['enabled']) ? $GLOBALS['enabled'] : '', 'value' => isset($GLOBALS['enabled']) ? $GLOBALS['enabled'] : '',
'output_name' => 'Enabled', 'output_name' => 'Enabled',
'int' => 1, 'int' => 1,
'type' => 'binary', 'type' => 'binary',
'element_list' => array ( 'element_list' => array(
'1' => 'Yes', '1' => 'Yes',
'0' => 'No' '0' => 'No'
) )
), ),
'name' => array ( 'name' => array(
'value' => isset($GLOBALS['name']) ? $GLOBALS['name'] : '', 'value' => isset($GLOBALS['name']) ? $GLOBALS['name'] : '',
'output_name' => 'Group Name', 'output_name' => 'Group Name',
'type' => 'text', 'type' => 'text',
'mandatory' => 1 'mandatory' => 1
), ),
'edit_access_right_id' => array ( 'edit_access_right_id' => array(
'value' => isset($GLOBALS['edit_access_right_id']) ? $GLOBALS['edit_access_right_id'] : '', 'value' => isset($GLOBALS['edit_access_right_id']) ? $GLOBALS['edit_access_right_id'] : '',
'output_name' => 'Group Level', 'output_name' => 'Group Level',
'mandatory' => 1, 'mandatory' => 1,
@@ -31,14 +31,14 @@ $edit_groups = array (
'type' => 'drop_down_db', 'type' => 'drop_down_db',
'query' => "SELECT edit_access_right_id, name FROM edit_access_right ORDER BY level" 'query' => "SELECT edit_access_right_id, name FROM edit_access_right ORDER BY level"
), ),
'edit_scheme_id' => array ( 'edit_scheme_id' => array(
'value' => isset($GLOBALS['edit_scheme_id']) ? $GLOBALS['edit_scheme_id'] : '', 'value' => isset($GLOBALS['edit_scheme_id']) ? $GLOBALS['edit_scheme_id'] : '',
'output_name' => 'Group Scheme', 'output_name' => 'Group Scheme',
'int_null' => 1, 'int_null' => 1,
'type' => 'drop_down_db', 'type' => 'drop_down_db',
'query' => "SELECT edit_scheme_id, name FROM edit_scheme WHERE enabled = 1 ORDER BY name" 'query' => "SELECT edit_scheme_id, name FROM edit_scheme WHERE enabled = 1 ORDER BY name"
), ),
'additional_acl' => array ( 'additional_acl' => array(
'value' => isset($GLOBALS['additional_acl']) ? $GLOBALS['additional_acl'] : '', 'value' => isset($GLOBALS['additional_acl']) ? $GLOBALS['additional_acl'] : '',
'output_name' => 'Additional ACL (as JSON)', 'output_name' => 'Additional ACL (as JSON)',
'type' => 'textarea', 'type' => 'textarea',
@@ -49,54 +49,54 @@ $edit_groups = array (
), ),
'load_query' => "SELECT edit_group_id, name, enabled FROM edit_group ORDER BY name", 'load_query' => "SELECT edit_group_id, name, enabled FROM edit_group ORDER BY name",
'table_name' => 'edit_group', 'table_name' => 'edit_group',
'show_fields' => array ( 'show_fields' => array(
array ( array(
'name' => 'name' 'name' => 'name'
), ),
array ( array(
'name' => 'enabled', 'name' => 'enabled',
'binary' => array ('Yes', 'No'), 'binary' => array('Yes', 'No'),
'before_value' => 'Enabled: ' 'before_value' => 'Enabled: '
) )
), ),
'element_list' => array ( 'element_list' => array(
'edit_page_access' => array ( 'edit_page_access' => array(
'output_name' => 'Pages', 'output_name' => 'Pages',
'mandatory' => 1, 'mandatory' => 1,
'delete' => 0, // set then reference entries are deleted, else the 'enable' flag is only set 'delete' => 0, // set then reference entries are deleted, else the 'enable' flag is only set
'enable_name' => 'enable_page_access', 'enable_name' => 'enable_page_access',
'prefix' => 'epa', 'prefix' => 'epa',
'read_data' => array ( 'read_data' => array(
'table_name' => 'edit_page', 'table_name' => 'edit_page',
'pk_id' => 'edit_page_id', 'pk_id' => 'edit_page_id',
'name' => 'name', 'name' => 'name',
'order' => 'order_number' 'order' => 'order_number'
), ),
'elements' => array ( 'elements' => array(
'edit_page_access_id' => array ( 'edit_page_access_id' => array(
'type' => 'hidden', 'type' => 'hidden',
'int' => 1, 'int' => 1,
'pk_id' => 1 'pk_id' => 1
), ),
'enabled' => array ( 'enabled' => array(
'type' => 'checkbox', 'type' => 'checkbox',
'output_name' => 'Activate', 'output_name' => 'Activate',
'int' => 1, 'int' => 1,
'element_list' => array(1) 'element_list' => array(1)
), ),
'edit_access_right_id' => array ( 'edit_access_right_id' => array(
'type' => 'drop_down_db', 'type' => 'drop_down_db',
'output_name' => 'Access Level', 'output_name' => 'Access Level',
'int' => 1, 'int' => 1,
'preset' => 1, // first of the select 'preset' => 1, // first of the select
'query' => "SELECT edit_access_right_id, name FROM edit_access_right ORDER BY level" 'query' => "SELECT edit_access_right_id, name FROM edit_access_right ORDER BY level"
), ),
'edit_page_id' => array ( 'edit_page_id' => array(
'int' => 1, 'int' => 1,
'type' => 'hidden' 'type' => 'hidden'
) )
/*, /*,
'edit_default' => array ( 'edit_default' => array(
'output_name' => 'Default', 'output_name' => 'Default',
'type' => 'radio', 'type' => 'radio',
'mandatory' => 1 'mandatory' => 1

View File

@@ -1,13 +1,13 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
$edit_languages=array ( $edit_languages=array(
'table_array' => array ( 'table_array' => array(
'edit_language_id' => array ( 'edit_language_id' => array(
'value' => isset($GLOBALS['edit_language_id']) ? $GLOBALS['edit_language_id'] : '', 'value' => isset($GLOBALS['edit_language_id']) ? $GLOBALS['edit_language_id'] : '',
'type' => 'hidden', 'type' => 'hidden',
'pk' => 1 'pk' => 1
), ),
'short_name' => array ( 'short_name' => array(
'value' => isset($GLOBALS['short_name']) ? $GLOBALS['short_name'] : '', 'value' => isset($GLOBALS['short_name']) ? $GLOBALS['short_name'] : '',
'output_name' => 'Language (short)', 'output_name' => 'Language (short)',
'mandatory' => 1, 'mandatory' => 1,
@@ -15,58 +15,58 @@ $edit_languages=array (
'size' => 2, 'size' => 2,
'length' => 2 'length' => 2
), ),
'long_name' => array ( 'long_name' => array(
'value' => isset($GLOBALS['long_name']) ? $GLOBALS['long_name'] : '', 'value' => isset($GLOBALS['long_name']) ? $GLOBALS['long_name'] : '',
'output_name' => 'Language (long)', 'output_name' => 'Language (long)',
'mandatory' => 1, 'mandatory' => 1,
'type' => 'text', 'type' => 'text',
'size' => 40 'size' => 40
), ),
'iso_name' => array ( 'iso_name' => array(
'value' => isset($GLOBALS['iso_name']) ? $GLOBALS['iso_name'] : '', 'value' => isset($GLOBALS['iso_name']) ? $GLOBALS['iso_name'] : '',
'output_name' => 'ISO Code', 'output_name' => 'ISO Code',
'mandatory' => 1, 'mandatory' => 1,
'type' => 'text' 'type' => 'text'
), ),
'order_number' => array ( 'order_number' => array(
'value' => isset($GLOBALS['order_number']) ? $GLOBALS['order_number'] : '', 'value' => isset($GLOBALS['order_number']) ? $GLOBALS['order_number'] : '',
'int' => 1, 'int' => 1,
'order' => 1 'order' => 1
), ),
'enabled' => array ( 'enabled' => array(
'value' => isset($GLOBALS['enabled']) ? $GLOBALS['enabled'] : '', 'value' => isset($GLOBALS['enabled']) ? $GLOBALS['enabled'] : '',
'output_name' => 'Enabled', 'output_name' => 'Enabled',
'int' => 1, 'int' => 1,
'type' => 'binary', 'type' => 'binary',
'element_list' => array ( 'element_list' => array(
'1' => 'Yes', '1' => 'Yes',
'0' => 'No' '0' => 'No'
) )
), ),
'lang_default' => array ( 'lang_default' => array(
'value' => isset($GLOBALS['lang_default']) ? $GLOBALS['lang_default'] : '', 'value' => isset($GLOBALS['lang_default']) ? $GLOBALS['lang_default'] : '',
'output_name' => 'Default Language', 'output_name' => 'Default Language',
'int' => 1, 'int' => 1,
'type' => 'binary', 'type' => 'binary',
'element_list' => array ( 'element_list' => array(
'1' => 'Yes', '1' => 'Yes',
'0' => 'No' '0' => 'No'
) )
) )
), ),
'load_query' => "SELECT edit_language_id, long_name, iso_name, enabled FROM edit_language ORDER BY long_name", 'load_query' => "SELECT edit_language_id, long_name, iso_name, enabled FROM edit_language ORDER BY long_name",
'show_fields' => array ( 'show_fields' => array(
array ( array(
'name' => 'long_name' 'name' => 'long_name'
), ),
array ( array(
'name' => 'iso_name', 'name' => 'iso_name',
'before_value' => 'ISO: ' 'before_value' => 'ISO: '
), ),
array ( array(
'name' => 'enabled', 'name' => 'enabled',
'before_value' => 'Enabled: ', 'before_value' => 'Enabled: ',
'binary' => array ('Yes','No') 'binary' => array('Yes','No')
) )
), ),
'table_name' => 'edit_language' 'table_name' => 'edit_language'

View File

@@ -1,26 +1,26 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
$edit_menu_group = array ( $edit_menu_group = array(
'table_array' => array ( 'table_array' => array(
'edit_menu_group_id' => array ( 'edit_menu_group_id' => array(
'value' => isset($GLOBALS['edit_menu_group_id']) ? $GLOBALS['edit_menu_group_id'] : '', 'value' => isset($GLOBALS['edit_menu_group_id']) ? $GLOBALS['edit_menu_group_id'] : '',
'type' => 'hidden', 'type' => 'hidden',
'pk' => 1 'pk' => 1
), ),
'name' => array ( 'name' => array(
'value' => isset($GLOBALS['name']) ? $GLOBALS['name'] : '', 'value' => isset($GLOBALS['name']) ? $GLOBALS['name'] : '',
'output_name' => 'Group name', 'output_name' => 'Group name',
'mandatory' => 1, 'mandatory' => 1,
'type' => 'text' 'type' => 'text'
), ),
'flag' => array ( 'flag' => array(
'value' => isset($GLOBALS['flag']) ? $GLOBALS['flag'] : '', 'value' => isset($GLOBALS['flag']) ? $GLOBALS['flag'] : '',
'output_name' => 'Flag', 'output_name' => 'Flag',
'mandatory' => 1, 'mandatory' => 1,
'type' => 'text', 'type' => 'text',
'error_check' => 'alphanumeric|unique' 'error_check' => 'alphanumeric|unique'
), ),
'order_number' => array ( 'order_number' => array(
'value' => isset($GLOBALS['order_number']) ? $GLOBALS['order_number'] : '', 'value' => isset($GLOBALS['order_number']) ? $GLOBALS['order_number'] : '',
'output_name' => 'Group order', 'output_name' => 'Group order',
'type' => 'order', 'type' => 'order',
@@ -30,8 +30,8 @@ $edit_menu_group = array (
), ),
'table_name' => 'edit_menu_group', 'table_name' => 'edit_menu_group',
'load_query' => "SELECT edit_menu_group_id, name FROM edit_menu_group ORDER BY name", 'load_query' => "SELECT edit_menu_group_id, name FROM edit_menu_group ORDER BY name",
'show_fields' => array ( 'show_fields' => array(
array ( array(
'name' => 'name' 'name' => 'name'
) )
) )

View File

@@ -1,13 +1,13 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
$edit_pages = array ( $edit_pages = array(
'table_array' => array ( 'table_array' => array(
'edit_page_id' => array ( 'edit_page_id' => array(
'value' => isset($GLOBALS['edit_page_id']) ? $GLOBALS['edit_page_id'] : '', 'value' => isset($GLOBALS['edit_page_id']) ? $GLOBALS['edit_page_id'] : '',
'type' => 'hidden', 'type' => 'hidden',
'pk' => 1 'pk' => 1
), ),
'filename' => array ( 'filename' => array(
'value' => isset($GLOBALS['filename']) ? $GLOBALS['filename'] : '', 'value' => isset($GLOBALS['filename']) ? $GLOBALS['filename'] : '',
'output_name' => 'Add File ...', 'output_name' => 'Add File ...',
'mandatory' => 1, 'mandatory' => 1,
@@ -17,24 +17,24 @@ $edit_pages = array (
"LEFT JOIN edit_page ep ON temp_files.filename = ep.filename ". "LEFT JOIN edit_page ep ON temp_files.filename = ep.filename ".
"WHERE ep.filename IS NULL" "WHERE ep.filename IS NULL"
), ),
'name' => array ( 'name' => array(
'value' => isset($GLOBALS['name']) ? $GLOBALS['name'] : '', 'value' => isset($GLOBALS['name']) ? $GLOBALS['name'] : '',
'output_name' => 'Page name', 'output_name' => 'Page name',
'mandatory' => 1, 'mandatory' => 1,
'type' => 'text' 'type' => 'text'
), ),
'order_number' => array ( 'order_number' => array(
'value' => isset($GLOBALS['order_number']) ? $GLOBALS['order_number'] : '', 'value' => isset($GLOBALS['order_number']) ? $GLOBALS['order_number'] : '',
'output_name' => 'Page order', 'output_name' => 'Page order',
'type' => 'order', 'type' => 'order',
'int' => 1, 'int' => 1,
'order' => 1 'order' => 1
), ),
/* 'flag' => array ( /* 'flag' => array(
'value' => isset($GLOBALS['flag']) ? $GLOBALS['flag'] : '', 'value' => isset($GLOBALS['flag']) ? $GLOBALS['flag'] : '',
'output_name' => 'Page Flag', 'output_name' => 'Page Flag',
'type' => 'drop_down_array', 'type' => 'drop_down_array',
'query' => array ( 'query' => array(
'0' => '0', '0' => '0',
'1' => '1', '1' => '1',
'2' => '2', '2' => '2',
@@ -43,37 +43,37 @@ $edit_pages = array (
'5' => '5' '5' => '5'
) )
),*/ ),*/
'online' => array ( 'online' => array(
'value' => isset($GLOBALS['online']) ? $GLOBALS['online'] : '', 'value' => isset($GLOBALS['online']) ? $GLOBALS['online'] : '',
'output_name' => 'Online', 'output_name' => 'Online',
'int' => 1, 'int' => 1,
'type' => 'binary', 'type' => 'binary',
'element_list' => array ( 'element_list' => array(
'1' => 'Yes', '1' => 'Yes',
'0' => 'No' '0' => 'No'
) )
), ),
'menu' => array ( 'menu' => array(
'value' => isset($GLOBALS['menu']) ? $GLOBALS['menu'] : '', 'value' => isset($GLOBALS['menu']) ? $GLOBALS['menu'] : '',
'output_name' => 'Menu', 'output_name' => 'Menu',
'int' => 1, 'int' => 1,
'type' => 'binary', 'type' => 'binary',
'element_list' => array ( 'element_list' => array(
'1' => 'Yes', '1' => 'Yes',
'0' => 'No' '0' => 'No'
) )
), ),
'popup' => array ( 'popup' => array(
'value' => isset($GLOBALS['popup']) ? $GLOBALS['popup'] : '', 'value' => isset($GLOBALS['popup']) ? $GLOBALS['popup'] : '',
'output_name' => 'Popup', 'output_name' => 'Popup',
'int' => 1, 'int' => 1,
'type' => 'binary', 'type' => 'binary',
'element_list' => array ( 'element_list' => array(
'1' => 'Yes', '1' => 'Yes',
'0' => 'No' '0' => 'No'
) )
), ),
'popup_x' => array ( 'popup_x' => array(
'value' => isset($GLOBALS['popup_x']) ? $GLOBALS['popup_x'] : '', 'value' => isset($GLOBALS['popup_x']) ? $GLOBALS['popup_x'] : '',
'output_name' => 'Popup Width', 'output_name' => 'Popup Width',
'int_null' => 1, 'int_null' => 1,
@@ -81,7 +81,7 @@ $edit_pages = array (
'size' => 4, 'size' => 4,
'length' => 4 'length' => 4
), ),
'popup_y' => array ( 'popup_y' => array(
'value' => isset($GLOBALS['popup_y']) ? $GLOBALS['popup_y'] : '', 'value' => isset($GLOBALS['popup_y']) ? $GLOBALS['popup_y'] : '',
'output_name' => 'Popup Height', 'output_name' => 'Popup Height',
'int_null' => 1, 'int_null' => 1,
@@ -89,7 +89,7 @@ $edit_pages = array (
'size' => 4, 'size' => 4,
'length' => 4 'length' => 4
), ),
'content_alias_edit_page_id' => array ( 'content_alias_edit_page_id' => array(
'value' => isset($GLOBALS['content_alias_edit_page_id']) ? $GLOBALS['content_alias_edit_page_id'] : '', 'value' => isset($GLOBALS['content_alias_edit_page_id']) ? $GLOBALS['content_alias_edit_page_id'] : '',
'output_name' => 'Content Alias Source', 'output_name' => 'Content Alias Source',
'int_null' => 1, 'int_null' => 1,
@@ -109,32 +109,32 @@ $edit_pages = array (
), ),
'load_query' => "SELECT edit_page_id, filename, name, online, menu, popup FROM edit_page ORDER BY order_number", 'load_query' => "SELECT edit_page_id, filename, name, online, menu, popup FROM edit_page ORDER BY order_number",
'table_name' => 'edit_page', 'table_name' => 'edit_page',
'show_fields' => array ( 'show_fields' => array(
array ( array(
'name' => 'name' 'name' => 'name'
), ),
array ( array(
'name' => 'filename', 'name' => 'filename',
'before_value' => 'Filename: ' 'before_value' => 'Filename: '
), ),
array ( array(
'name' => 'online', 'name' => 'online',
'binary' => array ('Yes','No'), 'binary' => array('Yes','No'),
'before_value' => 'Online: ' 'before_value' => 'Online: '
), ),
array ( array(
'name' => 'menu', 'name' => 'menu',
'binary' => array ('Yes','No'), 'binary' => array('Yes','No'),
'before_value' => 'Menu: ' 'before_value' => 'Menu: '
), ),
array ( array(
'name' => 'popup', 'name' => 'popup',
'binary' => array ('Yes','No'), 'binary' => array('Yes','No'),
'before_value' => 'Popup: ' 'before_value' => 'Popup: '
) )
), ),
'reference_arrays' => array ( 'reference_arrays' => array(
'edit_visible_group' => array ( 'edit_visible_group' => array(
'table_name' => 'edit_page_visible_group', 'table_name' => 'edit_page_visible_group',
'other_table_pk' => 'edit_visible_group_id', 'other_table_pk' => 'edit_visible_group_id',
'output_name' => 'Visible Groups (access)', 'output_name' => 'Visible Groups (access)',
@@ -143,7 +143,7 @@ $edit_pages = array (
'selected' => isset($GLOBALS['edit_visible_group_id']) ? $GLOBALS['edit_visible_group_id'] : '', 'selected' => isset($GLOBALS['edit_visible_group_id']) ? $GLOBALS['edit_visible_group_id'] : '',
'query' => "SELECT edit_visible_group_id, 'Name: ' || name || ', ' || 'Flag: ' || flag FROM edit_visible_group ORDER BY name" 'query' => "SELECT edit_visible_group_id, 'Name: ' || name || ', ' || 'Flag: ' || flag FROM edit_visible_group ORDER BY name"
), ),
'edit_menu_group' => array ( 'edit_menu_group' => array(
'table_name' => 'edit_page_menu_group', 'table_name' => 'edit_page_menu_group',
'other_table_pk' => 'edit_menu_group_id', 'other_table_pk' => 'edit_menu_group_id',
'output_name' => 'Menu Groups (grouping)', 'output_name' => 'Menu Groups (grouping)',
@@ -154,77 +154,77 @@ $edit_pages = array (
) )
), ),
'element_list' => array ( 'element_list' => array(
'edit_query_string' => array ( 'edit_query_string' => array(
'output_name' => 'Query Strings', 'output_name' => 'Query Strings',
'delete_name' => 'remove_query_string', 'delete_name' => 'remove_query_string',
'prefix' => 'eqs', 'prefix' => 'eqs',
'elements' => array ( 'elements' => array(
'name' => array ( 'name' => array(
'output_name' => 'Name', 'output_name' => 'Name',
'type' => 'text', 'type' => 'text',
'error_check' => 'unique|alphanumeric', 'error_check' => 'unique|alphanumeric',
'mandatory' => 1 'mandatory' => 1
), ),
'value' => array ( 'value' => array(
'output_name' => 'Value', 'output_name' => 'Value',
'type' => 'text' 'type' => 'text'
), ),
'enabled' => array ( 'enabled' => array(
'output_name' => 'Enabled', 'output_name' => 'Enabled',
'int' => 1, 'int' => 1,
'type' => 'checkbox', 'type' => 'checkbox',
'element_list' => array (1) 'element_list' => array(1)
), ),
'dynamic' => array ( 'dynamic' => array(
'output_name' => 'Dynamic', 'output_name' => 'Dynamic',
'int' => 1, 'int' => 1,
'type' => 'checkbox', 'type' => 'checkbox',
'element_list' => array (1) 'element_list' => array(1)
), ),
'edit_query_string_id' => array ( 'edit_query_string_id' => array(
'type' => 'hidden', 'type' => 'hidden',
'pk_id' => 1 'pk_id' => 1
) )
) // elements ) // elements
), // query_string element list ), // query_string element list
'edit_page_content' => array ( 'edit_page_content' => array(
'output_name' => 'Page Content', 'output_name' => 'Page Content',
'delete_name' => 'remove_page_content', 'delete_name' => 'remove_page_content',
'prefix' => 'epc', 'prefix' => 'epc',
'elements' => array ( 'elements' => array(
'name' => array ( 'name' => array(
'output_name' => 'Content', 'output_name' => 'Content',
'type' => 'text', 'type' => 'text',
'error_check' => 'alphanumeric', 'error_check' => 'alphanumeric',
'mandatory' => 1 'mandatory' => 1
), ),
'uid' => array ( 'uid' => array(
'output_name' => 'UID', 'output_name' => 'UID',
'type' => 'text', 'type' => 'text',
'error_check' => 'unique|alphanumeric', 'error_check' => 'unique|alphanumeric',
'mandatory' => 1 'mandatory' => 1
), ),
'order_number' => array ( 'order_number' => array(
'output_name' => 'Order', 'output_name' => 'Order',
'type' => 'text', 'type' => 'text',
'error_check' => 'int', 'error_check' => 'int',
'mandatory' => 1 'mandatory' => 1
), ),
'online' => array ( 'online' => array(
'output_name' => 'Online', 'output_name' => 'Online',
'int' => 1, 'int' => 1,
'type' => 'checkbox', 'type' => 'checkbox',
'element_list' => array (1) 'element_list' => array(1)
), ),
'edit_access_right_id' => array ( 'edit_access_right_id' => array(
'type' => 'drop_down_db', 'type' => 'drop_down_db',
'output_name' => 'Access Level', 'output_name' => 'Access Level',
'int' => 1, 'int' => 1,
'preset' => 1, // first of the select 'preset' => 1, // first of the select
'query' => "SELECT edit_access_right_id, name FROM edit_access_right ORDER BY level" 'query' => "SELECT edit_access_right_id, name FROM edit_access_right ORDER BY level"
), ),
'edit_page_content_id' => array ( 'edit_page_content_id' => array(
'type' => 'hidden', 'type' => 'hidden',
'pk_id' => 1 'pk_id' => 1
) )

View File

@@ -1,19 +1,19 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
$edit_schemes = array ( $edit_schemes = array(
'table_array' => array ( 'table_array' => array(
'edit_scheme_id' => array ( 'edit_scheme_id' => array(
'value' => isset($GLOBALS['edit_scheme_id']) ? $GLOBALS['edit_scheme_id'] : '', 'value' => isset($GLOBALS['edit_scheme_id']) ? $GLOBALS['edit_scheme_id'] : '',
'type' => 'hidden', 'type' => 'hidden',
'pk' => 1 'pk' => 1
), ),
'name' => array ( 'name' => array(
'value' => isset($GLOBALS['name']) ? $GLOBALS['name'] : '', 'value' => isset($GLOBALS['name']) ? $GLOBALS['name'] : '',
'output_name' => 'Scheme Name', 'output_name' => 'Scheme Name',
'mandatory' => 1, 'mandatory' => 1,
'type' => 'text' 'type' => 'text'
), ),
'header_color' => array ( 'header_color' => array(
'value' => isset($GLOBALS['header_color']) ? $GLOBALS['header_color'] : '', 'value' => isset($GLOBALS['header_color']) ? $GLOBALS['header_color'] : '',
'output_name' => 'Header Color', 'output_name' => 'Header Color',
'mandatory' => 1, 'mandatory' => 1,
@@ -24,17 +24,17 @@ $edit_schemes = array (
'error_regex' => '/[\dA-Fa-f]{6}/', 'error_regex' => '/[\dA-Fa-f]{6}/',
'error_example' => 'F6A544' 'error_example' => 'F6A544'
), ),
'enabled' => array ( 'enabled' => array(
'value' => isset($GLOBALS['enabled']) ? $GLOBALS['enabled'] : '', 'value' => isset($GLOBALS['enabled']) ? $GLOBALS['enabled'] : '',
'output_name' => 'Enabled', 'output_name' => 'Enabled',
'int' => 1, 'int' => 1,
'type' => 'binary', 'type' => 'binary',
'element_list' => array ( 'element_list' => array(
'1' => 'Yes', '1' => 'Yes',
'0' => 'No' '0' => 'No'
) )
), ),
'template' => array ( 'template' => array(
'value' => isset($GLOBALS['template']) ? $GLOBALS['template'] : '', 'value' => isset($GLOBALS['template']) ? $GLOBALS['template'] : '',
'output_name' => 'Template', 'output_name' => 'Template',
'type' => 'text' 'type' => 'text'
@@ -42,13 +42,13 @@ $edit_schemes = array (
), ),
'table_name' => 'edit_scheme', 'table_name' => 'edit_scheme',
'load_query' => "SELECT edit_scheme_id, name, enabled FROM edit_scheme ORDER BY name", 'load_query' => "SELECT edit_scheme_id, name, enabled FROM edit_scheme ORDER BY name",
'show_fields' => array ( 'show_fields' => array(
array ( array(
'name' => 'name' 'name' => 'name'
), ),
array ( array(
'name' => 'enabled', 'name' => 'enabled',
'binary' => array ('Yes', 'No'), 'binary' => array('Yes', 'No'),
'before_value' => 'Enabled: ' 'before_value' => 'Enabled: '
) )
) )

View File

@@ -1,29 +1,29 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
$edit_users = array ( $edit_users = array(
'table_array' => array ( 'table_array' => array(
'edit_user_id' => array ( 'edit_user_id' => array(
'value' => isset($GLOBALS['edit_user_id']) ? $GLOBALS['edit_user_id'] : '', 'value' => isset($GLOBALS['edit_user_id']) ? $GLOBALS['edit_user_id'] : '',
'type' => 'hidden', 'type' => 'hidden',
'pk' => 1, 'pk' => 1,
'int' => 1 'int' => 1
), ),
'username' => array ( 'username' => array(
'value' => isset($GLOBALS['username']) ? $GLOBALS['username'] : '', 'value' => isset($GLOBALS['username']) ? $GLOBALS['username'] : '',
'output_name' => 'Username', 'output_name' => 'Username',
'mandatory' => 1, 'mandatory' => 1,
'error_check' => 'unique|alphanumericextended', 'error_check' => 'unique|alphanumericextended',
'type' => 'text' 'type' => 'text'
), ),
'password' => array ( 'password' => array(
'value' => isset($GLOBALS['password']) ? $GLOBALS['password'] : '', 'value' => isset($GLOBALS['password']) ? $GLOBALS['password'] : '',
'HIDDEN_value' => isset($GLOBALS['HIDDEN_password']) ? $GLOBALS['HIDDEN_password'] : '', 'HIDDEN_value' => isset($GLOBALS['HIDDEN_password']) ? $GLOBALS['HIDDEN_password'] : '',
'CONFIRM_value' => isset($GLOBALS['CONFIRM_password']) ? $GLOBALS['CONFIRM_password'] : '', 'CONFIRM_value' => isset($GLOBALS['CONFIRM_password']) ? $GLOBALS['CONFIRM_password'] : '',
'output_name' => 'Password', 'output_name' => 'Password',
'mandatory' => 1, 'mandatory' => 1,
'type' => 'password', // later has to be password for encryption in database 'type' => 'password', // later has to be password for encryption in database
'update' => array ( // connected field updates, and update data 'update' => array( // connected field updates, and update data
'password_change_date' => array ( // db row to update 'password_change_date' => array( // db row to update
'type' => 'date', // type of field (int/text/date/etc) 'type' => 'date', // type of field (int/text/date/etc)
'value' => 'NOW()' // value [todo: complex reference 'value' => 'NOW()' // value [todo: complex reference
) )
@@ -31,7 +31,7 @@ $edit_users = array (
), ),
// password date when first insert and password is set, needs special field with connection to password // password date when first insert and password is set, needs special field with connection to password
// password reset force interval, if set, user needs to reset password after X time period // password reset force interval, if set, user needs to reset password after X time period
'password_change_interval' => array ( 'password_change_interval' => array(
'value' => isset($GLOBALS['password_change_interval']) ? $GLOBALS['password_change_interval'] : '', 'value' => isset($GLOBALS['password_change_interval']) ? $GLOBALS['password_change_interval'] : '',
'output_name' => 'Password change interval', 'output_name' => 'Password change interval',
'error_check' => 'intervalshort', // can be any date length format. n Y/M/D [not H/M/S], only one set, no combination 'error_check' => 'intervalshort', // can be any date length format. n Y/M/D [not H/M/S], only one set, no combination
@@ -40,83 +40,83 @@ $edit_users = array (
'size' => 5, // make it 5 chars long 'size' => 5, // make it 5 chars long
'length' => 5 'length' => 5
), ),
'enabled' => array ( 'enabled' => array(
'value' => isset($GLOBALS['enabled']) ? $GLOBALS['enabled'] : '', 'value' => isset($GLOBALS['enabled']) ? $GLOBALS['enabled'] : '',
'output_name' => 'Enabled', 'output_name' => 'Enabled',
'type' => 'binary', 'type' => 'binary',
'int' => 1, 'int' => 1,
'element_list' => array ( 'element_list' => array(
'1' => 'Yes', '1' => 'Yes',
'0' => 'No' '0' => 'No'
) )
), ),
'strict' => array ( 'strict' => array(
'value' => isset($GLOBALS['strict']) ? $GLOBALS['strict'] : '', 'value' => isset($GLOBALS['strict']) ? $GLOBALS['strict'] : '',
'output_name' => 'Strict (Lock after errors)', 'output_name' => 'Strict (Lock after errors)',
'type' => 'binary', 'type' => 'binary',
'int' => 1, 'int' => 1,
'element_list' => array ( 'element_list' => array(
'1' => 'Yes', '1' => 'Yes',
'0' => 'No' '0' => 'No'
) )
), ),
'locked' => array ( 'locked' => array(
'value' => isset($GLOBALS['locked']) ? $GLOBALS['locked'] : '', 'value' => isset($GLOBALS['locked']) ? $GLOBALS['locked'] : '',
'output_name' => 'Locked (auto set if strict with errors)', 'output_name' => 'Locked (auto set if strict with errors)',
'type' => 'binary', 'type' => 'binary',
'int' => 1, 'int' => 1,
'element_list' => array ( 'element_list' => array(
'1' => 'Yes', '1' => 'Yes',
'0' => 'No' '0' => 'No'
) )
), ),
'admin' => array ( 'admin' => array(
'value' => isset($GLOBALS['admin']) ? $GLOBALS['admin'] : '', 'value' => isset($GLOBALS['admin']) ? $GLOBALS['admin'] : '',
'output_name' => 'Admin', 'output_name' => 'Admin',
'type' => 'binary', 'type' => 'binary',
'int' => 1, 'int' => 1,
'element_list' => array ( 'element_list' => array(
'1' => 'Yes', '1' => 'Yes',
'0' => 'No' '0' => 'No'
) )
), ),
'debug' => array ( 'debug' => array(
'value' => isset($GLOBALS['debug']) ? $GLOBALS['debug'] : '', 'value' => isset($GLOBALS['debug']) ? $GLOBALS['debug'] : '',
'output_name' => 'Debug', 'output_name' => 'Debug',
'type' => 'binary', 'type' => 'binary',
'int' => 1, 'int' => 1,
'element_list' => array ( 'element_list' => array(
'1' => 'Yes', '1' => 'Yes',
'0' => 'No' '0' => 'No'
) )
), ),
'db_debug' => array ( 'db_debug' => array(
'value' => isset($GLOBALS['db_debug']) ? $GLOBALS['db_debug'] : '', 'value' => isset($GLOBALS['db_debug']) ? $GLOBALS['db_debug'] : '',
'output_name' => 'DB Debug', 'output_name' => 'DB Debug',
'type' => 'binary', 'type' => 'binary',
'int' => 1, 'int' => 1,
'element_list' => array ( 'element_list' => array(
'1' => 'Yes', '1' => 'Yes',
'0' => 'No' '0' => 'No'
) )
), ),
'email' => array ( 'email' => array(
'value' => isset($GLOBALS['email']) ? $GLOBALS['email'] : '', 'value' => isset($GLOBALS['email']) ? $GLOBALS['email'] : '',
'output_name' => 'E-Mail', 'output_name' => 'E-Mail',
'type' => 'text', 'type' => 'text',
'error_check' => 'email' 'error_check' => 'email'
), ),
'last_name' => array ( 'last_name' => array(
'value' => isset($GLOBALS['last_name']) ? $GLOBALS['last_name'] : '', 'value' => isset($GLOBALS['last_name']) ? $GLOBALS['last_name'] : '',
'output_name' => 'Last Name', 'output_name' => 'Last Name',
'type' => 'text' 'type' => 'text'
), ),
'first_name' => array ( 'first_name' => array(
'value' => isset($GLOBALS['first_name']) ? $GLOBALS['first_name'] : '', 'value' => isset($GLOBALS['first_name']) ? $GLOBALS['first_name'] : '',
'output_name' => 'First Name', 'output_name' => 'First Name',
'type' => 'text' 'type' => 'text'
), ),
'edit_language_id' => array ( 'edit_language_id' => array(
'value' => isset($GLOBALS['edit_language_id']) ? $GLOBALS['edit_language_id'] : '', 'value' => isset($GLOBALS['edit_language_id']) ? $GLOBALS['edit_language_id'] : '',
'output_name' => 'Language', 'output_name' => 'Language',
'mandatory' => 1, 'mandatory' => 1,
@@ -124,14 +124,14 @@ $edit_users = array (
'type' => 'drop_down_db', 'type' => 'drop_down_db',
'query' => "SELECT edit_language_id, long_name FROM edit_language WHERE enabled = 1 ORDER BY order_number" 'query' => "SELECT edit_language_id, long_name FROM edit_language WHERE enabled = 1 ORDER BY order_number"
), ),
'edit_scheme_id' => array ( 'edit_scheme_id' => array(
'value' => isset($GLOBALS['edit_scheme_id']) ? $GLOBALS['edit_scheme_id'] : '', 'value' => isset($GLOBALS['edit_scheme_id']) ? $GLOBALS['edit_scheme_id'] : '',
'output_name' => 'Scheme', 'output_name' => 'Scheme',
'int_null' => 1, 'int_null' => 1,
'type' => 'drop_down_db', 'type' => 'drop_down_db',
'query' => "SELECT edit_scheme_id, name FROM edit_scheme WHERE enabled = 1 ORDER BY name" 'query' => "SELECT edit_scheme_id, name FROM edit_scheme WHERE enabled = 1 ORDER BY name"
), ),
'edit_group_id' => array ( 'edit_group_id' => array(
'value' => isset($GLOBALS['edit_group_id']) ? $GLOBALS['edit_group_id'] : '', 'value' => isset($GLOBALS['edit_group_id']) ? $GLOBALS['edit_group_id'] : '',
'output_name' => 'Group', 'output_name' => 'Group',
'int' => 1, 'int' => 1,
@@ -139,7 +139,7 @@ $edit_users = array (
'query' => "SELECT edit_group_id, name FROM edit_group WHERE enabled = 1 ORDER BY name", 'query' => "SELECT edit_group_id, name FROM edit_group WHERE enabled = 1 ORDER BY name",
'mandatory' => 1 'mandatory' => 1
), ),
'edit_access_right_id' => array ( 'edit_access_right_id' => array(
'value' => isset($GLOBALS['edit_access_right_id']) ? $GLOBALS['edit_access_right_id'] : '', 'value' => isset($GLOBALS['edit_access_right_id']) ? $GLOBALS['edit_access_right_id'] : '',
'output_name' => 'User Level', 'output_name' => 'User Level',
'mandatory' => 1, 'mandatory' => 1,
@@ -147,35 +147,35 @@ $edit_users = array (
'type' => 'drop_down_db', 'type' => 'drop_down_db',
'query' => "SELECT edit_access_right_id, name FROM edit_access_right ORDER BY level" 'query' => "SELECT edit_access_right_id, name FROM edit_access_right ORDER BY level"
), ),
'login_error_count' => array ( 'login_error_count' => array(
'output_name' => 'Login error count', 'output_name' => 'Login error count',
'value' => isset($GLOBALS['login_error_count']) ? $GLOBALS['login_error_count'] : '', 'value' => isset($GLOBALS['login_error_count']) ? $GLOBALS['login_error_count'] : '',
'type' => 'view', 'type' => 'view',
'empty' => '0' 'empty' => '0'
), ),
'login_error_date_last' => array ( 'login_error_date_last' => array(
'output_name' => 'Last login error', 'output_name' => 'Last login error',
'value' => isset($GLOBALS['login_error_date_liast']) ? $GLOBALS['login_error_date_liast'] : '', 'value' => isset($GLOBALS['login_error_date_liast']) ? $GLOBALS['login_error_date_liast'] : '',
'type' => 'view', 'type' => 'view',
'empty' => '-' 'empty' => '-'
), ),
'login_error_date_first' => array ( 'login_error_date_first' => array(
'output_name' => 'First login error', 'output_name' => 'First login error',
'value' => isset($GLOBALS['login_error_date_first']) ? $GLOBALS['login_error_date_first'] : '', 'value' => isset($GLOBALS['login_error_date_first']) ? $GLOBALS['login_error_date_first'] : '',
'type' => 'view', 'type' => 'view',
'empty' => '-' 'empty' => '-'
), ),
'protected' => array ( 'protected' => array(
'value' => isset($GLOBALS['protected']) ? $GLOBALS['protected'] : '', 'value' => isset($GLOBALS['protected']) ? $GLOBALS['protected'] : '',
'output_name' => 'Protected', 'output_name' => 'Protected',
'type' => 'binary', 'type' => 'binary',
'int' => 1, 'int' => 1,
'element_list' => array ( 'element_list' => array(
'1' => 'Yes', '1' => 'Yes',
'0' => 'No' '0' => 'No'
) )
), ),
'additional_acl' => array ( 'additional_acl' => array(
'value' => isset($GLOBALS['additional_acl']) ? $GLOBALS['additional_acl'] : '', 'value' => isset($GLOBALS['additional_acl']) ? $GLOBALS['additional_acl'] : '',
'output_name' => 'Additional ACL (as JSON)', 'output_name' => 'Additional ACL (as JSON)',
'type' => 'textarea', 'type' => 'textarea',
@@ -186,79 +186,79 @@ $edit_users = array (
), ),
'load_query' => "SELECT edit_user_id, username, enabled, debug, db_debug, strict, locked, login_error_count FROM edit_user ORDER BY username", 'load_query' => "SELECT edit_user_id, username, enabled, debug, db_debug, strict, locked, login_error_count FROM edit_user ORDER BY username",
'table_name' => 'edit_user', 'table_name' => 'edit_user',
'show_fields' => array ( 'show_fields' => array(
array ( array(
'name' => 'username' 'name' => 'username'
), ),
array ( array(
'name' => 'enabled', 'name' => 'enabled',
'binary' => array ('Yes', 'No'), 'binary' => array('Yes', 'No'),
'before_value' => 'Enabled: ' 'before_value' => 'Enabled: '
), ),
array ( array(
'name' => 'debug', 'name' => 'debug',
'binary' => array ('Yes', 'No'), 'binary' => array('Yes', 'No'),
'before_value' => 'Debug: ' 'before_value' => 'Debug: '
), ),
array ( array(
'name' => 'db_debug', 'name' => 'db_debug',
'binary' => array ('Yes', 'No'), 'binary' => array('Yes', 'No'),
'before_value' => 'DB Debug: ' 'before_value' => 'DB Debug: '
), ),
array ( array(
'name' => 'strict', 'name' => 'strict',
'binary' => array ('Yes', 'No'), 'binary' => array('Yes', 'No'),
'before_value' => 'Strict: ' 'before_value' => 'Strict: '
), ),
array ( array(
'name' => 'locked', 'name' => 'locked',
'binary' => array ('Yes', 'No'), 'binary' => array('Yes', 'No'),
'before_value' => 'Locked: ' 'before_value' => 'Locked: '
), ),
array ( array(
'name' => 'login_error_count', 'name' => 'login_error_count',
'before_value' => 'Errors: ' 'before_value' => 'Errors: '
) )
), ),
'element_list' => array ( 'element_list' => array(
'edit_access_user' => array ( 'edit_access_user' => array(
'output_name' => 'Accounts', 'output_name' => 'Accounts',
'mandatory' => 1, 'mandatory' => 1,
'delete' => 0, // set then reference entries are deleted, else the 'enable' flag is only set 'delete' => 0, // set then reference entries are deleted, else the 'enable' flag is only set
'prefix' => 'ecu', 'prefix' => 'ecu',
'read_data' => array ( 'read_data' => array(
'table_name' => 'edit_access', 'table_name' => 'edit_access',
'pk_id' => 'edit_access_id', 'pk_id' => 'edit_access_id',
'name' => 'name', 'name' => 'name',
'order' => 'name' 'order' => 'name'
), ),
'elements' => array ( 'elements' => array(
'edit_access_user_id' => array ( 'edit_access_user_id' => array(
'output_name' => 'Activate', 'output_name' => 'Activate',
'type' => 'hidden', 'type' => 'hidden',
'int' => 1, 'int' => 1,
'pk_id' => 1 'pk_id' => 1
), ),
'enabled' => array ( 'enabled' => array(
'type' => 'checkbox', 'type' => 'checkbox',
'output_name' => 'Activate', 'output_name' => 'Activate',
'int' => 1, 'int' => 1,
'element_list' => array (1) 'element_list' => array(1)
), ),
'edit_access_right_id' => array ( 'edit_access_right_id' => array(
'type' => 'drop_down_db', 'type' => 'drop_down_db',
'output_name' => 'Access Level', 'output_name' => 'Access Level',
'preset' => 1, // first of the select 'preset' => 1, // first of the select
'int' => 1, 'int' => 1,
'query' => "SELECT edit_access_right_id, name FROM edit_access_right ORDER BY level" 'query' => "SELECT edit_access_right_id, name FROM edit_access_right ORDER BY level"
), ),
'edit_default' => array ( 'edit_default' => array(
'type' => 'radio_group', 'type' => 'radio_group',
'output_name' => 'Default', 'output_name' => 'Default',
'int' => 1, 'int' => 1,
'element_list' => 'radio_group' 'element_list' => 'radio_group'
), ),
'edit_access_id' => array ( 'edit_access_id' => array(
'type' => 'hidden', 'type' => 'hidden',
'int' => 1 'int' => 1
) )

View File

@@ -1,19 +1,19 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
$edit_visible_group = array ( $edit_visible_group = array(
'table_array' => array ( 'table_array' => array(
'edit_visible_group_id' => array ( 'edit_visible_group_id' => array(
'value' => isset($GLOBALS['edit_visible_group_id']) ? $GLOBALS['edit_visible_group_id'] : '', 'value' => isset($GLOBALS['edit_visible_group_id']) ? $GLOBALS['edit_visible_group_id'] : '',
'type' => 'hidden', 'type' => 'hidden',
'pk' => 1 'pk' => 1
), ),
'name' => array ( 'name' => array(
'value' => isset($GLOBALS['name']) ? $GLOBALS['name'] : '', 'value' => isset($GLOBALS['name']) ? $GLOBALS['name'] : '',
'output_name' => 'Group name', 'output_name' => 'Group name',
'mandatory' => 1, 'mandatory' => 1,
'type' => 'text' 'type' => 'text'
), ),
'flag' => array ( 'flag' => array(
'value' => isset($GLOBALS['flag']) ? $GLOBALS['flag'] : '', 'value' => isset($GLOBALS['flag']) ? $GLOBALS['flag'] : '',
'output_name' => 'Flag', 'output_name' => 'Flag',
'mandatory' => 1, 'mandatory' => 1,
@@ -23,8 +23,8 @@ $edit_visible_group = array (
), ),
'table_name' => 'edit_visible_group', 'table_name' => 'edit_visible_group',
'load_query' => "SELECT edit_visible_group_id, name FROM edit_visible_group ORDER BY name", 'load_query' => "SELECT edit_visible_group_id, name FROM edit_visible_group ORDER BY name",
'show_fields' => array ( 'show_fields' => array(
array ( array(
'name' => 'name' 'name' => 'name'
) )
) )

View File

@@ -78,33 +78,33 @@ class Login extends \CoreLibs\DB\IO
private $pw_old_password; private $pw_old_password;
private $pw_new_password; private $pw_new_password;
private $pw_new_password_confirm; 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 $logout_target;
private $max_login_error_count = -1; 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 // if we have password change we need to define some rules
private $password_min_length = PASSWORD_MIN_LENGTH; 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 // 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; private $password_max_length = PASSWORD_MAX_LENGTH;
// can have several regexes, if nothing set, all is ok // 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,}$', // '^(?=.*\d)(?=.*[A-Za-z])[0-9A-Za-z!@#$%]{8,}$',
// '^(?.*(\pL)u)(?=.*(\pN)u)(?=.*([^\pL\pN])u).{8,}', // '^(?.*(\pL)u)(?=.*(\pN)u)(?=.*([^\pL\pN])u).{8,}',
); );
// all possible login error conditions // 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) // this is an array holding all strings & templates passed from the outside (translation)
private $login_template = array ( private $login_template = array(
'strings' => array (), 'strings' => array(),
'password_change' => '', 'password_change' => '',
'template' => '' 'template' => ''
); );
// acl vars // acl vars
public $acl = array (); public $acl = array();
public $default_acl_list = array (); public $default_acl_list = array();
// language // language
public $l; public $l;
@@ -207,7 +207,7 @@ class Login extends \CoreLibs\DB\IO
// logout target (from config) // logout target (from config)
$this->logout_target = LOGOUT_TARGET; $this->logout_target = LOGOUT_TARGET;
// disallow user list for password change // 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 // set flag if password change is okay
if (defined('PASSWORD_CHANGE')) { if (defined('PASSWORD_CHANGE')) {
$this->password_change = PASSWORD_CHANGE; $this->password_change = PASSWORD_CHANGE;
@@ -219,15 +219,15 @@ class Login extends \CoreLibs\DB\IO
// max login counts before error reporting // max login counts before error reporting
$this->max_login_error_count = 10; $this->max_login_error_count = 10;
// users that never get locked, even if they are set strict // 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 // 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 // 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"; $q = "SELECT level, type, name FROM edit_access_right WHERE level >= 0 ORDER BY level";
while ($res = $this->dbReturn($q)) { while ($res = $this->dbReturn($q)) {
// level to description format (numeric) // level to description format (numeric)
$this->default_acl_list[$res['level']] = array ( $this->default_acl_list[$res['level']] = array(
'type' => $res['type'], 'type' => $res['type'],
'name' => $res['name'] 'name' => $res['name']
); );
@@ -428,7 +428,7 @@ class Login extends \CoreLibs\DB\IO
} }
$edit_page_ids = array(); $edit_page_ids = array();
$pages = array(); $pages = array();
$pages_acl = array (); $pages_acl = array();
// set pages access // 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 = "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 "; $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 // 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
$pages[$res['cuid']] = array ( $pages[$res['cuid']] = array(
'edit_page_id' => $res['edit_page_id'], 'edit_page_id' => $res['edit_page_id'],
'cuid' => $res['cuid'], 'cuid' => $res['cuid'],
'content_alias_uid' => $res['content_alias_uid'], // for reference of content data on a differen page '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'], 'online' => $res['online'],
'acl_level' => $res['level'], 'acl_level' => $res['level'],
'acl_type' => $res['type'], 'acl_type' => $res['type'],
'query' => array (), 'query' => array(),
'visible' => array () 'visible' => array()
); );
// make reference filename -> level // make reference filename -> level
$pages_acl[$res['filename']] = $res['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 .= "WHERE enabled = 1 AND edit_page_id IN (".join(', ', array_keys($edit_page_ids)).") ";
$q .= "ORDER BY eqs.edit_page_id"; $q .= "ORDER BY eqs.edit_page_id";
while ($res = $this->dbReturn($q)) { 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'], 'name' => $res['name'],
'value' => $res['value'], 'value' => $res['value'],
'dynamic' => $res['dynamic'] '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 .= "epc.edit_page_id IN (".join(', ', array_keys($edit_page_ids)).") ";
$q .= "ORDER BY epc.order_number"; $q .= "ORDER BY epc.order_number";
while ($res = $this->dbReturn($q)) { 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'], 'name' => $res['name'],
'uid' => $res['uid'], 'uid' => $res['uid'],
'online' => $res['online'], 'online' => $res['online'],
@@ -516,12 +516,12 @@ class Login extends \CoreLibs\DB\IO
while ($res = $this->dbReturn($q)) { while ($res = $this->dbReturn($q)) {
// read edit access data fields and drop them into the unit access array // 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']; $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)) { while ($res_sub = $this->dbReturn($q_sub)) {
$ea_data[$res_sub['name']] = $res_sub['value']; $ea_data[$res_sub['name']] = $res_sub['value'];
} }
// build master unit array // build master unit array
$unit_access[$res['edit_access_id']] = array ( $unit_access[$res['edit_access_id']] = array(
'id' => $res['edit_access_id'], 'id' => $res['edit_access_id'],
'acl_level' => $res['level'], 'acl_level' => $res['level'],
'acl_type' => $res['type'], 'acl_type' => $res['type'],
@@ -721,7 +721,7 @@ class Login extends \CoreLibs\DB\IO
} }
} }
// detail name/level set // detail name/level set
$this->acl['unit_detail'][$ea_id] = array ( $this->acl['unit_detail'][$ea_id] = array(
'name' => $unit['name'], 'name' => $unit['name'],
'uid' => $unit['uid'], 'uid' => $unit['uid'],
'level' => $this->default_acl_list[$this->acl['unit'][$ea_id]]['name'], '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 // if true, return error ajax
global $AJAX_PAGE; global $AJAX_PAGE;
if ($AJAX_PAGE === true) { if ($AJAX_PAGE === true) {
$data = array ( $data = array(
'status' => 'error', 'status' => 'error',
'error_code' => $this->login_error, 'error_code' => $this->login_error,
'msg' => array ( 'msg' => array(
'level' => 'error', 'level' => 'error',
'str' => $this->l->__('Login necessary') 'str' => $this->l->__('Login necessary')
) )
@@ -1020,7 +1020,7 @@ class Login extends \CoreLibs\DB\IO
*/ */
private function loginSetTemplates() private function loginSetTemplates()
{ {
$strings = array ( $strings = array(
'HTML_TITLE' => $this->l->__('LOGIN'), 'HTML_TITLE' => $this->l->__('LOGIN'),
'TITLE' => $this->l->__('LOGIN'), 'TITLE' => $this->l->__('LOGIN'),
'USERNAME' => $this->l->__('Username'), 'USERNAME' => $this->l->__('Username'),
@@ -1031,7 +1031,7 @@ class Login extends \CoreLibs\DB\IO
'PASSWORD_CHANGE_BUTTON_VALUE' => $this->l->__('Change Password') '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 '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 '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 '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 password change is okay
if ($this->password_change) { if ($this->password_change) {
$strings = array_merge($strings, array ( $strings = array_merge($strings, array(
'TITLE_PASSWORD_CHANGE' => 'Change Password for User', 'TITLE_PASSWORD_CHANGE' => 'Change Password for User',
'OLD_PASSWORD' => $this->l->__('Old Password'), 'OLD_PASSWORD' => $this->l->__('Old Password'),
'NEW_PASSWORD' => $this->l->__('New Password'), 'NEW_PASSWORD' => $this->l->__('New Password'),
@@ -1081,7 +1081,7 @@ EOM;
if ($this->password_forgot) { if ($this->password_forgot) {
} }
if (!$this->password_change && !$this->password_forgot) { if (!$this->password_change && !$this->password_forgot) {
$strings = array_merge($strings, array ( $strings = array_merge($strings, array(
'JS_SHOW_HIDE' => '', 'JS_SHOW_HIDE' => '',
'PASSWORD_CHANGE_BUTTON' => '', 'PASSWORD_CHANGE_BUTTON' => '',
'PASSWORD_CHANGE_DIV' => '' 'PASSWORD_CHANGE_DIV' => ''
@@ -1186,7 +1186,7 @@ EOM;
} else { } else {
$this->action = ''; $this->action = '';
} }
$_data_binary = array ( $_data_binary = array(
'_SESSION' => $_SESSION, '_SESSION' => $_SESSION,
'_GET' => $_GET, '_GET' => $_GET,
'_POST' => $_POST, '_POST' => $_POST,

View File

@@ -30,7 +30,7 @@ class Backend extends \CoreLibs\DB\IO
public $menu = array(); public $menu = array();
public $menu_show_flag = 0; // top menu flag (mostly string) public $menu_show_flag = 0; // top menu flag (mostly string)
// action ids // 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;
public $action_id; public $action_id;
public $action_sub_id; public $action_sub_id;
@@ -41,14 +41,14 @@ class Backend extends \CoreLibs\DB\IO
public $action_value; public $action_value;
public $action_error; public $action_error;
// ACL array variable if we want to set acl data from outisde // ACL array variable if we want to set acl data from outisde
public $acl = array (); public $acl = array();
public $default_acl; public $default_acl;
// queue key // queue key
public $queue_key; public $queue_key;
// the current active edit access id // the current active edit access id
public $edit_access_id; public $edit_access_id;
// error/warning/info messages // error/warning/info messages
public $messages = array (); public $messages = array();
public $error = 0; public $error = 0;
public $warning = 0; public $warning = 0;
public $info = 0; public $info = 0;
@@ -195,9 +195,9 @@ class Backend extends \CoreLibs\DB\IO
// get the session pages array // get the session pages array
$PAGES = $_SESSION['PAGES']; $PAGES = $_SESSION['PAGES'];
if (!isset($PAGES) || !is_array($PAGES)) { if (!isset($PAGES) || !is_array($PAGES)) {
$PAGES = array (); $PAGES = array();
} }
$pages = array (); $pages = array();
foreach ($PAGES as $PAGE_CUID => $PAGE_DATA) { foreach ($PAGES as $PAGE_CUID => $PAGE_DATA) {
$pages[] = $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 * @param array $vars optional data for a possible printf formated msg
* @return void has no return * @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)) { if (!preg_match("/^info|warning|error$/", $level)) {
$level = "info"; $level = "info";
} }
$this->messages[] = array ( $this->messages[] = array(
'msg' => vsprintf($this->l->__($msg), $vars), 'msg' => vsprintf($this->l->__($msg), $vars),
'class' => $level 'class' => $level
); );

View File

@@ -112,7 +112,7 @@ class Basic
public $host_port; public $host_port;
// internal error reporting vars // internal error reporting vars
protected $error_id; // error ID for errors in classes 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 // debug output prefix
public $error_msg_prefix = ''; // prefix to the error string (the class name) public $error_msg_prefix = ''; // prefix to the error string (the class name)
// debug flags // debug flags
@@ -152,14 +152,14 @@ class Basic
private $script_starttime; private $script_starttime;
// email valid checks // email valid checks
public $email_regex_check = array (); public $email_regex_check = array();
public $mobile_email_type = array (); public $mobile_email_type = array();
public $mobile_email_type_short = array (); public $mobile_email_type_short = array();
public $email_regex; // regex var for email check public $email_regex; // regex var for email check
public $keitai_email_regex; // regex var for email check public $keitai_email_regex; // regex var for email check
// data path for files // data path for files
public $data_path = array (); public $data_path = array();
// error char for the char conver // error char for the char conver
public $mbErrorChar; public $mbErrorChar;
@@ -170,12 +170,12 @@ class Basic
public $cryptIterationCost = 7; // this is for staying backwards compatible with the old ones 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, public $cryptSaltSize = 22; // default 22 chars for blowfish, 2 for STD DES, 8 for MD5,
// new better password management // new better password management
protected $password_options = array (); protected $password_options = array();
// session name // session name
private $session_name = ''; private $session_name = '';
private $session_id = ''; private $session_id = '';
// key generation // key generation
private $key_range = array (); private $key_range = array();
private $one_key_length; private $one_key_length;
private $key_length; private $key_length;
private $max_key_length = 256; // max allowed length private $max_key_length = 256; // max allowed length
@@ -233,7 +233,7 @@ class Basic
} }
// set the paths matching to the valid file types // set the paths matching to the valid file types
$this->data_path = array ( $this->data_path = array(
'P' => PICTURES, 'P' => PICTURES,
'F' => FLASH, 'F' => FLASH,
'V' => VIDEOS, 'V' => VIDEOS,
@@ -299,7 +299,7 @@ class Basic
// set the regex for checking emails // 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->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 is for error check parts in where the email regex failed
$this->email_regex_check = array ( $this->email_regex_check = array(
1 => "@(.*)@(.*)", // double @ 1 => "@(.*)@(.*)", // double @
2 => "^[A-Za-z0-9!#$%&'*+-\/=?^_`{|}~][A-Za-z0-9!#$%:\(\)&'*+-\/=?^_`{|}~\.]{0,63}@", // wrong part before @ 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 @ 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 7 => "@.*\.$" // ends with a dot, top level, domain missing
); );
// the array with the mobile types that are valid // the array with the mobile types that are valid
$this->mobile_email_type = array ( $this->mobile_email_type = array(
'.*@docomo\.ne\.jp$' => 'keitai_docomo', '.*@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] '.*@([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 '.*@(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 '.*@emobile-s\.ne\.jp$' => 'keitai_willcom_emnet' # e-mobile, group will willcom
); );
// short list for mobile email types // short list for mobile email types
$this->mobile_email_type_short = array ( $this->mobile_email_type_short = array(
'keitai_docomo' => 'docomo', 'keitai_docomo' => 'docomo',
'keitai_kddi_ezweb' => 'kddi', 'keitai_kddi_ezweb' => 'kddi',
'keitai_kddi' => 'kddi', 'keitai_kddi' => 'kddi',
@@ -738,10 +738,10 @@ class Basic
* @param array $error_msg error array * @param array $error_msg error array
* @return void has no return * @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)) { if (!is_array($error_msg)) {
$error_msg = array (); $error_msg = array();
} }
foreach ($error_msg as $level => $msg) { foreach ($error_msg as $level => $msg) {
$this->error_msg[$level] .= $msg; $this->error_msg[$level] .= $msg;
@@ -1171,7 +1171,7 @@ class Basic
*/ */
public static function arraySearchRecursive($needle, array $haystack, $key_lookin = ''): ?array public static function arraySearchRecursive($needle, array $haystack, $key_lookin = ''): ?array
{ {
$path = array (); $path = array();
if (!is_array($haystack)) { if (!is_array($haystack)) {
$haystack = array(); $haystack = array();
} }
@@ -1211,10 +1211,10 @@ class Basic
$path['level'] = 0; $path['level'] = 0;
} }
if (!isset($path['work'])) { if (!isset($path['work'])) {
$path['work'] = array (); $path['work'] = array();
} }
if (!is_array($haystack)) { if (!is_array($haystack)) {
$haystack = array (); $haystack = array();
} }
// go through the array, // go through the array,
@@ -1245,7 +1245,7 @@ class Basic
/** /**
* array search simple. looks for key, value combination, if found, returns true * 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 $key key (key to search in)
* @param string|int $value value (what to find) * @param string|int $value value (what to find)
* @return bool true on found, false on not found * @return bool true on found, false on not found
@@ -1253,7 +1253,7 @@ class Basic
public static function arraySearchSimple(array $array, $key, $value): bool public static function arraySearchSimple(array $array, $key, $value): bool
{ {
if (!is_array($array)) { if (!is_array($array)) {
$array = array (); $array = array();
} }
foreach ($array as $_key => $_value) { foreach ($array as $_key => $_value) {
// if value is an array, we search // if value is an array, we search
@@ -1342,7 +1342,7 @@ class Basic
if (!is_array($haystack)) { if (!is_array($haystack)) {
return false; return false;
} }
$found = array (); $found = array();
foreach ($needle as $element) { foreach ($needle as $element) {
if (in_array($element, $haystack)) { if (in_array($element, $haystack)) {
$found[] = $element; $found[] = $element;
@@ -1365,7 +1365,7 @@ class Basic
*/ */
public static function genAssocArray(array $db_array, $key, $value, bool $set_only = false): array 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 // do this to only run count once
for ($i = 0, $iMax = count($db_array); $i < $iMax; $i ++) { for ($i = 0, $iMax = count($db_array); $i < $iMax; $i ++) {
// if no key then we make an order reference // 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); trigger_error('Method '.__METHOD__.' is deprecated, use join()', E_USER_DEPRECATED);
if (!is_array($array)) { if (!is_array($array)) {
$array = array (); $array = array();
} }
return join($connect_char, $array); return join($connect_char, $array);
} }
@@ -1408,7 +1408,7 @@ class Basic
*/ */
public static function flattenArray(array $array): array public static function flattenArray(array $array): array
{ {
$return = array (); $return = array();
array_walk_recursive( array_walk_recursive(
$array, $array,
function ($value) use (&$return) { function ($value) use (&$return) {
@@ -1423,9 +1423,9 @@ class Basic
* @param array $array multidemnsional array to flatten * @param array $array multidemnsional array to flatten
* @return array flattened keys array * @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_walk_recursive(
$array, $array,
function ($value, $key) use (&$return) { 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 * searches for key -> value in an array tree and writes the value one level up
* this will remove this leaf will all other values * 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 * @param string|int $search key to find that has no sub leaf and will be pushed up
* @return array modified, flattened array * @return array modified, flattened array
*/ */
public static function arrayFlatForKey(array $array, $search): array public static function arrayFlatForKey(array $array, $search): array
{ {
if (!is_array($array)) { if (!is_array($array)) {
$array = array (); $array = array();
} }
foreach ($array as $key => $value) { foreach ($array as $key => $value) {
// if it is not an array do just nothing // if it is not an array do just nothing
@@ -1600,8 +1600,8 @@ class Basic
if (!preg_match("/(h|m|s|ms)/", (string)$timestamp)) { if (!preg_match("/(h|m|s|ms)/", (string)$timestamp)) {
$ms = 0; $ms = 0;
list ($timestamp, $ms) = explode('.', (string)round($timestamp, 4)); list ($timestamp, $ms) = explode('.', (string)round($timestamp, 4));
$timegroups = array (86400, 3600, 60, 1); $timegroups = array(86400, 3600, 60, 1);
$labels = array ('d', 'h', 'm', 's'); $labels = array('d', 'h', 'm', 's');
$time_string = ''; $time_string = '';
for ($i = 0, $iMax = count($timegroups); $i < $iMax; $i ++) { for ($i = 0, $iMax = count($timegroups); $i < $iMax; $i ++) {
$output = floor((float)$timestamp / $timegroups[$i]); $output = floor((float)$timestamp / $timegroups[$i]);
@@ -1636,8 +1636,8 @@ class Basic
$timestamp = 0; $timestamp = 0;
if (preg_match("/(d|h|m|s|ms)/", $timestring)) { if (preg_match("/(d|h|m|s|ms)/", $timestring)) {
// pos for preg match read + multiply factor // pos for preg match read + multiply factor
$timegroups = array (2 => 86400, 4 => 3600, 6 => 60, 8 => 1); $timegroups = array(2 => 86400, 4 => 3600, 6 => 60, 8 => 1);
$matches = array (); $matches = array();
// preg match: 0: full strsing // preg match: 0: full strsing
// 2, 4, 6, 8 are the to need values // 2, 4, 6, 8 are the to need values
preg_match("/^((\d+)d ?)?((\d+)h ?)?((\d+)m ?)?((\d+)s ?)?((\d+)ms)?$/", $timestring, $matches); 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 public static function calcDaysInterval($start_date, $end_date, bool $return_named = false): array
{ {
// pos 0 all, pos 1 weekday, pos 2 weekend // pos 0 all, pos 1 weekday, pos 2 weekend
$days = array (); $days = array();
$start = new \DateTime($start_date); $start = new \DateTime($start_date);
$end = new \DateTime($end_date); $end = new \DateTime($end_date);
// so we include the last day too, we need to add +1 second in the time // 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) { if ($return_named === true) {
return array ( return array(
'overall' => $days[0], 'overall' => $days[0],
'weekday' => $days[1], 'weekday' => $days[1],
'weekend' => $days[2] '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) 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 // get image type flags
$image_types = array ( $image_types = array(
1 => 'gif', 1 => 'gif',
2 => 'jpg', 2 => 'jpg',
3 => 'png' 3 => 'png'
@@ -1956,7 +1956,7 @@ class Basic
$compare = mb_convert_encoding($temp, $from_encoding, $to_encoding); $compare = mb_convert_encoding($temp, $from_encoding, $to_encoding);
// if string does not match anymore we have a convert problem // if string does not match anymore we have a convert problem
if ($string != $compare) { if ($string != $compare) {
$failed = array (); $failed = array();
// go through each character and find the ones that do not match // go through each character and find the ones that do not match
for ($i = 0, $iMax = mb_strlen($string, $from_encoding); $i < $iMax; $i ++) { for ($i = 0, $iMax = mb_strlen($string, $from_encoding); $i < $iMax; $i ++) {
$char = mb_substr($string, $i, 1, $from_encoding); $char = mb_substr($string, $i, 1, $from_encoding);
@@ -2161,9 +2161,9 @@ class Basic
// a-z is 97,122 // a-z is 97,122
// 0-9 is 48,57 // 0-9 is 48,57
// ./ is 46,47 (so first lower limit is 46) // ./ is 46,47 (so first lower limit is 46)
$min = array (46, 65, 97); $min = array(46, 65, 97);
$max = array (57, 90, 122); $max = array(57, 90, 122);
$chars = array (); $chars = array();
for ($i = 0, $iMax = count($min); $i < $iMax; $i ++) { for ($i = 0, $iMax = count($min); $i < $iMax; $i ++) {
for ($j = $min[$i]; $j <= $max[$i]; $j ++) { for ($j = $min[$i]; $j <= $max[$i]; $j ++) {
$chars[] = chr($j); $chars[] = chr($j);
@@ -2224,7 +2224,7 @@ class Basic
private function passwordInit(): void private function passwordInit(): void
{ {
// set default password cost: use default set automatically // set default password cost: use default set automatically
$this->password_options = array ( $this->password_options = array(
// 'cost' => PASSWORD_BCRYPT_DEFAULT_COST // 'cost' => PASSWORD_BCRYPT_DEFAULT_COST
); );
} }
@@ -2325,7 +2325,7 @@ class Basic
if ($hex_prefix === true) { if ($hex_prefix === true) {
$hex_color = '#'; $hex_color = '#';
} }
foreach (array ('red', 'green', 'blue') as $color) { foreach (array('red', 'green', 'blue') as $color) {
// if not valid, set to gray // if not valid, set to gray
if ($$color < 0 || $$color > 255) { if ($$color < 0 || $$color > 255) {
$$color = 125; $$color = 125;

View File

@@ -6,7 +6,7 @@
* RELEASED LICENSE: GNU GPL 3 * RELEASED LICENSE: GNU GPL 3
* SHORT DESC :RIPTION: * SHORT DESC :RIPTION:
* DB Array IO Class: * 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. * table from the connected DB.
* you don't have to write any SQL queries, worry over update/insert * 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 * set this as new table array too
* @return array returns the table array that was deleted * @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 // is array and has values, override set and set new
if (is_array($table_array) && count($table_array)) { 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 * @param array $table_array optional table array, overwrites internal set array
* @return array set table array with values * @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 array give, overrules internal array
if (is_array($table_array) && count($table_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 * @param array $table_array optional table array, overwrites internal one
* @return array table array or null * @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)) { if (is_array($table_array) && count($table_array)) {
$this->table_array = $table_array; $this->table_array = $table_array;

View File

@@ -41,7 +41,7 @@
* $class_name * $class_name
* - the name of the class * - the name of the class
* $class_version * $class_version
* - the version as an array (major, minor, patchlvl, daypatch) * - the version as an array(major, minor, patchlvl, daypatch)
* $class_last_changed * $class_last_changed
* - date (mysql format) for the last change * - date (mysql format) for the last change
* $class_created * $class_created
@@ -134,7 +134,7 @@
* - correctly escapes string for db insert * - correctly escapes string for db insert
* $string db_boolean(string) * $string db_boolean(string)
* - if the string value is 't' or 'f' it returns correct TRUE/FALSE for php * - 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 * - 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) * $boolean db_set_schema(schema)
* - sets search path to a schema * - sets search path to a schema
@@ -147,7 +147,7 @@
* _db_error() * _db_error()
* - INTERNAL ONLY!! error that occured during execution * - INTERNAL ONLY!! error that occured during execution
* $string _print_array($array) * $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() * 1/0 _connect_to_db()
* - returns 1 for successfull DB connection or 0 for none * - returns 1 for successfull DB connection or 0 for none
* 1/0 _check_query_for_select($query) * 1/0 _check_query_for_select($query)
@@ -270,7 +270,7 @@ class IO extends \CoreLibs\Basic
public $cursor; // actual cursor (DBH) public $cursor; // actual cursor (DBH)
public $num_rows; // how many rows have been found public $num_rows; // how many rows have been found
public $num_fields; // how many fields has the query 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; // last inserted ID
public $insert_id_ext; // extended insert ID (for data outside only primary key) public $insert_id_ext; // extended insert ID (for data outside only primary key)
private $temp_sql; private $temp_sql;
@@ -288,14 +288,14 @@ class IO extends \CoreLibs\Basic
// endless loop protection // endless loop protection
private $MAX_QUERY_CALL; private $MAX_QUERY_CALL;
private $query_called = array (); private $query_called = array();
// error string // error string
protected $error_string = array (); protected $error_string = array();
// prepared list // prepared list
public $prepare_cursor = array (); public $prepare_cursor = array();
// primary key per table list // primary key per table list
// format is 'table' => 'pk_name' // format is 'table' => 'pk_name'
public $pk_name_table = array (); public $pk_name_table = array();
// internal primary key name, for cross calls in async // internal primary key name, for cross calls in async
public $pk_name; public $pk_name;
// if we use RETURNING in the INSERT call // if we use RETURNING in the INSERT call
@@ -314,7 +314,7 @@ class IO extends \CoreLibs\Basic
parent::__construct($set_control_flag); parent::__construct($set_control_flag);
// dummy init array for db config if not array // dummy init array for db config if not array
if (!is_array($db_config)) { if (!is_array($db_config)) {
$db_config = array (); $db_config = array();
} }
// sets the names (for connect/reconnect) // sets the names (for connect/reconnect)
$this->db_name = $db_config['db_name'] ?? ''; $this->db_name = $db_config['db_name'] ?? '';
@@ -508,7 +508,7 @@ class IO extends \CoreLibs\Basic
{ {
$string = ''; $string = '';
if (!is_array($array)) { if (!is_array($array)) {
$array = array (); $array = array();
} }
foreach ($array as $key => $value) { foreach ($array as $key => $value) {
$string .= $this->nbsp.'<b>'.$key.'</b> => '; $string .= $this->nbsp.'<b>'.$key.'</b> => ';
@@ -765,7 +765,7 @@ class IO extends \CoreLibs\Basic
// count the fields // count the fields
$this->num_fields = $this->db_functions->__dbNumFields($this->cursor); $this->num_fields = $this->db_functions->__dbNumFields($this->cursor);
// set field names // set field names
$this->field_names = array (); $this->field_names = array();
for ($i = 0; $i < $this->num_fields; $i ++) { for ($i = 0; $i < $this->num_fields; $i ++) {
$this->field_names[] = $this->db_functions->__dbFieldName($this->cursor, $i); $this->field_names[] = $this->db_functions->__dbFieldName($this->cursor, $i);
} }
@@ -781,8 +781,8 @@ class IO extends \CoreLibs\Basic
if (!$this->returning_id) { if (!$this->returning_id) {
$this->insert_id = $this->db_functions->__dbInsertId($this->query, $this->pk_name); $this->insert_id = $this->db_functions->__dbInsertId($this->query, $this->pk_name);
} else { } else {
$this->insert_id = array (); $this->insert_id = array();
$this->insert_id_ext = array (); $this->insert_id_ext = array();
// echo "** PREPARE RETURNING FOR CURSOR: ".$this->cursor."<br>"; // echo "** PREPARE RETURNING FOR CURSOR: ".$this->cursor."<br>";
// we have returning, now we need to check if we get one or many returned // 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 // 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); $md5 = md5($query);
// pre declare array // pre declare array
if (!isset($this->cursor_ext[$md5])) { if (!isset($this->cursor_ext[$md5])) {
$this->cursor_ext[$md5] = array ( $this->cursor_ext[$md5] = array(
'query' => '', 'query' => '',
'pos' => 0, 'pos' => 0,
'cursor' => 0, 'cursor' => 0,
@@ -1135,7 +1135,7 @@ class IO extends \CoreLibs\Basic
$return = false; $return = false;
} else { } else {
// unset return value ... // unset return value ...
$return = array (); $return = array();
for ($i = 0; $i < $this->cursor_ext[$md5]['num_fields']; $i ++) { for ($i = 0; $i < $this->cursor_ext[$md5]['num_fields']; $i ++) {
// create mixed return array // create mixed return array
if ($assoc_only === false && isset($this->cursor_ext[$md5]['data'][$this->cursor_ext[$md5]['pos']][$i])) { 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'] ++; $this->cursor_ext[$md5]['read_rows'] ++;
// if reset is <3 caching is done, else no // if reset is <3 caching is done, else no
if ($reset < 3) { if ($reset < 3) {
$temp = array (); $temp = array();
foreach ($return as $field_name => $data) { foreach ($return as $field_name => $data) {
$temp[$field_name] = $data; $temp[$field_name] = $data;
} }
@@ -1361,9 +1361,9 @@ class IO extends \CoreLibs\Basic
return false; return false;
} }
$cursor = $this->dbExec($query); $cursor = $this->dbExec($query);
$rows = array (); $rows = array();
while ($res = $this->dbFetchArray($cursor, $assoc_only)) { while ($res = $this->dbFetchArray($cursor, $assoc_only)) {
$data = array (); $data = array();
for ($i = 0; $i < $this->num_fields; $i ++) { for ($i = 0; $i < $this->num_fields; $i ++) {
$data[$this->field_names[$i]] = $res[$this->field_names[$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']) { 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']); $this->insert_id = $this->db_functions->__dbInsertId($this->prepare_cursor[$stm_name]['query'], $this->prepare_cursor[$stm_name]['pk_name']);
} elseif ($result) { } elseif ($result) {
$this->insert_id = array (); $this->insert_id = array();
$this->insert_id_ext = array (); $this->insert_id_ext = array();
// we have returning, now we need to check if we get one or many returned // 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 // we'll need to loop this, if we have multiple insert_id returns
while ($_insert_id = $this->db_functions->__dbFetchArray( 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 * @param array $data data array to override _POST data
* @return int|bool primary key * @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)) { if (!is_array($write_array)) {
$write_array = array (); $write_array = array();
} }
if (!is_array($not_write_array)) { if (!is_array($not_write_array)) {
$not_write_array = array (); $not_write_array = array();
} }
if (is_array($table)) { if (is_array($table)) {
return false; 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); 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 * writes into one table based on array of table columns
* PARAM INFO: $primary key * PARAM INFO: $primary key
* this can be a plain string/int and will be internal transformed into the array form * 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 array $write_array list of elements to write
* @param int|string|array $primary_key primary key string or array set * @param int|string|array $primary_key primary key string or array set
* @param string $table name for the target table * @param string $table name for the target table
@@ -1770,12 +1770,12 @@ class IO extends \CoreLibs\Basic
array $write_array, array $write_array,
$primary_key, $primary_key,
string $table, string $table,
array $not_write_array = array (), array $not_write_array = array(),
array $not_write_update_array = array (), array $not_write_update_array = array(),
array $data = array () array $data = array()
) { ) {
if (!is_array($primary_key)) { if (!is_array($primary_key)) {
$primary_key = array ( $primary_key = array(
'row' => $table.'_id', 'row' => $table.'_id',
'value' => $primary_key 'value' => $primary_key
); );
@@ -1895,7 +1895,7 @@ class IO extends \CoreLibs\Basic
*/ */
public function dbArrayParse(string $text): array public function dbArrayParse(string $text): array
{ {
$output = array (); $output = array();
return $this->db_functions->__dbArrayParse($text, $output); return $this->db_functions->__dbArrayParse($text, $output);
} }

View File

@@ -444,7 +444,7 @@ class PgSQL
{ {
if (false === $limit) { if (false === $limit) {
$limit = strlen($text) - 1; $limit = strlen($text) - 1;
$output = array (); $output = array();
} }
if ('{}' != $text) { if ('{}' != $text) {
do { do {

View File

@@ -50,7 +50,7 @@ class GetTextReader
private $total = 0; // total string count private $total = 0; // total string count
private $table_originals = null; // table for original strings (offsets) private $table_originals = null; // table for original strings (offsets)
private $table_translations = null; // table for translated 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 */ /* Methods */
@@ -161,7 +161,7 @@ class GetTextReader
} }
if ($this->enable_cache) { if ($this->enable_cache) {
$this->cache_translations = array (); $this->cache_translations = array();
/* read all strings in the cache */ /* read all strings in the cache */
for ($i = 0; $i < $this->total; $i++) { for ($i = 0; $i < $this->total; $i++) {
$this->STREAM->seekto($this->table_originals[$i * 2 + 2]); $this->STREAM->seekto($this->table_originals[$i * 2 + 2]);

View File

@@ -35,7 +35,7 @@
* 'order_by' => 'order bY' string for drop_down_db(_input) if no query given but fields set * '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 * 'query' => for drop_down_db/array if no outer query given
* 'preset' => value to preset when array is unset (available for all types) * '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) * 'length' => 'nr' - only available for 'text' (maxlength)
* 'size' => 'nr' - only available for 'text' (size of input field) * 'size' => 'nr' - only available for 'text' (size of input field)
* 'rows' => 'nr' - only available for 'textarea' * 'rows' => 'nr' - only available for 'textarea'
@@ -69,7 +69,7 @@
* array( * array(
* 'name' => 'name_of_col_in_query' - col from the query that should be shown * '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 * '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 class Generate extends \CoreLibs\DB\Extended\ArrayIO
{ {
// rest // 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 $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 $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 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 $warning; // warning flag, for information (saved, loaded, etc)
public $archive_pk_name; // the pk name for the load select form public $archive_pk_name; // the pk name for the load select form
private $int_pk_name; // primary key, only internal usage 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 $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 $my_page_name; // the name of the page without .php extension
public $mobile_phone = false; public $mobile_phone = false;
// buttons and checkboxes // buttons and checkboxes
@@ -246,7 +246,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
public $l; public $l;
// now some default error msgs (english) // now some default error msgs (english)
public $language_array = array (); public $language_array = array();
/** /**
* construct form generator * construct form generator
@@ -277,8 +277,8 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
$config_array = ${$this->my_page_name}; $config_array = ${$this->my_page_name};
} else { } else {
// dummy created // dummy created
$config_array = array ( $config_array = array(
'table_array' => array (), 'table_array' => array(),
'table_name' => '', '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']) || if (!isset($config_array['security_level']) || !is_array($config_array['security_level']) ||
(is_array($config_array['security_level']) && count($config_array['security_level']) < 4) (is_array($config_array['security_level']) && count($config_array['security_level']) < 4)
) { ) {
$config_array['security_level'] = array ( $config_array['security_level'] = array(
'load' => 100, 'load' => 100,
'new' => 100, 'new' => 100,
'save' => 100, 'save' => 100,
@@ -355,7 +355,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
public function formDumpTableArray() public function formDumpTableArray()
{ {
if (!is_array($this->table_array)) { if (!is_array($this->table_array)) {
$this->table_array = array (); $this->table_array = array();
} }
reset($this->table_array); reset($this->table_array);
$string = '<b>TABLE ARRAY DUMP:</b> '.$this->table_name.'<br>'; $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 public function formGetColNameFromKey(string $want_key, ?string $key_value = null): ?string
{ {
if (!is_array($this->table_array)) { if (!is_array($this->table_array)) {
$this->table_array = array (); $this->table_array = array();
} }
reset($this->table_array); reset($this->table_array);
foreach ($this->table_array as $key => $value) { foreach ($this->table_array as $key => $value) {
@@ -400,7 +400,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
{ {
$key_array = array(); $key_array = array();
if (!is_array($this->table_array)) { if (!is_array($this->table_array)) {
$this->table_array = array (); $this->table_array = array();
} }
reset($this->table_array); reset($this->table_array);
foreach ($this->table_array as $key => $value) { foreach ($this->table_array as $key => $value) {
@@ -427,7 +427,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
if ($this->warning) { if ($this->warning) {
$class = 'warning'; $class = 'warning';
} }
return array ( return array(
'msg' => $this->msg, 'msg' => $this->msg,
'width' => $this->table_width, 'width' => $this->table_width,
'class' => $class '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 // next for functions are pre_test fkts for easier default new,load, etc handling
/** /**
* default load procedure * default load procedure
* @param int $archive_id archive id to load * @param string $archive_id archive id to load
* @return void has no return * @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']) { if ($this->archive && $archive_id && $this->base_acl_level >= $this->security_level['load']) {
$this->formLoadTableArray($archive_id); $this->formLoadTableArray($archive_id);
@@ -520,7 +520,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
!$this->error !$this->error
) { ) {
if (!is_array($element_list)) { if (!is_array($element_list)) {
$element_list = array (); $element_list = array();
} }
for ($i = 0, $i_max = count($element_list); $i < $i_max; $i ++) { 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']); // $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'] !$this->element_list[$element_list[$i]]['delete']
) { ) {
if (!isset($_POST[$id])) { if (!isset($_POST[$id])) {
$_POST[$id] = array (); $_POST[$id] = array();
} }
for ($j = 0, $j_max = count($_POST[$id]); $j < $j_max; $j ++) { for ($j = 0, $j_max = count($_POST[$id]); $j < $j_max; $j ++) {
// if it is not activated // if it is not activated
@@ -594,8 +594,8 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
{ {
$pk_selected = ''; $pk_selected = '';
$t_pk_name = ''; $t_pk_name = '';
$pk_names = array (); $pk_names = array();
$pk_ids = array (); $pk_ids = array();
// when security level is okay ... // when security level is okay ...
if ($this->base_acl_level >= $this->security_level['load']) { if ($this->base_acl_level >= $this->security_level['load']) {
$t_pk_name = $this->archive_pk_name; $t_pk_name = $this->archive_pk_name;
@@ -626,7 +626,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
$pk_names[] = $t_string; $pk_names[] = $t_string;
} }
} // show it at all } // show it at all
return array ( return array(
't_pk_name' => $t_pk_name, 't_pk_name' => $t_pk_name,
'pk_ids' => $pk_ids, 'pk_ids' => $pk_ids,
'pk_names' => $pk_names, 'pk_names' => $pk_names,
@@ -655,7 +655,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
$new_name = $this->l->__('New'); $new_name = $this->l->__('New');
} }
} // security level okay } // security level okay
return array ( return array(
'new_name' => $new_name, 'new_name' => $new_name,
'show_checkbox' => $show_checkbox 'show_checkbox' => $show_checkbox
); );
@@ -742,8 +742,9 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
$data['value'][] = $i; $data['value'][] = $i;
$data['output'][] = $this->table_array[$element_name]['element_list'][$i]; $data['output'][] = $this->table_array[$element_name]['element_list'][$i];
$data['name'] = $element_name; $data['name'] = $element_name;
if (($i && isset($this->table_array[$element_name]['value'])) || if (isset($this->table_array[$element_name]['value']) &&
(!$i && !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']; $data['checked'] = $this->table_array[$element_name]['value'];
} }
@@ -927,7 +928,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
public function formErrorCheck(): void public function formErrorCheck(): void
{ {
if (!is_array($this->table_array)) { if (!is_array($this->table_array)) {
$this->table_array = array (); $this->table_array = array();
} }
reset($this->table_array); reset($this->table_array);
foreach ($this->table_array as $key => $value) { foreach ($this->table_array as $key => $value) {
@@ -1068,7 +1069,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
} }
} }
} else { } else {
$this->reference_array = array (); $this->reference_array = array();
} }
// $this->debug('edit_error', 'QS: <pre>'.print_r($_POST, true).'</pre>'); // $this->debug('edit_error', 'QS: <pre>'.print_r($_POST, true).'</pre>');
if (is_array($this->element_list)) { 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 // 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) { foreach ($this->element_list as $table_name => $reference_array) {
if (!is_array($reference_array)) { if (!is_array($reference_array)) {
$reference_array = array (); $reference_array = array();
} }
// set pk/fk id for this // set pk/fk id for this
$_pk_name = ''; $_pk_name = '';
@@ -1222,7 +1223,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
{ {
unset($this->pk_id); unset($this->pk_id);
if (!is_array($this->table_array)) { if (!is_array($this->table_array)) {
$this->table_array = array (); $this->table_array = array();
} }
reset($this->table_array); reset($this->table_array);
foreach ($this->table_array as $key => $value) { 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)) {
if (!is_array($this->reference_array)) { if (!is_array($this->reference_array)) {
$this->reference_array = array (); $this->reference_array = array();
} }
reset($this->reference_array); reset($this->reference_array);
foreach ($this->reference_array as $key => $value) { foreach ($this->reference_array as $key => $value) {
@@ -1248,10 +1249,10 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
/** /**
* load a table & reference * load a table & reference
* @param int|null $pk_id overrule pk_id * @param string|null $pk_id overrule pk_id
* @return void has no return * @return void has no return
*/ */
public function formLoadTableArray(?int $pk_id = null): void public function formLoadTableArray(?string $pk_id = null): void
{ {
if ($pk_id) { if ($pk_id) {
$this->pk_id = $pk_id; $this->pk_id = $pk_id;
@@ -1260,7 +1261,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
// reset all temp fields // reset all temp fields
if (!is_array($this->table_array)) { if (!is_array($this->table_array)) {
$this->table_array = array (); $this->table_array = array();
} }
reset($this->table_array); reset($this->table_array);
foreach ($this->table_array as $key => $value) { foreach ($this->table_array as $key => $value) {
@@ -1270,7 +1271,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
if (is_array($this->reference_array)) { if (is_array($this->reference_array)) {
// load each reference_table // load each reference_table
if (!is_array($this->reference_array)) { if (!is_array($this->reference_array)) {
$this->reference_array = array (); $this->reference_array = array();
} }
reset($this->reference_array); reset($this->reference_array);
foreach ($this->reference_array as $key => $value) { 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 ... // for drop_down_db_input check if text field is filled and if, if not yet in db ...
// and upload files // and upload files
if (!is_array($this->table_array)) { if (!is_array($this->table_array)) {
$this->table_array = array (); $this->table_array = array();
} }
reset($this->table_array); reset($this->table_array);
foreach ($this->table_array as $key => $value) { foreach ($this->table_array as $key => $value) {
@@ -1408,7 +1409,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
// write reference array(s) if necessary // write reference array(s) if necessary
if (is_array($this->reference_array)) { if (is_array($this->reference_array)) {
if (!is_array($this->reference_array)) { if (!is_array($this->reference_array)) {
$this->reference_array = array (); $this->reference_array = array();
} }
reset($this->reference_array); reset($this->reference_array);
foreach ($this->reference_array as $reference_array) { foreach ($this->reference_array as $reference_array) {
@@ -1423,18 +1424,18 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
} // if reference arrays } // if reference arrays
// write element list // write element list
if (isset($this->element_list) && is_array($this->element_list)) { if (isset($this->element_list) && is_array($this->element_list)) {
$type = array (); $type = array();
reset($this->element_list); reset($this->element_list);
foreach ($this->element_list as $table_name => $reference_array) { foreach ($this->element_list as $table_name => $reference_array) {
// init arrays // init arrays
$q_begin = array (); $q_begin = array();
$q_middle = array (); $q_middle = array();
$q_end = array (); $q_end = array();
$q_names = array (); $q_names = array();
$q_data = array (); $q_data = array();
$q_values = array (); $q_values = array();
$no_write = array (); $no_write = array();
$block_write = array (); $block_write = array();
// get the number of keys from the elements array // get the number of keys from the elements array
$keys = array_keys($reference_array['elements']); $keys = array_keys($reference_array['elements']);
// element prefix name // element prefix name
@@ -1596,7 +1597,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
// remove any reference arrays // remove any reference arrays
if (is_array($this->reference_array)) { if (is_array($this->reference_array)) {
if (!is_array($this->reference_array)) { if (!is_array($this->reference_array)) {
$this->reference_array = array (); $this->reference_array = array();
} }
reset($this->reference_array); reset($this->reference_array);
foreach ($this->reference_array as $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 // remove any element list references
if (is_array($this->element_list)) { if (is_array($this->element_list)) {
if (!is_array($this->element_list)) { if (!is_array($this->element_list)) {
$this->element_list = array (); $this->element_list = array();
} }
reset($this->element_list); reset($this->element_list);
foreach ($this->element_list as $table_name => $data_array) { foreach ($this->element_list as $table_name => $data_array) {
@@ -1617,7 +1618,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
} }
// unlink ALL files // unlink ALL files
if (!is_array($this->table_array)) { if (!is_array($this->table_array)) {
$this->table_array = array (); $this->table_array = array();
} }
reset($this->table_array); reset($this->table_array);
foreach ($this->table_array as $key => $value) { foreach ($this->table_array as $key => $value) {
@@ -1635,11 +1636,11 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
// PARAMS: $hidden_array // PARAMS: $hidden_array
// RETURN: the input fields (html) // RETURN: the input fields (html)
// DESC : creates HTML hidden input fields out of an hash array // 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)) { if (!is_array($this->table_array)) {
$this->table_array = array (); $this->table_array = array();
} }
reset($this->table_array); reset($this->table_array);
foreach ($this->table_array as $key => $value) { foreach ($this->table_array as $key => $value) {
@@ -1728,13 +1729,13 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
// build the select part // build the select part
if (!isset($this->element_list[$table_name]['elements']) || !is_array($this->element_list[$table_name]['elements'])) { 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']); reset($this->element_list[$table_name]['elements']);
// generic data read in (counts for all rows) // generic data read in (counts for all rows)
// visible list data output // visible list data output
$q_select = array (); $q_select = array();
$proto = array (); $proto = array();
foreach ($this->element_list[$table_name]['elements'] as $el_name => $data_array) { foreach ($this->element_list[$table_name]['elements'] as $el_name => $data_array) {
// $this->debug('CFG', 'El: '.$el_name.' -> '.$this->printAr($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 // 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'])) { if (isset($this->element_list[$table_name]['read_data'])) {
// we need a second one for the query build only // we need a second one for the query build only
// prefix all elements with the $table name // prefix all elements with the $table name
$_q_select = array (); $_q_select = array();
foreach ($q_select as $_pos => $element) { foreach ($q_select as $_pos => $element) {
$_q_select[$_pos] = $table_name.'.'.$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 $pos = 0; // position in while for overwrite if needed
// read out the list and add the selected data if needed // read out the list and add the selected data if needed
while ($res = $this->dbReturn($q)) { while ($res = $this->dbReturn($q)) {
$_data = array (); $_data = array();
$prfx = $data['prefix']; // short $prfx = $data['prefix']; // short
// go through each res // go through each res
for ($i = 0, $i_max = count($q_select); $i < $i_max; $i ++) { 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 // 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) { 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 ++) { 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: // the fields that need to be filled are in data->type array:
// pk fields are unfilled // pk fields are unfilled
// fk fields are filled with the fk_id 'int_pk_name' value // 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['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'])); // $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'])) { if (isset($data['delete_name']) && !empty($data['delete_name'])) {
$data['content'][] = $proto; $data['content'][] = $proto;
// we also need the pos add or we through an error in smarty // 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 0 => isset($data['pos']) ? count($data['pos']) : 0
); );
} }
// $this->debug('CFG ELEMENT LIST FILL', 'Data array: '.$this->printAr($data)); // $this->debug('CFG ELEMENT LIST FILL', 'Data array: '.$this->printAr($data));
$type = 'element_list'; $type = 'element_list';
return array ( return array(
'output_name' => $output_name, 'output_name' => $output_name,
'type' => $type, 'type' => $type,
'color' => 'edit_fgcolor', 'color' => 'edit_fgcolor',

View File

@@ -157,7 +157,7 @@ class ProgressBar
$pixel = $bar - ($this->pedding * 2); $pixel = $bar - ($this->pedding * 2);
} }
$position = array (); $position = array();
switch ($this->direction) { switch ($this->direction) {
case 'right': case 'right':
$position['left'] = $this->pedding; $position['left'] = $this->pedding;
@@ -212,7 +212,7 @@ class ProgressBar
*/ */
public function setFrame(int $width = 0, int $height = 0): void public function setFrame(int $width = 0, int $height = 0): void
{ {
$this->frame = array ( $this->frame = array(
'show' => true, 'show' => true,
'left' => 20, 'left' => 20,
'top' => 35, 'top' => 35,

View File

@@ -32,7 +32,7 @@ function MyErrorHandler($type, $message, $file, $line, $context)
return; return;
} }
// ERROR LEVEL // ERROR LEVEL
$error_level = array ( $error_level = array(
1 => 'E_ERROR', 1 => 'E_ERROR',
2 => 'E_WARNING', 2 => 'E_WARNING',
4 => 'E_PARSE', 4 => 'E_PARSE',