Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b6a35d15cf | ||
|
|
20c44694e8 |
@@ -82,17 +82,17 @@ return [
|
||||
// A list of directories holding code that we want
|
||||
// to parse, but not analyze
|
||||
"exclude_analysis_directory_list" => [
|
||||
'www/vendor',
|
||||
'www/lib/FileUpload',
|
||||
'www/lib/pChart',
|
||||
'www/lib/pChart2.1.4',
|
||||
'www/lib/Smarty',
|
||||
'www/lib/smarty-3.1.30',
|
||||
'www/templates_c',
|
||||
'www/log',
|
||||
'www/tmp',
|
||||
'www/cache',
|
||||
'www/media',
|
||||
'www/vendor',
|
||||
'www/lib/FileUpload',
|
||||
'www/lib/pChart',
|
||||
'www/lib/pChart2.1.4',
|
||||
'www/lib/Smarty',
|
||||
'www/lib/smarty-3.1.30',
|
||||
'www/templates_c',
|
||||
'www/log',
|
||||
'www/tmp',
|
||||
'www/cache',
|
||||
'www/media',
|
||||
],
|
||||
'exclude_file_list' => [
|
||||
// ignore all symlink files to edit
|
||||
|
||||
@@ -7,19 +7,18 @@
|
||||
* - DB access name (array group from config.db)
|
||||
* - location (test/stage/live)
|
||||
* - debug flag (true/false)
|
||||
* - DB path (eg PUBLIC_SCHEMA)
|
||||
* - stie lang
|
||||
* - site lang
|
||||
* HISTORY:
|
||||
*********************************************************************/
|
||||
|
||||
// other master config to attach
|
||||
// $LOCAL_CONFIG = array(
|
||||
// $__LOCAL_CONFIG = array(
|
||||
// 'db_host' => '',
|
||||
// 'location' => '',
|
||||
// 'debug_flag' => true,
|
||||
// 'site_lang' => 'en_utf8',
|
||||
// 'login_enabled' => true
|
||||
// )
|
||||
// );
|
||||
|
||||
// each host has a different db_host
|
||||
$SITE_CONFIG = array(
|
||||
@@ -39,7 +38,7 @@ $SITE_CONFIG = array(
|
||||
// enable/disable login override
|
||||
'login_enabled' => true
|
||||
),
|
||||
// 'other.host.com' => $LOCAL_CONFIG
|
||||
// 'other.host.com' => $__LOCAL_CONFIG
|
||||
);
|
||||
|
||||
// __END__
|
||||
|
||||
@@ -190,24 +190,24 @@ if (file_exists(BASE.CONFIGS.'config.path.php')) {
|
||||
// ** missing live domains **
|
||||
// get the name without the port
|
||||
list($HOST_NAME) = array_pad(explode(':', $_SERVER['HTTP_HOST'], 2), 2, null);
|
||||
// set HOST name
|
||||
DEFINE('HOST_NAME', $HOST_NAME);
|
||||
// BAIL ON:
|
||||
// we have either no db selction for this host but have db config entries
|
||||
// or we have a db selection but no db config as array or empty
|
||||
// or we have a selection but no matching db config entry
|
||||
if ((!isset($SITE_CONFIG[$HOST_NAME]['db_host']) && count($DB_CONFIG)) ||
|
||||
(isset($SITE_CONFIG[$HOST_NAME]['db_host']) &&
|
||||
if ((!isset($SITE_CONFIG[HOST_NAME]['db_host']) && count($DB_CONFIG)) ||
|
||||
(isset($SITE_CONFIG[HOST_NAME]['db_host']) &&
|
||||
// missing DB CONFIG
|
||||
((is_array($DB_CONFIG) && !count($DB_CONFIG)) ||
|
||||
!is_array($DB_CONFIG) ||
|
||||
// has DB CONFIG but no match
|
||||
(is_array($DB_CONFIG) && count($DB_CONFIG) && !isset($DB_CONFIG[$SITE_CONFIG[$HOST_NAME]['db_host']])))
|
||||
(is_array($DB_CONFIG) && count($DB_CONFIG) && !isset($DB_CONFIG[$SITE_CONFIG[HOST_NAME]['db_host']])))
|
||||
)
|
||||
) {
|
||||
echo 'No matching DB config found for: "'.$HOST_NAME.'". Contact Administrator';
|
||||
echo 'No matching DB config found for: "'.HOST_NAME.'". Contact Administrator';
|
||||
exit;
|
||||
}
|
||||
// set HOST name
|
||||
DEFINE('HOST_NAME', $HOST_NAME);
|
||||
// set SSL on
|
||||
if ((array_key_exists('HTTPS', $_SERVER) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ||
|
||||
$_SERVER['SERVER_PORT'] == 443) {
|
||||
@@ -218,7 +218,7 @@ if ((array_key_exists('HTTPS', $_SERVER) && !empty($_SERVER['HTTPS']) && $_SERVE
|
||||
DEFINE('HOST_PROTOCOL', 'http://');
|
||||
}
|
||||
// define the db config set name, the db config and the db schema
|
||||
DEFINE('DB_CONFIG_NAME', $SITE_CONFIG[$HOST_NAME]['db_host']);
|
||||
DEFINE('DB_CONFIG_NAME', $SITE_CONFIG[HOST_NAME]['db_host']);
|
||||
DEFINE('DB_CONFIG', isset($DB_CONFIG[DB_CONFIG_NAME]) ? $DB_CONFIG[DB_CONFIG_NAME] : array());
|
||||
// DEFINE('DB_CONFIG_TARGET', SITE_CONFIG[$HOST_NAME]['db_host_target']);
|
||||
// DEFINE('DB_CONFIG_OTHER', SITE_CONFIG[$HOST_NAME]['db_host_other']);
|
||||
@@ -226,10 +226,10 @@ DEFINE('DB_CONFIG', isset($DB_CONFIG[DB_CONFIG_NAME]) ? $DB_CONFIG[DB_CONFIG_NAM
|
||||
// DEFINE('LOGIN_DB_SCHEMA', PUBLIC_SCHEMA); // where the edit* tables are
|
||||
// DEFINE('GLOBAL_DB_SCHEMA', PUBLIC_SCHEMA); // where global tables are that are used by all schemas (eg queue tables for online, etc)
|
||||
// debug settings, site lang, etc
|
||||
DEFINE('TARGET', $SITE_CONFIG[$HOST_NAME]['location']);
|
||||
DEFINE('DEBUG', $SITE_CONFIG[$HOST_NAME]['debug_flag']);
|
||||
DEFINE('SITE_LANG', $SITE_CONFIG[$HOST_NAME]['site_lang']);
|
||||
DEFINE('LOGIN_ENABLED', $SITE_CONFIG[$HOST_NAME]['login_enabled']);
|
||||
DEFINE('TARGET', $SITE_CONFIG[HOST_NAME]['location']);
|
||||
DEFINE('DEBUG', $SITE_CONFIG[HOST_NAME]['debug_flag']);
|
||||
DEFINE('SITE_LANG', $SITE_CONFIG[HOST_NAME]['site_lang']);
|
||||
DEFINE('LOGIN_ENABLED', $SITE_CONFIG[HOST_NAME]['login_enabled']);
|
||||
// paths
|
||||
// DEFINE('CSV_PATH', $PATHS[TARGET]['csv_path']);
|
||||
// DEFINE('EXPORT_SCRIPT', $PATHS[TARGET]['perl_bin']);
|
||||
|
||||
@@ -27,6 +27,12 @@ $SET_SESSION_NAME = EDIT_SESSION_NAME;
|
||||
//------------------------------ library include end
|
||||
|
||||
//------------------------------ basic variable settings start
|
||||
if (!isset($AJAX_PAGE)) {
|
||||
$AJAX_PAGE = false;
|
||||
}
|
||||
if (!isset($ZIP_STREAM)) {
|
||||
$ZIP_STREAM = false;
|
||||
}
|
||||
// set encoding
|
||||
if (!isset($encoding)) {
|
||||
$encoding = DEFAULT_ENCODING;
|
||||
@@ -38,10 +44,10 @@ if (session_id() && $_SESSION['DEFAULT_LANG']) {
|
||||
$lang = defined('SITE_LANG') ? SITE_LANG : DEFAULT_LANG;
|
||||
}
|
||||
// end the stop of the output flow, but only if we didn't request a csv file download
|
||||
if (array_key_exists('action', $_POST) && $_POST['action'] != 'download_csv') {
|
||||
if (isset($_POST['action']) && $_POST['action'] != 'download_csv' && !$AJAX_PAGE) {
|
||||
header("Content-type: text/html; charset=".$encoding);
|
||||
}
|
||||
if (isset($AJAX_PAGE) && isset($ZIP_STREAM) && $AJAX_PAGE && !$ZIP_STREAM) {
|
||||
if ($AJAX_PAGE && !$ZIP_STREAM) {
|
||||
header("Content-Type: application/json; charset=UTF-8");
|
||||
}
|
||||
//------------------------------ basic variable settings start
|
||||
|
||||
@@ -29,21 +29,21 @@ if (isset($_SESSION['DEFAULT_LANG'])) {
|
||||
$lang_short = substr($lang, 0, 2);
|
||||
|
||||
// set include & template names
|
||||
$PAGE_FILE_NAME = str_replace(".php", "", $cms->page_name);
|
||||
$PAGE_FILE_NAME = str_replace('.php', '', $cms->page_name);
|
||||
// set include & template names
|
||||
if (!isset($CONTENT_INCLUDE)) {
|
||||
$CONTENT_INCLUDE = $PAGE_FILE_NAME.'.tpl';
|
||||
}
|
||||
$FORM_NAME = !isset($FORM_NAME) || !$FORM_NAME ? str_replace(".php", "", $cms->page_name) : $FORM_NAME;
|
||||
$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))).(defined(G_TITLE) ? ' - '.G_TITLE : '');
|
||||
// strip tpl and replace it with php
|
||||
// php include file per page
|
||||
$cms->INC_TEMPLATE_NAME = str_replace(".tpl", ".php", $CONTENT_INCLUDE);
|
||||
$cms->INC_TEMPLATE_NAME = str_replace('.tpl', '.php', $CONTENT_INCLUDE);
|
||||
// javascript include per page
|
||||
$cms->JS_TEMPLATE_NAME = str_replace(".tpl", ".js", $CONTENT_INCLUDE);
|
||||
$cms->JS_TEMPLATE_NAME = str_replace('.tpl', '.js', $CONTENT_INCLUDE);
|
||||
// css per page
|
||||
$cms->CSS_TEMPLATE_NAME = str_replace(".tpl", ".css", $CONTENT_INCLUDE);
|
||||
$cms->CSS_TEMPLATE_NAME = str_replace('.tpl', '.css', $CONTENT_INCLUDE);
|
||||
// special CSS file
|
||||
$cms->CSS_SPECIAL_TEMPLATE_NAME = isset($CSS_NAME) ? $CSS_NAME : '';
|
||||
// special JS file
|
||||
|
||||
@@ -69,16 +69,23 @@ $cms->DATA['messages'] = $cms->messages;
|
||||
|
||||
// top menu
|
||||
$cms->DATA['nav_menu'] = $cms->adbTopMenu();
|
||||
$cms->DATA['nav_menu_count'] = is_array($cms->DATA['nav_menu']) ? count($cms->DATA['nav_menu']) : 0;
|
||||
// the page name
|
||||
$cms->DATA['page_name'] = $cms->page_name;
|
||||
// user name
|
||||
$cms->DATA['USER_NAME'] = $_SESSION['USER_NAME'];
|
||||
$cms->DATA['ADMIN'] = $login->acl['admin'];
|
||||
// the template part to include into the body
|
||||
$cms->DATA['TEMPLATE_NAME'] = $TEMPLATE_NAME;
|
||||
$cms->DATA['CONTENT_INCLUDE'] = $CONTENT_INCLUDE;
|
||||
$cms->DATA['TEMPLATE_TRANSLATE'] = $TEMPLATE_TRANSLATE;
|
||||
$cms->DATA['PAGE_FILE_NAME'] = $PAGE_FILE_NAME;
|
||||
// LANG
|
||||
$cms->DATA['LANG'] = $lang;
|
||||
$cms->DATA['TINYMCE_LANG'] = $lang_short;
|
||||
// form name
|
||||
$cms->DATA['FORM_NAME'] = $FORM_NAME;
|
||||
// include flags
|
||||
$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;
|
||||
|
||||
@@ -471,13 +471,22 @@ class Basic
|
||||
* if strict mode is set, throws an error if the class variable is not set
|
||||
* default is strict mode false
|
||||
* @param mixed $name class variable name
|
||||
* @return void
|
||||
* @return mixed return set variable content
|
||||
*/
|
||||
public function __get($name): void
|
||||
public function &__get($name)
|
||||
{
|
||||
if ($this->set_strict_mode === true && !property_exists($this, $name)) {
|
||||
trigger_error('Undefined property via __get(): '.$name, E_USER_NOTICE);
|
||||
}
|
||||
// on set return
|
||||
if (property_exists($this, $name)) {
|
||||
return $this->$name;
|
||||
} elseif ($this->set_compatible === true && !property_exists($this, $name)) {
|
||||
// if it is not set, and we are in compatible mode we need to init.
|
||||
// This is so that $class->array['key'] = 'bar'; works
|
||||
$this->{$name} = null;
|
||||
return $this->$name;
|
||||
}
|
||||
}
|
||||
|
||||
// *************************************************************
|
||||
@@ -1164,18 +1173,19 @@ class Basic
|
||||
/**
|
||||
* searches key = value in an array / array
|
||||
* only returns the first one found
|
||||
* @param string|int $needle needle (search for)
|
||||
* @param array $haystack haystack (search in)
|
||||
* @param string $key_lookin the key to look out for, default empty
|
||||
* @return ?array array with the elements where the needle can be found in the haystack array
|
||||
* @param string|int $needle needle (search for)
|
||||
* @param array $haystack haystack (search in)
|
||||
* @param string|null $key_lookin the key to look out for, default empty
|
||||
* @return array array with the elements where the needle can be
|
||||
* found in the haystack array
|
||||
*/
|
||||
public static function arraySearchRecursive($needle, array $haystack, $key_lookin = ''): ?array
|
||||
public static function arraySearchRecursive($needle, array $haystack, ?string $key_lookin = null): array
|
||||
{
|
||||
$path = array();
|
||||
if (!is_array($haystack)) {
|
||||
$haystack = array();
|
||||
}
|
||||
if (!is_array($key_lookin) &&
|
||||
if ($key_lookin != null &&
|
||||
!empty($key_lookin) &&
|
||||
array_key_exists($key_lookin, $haystack) &&
|
||||
$needle === $haystack[$key_lookin]
|
||||
|
||||
@@ -305,8 +305,8 @@ class IO extends \CoreLibs\Basic
|
||||
|
||||
/**
|
||||
* main DB concstructor with auto connection to DB and failure set on failed connection
|
||||
* @param array $db_config DB configuration array
|
||||
* @param int|integer $set_control_flag Class set control flag
|
||||
* @param array $db_config DB configuration array
|
||||
* @param int $set_control_flag 0/1/2/3 to set internal class parameter check
|
||||
*/
|
||||
public function __construct(array $db_config, int $set_control_flag = 0)
|
||||
{
|
||||
@@ -1056,7 +1056,7 @@ class IO extends \CoreLibs\Basic
|
||||
// if it is a call with reset in it we reset the cursor, so we get an uncached return
|
||||
// but only for the FIRST call (pos == 0)
|
||||
if ($reset && !$this->cursor_ext[$md5]['pos']) {
|
||||
unset($this->cursor_ext[$md5]['cursor']);
|
||||
$this->cursor_ext[$md5]['cursor'] = null;
|
||||
}
|
||||
// $this->debug('MENU', 'Reset: '.$reset.', Cursor: '.$this->cursor_ext[$md5]['cursor'].', Pos: '.$this->cursor_ext[$md5]['pos'].', Query: '.$query);
|
||||
|
||||
@@ -1156,7 +1156,7 @@ class IO extends \CoreLibs\Basic
|
||||
// return row, if last && reset, then unset the hole md5 array
|
||||
if (!$return && ($reset == 1 || $reset == 3) && $this->cursor_ext[$md5]['pos']) {
|
||||
// unset only the field names here of course
|
||||
unset($this->cursor_ext[$md5]['field_names']);
|
||||
$this->cursor_ext[$md5]['field_names'] = array();
|
||||
$this->cursor_ext[$md5]['pos'] = 0;
|
||||
} elseif (!$return && $reset == 2 && $this->cursor_ext[$md5]['pos']) {
|
||||
// at end of read reset pos & set cursor to 1 (so it does not get lost in session transfer)
|
||||
|
||||
Reference in New Issue
Block a user