Compare commits

..

17 Commits

Author SHA1 Message Date
Clemens Schwaighofer
05c48bce60 Bug fixes for Language and DB\IO class
language class needs to have l var set as public
db\io convert encoding function needs to work with false method
parameters as the return can be false and needs a clean pass through in
this case
2019-09-12 16:53:09 +09:00
Clemens Schwaighofer
b25f280849 Add Base class set/get variable error check, strict updates
The base class has now set/get class variable check handlers.
Default they are off and setting undefined variables in a class works as
before.
The flag can be set to throw an error on an unset var but let var still
be set or also surpress setting and unset var.
This can be controlled via setting for the last parameter in class init
or the global var $CLASS_VARIABLE_ERROR_MODE or in the config file the
constant CLASS_VARIABLE_ERROR_MODE (constant > global). Note that if a
global or constant is set the class constructor setting will be
overridden.

Backend/IO/Basic/Login classes are set to be type safe as much as possible if
called from a strict defined php script.

Added random key generator function to the basic class and removed the
random key definitons from the Backend class.
- randomKeyGen
- initRandomKeyLength

Updated the basic bytes to string and string to bytes functions.

Added hrRunningTime method to use the hrtime for precise running time
calculations. Default returns running time in ms. Can be set via
parameter to ns (lowest), ys, ms, s.
The old runningTime method is still there, but it is recommended to use the
hrRunningTime method instead

Removed Error Handling method in Basic, as there is no need for it
there. The is a master one in lib Folder Error.Handling.inc if needed.

Currently Generate/ArrayIO are not 100% type safe [because they are only
used in the edit_base anyway]
2019-09-11 16:10:28 +09:00
Clemens Schwaighofer
745faacb30 htaccess update with xdebug settings 2019-09-10 17:29:43 +09:00
Clemens Schwaighofer
fd2e0937b5 Fixes for the E_NOTICE fix update
- reference save was not 100% correct with isset/empty checks
- more missing fixes in admin_*inc files for non edit_* pages
- non edit page menu build fix
- fix non set smart core vars
- add update SQL for fixing missing cuid in edit_* tables
2019-09-10 14:33:50 +09:00
Clemens Schwaighofer
6be1b3008e Disable edit base POST debug output 2019-09-10 11:29:09 +09:00
Clemens Schwaighofer
46554e6965 Update to make all class E_NOTICE safe, add page_content
- ALL classes are E_NOTICE safe as far as possible.
There might be some minor things left over which will be cleaned up in
further testing

- Added declare(strict_types=1); on all pages for trying to make all
calls strict

- Added page_content sub content to edit_page, with this some inner page
content with ACL can be set, eg for use with Ajax/JS calls with backend.
Also alias can be set so the control ajax pages can back reference to
the master page content setting. Currently only one back reference is
allowed

- Note that the PAGES array has no numeric indexes, but uses the cuid as
index
2019-09-10 11:05:30 +09:00
Clemens Schwaighofer
c8686024e2 Add .htaccess to override global php settings
This is for working on E_ALL fix for core libs before we can turn it on
global
2019-09-06 18:21:14 +09:00
Clemens Schwaighofer
605ea06bf0 Add additional_acl column to edit_access table
To be able to have special ACL (json) for edit edit access table too
2019-09-03 09:39:12 +09:00
Clemens Schwaighofer
9ec19f5940 Add list ACR, select update for html options JS, array methods in Basic
* ACR list has new list at level 10 for listing but not reading/opening
* JS update for the html options create
if select multi allow selected as array for highlight
* Basic Class
- array merge recursive implementation
proper implementation that proper merges nested arrays. With key is
always string override
- array flat per key
For multi arrays flatten down a key -> value entry to set the value to
the level up in the leaf
eg:
foo -> bar -> KEY: value
and you go by KEY as search it will change to
foo -> bar: value
2019-08-30 13:02:02 +09:00
Clemens Schwaighofer
a27e4603a8 Add deleted to edit_group/user decl, add assoc only return for fetchrow
DB IO Fetchrow has assoc only true/false
Currently only tested with PgSQL

default returns both,
if set true only returns assoc
2019-08-28 18:49:23 +09:00
Clemens Schwaighofer
54b7af348b Add fix for DB Array IO json error_check type field storage on empty save 2019-08-27 16:01:29 +09:00
Clemens Schwaighofer
c5d624a318 Add Additional ACL jsonb field to edit_pages table 2019-08-27 15:15:40 +09:00
Clemens Schwaighofer
47ffec1fd4 Add JSON additional ACL field to edit user page 2019-08-26 11:18:21 +09:00
Clemens Schwaighofer
72c6844e74 Jquery update to 3.4.1 2019-07-31 17:59:13 +09:00
Clemens Schwaighofer
d0753512a3 Fix path calls, add better js html options block
in admin set paths, only call smarty sets if smarty object is initalized

Add better JS html options creation with multi block allow. Old call is
still there as wrapper to new call html_options_block

missing variable init in Class Basic
2019-07-31 15:36:28 +09:00
Clemens Schwaighofer
d0de3821f8 Basic class date diff calc fix for including last day 2019-07-08 12:02:15 +09:00
Clemens Schwaighofer
0d89eea1af Basic class fix for calc interval, smarty test page fix
- smarty test page used old variable names
- the interval date calc function was private but should be public
static
2019-06-28 11:50:40 +09:00
61 changed files with 2553 additions and 1429 deletions

28
.htaccess Normal file
View File

@@ -0,0 +1,28 @@
# PHP XDEBUG SETTINGS
# php_value xdebug.profiler_output_dir xdebug/
# php_value xdebug.profiler_output_name timestamp
# php_value xdebug.profiler_enable 1
php_value xdebug.collect_params 2
php_value xdebug.collect_vars 0
php_value xdebug.show_local_vars 0
#php_value xdebug.dump_globals 0
# allowed COOKIE, FILES, GET, POST, REQUEST, SERVER, SESSION
#php_value xdebug.dump.GET *
# PHP ERROR SETTINGS
php_flag display_startup_errors on
php_flag display_errors on
php_flag html_errors on
php_flag log_errors on
php_flag ignore_repeated_errors off
php_flag ignore_repeated_source off
php_flag report_memleaks on
php_flag track_errors on
php_value docref_root 0
php_value docref_ext 0
# Turn this on to redirect log to different folder
#php_value error_log /var/www/html/developers/clemens/php/php-error/php-errors.log
# this is E_ALL reporting ON
php_value error_reporting -1
# this is E_ALL | ~E_NOTICE
#php_value error_reporting 2039
php_value log_errors_max_len 0

1
.phplint-cache Normal file

File diff suppressed because one or more lines are too long

View File

@@ -51,6 +51,7 @@ INSERT INTO edit_page_menu_group VALUES ((SELECT edit_page_id FROM edit_page WHE
DELETE FROM edit_access_right;
INSERT INTO edit_access_right (name, level, type) VALUES ('Default', -1, 'default');
INSERT INTO edit_access_right (name, level, type) VALUES ('No Access', 0, 'none');
INSERT INTO edit_access_right (name, level, type) VALUES ('List', 10, 'list');
INSERT INTO edit_access_right (name, level, type) VALUES ('Read', 20, 'read');
INSERT INTO edit_access_right (name, level, type) VALUES ('Translator', 30, 'mod_trans');
INSERT INTO edit_access_right (name, level, type) VALUES ('Modify', 40, 'mod');

View File

@@ -14,5 +14,6 @@ CREATE TABLE edit_access (
uid VARCHAR,
enabled SMALLINT NOT NULL DEFAULT 0,
protected INT,
deleted SMALLINT DEFAULT 0
deleted SMALLINT DEFAULT 0,
additional_acl JSONB
) INHERITS (edit_generic) WITHOUT OIDS;

View File

@@ -10,8 +10,10 @@ CREATE TABLE edit_group (
edit_group_id SERIAL PRIMARY KEY,
name VARCHAR,
enabled SMALLINT NOT NULL DEFAULT 0,
deleted SMALLINT DEFAULT 0,
edit_scheme_id INT,
edit_access_right_id INT NOT NULL,
additional_acl JSONB,
FOREIGN KEY (edit_scheme_id) REFERENCES edit_scheme (edit_scheme_id) MATCH FULL ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (edit_access_right_id) REFERENCES edit_access_right (edit_access_right_id) MATCH FULL ON DELETE CASCADE ON UPDATE CASCADE
) INHERITS (edit_generic) WITHOUT OIDS;

View File

@@ -2,12 +2,13 @@
-- DATE: 2005/07/05
-- DESCRIPTION:
-- edit tables, this table contains all pages in the edit interface and allocates rights + values to it
-- TABLE: edit_table
-- TABLE: edit_page
-- HISTORY:
-- DROP TABLE edit_page;
CREATE TABLE edit_page (
edit_page_id SERIAL PRIMARY KEY,
content_alias_edit_page_id INT, -- alias for page content, if the page content is defined on a different page, ege for ajax backend pages
filename VARCHAR,
name VARCHAR UNIQUE,
order_number INT NOT NULL,
@@ -15,5 +16,6 @@ CREATE TABLE edit_page (
menu SMALLINT NOT NULL DEFAULT 0,
popup SMALLINT NOT NULL DEFAULT 0,
popup_x SMALLINT,
popup_y SMALLINT
popup_y SMALLINT,
FOREIGN KEY (content_alias_edit_page_id) REFERENCES edit_page (edit_page_id) MATCH FULL ON DELETE RESTRICT ON UPDATE CASCADE,
) INHERITS (edit_generic) WITHOUT OIDS;

View File

@@ -0,0 +1,20 @@
-- AUTHOR: Clemens Schwaighofer
-- DATE: 2019/9/9
-- DESCRIPTION:
-- sub content to one page with additional edit access right set
-- can be eg JS content groups on one page
-- TABLE: edit_page_content
-- HISTORY:
-- DROP TABLE edit_page_content;
CREATE TABLE edit_page_content (
edit_page_content_id SERIAL PRIMARY KEY,
edit_page_id INT NOT NULL,
edit_access_right_id INT NOT NULL,
name VARCHAR,
uid VARCHAR UNIQUE,
order_number INT NOT NULL,
online SMALLINT NOT NULL DEFAULT 0,
FOREIGN KEY (edit_access_right_id) REFERENCES edit_access_right (edit_access_right_id) MATCH FULL ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (edit_page_id) REFERENCES edit_page (edit_page_id) MATCH FULL ON DELETE CASCADE ON UPDATE CASCADE
) INHERITS (edit_generic) WITHOUT OIDS;

View File

@@ -16,6 +16,7 @@ CREATE TABLE edit_user (
first_name_furigana VARCHAR,
last_name_furigana VARCHAR,
enabled SMALLINT NOT NULL DEFAULT 0,
deleted SMALLINT NOT NULL DEFAULT 0,
debug SMALLINT NOT NULL DEFAULT 0,
db_debug SMALLINT NOT NULL DEFAULT 0,
email VARCHAR,
@@ -32,6 +33,7 @@ CREATE TABLE edit_user (
locked SMALLINT DEFAULT 0,
password_change_date TIMESTAMP WITHOUT TIME ZONE, -- only when password is first set or changed
password_change_interval INTERVAL, -- null if no change is needed, or d/m/y time interval
additional_acl JSONB, -- additional ACL as JSON string (can be set by other pages)
FOREIGN KEY (connect_edit_user_id) REFERENCES edit_user (edit_user_id) MATCH FULL ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (edit_language_id) REFERENCES edit_language (edit_language_id) MATCH FULL ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (edit_group_id) REFERENCES edit_group (edit_group_id) MATCH FULL ON DELETE CASCADE ON UPDATE CASCADE,

View File

@@ -0,0 +1,4 @@
DROP TRIGGER trg_edit_page_content ON edit_page_content;
CREATE TRIGGER trg_edit_page_content
BEFORE INSERT OR UPDATE ON edit_page_content
FOR EACH ROW EXECUTE PROCEDURE set_edit_generic();

View File

@@ -0,0 +1,17 @@
-- 2019/9/10 UPDATE missing cuid in edit_* tables
UPDATE edit_access SET cuid = random_string(12) WHERE cuid IS NULL;
UPDATE edit_access_data SET cuid = random_string(12) WHERE cuid IS NULL;
UPDATE edit_access_right SET cuid = random_string(12) WHERE cuid IS NULL;
UPDATE edit_access_user SET cuid = random_string(12) WHERE cuid IS NULL;
UPDATE edit_group SET cuid = random_string(12) WHERE cuid IS NULL;
UPDATE edit_language SET cuid = random_string(12) WHERE cuid IS NULL;
UPDATE edit_log SET cuid = random_string(12) WHERE cuid IS NULL;
UPDATE edit_menu_group SET cuid = random_string(12) WHERE cuid IS NULL;
UPDATE edit_page SET cuid = random_string(12) WHERE cuid IS NULL;
UPDATE edit_page_access SET cuid = random_string(12) WHERE cuid IS NULL;
UPDATE edit_page_content SET cuid = random_string(12) WHERE cuid IS NULL;
UPDATE edit_query_string SET cuid = random_string(12) WHERE cuid IS NULL;
UPDATE edit_scheme SET cuid = random_string(12) WHERE cuid IS NULL;
UPDATE edit_user SET cuid = random_string(12) WHERE cuid IS NULL;
UPDATE edit_visible_group SET cuid = random_string(12) WHERE cuid IS NULL;

View File

@@ -0,0 +1,7 @@
-- 2019/9/10 update edit_page with reference
-- page content reference settings
-- UPDATE
ALTER TABLE edit_page ADD content_alias_edit_page_id INT;
ALTER TABLE edit_page ADD CONSTRAINT edit_page_content_alias_edit_page_id_fkey FOREIGN KEY (content_alias_edit_page_id) REFERENCES edit_page (edit_page_id) MATCH FULL ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
$DEBUG_ALL = 1;
@@ -30,10 +30,19 @@ $basic = new CoreLibs\Admin\Backend($DB_CONFIG[MAIN_DB], $lang);
$basic->dbInfo(1);
ob_end_flush();
$basic->hrRunningTime();
$basic->runningTime();
echo "RANDOM KEY [50]: ".$basic->randomKeyGen(50)."<br>";
echo "TIMED [hr]: ".$basic->hrRunningTime()."<br>";
echo "TIMED [def]: ".$basic->runningTime()."<br>";
$basic->hrRunningTime();
echo "RANDOM KEY [default]: ".$basic->randomKeyGen()."<br>";
echo "TIMED: ".$basic->hrRunningTime()."<br>";
// set + check edit access id
$edit_access_id = 3;
if (isset($login) && is_object($login) && isset($login->acl['unit'])) {
print "ACL UNIT: ".print_r(array_keys($login->acl['unit']), 1)."<br>";
print "ACL UNIT: ".print_r(array_keys($login->acl['unit']), true)."<br>";
print "ACCESS CHECK: ".$login->loginCheckEditAccess($edit_access_id)."<br>";
if ($login->loginCheckEditAccess($edit_access_id)) {
$basic->edit_access_id = $edit_access_id;
@@ -87,22 +96,22 @@ while ($res = $basic->dbReturn("SELECT * FROM max_test")) {
}
$status = $basic->dbExec("INSERT INTO foo (test) VALUES ('FOO TEST ".time()."') RETURNING test");
print "DIRECT INSERT STATUS: $status | PRIMARY KEY: ".$basic->insert_id." | PRIMARY KEY EXT: ".print_r($basic->insert_id_ext, 1)."<br>";
print "DIRECT INSERT PREVIOUS INSERTED: ".print_r($basic->dbReturnRow("SELECT foo_id, test FROM foo WHERE foo_id = ".$basic->insert_id), 1)."<br>";
print "DIRECT INSERT STATUS: $status | PRIMARY KEY: ".$basic->insert_id." | PRIMARY KEY EXT: ".print_r($basic->insert_id_ext, true)."<br>";
print "DIRECT INSERT PREVIOUS INSERTED: ".print_r($basic->dbReturnRow("SELECT foo_id, test FROM foo WHERE foo_id = ".$basic->insert_id), true)."<br>";
$basic->dbPrepare("ins_foo", "INSERT INTO foo (test) VALUES ($1)");
$status = $basic->dbExecute("ins_foo", array('BAR TEST '.time()));
print "PREPARE INSERT STATUS: $status | PRIMARY KEY: ".$basic->insert_id." | PRIMARY KEY EXT: ".print_r($basic->insert_id_ext, 1)."<br>";
print "PREPARE INSERT PREVIOUS INSERTED: ".print_r($basic->dbReturnRow("SELECT foo_id, test FROM foo WHERE foo_id = ".$basic->insert_id), 1)."<br>";
print "PREPARE INSERT STATUS: $status | PRIMARY KEY: ".$basic->insert_id." | PRIMARY KEY EXT: ".print_r($basic->insert_id_ext, true)."<br>";
print "PREPARE INSERT PREVIOUS INSERTED: ".print_r($basic->dbReturnRow("SELECT foo_id, test FROM foo WHERE foo_id = ".$basic->insert_id), true)."<br>";
// returning test with multiple entries
// $status = $basic->db_exec("INSERT INTO foo (test) values ('BAR 1 ".time()."'), ('BAR 2 ".time()."'), ('BAR 3 ".time()."') RETURNING foo_id");
$status = $basic->dbExec("INSERT INTO foo (test) values ('BAR 1 ".time()."'), ('BAR 2 ".time()."'), ('BAR 3 ".time()."') RETURNING foo_id, test");
print "DIRECT MULTIPLE INSERT STATUS: $status | PRIMARY KEYS: ".print_r($basic->insert_id, 1)." | PRIMARY KEY EXT: ".print_r($basic->insert_id_ext, 1)."<br>";
print "DIRECT MULTIPLE INSERT STATUS: $status | PRIMARY KEYS: ".print_r($basic->insert_id, true)." | PRIMARY KEY EXT: ".print_r($basic->insert_id_ext, true)."<br>";
// no returning, but not needed ;
$status = $basic->dbExec("INSERT INTO foo (test) VALUES ('FOO; TEST ".time()."');");
print "DIRECT INSERT STATUS: $status | PRIMARY KEY: ".$basic->insert_id." | PRIMARY KEY EXT: ".print_r($basic->insert_id_ext, 1)."<br>";
print "DIRECT INSERT STATUS: $status | PRIMARY KEY: ".$basic->insert_id." | PRIMARY KEY EXT: ".print_r($basic->insert_id_ext, true)."<br>";
// UPDATE WITH RETURNING
$status = $basic->dbExec("UPDATE foo SET test = 'SOMETHING DIFFERENT' WHERE foo_id = 3688452 RETURNING test");
print "UPDATE STATUS: $status | RETURNING EXT: ".print_r($basic->insert_id_ext, 1)."<br>";
print "UPDATE STATUS: $status | RETURNING EXT: ".print_r($basic->insert_id_ext, true)."<br>";
# db write class test
$table = 'foo';
@@ -125,6 +134,11 @@ $data = array ('test' => 'BOOL TEST UNSET '.time());
$primary_key = $basic->dbWriteDataExt($db_write_table, $primary_key, $table, $object_fields_not_touch, $object_fields_not_update, $data);
print "Wrote to DB tabel $table and got primary key $primary_key<br>";
// return Array Test
$query = "SELECT type, sdate, integer FROM foobar";
$data = $basic->dbReturnArray($query, true);
print "Full foobar list: <br><pre>".print_r($data, true)."</pre><br>";
# async test queries
/* $basic->dbExecAsync("SELECT test FROM foo, (SELECT pg_sleep(10)) as sub WHERE foo_id IN (27, 50, 67, 44, 10)");
echo "WAITING FOR ASYNC: ";
@@ -156,7 +170,7 @@ while (($ret = $basic->dbCheckAsync()) === true)
flush();
}
print "<br>END STATUS: ".$ret." | PK: ".$basic->insert_id."<br>";
print "ASYNC PREVIOUS INSERTED: ".print_r($basic->dbReturnRow("SELECT foo_id, test FROM foo WHERE foo_id = ".$basic->insert_id), 1)."<br>"; */
print "ASYNC PREVIOUS INSERTED: ".print_r($basic->dbReturnRow("SELECT foo_id, test FROM foo WHERE foo_id = ".$basic->insert_id), true)."<br>"; */
$to_db_version = '9.1.9';
print "VERSION DB: ".$basic->dbVersion()."<br>";

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
$DEBUG_ALL = 1;

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
// debug for L10n issues in php 7.3

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
declare(strict_types=1);

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
namespace Foo;

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
$ENABLE_ERROR_HANDLING = 0;
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
$DEBUG_ALL = 1;
@@ -15,11 +15,12 @@ $TEMPLATE_NAME = 'smarty_test.tpl';
$CSS_NAME = 'smart_test.css';
$USE_PROTOTYPE = false;
$USE_JQUERY = true;
$JS_DATEPICKR = false;
if ($USE_PROTOTYPE) {
$EDIT_JAVASCRIPT = 'edit.pt.js';
$ADMIN_JAVASCRIPT = 'edit.pt.js';
$JS_NAME = 'prototype.test.js';
} else if ($USE_JQUERY) {
$EDIT_JAVASCRIPT = 'edit.jq.js';
} elseif ($USE_JQUERY) {
$ADMIN_JAVASCRIPT = 'edit.jq.js';
$JS_NAME = 'jquery.test.js';
}
$PAGE_WIDTH = "100%";

View File

@@ -146,6 +146,13 @@ DEFINE('DEFAULT_ENCODING', 'UTF-8');
/************* LOGGING *******************/
// DEFINE('LOG_FILE_ID', '');
/************* CLASS ERRORS *******************/
// 0 = default all OFF
// 1 = throw notice on unset class var
// 2 = no notice on unset class var, but do not set undefined class var
// 3 = throw error and do not set class var
define('CLASS_VARIABLE_ERROR_MODE', 3);
/************* QUEUE TABLE *************/
// if we have a dev/live system
// set_live is a per page/per item
@@ -255,6 +262,7 @@ if (defined('DEBUG') && DEBUG == false) {
$DEBUG_ALL = 1;
$PRINT_ALL = 1;
$DB_DEBUG = 1;
$ENABLE_ERROR_HANDLING = 0;
}
// read auto loader

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/********************************************************************
* AUTHOR: Clemens Schwaighofer
* CREATED: 2018/10/11

View File

@@ -1,3 +1,3 @@
<?php
<?php declare(strict_types=1);
require 'config.php';

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/********************************************************************
* AUTHOR: Clemens Schwaighofer
* CREATED: 2005/07/19

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/********************************************************************
* AUTHOR: Clemens Schwaighofer
* CREATED: 2008/08/14

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/********************************************************************
* AUTHOR: Clemens Schwaighofer
* CREATED: 2008/08/01
@@ -22,6 +22,8 @@ extract($_POST, EXTR_SKIP);
//------------------------------ library include start
// set output to quiet for load of classes & session settings
ob_start();
// set the session name
define('SET_SESSION_NAME', EDIT_SESSION_NAME);
//------------------------------ library include end
//------------------------------ basic variable settings start
@@ -39,7 +41,7 @@ if (session_id() && $_SESSION['DEFAULT_LANG']) {
if (array_key_exists('action', $_POST) && $_POST['action'] != 'download_csv') {
header("Content-type: text/html; charset=".$encoding);
}
if ($AJAX_PAGE && !$ZIP_STREAM) {
if (isset($AJAX_PAGE) && isset($ZIP_STREAM) && $AJAX_PAGE && !$ZIP_STREAM) {
header("Content-Type: application/json; charset=UTF-8");
}
//------------------------------ basic variable settings start
@@ -84,7 +86,7 @@ if (!$login->login) {
//------------------------------ page rights start
// flag if to show the edit access id drop down list
// check if we have more than one EA ID
$cms->DATA['show_ea_extra'] = $login->acl['acl']['show_ea_extra'];
$cms->DATA['show_ea_extra'] = $login->acl['show_ea_extra'];
//------------------------------ page rights ned
// automatic hide for DEBUG messages on live server

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/********************************************************************
* AUTHOR: Clemens Schwaighofer
* CREATED: 2007/09/03
@@ -36,7 +36,7 @@ if (!isset($CONTENT_INCLUDE)) {
}
$FORM_NAME = !isset($FORM_NAME) || !$FORM_NAME ? str_replace(".php", "", $cms->page_name) : $FORM_NAME;
// set local page title
$L_TITLE = ucfirst(str_replace('_', ' ', $cms->getPageName(1))).' - '.$G_TITLE;
$L_TITLE = ucfirst(str_replace('_', ' ', $cms->getPageName(1))).(defined(G_TITLE) ? ' - '.G_TITLE : '');
// strip tpl and replace it with inc
// php include file per page
$cms->INC_TEMPLATE_NAME = str_replace(".tpl", ".inc", $CONTENT_INCLUDE);
@@ -78,7 +78,7 @@ if (file_exists($cms->includes.$cms->INC_TEMPLATE_NAME) &&
include($cms->includes.$cms->INC_TEMPLATE_NAME);
}
// only CSS/JS/etc include stuff if we have non AJAX page
if (!$AJAX_PAGE) {
if (isset($AJAX_PAGE) && !$AJAX_PAGE) {
// check for template include
if (isset($USE_INCLUDE_TEMPLATE) && $USE_INCLUDE_TEMPLATE === true && !isset($TEMPLATE_NAME)) {
$TEMPLATE_NAME = $CONTENT_INCLUDE;
@@ -106,13 +106,15 @@ if (!$AJAX_PAGE) {
if (file_exists($cms->javascript.$cms->JS_SPECIAL_TEMPLATE_NAME) && is_file($cms->javascript.$cms->JS_SPECIAL_TEMPLATE_NAME)) {
$cms->JS_SPECIAL_INCLUDE = $cms->javascript.$cms->JS_SPECIAL_TEMPLATE_NAME;
}
// check if template names exist
if (!file_exists($smarty->getTemplateDir()[0].DS.$MASTER_TEMPLATE_NAME)) {
// abort if master template could not be found
exit('MASTER TEMPLATE: '.$MASTER_TEMPLATE_NAME.' could not be found');
}
if (isset($TEMPLATE_NAME) && !file_exists($smarty->getTemplateDir()[0].DS.$TEMPLATE_NAME)) {
exit('INCLUDE TEMPLATE: '.$TEMPLATE_NAME.' could not be found');
if ($smarty) {
// check if template names exist
if (!file_exists($smarty->getTemplateDir()[0].DS.$MASTER_TEMPLATE_NAME)) {
// abort if master template could not be found
exit('MASTER TEMPLATE: '.$MASTER_TEMPLATE_NAME.' could not be found');
}
if (isset($TEMPLATE_NAME) && !file_exists($smarty->getTemplateDir()[0].DS.$TEMPLATE_NAME)) {
exit('INCLUDE TEMPLATE: '.$TEMPLATE_NAME.' could not be found');
}
}
}
@@ -133,9 +135,9 @@ if (false === strstr(BASE.INCLUDES.LANG.CONTENT_PATH, $cms->lang_dir) ||
}
}
if (!$AJAX_PAGE) {
if (isset($AJAX_PAGE) && !$AJAX_PAGE) {
// javascript translate data as template for auto translate
if (!$TEMPLATE_TRANSLATE) {
if (empty($TEMPLATE_TRANSLATE)) {
$TEMPLATE_TRANSLATE = 'jsTranslate_'.$lang.'.tpl';
$cms->debug('LANG', 'Load lang: '.$lang.', for page file '.$TEMPLATE_TRANSLATE);
} else {

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/********************************************************************
* AUTHOR: Clemens Schwaighofer
* CREATED: 2005/07/12
@@ -16,6 +16,31 @@ if ($cms->HEADER['USE_PROTOTYPE']) {
// jquery and prototype should not be used together
$cms->HEADER['USE_JQUERY'] = isset($USE_JQUERY) ? $USE_JQUERY : USE_JQUERY; // don't use either of those two together
// check if we have an external file with the template name
if (file_exists($cms->includes.$cms->INC_TEMPLATE_NAME) && is_file($cms->includes.$cms->INC_TEMPLATE_NAME)) {
include($cms->includes.$cms->INC_TEMPLATE_NAME);
}
// additional per page Javascript include
$cms->JS_INCLUDE = '';
if (file_exists($cms->javascript.$cms->JS_TEMPLATE_NAME) && is_file($cms->javascript.$cms->JS_TEMPLATE_NAME)) {
$cms->JS_INCLUDE = $cms->javascript.$cms->JS_TEMPLATE_NAME;
}
// per page css file
$cms->CSS_INCLUDE = '';
if (file_exists($cms->css.$cms->CSS_TEMPLATE_NAME) && is_file($cms->css.$cms->CSS_TEMPLATE_NAME)) {
$cms->CSS_INCLUDE = $cms->css.$cms->CSS_TEMPLATE_NAME;
}
// optional CSS file
$cms->CSS_SPECIAL_INCLUDE = '';
if (file_exists($cms->css.$cms->CSS_SPECIAL_TEMPLATE_NAME) && is_file($cms->css.$cms->CSS_SPECIAL_TEMPLATE_NAME)) {
$cms->CSS_SPECIAL_INCLUDE = $cms->css.$cms->CSS_SPECIAL_TEMPLATE_NAME;
}
// optional JS file
$cms->JS_SPECIAL_INCLUDE = '';
if (file_exists($cms->javascript.$cms->JS_SPECIAL_TEMPLATE_NAME) && is_file($cms->javascript.$cms->JS_SPECIAL_TEMPLATE_NAME)) {
$cms->JS_SPECIAL_INCLUDE = $cms->javascript.$cms->JS_SPECIAL_TEMPLATE_NAME;
}
// the actual include files for javascript (per page)
$cms->HEADER['JS_INCLUDE'] = $cms->JS_INCLUDE;
$cms->HEADER['CSS_INCLUDE'] = $cms->CSS_INCLUDE;
@@ -54,6 +79,9 @@ $cms->DATA['CONTENT_INCLUDE'] = $CONTENT_INCLUDE;
// LANG
$cms->DATA['LANG'] = $lang;
$cms->DATA['TINYMCE_LANG'] = $lang_short;
$cms->DATA['USE_TINY_MCE'] = isset($USE_TINY_MCE) ? $USE_TINY_MCE : false;
$cms->DATA['JS_DATEPICKR'] = isset($JS_DATEPICKR) ? $JS_DATEPICKR : false;
$cms->DATA['JS_FLATPICKR'] = isset($JS_FLATPICKR) ? $JS_FLATPICKR : false;
// debug data, if DEBUG flag is on, this data is print out
$cms->DEBUG_DATA['debug_error_msg'] = $cms->runningTime();

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/********************************************************************
* AUTHOR: Clemens "Gullevek" Schwaighofer (www.gullevek.org)
* CREATED: 2003/06/10
@@ -41,7 +41,7 @@ if (!DEBUG) {
}
// set default lang if not set otherwise
if (!$lang) {
if (!isset($lang)) {
$lang = DEFAULT_LANG;
}
// should be utf8
@@ -58,6 +58,8 @@ if ($form->mobile_phone) {
// smarty template engine (extended Translation version)
$smarty = new CoreLibs\Template\SmartyExtend($lang);
// $form->debug('POST', $form->printAr($_POST));
if (TARGET == 'live' || TARGET == 'remote') {
// login
$login->debug_output_all = DEBUG ? 1 : 0;
@@ -123,7 +125,7 @@ if ($form->my_page_name == 'edit_order') {
// there are the POSITION stored, that should CHANGE there order (up/down)
// $row_data_id ... has ALL ids from the sorting part
// $row_data_order ... has ALL order positions from the soirting part
if (!is_array($position)) {
if (!isset($position)) {
$position = array ();
}
if (count($position)) {
@@ -131,7 +133,7 @@ if ($form->my_page_name == 'edit_order') {
// FIRST u have to put right sort, then read again ...
// hast to be >0 or the first one is selected and then there is no move
if ($up && $position[0] > 0) {
if (isset($up) && $position[0] > 0) {
for ($i = 0; $i < count($position); $i++) {
// change position order
// this gets temp, id before that, gets actual (moves one "down")
@@ -146,7 +148,7 @@ if ($form->my_page_name == 'edit_order') {
} // if up
// the last position id from position array is not to be the count-1 of row_data_id array, or it is the last element
if ($down && ($position[count($position) - 1] != (count($row_data_id) - 1))) {
if (isset($down) && ($position[count($position) - 1] != (count($row_data_id) - 1))) {
for ($i = count($position) - 1; $i >= 0; $i --) {
// same as up, just up in other way, starts from bottom (last element) and moves "up"
// element before actuel gets temp, this element, becomes element after this,
@@ -158,7 +160,9 @@ if ($form->my_page_name == 'edit_order') {
} // if down
// write data ... (which has to be abstrackt ...)
if (($up && $position[0] > 0) || ($down && ($position[count($position) - 1]!=(count($row_data_id) - 1)))) {
if ((isset($up) && $position[0] > 0) ||
(isset($down) && ($position[count($position) - 1] != (count($row_data_id) - 1)))
) {
for ($i = 0; $i < count($row_data_id); $i ++) {
$q = "UPDATE ".$table_name." SET order_number = ".$row_data_order[$i]." WHERE ".$table_name."_id = ".$row_data_id[$i];
$q = $form->dbExec($q);
@@ -168,7 +172,7 @@ if ($form->my_page_name == 'edit_order') {
// get ...
$q = "SELECT ".$table_name."_id, name, order_number FROM ".$table_name." ";
if ($where_string) {
if (!empty($where_string)) {
$q .= "WHERE $where_string ";
}
$q .= "ORDER BY order_number";
@@ -184,8 +188,9 @@ if ($form->my_page_name == 'edit_order') {
// html title
$HEADER['HTML_TITLE'] = $form->l->__('Edit Order');
$messages = array ();
// error msg
if ($error) {
if (isset($error)) {
$messages[] = array ('msg' => $msg, 'class' => 'error', 'width' => '100%');
}
$DATA['form_error_msg'] = $messages;
@@ -199,11 +204,11 @@ if ($form->my_page_name == 'edit_order') {
}
for ($i = 0; $i < count($row_data); $i ++) {
$options_id[] = $i;
$options_name[] = $row_data[$i]["name"];
$options_name[] = $row_data[$i]['name'];
// list of points to order
for ($j = 0; $j < count($position); $j++) {
// if matches, put into select array
if ($original_id[$position[$j]] == $row_data[$i]["id"]) {
if ($original_id[$position[$j]] == $row_data[$i]['id']) {
$options_selected[] = $i;
}
}
@@ -216,23 +221,29 @@ if ($form->my_page_name == 'edit_order') {
$row_data_id = array ();
$row_data_order = array ();
for ($i = 0; $i < count($row_data); $i++) {
$row_data_id[] = $row_data[$i]["id"];
$row_data_order[] = $row_data[$i]["order"];
$row_data_id[] = $row_data[$i]['id'];
$row_data_order[] = $row_data[$i]['order'];
}
$DATA['row_data_id'] = $row_data_id;
$DATA['row_data_order'] = $row_data_order;
// hidden names for the table & where string
$DATA['table_name'] = $table_name;
$DATA['where_string'] = $where_string;
$DATA['where_string'] = isset($where_string) ? $where_string : '';
$EDIT_TEMPLATE = 'edit_order.tpl';
} else {
$form->formProcedureLoad(${$form->archive_pk_name});
// load call only if id is set
if (isset(${$form->archive_pk_name})) {
$form->formProcedureLoad(${$form->archive_pk_name});
}
$form->formProcedureNew();
$form->formProcedureSave();
$form->formProcedureDelete();
$form->formProcedureDeleteFromElementList($element_list, $remove_name);
// delete call only if those two are set
if (isset($element_list) && isset($remove_name)) {
$form->formProcedureDeleteFromElementList($element_list, $remove_name);
}
$DATA['table_width'] = $table_width;
@@ -242,26 +253,26 @@ if ($form->my_page_name == 'edit_order') {
// MENU START
// request some session vars
if (!$HEADER_COLOR) {
$DATA['HEADER_COLOR'] = "#E0E2FF";
if (!isset($HEADER_COLOR)) {
$DATA['HEADER_COLOR'] = '#E0E2FF';
} else {
$DATA['HEADER_COLOR'] = $_SESSION['HEADER_COLOR'];
}
$DATA['USER_NAME'] = $_SESSION["USER_NAME"];
$DATA['EUID'] = $_SESSION["EUID"];
$DATA['GROUP_NAME'] = $_SESSION["GROUP_NAME"];
$DATA['GROUP_LEVEL'] = $_SESSION["GROUP_LEVEL"];
$PAGES = $_SESSION["PAGES"];
$DATA['USER_NAME'] = $_SESSION['USER_NAME'];
$DATA['EUID'] = $_SESSION['EUID'];
$DATA['GROUP_NAME'] = $_SESSION['GROUP_NAME'];
$DATA['GROUP_LEVEL'] = $_SESSION['GROUP_ACL_LEVEL'];
$PAGES = $_SESSION['PAGES'];
//$form->debug('menu', $form->printAr($PAGES));
// build nav from $PAGES ...
if (!is_array($PAGES)) {
if (!isset($PAGES) || !is_array($PAGES)) {
$PAGES = array ();
}
for ($i = 0, $i_max = count($PAGES); $i < $i_max; $i ++) {
if ($PAGES[$i]["menu"] && $PAGES[$i]["online"]) {
$menuarray[] = $PAGES[$i];
foreach ($PAGES as $PAGE_CUID => $PAGE_DATA) {
if ($PAGE_DATA['menu'] && $PAGE_DATA['online']) {
$menuarray[] = $PAGE_DATA;
}
}
@@ -276,34 +287,44 @@ if ($form->my_page_name == 'edit_order') {
}
}
$position = 0;
for ($i = 1; $i <= count($menuarray); $i ++) {
// do that for new array
$j = $i - 1;
$menu_data[$j]['pagename'] = htmlentities($menuarray[($i-1)]["page_name"]);
$menu_data[$j]['filename'] = $menuarray[($i-1)]["filename"].$menuarray[($i-1)]["query_string"];
if ($i == 1 || !(($i - 1) % $SPLIT_FACTOR)) {
$menu_data[$j]['pagename'] = htmlentities($menuarray[($i-1)]['page_name']);
$menu_data[$j]['filename'] = $menuarray[($i-1)]['filename'].(isset($menuarray[$j]['query_string']) ? $menuarray[$j]['query_string'] : '');
if ($i == 1 || !($j % $SPLIT_FACTOR)) {
$menu_data[$j]['splitfactor_in'] = 1;
} else {
$menu_data[$j]['splitfactor_in'] = 0;
}
if ($menuarray[($i - 1)]["filename"] == $form->getPageName()) {
$position = $i - 1;
if ($menuarray[$j]['filename'] == $form->getPageName()) {
$position = $j;
$menu_data[$j]['position'] = 1;
$menu_data[$j]['popup'] = 0;
} else {
// add query stuff
// HAS TO DONE LATER ... set urlencode, etc ...
// check if popup needed
if ($menuarray[($i - 1)]["popup"]) {
if (isset($menuarray[$j]['popup']) && $menuarray[$j]['popup'] == 1) {
$menu_data[$j]['popup'] = 1;
$menu_data[$j]['rand'] = uniqid(rand());
$menu_data[$j]['width'] = $menuarray[($i-1)]["popup_x"];
$menu_data[$j]['height'] = $menuarray[($i-1)]["popup_y"];
} // popup or not
$menu_data[$j]['rand'] = uniqid((string)rand());
$menu_data[$j]['width'] = $menuarray[$j]['popup_x'];
$menu_data[$j]['height'] = $menuarray[$j]['popup_y'];
} else {
$menu_data[$j]['popup'] = 0;
}
$menu_data[$j]['position'] = 0;
} // highlight or not
if (!($i % $SPLIT_FACTOR) || (($i + 1) > count($menuarray))) {
$menu_data[$j]['splitfactor_out'] = 1;
} // split
} else {
$menu_data[$j]['splitfactor_out'] = 0;
}
} // for
// $form->debug('MENU ARRAY', $form->printAr($menu_data));
$DATA['menu_data'] = $menu_data;
$DATA['page_name'] = $menuarray[$position]["page_name"];
$DATA['page_name'] = $menuarray[$position]['page_name'];
$L_TITLE = $DATA['page_name'];
// html title
$HEADER['HTML_TITLE'] = $form->l->__($L_TITLE);
@@ -315,115 +336,124 @@ if ($form->my_page_name == 'edit_order') {
if ($form->yes) {
$DATA['form_yes'] = $form->yes;
$DATA['form_my_page_name'] = $form->my_page_name;
$DATA['filename_exist'] = 0;
$DATA['drop_down_input'] = 0;
// depending on the "getPageName()" I show different stuff
switch ($form->my_page_name) {
case "edit_users":
$elements[] = $form->formCreateElement("login_error_count");
$elements[] = $form->formCreateElement("login_error_date_last");
$elements[] = $form->formCreateElement("login_error_date_first");
$elements[] = $form->formCreateElement("enabled");
$elements[] = $form->formCreateElement("protected");
$elements[] = $form->formCreateElement("username");
$elements[] = $form->formCreateElement("password");
$elements[] = $form->formCreateElement("password_change_interval");
$elements[] = $form->formCreateElement("email");
$elements[] = $form->formCreateElement("last_name");
$elements[] = $form->formCreateElement("first_name");
$elements[] = $form->formCreateElement("edit_group_id");
$elements[] = $form->formCreateElement("edit_access_right_id");
$elements[] = $form->formCreateElement("strict");
$elements[] = $form->formCreateElement("locked");
$elements[] = $form->formCreateElement("admin");
$elements[] = $form->formCreateElement("debug");
$elements[] = $form->formCreateElement("db_debug");
$elements[] = $form->formCreateElement("edit_language_id");
$elements[] = $form->formCreateElement("edit_scheme_id");
$elements[] = $form->formCreateElementListTable("edit_access_user");
case 'edit_users':
$elements[] = $form->formCreateElement('login_error_count');
$elements[] = $form->formCreateElement('login_error_date_last');
$elements[] = $form->formCreateElement('login_error_date_first');
$elements[] = $form->formCreateElement('enabled');
$elements[] = $form->formCreateElement('protected');
$elements[] = $form->formCreateElement('username');
$elements[] = $form->formCreateElement('password');
$elements[] = $form->formCreateElement('password_change_interval');
$elements[] = $form->formCreateElement('email');
$elements[] = $form->formCreateElement('last_name');
$elements[] = $form->formCreateElement('first_name');
$elements[] = $form->formCreateElement('edit_group_id');
$elements[] = $form->formCreateElement('edit_access_right_id');
$elements[] = $form->formCreateElement('strict');
$elements[] = $form->formCreateElement('locked');
$elements[] = $form->formCreateElement('admin');
$elements[] = $form->formCreateElement('debug');
$elements[] = $form->formCreateElement('db_debug');
$elements[] = $form->formCreateElement('edit_language_id');
$elements[] = $form->formCreateElement('edit_scheme_id');
$elements[] = $form->formCreateElementListTable('edit_access_user');
$elements[] = $form->formCreateElement('additional_acl');
break;
case "edit_schemes":
$elements[] = $form->formCreateElement("enabled");
$elements[] = $form->formCreateElement("name");
$elements[] = $form->formCreateElement("header_color");
$elements[] = $form->formCreateElement("template");
case 'edit_schemes':
$elements[] = $form->formCreateElement('enabled');
$elements[] = $form->formCreateElement('name');
$elements[] = $form->formCreateElement('header_color');
$elements[] = $form->formCreateElement('template');
break;
case "edit_pages":
if (!$form->table_array["edit_page_id"]["value"]) {
case 'edit_pages':
if (!isset($form->table_array['edit_page_id']['value'])) {
$q = "DELETE FROM temp_files";
$form->dbExec($q);
// gets all files in the current dir ending with .php
$crap = exec("ls *.php", $output, $status);
$crap = exec('ls *.php', $output, $status);
// now get all that are NOT in de DB
$q = "INSERT INTO temp_files VALUES ";
for ($i = 0; $i < count($output); $i ++) {
$t_q = "('".$form->dbEscapeString($output[$i])."')";
$form->dbExec($q.$t_q, 'NULL');
}
$elements[] = $form->formCreateElement("filename");
$elements[] = $form->formCreateElement('filename');
} else {
// show file menu
// just show name of file ...
$DATA['filename_exist'] = 1;
$DATA['filename'] = $form->table_array["filename"]["value"];
$DATA['filename'] = $form->table_array['filename']['value'];
} // File Name View IF
$elements[] = $form->formCreateElement("name");
// $elements[] = $form->formCreateElement("tag");
// $elements[] = $form->formCreateElement("min_acl");
$elements[] = $form->formCreateElement("order_number");
$elements[] = $form->formCreateElement("online");
$elements[] = $form->formCreateElement("menu");
$elements[] = $form->formCreateElementListTable("edit_query_string");
$elements[] = $form->formCreateElement("popup");
$elements[] = $form->formCreateElement("popup_x");
$elements[] = $form->formCreateElement("popup_y");
$elements[] = $form->formCreateElementReferenceTable("edit_visible_group");
$elements[] = $form->formCreateElementReferenceTable("edit_menu_group");
$elements[] = $form->formCreateElement('name');
// $elements[] = $form->formCreateElement('tag');
// $elements[] = $form->formCreateElement('min_acl');
$elements[] = $form->formCreateElement('order_number');
$elements[] = $form->formCreateElement('online');
$elements[] = $form->formCreateElement('menu');
$elements[] = $form->formCreateElementListTable('edit_query_string');
$elements[] = $form->formCreateElement('content_alias_edit_page_id');
$elements[] = $form->formCreateElementListTable('edit_page_content');
$elements[] = $form->formCreateElement('popup');
$elements[] = $form->formCreateElement('popup_x');
$elements[] = $form->formCreateElement('popup_y');
$elements[] = $form->formCreateElementReferenceTable('edit_visible_group');
$elements[] = $form->formCreateElementReferenceTable('edit_menu_group');
break;
case "edit_languages":
$elements[] = $form->formCreateElement("enabled");
$elements[] = $form->formCreateElement("short_name");
$elements[] = $form->formCreateElement("long_name");
$elements[] = $form->formCreateElement("iso_name");
case 'edit_languages':
$elements[] = $form->formCreateElement('enabled');
$elements[] = $form->formCreateElement('short_name');
$elements[] = $form->formCreateElement('long_name');
$elements[] = $form->formCreateElement('iso_name');
break;
case "edit_groups":
$elements[] = $form->formCreateElement("enabled");
$elements[] = $form->formCreateElement("name");
$elements[] = $form->formCreateElement("edit_access_right_id");
$elements[] = $form->formCreateElement("edit_scheme_id");
$elements[] = $form->formCreateElementListTable("edit_page_access");
case 'edit_groups':
$elements[] = $form->formCreateElement('enabled');
$elements[] = $form->formCreateElement('name');
$elements[] = $form->formCreateElement('edit_access_right_id');
$elements[] = $form->formCreateElement('edit_scheme_id');
$elements[] = $form->formCreateElementListTable('edit_page_access');
$elements[] = $form->formCreateElement('additional_acl');
break;
case "edit_visible_group":
$elements[] = $form->formCreateElement("name");
$elements[] = $form->formCreateElement("flag");
case 'edit_visible_group':
$elements[] = $form->formCreateElement('name');
$elements[] = $form->formCreateElement('flag');
break;
case "edit_menu_group":
$elements[] = $form->formCreateElement("name");
$elements[] = $form->formCreateElement("flag");
$elements[] = $form->formCreateElement("order_number");
case 'edit_menu_group':
$elements[] = $form->formCreateElement('name');
$elements[] = $form->formCreateElement('flag');
$elements[] = $form->formCreateElement('order_number');
break;
case "edit_access":
$elements[] = $form->formCreateElement("name");
$elements[] = $form->formCreateElement("enabled");
$elements[] = $form->formCreateElement("protected");
$elements[] = $form->formCreateElement("color");
$elements[] = $form->formCreateElement("description");
case 'edit_access':
$elements[] = $form->formCreateElement('name');
$elements[] = $form->formCreateElement('enabled');
$elements[] = $form->formCreateElement('protected');
$elements[] = $form->formCreateElement('color');
$elements[] = $form->formCreateElement('description');
// add name/value list here
$elements[] = $form->formCreateElementListTable("edit_access_data");
$elements[] = $form->formCreateElementListTable('edit_access_data');
$elements[] = $form->formCreateElement('additional_acl');
break;
default:
print "[No valid page definition given]";
print '[No valid page definition given]';
break;
}
// $form->debug('edit', "Elements: <pre>".$form->printAr($elements));
$DATA['elements'] = $elements;
$DATA['hidden'] = $form->formCreateHiddenFields();
$DATA['save_delete'] = $form->formCreateSaveDelete();
} else {
$DATA['form_yes'] = 0;
}
$EDIT_TEMPLATE = 'edit_body.tpl';
}
// debug data, if DEBUG flag is on, this data is print out
$DEBUG_DATA['DEBUG'] = $DEBUG_TMPL;
$DEBUG_DATA['DEBUG'] = isset($DEBUG_TMPL) ? $DEBUG_TMPL : '';
// create main data array
$CONTENT_DATA = array_merge($HEADER, $DATA, $DEBUG_DATA);

View File

@@ -1,95 +1,104 @@
<?php
<?php declare(strict_types=1);
$edit_access = array (
"table_array" => array (
"edit_access_id" => array (
"value" => $GLOBALS["edit_access_id"],
"type" => "hidden",
"pk" => 1
'table_array' => array (
'edit_access_id' => array (
'value' => isset($GLOBALS['edit_access_id']) ? $GLOBALS['edit_access_id'] : '',
'type' => 'hidden',
'pk' => 1
),
"name" => array (
"value" => $GLOBALS["name"],
"output_name" => $this->l->__("Access Group Name"),
"mandatory" => 1,
"type" => "text",
"error_check" => "alphanumericspace|unique"
'name' => array (
'value' => isset($GLOBALS['name']) ? $GLOBALS['name'] : '',
'output_name' => $this->l->__('Access Group Name'),
'mandatory' => 1,
'type' => 'text',
'error_check' => 'alphanumericspace|unique'
),
"description" => array (
"value" => $GLOBALS["description"],
"output_name" => $this->l->__("Description"),
"type" => "textarea"
'description' => array (
'value' => isset($GLOBALS['description']) ? $GLOBALS['description'] : '',
'output_name' => $this->l->__('Description'),
'type' => 'textarea'
),
"color" => array (
"value" => $GLOBALS["color"],
"output_name" => $this->l->__("Color"),
"mandatory" => 0,
"type" => "text",
"size" => 6,
"length" => 6,
"error_check" => "custom",
"error_regex" => "/[\dA-Fa-f]{6}/",
"error_example" => "F6A544"
'color' => array (
'value' => isset($GLOBALS['color']) ? $GLOBALS['color'] : '',
'output_name' => $this->l->__('Color'),
'mandatory' => 0,
'type' => 'text',
'size' => 6,
'length' => 6,
'error_check' => 'custom',
'error_regex' => "/[\dA-Fa-f]{6}/",
'error_example' => 'F6A544'
),
"enabled" => array (
"value" => $GLOBALS["enabled"],
"output_name" => "Enabled",
"type" => "binary",
"int" => 1, // OR "bool" => 1
"element_list" => array (
"1" => "Yes",
"0" => "No"
'enabled' => array (
'value' => isset($GLOBALS['enabled']) ? $GLOBALS['enabled'] : 0,
'output_name' => 'Enabled',
'type' => 'binary',
'int' => 1, // OR 'bool' => 1
'element_list' => array (
'1' => 'Yes',
'0' => 'No'
)
),
"protected" => array (
"value" => $GLOBALS["protected"],
"output_name" => "Protected",
"type" => "binary",
"int" => 1,
"element_list" => array (
"1" => "Yes",
"0" => "No"
'protected' => array (
'value' => isset($GLOBALS['protected']) ? $GLOBALS['protected'] : 0,
'output_name' => 'Protected',
'type' => 'binary',
'int' => 1,
'element_list' => array (
'1' => 'Yes',
'0' => 'No'
)
)
),
'additional_acl' => array (
'value' => isset($GLOBALS['additional_acl']) ? $GLOBALS['additional_acl'] : '',
'output_name' => 'Additional ACL (as JSON)',
'type' => 'textarea',
'error_check' => 'json',
'rows' => 10,
'cols' => 60
),
),
"table_name" => "edit_access",
'table_name' => 'edit_access',
"load_query" => "SELECT edit_access_id, name FROM edit_access ORDER BY name",
"show_fields" => array (
'show_fields' => array (
array (
"name" => "name"
'name' => 'name'
)
),
"element_list" => array (
"edit_access_data" => array (
"output_name" => "Edit Access 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
"prefix" => "ead",
"elements" => array (
"edit_access_data_id" => array (
"output_name" => "Activate",
"type" => "hidden",
"int" => 1,
"pk_id" => 1
'element_list' => array (
'edit_access_data' => array (
'output_name' => '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
'max_empty' => 5, # maxium visible if no data is set, if filled add this number to visible
'prefix' => 'ead',
'elements' => array (
'name' => array (
'type' => 'text',
'error_check' => 'alphanumeric|unique',
'output_name' => 'Name',
'mandatory' => 1
),
"name" => array (
"type" => "text",
"error_check" => "alphanumeric|unique",
"output_name" => "Name"
'value' => array (
'type' => 'text',
'output_name' => 'Value'
),
"value" => array (
"type" => "text",
"output_name" => "Value"
'enabled' => array (
'type' => 'checkbox',
'output_name' => 'Activate',
'int' => 1,
'element_list' => array(1)
),
"enabled" => array (
"type" => "checkbox",
"output_name" => "Activate",
"int" => 1,
"element_list" => array(1)
),
"edit_access_id" => array (
"int" => 1,
"type" => "hidden",
"fk_id" => 1 # reference main key from master table above
/*'edit_access_id' => array (
'int' => 1,
'type' => 'hidden',
'fk_id' => 1 # reference main key from master table above
),*/
'edit_access_data_id' => array (
'type' => 'hidden',
'int' => 1,
'pk_id' => 1
)
)
)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,27 +1,27 @@
<?php
<?php declare(strict_types=1);
$edit_users = array (
"table_array" => array (
"edit_user_id" => array (
"value" => $GLOBALS["edit_user_id"],
"type" => "hidden",
"pk" => 1,
"int" => 1
'table_array' => array (
'edit_user_id' => array (
'value' => isset($GLOBALS['edit_user_id']) ? $GLOBALS['edit_user_id'] : '',
'type' => 'hidden',
'pk' => 1,
'int' => 1
),
"username" => array (
"value" => $GLOBALS["username"],
"output_name" => "Username",
"mandatory" => 1,
"error_check" => "unique|alphanumericextended",
"type" => "text"
'username' => array (
'value' => isset($GLOBALS['username']) ? $GLOBALS['username'] : '',
'output_name' => 'Username',
'mandatory' => 1,
'error_check' => 'unique|alphanumericextended',
'type' => 'text'
),
"password" => array (
"value" => $GLOBALS["password"],
"HIDDEN_value" => $GLOBALS["HIDDEN_password"],
"CONFIRM_value" => $GLOBALS["CONFIRM_password"],
"output_name" => "Password",
"mandatory" => 1,
"type" => "password", // later has to be password for encryption in database
'password' => array (
'value' => isset($GLOBALS['password']) ? $GLOBALS['password'] : '',
'HIDDEN_value' => isset($GLOBALS['HIDDEN_password']) ? $GLOBALS['HIDDEN_password'] : '',
'CONFIRM_value' => isset($GLOBALS['CONFIRM_password']) ? $GLOBALS['CONFIRM_password'] : '',
'output_name' => 'Password',
'mandatory' => 1,
'type' => 'password', // later has to be password for encryption in database
'update' => array ( // connected field updates, and update data
'password_change_date' => array ( // db row to update
'type' => 'date', // type of field (int/text/date/etc)
@@ -32,7 +32,7 @@ $edit_users = array (
// 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_change_interval' => array (
'value' => $GLOBALS['password_change_interval'],
'value' => isset($GLOBALS['password_change_interval']) ? $GLOBALS['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
'type' => 'text',
@@ -40,218 +40,227 @@ $edit_users = array (
'size' => 5, // make it 5 chars long
'length' => 5
),
"enabled" => array (
"value" => $GLOBALS["enabled"],
"output_name" => "Enabled",
"type" => "binary",
"int" => 1,
"element_list" => array (
"1" => "Yes",
"0" => "No"
'enabled' => array (
'value' => isset($GLOBALS['enabled']) ? $GLOBALS['enabled'] : '',
'output_name' => 'Enabled',
'type' => 'binary',
'int' => 1,
'element_list' => array (
'1' => 'Yes',
'0' => 'No'
)
),
"strict" => array (
"value" => $GLOBALS["strict"],
"output_name" => "Strict (Lock after errors)",
"type" => "binary",
"int" => 1,
"element_list" => array (
"1" => "Yes",
"0" => "No"
'strict' => array (
'value' => isset($GLOBALS['strict']) ? $GLOBALS['strict'] : '',
'output_name' => 'Strict (Lock after errors)',
'type' => 'binary',
'int' => 1,
'element_list' => array (
'1' => 'Yes',
'0' => 'No'
)
),
"locked" => array (
"value" => $GLOBALS["locked"],
"output_name" => "Locked (auto set if strict with errors)",
"type" => "binary",
"int" => 1,
"element_list" => array (
"1" => "Yes",
"0" => "No"
'locked' => array (
'value' => isset($GLOBALS['locked']) ? $GLOBALS['locked'] : '',
'output_name' => 'Locked (auto set if strict with errors)',
'type' => 'binary',
'int' => 1,
'element_list' => array (
'1' => 'Yes',
'0' => 'No'
)
),
"admin" => array (
"value" => $GLOBALS["admin"],
"output_name" => "Admin",
"type" => "binary",
"int" => 1,
"element_list" => array (
"1" => "Yes",
"0" => "No"
'admin' => array (
'value' => isset($GLOBALS['admin']) ? $GLOBALS['admin'] : '',
'output_name' => 'Admin',
'type' => 'binary',
'int' => 1,
'element_list' => array (
'1' => 'Yes',
'0' => 'No'
)
),
"debug" => array (
"value" => $GLOBALS["debug"],
"output_name" => "Debug",
"type" => "binary",
"int" => 1,
"element_list" => array (
"1" => "Yes",
"0" => "No"
'debug' => array (
'value' => isset($GLOBALS['debug']) ? $GLOBALS['debug'] : '',
'output_name' => 'Debug',
'type' => 'binary',
'int' => 1,
'element_list' => array (
'1' => 'Yes',
'0' => 'No'
)
),
"db_debug" => array (
"value" => $GLOBALS["db_debug"],
"output_name" => "DB Debug",
"type" => "binary",
"int" => 1,
"element_list" => array (
"1" => "Yes",
"0" => "No"
'db_debug' => array (
'value' => isset($GLOBALS['db_debug']) ? $GLOBALS['db_debug'] : '',
'output_name' => 'DB Debug',
'type' => 'binary',
'int' => 1,
'element_list' => array (
'1' => 'Yes',
'0' => 'No'
)
),
"email" => array (
"value" => $GLOBALS["email"],
"output_name" => "E-Mail",
"type" => "text"
'email' => array (
'value' => isset($GLOBALS['email']) ? $GLOBALS['email'] : '',
'output_name' => 'E-Mail',
'type' => 'text',
'error_check' => 'email'
),
"last_name" => array (
"value" => $GLOBALS["last_name"],
"output_name" => "Last Name",
"type" => "text"
'last_name' => array (
'value' => isset($GLOBALS['last_name']) ? $GLOBALS['last_name'] : '',
'output_name' => 'Last Name',
'type' => 'text'
),
"first_name" => array (
"value" => $GLOBALS["first_name"],
"output_name" => "First Name",
"type" => "text"
'first_name' => array (
'value' => isset($GLOBALS['first_name']) ? $GLOBALS['first_name'] : '',
'output_name' => 'First Name',
'type' => 'text'
),
"edit_language_id" => array (
"value" => $GLOBALS["edit_language_id"],
"output_name" => "Language",
"mandatory" => 1,
"int" => 1,
"type" => "drop_down_db",
"query" => "SELECT edit_language_id, long_name FROM edit_language WHERE enabled = 1 ORDER BY order_number"
'edit_language_id' => array (
'value' => isset($GLOBALS['edit_language_id']) ? $GLOBALS['edit_language_id'] : '',
'output_name' => 'Language',
'mandatory' => 1,
'int' => 1,
'type' => 'drop_down_db',
'query' => "SELECT edit_language_id, long_name FROM edit_language WHERE enabled = 1 ORDER BY order_number"
),
"edit_scheme_id" => array (
"value" => $GLOBALS["edit_scheme_id"],
"output_name" => "Scheme",
"int_null" => 1,
"type" => "drop_down_db",
"query" => "SELECT edit_scheme_id, name FROM edit_scheme WHERE enabled = 1 ORDER BY name"
'edit_scheme_id' => array (
'value' => isset($GLOBALS['edit_scheme_id']) ? $GLOBALS['edit_scheme_id'] : '',
'output_name' => 'Scheme',
'int_null' => 1,
'type' => 'drop_down_db',
'query' => "SELECT edit_scheme_id, name FROM edit_scheme WHERE enabled = 1 ORDER BY name"
),
"edit_group_id" => array (
"value" => $GLOBALS["edit_group_id"],
"output_name" => "Group",
"int" => 1,
"type" => "drop_down_db",
"query" => "SELECT edit_group_id, name FROM edit_group WHERE enabled = 1 ORDER BY name",
"mandatory" => 1
'edit_group_id' => array (
'value' => isset($GLOBALS['edit_group_id']) ? $GLOBALS['edit_group_id'] : '',
'output_name' => 'Group',
'int' => 1,
'type' => 'drop_down_db',
'query' => "SELECT edit_group_id, name FROM edit_group WHERE enabled = 1 ORDER BY name",
'mandatory' => 1
),
"edit_access_right_id" => array (
"value" => $GLOBALS["edit_access_right_id"],
"output_name" => "User Level",
"mandatory" => 1,
"int" => 1,
"type" => "drop_down_db",
"query" => "SELECT edit_access_right_id, name FROM edit_access_right ORDER BY level"
'edit_access_right_id' => array (
'value' => isset($GLOBALS['edit_access_right_id']) ? $GLOBALS['edit_access_right_id'] : '',
'output_name' => 'User Level',
'mandatory' => 1,
'int' => 1,
'type' => 'drop_down_db',
'query' => "SELECT edit_access_right_id, name FROM edit_access_right ORDER BY level"
),
"login_error_count" => array (
"output_name" => "Login error count",
"value" => $GLOBALS['login_error_count'],
"type" => "view",
"empty" => "0"
'login_error_count' => array (
'output_name' => 'Login error count',
'value' => isset($GLOBALS['login_error_count']) ? $GLOBALS['login_error_count'] : '',
'type' => 'view',
'empty' => '0'
),
"login_error_date_last" => array (
"output_name" => "Last login error",
"value" => $GLOBALS['login_error_date_liast'],
"type" => "view",
"empty" => "-"
'login_error_date_last' => array (
'output_name' => 'Last login error',
'value' => isset($GLOBALS['login_error_date_liast']) ? $GLOBALS['login_error_date_liast'] : '',
'type' => 'view',
'empty' => '-'
),
"login_error_date_first" => array (
"output_name" => "First login error",
"value" => $GLOBALS['login_error_date_first'],
"type" => "view",
"empty" => "-"
'login_error_date_first' => array (
'output_name' => 'First login error',
'value' => isset($GLOBALS['login_error_date_first']) ? $GLOBALS['login_error_date_first'] : '',
'type' => 'view',
'empty' => '-'
),
"protected" => array (
"value" => $GLOBALS["protected"],
"output_name" => "Protected",
"type" => "binary",
"int" => 1,
"element_list" => array (
"1" => "Yes",
"0" => "No"
'protected' => array (
'value' => isset($GLOBALS['protected']) ? $GLOBALS['protected'] : '',
'output_name' => 'Protected',
'type' => 'binary',
'int' => 1,
'element_list' => array (
'1' => 'Yes',
'0' => 'No'
)
),
'additional_acl' => array (
'value' => isset($GLOBALS['additional_acl']) ? $GLOBALS['additional_acl'] : '',
'output_name' => 'Additional ACL (as JSON)',
'type' => 'textarea',
'error_check' => 'json',
'rows' => 10,
'cols' => 60
),
),
'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',
'show_fields' => array (
array (
'name' => 'username'
),
array (
'name' => 'enabled',
'binary' => array ('Yes', 'No'),
'before_value' => 'Enabled: '
),
array (
'name' => 'debug',
'binary' => array ('Yes', 'No'),
'before_value' => 'Debug: '
),
array (
'name' => 'db_debug',
'binary' => array ('Yes', 'No'),
'before_value' => 'DB Debug: '
),
array (
'name' => 'strict',
'binary' => array ('Yes', 'No'),
'before_value' => 'Strict: '
),
array (
'name' => 'locked',
'binary' => array ('Yes', 'No'),
'before_value' => 'Locked: '
),
array (
'name' => 'login_error_count',
'before_value' => 'Errors: '
)
),
"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",
"show_fields" => array (
array (
"name" => "username"
),
array (
"name" => "enabled",
"binary" => array ("Yes", "No"),
"before_value" => "Enabled: "
),
array (
"name" => "debug",
"binary" => array ("Yes", "No"),
"before_value" => "Debug: "
),
array (
"name" => "db_debug",
"binary" => array ("Yes", "No"),
"before_value" => "DB Debug: "
),
array (
"name" => "strict",
"binary" => array ("Yes", "No"),
"before_value" => "Strict: "
),
array (
"name" => "locked",
"binary" => array ("Yes", "No"),
"before_value" => "Locked: "
),
array (
"name" => "login_error_count",
"before_value" => "Errors: "
)
),
"element_list" => array (
"edit_access_user" => array (
"output_name" => "Accounts",
"mandatory" => 1,
"delete" => 0, // set then reference entries are deleted, else the "enable" flag is only set
"prefix" => "ecu",
"read_data" => array (
"table_name" => "edit_access",
"pk_id" => "edit_access_id",
"name" => "name",
"order" => "name"
'element_list' => array (
'edit_access_user' => array (
'output_name' => 'Accounts',
'mandatory' => 1,
'delete' => 0, // set then reference entries are deleted, else the 'enable' flag is only set
'prefix' => 'ecu',
'read_data' => array (
'table_name' => 'edit_access',
'pk_id' => 'edit_access_id',
'name' => 'name',
'order' => 'name'
),
"elements" => array (
"edit_access_user_id" => array (
"output_name" => "Activate",
"type" => "hidden",
"int" => 1,
"pk_id" => 1
'elements' => array (
'edit_access_user_id' => array (
'output_name' => 'Activate',
'type' => 'hidden',
'int' => 1,
'pk_id' => 1
),
"enabled" => array (
"type" => "checkbox",
"output_name" => "Activate",
"int" => 1,
"element_list" => array (1)
'enabled' => array (
'type' => 'checkbox',
'output_name' => 'Activate',
'int' => 1,
'element_list' => array (1)
),
"edit_access_right_id" => array (
"type" => "drop_down_db",
"output_name" => "Access Level",
"preset" => 1, // first of the select
"int" => 1,
"query" => "SELECT edit_access_right_id, name FROM edit_access_right ORDER BY level"
'edit_access_right_id' => array (
'type' => 'drop_down_db',
'output_name' => 'Access Level',
'preset' => 1, // first of the select
'int' => 1,
'query' => "SELECT edit_access_right_id, name FROM edit_access_right ORDER BY level"
),
"edit_default" => array (
"type" => "radio_group",
"output_name" => "Default",
"int" => 1,
"element_list" => "radio_group"
'edit_default' => array (
'type' => 'radio_group',
'output_name' => 'Default',
'int' => 1,
'element_list' => 'radio_group'
),
"edit_access_id" => array (
"type" => "hidden",
"int" => 1
'edit_access_id' => array (
'type' => 'hidden',
'int' => 1
)
)
) // edit pages ggroup

View File

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

View File

@@ -114,8 +114,8 @@
{/foreach}
</table>
{if $element.data.delete_name}
<input type="hidden" value="" name="{$element.data.delete_name}">
<input type="hidden" value="" name="{$element.data.delete_name}_flag">
<input type="hidden" value="" id="{$element.data.delete_name}" name="{$element.data.delete_name}">
<input type="hidden" value="" id="{$element.data.delete_name}_flag" name="{$element.data.delete_name}_flag">
<input type="hidden" name="remove_name[]" value="{$element.data.delete_name}">
{/if}
{if $element.data.enable_name}

View File

@@ -15,12 +15,6 @@
{if $STYLESHEET}
<link rel=stylesheet type="text/css" href="{$css}{$STYLESHEET}">
{/if}
{if $JAVASCRIPT}
<script language="JavaScript" src="{$JS}{$JAVASCRIPT}"></script>
{/if}
{if $DATE_JAVASCRIPT}
<script language="JavaScript" src="{$JS}{$DATE_JAVASCRIPT}"></script>
{/if}
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="1">

View File

@@ -221,6 +221,38 @@ function getTimestamp()
return date.getTime();
}
// METHOD: dec2hex
// PARAMS: decimal string
// RETURN: string
// DESC : dec2hex :: Integer -> String
// i.e. 0-255 -> '00'-'ff'
function dec2hex(dec)
{
return ('0' + dec.toString(16)).substr(-2);
}
// METHOD: generateId
// PARAMS: lenght in int
// RETURN: random string
// DESC : generateId :: Integer -> String
// only works on mondern browsers
function generateId(len)
{
var arr = new Uint8Array((len || 40) / 2);
(window.crypto || window.msCrypto).getRandomValues(arr);
return Array.from(arr, dec2hex).join('');
}
// METHOD: randomIdF()
// PARAMS: none
// RETURN: not true random string
// DESC : creates a pseudo random string of 10 characters
// after many runs it will create duplicates
function randomIdF()
{
return Math.random().toString(36).substring(2);
}
// METHOD: isObject
// PARAMS: possible object
// RETURN: true/false if it is an object or not
@@ -242,6 +274,22 @@ const keyInObject = (key, object) => (key in object) ? true : false;
return (key in object) ? true : false;
}*/
// METHOD: getKeyByValue
// PARAMS: object, value
// RETURN: key found
// DESC : returns matching key of value
const getKeyByValue = (obj, value) => Object.keys(obj).find(key => obj[key] === value);
// function getKeyByValue(object, value)
// {
// return Object.keys(object).find(key => object[key] === value);
// }
// METHOD: valueInObject
// PARAMS: obj, value
// RETURN: true/false
// DESC : returns true if value is found in object with a key
const valueInObject = (obj, value) => (Object.keys(obj).find(key => obj[key] === value)) ? true : false;
// METHOD: exists
// PARAMS: uid
// RETURN: true/false
@@ -554,6 +602,8 @@ function phfo(tree)
// *** DOM MANAGEMENT FUNCTIONS
// BLOCK: html wrappers for quickly creating html data blocks
// NOTE : OLD FORMAT which misses multiple block set
// METHOD: html_options
// PARAMS: name/id, array for the options, selected item uid
// options_only [def false] if this is true, it will not print the select part
@@ -563,15 +613,40 @@ function phfo(tree)
// DESC : creates an select/options drop down block.
// the array needs to be key -> value format. key is for the option id and value is for the data output
function html_options(name, data, selected = '', options_only = false, return_string = false, sort = '')
{
// wrapper to new call
return html_options_block(name, data, selected, false, options_only, return_string, sort);
}
// NOTE : USE THIS CALL, the above one is deprecated
// METHOD: html_options
// PARAMS: name/id, array for the options,
// selected item uid [drop down string, multi select array]
// multiple [def 0] if this is 1 or larger, the drop down will be turned into multiple select
// the number sets the size value unless it is 1, then it is default
// options_only [def false] if this is true, it will not print the select part
// return_string [def false]: return as string and not as element
// sort [def '']: if empty as is, else allowed 'keys', 'values' all others are ignored
// RETURN: html with build options block
// DESC : creates an select/options drop down block.
// the array needs to be key -> value format. key is for the option id and value is for the data output
function html_options_block(name, data, selected = '', multiple = 0, options_only = false, return_string = false, sort = '')
{
var content = [];
var element_select;
var select_options = {};
var element_option;
var data_list = []; // for sorted output
var value;
var options;
var option;
if (multiple > 0) {
select_options.multiple = '';
if (multiple > 1) {
select_options.size = multiple;
}
}
// set outside select, gets stripped on return if options only is true
element_select = cel('select', name);
element_select = cel('select', name, '', [], select_options);
// console.log('Call for %s, options: %s', name, options_only);
if (sort == 'keys') {
data_list = Object.keys(data).sort();
@@ -585,14 +660,18 @@ function html_options(name, data, selected = '', options_only = false, return_st
// for (const [key, value] of Object.entries(data)) {
for (const key of data_list) {
value = data[key];
console.log('create [%s] options: key: %s, value: %s', name, key, value);
// console.log('create [%s] options: key: %s, value: %s', name, key, value);
// basic options init
options = {
'label': value,
'value': key
};
// add selected if matching
if (selected == key) {
if (multiple == 0 && !Array.isArray(selected) && selected == key) {
options.selected = '';
}
// for multiple, we match selected as array
if (multiple == 1 && Array.isArray(selected) && selected.indexOf(key) != -1) {
options.selected = '';
}
// create the element option

View File

@@ -299,6 +299,38 @@ function getTimestamp()
return date.getTime();
}
// METHOD: dec2hex
// PARAMS: decimal string
// RETURN: string
// DESC : dec2hex :: Integer -> String
// i.e. 0-255 -> '00'-'ff'
function dec2hex(dec)
{
return ('0' + dec.toString(16)).substr(-2);
}
// METHOD: generateId
// PARAMS: lenght in int
// RETURN: random string
// DESC : generateId :: Integer -> String
// only works on mondern browsers
function generateId(len)
{
var arr = new Uint8Array((len || 40) / 2);
(window.crypto || window.msCrypto).getRandomValues(arr);
return Array.from(arr, dec2hex).join('');
}
// METHOD: randomIdF()
// PARAMS: none
// RETURN: not true random string
// DESC : creates a pseudo random string of 10 characters
// after many runs it will create duplicates
function randomIdF()
{
return Math.random().toString(36).substring(2);
}
// METHOD: isObject
// PARAMS: possible object
// RETURN: true/false if it is an object or not
@@ -320,6 +352,22 @@ const keyInObject = (key, object) => (key in object) ? true : false;
return (key in object) ? true : false;
}*/
// METHOD: getKeyByValue
// PARAMS: object, value
// RETURN: key found
// DESC : returns matching key of value
const getKeyByValue = (obj, value) => Object.keys(obj).find(key => obj[key] === value);
// function getKeyByValue(object, value)
// {
// return Object.keys(object).find(key => object[key] === value);
// }
// METHOD: valueInObject
// PARAMS: obj, value
// RETURN: true/false
// DESC : returns true if value is found in object with a key
const valueInObject = (obj, value) => (Object.keys(obj).find(key => obj[key] === value)) ? true : false;
// METHOD: exists
// PARAMS: uid
// RETURN: true/false
@@ -632,6 +680,8 @@ function phfo(tree)
// *** DOM MANAGEMENT FUNCTIONS
// BLOCK: html wrappers for quickly creating html data blocks
// NOTE : OLD FORMAT which misses multiple block set
// METHOD: html_options
// PARAMS: name/id, array for the options, selected item uid
// options_only [def false] if this is true, it will not print the select part
@@ -641,15 +691,40 @@ function phfo(tree)
// DESC : creates an select/options drop down block.
// the array needs to be key -> value format. key is for the option id and value is for the data output
function html_options(name, data, selected = '', options_only = false, return_string = false, sort = '')
{
// wrapper to new call
return html_options_block(name, data, selected, false, options_only, return_string, sort);
}
// NOTE : USE THIS CALL, the above one is deprecated
// METHOD: html_options
// PARAMS: name/id, array for the options,
// selected item uid [drop down string, multi select array]
// multiple [def 0] if this is 1 or larger, the drop down will be turned into multiple select
// the number sets the size value unless it is 1, then it is default
// options_only [def false] if this is true, it will not print the select part
// return_string [def false]: return as string and not as element
// sort [def '']: if empty as is, else allowed 'keys', 'values' all others are ignored
// RETURN: html with build options block
// DESC : creates an select/options drop down block.
// the array needs to be key -> value format. key is for the option id and value is for the data output
function html_options_block(name, data, selected = '', multiple = 0, options_only = false, return_string = false, sort = '')
{
var content = [];
var element_select;
var select_options = {};
var element_option;
var data_list = []; // for sorted output
var value;
var options;
var option;
if (multiple > 0) {
select_options.multiple = '';
if (multiple > 1) {
select_options.size = multiple;
}
}
// set outside select, gets stripped on return if options only is true
element_select = cel('select', name);
element_select = cel('select', name, '', [], select_options);
// console.log('Call for %s, options: %s', name, options_only);
if (sort == 'keys') {
data_list = Object.keys(data).sort();
@@ -663,14 +738,18 @@ function html_options(name, data, selected = '', options_only = false, return_st
// for (const [key, value] of Object.entries(data)) {
for (const key of data_list) {
value = data[key];
console.log('create [%s] options: key: %s, value: %s', name, key, value);
// console.log('create [%s] options: key: %s, value: %s', name, key, value);
// basic options init
options = {
'label': value,
'value': key
};
// add selected if matching
if (selected == key) {
if (multiple == 0 && !Array.isArray(selected) && selected == key) {
options.selected = '';
}
// for multiple, we match selected as array
if (multiple == 1 && Array.isArray(selected) && selected.indexOf(key) != -1) {
options.selected = '';
}
// create the element option

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,5 @@
/*!
* jQuery JavaScript Library v3.4.0
* jQuery JavaScript Library v3.4.1
* https://jquery.com/
*
* Includes Sizzle.js
@@ -9,7 +9,7 @@
* Released under the MIT license
* https://jquery.org/license
*
* Date: 2019-04-10T19:48Z
* Date: 2019-05-01T21:04Z
*/
( function( global, factory ) {
@@ -142,7 +142,7 @@ function toType( obj ) {
var
version = "3.4.0",
version = "3.4.1",
// Define a local copy of jQuery
jQuery = function( selector, context ) {
@@ -4498,8 +4498,12 @@ var documentElement = document.documentElement;
},
composed = { composed: true };
// Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
// Check attachment across shadow DOM boundaries when possible (gh-3504)
if ( documentElement.attachShadow ) {
// Support: iOS 10.0-10.2 only
// Early iOS 10 versions support `attachShadow` but not `getRootNode`,
// leading to errors. We need to check for `getRootNode`.
if ( documentElement.getRootNode ) {
isAttached = function( elem ) {
return jQuery.contains( elem.ownerDocument, elem ) ||
elem.getRootNode( composed ) === elem.ownerDocument;
@@ -5359,8 +5363,7 @@ jQuery.event = {
// Claim the first handler
if ( rcheckableType.test( el.type ) &&
el.click && nodeName( el, "input" ) &&
dataPriv.get( el, "click" ) === undefined ) {
el.click && nodeName( el, "input" ) ) {
// dataPriv.set( el, "click", ... )
leverageNative( el, "click", returnTrue );
@@ -5377,8 +5380,7 @@ jQuery.event = {
// Force setup before triggering a click
if ( rcheckableType.test( el.type ) &&
el.click && nodeName( el, "input" ) &&
dataPriv.get( el, "click" ) === undefined ) {
el.click && nodeName( el, "input" ) ) {
leverageNative( el, "click" );
}
@@ -5419,7 +5421,9 @@ function leverageNative( el, type, expectSync ) {
// Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
if ( !expectSync ) {
jQuery.event.add( el, type, returnTrue );
if ( dataPriv.get( el, type ) === undefined ) {
jQuery.event.add( el, type, returnTrue );
}
return;
}
@@ -5434,9 +5438,13 @@ function leverageNative( el, type, expectSync ) {
if ( ( event.isTrigger & 1 ) && this[ type ] ) {
// Interrupt processing of the outer synthetic .trigger()ed event
if ( !saved ) {
// Saved data should be false in such cases, but might be a leftover capture object
// from an async native handler (gh-4350)
if ( !saved.length ) {
// Store arguments for use when handling the inner native event
// There will always be at least one argument (an event object), so this array
// will not be confused with a leftover capture object.
saved = slice.call( arguments );
dataPriv.set( this, type, saved );
@@ -5449,14 +5457,14 @@ function leverageNative( el, type, expectSync ) {
if ( saved !== result || notAsync ) {
dataPriv.set( this, type, false );
} else {
result = undefined;
result = {};
}
if ( saved !== result ) {
// Cancel the outer synthetic event
event.stopImmediatePropagation();
event.preventDefault();
return result;
return result.value;
}
// If this is an inner synthetic event for an event with a bubbling surrogate
@@ -5471,17 +5479,19 @@ function leverageNative( el, type, expectSync ) {
// If this is a native event triggered above, everything is now in order
// Fire an inner synthetic event with the original arguments
} else if ( saved ) {
} else if ( saved.length ) {
// ...and capture the result
dataPriv.set( this, type, jQuery.event.trigger(
dataPriv.set( this, type, {
value: jQuery.event.trigger(
// Support: IE <=9 - 11+
// Extend with the prototype to reset the above stopImmediatePropagation()
jQuery.extend( saved.shift(), jQuery.Event.prototype ),
saved,
this
) );
// Support: IE <=9 - 11+
// Extend with the prototype to reset the above stopImmediatePropagation()
jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
saved.slice( 1 ),
this
)
} );
// Abort handling of the native event
event.stopImmediatePropagation();

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
jquery-3.4.0.js
jquery-3.4.1.js

View File

@@ -1 +1 @@
jquery-3.4.0.min.js
jquery-3.4.1.min.js

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*********************************************************************
* AUTHOR: Clemens Schwaighofer
* CREATED: 2000/06/01
@@ -67,7 +67,7 @@ class Login extends \CoreLibs\DB\IO
private $username; // login name
private $password; // login password
private $logout; // logout button
private $login_error; // login error code, can be matched to the array login_error_msg, which holds the string
private $login_error = 0; // login error code, can be matched to the array login_error_msg, which holds the string
private $password_change = false; // if this is set to true, the user can change passwords
private $password_change_ok = false; // password change was successful
private $password_forgot = false; // can we reset password and mail to user with new password set screen
@@ -78,6 +78,9 @@ class Login extends \CoreLibs\DB\IO
private $pw_new_password;
private $pw_new_password_confirm;
private $pw_change_deny_users = array (); // array of users for which the password change is forbidden
private $logout_target;
private $max_login_error_count = -1;
private $lock_deny_users = array ();
// if we have password change we need to define some rules
private $password_min_length = PASSWORD_MIN_LENGTH;
@@ -102,18 +105,21 @@ class Login extends \CoreLibs\DB\IO
public $acl = array ();
public $default_acl_list = array ();
// language
public $l;
// METHOD: login
// PARAMS: db_config -> array for logging in to DB where edit_users tables are
// db_debug -> sets debug output for db_io (can be overruled with DB_DEBUG)
// RETURN: none
// DESC : cunstroctuor, does ALL, opens db, works through connection checks, closes itself
public function __construct($db_config, $lang = 'en_utf8', $debug = 0, $db_debug = 0, $echo = 1, $print = 0)
public function __construct(array $db_config, string $lang = 'en_utf8', int $set_control_flag = 0)
{
// log login data for this class only
$this->log_per_class = 1;
// create db connection and init base class
if (!parent::__construct($db_config, $debug, $db_debug, $echo, $print)) {
if (!parent::__construct($db_config, $set_control_flag)) {
echo 'Could not connect to DB<br>';
// if I can't connect to the DB to auth exit hard. No access allowed
exit;
@@ -282,7 +288,7 @@ class Login extends \CoreLibs\DB\IO
// PARAMS: hash, optional password, to override
// RETURN: true or false
// DESC : checks if password is valid, sets internal error login variable
private function loginPasswordCheck($hash, $password = '')
private function loginPasswordCheck(string $hash, string $password = ''): bool
{
// check with what kind of prefix the password begins:
// $2a$ or $2y$: BLOWFISCH
@@ -426,18 +432,22 @@ class Login extends \CoreLibs\DB\IO
$pages = array();
$edit_page_ids = array();
// set pages access
$q = "SELECT ep.edit_page_id, filename, ep.name AS edit_page_name, ep.order_number AS edit_page_order, menu, ";
$q .= "popup, popup_x, popup_y, online, ear.level, ear.type ";
$q .= "FROM edit_page ep, edit_page_access epa, edit_access_right ear ";
$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 .= "FROM edit_page ep ";
$q .= "LEFT JOIN edit_page epca ON (epca.edit_page_id = ep.content_alias_edit_page_id)";
$q .= ", edit_page_access epa, edit_access_right ear ";
$q .= "WHERE ep.edit_page_id = epa.edit_page_id AND ear.edit_access_right_id = epa.edit_access_right_id ";
$q .= "AND epa.enabled = 1 AND epa.edit_group_id = ".$res["edit_group_id"]." ";
$q .= "ORDER BY ep.order_number";
while ($res = $this->dbReturn($q)) {
// page id array for sub data readout
$edit_page_ids[] = $res['edit_page_id'];
$edit_page_ids[$res['edit_page_id']] = $res['cuid'];
// create the array for pages
array_push($pages, array (
$pages[$res['cuid']] = array (
'edit_page_id' => $res['edit_page_id'],
'cuid' => $res['cuid'],
'content_alias_uid' => $res['content_alias_uid'], // for reference of content data on a differen page
'filename' => $res['filename'],
'page_name' => $res['edit_page_name'],
'order' => $res['edit_page_order'],
@@ -450,7 +460,7 @@ class Login extends \CoreLibs\DB\IO
'acl_type' => $res['type'],
'query' => array (),
'visible' => array ()
));
);
// make reference filename -> level
$pages_acl[$res['filename']] = $res['level'];
} // for each page
@@ -458,33 +468,42 @@ class Login extends \CoreLibs\DB\IO
$_edit_page_id = 0;
$q = "SELECT epvg.edit_page_id, name, flag ";
$q .= "FROM edit_visible_group evp, edit_page_visible_group epvg ";
$q .= "WHERE evp.edit_visible_group_id = epvg.edit_visible_group_id AND epvg.edit_page_id IN (".join(', ', $edit_page_ids).") ";
$q .= "WHERE evp.edit_visible_group_id = epvg.edit_visible_group_id AND epvg.edit_page_id IN (".join(', ', array_keys($edit_page_ids)).") ";
$q .= "ORDER BY epvg.edit_page_id";
while ($res = $this->dbReturn($q)) {
if ($res['edit_page_id'] != $_edit_page_id) {
// search the pos in the array push
$pos = $this->arraySearchRecursive($res['edit_page_id'], $pages, 'edit_page_id');
$_edit_page_id = $res['edit_page_id'];
}
$pages[$pos[0]]['visible'][$res['name']] = $res['flag'];
$pages[$edit_page_ids[$res['edit_page_id']]]['visible'][$res['name']] = $res['flag'];
}
// get the same for the query strings
$_edit_page_id = 0;
$q = "SELECT eqs.edit_page_id, name, value, dynamic FROM edit_query_string eqs ";
$q .= "WHERE enabled = 1 AND edit_page_id IN (".join(', ', $edit_page_ids).") ORDER BY eqs.edit_page_id";
$q .= "WHERE enabled = 1 AND edit_page_id IN (".join(', ', array_keys($edit_page_ids)).") ";
$q .= "ORDER BY eqs.edit_page_id";
while ($res = $this->dbReturn($q)) {
if ($res['edit_page_id'] != $_edit_page_id) {
// search the pos in the array push
$pos = $this->arraySearchRecursive($res['edit_page_id'], $pages, 'edit_page_id');
$_edit_page_id = $res['edit_page_id'];
}
$pages[$pos[0]]['query'][] = array (
$pages[$edit_page_ids[$res['edit_page_id']]]['query'][] = array (
'name' => $res['name'],
'value' => $res['value'],
'dynamic' => $res['dynamic']
);
}
// get the page content and add them to the page
$_edit_page_id = 0;
$q = "SELECT epc.edit_page_id, epc.name, epc.uid, epc.order_number, epc.online, ear.level, ear.type ";
$q .= "FROM edit_page_content epc, edit_access_right ear ";
$q .= "WHERE epc.edit_access_right_id = ear.edit_access_right_id AND ";
$q .= "epc.edit_page_id IN (".join(', ', array_keys($edit_page_ids)).") ";
$q .= "ORDER BY epc.order_number";
while ($res = $this->dbReturn($q)) {
$pages[$edit_page_ids[$res['edit_page_id']]]['content'][$res['uid']] = array (
'name' => $res['name'],
'uid' => $res['uid'],
'online' => $res['online'],
'order' => $res['order_number'],
// access name and level
'acl_type' => $res['type'],
'acl_level' => $res['level']
);
}
// write back the pages data to the output array
$_SESSION['PAGES'] = $pages;
$_SESSION['PAGES_ACL_LEVEL'] = $pages_acl;
// load the edit_access user rights
@@ -528,16 +547,19 @@ class Login extends \CoreLibs\DB\IO
} // user has permission to THIS page
} // user was not enabled or other login error
if ($this->login_error) {
$login_error_date_first = '';
if ($res['login_error_count'] == 0) {
$login_error_date_first = ', login_error_date_first = NOW()';
$login_error_date_first = ", login_error_date_first = NOW()";
}
// update login error count for this user
$q = "UPDATE edit_user ";
$q .= "SET login_error_count = login_error_count + 1, login_error_date_last = NOW() $login_error_date_first ";
$q .= "SET login_error_count = login_error_count + 1, login_error_date_last = NOW() ".$login_error_date_first." ";
$q .= "WHERE edit_user_id = ".$res['edit_user_id'];
$this->dbExec($q);
// totally lock the user if error max is reached
if ($res['login_error_count'] + 1 > $this->max_login_error_count) {
if ($this->max_login_error_count != -1 &&
$res['login_error_count'] + 1 > $this->max_login_error_count
) {
// do some alert reporting in case this error is too big
// if strict is set, lock this user
// this needs manual unlocking by an admin user
@@ -593,7 +615,8 @@ class Login extends \CoreLibs\DB\IO
if ($this->logout || $this->login_error) {
// unregister and destroy session vars
unset($_SESSION['EUID']);
unset($_SESSION['GROUP_LEVEL']);
unset($_SESSION['GROUP_ACL_LEVEL']);
unset($_SESSION['USER_ACL_LEVEL']);
unset($_SESSION['PAGES']);
unset($_SESSION['USER_NAME']);
unset($_SESSION['UNIT']);
@@ -658,6 +681,7 @@ class Login extends \CoreLibs\DB\IO
$this->acl['base'] = $_SESSION['USER_ACL_LEVEL'];
}
}
$_SESSION['BASE_ACL_LEVEL'] = $this->acl['base'];
// set the current page acl
// start with default acl
@@ -722,7 +746,7 @@ class Login extends \CoreLibs\DB\IO
// PARAMS: edit_access_id to check
// RETURN: true/false: if the edit access is not in the valid list: false
// DESC : checks if this edit access id is valid
public function loginCheckEditAccess($edit_access_id)
public function loginCheckEditAccess($edit_access_id): bool
{
if (array_key_exists($edit_access_id, $this->acl['unit'])) {
return true;
@@ -757,7 +781,7 @@ class Login extends \CoreLibs\DB\IO
// PARAMS: set the minimum length
// RETURN: true/false on success
// DESC : sets the minium length and checks on valid
public function loginSetPasswordMinLength($length)
public function loginSetPasswordMinLength(int $length): bool
{
// check that numeric, positive numeric, not longer than max input string lenght
// and not short than min password length
@@ -1149,7 +1173,7 @@ EOM;
$q .= "ip, user_agent, referer, script_name, query_string, server_name, http_host, http_accept, http_accept_charset, http_accept_encoding, session_id, ";
$q .= "action, action_id, action_yes, action_flag, action_menu, action_loaded, action_value, action_error) ";
$q .= "VALUES ('".$this->dbEscapeString($username)."', 'PASSWORD', ".(($this->euid) ? $this->euid : 'NULL').", ";
$q .= "NOW(), '".$this->dbEscapeString($event)."', '".$this->dbEscapeString($error)."', '".$this->dbEscapeString($data)."', '".$data_binary."', '".$this->page_name."', ";
$q .= "NOW(), '".$this->dbEscapeString($event)."', '".$this->dbEscapeString((string)$error)."', '".$this->dbEscapeString($data)."', '".$data_binary."', '".$this->page_name."', ";
foreach (array(
'REMOTE_ADDR', 'HTTP_USER_AGENT', 'HTTP_REFERER', 'SCRIPT_FILENAME', 'QUERY_STRING', 'SERVER_NAME', 'HTTP_HOST', 'HTTP_ACCEPT', 'HTTP_ACCEPT_CHARSET', 'HTTP_ACCEPT_ENCODING'
) as $server_code) {
@@ -1160,7 +1184,13 @@ EOM;
}
}
$q .= "'".session_id()."', ";
$q .= "'".$this->dbEscapeString($this->action)."', '".$this->dbEscapeString($this->username)."', NULL, '".$this->dbEscapeString($this->login_error)."', NULL, NULL, '".$this->dbEscapeString($this->permission_okay)."', NULL)";
$q .= "'".$this->dbEscapeString($this->action)."', ";
$q .= "'".$this->dbEscapeString($this->username)."', ";
$q .= "NULL, ";
$q .= "'".$this->dbEscapeString((string)$this->login_error)."', ";
$q .= "NULL, NULL, ";
$q .= "'".$this->dbEscapeString((string)$this->permission_okay)."', ";
$q .= "NULL)";
$this->dbExec($q, 'NULL');
}

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*********************************************************************
* AUTHOR: Clemens Schwaighofer
* CREATED: 2006/08/15
@@ -27,7 +27,6 @@ namespace CoreLibs\Admin;
class Backend extends \CoreLibs\DB\IO
{
// page name
public $page_name; // the name of the current page
public $menu = array();
public $menu_show_flag = 0; // top menu flag (mostly string)
// action ids
@@ -43,6 +42,9 @@ class Backend extends \CoreLibs\DB\IO
public $action_error;
// ACL array variable if we want to set acl data from outisde
public $acl = array ();
public $default_acl;
// queue key
public $queue_key;
// the current active edit access id
public $edit_access_id;
// error/warning/info messages
@@ -55,15 +57,41 @@ class Backend extends \CoreLibs\DB\IO
public $HEADER;
public $DEBUG_DATA;
public $CONTENT_DATA;
// smarty include/set var
public $INC_TEMPLATE_NAME;
public $JS_TEMPLATE_NAME;
public $CSS_TEMPLATE_NAME;
public $CSS_SPECIAL_TEMPLATE_NAME;
public $JS_SPECIAL_TEMPLATE_NAME;
public $CACHE_ID;
public $COMPILE_ID;
public $includes;
public $template_path;
public $lang_dir;
public $javascript;
public $css;
public $pictures;
public $cache_pictures;
public $cache_pictures_root;
public $JS_INCLUDE;
public $JS_SPECIAL_INCLUDE;
public $CSS_INCLUDE;
public $CSS_SPECIAL_INCLUDE;
// language
public $l;
// CONSTRUCTOR / DECONSTRUCTOR |====================================>
public function __construct($db_config, $lang, $debug = 0, $db_debug = 0, $echo = 1, $print = 0)
// METHOD: __construct
// PARAMS: array db config
// string for language set
// int set control flag (for core basic set/get var error control)
public function __construct(array $db_config, string $lang, int $set_control_flag = 0)
{
// get the language sub class & init it
$this->l = new \CoreLibs\Language\L10n($lang);
// init the database class
parent::__construct($db_config, $debug, $db_debug, $echo, $print);
parent::__construct($db_config, $set_control_flag);
// internal
$this->class_info["adbBackend"] = array(
@@ -73,9 +101,6 @@ class Backend extends \CoreLibs\DB\IO
"class_author" => "Clemens Schwaighofer"
);
// set page name
$this->page_name = $this->getPageName();
// set the action ids
foreach ($this->action_list as $_action) {
$this->$_action = (isset($_POST[$_action])) ? $_POST[$_action] : '';
@@ -83,24 +108,9 @@ class Backend extends \CoreLibs\DB\IO
$this->default_acl = DEFAULT_ACL_LEVEL;
// random key generation
$this->key_range = array_merge(range('A', 'Z'), range('a', 'z'), range('0', '9'));
$GLOBALS["_KEY_RANGE"] = $this->key_range;
$this->one_key_length = count($this->key_range);
$this->key_length = 4; // pow($this->one_key_length, 4); // hardcoded, should be more than enought (62*62*62*62)
// queue key
if (preg_match("/^(add|save|delete|remove|move|up|down|push_live)$/", $this->action)) {
$this->queue_key = join(
'',
array_map(
function () {
$range = $GLOBALS['_KEY_RANGE'];
return $range[rand(0, (count($range) - 1))];
},
range(1, 3)
)
);
$this->queue_key = $this->randomKeyGen(3);
}
}
@@ -116,16 +126,18 @@ class Backend extends \CoreLibs\DB\IO
// PUBLIC METHODS |=================================================>
// METHOD: adbEditLog()
// PARAMS: event -> any kind of event description, data -> any kind of data related to that event
// PARAMS: event -> any kind of event description,
// data -> any kind of data related to that event
// RETURN: none
// DESC : writes all action vars plus other info into edit_log table
public function adbEditLog($event = '', $data = '', $write_type = 'STRING')
public function adbEditLog(string $event = '', $data = '', string $write_type = 'STRING')
{
if ($write_type == 'BINARY') {
$data_binary = $this->dbEscapeBytea(bzcompress(serialize($data)));
$data = 'see bzip compressed data_binary field';
}
if ($write_type == 'STRING') {
$data_binary = '';
$data = $this->dbEscapeString(serialize($data));
}
@@ -134,17 +146,27 @@ class Backend extends \CoreLibs\DB\IO
$q .= "ip, user_agent, referer, script_name, query_string, server_name, http_host, http_accept, http_accept_charset, http_accept_encoding, session_id, ";
$q .= "action, action_id, action_yes, action_flag, action_menu, action_loaded, action_value, action_error) ";
$q .= "VALUES ";
$q .= "(".@$_SESSION['EUID'].", NOW(), '".$this->dbEscapeString($event)."', '".$data."', '".$data_binary."', '".$this->page_name."', ";
$q .= "(".$this->dbEscapeString(isset($_SESSION['EUID']) ? $_SESSION['EUID'] : '').", ";
$q .= "NOW(), ";
$q .= "'".$this->dbEscapeString($event)."', '".$data."', '".$data_binary."', '".$this->dbEscapeString($this->page_name)."', ";
$q .= "'".@$_SERVER["REMOTE_ADDR"]."', '".$this->dbEscapeString(@$_SERVER['HTTP_USER_AGENT'])."', ";
$q .= "'".$this->dbEscapeString(@$_SERVER['HTTP_REFERER'])."', '".$this->dbEscapeString(@$_SERVER['SCRIPT_FILENAME'])."', ";
$q .= "'".$this->dbEscapeString(@$_SERVER['QUERY_STRING'])."', '".$this->dbEscapeString(@$_SERVER['SERVER_NAME'])."', ";
$q .= "'".$this->dbEscapeString(@$_SERVER['HTTP_HOST'])."', '".$this->dbEscapeString(@$_SERVER['HTTP_ACCEPT'])."', ";
$q .= "'".$this->dbEscapeString(@$_SERVER['HTTP_ACCEPT_CHARSET'])."', '".$this->dbEscapeString(@$_SERVER['HTTP_ACCEPT_ENCODING'])."', ";
$q .= "'".$this->dbEscapeString(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '')."', ";
$q .= "'".$this->dbEscapeString(isset($_SERVER['SCRIPT_FILENAME']) ? $_SERVER['SCRIPT_FILENAME'] : '')."', ";
$q .= "'".$this->dbEscapeString(isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '')."', ";
$q .= "'".$this->dbEscapeString(isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : '')."', ";
$q .= "'".$this->dbEscapeString(isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '')."', ";
$q .= "'".$this->dbEscapeString(isset($_SERVER['HTTP_ACCEPT']) ? $_SERVER['HTTP_ACCEPT'] : '')."', ";
$q .= "'".$this->dbEscapeString(isset($_SERVER['HTTP_ACCEPT_CHARSET']) ? $_SERVER['HTTP_ACCEPT_CHARSET'] : '')."', ";
$q .= "'".$this->dbEscapeString(isset($_SERVER['HTTP_ACCEPT_ENCODING']) ? $_SERVER['HTTP_ACCEPT_ENCODING'] : '')."', ";
$q .= "'".session_id()."', ";
$q .= "'".$this->dbEscapeString($this->action)."', '".$this->dbEscapeString($this->action_id)."', ";
$q .= "'".$this->dbEscapeString($this->action_yes)."', '".$this->dbEscapeString($this->action_flag)."', ";
$q .= "'".$this->dbEscapeString($this->action_menu)."', '".$this->dbEscapeString($this->action_loaded)."', ";
$q .= "'".$this->dbEscapeString($this->action_value)."', '".$this->dbEscapeString($this->action_error)."')";
$q .= "'".$this->dbEscapeString($this->action)."', ";
$q .= "'".$this->dbEscapeString($this->action_id)."', ";
$q .= "'".$this->dbEscapeString($this->action_yes)."', ";
$q .= "'".$this->dbEscapeString($this->action_flag)."', ";
$q .= "'".$this->dbEscapeString($this->action_menu)."', ";
$q .= "'".$this->dbEscapeString($this->action_loaded)."', ";
$q .= "'".$this->dbEscapeString($this->action_value)."', ";
$q .= "'".$this->dbEscapeString($this->action_error)."')";
$this->dbExec($q, 'NULL');
}
@@ -152,16 +174,19 @@ class Backend extends \CoreLibs\DB\IO
// PARAMS: level
// RETURN: returns an array for the top menu with all correct settings
// DESC : menu creater
public function adbTopMenu($flag = 0)
public function adbTopMenu(int $flag = 0): array
{
if ($this->menu_show_flag) {
$flag = $this->menu_show_flag;
}
// get the session pages array
$pages = $_SESSION["PAGES"];
if (!is_array($pages)) {
$pages = array ();
$PAGES = $_SESSION['PAGES'];
if (!isset($PAGES) || !is_array($PAGES)) {
$PAGES = array ();
}
foreach ($PAGES as $PAGE_CUID => $PAGE_DATA) {
$pages[] = $PAGE_DATA;
}
// $this->debug('pages', $this->print_ar($pages));
// if flag is 0, then we show all, else, we show only the matching flagges array points
@@ -170,10 +195,10 @@ class Backend extends \CoreLibs\DB\IO
for ($i = 0, $iMax = count($pages); $i < $iMax; $i ++) {
$show = 0;
// is it visible in the menu & is it online
if ($pages[$i]["menu"] && $pages[$i]["online"]) {
if ($pages[$i]['menu'] && $pages[$i]['online']) {
// check if it falls into our flag if we have a flag
if ($flag) {
foreach ($pages[$i]["visible"] as $name => $key) {
foreach ($pages[$i]['visible'] as $name => $key) {
if ($key == $flag) {
$show = 1;
}
@@ -185,43 +210,51 @@ class Backend extends \CoreLibs\DB\IO
if ($show) {
// if it is popup, write popup arrayound
if ($pages[$i]["popup"]) {
$type = "popup";
if (isset($pages[$i]['popup']) && $pages[$i]['popup']) {
$type = 'popup';
} else {
$type = "normal";
$type = 'normal';
$pages[$i]['popup'] = 0;
}
$query_string = '';
if (count($pages[$i]["query"])) {
for ($j = 0, $jMax = count($pages[$i]["query"]); $j < $jMax; $j ++) {
if (count($pages[$i]['query'])) {
for ($j = 0, $jMax = count($pages[$i]['query']); $j < $jMax; $j ++) {
if (strlen($query_string)) {
$query_string .= "&";
$query_string .= '&';
}
$query_string .= $pages[$i]["query"][$j]["name"]."=";
if (!$pages[$i]["query"][$j]["dynamic"]) {
$query_string .= urlencode($pages[$i]["query"][$j]["value"]);
$query_string .= $pages[$i]['query'][$j]['name'].'=';
if (!$pages[$i]['query'][$j]['dynamic']) {
$query_string .= urlencode($pages[$i]['query'][$j]['value']);
} else {
$query_string .= $_GET[$pages[$i]["query"][$j]["value"]] ? urlencode($_GET[$pages[$i]["query"][$j]["value"]]) : urlencode($_POST[$pages[$i]["query"][$j]["value"]]);
$query_string .= $_GET[$pages[$i]['query'][$j]['value']] ? urlencode($_GET[$pages[$i]['query'][$j]['value']]) : urlencode($_POST[$pages[$i]['query'][$j]['value']]);
}
}
}
$url = $pages[$i]["filename"];
$url = $pages[$i]['filename'];
if (strlen($query_string)) {
$url .= "?".$query_string;
$url .= '?'.$query_string;
}
$name = $pages[$i]["page_name"];
$name = $pages[$i]['page_name'];
// if page name matchs -> set selected flag
$selected = 0;
if ($this->getPageName() == $pages[$i]["filename"]) {
if ($this->getPageName() == $pages[$i]['filename']) {
$selected = 1;
$this->page_name = $name;
}
// last check, is this menu point okay to show
$enabled = 0;
if ($this->adbShowMenuPoint($pages[$i]["filename"])) {
if ($this->adbShowMenuPoint($pages[$i]['filename'])) {
$enabled = 1;
}
// write in to view menu array
array_push($this->menu, array("name" => $this->l->__($name), "url" => $url, "selected" => $selected, "enabled" => $enabled, "type" => $type));
array_push($this->menu, array(
'name' => $this->l->__($name),
'url' => $url,
'selected' => $selected,
'enabled' => $enabled,
'popup' => $type == 'popup' ? 1 : 0,
'type' => $type
));
} // show page
} // online and in menu
} // for each page
@@ -232,12 +265,12 @@ class Backend extends \CoreLibs\DB\IO
// PARAMS: filename
// RETURN: returns boolean true/false
// DESC : checks if this filename is in the current situation (user id, etc) available
public function adbShowMenuPoint($filename)
public function adbShowMenuPoint(string $filename): bool
{
$enabled = 0;
$enabled = false;
switch ($filename) {
default:
$enabled = 1;
$enabled = true;
break;
};
return $enabled;
@@ -248,8 +281,9 @@ class Backend extends \CoreLibs\DB\IO
// PARAMS: db array, key, value part
// RETURN: returns and associative array
// DESC : creates out of a normal db_return array an assoc array
public function adbAssocArray($db_array, $key, $value)
public function adbAssocArray(array $db_array, $key, $value): array
{
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->genAssocArray($db_array, $key, $value);
}
@@ -258,8 +292,9 @@ class Backend extends \CoreLibs\DB\IO
// PARAMS: int
// RETURN: string
// DESC : converts bytes into formated string with KB, MB, etc
public function adbByteStringFormat($number)
public function adbByteStringFormat($number): string
{
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->byteStringFormat($number);
}
@@ -275,6 +310,7 @@ class Backend extends \CoreLibs\DB\IO
// DESC : converts picture to a thumbnail with max x and max y size
public function adbCreateThumbnail($pic, $size_x, $size_y, $dummy = false, $path = "", $cache = "")
{
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->createThumbnail($pic, $size_x, $size_y, $dummy, $path, $cache);
}
@@ -284,7 +320,7 @@ class Backend extends \CoreLibs\DB\IO
// var array -> optional data for a possible printf formated msg
// RETURN: none
// DESC : wrapper function to fill up the mssages array
public function adbMsg($level, $msg, $vars = array ())
public function adbMsg(string $level, string $msg, array $vars = array ()): void
{
if (!preg_match("/^info|warning|error$/", $level)) {
$level = "info";
@@ -317,8 +353,16 @@ class Backend extends \CoreLibs\DB\IO
// file -> string for special file copy actions; mostyle "test#live;..."
// RETURN: none
// DESC : writes live queue
public function adbLiveQueue($queue_key, $type, $target, $data, $key_name, $key_value, $associate = null, $file = null)
{
public function adbLiveQueue(
$queue_key,
$type,
$target,
$data,
$key_name,
$key_value,
$associate = null,
$file = null
) {
$q = "INSERT INTO ".GLOBAL_DB_SCHEMA.".live_queue (";
$q .= "queue_key, key_value, key_name, type, target, data, group_key, action, associate, file";
$q .= ") VALUES (";
@@ -342,8 +386,16 @@ class Backend extends \CoreLibs\DB\IO
// DESC : print the date/time drop downs, used in any queue/send/insert at date/time place
// NOTE : Basic class holds exact the same, except the Year/Month/Day/etc strings
// are translated in this call
public function adbPrintDateTime($year, $month, $day, $hour, $min, $suffix = '', $min_steps = 1, $name_pos_back = false)
{
public function adbPrintDateTime(
$year,
$month,
$day,
$hour,
$min,
string $suffix = '',
int $min_steps = 1,
bool $name_pos_back = false
) {
// get the build layout
$html_time = $this->printDateTime($year, $month, $day, $hour, $min, $suffix, $min_steps, $name_pos_back);
// translate the strings inside

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*********************************************************************
* AUTHOR: Clemens Schwaighofer
* CREATED: 2002/12/17
@@ -19,6 +19,7 @@
* PRIVATE METHOD:S
*
* HISTORY:
* 2019/9/11 (cs) error string 21->91, 22->92 for not overlapping with IO
* 2005/07/07 (cs) updated array class for postgres: set 0 & NULL if int field given, insert uses () values () syntax
* 2005/03/31 (cs) fixed the class call with all debug vars
* 2003-03-10: error_ids where still wrong chagned 11->21 and 12->22
@@ -51,17 +52,17 @@ class ArrayIO extends \CoreLibs\DB\IO
// PARAMS: db_config -> db_io class init vars
// table_array -> the array from the table
// table_name -> name of the table (for the array)
// db_debug -> turn on db_io debug output (DB_DEBUG as global var does the same)
// set_control_flag -> set basic class set/get variable error flags
// RETURN: none
// DESC : constructor for the array io class, set the
// primary key name automatically (from array)
public function __construct($db_config, $table_array, $table_name, $debug = 0, $db_debug = 0, $echo = 1, $print = 0)
public function __construct(array $db_config, array $table_array, string $table_name, int $set_control_flag = 0)
{
// instance db_io class
parent::__construct($db_config, $debug, $db_debug, $echo, $print);
parent::__construct($db_config, $set_control_flag);
// more error vars for this class
$this->error_string['21'] = 'No Primary Key given';
$this->error_string['22'] = 'Could not run Array Query';
$this->error_string['91'] = 'No Primary Key given';
$this->error_string['92'] = 'Could not run Array Query';
$this->table_array = $table_array;
$this->table_name = $table_name;
@@ -69,18 +70,19 @@ class ArrayIO extends \CoreLibs\DB\IO
// set primary key for given table_array
if (is_array($this->table_array)) {
foreach ($this->table_array as $key => $value) {
if ($value['pk']) {
if (isset($value['pk'])) {
$this->pk_name = $key;
}
}
} // set pk_name IF table_array was given
// internal
$this->class_info['db_array_io'] = array(
$this->class_info['db_array_io'] = array (
'class_name' => 'DB Array IO',
'class_version' => '1.0.0',
'class_created' => '2002/12/17',
'class_author' => 'Clemens Schwaighofer'
);
// echo "CALSS INFO POST [A]: <pre>".print_r($this->class_info, true)."</pre><br>";
}
// deconstruktor
@@ -158,7 +160,7 @@ class ArrayIO extends \CoreLibs\DB\IO
// if not set ... produce error
if (!$this->table_array[$this->pk_name]['value']) {
// if no PK found, error ...
$this->error_id = 21;
$this->error_id = 91;
$this->__dbError();
return 0;
} else {
@@ -204,7 +206,9 @@ class ArrayIO extends \CoreLibs\DB\IO
$q_where = '';
foreach ($this->table_array as $column => $data_array) {
// suchen nach bildern und lschen ...
if ($this->table_array[$column]['file'] && file_exists($this->table_array[$column]['url'].$this->table_array[$column]['value'])) {
if (!empty($this->table_array[$column]['file']) &&
file_exists($this->table_array[$column]['url'].$this->table_array[$column]['value'])
) {
if (file_exists($this->table_array[$column]['path'].$this->table_array[$column]['value'])) {
unlink($this->table_array[$column]['path'].$this->table_array[$column]['value']);
}
@@ -214,7 +218,7 @@ class ArrayIO extends \CoreLibs\DB\IO
}
}
// if we have a foreign key
if ($this->table_array[$column]['fk']) {
if (!empty($this->table_array[$column]['fk'])) {
// create FK constraint checks
if ($q_where) {
$q_where .= ' AND ';
@@ -232,7 +236,7 @@ class ArrayIO extends \CoreLibs\DB\IO
// if 0, error
unset($this->pk_id);
if (!$this->dbExec($q)) {
$this->error_id=22;
$this->error_id = 92;
$this->__dbError();
}
return $this->table_array;
@@ -263,7 +267,7 @@ class ArrayIO extends \CoreLibs\DB\IO
$q_select .= $column;
// check FK ...
if ($this->table_array[$column]['fk'] && $this->table_array[$column]['value']) {
if (isset($this->table_array[$column]['fk']) && isset($this->table_array[$column]['value'])) {
if ($q_where) {
$q_where .= ' AND ';
}
@@ -290,7 +294,9 @@ class ArrayIO extends \CoreLibs\DB\IO
if ($edit) {
$this->table_array[$column]['value'] = $res[$column];
// if password, also write to hidden
if ($this->table_array[$column]['type'] == 'password') {
if (isset($this->table_array[$column]['type']) &&
$this->table_array[$column]['type'] == 'password'
) {
$this->table_array[$column]['HIDDEN_value'] = $res[$column];
}
} else {
@@ -302,7 +308,7 @@ class ArrayIO extends \CoreLibs\DB\IO
// possible dbFetchArray errors ...
$this->pk_id = $this->table_array[$this->pk_name]['value'];
} else {
$this->error_id = 22;
$this->error_id = 92;
$this->__dbError();
}
return $this->table_array;
@@ -334,9 +340,9 @@ class ArrayIO extends \CoreLibs\DB\IO
$q_vars = '';
$q_where = '';
foreach ($this->table_array as $column => $data_array) {
/********************************* START FILE *************************************/
/********************************* START FILE *************************************/
// file upload
if ($this->table_array[$column]['file']) {
if (isset($this->table_array[$column]['file'])) {
// falls was im tmp drinnen, sprich ein upload, datei kopieren, Dateinamen in db schreiben
// falls datei schon am server (physischer pfad), dann einfach url in db schreiben (update)
// falls in 'delete' 'ja' dann loeschen (und gibts eh nur beim update)
@@ -381,12 +387,19 @@ class ArrayIO extends \CoreLibs\DB\IO
}
} // delete or upload
} // file IF
/********************************* END FILE **************************************/
/********************************* END FILE **************************************/
// do not write 'pk' (primary key) or 'view' values
if (!$this->table_array[$column]['pk'] && $this->table_array[$column]['type'] != 'view' && strlen($column) > 0) {
if (!isset($this->table_array[$column]['pk']) &&
isset($this->table_array[$column]['type']) &&
$this->table_array[$column]['type'] != 'view' &&
strlen($column) > 0
) {
// for password use hidden value if main is not set
if ($this->table_array[$column]['type'] == 'password' && !$this->table_array[$column]['value']) {
if (isset($this->table_array[$column]['type']) &&
$this->table_array[$column]['type'] == 'password' &&
empty($this->table_array[$column]['value'])
) {
$this->table_array[$column]['value'] = $this->table_array[$column]['HIDDEN_value'];
}
if (!$insert) {
@@ -399,41 +412,59 @@ class ArrayIO extends \CoreLibs\DB\IO
if (strlen($q_data)) {
$q_data .= ', ';
}
if ($q_vars) {
if (strlen($q_vars)) {
$q_vars .= ', ';
}
$q_vars .= $column;
}
// integer is different
if ($this->table_array[$column]['int'] || $this->table_array[$column]['int_null']) {
$this->debug('write_check', '[$column]['.$this->table_array[$column]['value'].'] Foo: '.isset($this->table_array[$column]['value']).' | '.$this->table_array[$column]['int_null']);
if (!$this->table_array[$column]['value'] && $this->table_array[$column]['int_null']) {
if (isset($this->table_array[$column]['int']) || isset($this->table_array[$column]['int_null'])) {
$this->debug('write_check', '['.$column.']['.$this->table_array[$column]['value'].']['.$this->table_array[$column]['type'].'] VALUE SET: '.isset($this->table_array[$column]['value']).' | INT NULL: '.isset($this->table_array[$column]['int_null']));
if (isset($this->table_array[$column]['value']) &&
!$this->table_array[$column]['value'] &&
isset($this->table_array[$column]['int_null'])
) {
$_value = 'NULL';
} elseif (!isset($this->table_array[$column]['value'])) {
} elseif (!isset($this->table_array[$column]['value']) ||
(isset($this->table_array[$column]['value']) && !$this->table_array[$column]['value'])
) {
$_value = 0;
} else {
$_value = $this->table_array[$column]['value'];
}
$q_data .= $_value;
} elseif ($this->table_array[$column]['bool']) {
} elseif (isset($this->table_array[$column]['bool'])) {
// boolean storeage (reverse check on ifset)
$q_data .= "'".$this->dbBoolean($this->table_array[$column]['value'], true)."'";
} elseif ($this->table_array[$column]["interval"]) {
} elseif (isset($this->table_array[$column]['interval'])) {
// for interval we check if no value, then we set null
if (!$this->table_array[$column]['value']) {
if (!isset($this->table_array[$column]['value']) ||
(isset($this->table_array[$column]['value']) && !$this->table_array[$column]['value'])
) {
$_value = 'NULL';
} elseif (isset($this->table_array[$column]['value'])) {
$_value = $this->table_array[$column]['value'];
}
$q_data .= $_value;
} else {
// normal string
$q_data .= "'";
// if add slashes do convert & add slashes else write AS is
if ($addslashes) {
$q_data .= $this->dbEscapeString($this->convertEntities($this->table_array[$column]['value']));
// if the error check is json, we set field to null if NOT set
// else normal string write
if (isset($this->table_array[$column]['error_check']) &&
$this->table_array[$column]['error_check'] == 'json' &&
(!isset($this->table_array[$column]['value']) || (isset($this->table_array[$column]['value']) && !$this->table_array[$column]['value']))
) {
$q_data .= 'NULL';
} else {
$q_data .= $this->dbEscapeString($this->table_array[$column]['value']);
// normal string
$q_data .= "'";
// if add slashes do convert & add slashes else write AS is
if ($addslashes) {
$q_data .= $this->dbEscapeString($this->convertEntities($this->table_array[$column]['value']));
} else {
$q_data .= $this->dbEscapeString($this->table_array[$column]['value']);
}
$q_data .= "'";
}
$q_data .= "'";
}
}
} // while ...
@@ -444,8 +475,8 @@ class ArrayIO extends \CoreLibs\DB\IO
// create select part & addition FK part
foreach ($this->table_array as $column => $data_array) {
// check FK ...
if ($this->table_array[$column]['fk'] && $this->table_array[$column]['value']) {
if ($q_where) {
if (isset($this->table_array[$column]['fk']) && isset($this->table_array[$column]['value'])) {
if (!empty($q_where)) {
$q_where .= ' AND ';
}
$q_where .= $column .= ' = '.$this->table_array[$column]['value'];
@@ -453,11 +484,11 @@ class ArrayIO extends \CoreLibs\DB\IO
}
// if no PK set, then get max ID from DB
if (!$this->table_array[$this->pk_name]["value"]) {
if (!$this->table_array[$this->pk_name]['value']) {
// max id, falls INSERT
$q = 'SELECT MAX('.$this->pk_name.') + 1 AS pk_id FROM '.$this->table_name;
$res = $this->dbReturnRow($q);
if (!$res['pk_id']) {
if (!isset($res['pk_id'])) {
$res['pk_id'] = 1;
}
$this->table_array[$this->pk_name]['value'] = $res['pk_id'];
@@ -468,7 +499,7 @@ class ArrayIO extends \CoreLibs\DB\IO
$q .= $q_data;
$q .= ' WHERE ';
$q .= $this->pk_name.' = '.$this->table_array[$this->pk_name]['value'].' ';
if ($q_where) {
if (!empty($q_where)) {
$q .= ' AND '.$q_where;
}
// set pk_id ... if it has changed or so
@@ -480,12 +511,12 @@ class ArrayIO extends \CoreLibs\DB\IO
// write primary key too
// if ($q_data)
// $q .= ", ";
// $q .= $this->pk_name." = ".$this->table_array[$this->pk_name]["value"]." ";
// $this->pk_id = $this->table_array[$this->pk_name]["value"];
// $q .= $this->pk_name." = ".$this->table_array[$this->pk_name]['value']." ";
// $this->pk_id = $this->table_array[$this->pk_name]['value'];
}
// return success or not
if (!$this->dbExec($q)) {
$this->error_id = 22;
$this->error_id = 92;
$this->__dbError();
}
// set primary key
@@ -506,48 +537,56 @@ class ArrayIO extends \CoreLibs\DB\IO
public function convert_data($text)
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->convertData($text);
}
public function convert_entities($text)
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->convertEntities($text);
}
public function db_dump_array($write = 0)
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->dbDumpArray($write);
}
public function db_check_pk_set()
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->dbCheckPkSet();
}
public function db_reset_array($reset_pk = 0)
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->dbResetArray($reset_pk);
}
public function db_delete($table_array = 0)
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->dbDelete($table_array);
}
public function db_read($edit = 0, $table_array = 0)
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->dbRead($edit, $table_array);
}
public function db_write($addslashes = 0, $table_array = 0)
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->dbWrite($addslashes, $table_array);
}
} // end of class

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/********************************************************************
* AUTHOR: Clemens Schwaighofer
* CREATED: 2000/11/23
@@ -270,14 +270,16 @@ class IO extends \CoreLibs\Basic
public $cursor; // actual cursor (DBH)
public $num_rows; // how many rows have been found
public $num_fields; // how many fields has the query
public $field_names; // array with the field names of the current query
public $field_names = array (); // array with the field names of the current query
public $insert_id; // last inserted ID
public $insert_id_ext; // extended insert ID (for data outside only primary key)
private $temp_sql;
// other vars
private $nbsp = ''; // used by print_array recursion function
// error & warning id
private $error_id;
private $warning_id;
private $had_warning;
// sub include with the database functions
private $db_functions;
@@ -285,7 +287,7 @@ class IO extends \CoreLibs\Basic
private $MAX_QUERY_CALL;
private $query_called = array ();
// error string
private $error_string = array ();
protected $error_string = array ();
// prepared list
public $prepare_cursor = array ();
// primary key per table list
@@ -300,14 +302,13 @@ class IO extends \CoreLibs\Basic
// METHOD __construct
// PARAMS db_config -> array with db, user, password & host
// debug -> turns debugging output on or of (default 0),
// debugging can also be triggerd via DB_DEBUG var on global level
// set_control_flag -> flags for core class get/set variable error handling
// RETURN nothing
// DESC constructor for db_clss
public function __construct($db_config, $debug = 0, $db_debug = 0, $echo = 1, $print = 0)
public function __construct(array $db_config, int $set_control_flag = 0)
{
// start basic class
parent::__construct($debug, $echo, $print);
parent::__construct($set_control_flag);
// dummy init array for db config if not array
if (!is_array($db_config)) {
$db_config = array ();
@@ -355,7 +356,7 @@ class IO extends \CoreLibs\Basic
$this->error_string['42'] = 'Cannot check for async query, none has been started yet.';
// set debug, either via global var, or debug var during call
$this->db_debug = $db_debug;
$this->db_debug = false;
// global overrules local
if (isset($GLOBALS['DB_DEBUG'])) {
$this->db_debug = $GLOBALS['DB_DEBUG'];
@@ -389,7 +390,7 @@ class IO extends \CoreLibs\Basic
'class_author' => 'Clemens Schwaighofer'
);
// all ok return true
// so we can check that we have a successful DB connection created
return true;
}
@@ -414,7 +415,7 @@ class IO extends \CoreLibs\Basic
// DESC :
// internal connection function. Used to connect to the DB if there is no connection done yet.
// Called before any execute
private function __connectToDB()
private function __connectToDB(): bool
{
// generate connect string
$this->dbh = $this->db_functions->__dbConnect($this->db_host, $this->db_user, $this->db_pwd, $this->db_name, $this->db_port, $this->db_ssl);
@@ -449,7 +450,7 @@ class IO extends \CoreLibs\Basic
// RETURN: none
// DESC : close db connection
// only used by the deconstructor
private function __closeDB()
private function __closeDB(): void
{
if (isset($this->dbh) && $this->dbh) {
$this->db_functions->__dbClose();
@@ -463,7 +464,7 @@ class IO extends \CoreLibs\Basic
// RETURN: true if matching, false if not
// DESC : checks if query is a SELECT, SHOW or WITH, if not error, 0 return
// NOTE : Query needs to start with SELECT, SHOW or WITH. if starts with "with" it is ignored
private function __checkQueryForSelect($query)
private function __checkQueryForSelect(string $query): bool
{
// perhaps allow spaces before select ?!?
if (preg_match("/^(select|show|with) /i", $query)) {
@@ -479,7 +480,7 @@ class IO extends \CoreLibs\Basic
// DESC : check for DELETE, INSERT, UPDATE
// : if pure is set to true, only when INSERT is set will return true
// NOTE : Queries need to start with INSERT, UPDATE, DELETE. Anything else is ignored
private function __checkQueryForInsert($query, $pure = false)
private function __checkQueryForInsert(string $query, bool $pure = false): bool
{
if ($pure && preg_match("/^insert /i", $query)) {
return true;
@@ -495,7 +496,7 @@ class IO extends \CoreLibs\Basic
// RETURN: true if UPDATE, else false
// DESC : returns true if the query starts with UPDATE
// NOTE : query NEEDS to start with UPDATE
private function __checkQueryForUpdate($query)
private function __checkQueryForUpdate(string $query): bool
{
if (preg_match("/^update /i", $query)) {
return true;
@@ -509,9 +510,12 @@ class IO extends \CoreLibs\Basic
// RETURN: string with printed and formated array
// DESC : internal funktion that creates the array
// NOTE : used in db_dump_data only
private function __printArray($array)
private function __printArray(array $array): string
{
$string = '';
if (!is_array($array)) {
$array = array ();
}
foreach ($array as $key => $value) {
$string .= $this->nbsp.'<b>'.$key.'</b> => ';
if (is_array($value)) {
@@ -534,7 +538,7 @@ class IO extends \CoreLibs\Basic
// type -> query identifiery (Q, I, etc)
// RETURN: none
// DESC : calls the basic class debug with strip command
private function __dbDebug($debug_id, $error_string, $id = '', $type = '')
private function __dbDebug(string $debug_id, string $error_string, string $id = '', string $type = ''): void
{
$prefix = '';
if ($id) {
@@ -557,7 +561,7 @@ class IO extends \CoreLibs\Basic
// RETURN: none
// DESC : if error_id set, writes long error string into error_msg
// NOTE : needed to make public so it can be called from DB.Array.IO too
public function __dbError($cursor = '', $msg = '')
public function __dbError($cursor = '', string $msg = ''): void
{
$pg_error_string = '';
$where_called = $this->getCallerMethod();
@@ -593,13 +597,16 @@ class IO extends \CoreLibs\Basic
// DESC : if there is the 'to_encoding' var set, and the field is in the wrong encoding converts it to the target
private function __dbConvertEncoding($row)
{
if ($this->to_encoding && $this->db_encoding) {
// go through each row and convert the encoding if needed
for ($i = 0; $i < $this->num_fields; $i ++) {
$from_encoding = mb_detect_encoding($row[$i]);
// convert only if encoding doesn't match and source is not pure ASCII
if ($from_encoding != $this->to_encoding && $from_encoding != 'ASCII') {
$row[$i] = mb_convert_encoding($row[$i], $this->to_encoding, $from_encoding);
// only do if array, else pass through row (can be false)
if (is_array($row)) {
if ($this->to_encoding && $this->db_encoding) {
// go through each row and convert the encoding if needed
foreach ($row as $key => $value) {
$from_encoding = mb_detect_encoding($value);
// convert only if encoding doesn't match and source is not pure ASCII
if ($from_encoding != $this->to_encoding && $from_encoding != 'ASCII') {
$row[$key] = mb_convert_encoding($value, $this->to_encoding, $from_encoding);
}
}
}
}
@@ -611,7 +618,7 @@ class IO extends \CoreLibs\Basic
// PARAMS: $stm_name, data array
// RETURN: query in prepared form
// DESC : for debug purpose replaces $1, $2, etc with actual data
private function __dbDebugPrepare($stm_name, $data = array())
private function __dbDebugPrepare(string $stm_name, array $data = array()): string
{
// get the keys from data array
$keys = array_keys($data);
@@ -628,7 +635,7 @@ class IO extends \CoreLibs\Basic
// PARAMS: insert/select/update/delete query
// RETURN: array with schema and table
// DESC : extracts schema and table from the query, if no schema returns just empty string
private function __dbReturnTable($query)
private function __dbReturnTable(string $query): array
{
if (preg_match("/^SELECT /i", $query)) {
preg_match("/ (FROM) (([\w_]+)\.)?([\w_]+) /i", $query, $matches);
@@ -649,7 +656,7 @@ class IO extends \CoreLibs\Basic
// * checks for insert if returning is set/pk name
// * sets internal md5 for query
// * checks multiple call count
private function __dbPrepareExec($query, $pk_name)
private function __dbPrepareExec(string $query, string $pk_name)
{
// to either use the returning method or the guess method for getting primary keys
$this->returning_id = false;
@@ -741,7 +748,7 @@ class IO extends \CoreLibs\Basic
// PARAMS: none
// RETURN: true on success or false if an error occured
// DESC : runs post execute for rows affected, field names, inserted primary key, etc
private function __dbPostExec()
private function __dbPostExec(): bool
{
// if FALSE returned, set error stuff
// if either the cursor is false
@@ -762,7 +769,7 @@ class IO extends \CoreLibs\Basic
// count the fields
$this->num_fields = $this->db_functions->__dbNumFields($this->cursor);
// set field names
unset($this->field_names);
$this->field_names = array ();
for ($i = 0; $i < $this->num_fields; $i ++) {
$this->field_names[] = $this->db_functions->__dbFieldName($this->cursor, $i);
}
@@ -784,7 +791,7 @@ class IO extends \CoreLibs\Basic
// we have returning, now we need to check if we get one or many returned
// we'll need to loop this, if we have multiple insert_id returns
while ($_insert_id = $this->db_functions->__dbFetchArray($this->cursor, PGSQL_ASSOC)) {
// echo "*** RETURNING: ".print_r($_insert_id, 1)."<br>";
// echo "*** RETURNING: ".print_r($_insert_id, true)."<br>";
$this->insert_id[] = $_insert_id;
}
// if we have only one, revert from array to single
@@ -1177,7 +1184,7 @@ class IO extends \CoreLibs\Basic
// like num_rows, num_fields, etc depending on query
// for INSERT INTO queries it is highly recommended to set the pk_name to avoid an additional
// read from the database for the PK NAME
public function dbExec($query = 0, $pk_name = '')
public function dbExec(string $query = '', string $pk_name = '')
{
// prepare and check if we can actually run it
if (($md5 = $this->__dbPrepareExec($query, $pk_name)) === false) {
@@ -1204,7 +1211,7 @@ class IO extends \CoreLibs\Basic
// for INSERT INTO queries it is highly recommended to set the pk_name to avoid an additional
// read from the database for the PK NAME
// NEEDS : dbCheckAsync
public function dbExecAsync($query, $pk_name = '')
public function dbExecAsync(string $query, string $pk_name = ''): bool
{
// prepare and check if we can actually run the query
if (($md5 = $this->__dbPrepareExec($query, $pk_name)) === false) {
@@ -1259,9 +1266,10 @@ class IO extends \CoreLibs\Basic
// WAS : db_fetch_array
// PARAMS: cusors -> the cursor from db_exec or pg_query/pg_exec/mysql_query
// if not set will use internal cursor, if not found, stops with 0 (error)
// assoc_only -> false is default, if true only assoc rows
// RETURN: a mixed row
// DESC : executes a cursor and returns the data, if no more data 0 will be returned
public function dbFetchArray($cursor = 0)
public function dbFetchArray($cursor = 0, bool $assoc_only = false)
{
// return false if no query or cursor set ...
if (!$cursor) {
@@ -1272,15 +1280,21 @@ class IO extends \CoreLibs\Basic
$this->__dbError();
return false;
}
return $this->__dbConvertEncoding($this->db_functions->__dbFetchArray($cursor));
return $this->__dbConvertEncoding(
$this->db_functions->__dbFetchArray(
$cursor,
$this->db_functions->__dbResultType($assoc_only)
)
);
}
// METHOD: dbReturnRow
// WAS : db_return_row
// PARAMS: query -> the query to be executed
// assoc_only -> if true, only return assoc entry, else both (pgsql)
// RETURN: mixed db result
// DESC : returns the FIRST row of the given query
public function dbReturnRow($query)
public function dbReturnRow(string $query, bool $assoc_only = false)
{
if (!$query) {
$this->error_id = 11;
@@ -1294,16 +1308,17 @@ class IO extends \CoreLibs\Basic
return false;
}
$cursor = $this->dbExec($query);
$result = $this->dbFetchArray($cursor);
$result = $this->dbFetchArray($cursor, $assoc_only);
return $result;
}
// METHOD: dbReturnArray
// WAS : db_return_array
// PARAMS: query -> the query to be executed, named_only -> if true, only name ref are returned
// PARAMS: query -> the query to be executed
// assoc_only -> if true, only name ref are returned
// RETURN: array of hashes (row -> fields)
// DESC : createds an array of hashes of the query (all data)
public function dbReturnArray($query, $named_only = 0)
public function dbReturnArray(string $query, bool $assoc_only = false)
{
if (!$query) {
$this->error_id = 11;
@@ -1317,14 +1332,9 @@ class IO extends \CoreLibs\Basic
return false;
}
$cursor = $this->dbExec($query);
while ($res = $this->dbFetchArray($cursor)) {
while ($res = $this->dbFetchArray($cursor, $assoc_only)) {
for ($i = 0; $i < $this->num_fields; $i ++) {
// cereated mixed, first name
$data[$this->field_names[$i]] = $res[$this->field_names[$i]];
// then number
if (!$named_only) {
$data[$i] = $res[$this->field_names[$i]];
}
}
$rows[] = $data;
}
@@ -1336,7 +1346,7 @@ class IO extends \CoreLibs\Basic
// PARAMS: $query -> query to find in cursor_ext
// RETURN: position (int)
// DESC : returns the current position the read out
public function dbCursorPos($query)
public function dbCursorPos(string $query)
{
if (!$query) {
$this->error_id = 11;
@@ -1352,7 +1362,7 @@ class IO extends \CoreLibs\Basic
// PARAMS: $query -> query to find in cursor_ext
// RETURN: row count (int)
// DESC : returns the number of rows for the current select query
public function dbCursorNumRows($query)
public function dbCursorNumRows(string $query)
{
if (!$query) {
$this->error_id = 11;
@@ -1367,9 +1377,9 @@ class IO extends \CoreLibs\Basic
// WAS : db_show_table_meta_data
// PARAMS: $table -> table name
// $schema -> optional schema name
// RETURN: array of table data
// RETURN: array of table data, false on error (table not found)
// DESC : returns an array of the table with columns and values. FALSE on no table found
public function dbShowTableMetaData($table, $schema = '')
public function dbShowTableMetaData(string $table, string $schema = '')
{
$table = ($schema ? $schema.'.' : '').$table;
@@ -1383,11 +1393,11 @@ class IO extends \CoreLibs\Basic
// METHOD: dbPrepare
// WAS : db_prepare
// PARAMS: $stm_name, $query, $pk_name: optional
// RETURN: false on error
// RETURN: false on error, true on warning or result on full ok
// DESC : prepares a query
// for INSERT INTO queries it is highly recommended to set the pk_name to avoid an additional
// read from the database for the PK NAME
public function dbPrepare($stm_name, $query, $pk_name = '')
public function dbPrepare(string $stm_name, string $query, string $pk_name = '')
{
if (!$query) {
$this->error_id = 11;
@@ -1466,9 +1476,9 @@ class IO extends \CoreLibs\Basic
// METHOD: dbExecute
// WAS : db_execute
// PARAMS: $stm_name, data array
// RETURN: false on error
// RETURN: false on error, result on OK
// DESC : runs a prepare query
public function dbExecute($stm_name, $data = array())
public function dbExecute(string $stm_name, array $data = array())
{
// if we do not have no prepare cursor array entry for this statement name, abort
if (!is_array($this->prepare_cursor[$stm_name])) {
@@ -1489,22 +1499,25 @@ class IO extends \CoreLibs\Basic
if ($this->db_debug) {
$this->__dbDebug('db', $this->__dbDebugPrepare($stm_name, $data), 'dbExecPrep', 'Q');
}
$code = $this->db_functions->__dbExecute($stm_name, $data);
if (!$code) {
$result = $this->db_functions->__dbExecute($stm_name, $data);
if (!$result) {
$this->debug('ExecuteData', 'ERROR in STM['.$stm_name.'|'.$this->prepare_cursor[$stm_name]['result'].']: '.$this->print_ar($data));
$this->error_id = 22;
$this->__dbError($this->prepare_cursor[$stm_name]['result']);
$this->__dbDebug('db', '<span style="color: red;"><b>DB-Error</b> '.$stm_name.': Execution failed</span>', 'DB_ERROR');
return false;
}
if ($this->__checkQueryForInsert($this->prepare_cursor[$stm_name]['query'], true) && $this->prepare_cursor[$stm_name]['pk_name'] != 'NULL') {
if ($this->__checkQueryForInsert($this->prepare_cursor[$stm_name]['query'], true) &&
$this->prepare_cursor[$stm_name]['pk_name'] != 'NULL'
) {
if (!$this->prepare_cursor[$stm_name]['returning_id']) {
$this->insert_id = $this->db_functions->__dbInsertId($this->prepare_cursor[$stm_name]['query'], $this->prepare_cursor[$stm_name]['pk_name']);
} elseif ($code) {
} elseif ($result) {
$this->insert_id = array ();
$this->insert_id_ext = array ();
// we have returning, now we need to check if we get one or many returned
// we'll need to loop this, if we have multiple insert_id returns
while ($_insert_id = $this->db_functions->__dbFetchArray($code, PGSQL_ASSOC)) {
while ($_insert_id = $this->db_functions->__dbFetchArray($result, PGSQL_ASSOC)) {
$this->insert_id[] = $_insert_id;
}
// if we have only one, revert from arry to single
@@ -1514,7 +1527,9 @@ class IO extends \CoreLibs\Basic
// if this has only the pk_name, then only return this, else array of all data (but without the position)
// example if insert_id[0]['foo'] && insert_id[0]['bar'] it will become insert_id['foo'] & insert_id['bar']
// if only ['foo_id'] and it is the PK then the PK is directly written to the insert_id
if (count($this->insert_id[0]) > 1 || !array_key_exists($this->prepare_cursor[$stm_name]['pk_name'], $this->insert_id[0])) {
if (count($this->insert_id[0]) > 1 ||
!array_key_exists($this->prepare_cursor[$stm_name]['pk_name'], $this->insert_id[0])
) {
$this->insert_id_ext = $this->insert_id[0];
$this->insert_id = $this->insert_id[0][$this->prepare_cursor[$stm_name]['pk_name']];
} elseif ($this->insert_id[0][$this->prepare_cursor[$stm_name]['pk_name']]) {
@@ -1540,7 +1555,7 @@ class IO extends \CoreLibs\Basic
$this->__dbDebug('db', '<span style="color: orange;"><b>DB-Warning</b> '.$stm_name.': Could not get insert id</span>', 'DB_WARNING');
}
}
return $code;
return $result;
}
}
@@ -1549,7 +1564,7 @@ class IO extends \CoreLibs\Basic
// PARAMS: $string -> string to escape
// RETURN: escaped string
// DESC : neutral function to escape a string for DB writing
public function dbEscapeString($string)
public function dbEscapeString(string $string): string
{
return $this->db_functions->__dbEscapeString($string);
}
@@ -1569,7 +1584,7 @@ class IO extends \CoreLibs\Basic
// PARAMS: none
// RETURN: database version as string
// DESC : return current database version
public function dbVersion()
public function dbVersion(): string
{
return $this->db_functions->__dbVersion();
}
@@ -1580,10 +1595,10 @@ class IO extends \CoreLibs\Basic
// =X.Y, >X.Y, <X.Y
// RETURN: true/false
// DESC : returns boolean true or false if the string matches the database version
public function dbCompareVersion($compare)
public function dbCompareVersion(string $compare): bool
{
// compare has =, >, < prefix, and gets stripped, if the rest is not X.Y format then error
preg_match("/^([<>=]{1,2})(\d{1,2})\.(\d{1,2})/", $compare, $matches);
preg_match("/^([<>=]{1,})(\d{1,})\.(\d{1,})/", $compare, $matches);
$compare = $matches[1];
$to_master = $matches[2];
$to_minor = $matches[3];
@@ -1594,7 +1609,9 @@ class IO extends \CoreLibs\Basic
}
// db_version can return X.Y.Z
// we only compare the first two
list ($master, $minor, $_other) = explode('.', $this->dbVersion());
preg_match("/^(\d{1,})\.(\d{1,})\.?(\d{1,})?/", $this->dbVersion(), $matches);
$master = $matches[1];
$minor = $matches[2];
$version = $master.($minor < 10 ? '0' : '').$minor;
$return = false;
// compare
@@ -1695,6 +1712,7 @@ class IO extends \CoreLibs\Basic
// -> alternate the primary key can be an array with
// 'row' => 'row name', 'value' => 'data' to use a
// different column as the primary key
// !!! primary key can be an array or a number/string
// table -> name for the target table
// (optional)
// not_write_array -> list of elements not to write
@@ -1702,13 +1720,21 @@ class IO extends \CoreLibs\Basic
// data -> optional array with data, if not _POST vars are used
// RETURN: primary key id
// DESC : writes into one table based on array of table columns
public function dbWriteDataExt($write_array, $primary_key, $table, $not_write_array = array (), $not_write_update_array = array (), $data = array ())
{
public function dbWriteDataExt(
array $write_array,
$primary_key,
string $table,
array $not_write_array = array (),
array $not_write_update_array = array (),
array $data = array ()
) {
if (!is_array($primary_key)) {
$primary_key = array (
'row' => $table.'_id',
'value' => $primary_key
);
} elseif (!isset($primary_key['value'])) {
$primary_key['value'] = '';
}
// var set for strings
$q_sub_value = '';
@@ -1794,7 +1820,7 @@ class IO extends \CoreLibs\Basic
// micro on off (default false)
// RETURN: Y/M/D/h/m/s formatted string (like TimeStringFormat
// DESC : only for postgres. pretty formats an age or datetime difference string
public function dbTimeFormat($age, $show_micro = false)
public function dbTimeFormat(string $age, bool $show_micro = false): string
{
// in string (datetime diff): 1786 days 22:11:52.87418
// or (age): 4 years 10 mons 21 days 12:31:11.87418
@@ -1816,7 +1842,7 @@ class IO extends \CoreLibs\Basic
// PARAMS: text: input text to parse to an array
// RETURN: PHP array of the parsed data
// DESC : this is only needed for Postgresql. Converts postgresql arrays to PHP
public function dbArrayParse($text)
public function dbArrayParse(string $text): array
{
$output = array ();
return $this->db_functions->__dbArrayParse($text, $output);
@@ -1828,23 +1854,23 @@ class IO extends \CoreLibs\Basic
// kbn -> escape trigger type
// RETURN: escaped value
// DESC : clear up any data for valid DB insert
public function dbSqlEscape($value, $kbn = "")
public function dbSqlEscape($value, string $kbn = '')
{
switch ($kbn) {
case "i":
$value = (!isset($value) || $value === "") ? "NULL" : intval($value);
case 'i':
$value = (!isset($value) || $value === '') ? "NULL" : intval($value);
break;
case "f":
$value = (!isset($value) || $value === "") ? "NULL" : floatval($value);
case 'f':
$value = (!isset($value) || $value === '') ? "NULL" : floatval($value);
break;
case "t":
$value = (!isset($value) || $value === "") ? "NULL" : "'".$this->dbEscapeString($value)."'";
case 't':
$value = (!isset($value) || $value === '') ? "NULL" : "'".$this->dbEscapeString($value)."'";
break;
case "d":
$value = (!isset($value) || $value === "") ? "NULL" : "'".$this->dbEscapeString($value)."'";
case 'd':
$value = (!isset($value) || $value === '') ? "NULL" : "'".$this->dbEscapeString($value)."'";
break;
case "i2":
$value = (!isset($value) || $value === "") ? 0 : intval($value);
case 'i2':
$value = (!isset($value) || $value === '') ? 0 : intval($value);
break;
}
return $value;
@@ -1859,264 +1885,308 @@ class IO extends \CoreLibs\Basic
private function _connect_to_db()
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->__connectToDB();
}
private function _close_db()
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->__closeDB();
}
private function _check_query_for_select($query)
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->__checkQueryForSelect($query);
}
private function _check_query_for_insert($query, $pure = false)
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->__checkQueryForInsert($query, $pure);
}
private function _print_array($array)
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->__printArray($array);
}
private function _db_debug($debug_id, $error_string, $id = '', $type = '')
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->__dbDebug($debug_id, $error_string, $id, $type);
}
public function _db_error($cursor = '', $msg = '')
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->__dbError($cursor, $msg);
}
private function _db_convert_encoding($row)
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->__dbConvertEncoding($row);
}
private function _db_debug_prepare($stm_name, $data = array())
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->__dbDebugPrepare($stm_name, $data);
}
private function _db_return_table($query)
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->__dbReturnTable($query);
}
private function _db_prepare_exec($query, $pk_name)
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->__dbPrepareExec($query, $pk_name);
}
private function _db_post_exec()
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->__dbPostExec();
}
public function db_set_debug($debug = '')
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->dbSetDebug($debug);
}
public function db_reset_query_called($query)
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->dbResetQueryCalled($query);
}
public function db_get_query_called($query)
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->dbGetQueryCalled($query);
}
public function db_close()
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->dbClose();
}
public function db_set_schema($db_schema = '')
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->dbSetSchema($db_schema);
}
public function db_get_schema()
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->dbGetSchema();
}
public function db_set_encoding($db_encoding = '')
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->dbSetEncoding($db_encoding);
}
public function db_info($show = 1)
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->dbInfo($show);
}
public function db_dump_data($query = 0)
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->dbDumpData($query);
}
public function db_return($query, $reset = 0)
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->dbReturn($query, $reset);
}
public function db_cache_reset($query)
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->dbCacheReset($query);
}
public function db_exec($query = 0, $pk_name = '')
public function db_exec($query = '', $pk_name = '')
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->dbExec($query, $pk_name);
}
public function db_exec_async($query, $pk_name = '')
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->dbExecAsync($query, $pk_name);
}
public function db_check_async()
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->dbCheckAsync();
}
public function db_fetch_array($cursor = 0)
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->dbFetchArray($cursor);
}
public function db_return_row($query)
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->dbReturnRow($query);
}
public function db_return_array($query, $named_only = 0)
public function db_return_array($query, $named_only = false)
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->dbReturnArray($query, $named_only);
}
public function db_cursor_pos($query)
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->dbCursorPos($query);
}
public function db_cursor_num_rows($query)
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->dbCursorNumRows($query);
}
public function db_show_table_meta_data($table, $schema = '')
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->dbShowTableMetaData($table, $schema);
}
public function db_prepare($stm_name, $query, $pk_name = '')
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->dbPrepare($stm_name, $query, $pk_name);
}
public function db_execute($stm_name, $data = array())
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->dbExecute($stm_name, $data);
}
public function db_escape_string($string)
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->dbEscapeString($string);
}
public function db_escape_bytea($bytea)
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->dbEscapeBytea($bytea);
}
public function db_version()
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->dbVersion();
}
public function db_compare_version($compare)
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->dbCompareVersion($compare);
}
public function db_boolean($string, $rev = false)
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->dbBoolean($string, $rev);
}
public function db_write_data($write_array, $not_write_array, $primary_key, $table, $data = array ())
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->dbWriteData($write_array, $not_write_array, $primary_key, $table, $data);
}
public function db_write_data_ext($write_array, $primary_key, $table, $not_write_array = array (), $not_write_update_array = array (), $data = array ())
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->dbWriteDataExt($write_array, $primary_key, $table, $not_write_array, $not_write_update_array, $data);
}
public function db_time_format($age, $show_micro = false)
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->dbTimeFormat($age, $show_micro);
}
public function db_array_parse($text)
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->dbArrayParse($text);
}
public function db_sql_escape($value, $kbn = "")
{
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
return $this->dbSqlEscape($value, $kbn);
}
} // end if db class

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*********************************************************************
* AUTHOR: Clemens Schwaighofer
* CREATED: 2003/04/09
@@ -190,6 +190,9 @@ class PgSQL
// DESC : wrapper for pg_fetch_array
public function __dbFetchArray($cursor, $result_type = '')
{
if ($result_type == true) {
$result_type = PGSQL_ASSOC;
}
// result type is passed on as is [should be checked]
if ($result_type) {
return pg_fetch_array($cursor, null, $result_type);
@@ -198,6 +201,18 @@ class PgSQL
}
}
// METHOD: __dbResultType
// PARAMS: true/false for ASSOC only or BOTH
// RETURN: PGSQL assoc type
// DESC : simple match up between assoc true/false
public function __dbResultType($assoc_type)
{
if ($assoc_type == true) {
return PGSQL_ASSOC;
}
return ''; // fallback to default
}
// METHOD: __dbFetchAll
// WAS : _db_fetch_all
// PARAMS: cursor
@@ -361,7 +376,7 @@ class PgSQL
// DESC : wrapper for pg_escape_string
public function __dbEscapeString($string)
{
return pg_escape_string($this->dbh, $string);
return pg_escape_string($this->dbh, (string)$string);
}
// METHOD: __dbEscapeBytea

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
Copyright (c) 2003, 2005, 2006, 2009 Danilo Segan <danilo@kvota.net>.

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
Copyright (c) 2003, 2005, 2006, 2009 Danilo Segan <danilo@kvota.net>.

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
Copyright (c) 2003, 2009 Danilo Segan <danilo@kvota.net>.
Copyright (c) 2005 Nico Kaiser <nico@siriux.net>
@@ -50,7 +50,7 @@ class GetTextReader
private $total = 0; // total string count
private $table_originals = null; // table for original strings (offsets)
private $table_translations = null; // table for translated strings (offsets)
private $cache_translations = null; // original -> translation mapping
private $cache_translations = array (); // original -> translation mapping
/* Methods */
@@ -272,7 +272,7 @@ class GetTextReader
if ($this->enable_cache) {
// Caching enabled, get translated string from cache
if (array_key_exists($string, $this->cache_translations)) {
if (is_array($this->cache_translations) && array_key_exists($string, $this->cache_translations)) {
return $this->cache_translations[$string];
} else {
return $string;
@@ -355,7 +355,7 @@ class GetTextReader
// cache header field for plural forms
if (! is_string($this->pluralheader)) {
if ($this->enable_cache) {
$header = $this->cache_translations[""];
$header = $this->cache_translations[''];
} else {
$header = $this->get_translation_string(0);
}
@@ -415,7 +415,7 @@ class GetTextReader
$key = $single . chr(0) . $plural;
if ($this->enable_cache) {
if (! array_key_exists($key, $this->cache_translations)) {
if (is_array($this->cache_translations) && !array_key_exists($key, $this->cache_translations)) {
return ($number != 1) ? $plural : $single;
} else {
$result = $this->cache_translations[$key];

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
Copyright (c) 2003, 2005, 2006, 2009 Danilo Segan <danilo@kvota.net>.

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
Copyright (c) 2003, 2005, 2006, 2009 Danilo Segan <danilo@kvota.net>.

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*********************************************************************
* AUTHOR: Clemens Schwaighofer
* CREATED: 2004/11/18
@@ -35,7 +35,7 @@ class L10n extends \CoreLibs\Basic
private $input;
private $l10n;
public function __construct($lang = '', $path = '')
public function __construct(string $lang = '', string $path = '')
{
if (!$lang) {
$this->lang = 'en';
@@ -60,7 +60,7 @@ class L10n extends \CoreLibs\Basic
}
// reloads the mofile, if the location of the lang file changes
public function l10nReloadMOfile($lang, $path = '')
public function l10nReloadMOfile(string $lang, string $path = ''): bool
{
$success = false;
$old_mofile = $this->mofile;

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* Class ProgressBar
*
@@ -481,7 +481,7 @@ class ProgressBar
$js .= ' }'."\n";
$js .= '}'."\n";
// print "DUMP LABEL: <br><pre>".print_r($this->label, 1)."</pre><br>";
// print "DUMP LABEL: <br><pre>".print_r($this->label, true)."</pre><br>";
foreach ($this->label as $name => $data) {
// set what type of move we do
$move_prefix = $data['type'] == 'button' ? 'margin' : 'padding';

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/********************************************************************
* AUTHOR: Clemens Schwaighofer
* CREATED: 2004/12/21
@@ -20,7 +20,7 @@ class SmartyExtend extends SmartyBC
public $l10n;
// constructor class, just sets the language stuff
public function __construct($lang)
public function __construct(string $lang)
{
SmartyBC::__construct();
$this->l10n = new \CoreLibs\Language\L10n($lang);

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*********************************************************************
* AUTHOR: Clemens Schwaighofer
* CREATED: 2011/2/8

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
namespace Autoloader;

2
www/media/video/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*
!.gitignore