diff --git a/.phan/config.php b/.phan/config.php index 117307ae..352110d7 100644 --- a/.phan/config.php +++ b/.phan/config.php @@ -95,6 +95,7 @@ return [ 'www/media', ], 'exclude_file_list' => [ + // ignore all symlink files to edit 'www/admin/edit_access.php', 'www/admin/edit_groups.php', 'www/admin/edit_languages.php', diff --git a/4dev/lang/admin/messages_en_utf8.po b/4dev/lang/admin/messages_en_utf8.po index fbfe06ce..fa3b2d7b 100644 --- a/4dev/lang/admin/messages_en_utf8.po +++ b/4dev/lang/admin/messages_en_utf8.po @@ -1,11 +1,11 @@ -#******************************************************************** +# ******************************************************************** # AUTHOR: Clemens Schwaighofer # CREATED: 2005/08/09 # SHORT DESCRIPTION: # Backned English Messages file for gettext # to craete: msgfmt -o ja.mo messages_en.po # HISTORY: -#********************************************************************/ +# ********************************************************************/ msgid "" msgstr "" @@ -24,3 +24,6 @@ msgstr "Year" msgid "Month" msgstr "Month" + +msgid "INPUT TEST" +msgstr "OUTPUT TEST EN" diff --git a/4dev/lang/admin/messages_ja_utf8.po b/4dev/lang/admin/messages_ja_utf8.po index 6d0ae776..1cf27e48 100644 --- a/4dev/lang/admin/messages_ja_utf8.po +++ b/4dev/lang/admin/messages_ja_utf8.po @@ -1,11 +1,11 @@ -#******************************************************************** +# ******************************************************************** # AUTHOR: Clemens Schwaighofer # CREATED: 2018/03/28 # SHORT DESCRIPTION: # Backend Japanese Messages file for gettext # to craete: msgfmt -o ja.mo messages_ja.po # HISTORY: -#********************************************************************/ +# ********************************************************************/ msgid "" msgstr "" @@ -61,3 +61,6 @@ msgstr "土" msgid "Sun" msgstr "日" + +msgid "INPUT TEST" +msgstr "OUTPUT TEST JA" diff --git a/www/admin/l10n_test.php b/www/admin/l10n_test.php index 8ad1a7cf..014d66b7 100755 --- a/www/admin/l10n_test.php +++ b/www/admin/l10n_test.php @@ -5,13 +5,25 @@ // namespace test ob_start(); +// init language $lang = 'en_utf8'; - // admin class tests require 'config.php'; $l = new CoreLibs\Language\L10n($lang); - -echo "OK
"; - ob_end_flush(); + +$string = 'INPUT TEST'; + +echo "LANGUAGE SET: ".$l->__getLang()."
"; +echo "LANGUAGE FILE: ".$l->__getMoFile()."
"; +echo "INPUT TEST: ".$string." => ".$l->__($string)."
"; + +// switch to other language +$lang = 'ja_utf8'; +$l->l10nReloadMOfile($lang); + +echo "LANGUAGE SET: ".$l->__getLang()."
"; +echo "LANGUAGE FILE: ".$l->__getMoFile()."
"; +echo "INPUT TEST: ".$string." => ".$l->__($string)."
"; + // __END__ diff --git a/www/admin/namespace_test.php b/www/admin/namespace_test.php index 009ac21d..e8248c92 100755 --- a/www/admin/namespace_test.php +++ b/www/admin/namespace_test.php @@ -17,6 +17,9 @@ echo "DIR: ".DIR."
ROOT: ".ROOT."
BASE: ".BASE."
"; $lang = 'ja_utf8'; $base = new CoreLibs\Admin\Backend(DB_CONFIG, $lang); ob_end_flush(); +if ($base->getConnectionStatus()) { + die("Cannot connect to database"); +} print "Start time: ".$base->runningTime()."
"; print "ByteStringFormat: ".$base->ByteStringFormat(1234567.12)."
"; diff --git a/www/configs/config.host.php b/www/configs/config.host.php index 5347620f..1c5eadff 100755 --- a/www/configs/config.host.php +++ b/www/configs/config.host.php @@ -27,6 +27,8 @@ $SITE_CONFIG = array ( 'debug_flag' => true, // site language 'site_lang' => 'en_utf8', + // enable/disable login override + 'login_enabled' => true ) ); diff --git a/www/configs/config.master.php b/www/configs/config.master.php index 913bc3d6..a431185e 100644 --- a/www/configs/config.master.php +++ b/www/configs/config.master.php @@ -145,7 +145,7 @@ DEFINE('DEFAULT_ENCODING', 'UTF-8'); // below two can be defined here, but they should be // defined in either the header file or the file itself /************* LOGGING *******************/ -// DEFINE('LOG_FILE_ID', ''); +DEFINE('LOG_FILE_ID', ''); /************* CLASS ERRORS *******************/ // 0 = default all OFF @@ -220,7 +220,7 @@ if ((array_key_exists('HTTPS', $_SERVER) && !empty($_SERVER['HTTPS']) && $_SERVE } // define the db config set name, the db config and the db schema DEFINE('DB_CONFIG_NAME', $SITE_CONFIG[$HOST_NAME]['db_host']); -DEFINE('DB_CONFIG', $DB_CONFIG[DB_CONFIG_NAME]); +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']); // override for login and global schemas @@ -230,6 +230,7 @@ DEFINE('DB_CONFIG', $DB_CONFIG[DB_CONFIG_NAME]); 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']); diff --git a/www/configs/config.path.php b/www/configs/config.path.php index 6bd569f9..c77a158e 100755 --- a/www/configs/config.path.php +++ b/www/configs/config.path.php @@ -10,8 +10,12 @@ // File and Folder paths // ID is TARGET (first array element) -// $PATHS['test']['csv_path'] = ''; -// $PATHS['test']['perl_bin'] = ''; -// $PATHS['test']['redirect_url'] = ''; +/*$PATHS = array ( + 'test' => array ( + 'csv_path' => '', + 'perl_bin' => '', + 'other_url' => '', + ) +)*/ // __END__ diff --git a/www/includes/lang/admin/en_utf8.mo b/www/includes/lang/admin/en_utf8.mo index 90d607fd..ce0b0578 100644 Binary files a/www/includes/lang/admin/en_utf8.mo and b/www/includes/lang/admin/en_utf8.mo differ diff --git a/www/includes/lang/admin/ja_utf8.mo b/www/includes/lang/admin/ja_utf8.mo index 7be9274b..67fd6ed9 100644 Binary files a/www/includes/lang/admin/ja_utf8.mo and b/www/includes/lang/admin/ja_utf8.mo differ diff --git a/www/lib/CoreLibs/ACL/Login.php b/www/lib/CoreLibs/ACL/Login.php index ba747966..255de0a0 100644 --- a/www/lib/CoreLibs/ACL/Login.php +++ b/www/lib/CoreLibs/ACL/Login.php @@ -122,7 +122,7 @@ class Login extends \CoreLibs\DB\IO // create db connection and init base class parent::__construct($db_config, $set_control_flag); - if ($this->db_init_error === false) { + if ($this->db_init_error === true) { echo 'Could not connect to DB
'; // if I can't connect to the DB to auth exit hard. No access allowed exit; diff --git a/www/lib/CoreLibs/DB/IO.php b/www/lib/CoreLibs/DB/IO.php index dda77af1..01e58a2c 100644 --- a/www/lib/CoreLibs/DB/IO.php +++ b/www/lib/CoreLibs/DB/IO.php @@ -376,18 +376,15 @@ class IO extends \CoreLibs\Basic // abort error $this->error_id = 10; $this->__dbError(); - $this->db_init_error = false; + $this->db_init_error = true; } // connect to DB if (!$this->__connectToDB()) { $this->error_id = 16; $this->__dbError(); - $this->db_init_error = false; + $this->db_init_error = true; } - - // so we can check that we have a successful DB connection created - $this->db_init_error = true; } /** @@ -897,6 +894,17 @@ class IO extends \CoreLibs\Basic } } + /** + * returns the db init error + * if failed to connect it is set to true + * else false + * @return bool connection failure status + */ + public function getConnectionStatus(): bool + { + return $this->db_init_error; + } + /** * sets new db schema * @param string $db_schema schema name, if not given tries internal default db schema diff --git a/www/lib/CoreLibs/Language/Core/GetTextReader.php b/www/lib/CoreLibs/Language/Core/GetTextReader.php index 776c7309..cdf84ed5 100755 --- a/www/lib/CoreLibs/Language/Core/GetTextReader.php +++ b/www/lib/CoreLibs/Language/Core/GetTextReader.php @@ -106,7 +106,7 @@ class GetTextReader public function __construct($Reader, $enable_cache = true) { // If there isn't a StreamReader, turn on short circuit mode. - if (!$Reader || isset($Reader->error)) { + if (!$Reader || $Reader->error) { $this->short_circuit = true; return; }