Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3ae3b1b761 |
@@ -24,12 +24,10 @@ if (!defined('SET_SESSION_NAME')) {
|
|||||||
}
|
}
|
||||||
// define log file id
|
// define log file id
|
||||||
$LOG_FILE_ID = 'classTest';
|
$LOG_FILE_ID = 'classTest';
|
||||||
// set language for l10n
|
|
||||||
$lang = 'en_utf8';
|
|
||||||
|
|
||||||
// init login & backend class
|
// init login & backend class
|
||||||
$login = new CoreLibs\ACL\Login(DB_CONFIG, $lang);
|
$login = new CoreLibs\ACL\Login(DB_CONFIG);
|
||||||
$basic = new CoreLibs\Admin\Backend(DB_CONFIG, $lang);
|
$basic = new CoreLibs\Admin\Backend(DB_CONFIG);
|
||||||
$basic->dbInfo(true);
|
$basic->dbInfo(true);
|
||||||
ob_end_flush();
|
ob_end_flush();
|
||||||
|
|
||||||
|
|||||||
@@ -14,8 +14,7 @@ $SET_SESSION_NAME = EDIT_SESSION_NAME;
|
|||||||
|
|
||||||
echo "DIR: ".DIR."<br>ROOT: ".ROOT."<br>BASE: ".BASE."<br>";
|
echo "DIR: ".DIR."<br>ROOT: ".ROOT."<br>BASE: ".BASE."<br>";
|
||||||
|
|
||||||
$lang = 'ja_utf8';
|
$base = new CoreLibs\Admin\Backend(DB_CONFIG);
|
||||||
$base = new CoreLibs\Admin\Backend(DB_CONFIG, $lang);
|
|
||||||
ob_end_flush();
|
ob_end_flush();
|
||||||
if ($base->getConnectionStatus()) {
|
if ($base->getConnectionStatus()) {
|
||||||
die("Cannot connect to database");
|
die("Cannot connect to database");
|
||||||
|
|||||||
@@ -38,12 +38,6 @@ if (!isset($ZIP_STREAM)) {
|
|||||||
if (!isset($ENCODING) || !$ENCODING) {
|
if (!isset($ENCODING) || !$ENCODING) {
|
||||||
$ENCODING = DEFAULT_ENCODING;
|
$ENCODING = DEFAULT_ENCODING;
|
||||||
}
|
}
|
||||||
// set the default lang, if not given
|
|
||||||
if (session_id() && isset($_SESSION['DEFAULT_LANG']) && $_SESSION['DEFAULT_LANG']) {
|
|
||||||
$LANG = $_SESSION['DEFAULT_LANG'];
|
|
||||||
} else {
|
|
||||||
$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
|
// end the stop of the output flow, but only if we didn't request a csv file download
|
||||||
if (isset($_POST['action']) && $_POST['action'] != 'download_csv' && !$AJAX_PAGE) {
|
if (isset($_POST['action']) && $_POST['action'] != 'download_csv' && !$AJAX_PAGE) {
|
||||||
header("Content-type: text/html; charset=".$ENCODING);
|
header("Content-type: text/html; charset=".$ENCODING);
|
||||||
@@ -55,15 +49,15 @@ if ($AJAX_PAGE && !$ZIP_STREAM) {
|
|||||||
|
|
||||||
//------------------------------ class init start
|
//------------------------------ class init start
|
||||||
// login & page access check
|
// login & page access check
|
||||||
$login = new CoreLibs\ACL\Login(DB_CONFIG, $LANG);
|
$login = new CoreLibs\ACL\Login(DB_CONFIG);
|
||||||
// post login lang check
|
// post login lang check
|
||||||
if (isset($_SESSION['DEFAULT_LANG'])) {
|
if (isset($_SESSION['DEFAULT_LANG'])) {
|
||||||
$LANG = $_SESSION['DEFAULT_LANG'];
|
$LANG = $_SESSION['DEFAULT_LANG'];
|
||||||
}
|
}
|
||||||
// create smarty object
|
// create smarty object
|
||||||
$smarty = new CoreLibs\Template\SmartyExtend($LANG);
|
$smarty = new CoreLibs\Template\SmartyExtend();
|
||||||
// create new DB class
|
// create new DB class
|
||||||
$cms = new CoreLibs\Admin\Backend(DB_CONFIG, $LANG);
|
$cms = new CoreLibs\Admin\Backend(DB_CONFIG);
|
||||||
// the menu show flag (what menu to show)
|
// the menu show flag (what menu to show)
|
||||||
$cms->menu_show_flag = 'main';
|
$cms->menu_show_flag = 'main';
|
||||||
// db nfo
|
// db nfo
|
||||||
|
|||||||
@@ -36,23 +36,19 @@ if (!DEBUG) {
|
|||||||
$ECHO_ALL = 0;
|
$ECHO_ALL = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set default lang if not set otherwise
|
|
||||||
if (!isset($lang)) {
|
|
||||||
$lang = DEFAULT_LANG;
|
|
||||||
}
|
|
||||||
// should be utf8
|
// should be utf8
|
||||||
header("Content-type: text/html; charset=".DEFAULT_ENCODING);
|
header("Content-type: text/html; charset=".DEFAULT_ENCODING);
|
||||||
ob_end_flush();
|
ob_end_flush();
|
||||||
$login = new CoreLibs\ACL\Login(DB_CONFIG, $lang);
|
$login = new CoreLibs\ACL\Login(DB_CONFIG);
|
||||||
|
|
||||||
// create form class
|
// create form class
|
||||||
$form = new CoreLibs\Output\Form\Generate(DB_CONFIG, $lang);
|
$form = new CoreLibs\Output\Form\Generate(DB_CONFIG);
|
||||||
if ($form->mobile_phone) {
|
if ($form->mobile_phone) {
|
||||||
echo "I am sorry, but this page cannot be viewed by a mobile phone";
|
echo "I am sorry, but this page cannot be viewed by a mobile phone";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
// smarty template engine (extended Translation version)
|
// smarty template engine (extended Translation version)
|
||||||
$smarty = new CoreLibs\Template\SmartyExtend($lang);
|
$smarty = new CoreLibs\Template\SmartyExtend();
|
||||||
|
|
||||||
// $form->debug('POST', $form->printAr($_POST));
|
// $form->debug('POST', $form->printAr($_POST));
|
||||||
|
|
||||||
@@ -453,7 +449,7 @@ if (is_dir(BASE.TEMPLATES_C)) {
|
|||||||
if (is_dir(BASE.CACHE)) {
|
if (is_dir(BASE.CACHE)) {
|
||||||
$smarty->setCacheDir(BASE.CACHE);
|
$smarty->setCacheDir(BASE.CACHE);
|
||||||
}
|
}
|
||||||
$smarty->display($EDIT_TEMPLATE, 'editAdmin_'.$lang, 'editAdmin_'.$lang);
|
$smarty->display($EDIT_TEMPLATE, 'editAdmin_'.$smarty->lang, 'editAdmin_'.$smarty->lang);
|
||||||
|
|
||||||
// debug output
|
// debug output
|
||||||
echo $login->printErrorMsg();
|
echo $login->printErrorMsg();
|
||||||
|
|||||||
@@ -115,10 +115,9 @@ class Login extends \CoreLibs\DB\IO
|
|||||||
/**
|
/**
|
||||||
* constructor, does ALL, opens db, works through connection checks, closes itself
|
* constructor, does ALL, opens db, works through connection checks, closes itself
|
||||||
* @param array $db_config db config array
|
* @param array $db_config db config array
|
||||||
* @param string $lang language string (default en_utf8)
|
|
||||||
* @param int $set_control_flag class variable check flags
|
* @param int $set_control_flag class variable check flags
|
||||||
*/
|
*/
|
||||||
public function __construct(array $db_config, string $lang = 'en_utf8', int $set_control_flag = 0)
|
public function __construct(array $db_config, int $set_control_flag = 0)
|
||||||
{
|
{
|
||||||
// log login data for this class only
|
// log login data for this class only
|
||||||
$this->log_per_class = 1;
|
$this->log_per_class = 1;
|
||||||
@@ -151,7 +150,13 @@ class Login extends \CoreLibs\DB\IO
|
|||||||
// set global is ajax page for if we show the data directly, or need to pass it back
|
// set global is ajax page for if we show the data directly, or need to pass it back
|
||||||
// to the continue AJAX class for output back to the user
|
// to the continue AJAX class for output back to the user
|
||||||
$this->login_is_ajax_page = isset($GLOBALS['AJAX_PAGE']) && $GLOBALS['AJAX_PAGE'] ? true : false;
|
$this->login_is_ajax_page = isset($GLOBALS['AJAX_PAGE']) && $GLOBALS['AJAX_PAGE'] ? true : false;
|
||||||
|
// set the default lang
|
||||||
|
$lang = 'en_utf8';
|
||||||
|
if (session_id() && isset($_SESSION['DEFAULT_LANG']) && $_SESSION['DEFAULT_LANG']) {
|
||||||
|
$lang = $_SESSION['DEFAULT_LANG'];
|
||||||
|
} else {
|
||||||
|
$lang = defined('SITE_LANG') ? SITE_LANG : DEFAULT_LANG;
|
||||||
|
}
|
||||||
$this->l = new \CoreLibs\Language\L10n($lang);
|
$this->l = new \CoreLibs\Language\L10n($lang);
|
||||||
|
|
||||||
// if we have a search path we need to set it, to use the correct DB to login
|
// if we have a search path we need to set it, to use the correct DB to login
|
||||||
|
|||||||
@@ -57,26 +57,25 @@ class Backend extends \CoreLibs\DB\IO
|
|||||||
public $lang;
|
public $lang;
|
||||||
public $lang_short;
|
public $lang_short;
|
||||||
public $encoding;
|
public $encoding;
|
||||||
|
// language
|
||||||
|
public $l;
|
||||||
// smarty publics [end processing in smarty class]
|
// smarty publics [end processing in smarty class]
|
||||||
public $DATA;
|
public $DATA;
|
||||||
public $HEADER;
|
public $HEADER;
|
||||||
public $DEBUG_DATA;
|
public $DEBUG_DATA;
|
||||||
public $CONTENT_DATA;
|
public $CONTENT_DATA;
|
||||||
// language
|
|
||||||
public $l;
|
|
||||||
|
|
||||||
// CONSTRUCTOR / DECONSTRUCTOR |====================================>
|
// CONSTRUCTOR / DECONSTRUCTOR |====================================>
|
||||||
/**
|
/**
|
||||||
* main class constructor
|
* main class constructor
|
||||||
* @param array $db_config db config array
|
* @param array $db_config db config array
|
||||||
* @param string $lang language string
|
|
||||||
* @param int|integer $set_control_flag class variable check flag
|
* @param int|integer $set_control_flag class variable check flag
|
||||||
*/
|
*/
|
||||||
public function __construct(array $db_config, string $lang, int $set_control_flag = 0)
|
public function __construct(array $db_config, int $set_control_flag = 0)
|
||||||
{
|
{
|
||||||
$this->setLangEncoding();
|
$this->setLangEncoding();
|
||||||
// get the language sub class & init it
|
// get the language sub class & init it
|
||||||
$this->l = new \CoreLibs\Language\L10n($lang);
|
$this->l = new \CoreLibs\Language\L10n($this->lang);
|
||||||
|
|
||||||
// init the database class
|
// init the database class
|
||||||
parent::__construct($db_config, $set_control_flag);
|
parent::__construct($db_config, $set_control_flag);
|
||||||
@@ -104,9 +103,6 @@ class Backend extends \CoreLibs\DB\IO
|
|||||||
|
|
||||||
// INTERNAL METHODS |===============================================>
|
// INTERNAL METHODS |===============================================>
|
||||||
|
|
||||||
|
|
||||||
// PUBLIC METHODS |=================================================>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set the language encoding and language settings
|
* set the language encoding and language settings
|
||||||
* the default charset from _SESSION login or from
|
* the default charset from _SESSION login or from
|
||||||
@@ -116,7 +112,7 @@ class Backend extends \CoreLibs\DB\IO
|
|||||||
* creates short lang (only first two chars) from the lang
|
* creates short lang (only first two chars) from the lang
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setLangEncoding(): void
|
private function setLangEncoding(): void
|
||||||
{
|
{
|
||||||
// just emergency fallback for language
|
// just emergency fallback for language
|
||||||
// set encoding
|
// set encoding
|
||||||
@@ -125,10 +121,14 @@ class Backend extends \CoreLibs\DB\IO
|
|||||||
} else {
|
} else {
|
||||||
$this->encoding = DEFAULT_ENCODING;
|
$this->encoding = DEFAULT_ENCODING;
|
||||||
}
|
}
|
||||||
// just emergency fallback for language
|
// gobal override
|
||||||
if (isset($_SESSION['DEFAULT_LANG'])) {
|
if (isset($GLOBALS['OVERRIDE_LANG'])) {
|
||||||
|
$this->lang = $GLOBALS['OVERRIDE_LANG'];
|
||||||
|
} elseif (isset($_SESSION['DEFAULT_LANG'])) {
|
||||||
|
// session (login)
|
||||||
$this->lang = $_SESSION['DEFAULT_LANG'];
|
$this->lang = $_SESSION['DEFAULT_LANG'];
|
||||||
} else {
|
} else {
|
||||||
|
// mostly default SITE LANG or DEFAULT LANG
|
||||||
$this->lang = defined('SITE_LANG') ? SITE_LANG : DEFAULT_LANG;
|
$this->lang = defined('SITE_LANG') ? SITE_LANG : DEFAULT_LANG;
|
||||||
}
|
}
|
||||||
// create the char lang encoding
|
// create the char lang encoding
|
||||||
@@ -137,6 +137,8 @@ class Backend extends \CoreLibs\DB\IO
|
|||||||
$this->lang_dir = BASE.INCLUDES.LANG.CONTENT_PATH;
|
$this->lang_dir = BASE.INCLUDES.LANG.CONTENT_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PUBLIC METHODS |=================================================>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set internal ACL from login ACL
|
* set internal ACL from login ACL
|
||||||
* @param array $acl login acl array
|
* @param array $acl login acl array
|
||||||
|
|||||||
@@ -242,6 +242,11 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
|||||||
public $security_level;
|
public $security_level;
|
||||||
// layout publics
|
// layout publics
|
||||||
public $table_width;
|
public $table_width;
|
||||||
|
// internal lang & encoding vars
|
||||||
|
public $lang_dir = '';
|
||||||
|
public $lang;
|
||||||
|
public $lang_short;
|
||||||
|
public $encoding;
|
||||||
// language
|
// language
|
||||||
public $l;
|
public $l;
|
||||||
|
|
||||||
@@ -251,15 +256,15 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
|||||||
/**
|
/**
|
||||||
* construct form generator
|
* construct form generator
|
||||||
* @param array $db_config db config array
|
* @param array $db_config db config array
|
||||||
* @param string $lang interface language
|
|
||||||
* @param int|integer $table_width table/div width (default 750)
|
* @param int|integer $table_width table/div width (default 750)
|
||||||
* @param int|integer $set_control_flag basic class set/get variable error flags
|
* @param int|integer $set_control_flag basic class set/get variable error flags
|
||||||
*/
|
*/
|
||||||
public function __construct(array $db_config, string $lang, int $table_width = 750, int $set_control_flag = 0)
|
public function __construct(array $db_config, int $table_width = 750, int $set_control_flag = 0)
|
||||||
{
|
{
|
||||||
$this->my_page_name = $this->getPageName(1);
|
$this->my_page_name = $this->getPageName(1);
|
||||||
|
$this->setLangEncoding();
|
||||||
// init the language class
|
// init the language class
|
||||||
$this->l = new \CoreLibs\Language\L10n($lang);
|
$this->l = new \CoreLibs\Language\L10n($this->lang);
|
||||||
// load config array
|
// load config array
|
||||||
// get table array definitions for current page name
|
// get table array definitions for current page name
|
||||||
// WARNING: auto spl load does not work with this as it is an array and not a function/object
|
// WARNING: auto spl load does not work with this as it is an array and not a function/object
|
||||||
@@ -348,6 +353,45 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
|||||||
parent::__destruct();
|
parent::__destruct();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// INTERNAL METHODS |===============================================>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ORIGINAL in \CoreLibs\Admin\Backend
|
||||||
|
* set the language encoding and language settings
|
||||||
|
* the default charset from _SESSION login or from
|
||||||
|
* config DEFAULT ENCODING
|
||||||
|
* the lang full name for mo loading from _SESSION login
|
||||||
|
* or SITE LANG or DEFAULT LANG from config
|
||||||
|
* creates short lang (only first two chars) from the lang
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private function setLangEncoding(): void
|
||||||
|
{
|
||||||
|
// just emergency fallback for language
|
||||||
|
// set encoding
|
||||||
|
if (isset($_SESSION['DEFAULT_CHARSET'])) {
|
||||||
|
$this->encoding = $_SESSION['DEFAULT_CHARSET'];
|
||||||
|
} else {
|
||||||
|
$this->encoding = DEFAULT_ENCODING;
|
||||||
|
}
|
||||||
|
// gobal override
|
||||||
|
if (isset($GLOBALS['OVERRIDE_LANG'])) {
|
||||||
|
$this->lang = $GLOBALS['OVERRIDE_LANG'];
|
||||||
|
} elseif (isset($_SESSION['DEFAULT_LANG'])) {
|
||||||
|
// session (login)
|
||||||
|
$this->lang = $_SESSION['DEFAULT_LANG'];
|
||||||
|
} else {
|
||||||
|
// mostly default SITE LANG or DEFAULT LANG
|
||||||
|
$this->lang = defined('SITE_LANG') ? SITE_LANG : DEFAULT_LANG;
|
||||||
|
}
|
||||||
|
// create the char lang encoding
|
||||||
|
$this->lang_short = substr($this->lang, 0, 2);
|
||||||
|
// set the language folder
|
||||||
|
$this->lang_dir = BASE.INCLUDES.LANG.CONTENT_PATH;
|
||||||
|
}
|
||||||
|
|
||||||
|
// PUBLIC METHODS |=================================================>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* dumps all values into output (for error msg)
|
* dumps all values into output (for error msg)
|
||||||
* @return string full table array data output as string html formatted
|
* @return string full table array data output as string html formatted
|
||||||
|
|||||||
@@ -89,10 +89,9 @@ class SmartyExtend extends SmartyBC
|
|||||||
/**
|
/**
|
||||||
* constructor class, just sets the language stuff
|
* constructor class, just sets the language stuff
|
||||||
* calls L10 for pass on internaly in smarty
|
* calls L10 for pass on internaly in smarty
|
||||||
* also registers the getvar caller pliugin
|
* also registers the getvar caller plugin
|
||||||
* @param string $lang language string to set
|
|
||||||
*/
|
*/
|
||||||
public function __construct(string $lang)
|
public function __construct()
|
||||||
{
|
{
|
||||||
// call basic smarty
|
// call basic smarty
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
@@ -121,7 +120,7 @@ class SmartyExtend extends SmartyBC
|
|||||||
* creates short lang (only first two chars) from the lang
|
* creates short lang (only first two chars) from the lang
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setLangEncoding(): void
|
private function setLangEncoding(): void
|
||||||
{
|
{
|
||||||
// just emergency fallback for language
|
// just emergency fallback for language
|
||||||
// set encoding
|
// set encoding
|
||||||
@@ -130,10 +129,14 @@ class SmartyExtend extends SmartyBC
|
|||||||
} else {
|
} else {
|
||||||
$this->encoding = DEFAULT_ENCODING;
|
$this->encoding = DEFAULT_ENCODING;
|
||||||
}
|
}
|
||||||
// just emergency fallback for language
|
// gobal override
|
||||||
if (isset($_SESSION['DEFAULT_LANG'])) {
|
if (isset($GLOBALS['OVERRIDE_LANG'])) {
|
||||||
|
$this->lang = $GLOBALS['OVERRIDE_LANG'];
|
||||||
|
} elseif (isset($_SESSION['DEFAULT_LANG'])) {
|
||||||
|
// session (login)
|
||||||
$this->lang = $_SESSION['DEFAULT_LANG'];
|
$this->lang = $_SESSION['DEFAULT_LANG'];
|
||||||
} else {
|
} else {
|
||||||
|
// mostly default SITE LANG or DEFAULT LANG
|
||||||
$this->lang = defined('SITE_LANG') ? SITE_LANG : DEFAULT_LANG;
|
$this->lang = defined('SITE_LANG') ? SITE_LANG : DEFAULT_LANG;
|
||||||
}
|
}
|
||||||
// create the char lang encoding
|
// create the char lang encoding
|
||||||
@@ -405,7 +408,7 @@ class SmartyExtend extends SmartyBC
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* render smarty data (can be called sepparate)
|
* render smarty data (can be called sepparate)
|
||||||
* @return [type] [description]
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function renderSmarty(): void
|
public function renderSmarty(): void
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user