openrat-cms

OpenRat Content Management System
git clone http://git.code.weiherhei.de/openrat-cms.git
Log | Files | Refs | README

commit 2fb7fd1d451312814c005cc6435a303d5e88b734
parent 7f52f1959dd1abc648978fbb116dcddc4f6abef7
Author: Jan Dankert <develop@jandankert.de>
Date:   Sun,  1 Nov 2020 00:36:50 +0100

Refactoring: Only using the configuration object.

Diffstat:
Mmodules/cms/Dispatcher.class.php | 46+++++++++++++++++++++++-----------------------
Mmodules/cms/action/ElementAction.class.php | 14+++++---------
Mmodules/cms/action/FileAction.class.php | 8++++----
Mmodules/cms/action/FolderAction.class.php | 22++++++++++++----------
Mmodules/cms/action/GroupAction.class.php | 5+----
Mmodules/cms/action/LanguageAction.class.php | 5+++--
Mmodules/cms/action/LanguagelistAction.class.php | 21+++++++++++----------
Mmodules/cms/action/LoginAction.class.php | 54+++++++++++++++++++++++++++++-------------------------
Mmodules/cms/action/PageAction.class.php | 6++++--
Mmodules/cms/action/ProfileAction.class.php | 40+++++++++++++++++++++++-----------------
Mmodules/cms/action/StartAction.class.php | 35++++++++++++++++++-----------------
Mmodules/cms/action/UserAction.class.php | 38+++++++++++++++++---------------------
Mmodules/cms/auth/InternalAuth.class.php | 2+-
Mmodules/cms/auth/RememberAuth.class.php | 2+-
Mmodules/cms/auth/SSLAuth.class.php | 14+++++++++-----
Mmodules/cms/base/Configuration.class.php | 61++++++++++++++++++++++++-------------------------------------
Mmodules/cms/base/DefaultConfig.class.php | 2+-
Mmodules/cms/base/Language.class.php | 10+++++++---
Mmodules/cms/base/Startup.class.php | 2+-
Mmodules/cms/generator/PageGenerator.class.php | 16+++++++++-------
Mmodules/cms/generator/link/PublicLink.class.php | 15+++++++++------
Mmodules/cms/generator/target/Ftp.class.php | 3++-
Mmodules/cms/generator/target/Local.class.php | 11++++++-----
Mmodules/cms/model/BaseObject.class.php | 9+++++----
Mmodules/cms/model/Folder.class.php | 7++++---
Mmodules/cms/model/Language.class.php | 5+++--
Mmodules/cms/model/Value.class.php | 27+++++++++++++--------------
Mmodules/cms/ui/action/IndexAction.class.php | 100++++++++++++++++++++++++++++++++++++++++----------------------------------------
Mmodules/cms/ui/action/TitleAction.class.php | 5+++--
Mmodules/cms/ui/themes/default/html/views/element/advanced.php | 2+-
Mmodules/cms/ui/themes/default/html/views/file/pub.php | 2+-
Mmodules/cms/ui/themes/default/html/views/folder/pub.php | 2+-
Mmodules/cms/ui/themes/default/html/views/grouplist/show.php | 2+-
Mmodules/cms/ui/themes/default/html/views/image/pub.php | 2+-
Mmodules/cms/ui/themes/default/html/views/image/uncompress.php | 2+-
Mmodules/cms/ui/themes/default/html/views/login/login.php | 22+++++++++++-----------
Mmodules/cms/ui/themes/default/html/views/login/password.php | 2+-
Mmodules/cms/ui/themes/default/html/views/login/register.php | 2+-
Mmodules/cms/ui/themes/default/html/views/modellist/show.php | 2+-
Mmodules/cms/ui/themes/default/html/views/page/pub.php | 2+-
Mmodules/cms/ui/themes/default/html/views/pageelement/pub.php | 2+-
Mmodules/cms/ui/themes/default/html/views/pageelement/value.php | 32++++++++++++++++----------------
Mmodules/cms/ui/themes/default/html/views/profile/pw.php | 4++--
Mmodules/cms/ui/themes/default/html/views/project/prop.php | 2+-
Mmodules/cms/ui/themes/default/html/views/projectlist/edit.php | 4++--
Mmodules/cms/ui/themes/default/html/views/search/edit.php | 10+++++-----
Mmodules/cms/ui/themes/default/html/views/template/pub.php | 2+-
Mmodules/cms/ui/themes/default/html/views/templatelist/show.php | 2+-
Mmodules/cms/ui/themes/default/html/views/text/pub.php | 2+-
Mmodules/cms/ui/themes/default/html/views/text/uncompress.php | 2+-
Mmodules/cms/ui/themes/default/html/views/title/show.php | 12++++++------
Mmodules/cms/ui/themes/default/html/views/user/info.php | 2+-
Mmodules/cms/ui/themes/default/html/views/user/prop.php | 2+-
Mmodules/cms/ui/themes/default/html/views/user/pw.php | 2+-
Mmodules/configuration/Config.class.php | 18++++++++++++++++++
Mmodules/language/LanguageCompiler.class.php | 36++++++++++++++++++++++++------------
Mmodules/language/Language_CN.class.php | 1+
Mmodules/language/Language_DE.class.php | 1+
Mmodules/language/Language_EN.class.php | 1+
Mmodules/language/Language_ES.class.php | 1+
Mmodules/language/Language_FR.class.php | 1+
Mmodules/language/Language_IT.class.php | 1+
Mmodules/language/Language_RU.class.php | 1+
Mmodules/language/Messages.class.php | 2++
Mmodules/language/language.yml | 8++++++++
Mmodules/template_engine/Output.class.php | 14+++++++++++---
Mmodules/template_engine/components/html/component_user/component-user.php | 2+-
Mmodules/template_engine/element/PHPBlockElement.class.php | 2+-
Mmodules/template_engine/element/Value.class.php | 2+-
Mmodules/util/cache/FileCache.class.php | 2+-
70 files changed, 433 insertions(+), 367 deletions(-)

diff --git a/modules/cms/Dispatcher.class.php b/modules/cms/Dispatcher.class.php @@ -13,9 +13,11 @@ use cms\base\DB; use cms\base\DefaultConfig; use cms\base\Startup; use cms\base\Version; +use configuration\Config; use configuration\ConfigurationLoader; use database\Database; use cms\update\Update; +use language\Language; use language\Messages; use modules\cms\base\HttpRequest; use util\exception\ValidationException; @@ -56,9 +58,6 @@ class Dispatcher $this->checkConfiguration(); - // Vorhandene Konfiguration aus der Sitzung lesen. - $conf = Configuration::rawConfig(); - define('PRODUCTION', Configuration::Conf()->is('production',true)); define('DEVELOPMENT', !PRODUCTION); @@ -82,11 +81,13 @@ class Dispatcher //if ( DEVELOPMENT ) // Logger::debug( "Effective configuration:\n".YAML::YAMLDump($conf) ); - if (!empty($conf['security']['umask'])) - umask(octdec($conf['security']['umask'])); + $umask = Configuration::subset('security')->get('umask',''); + if ( $umask ) + umask(octdec($umask)); - if (!empty($conf['interface']['timeout'])) - set_time_limit(intval($conf['interface']['timeout'])); + $timeout = Configuration::subset('interface')->get('timeout',0); + if ( $timeout ) + set_time_limit($timeout); $this->checkPostToken(); @@ -230,7 +231,7 @@ class Dispatcher // dann die Konfiguration neu einlesen. $configLoader = new ConfigurationLoader(__DIR__ . '/../../config/config.yml'); - if (!is_array($conf) || $conf['config']['auto_reload'] && $configLoader->lastModificationTime() > $conf['config']['last_modification_time']) { + if (!is_array($conf) || @$conf['config']['auto_reload'] && $configLoader->lastModificationTime() > @$conf['config']['last_modification_time']) { // Da die Konfiguration neu eingelesen wird, sollten wir auch die Sitzung komplett leeren. if (is_array($conf) && $conf['config']['session_destroy_on_config_reload']) @@ -243,28 +244,27 @@ class Dispatcher $conf = array_replace_recursive($conf, $customConfig); // Sprache lesen + $languages = []; + if (isset($_COOKIE['or_language'])) + $languages[] = $_COOKIE['or_language']; - if ($conf['i18n']['use_http']) - // Die vom Browser angeforderten Sprachen ermitteln - $languages = Http::getLanguages(); - else - // Nur Default-Sprache erlauben - $languages = array(); + $i18nConfig = (new Config($conf))->subset('i18n'); - if (isset($_COOKIE['or_language'])) - $languages = array($_COOKIE['or_language']) + $languages; + if ( $i18nConfig->is('use_http',true ) ) + // Die vom Browser angeforderten Sprachen ermitteln + $languages = array_merge( $languages,Http::getLanguages() ); // Default-Sprache hinzufuegen. // Wird dann verwendet, wenn die vom Browser angeforderten Sprachen // nicht vorhanden sind - $languages[] = $conf['i18n']['default']; - $available = explode(',', $conf['i18n']['available']); + $languages[] = $i18nConfig->get('default','en'); + $languages[] = 'en'; // last fallback. foreach ($languages as $l) { - if (!in_array($l, $available)) - continue; // language is not configured as available. + if (!in_array($l, Messages::$AVAILABLE_LANGUAGES)) + continue; // language is not available. - $language = new \language\Language(); + $language = new Language(); $lang = $language->getLanguage( $l ); $conf['language'] = $lang; $conf['language']['language_code'] = $l; @@ -389,7 +389,7 @@ class Dispatcher } - $dbConfig = Configuration::config()->subset('database'); + $dbConfig = Configuration::subset('database'); if ( ! $dbConfig->has( $dbid ) ) throw new \LogicException( 'unknown DB-Id: '.$dbid ); @@ -529,7 +529,7 @@ class Dispatcher if ( ! $this->request->isAction ) return; - $auditConfig = Configuration::config()->subset('audit-log'); + $auditConfig = Configuration::subset('audit-log'); if ( $auditConfig->is('enabled',false)) { diff --git a/modules/cms/action/ElementAction.class.php b/modules/cms/action/ElementAction.class.php @@ -3,6 +3,7 @@ namespace cms\action; +use cms\base\Configuration; use cms\model\Element; use cms\model\Project; use cms\model\Template; @@ -93,16 +94,14 @@ class ElementAction extends BaseAction */ public function advancedPost() { - $conf = \cms\base\Configuration::rawConfig(); - $ini_date_format = \cms\base\Configuration::config('date','format'); - + $ini_date_format = Configuration::subset('date')->get('format',[] ); if ( $this->hasRequestVar('format')) $this->element->format = $this->getRequestId('format'); if ( $this->hasRequestVar('dateformat')) - $this->element->dateformat = $ini_date_format[$this->getRequestVar('dateformat')]; + $this->element->dateformat = @$ini_date_format[$this->getRequestVar('dateformat')]; if ( $this->hasRequestVar('default_longtext')) @@ -146,7 +145,6 @@ class ElementAction extends BaseAction public function advancedView() { - $conf = \cms\base\Configuration::rawConfig(); $this->setTemplateVar('type',$this->element->getTypeName() ); // Abhaengig vom aktuellen Element-Typ die Eigenschaften anzeigen @@ -302,9 +300,7 @@ class ElementAction extends BaseAction case 'dateformat': - //$ini_date_format = \cms\base\Configuration::config('date','format'); - //$ini_date_format = \cms\base\Configuration::Conf()->subset('date')->get('format'); - $ini_date_format = \cms\base\Configuration::config()->subset('date')->get('format'); + $ini_date_format = Configuration::subset('date')->get('format',[]); $dateformat = array(); $this->setTemplateVar('dateformat',''); @@ -455,7 +451,7 @@ class ElementAction extends BaseAction break; case Element::ELEMENT_TYPE_CODE: - if ( $conf['security']['disable_dynamic_code'] ) + if ( Configuration::subset('security')->is('disable_dynamic_code',true ) ) $this->addNotice('element', 0, $this->element->name, 'CODE_DISABLED', Action::NOTICE_WARN); $this->setTemplateVar('code',$this->element->code); diff --git a/modules/cms/action/FileAction.class.php b/modules/cms/action/FileAction.class.php @@ -2,6 +2,7 @@ namespace cms\action; +use cms\base\Configuration; use cms\generator\FileContext; use cms\generator\FileGenerator; use cms\generator\Producer; @@ -225,8 +226,9 @@ class FileAction extends ObjectAction // Unterscheidung, ob PHP-Code in der Datei ausgefuehrt werden soll. - $phpActive = ( \cms\base\Configuration::config('publish','enable_php_in_file_content')=='auto' && $this->file->getRealExtension()=='php') || - \cms\base\Configuration::config('publish','enable_php_in_file_content')===true; + $publishConfig = Configuration::subset('publish'); + $phpActive = ( $publishConfig->get('enable_php_in_file_content')=='auto' && $this->file->getRealExtension()=='php') || + $publishConfig->get('enable_php_in_file_content' )===true; if ( $phpActive ) { @@ -264,7 +266,6 @@ class FileAction extends ObjectAction */ function editView() { - $conf = \cms\base\Configuration::rawConfig(); // MIME-Types aus Datei lesen $this->setTemplateVars( $this->file->getProperties() ); } @@ -283,7 +284,6 @@ class FileAction extends ObjectAction */ function valueView() { - $conf = \cms\base\Configuration::rawConfig(); // MIME-Types aus Datei lesen $this->setTemplateVars( $this->file->getProperties() ); $this->setTemplateVar('value',$this->file->loadValue()); diff --git a/modules/cms/action/FolderAction.class.php b/modules/cms/action/FolderAction.class.php @@ -2,6 +2,7 @@ namespace cms\action; +use cms\base\Configuration; use cms\base\Startup; use cms\generator\FileContext; use cms\generator\FileGenerator; @@ -736,28 +737,29 @@ class FolderAction extends ObjectAction */ private function maxFileSize() { - $conf = \cms\base\Configuration::rawConfig(); - // When querying memory size values: // Many ini memory size values, such as upload_max_filesize, // are stored in the php.ini file in shorthand notation. // ini_get() will return the exact string stored in the php.ini file // and NOT its integer equivalent. - $sizes = array(10*1024*1024*1024); // Init with 10GB enough? :) - foreach( array('upload_max_filesize','post_max_size','memory_limit') as $var ) + $_10GB = 10 * 1024 * 1024 * 1024; // 10GB + $sizes = []; + + foreach( ['upload_max_filesize','post_max_size','memory_limit'] as $setting ) { - $v = $this->stringToBytes(ini_get($var)); + $memLimit = $this->stringToBytes(ini_get($setting)); - if ($v > 0 ) - $sizes[] = $v; + if ($memLimit ) + $sizes[] = $memLimit; } - $confMaxSize = intval($conf['content']['file']['max_file_size'])*1024; - if ( $confMaxSize > 0 ) + $confMaxSize = Configuration::subset(['content','file'])->get('max_file_size',$_10GB) * 1024; + + if ( $confMaxSize ) $sizes[] = $confMaxSize; - return min($sizes); + return min($sizes); // Using the minimum of all sizes. } diff --git a/modules/cms/action/GroupAction.class.php b/modules/cms/action/GroupAction.class.php @@ -2,6 +2,7 @@ namespace cms\action; +use cms\base\Configuration; use cms\model\Acl; use cms\model\User; use cms\model\Project; @@ -206,10 +207,6 @@ class GroupAction extends BaseAction $this->setTemplateVar($varName,$hasUser); } $this->setTemplateVar('memberships',$userliste); - - $conf = \cms\base\Configuration::rawConfig(); - if ($conf['security']['authorize']['type']=='ldap') - $this->addNotice('group', 0, $this->group->name, 'GROUPS_MAY_CONFLICT_WITH_LDAP', Action::NOTICE_WARN); } diff --git a/modules/cms/action/LanguageAction.class.php b/modules/cms/action/LanguageAction.class.php @@ -2,6 +2,7 @@ namespace cms\action; +use cms\base\Configuration; use cms\model\Language; use cms\model\Project; use util\Session; @@ -103,9 +104,9 @@ class LanguageAction extends BaseAction } else { - $countryList = \cms\base\Configuration::config()['countries']; + $countries = Configuration::subset('countries'); $iso = $this->getRequestVar('isocode'); - $this->language->name = $countryList[$iso]; + $this->language->name = $countries->get($iso,$iso); $this->language->isoCode = strtolower( $iso ); } diff --git a/modules/cms/action/LanguagelistAction.class.php b/modules/cms/action/LanguagelistAction.class.php @@ -7,6 +7,7 @@ use cms\model\Language; use cms\model\Project; +use language\Messages; use util\Session; use util\Html; @@ -64,8 +65,7 @@ class LanguagelistAction extends BaseAction public function showView() { - $conf = \cms\base\Configuration::rawConfig(); - $countryList = $conf['countries']; + $countryList = Configuration::Conf()->get('countries',[]); $list = array(); @@ -124,22 +124,23 @@ class LanguagelistAction extends BaseAction $this->setTemplateVar('isocodes' ,$countryList ); $this->setTemplateVar('isocode' ,'' ); } - - - function addPost() + + + /** + * Adding a language. + */ + public function addPost() { - $conf = \cms\base\Configuration::rawConfig(); - $countryList = $conf['countries']; + $countryList = Configuration::Conf()->get('countries',[]); - // Hinzufuegen einer Sprache $iso = $this->getRequestVar('isocode'); $language = new Language(); $language->projectid = $this->project->projectid; $language->isoCode = $iso; - $language->name = $countryList[$iso]; + $language->name = @$countryList[$iso]; $language->add(); - $this->addNotice('language', 0, $language->name, 'ADDED', 'ok'); + $this->addNoticeFor($language, Messages::ADDED); } diff --git a/modules/cms/action/LoginAction.class.php b/modules/cms/action/LoginAction.class.php @@ -14,7 +14,9 @@ use cms\model\Group; use configuration\Config; use Exception; use http\Env\Request; +use language\Messages; use openid_connect\OpenIDConnectClient; +use util\exception\SecurityException; use util\FileUtils; use util\Http; use cms\auth\InternalAuth; @@ -77,8 +79,6 @@ class LoginAction extends BaseAction { Logger::debug( "Login user: '$name'.'" ); - $conf = Configuration::rawConfig(); - Session::setUser(null); @@ -106,6 +106,8 @@ class LoginAction extends BaseAction $ok = $user->checkPassword( $pw ); $mustChangePassword = $user->mustChangePassword; + + $passwordConfig = Configuration::subset(['security','password']); if ( $mustChangePassword ) { @@ -116,12 +118,14 @@ class LoginAction extends BaseAction } elseif ( $pw1 != $pw2 ) { - $this->addValidationError('password1','PASSWORDS_DO_NOT_MATCH'); + $this->addValidationError('password1',Messages::PASSWORDS_DO_NOT_MATCH); $this->addValidationError('password2',''); } - elseif ( strlen($pw2) < $conf['security']['password']['min_length'] ) + elseif ( strlen($pw2) < $passwordConfig->get('min_length',10) ) { - $this->addValidationError('password1','PASSWORD_MINLENGTH',array('minlength'=>$conf['security']['password']['min_length'])); + $this->addValidationError('password1',Messages::PASSWORD_MINLENGTH,[ + 'minlength'=>$passwordConfig->get('min_length',10) + ]); $this->addValidationError('password2',''); } else @@ -255,7 +259,7 @@ class LoginAction extends BaseAction $authid = $this->getRequestVar( $sso['auth_param_name']); if ( empty( $authid) ) - throw new \util\exception\SecurityException( 'no authorization data (no auth-id)'); + throw new SecurityException( 'no authorization data (no auth-id)'); if ( $sso['auth_param_serialized'] ) $authid = unserialize( $authid ); @@ -303,19 +307,19 @@ class LoginAction extends BaseAction $html = implode('',$inhalt); if ( !preg_match($sso['expect_regexp'],$html) ) - throw new \util\exception\SecurityException('auth failed'); + throw new SecurityException('auth failed'); $treffer=0; if ( !preg_match($sso['username_regexp'],$html,$treffer) ) - throw new \util\exception\SecurityException('auth failed'); + throw new SecurityException('auth failed'); if ( !isset($treffer[1]) ) - throw new \util\exception\SecurityException('authorization failed'); + throw new SecurityException('authorization failed'); $username = $treffer[1]; $user = User::loadWithName( $username,User::AUTH_TYPE_INTERNAL ); if ( ! $user->isValid( )) - throw new \util\exception\SecurityException('authorization failed: user not found: '.$username); + throw new SecurityException('authorization failed: user not found: '.$username); $user->setCurrent(); @@ -331,7 +335,7 @@ class LoginAction extends BaseAction $username = getenv( $ssl_user_var ); if ( empty($username) ) - throw new \util\exception\SecurityException( 'no username in client certificate ('.$ssl_user_var.') (or there is no client certificate...?)' ); + throw new SecurityException( 'no username in client certificate ('.$ssl_user_var.') (or there is no client certificate...?)' ); $user = User::loadWithName( $username,User::AUTH_TYPE_INTERNAL ); @@ -514,12 +518,10 @@ class LoginAction extends BaseAction */ function loginPost() { - $conf = Configuration::rawConfig(); - Session::setUser(''); // Altes Login entfernen. - if ( $conf['login']['nologin'] ) - throw new \util\exception\SecurityException('login disabled'); + if ( Configuration::subset('login')->is('nologin',false ) ) + throw new SecurityException('login disabled'); $loginName = $this->getRequestVar('login_name' ,RequestParams::FILTER_ALPHANUM); $loginPassword = $this->getRequestVar('login_password',RequestParams::FILTER_ALPHANUM); @@ -537,18 +539,20 @@ class LoginAction extends BaseAction else { $auth = new InternalAuth(); - + + $passwordConfig = Configuration::subset(['security','password']); + if ( $auth->login($loginName, $loginPassword,$token) || $auth->mustChangePassword ) { if ( $newPassword1 != $newPassword2 ) { - $this->addValidationError('password1','PASSWORDS_DO_NOT_MATCH'); + $this->addValidationError('password1',Messages::PASSWORDS_DO_NOT_MATCH); $this->addValidationError('password2',''); return; } - elseif ( strlen($newPassword1) < $conf['security']['password']['min_length'] ) + elseif ( strlen($newPassword1) < $passwordConfig->get('min_length',10) ) { - $this->addValidationError('password1','PASSWORD_MINLENGTH',array('minlength'=>$conf['security']['password']['min_length'])); + $this->addValidationError('password1',Messages::PASSWORD_MINLENGTH,array('minlength'=>$passwordConfig->get('min_length',10))); $this->addValidationError('password2',''); return; } @@ -577,7 +581,7 @@ class LoginAction extends BaseAction $this->setCookie('or_dbid' ,$this->getRequestVar('dbid')); // Authentifizierungs-Module. - $modules = $conf['security']['authenticate']['modules']; + $modules = Configuration::subset(['security','authenticate'])->get('modules',[] ); $loginOk = false; $mustChangePassword = false; @@ -634,7 +638,7 @@ class LoginAction extends BaseAction { // Benutzer wurde zwar authentifiziert, ist aber in der // internen Datenbank nicht vorhanden - if ( $conf['security']['newuser']['autoadd'] ) + if ( Configuration::subset(['security','newuser'])->is('autoadd',true ) ) { // Neue Benutzer in die interne Datenbank uebernehmen. $user = new User(); @@ -703,7 +707,7 @@ class LoginAction extends BaseAction } // Anmeldung erfolgreich. - if ( Configuration::config()->subset('security')->is('renew_session_login',false) ) + if ( Configuration::subset('security')->is('renew_session_login',false) ) $this->recreateSession(); $this->addNotice('user', 0, $user->name, 'LOGIN_OK', Action::NOTICE_OK, array('name' => $user->fullname)); @@ -729,7 +733,7 @@ class LoginAction extends BaseAction if ( is_object($user) ) $this->setTemplateVar('login_username',$user->name); - if ( Configuration::config()->subset('security')->is('renew_session_logout',false) ) + if ( Configuration::subset('security')->is('renew_session_logout',false) ) $this->recreateSession(); if ( @$conf['theme']['compiler']['compile_at_logout'] ) @@ -813,7 +817,7 @@ class LoginAction extends BaseAction $user = Session::getUser(); if ( ! $user->isAdmin ) - throw new \util\exception\SecurityException("Switching the user is only possible for admins."); + throw new SecurityException("Switching the user is only possible for admins."); $this->recreateSession(); @@ -1035,7 +1039,7 @@ class LoginAction extends BaseAction if ( is_object($db) ) $this->setTemplateVar('actdbid',$db->id); else - $this->setTemplateVar('actdbid', Configuration::config('database-default','default-id')); + $this->setTemplateVar('actdbid', Configuration::subset('database-default')->get('default-id','')); } diff --git a/modules/cms/action/PageAction.class.php b/modules/cms/action/PageAction.class.php @@ -2,6 +2,7 @@ namespace cms\action; +use cms\base\Configuration; use cms\generator\PageGenerator; use cms\generator\Producer; use cms\generator\Publisher; @@ -671,8 +672,9 @@ class PageAction extends ObjectAction $templateModel->load(); // Executing PHP in Pages. - if ( ( \cms\base\Configuration::config('publish','enable_php_in_page_content')=='auto' && $templateModel->extension == 'php') || - \cms\base\Configuration::config('publish','enable_php_in_page_content')===true ) + $enablePHP = Configuration::subset('publish')->get('enable_php_in_page_content'); + if ( ( $enablePHP=='auto' && $templateModel->extension == 'php') || + $enablePHP===true ) { ob_start(); require( $generator->getCache()->load()->getFilename() ); diff --git a/modules/cms/action/ProfileAction.class.php b/modules/cms/action/ProfileAction.class.php @@ -20,6 +20,7 @@ namespace cms\action; // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. use cms\base\Configuration; +use cms\base\Startup; use cms\model\BaseObject; use cms\model\User; use language\Language; @@ -88,7 +89,8 @@ class ProfileAction extends BaseAction // Ausgewählte Sprache sofort verwenden. $l = $this->getRequestVar('language'); - $this->setLanguage($l); + if ( $l ) + $this->setLanguage($l); } @@ -198,6 +200,8 @@ class ProfileAction extends BaseAction public function pwPost() { + $pwMinLength = Configuration::subset(['security','password'])->get('min_length',10); + if ( ! $this->user->checkPassword( $this->getRequestVar('act_password') ) ) { $this->addValidationError('act_password'); @@ -210,9 +214,9 @@ class ProfileAction extends BaseAction { $this->addValidationError('password2','PASSWORDS_DO_NOT_MATCH'); } - elseif ( strlen($this->getRequestVar('password1'))<intval(\cms\base\Configuration::config('security','password','min_length')) ) + elseif ( strlen($this->getRequestVar('password1'))<$pwMinLength ) { - $this->addValidationError('password1','PASSWORD_MINLENGTH',array('minlength'=>\cms\base\Configuration::config('security','password','min_length'))); + $this->addValidationError('password1','PASSWORD_MINLENGTH',array('minlength'=> $pwMinLength)); } else { @@ -228,7 +232,7 @@ class ProfileAction extends BaseAction */ function editView() { - $issuer = urlencode(\cms\base\Configuration::config('application','operator')); + $issuer = urlencode(Configuration::subset('application')->get('operator',Startup::TITLE)); $account = $this->user->name.'@'.$_SERVER['SERVER_NAME']; $base32 = new Base2n(5, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567', FALSE, TRUE, TRUE); @@ -241,13 +245,15 @@ class ProfileAction extends BaseAction $this->setTemplateVar('timezone_list',timezone_identifiers_list() ); - $languages = explode(',',\cms\base\Configuration::config('i18n','available')); - foreach($languages as $id=>$name) + $languageList = []; + + foreach( Messages::$AVAILABLE_LANGUAGES as $languageIsoCode) { - unset($languages[$id]); - $languages[$name] = $name; + $language = (new Language)->getLanguage($languageIsoCode); + $label = $language[ Messages::SELF_NAME ]; + $languageList[ $languageIsoCode ] = $label; } - $this->setTemplateVar('language_list',$languages); + $this->setTemplateVar('language_list',$languageList ); $this->setTemplateVars( $this->user->getProperties() + @@ -280,7 +286,7 @@ class ProfileAction extends BaseAction public function setLanguage($l) { $conf = Session::getConfig(); - $language = new \language\Language(); + $language = new Language(); $conf['language'] = $language->getLanguage($l,PRODUCTION); $conf['language']['language_code'] = $l; Session::setConfig($conf); @@ -319,16 +325,16 @@ class ProfileAction extends BaseAction $this->setTemplateVar('style',$currentStyle); - $styleConfig = \cms\base\Configuration::config('style-default'); // default style config - $userStyleConfig = \cms\base\Configuration::config('style', $currentStyle); // user style config + $defaultStyleConfig = Configuration::Conf()->get('style-default',[]); // default style config + $userStyleConfig = Configuration::subset('style')->get($currentStyle,[]); // user style config - if (is_array($userStyleConfig)) - $styleConfig = array_merge($styleConfig, $userStyleConfig ); // Merging user style into default style + if ( $userStyleConfig ) + $defaultStyleConfig = array_merge($defaultStyleConfig, $userStyleConfig ); // Merging user style into default style else ; // Unknown style name, we are ignoring this. // Theme base color for smartphones colorizing their status bar. - $this->setTemplateVar('theme-color', UIUtils::getColorHexCode($styleConfig['title_background_color'])); + $this->setTemplateVar('theme-color', UIUtils::getColorHexCode($defaultStyleConfig['title_background_color'])); } @@ -365,10 +371,10 @@ class ProfileAction extends BaseAction private function getUserStyle( $user ) { // Theme für den angemeldeten Benuter ermitteln - if ( $user && isset(\cms\base\Configuration::config('style')[$user->style])) + if ( $user && Configuration::subset('style')->has($user->style)) $style = $user->style; else - $style = \cms\base\Configuration::config('interface', 'style', 'default'); + $style = Configuration::subset(['interface','style'])->get('default',''); return $style; } diff --git a/modules/cms/action/StartAction.class.php b/modules/cms/action/StartAction.class.php @@ -2,6 +2,7 @@ namespace cms\action; +use cms\base\Configuration; use cms\base\Startup; use cms\model\User; use cms\model\Project; @@ -54,7 +55,7 @@ class StartAction extends BaseAction function setDb( $dbid ) { - $conf = \cms\base\Configuration::rawConfig(); + $conf = Configuration::rawConfig(); if ( !isset($conf['database'][$dbid] )) throw new \LogicException( 'unknown DB-Id: '.$dbid ); @@ -75,7 +76,7 @@ class StartAction extends BaseAction function checkForDb() { - $conf = \cms\base\Configuration::rawConfig(); + $conf = Configuration::rawConfig(); $dbid = $this->getRequestVar('dbid'); if ( $dbid != '' ) @@ -92,7 +93,7 @@ class StartAction extends BaseAction } else { - $conf = \cms\base\Configuration::rawConfig(); + $conf = Configuration::rawConfig(); if ( !isset($conf['database']['default']) ) throw new \LogicException('default-database not set'); @@ -109,7 +110,7 @@ class StartAction extends BaseAction { Logger::debug( "login user $name" ); - $conf = \cms\base\Configuration::rawConfig(); + $conf = Configuration::rawConfig(); global $SESS; unset( $SESS['user'] ); @@ -191,7 +192,7 @@ class StartAction extends BaseAction */ function loginView() { - $conf = \cms\base\Configuration::rawConfig(); + $conf = Configuration::rawConfig(); $sso = $conf['security']['sso']; $ssl = $conf['security']['ssl']; @@ -309,9 +310,9 @@ class StartAction extends BaseAction $openid_provider = array(); foreach( explode(',',$conf['security']['openid']['provider']) as $provider ) - $openid_provider[$provider] = \cms\base\Configuration::config('security','openid','provider.'.$provider.'.name'); + $openid_provider[$provider] = Configuration::config('security','openid','provider.'.$provider.'.name'); $this->setTemplateVar('openid_providers',$openid_provider); - $this->setTemplateVar('openid_user_identity',\cms\base\Configuration::config('security','openid','user_identity')); + $this->setTemplateVar('openid_user_identity', Configuration::config('security','openid','user_identity')); //$this->setTemplateVar('openid_provider','identity'); @@ -438,7 +439,7 @@ class StartAction extends BaseAction */ public function applicationsView() { - $conf = \cms\base\Configuration::rawConfig(); + $conf = Configuration::rawConfig(); // Diese Seite gilt pro Sitzung. $user = Session::getUser(); @@ -488,7 +489,7 @@ class StartAction extends BaseAction */ function openid() { - $conf = \cms\base\Configuration::rawConfig(); + $conf = Configuration::rawConfig(); $openId = Session::get('openid'); if ( !$openId->checkAuthentication() ) @@ -557,7 +558,7 @@ class StartAction extends BaseAction */ function loginPost() { - $conf = \cms\base\Configuration::rawConfig(); + $conf = Configuration::rawConfig(); $this->checkForDb(); Session::setUser(''); @@ -631,7 +632,7 @@ class StartAction extends BaseAction Logger::debug("Login successful for user '$loginName'"); // Anmeldung erfolgreich. - if ( \cms\base\Configuration::config('security','renew_session_login') ) + if ( Configuration::config('security','renew_session_login') ) $this->recreateSession(); $user = Session::getUser(); @@ -647,13 +648,13 @@ class StartAction extends BaseAction */ function logoutPost() { - $conf = \cms\base\Configuration::rawConfig(); + $conf = Configuration::rawConfig(); $user = Session::getUser(); if ( is_object($user) ) $this->setTemplateVar('login_username',$user->name); - if ( \cms\base\Configuration::config('security','renew_session_logout') ) + if ( Configuration::subset('security')->is('renew_session_logout',false) ) $this->recreateSession(); session_unset(); @@ -807,7 +808,7 @@ class StartAction extends BaseAction function showView() { - $conf = \cms\base\Configuration::rawConfig(); + $conf = Configuration::rawConfig(); global $PHP_AUTH_USER; global $PHP_AUTH_PW; @@ -933,7 +934,7 @@ class StartAction extends BaseAction public function registeruserdata() { - $conf = \cms\base\Configuration::rawConfig(); + $conf = Configuration::rawConfig(); Session::set('registerMail',$this->getRequestVar('mail') ); // TODO: Attribut "Password" abfragen @@ -959,7 +960,7 @@ class StartAction extends BaseAction */ public function registercommit() { - $conf = \cms\base\Configuration::rawConfig(); + $conf = Configuration::rawConfig(); $this->checkForDb(); $origRegisterCode = Session::get('registerCode'); @@ -1017,7 +1018,7 @@ class StartAction extends BaseAction */ public function password() { - $conf = \cms\base\Configuration::rawConfig(); + $conf = Configuration::rawConfig(); // TODO: Attribut "Password" abfragen foreach( $conf['database'] as $dbname=>$dbconf ) diff --git a/modules/cms/action/UserAction.class.php b/modules/cms/action/UserAction.class.php @@ -3,6 +3,7 @@ namespace cms\action; use cms\base\Configuration; +use cms\base\Startup; use cms\model\Acl; use cms\model\User; use cms\model\Project; @@ -89,7 +90,7 @@ class UserAction extends BaseAction $this->user->hotp = $this->hasRequestVar('hotp' ); $this->user->totp = $this->hasRequestVar('totp' ); - $conf = \cms\base\Configuration::rawConfig(); + $conf = Configuration::rawConfig(); if ( @$conf['security']['user']['show_admin_mail'] ) $this->user->mail = $this->getRequestVar('mail' ); @@ -207,9 +208,9 @@ class UserAction extends BaseAction */ public function propView() { - $conf = \cms\base\Configuration::rawConfig(); + $conf = Configuration::rawConfig(); - $issuer = urlencode(\cms\base\Configuration::config('application','operator')); + $issuer = urlencode(Configuration::subset('application')->get('operator',Startup::TITLE)); $account = $this->user->name.'@'.$_SERVER['SERVER_NAME']; $base32 = new Base2n(5, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567', FALSE, TRUE, TRUE); @@ -249,31 +250,26 @@ class UserAction extends BaseAction { $this->setTemplateVars( $this->user->getProperties() ); - $gravatarConfig = \cms\base\Configuration::config('interface','gravatar'); + $gravatarConfig = Configuration::subset(['interface','gravatar'] ); - $this->setTemplateVar( 'image', 'about:blank' ); - if ( is_array($gravatarConfig) ) + + if ( $gravatarConfig->is('enabled',true) && $this->user->mail ) { - extract($gravatarConfig); - - if ( isset($enable) && $enable && !empty($this->user->mail) ) - { - $url = 'http://www.gravatar.com/avatar/'.md5($this->user->mail).'?'; - if ( isset($size)) - $url .= '&s='.$size; - if ( isset($default)) - $url .= '&d='.$default; - if ( isset($rating)) - $url .= '&r='.$rating; - - $this->setTemplateVar( 'image', $url ); - } + $url = 'http://www.gravatar.com/avatar/'.md5($this->user->mail).'?'; + + $url .= '&s='.$gravatarConfig->get('size' ,80 ); + $url .= '&d='.$gravatarConfig->get('default',404); + $url .= '&r='.$gravatarConfig->get('rating' ,'g'); + + $this->setTemplateVar( 'image', $url ); + } else { + $this->setTemplateVar( 'image', 'about:blank' ); } - $issuer = urlencode(\cms\base\Configuration::config('application','operator')); + $issuer = urlencode(Configuration::subset('application')->get('operator',Startup::TITLE)); $account = $this->user->name.'@'.$_SERVER['SERVER_NAME']; $base32 = new Base2n(5, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567', FALSE, TRUE, TRUE); diff --git a/modules/cms/auth/InternalAuth.class.php b/modules/cms/auth/InternalAuth.class.php @@ -63,7 +63,7 @@ SQL // Wenn das kennwort abgelaufen ist, kann es eine bestimmte Dauer noch benutzt und geändert werden. // Nach Ablauf dieser Dauer wird das Login abgelehnt. - if ($row_user['password_expires'] + (Configuration::config('security', 'deny_after_expiration_duration') * 60 * 60) < time()) + if ($row_user['password_expires'] + (Configuration::subset('security')->get('deny_after_expiration_duration',72) * 60 * 60) < time()) return false; // Abgelaufenes Kennwort wird nicht mehr akzeptiert. else return Auth::STATUS_PW_EXPIRED; // Kennwort ist abgelaufen, kann aber noch geändert werden. diff --git a/modules/cms/auth/RememberAuth.class.php b/modules/cms/auth/RememberAuth.class.php @@ -30,7 +30,7 @@ class RememberAuth implements Auth list($selector, $token) = array_pad(explode('.', $_COOKIE['or_token']), 2, ''); $dbid = $_COOKIE['or_dbid']; - $dbConfig = Configuration::config()->subset('database'); + $dbConfig = Configuration::subset('database'); if (!$dbConfig->has($dbid)) { diff --git a/modules/cms/auth/SSLAuth.class.php b/modules/cms/auth/SSLAuth.class.php @@ -3,6 +3,7 @@ namespace cms\auth; use cms\auth\Auth; +use cms\base\Configuration; /** * Authentifizierung ueber ein SSL-Zertifikat. @@ -13,9 +14,14 @@ class SSLAuth implements Auth { public function username() { - $conf = \cms\base\Configuration::config('security', 'ssl'); - if (isset($_SERVER[\cms\base\Configuration::config('security', 'ssl', 'client_cert_dn_env')])) - return $_SERVER[\cms\base\Configuration::config('security', 'ssl', 'client_cert_dn_env')]; + $envName = Configuration::subset(['security', 'ssl'] )->get('client_cert_dn_env','SSL_CLIENT_S_DN_CN'); + + $dn = @$_SERVER[ $envName ]; + + if ( $dn ) + return $dn; + + return null; } @@ -28,4 +34,3 @@ class SSLAuth implements Auth } } -?>- \ No newline at end of file diff --git a/modules/cms/base/Configuration.class.php b/modules/cms/base/Configuration.class.php @@ -7,43 +7,6 @@ use util\Session; class Configuration { - /* - * Liest einen Schluessel aus der Konfiguration - * - * @return String, leer falls Schluessel nicht vorhanden - */ - public static function config($part1 = null, $part2 = null, $part3 = null, $part4 = null) - { - $conf = self::getConfig(); - - if ($part1 == null) - return new Config($conf); - - if ($part2 == null) - if (isset($conf[$part1])) - return $conf[$part1]; - else - return ''; - - if ($part3 == null) - if (isset($conf[$part1][$part2])) - return $conf[$part1][$part2]; - else - return ''; - - if ($part4 == null) - if (isset($conf[$part1][$part2][$part3])) - return $conf[$part1][$part2][$part3]; - else - return ''; - - if (isset($conf[$part1][$part2][$part3][$part4])) - return $conf[$part1][$part2][$part3][$part4]; - else - return ''; - } - - /** * @return Config */ @@ -74,4 +37,28 @@ class Configuration { return self::getConfig(); } + + /** + * @param $keys + */ + public static function get( $keys ) { + + settype($keys,'array'); + + $value = self::getConfig(); + + foreach( $keys as $key ) { + if ( is_array( $value ) ) { + if ( isset( $value[$key] ) ) + $value = $value[$key]; + else + return null;; + } else { + return null; + } + } + + return $value; + } + } diff --git a/modules/cms/base/DefaultConfig.class.php b/modules/cms/base/DefaultConfig.class.php @@ -334,7 +334,7 @@ class DefaultConfig { [ 'use_http' => true, 'default' => 'de', - 'available' => 'de,en,es,fr,it,ru,cn', + 'available' => ['de','en','es','fr','it','ru','cn'], 'locale' => [ 'de' => 'de_DE.utf8', diff --git a/modules/cms/base/Language.class.php b/modules/cms/base/Language.class.php @@ -34,7 +34,7 @@ class Language */ public static function lang($textVar, $vars = array()) { - $conf = \cms\base\Configuration::rawConfig(); + $conf = Configuration::rawConfig(); $lang = $conf['language']; $text = strtoupper($textVar); @@ -58,8 +58,12 @@ class Language return $text; } + if ( DEVELOPMENT ) { + Logger::warn('Message-Key not found: ' . $textVar); + return '??' . $textVar . '??'; + } + // Wenn Textvariable nicht vorhanden ist, dann als letzten Ausweg nur den Variablennamen zurueckgeben - Logger::warn('Message-Key not found: ' . $textVar); - return ('?' . $textVar . '?'); + return $textVar; } } \ No newline at end of file diff --git a/modules/cms/base/Startup.class.php b/modules/cms/base/Startup.class.php @@ -172,7 +172,7 @@ class Startup { public static function readonly() { // Gesamtes CMS ist readonly. - if (Configuration::config('security', 'readonly')) + if (Configuration::subset( ['security'] )->is('readonly',false)) return true; // Aktuelle Datenbankverbindung ist readonly. diff --git a/modules/cms/generator/PageGenerator.class.php b/modules/cms/generator/PageGenerator.class.php @@ -4,6 +4,7 @@ namespace cms\generator; +use cms\base\Configuration; use cms\generator\PageContext; use cms\model\File; use cms\model\Folder; @@ -73,7 +74,7 @@ class PageGenerator extends BaseGenerator */ private function generatePageValue() { - $conf = \cms\base\Configuration::rawConfig(); + $conf = Configuration::rawConfig(); // Setzen der 'locale', damit sprachabhängige Systemausgaben (wie z.B. die // Ausgabe von strftime()) in der korrekten Sprache dargestellt werden. @@ -174,7 +175,7 @@ class PageGenerator extends BaseGenerator // should we do a UTF-8-escaping here? // Default should be off, because if you are fully using utf-8 (you should do), this is unnecessary. - if ( \cms\base\Configuration::config('publish','escape_8bit_characters') ) + if ( Configuration::subset('publish' )->is('escape_8bit_characters') ) if ( substr($this->mimeType(),-4) == 'html' ) { /* @@ -213,14 +214,15 @@ class PageGenerator extends BaseGenerator $project = $page->getProject(); $project->load(); - $format = \cms\base\Configuration::config('publish','format'); + $publishConfig = Configuration::subset('publish'); + $format = $publishConfig->get('format','{filename}{language_sep}{language}{type_sep}{type}'); $format = str_replace('{filename}',$page->filename,$format ); $allLanguages = $project->getLanguageIds(); $allModels = $project->getModelIds(); - $withLanguage = count($allLanguages) > 1 || \cms\base\Configuration::config('publish','filename_language') == 'always'; - $withModel = count($allModels ) > 1 || \cms\base\Configuration::config('publish','filename_type' ) == 'always'; + $withLanguage = count($allLanguages) > 1 || $publishConfig->get('filename_language','auto' ) == 'always'; + $withModel = count($allModels ) > 1 || $publishConfig->get('filename_type' ,'always' ) == 'always'; $languagePart = ''; $typePart = ''; @@ -239,8 +241,8 @@ class PageGenerator extends BaseGenerator $typePart = $templateModel->extension; } - $languageSep = $languagePart?\cms\base\Configuration::config('publish','language_sep') :''; - $typeSep = $typePart ?\cms\base\Configuration::config('publish','type_sep' ) :''; + $languageSep = $languagePart? $publishConfig->get('language_sep','.') :''; + $typeSep = $typePart ? $publishConfig->get('type_sep' ,'.') :''; $format = str_replace('{language}' ,$languagePart ,$format ); $format = str_replace('{language_sep}',$languageSep ,$format ); diff --git a/modules/cms/generator/link/PublicLink.class.php b/modules/cms/generator/link/PublicLink.class.php @@ -2,6 +2,7 @@ namespace cms\generator\link; +use cms\base\Configuration; use cms\generator\PageContext; use cms\model\BaseObject; use cms\model\File; @@ -61,6 +62,8 @@ class PublicLink implements LinkFormat */ public function linkToObject( BaseObject $from, BaseObject $to ) { + $publishConfig = Configuration::subset('publish'); + $from->load(); $fromProject = $from->getProject()->load(); @@ -97,7 +100,7 @@ class PublicLink implements LinkFormat case BaseObject::TYPEID_PAGE: - if ($fromProject->cut_index && $to->filename == \cms\base\Configuration::config('publish', 'default')) { + if ($fromProject->cut_index && $to->filename == $publishConfig->get('default','index')) { $filename = ''; // Link auf Index-Datei, der Dateiname bleibt leer. } else { @@ -107,7 +110,7 @@ class PublicLink implements LinkFormat $parentFolder = new Folder($page->parentid); $parentFolder->load(); - $format = \cms\base\Configuration::config('publish', 'format'); + $format = $publishConfig->get('format','{filename}{language_sep}{language}{type_sep}{type}'); $format = str_replace('{filename}', $page->filename(), $format); $allLanguages = $fromProject->getLanguageIds(); @@ -116,12 +119,12 @@ class PublicLink implements LinkFormat $withLanguage = !$fromProject->content_negotiation && $fromProject->publishPageExtension && - (count($allLanguages) > 1 || \cms\base\Configuration::config('publish', 'filename_language') == 'always'); + (count($allLanguages) > 1 || $publishConfig->get('filename_language','auto') == 'always'); $withModel = ! $fromProject->content_negotiation && ! $fromProject->publishPageExtension && - (count($allModels) > 1 || \cms\base\Configuration::config('publish', 'filename_type') == 'always'); + (count($allModels) > 1 || $publishConfig->get('filename_type','always') == 'always'); $languagePart = ''; $typePart = ''; @@ -139,8 +142,8 @@ class PublicLink implements LinkFormat $typePart = $templateModel->extension; } - $languageSep = $languagePart?\cms\base\Configuration::config('publish','language_sep') :''; - $typeSep = $typePart ?\cms\base\Configuration::config('publish','type_sep' ) :''; + $languageSep = $languagePart? $publishConfig->get('language_sep','.') :''; + $typeSep = $typePart ? $publishConfig->get('type_sep' ,'.') :''; $format = str_replace('{language}' ,$languagePart ,$format ); $format = str_replace('{language_sep}',$languageSep ,$format ); diff --git a/modules/cms/generator/target/Ftp.class.php b/modules/cms/generator/target/Ftp.class.php @@ -17,6 +17,7 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. namespace cms\generator\target; +use cms\base\Configuration; use logger\Logger; use util\exception\PublisherException; use util\exception\UIException; @@ -100,7 +101,7 @@ class Ftp extends BaseTarget if ($p !== false) // Wennn letzten Punkt gefunden, dann dort aufteilen { $extension = substr(basename($dest), $p + 1); - $type = \cms\base\Configuration::config('mime-types', $extension); + $type = Configuration::subset('mime-types')->get( $extension,'application/download'); if (substr($type, 0, 5) == 'text/') $mode = FTP_ASCII; } diff --git a/modules/cms/generator/target/Local.class.php b/modules/cms/generator/target/Local.class.php @@ -17,6 +17,7 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. namespace cms\generator\target; +use cms\base\Configuration; use cms\base\Startup; use logger\Logger; use util\exception\PublisherException; @@ -42,18 +43,18 @@ class Local extends BaseTarget */ public function open() { - $confPublish = \cms\base\Configuration::config('publish'); + $fileSystemConfig = Configuration::subset(['publish','filesystem']); $targetDir = rtrim( $this->url->path,'/' ); - if ( FileUtils::isAbsolutePath($targetDir) && $confPublish['filesystem']['per_project'] ) + if ( FileUtils::isAbsolutePath($targetDir) && $fileSystemConfig->is('per_project',true )) { $this->localDestinationDirectory = FileUtils::toAbsolutePath([$targetDir]); // Projekteinstellung verwenden. } else { // Konfiguriertes Verzeichnis verwenden. - $this->localDestinationDirectory = FileUtils::toAbsolutePath([$confPublish['filesystem']['directory'],$targetDir]); + $this->localDestinationDirectory = FileUtils::toAbsolutePath([$fileSystemConfig->get('directory','/var/www'),$targetDir]); } @@ -71,7 +72,7 @@ class Local extends BaseTarget */ public function put($source, $dest, $lastChangeDate) { - $conf = \cms\base\Configuration::rawConfig(); + $conf = Configuration::rawConfig(); // Is the output directory writable? if ( !is_writeable( $this->localDestinationDirectory ) ) @@ -124,7 +125,7 @@ class Local extends BaseTarget */ private function mkdirs($path ) { - $conf = \cms\base\Configuration::rawConfig(); + $conf = Configuration::rawConfig(); if ( is_dir($path) ) return; // Path exists diff --git a/modules/cms/model/BaseObject.class.php b/modules/cms/model/BaseObject.class.php @@ -3,6 +3,7 @@ namespace cms\model; +use cms\base\Configuration; use cms\base\DB as Db; use cms\base\Startup; use util\ArrayUtils; @@ -294,7 +295,7 @@ SQL } $guestMask = 0; - switch( \cms\base\Configuration::Conf()->subset('security')->get('guest-access','read') ) + switch( Configuration::Conf()->subset('security')->get('guest-access','read') ) { case 'read': case 'readonly': @@ -524,7 +525,7 @@ SQL $slug = str_replace(array_keys($replacements), array_values($replacements), $slug); // 2nd try is to use iconv with the current locale. - Language::setLocale( \cms\base\Configuration::config('language','language_code' ) ); + Language::setLocale( Configuration::subset('language')->get('language_code','en' ) ); $slug = iconv('utf-8', 'ascii//TRANSLIT', $slug); // now replace every unpleasant char with a hyphen. @@ -555,7 +556,7 @@ SQL */ public function filename() { - $conf = \cms\base\Configuration::rawConfig(); + $conf = Configuration::rawConfig(); $filename = $this->filename; @@ -1348,7 +1349,7 @@ SQL // Resolve config variables. $resolver->addResolver('config', function ($var) { - $conf = \cms\base\Configuration::rawConfig(); + $conf = Configuration::rawConfig(); return ArrayUtils::getSubValue($conf,explode('.',$var) ); }); diff --git a/modules/cms/model/Folder.class.php b/modules/cms/model/Folder.class.php @@ -2,6 +2,7 @@ namespace cms\model; +use cms\base\Configuration; use cms\base\DB as Db; use cms\generator\Publish; use Exception; @@ -426,9 +427,9 @@ class Folder extends BaseObject */ public function filename() { - $filenameConfig = \cms\base\Configuration::config('filename'); + $filenameConfig = Configuration::subset('filename'); - if ( $filenameConfig['edit'] ) + if ( $filenameConfig->is('edit',true ) ) { if ( $this->filename == '' ) // Filename ist eigentlich ein Pflichtfeld, daher kann dies nahezu nie auftreten. @@ -440,7 +441,7 @@ class Folder extends BaseObject else { // Filename is not edited, so we are generating a pleasant filename. - switch( $filenameConfig['style'] ) + switch( $filenameConfig->get('style','short') ) { case 'longid': // Eine etwas laengere ID als Dateinamen benutzen diff --git a/modules/cms/model/Language.class.php b/modules/cms/model/Language.class.php @@ -18,6 +18,7 @@ namespace cms\model; // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. use cms\base\Configuration; use cms\base\DB as Db; +use logger\Logger; /** @@ -46,7 +47,7 @@ class Language extends ModelBase public static function setLocale( $isoCode ) { - $localeConf = \cms\base\Configuration::config()->subset('i18n')->subset('locale'); + $localeConf = Configuration::subset('i18n')->subset('locale'); if ( $localeConf->has(strtolower($isoCode)) ) { @@ -55,7 +56,7 @@ class Language extends ModelBase if ( !$locale_ok ) // Hat nicht geklappt. Entweder ist das Mapping falsch oder die locale ist // nicht korrekt installiert. - \logger\Logger::warn("Could not set locale '$locale', please check with 'locale -a' if it is installaled correctly"); + Logger::warn("Could not set locale '$locale', please check with 'locale -a' if it is installaled correctly"); } else { diff --git a/modules/cms/model/Value.class.php b/modules/cms/model/Value.class.php @@ -1,5 +1,6 @@ <?php namespace cms\model; +use cms\base\Configuration; use cms\base\DB; use cms\base\Startup; use util\ArrayUtils; @@ -498,8 +499,8 @@ SQL $sql->query(); // Nur ausfuehren, wenn in Konfiguration aktiviert. - $limit = \cms\base\Configuration::config('content','revision-limit'); - if ( isset($limit['enabled']) && $limit['enabled'] ) + $limit = Configuration::subset(['content','revision-limit'] ); + if ( $limit->is('enabled',false) ) $this->checkLimit(); } @@ -510,11 +511,9 @@ SQL */ function checkLimit() { - $limit = \cms\base\Configuration::config('content','revision-limit'); + $limitConfig = Configuration::subset(['content','revision-limit']); - $db = \cms\base\DB::get(); - - $sql = $db->sql( <<<SQL + $sql = DB::sql( <<<SQL SELECT id FROM {{value}} WHERE elementid = {elementid} AND pageid = {pageid} @@ -529,9 +528,9 @@ SQL $sql->setInt( 'languageid',$this->languageid ); $values = $sql->getCol(); - if ( count($values) > $limit['min-revisions'] ) + if ( count($values) > $limitConfig->get('min-revisions',3) ) { - $sql = $db->sql( <<<SQL + $sql = DB::sql( <<<SQL DELETE FROM {{value}} WHERE elementid = {elementid} AND pageid = {pageid} @@ -545,14 +544,14 @@ SQL $sql->setInt( 'elementid' ,$this->element->elementid ); $sql->setInt( 'pageid' ,$this->pageid ); $sql->setInt( 'languageid',$this->languageid ); - $sql->setInt( 'min_date' ,$limit['max-age']*24*60*60); - $sql->setInt( 'min_id' ,$values[count($values)-$limit['min-revisions']]); + $sql->setInt( 'min_date' ,$limitConfig['max-age']*24*60*60); + $sql->setInt( 'min_id' ,$values[count($values)-$limitConfig['min-revisions']]); $sql->query(); } - if ( count($values) > $limit['max-revisions'] ) + if ( count($values) > $limitConfig->get('max-revisions',100 ) ) { - $sql = $db->sql( <<<SQL + $sql = Db::sql( <<<SQL DELETE FROM {{value}} WHERE elementid = {elementid} AND pageid = {pageid} @@ -566,8 +565,8 @@ SQL $sql->setInt( 'elementid' ,$this->element->elementid ); $sql->setInt( 'pageid' ,$this->pageid ); $sql->setInt( 'languageid',$this->languageid ); - $sql->setInt( 'min_date' ,$limit['min-age']*24*60*60); - $sql->setInt( 'min_id' ,$values[count($values)-$limit['max-revisions']]); + $sql->setInt( 'min_date' ,$limitConfig['min-age']*24*60*60); + $sql->setInt( 'min_id' ,$values[count($values)-$limitConfig['max-revisions']]); $sql->query(); } } diff --git a/modules/cms/ui/action/IndexAction.class.php b/modules/cms/ui/action/IndexAction.class.php @@ -52,17 +52,17 @@ class IndexAction extends Action $user = Session::getUser(); if ( $user ) - $this->lastModified( C::config('config','last_modification_time') ); + $this->lastModified( C::subset('config')->get('last_modification_time',time() ) ); else $this->lastModified( time() ); $style = $this->getUserStyle( $user ); - $styleConfig = C::config('style-default'); // default style config - $userStyleConfig = C::config('style', $style); // user style config + $styleConfig = C::Conf()->subset('style-default' ); // default style config + $userStyleConfig = C::subset('style')->subset( $style ); // user style config - if (is_array($userStyleConfig)) - $styleConfig = array_merge($styleConfig, $userStyleConfig ); // Merging user style into default style + if ( $userStyleConfig->hasContent() ) + $styleConfig->merge( $userStyleConfig ); // Merging user style into default style else ; // Unknown style name, we are ignoring this. @@ -70,22 +70,18 @@ class IndexAction extends Action $themeColor = UIUtils::getColorHexCode($styleConfig['title_background_color']); - - - $appName = C::config('application','name'); + $appName = C::subset(['application'])->get('name',Startup::TITLE); $value = array( - 'name' => $appName, + 'name' => $appName, 'description' => $appName, - 'short_name' => 'CMS', - 'display' => 'standalone', + 'short_name' => 'CMS', + 'display' => 'standalone', 'orientation' => 'landscape', - "background_color" => $themeColor, + 'background_color' => $themeColor, ); header("Content-Type: application/manifest+json"); - - header('Content-Type: application/json'); $json = new JSON(); $this->setTemplateVar( 'manifest',$json->encode($value) ); } @@ -108,10 +104,12 @@ class IndexAction extends Action $user = Session::getUser(); } + $configLastModificationTime = C::subset('config')->get('last_modification_time', 0); + if ( $user ) - $this->lastModified( max( $user->loginDate, C::config('config','last_modification_time')) ); + $this->lastModified( max( $user->loginDate, $configLastModificationTime) ); else - $this->lastModified( C::config('config','last_modification_time') ); + $this->lastModified( $configLastModificationTime ); // Theme für den angemeldeten Benuter ermitteln $style = $this->getUserStyle($user); @@ -134,10 +132,10 @@ class IndexAction extends Action $this->setTemplateVar('themeStyleLink', Html::url('index','themestyle') ); $this->setTemplateVar('manifestLink' , Html::url('index','manifest' ) ); - $styleConfig = C::config('style-default'); // default style config - $userStyleConfig = C::config('style', $style); // user style config + $styleConfig = C::Conf()->get('style-default',[]); // default style config + $userStyleConfig = C::subset('style')->get( $style,[]); // user style config - if (is_array($userStyleConfig)) + if ( $userStyleConfig ) $styleConfig = array_merge($styleConfig,$userStyleConfig); // Merging user style into default style else ; // Unknown style name, we are ignoring this. @@ -145,10 +143,10 @@ class IndexAction extends Action // Theme base color for smartphones colorizing their status bar. $this->setTemplateVar('themeColor', UIUtils::getColorHexCode($styleConfig['title_background_color'])); - $messageOfTheDay = C::config('login', 'motd'); + $messageOfTheDay = C::subset('login')->get('motd',''); - if ( !empty($messageOfTheDay) ) - $this->addInfoFor( new User(),Messages::MOTD,array('motd'=>$messageOfTheDay) ); + if ( $messageOfTheDay ) + $this->addInfoFor( new User(),Messages::MOTD,array('motd' => $messageOfTheDay) ); if ( DEVELOPMENT ) $this->addInfoFor( new User(),Messages::DEVELOPMENT_MODE ); @@ -212,44 +210,46 @@ class IndexAction extends Action { // Je Theme die Theme-CSS-Datei ausgeben. $lessFile = Startup::THEMES_DIR . 'default/style/theme/openrat-theme.less'; - $css = ''; - - - foreach (array_keys(C::config('style')) as $styleId) + $css = ''; + + $parser = new Less(array( + 'sourceMap' => DEVELOPMENT, + 'indentation' => DEVELOPMENT?"\t":'', + 'outputSourceFiles' => false, + 'compress' => PRODUCTION + )); + + foreach ( C::subset('style')->subsets() as $styleId => $styleConfig) { try { - $parser = new Less(array( - 'sourceMap' => DEVELOPMENT, - 'indentation' => ' ', - 'outputSourceFiles' => false - )); - $parser->parseFile($lessFile,basename($lessFile)); - - $styleConfig = array_merge( C::config('style-default'), C::config('style', $styleId) ); + $styleConfig = C::Conf()->subset('style-default')->merge( $styleConfig ); + + if ( DEVELOPMENT ) + $css .= "\n".'/* Theme: '.$styleId.' */'."\n"; + $lessVars = array( - 'cms-theme-id' => strtolower($styleId), + 'cms-theme-id' => strtolower($styleId), 'cms-image-path' => 'themes/default/images/' ); - foreach ($styleConfig as $styleSetting => $value) + foreach ($styleConfig->getConfig() as $styleSetting => $value) $lessVars['cms-' . strtolower(strtr($styleSetting, '_', '-'))] = $value; + $parser->parseFile($lessFile,basename($lessFile)); $parser->modifyVars($lessVars); $css .= $parser->getCss(); } catch (Exception $e) { - Logger::warn("LESS Parser failed on file '$lessFile'. Reason: " . $e->__toString() . " */\n\n"); + Logger::warn( new \RuntimeException("LESS Parser failed on file '$lessFile'.", 0,$e) ); // For not confusing the browser we are displaying a CSS with a comment. - $css .= "\n\n/* WARNING!\n LESS Parser failed on file '$lessFile'. Reason: " . $e->__toString() . " */\n\n"; + if ( DEVELOPMENT ) + $css .= "\n\n/* ERROR!\n LESS Parser failed on file '$lessFile'. Reason: " . $e->__toString() . " */\n\n"; } } - if (PRODUCTION) - return $css; // Should we minify here? Bandwidth vs. cpu-load. - else - return $css; + return $css; } @@ -291,8 +291,9 @@ class IndexAction extends Action } + $startConfig = Configuration::subset( ['login','start'] ); // Das zuletzt geänderte Objekt benutzen. - if ( C::config('login','start','start_lastchanged_object') ) + if ( $startConfig->is('start_lastchanged_object',true) ) { $objectid = Value::getLastChangedObjectByUserId($user->userid); @@ -308,7 +309,7 @@ class IndexAction extends Action } // Das einzige Projekt benutzen - if ( C::config('login','start','start_single_project') ) + if ( $startConfig->is('start_single_project',true) ) { $projects = Project::getAllProjects(); if ( count($projects) == 1 ) { @@ -324,17 +325,16 @@ class IndexAction extends Action private function tryAutoLogin() { - $modules = C::config('security','autologin','modules'); + $modules = C::subset( ['security','autologin'] )->get('modules',[] ); $username = null; foreach( $modules as $module) { Logger::debug( 'Auto-Login module: '.$module ); - $moduleClass = 'cms\auth\\'.$module.'Auth'; - $auth = new $moduleClass; + $moduleClass = Auth::NS. '\\'.$module.'Auth'; + $auth = new $moduleClass; /* @type $auth Auth */ try { - $username = $auth->username(); } catch( Exception $e ) { @@ -380,10 +380,10 @@ class IndexAction extends Action private function getUserStyle( $user ) { // Theme für den angemeldeten Benuter ermitteln - if ( $user && isset(C::config('style')[$user->style])) + if ( $user && C::subset('style')->has($user->style) ) $style = $user->style; else - $style = C::config('interface', 'style', 'default'); + $style = C::subset( ['interface', 'style'])->get('default','default'); return $style; } diff --git a/modules/cms/ui/action/TitleAction.class.php b/modules/cms/ui/action/TitleAction.class.php @@ -3,6 +3,7 @@ namespace cms\ui\action; use cms\action\Action; +use cms\base\Configuration; use cms\base\DB; use cms\base\Startup; use cms\model\BaseObject; @@ -42,7 +43,7 @@ class TitleAction extends Action */ public function showView() { - $this->setTemplateVar('buildinfo',Startup::TITLE.' '.Startup::VERSION.' - build '.\cms\base\Configuration::config('build','build') ); + $this->setTemplateVar('buildinfo',Startup::TITLE.' '.Startup::VERSION.' - build date '.Startup::DATE ); $user = Session::getUser(); @@ -69,7 +70,7 @@ class TitleAction extends Action //$this->setTemplateVar('logout_url' ,Html::url( 'index','logout' )); $this->setTemplateVar('isAdmin',$this->userIsAdmin() ); - if ( \cms\base\Configuration::config('interface','session','auto_extend') ) + if ( Configuration::subset(['interface','session'])->is('auto_extend',true) ) { $this->setTemplateVar('ping_url' ,Html::url('title','ping') ); $this->setTemplateVar('ping_timeout',ini_get('session.gc_maxlifetime')-60 ); diff --git a/modules/cms/ui/themes/default/html/views/element/advanced.php b/modules/cms/ui/themes/default/html/views/element/advanced.php @@ -1,5 +1,5 @@ <?php /* THIS FILE IS GENERATED from advanced.tpl.src.xml - DO NOT CHANGE */ defined('APP_STARTED') || die('Forbidden'); use \template_engine\Output as O; ?> - <?php $if2=(O::config('security','disable_dynamic_code')); if($if2) { ?> + <?php $if2=(O::config(['security','disable_dynamic_code'])); if($if2) { ?> <?php $if3=(!1); if($if3) { ?> <div class="<?php echo O::escapeHtml('or-message warn') ?>"><?php echo O::escapeHtml('') ?> <span><?php echo O::escapeHtml(''.@O::lang('NOTICE_CODE_DISABLED').'') ?> diff --git a/modules/cms/ui/themes/default/html/views/file/pub.php b/modules/cms/ui/themes/default/html/views/file/pub.php @@ -1,5 +1,5 @@ <?php /* THIS FILE IS GENERATED from pub.tpl.src.xml - DO NOT CHANGE */ defined('APP_STARTED') || die('Forbidden'); use \template_engine\Output as O; ?> - <?php $if2=(O::config('security','nopublish')); if($if2) { ?> + <?php $if2=(O::config(['security','nopublish'])); if($if2) { ?> <div class="<?php echo O::escapeHtml('or-message warn') ?>"><?php echo O::escapeHtml('') ?> <span class="<?php echo O::escapeHtml('or-help') ?>"><?php echo O::escapeHtml(''.@O::lang('NOPUBLISH_DESC').'') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/folder/pub.php b/modules/cms/ui/themes/default/html/views/folder/pub.php @@ -1,5 +1,5 @@ <?php /* THIS FILE IS GENERATED from pub.tpl.src.xml - DO NOT CHANGE */ defined('APP_STARTED') || die('Forbidden'); use \template_engine\Output as O; ?> - <?php $if2=(O::config('security','nopublish')); if($if2) { ?> + <?php $if2=(O::config(['security','nopublish'])); if($if2) { ?> <div class="<?php echo O::escapeHtml('or-message warn') ?>"><?php echo O::escapeHtml('') ?> <span class="<?php echo O::escapeHtml('or-help') ?>"><?php echo O::escapeHtml(''.@O::lang('NOPUBLISH_DESC').'') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/grouplist/show.php b/modules/cms/ui/themes/default/html/views/grouplist/show.php @@ -28,7 +28,7 @@ <a target="<?php echo O::escapeHtml('_self') ?>" date-name="<?php echo O::escapeHtml(''.@O::lang('menu_add').'') ?>" name="<?php echo O::escapeHtml(''.@O::lang('menu_add').'') ?>" data-type="<?php echo O::escapeHtml('dialog') ?>" data-action="<?php echo O::escapeHtml('') ?>" data-method="<?php echo O::escapeHtml('add') ?>" data-id="<?php echo O::escapeHtml('') ?>" data-extra-dialogAction="<?php echo O::escapeHtml('') ?>" data-extra-dialogMethod="<?php echo O::escapeHtml('add') ?>" data-extra="<?php echo O::escapeHtml('{\'dialogAction\':null,\'dialogMethod\':\'add\'}') ?>" href="<?php echo O::escapeHtml('') ?>" class="<?php echo O::escapeHtml('or-link') ?>"><?php echo O::escapeHtml('') ?> <i class="<?php echo O::escapeHtml('or-image-icon or-image-icon--method-add') ?>"><?php echo O::escapeHtml('') ?> </i> - <span><?php echo O::escapeHtml(''.@O::lang('new').'') ?> + <span><?php echo O::escapeHtml(''.@O::lang('add').'') ?> </span> </a> </td> diff --git a/modules/cms/ui/themes/default/html/views/image/pub.php b/modules/cms/ui/themes/default/html/views/image/pub.php @@ -1,5 +1,5 @@ <?php /* THIS FILE IS GENERATED from pub.tpl.src.xml - DO NOT CHANGE */ defined('APP_STARTED') || die('Forbidden'); use \template_engine\Output as O; ?> - <?php $if2=(O::config('security','nopublish')); if($if2) { ?> + <?php $if2=(O::config(['security','nopublish'])); if($if2) { ?> <div class="<?php echo O::escapeHtml('or-message warn') ?>"><?php echo O::escapeHtml('') ?> <span class="<?php echo O::escapeHtml('or-help') ?>"><?php echo O::escapeHtml(''.@O::lang('NOPUBLISH_DESC').'') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/image/uncompress.php b/modules/cms/ui/themes/default/html/views/image/uncompress.php @@ -34,7 +34,7 @@ <br /><?php echo O::escapeHtml('') ?> <input type="<?php echo O::escapeHtml('radio') ?>" name="<?php echo O::escapeHtml('replace') ?>" value="<?php echo O::escapeHtml('') ?>" <?php if(@$replace=='0'){ ?>checked="<?php echo O::escapeHtml('checked') ?>"<?php } ?> class="<?php echo O::escapeHtml('or-form-radio') ?>" /><?php echo O::escapeHtml('') ?> <label class="<?php echo O::escapeHtml('or-label') ?>"><?php echo O::escapeHtml('') ?> - <span><?php echo O::escapeHtml(''.@O::lang('new').'') ?> + <span><?php echo O::escapeHtml(''.@O::lang('add').'') ?> </span> </label> </div> diff --git a/modules/cms/ui/themes/default/html/views/login/login.php b/modules/cms/ui/themes/default/html/views/login/login.php @@ -7,29 +7,29 @@ <input type="<?php echo O::escapeHtml('hidden') ?>" name="<?php echo O::escapeHtml('action') ?>" value="<?php echo O::escapeHtml('login') ?>" /><?php echo O::escapeHtml('') ?> <input type="<?php echo O::escapeHtml('hidden') ?>" name="<?php echo O::escapeHtml('subaction') ?>" value="<?php echo O::escapeHtml('login') ?>" /><?php echo O::escapeHtml('') ?> <input type="<?php echo O::escapeHtml('hidden') ?>" name="<?php echo O::escapeHtml('id') ?>" value="<?php echo O::escapeHtml(''.@$_id.'') ?>" /><?php echo O::escapeHtml('') ?> - <?php $if3=(O::config('login','logo','enabled')); if($if3) { ?> - <?php $if4=!((O::config('login','logo','url'))==FALSE); if($if4) { ?> - <a target="<?php echo O::escapeHtml('_self') ?>" data-url="<?php echo O::escapeHtml(''.O::config('login','logo','url').'') ?>" data-action="<?php echo O::escapeHtml('') ?>" data-method="<?php echo O::escapeHtml('') ?>" data-id="<?php echo O::escapeHtml('') ?>" data-extra="<?php echo O::escapeHtml('[]') ?>" href="<?php echo O::escapeHtml('') ?>" class="<?php echo O::escapeHtml('or-link') ?>"><?php echo O::escapeHtml('') ?> - <img src="<?php echo O::escapeHtml(''.O::config('login','logo','image').'') ?>" /><?php echo O::escapeHtml('') ?> + <?php $if3=(O::config(['login','logo','enabled'])); if($if3) { ?> + <?php $if4=!((O::config(['login','logo','url']))==FALSE); if($if4) { ?> + <a target="<?php echo O::escapeHtml('_self') ?>" data-url="<?php echo O::escapeHtml(''.O::config(['login','logo','url']).'') ?>" data-action="<?php echo O::escapeHtml('') ?>" data-method="<?php echo O::escapeHtml('') ?>" data-id="<?php echo O::escapeHtml('') ?>" data-extra="<?php echo O::escapeHtml('[]') ?>" href="<?php echo O::escapeHtml('') ?>" class="<?php echo O::escapeHtml('or-link') ?>"><?php echo O::escapeHtml('') ?> + <img src="<?php echo O::escapeHtml(''.O::config(['login','logo','image']).'') ?>" /><?php echo O::escapeHtml('') ?> </a> <?php } ?> <?php if(!$if4) { ?> - <img src="<?php echo O::escapeHtml(''.O::config('login','logo','image').'') ?>" /><?php echo O::escapeHtml('') ?> + <img src="<?php echo O::escapeHtml(''.O::config(['login','logo','image']).'') ?>" /><?php echo O::escapeHtml('') ?> <?php } ?> <?php } ?> - <?php $if3=!((O::config('login','motd'))==FALSE); if($if3) { ?> + <?php $if3=!((O::config(['login','motd']))==FALSE); if($if3) { ?> <div class="<?php echo O::escapeHtml('or-message info') ?>"><?php echo O::escapeHtml('') ?> - <span><?php echo O::escapeHtml(''.O::config('login','motd').'') ?> + <span><?php echo O::escapeHtml(''.O::config(['login','motd']).'') ?> </span> </div> <?php } ?> - <?php $if3=(O::config('security','readonly')); if($if3) { ?> + <?php $if3=(O::config(['security','readonly'])); if($if3) { ?> <div class="<?php echo O::escapeHtml('or-message warn') ?>"><?php echo O::escapeHtml('') ?> <span><?php echo O::escapeHtml(''.@O::lang('READONLY_DESC').'') ?> </span> </div> <?php } ?> - <?php $if3=(!O::config('login','nologin')); if($if3) { ?> + <?php $if3=(!O::config(['login','nologin'])); if($if3) { ?> <?php $if4=($enableOpenIdConnect); if($if4) { ?> <section class="<?php echo O::escapeHtml('or-group or-collapsible or-collapsible--is-open or-collapsible--show') ?>"><?php echo O::escapeHtml('') ?> <h2 class="<?php echo O::escapeHtml('or-collapsible-title or-group-title or-collapsible-act-switch') ?>"><?php echo O::escapeHtml(''.@O::lang('login').'') ?> @@ -97,8 +97,8 @@ <h3 class="<?php echo O::escapeHtml('or-fieldset-label') ?>"><?php echo O::escapeHtml(''.@O::lang('USER_NEW_PASSWORD').'') ?> </h3> <div class="<?php echo O::escapeHtml('or-fieldset-value') ?>"><?php echo O::escapeHtml('') ?> - <input type="<?php echo O::escapeHtml('password') ?>" name="<?php echo O::escapeHtml('password1') ?>" size="<?php echo O::escapeHtml('25') ?>" maxlength="<?php echo O::escapeHtml('256') ?>" placeholder="<?php echo O::escapeHtml(''.@O::lang('USER_NEW_PASSWORD').'') ?>" minlength="<?php echo O::escapeHtml(''.O::config('security','password','min_length').'') ?>" value="<?php echo O::escapeHtml(''.@$password1.'') ?>" class="<?php echo O::escapeHtml('or- or-input') ?>" /><?php echo O::escapeHtml('') ?> - <input type="<?php echo O::escapeHtml('password') ?>" name="<?php echo O::escapeHtml('password2') ?>" size="<?php echo O::escapeHtml('25') ?>" maxlength="<?php echo O::escapeHtml('256') ?>" placeholder="<?php echo O::escapeHtml(''.@O::lang('USER_NEW_PASSWORD_REPEAT').'') ?>" minlength="<?php echo O::escapeHtml(''.O::config('security','password','min_length').'') ?>" value="<?php echo O::escapeHtml(''.@$password2.'') ?>" class="<?php echo O::escapeHtml('or- or-input') ?>" /><?php echo O::escapeHtml('') ?> + <input type="<?php echo O::escapeHtml('password') ?>" name="<?php echo O::escapeHtml('password1') ?>" size="<?php echo O::escapeHtml('25') ?>" maxlength="<?php echo O::escapeHtml('256') ?>" placeholder="<?php echo O::escapeHtml(''.@O::lang('USER_NEW_PASSWORD').'') ?>" minlength="<?php echo O::escapeHtml(''.O::config(['security','password','min_length']).'') ?>" value="<?php echo O::escapeHtml(''.@$password1.'') ?>" class="<?php echo O::escapeHtml('or- or-input') ?>" /><?php echo O::escapeHtml('') ?> + <input type="<?php echo O::escapeHtml('password') ?>" name="<?php echo O::escapeHtml('password2') ?>" size="<?php echo O::escapeHtml('25') ?>" maxlength="<?php echo O::escapeHtml('256') ?>" placeholder="<?php echo O::escapeHtml(''.@O::lang('USER_NEW_PASSWORD_REPEAT').'') ?>" minlength="<?php echo O::escapeHtml(''.O::config(['security','password','min_length']).'') ?>" value="<?php echo O::escapeHtml(''.@$password2.'') ?>" class="<?php echo O::escapeHtml('or- or-input') ?>" /><?php echo O::escapeHtml('') ?> </div> </section> </div> diff --git a/modules/cms/ui/themes/default/html/views/login/password.php b/modules/cms/ui/themes/default/html/views/login/password.php @@ -1,5 +1,5 @@ <?php /* THIS FILE IS GENERATED from password.tpl.src.xml - DO NOT CHANGE */ defined('APP_STARTED') || die('Forbidden'); use \template_engine\Output as O; ?> - <?php $if2=(O::config('login','send_password')); if($if2) { ?> + <?php $if2=(O::config(['login','send_password'])); if($if2) { ?> <form name="<?php echo O::escapeHtml('') ?>" target="<?php echo O::escapeHtml('_self') ?>" data-target="<?php echo O::escapeHtml('view') ?>" action="<?php echo O::escapeHtml('./') ?>" data-method="<?php echo O::escapeHtml('password') ?>" data-action="<?php echo O::escapeHtml('login') ?>" data-id="<?php echo O::escapeHtml(''.@$_id.'') ?>" method="<?php echo O::escapeHtml('POST') ?>" enctype="<?php echo O::escapeHtml('application/x-www-form-urlencoded') ?>" data-async="<?php echo O::escapeHtml('') ?>" data-autosave="<?php echo O::escapeHtml('') ?>" class="<?php echo O::escapeHtml('or-form or-login') ?>"><?php echo O::escapeHtml('') ?> <div class="<?php echo O::escapeHtml('or-form-headline') ?>"><?php echo O::escapeHtml('') ?> </div> diff --git a/modules/cms/ui/themes/default/html/views/login/register.php b/modules/cms/ui/themes/default/html/views/login/register.php @@ -1,5 +1,5 @@ <?php /* THIS FILE IS GENERATED from register.tpl.src.xml - DO NOT CHANGE */ defined('APP_STARTED') || die('Forbidden'); use \template_engine\Output as O; ?> - <?php $if2=(O::config('login','register')); if($if2) { ?> + <?php $if2=(O::config(['login','register'])); if($if2) { ?> <form name="<?php echo O::escapeHtml('') ?>" target="<?php echo O::escapeHtml('_self') ?>" data-target="<?php echo O::escapeHtml('view') ?>" action="<?php echo O::escapeHtml('./') ?>" data-method="<?php echo O::escapeHtml('register') ?>" data-action="<?php echo O::escapeHtml('login') ?>" data-id="<?php echo O::escapeHtml(''.@$_id.'') ?>" method="<?php echo O::escapeHtml('POST') ?>" enctype="<?php echo O::escapeHtml('application/x-www-form-urlencoded') ?>" data-async="<?php echo O::escapeHtml('') ?>" data-autosave="<?php echo O::escapeHtml('') ?>" class="<?php echo O::escapeHtml('or-form or-login') ?>"><?php echo O::escapeHtml('') ?> <div class="<?php echo O::escapeHtml('or-form-headline') ?>"><?php echo O::escapeHtml('') ?> </div> diff --git a/modules/cms/ui/themes/default/html/views/modellist/show.php b/modules/cms/ui/themes/default/html/views/modellist/show.php @@ -56,7 +56,7 @@ <a target="<?php echo O::escapeHtml('_self') ?>" data-type="<?php echo O::escapeHtml('dialog') ?>" data-action="<?php echo O::escapeHtml('') ?>" data-method="<?php echo O::escapeHtml('add') ?>" data-id="<?php echo O::escapeHtml('') ?>" data-extra-dialogAction="<?php echo O::escapeHtml('') ?>" data-extra-dialogMethod="<?php echo O::escapeHtml('add') ?>" data-extra="<?php echo O::escapeHtml('{\'dialogAction\':null,\'dialogMethod\':\'add\'}') ?>" href="<?php echo O::escapeHtml('') ?>" class="<?php echo O::escapeHtml('or-link') ?>"><?php echo O::escapeHtml('') ?> <i class="<?php echo O::escapeHtml('or-image-icon or-image-icon--method-add') ?>"><?php echo O::escapeHtml('') ?> </i> - <span><?php echo O::escapeHtml(''.@O::lang('new').'') ?> + <span><?php echo O::escapeHtml(''.@O::lang('add').'') ?> </span> </a> </td> diff --git a/modules/cms/ui/themes/default/html/views/page/pub.php b/modules/cms/ui/themes/default/html/views/page/pub.php @@ -1,5 +1,5 @@ <?php /* THIS FILE IS GENERATED from pub.tpl.src.xml - DO NOT CHANGE */ defined('APP_STARTED') || die('Forbidden'); use \template_engine\Output as O; ?> - <?php $if2=(O::config('security','nopublish')); if($if2) { ?> + <?php $if2=(O::config(['security','nopublish'])); if($if2) { ?> <div class="<?php echo O::escapeHtml('or-message warn') ?>"><?php echo O::escapeHtml('') ?> <span class="<?php echo O::escapeHtml('or-help') ?>"><?php echo O::escapeHtml(''.@O::lang('NOPUBLISH_DESC').'') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/pageelement/pub.php b/modules/cms/ui/themes/default/html/views/pageelement/pub.php @@ -1,5 +1,5 @@ <?php /* THIS FILE IS GENERATED from pub.tpl.src.xml - DO NOT CHANGE */ defined('APP_STARTED') || die('Forbidden'); use \template_engine\Output as O; ?> - <?php $if2=(O::config('security','nopublish')); if($if2) { ?> + <?php $if2=(O::config(['security','nopublish'])); if($if2) { ?> <div class="<?php echo O::escapeHtml('or-message warn') ?>"><?php echo O::escapeHtml('') ?> <span class="<?php echo O::escapeHtml('or-help') ?>"><?php echo O::escapeHtml(''.@O::lang('NOPUBLISH_DESC').'') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/pageelement/value.php b/modules/cms/ui/themes/default/html/views/pageelement/value.php @@ -109,73 +109,73 @@ <div class="<?php echo O::escapeHtml('or-table-area') ?>"><?php echo O::escapeHtml('') ?> <table width="<?php echo O::escapeHtml('100%') ?>"><?php echo O::escapeHtml('') ?> <td><?php echo O::escapeHtml('') ?> - <span><?php echo O::escapeHtml(''.O::config('editor','text-markup','strong-begin').'') ?> + <span><?php echo O::escapeHtml(''.O::config(['editor','text-markup','strong-begin']).'') ?> </span> <span><?php echo O::escapeHtml(''.@O::lang('text_markup_strong').'') ?> </span> - <span><?php echo O::escapeHtml(''.O::config('editor','text-markup','strong-end').'') ?> + <span><?php echo O::escapeHtml(''.O::config(['editor','text-markup','strong-end']).'') ?> </span> <br /><?php echo O::escapeHtml('') ?> - <span><?php echo O::escapeHtml(''.O::config('editor','text-markup','emphatic-begin').'') ?> + <span><?php echo O::escapeHtml(''.O::config(['editor','text-markup','emphatic-begin']).'') ?> </span> <span><?php echo O::escapeHtml(''.@O::lang('text_markup_emphatic').'') ?> </span> - <span><?php echo O::escapeHtml(''.O::config('editor','text-markup','emphatic-end').'') ?> + <span><?php echo O::escapeHtml(''.O::config(['editor','text-markup','emphatic-end']).'') ?> </span> </td> <td><?php echo O::escapeHtml('') ?> - <span><?php echo O::escapeHtml(''.O::config('editor','text-markup','list-numbered').'') ?> + <span><?php echo O::escapeHtml(''.O::config(['editor','text-markup','list-numbered']).'') ?> </span> <span><?php echo O::escapeHtml(''.@O::lang('text_markup_numbered_list').'') ?> </span> <br /><?php echo O::escapeHtml('') ?> - <span><?php echo O::escapeHtml(''.O::config('editor','text-markup','list-numbered').'') ?> + <span><?php echo O::escapeHtml(''.O::config(['editor','text-markup','list-numbered']).'') ?> </span> <span><?php echo O::escapeHtml('...') ?> </span> <br /><?php echo O::escapeHtml('') ?> </td> <td><?php echo O::escapeHtml('') ?> - <span><?php echo O::escapeHtml(''.O::config('editor','text-markup','list-unnumbered').'') ?> + <span><?php echo O::escapeHtml(''.O::config(['editor','text-markup','list-unnumbered']).'') ?> </span> <span><?php echo O::escapeHtml(''.@O::lang('text_markup_unnumbered_list').'') ?> </span> <br /><?php echo O::escapeHtml('') ?> - <span><?php echo O::escapeHtml(''.O::config('editor','text-markup','list-unnumbered').'') ?> + <span><?php echo O::escapeHtml(''.O::config(['editor','text-markup','list-unnumbered']).'') ?> </span> <span><?php echo O::escapeHtml('...') ?> </span> <br /><?php echo O::escapeHtml('') ?> </td> <td><?php echo O::escapeHtml('') ?> - <span><?php echo O::escapeHtml(''.O::config('editor','text-markup','table-cell-sep').'') ?> + <span><?php echo O::escapeHtml(''.O::config(['editor','text-markup','table-cell-sep']).'') ?> </span> <span><?php echo O::escapeHtml(''.@O::lang('text_markup_table').'') ?> </span> - <span><?php echo O::escapeHtml(''.O::config('editor','text-markup','table-cell-sep').'') ?> + <span><?php echo O::escapeHtml(''.O::config(['editor','text-markup','table-cell-sep']).'') ?> </span> <span><?php echo O::escapeHtml('...') ?> </span> - <span><?php echo O::escapeHtml(''.O::config('editor','text-markup','table-cell-sep').'') ?> + <span><?php echo O::escapeHtml(''.O::config(['editor','text-markup','table-cell-sep']).'') ?> </span> <span><?php echo O::escapeHtml('...') ?> </span> - <span><?php echo O::escapeHtml(''.O::config('editor','text-markup','table-cell-sep').'') ?> + <span><?php echo O::escapeHtml(''.O::config(['editor','text-markup','table-cell-sep']).'') ?> </span> <br /><?php echo O::escapeHtml('') ?> - <span><?php echo O::escapeHtml(''.O::config('editor','text-markup','table-cell-sep').'') ?> + <span><?php echo O::escapeHtml(''.O::config(['editor','text-markup','table-cell-sep']).'') ?> </span> <span><?php echo O::escapeHtml('...') ?> </span> - <span><?php echo O::escapeHtml(''.O::config('editor','text-markup','table-cell-sep').'') ?> + <span><?php echo O::escapeHtml(''.O::config(['editor','text-markup','table-cell-sep']).'') ?> </span> <span><?php echo O::escapeHtml('...') ?> </span> - <span><?php echo O::escapeHtml(''.O::config('editor','text-markup','table-cell-sep').'') ?> + <span><?php echo O::escapeHtml(''.O::config(['editor','text-markup','table-cell-sep']).'') ?> </span> <span><?php echo O::escapeHtml('...') ?> </span> - <span><?php echo O::escapeHtml(''.O::config('editor','text-markup','table-cell-sep').'') ?> + <span><?php echo O::escapeHtml(''.O::config(['editor','text-markup','table-cell-sep']).'') ?> </span> <br /><?php echo O::escapeHtml('') ?> </td> diff --git a/modules/cms/ui/themes/default/html/views/profile/pw.php b/modules/cms/ui/themes/default/html/views/profile/pw.php @@ -40,8 +40,8 @@ <h3 class="<?php echo O::escapeHtml('or-fieldset-label') ?>"><?php echo O::escapeHtml(''.@O::lang('user_new_password').'') ?> </h3> <div class="<?php echo O::escapeHtml('or-fieldset-value') ?>"><?php echo O::escapeHtml('') ?> - <input type="<?php echo O::escapeHtml('password') ?>" name="<?php echo O::escapeHtml('password1') ?>" size="<?php echo O::escapeHtml('40') ?>" maxlength="<?php echo O::escapeHtml('256') ?>" required="<?php echo O::escapeHtml('required') ?>" placeholder="<?php echo O::escapeHtml(''.@O::lang('USER_NEW_PASSWORD').'') ?>" minlength="<?php echo O::escapeHtml(''.O::config('security','password','min_length').'') ?>" value="<?php echo O::escapeHtml(''.@$password1.'') ?>" class="<?php echo O::escapeHtml('or- or-input') ?>" /><?php echo O::escapeHtml('') ?> - <input type="<?php echo O::escapeHtml('password') ?>" name="<?php echo O::escapeHtml('password2') ?>" size="<?php echo O::escapeHtml('40') ?>" maxlength="<?php echo O::escapeHtml('256') ?>" required="<?php echo O::escapeHtml('required') ?>" placeholder="<?php echo O::escapeHtml(''.@O::lang('USER_NEW_PASSWORD_REPEAT').'') ?>" minlength="<?php echo O::escapeHtml(''.O::config('security','password','min_length').'') ?>" value="<?php echo O::escapeHtml(''.@$password2.'') ?>" class="<?php echo O::escapeHtml('or- or-input') ?>" /><?php echo O::escapeHtml('') ?> + <input type="<?php echo O::escapeHtml('password') ?>" name="<?php echo O::escapeHtml('password1') ?>" size="<?php echo O::escapeHtml('40') ?>" maxlength="<?php echo O::escapeHtml('256') ?>" required="<?php echo O::escapeHtml('required') ?>" placeholder="<?php echo O::escapeHtml(''.@O::lang('USER_NEW_PASSWORD').'') ?>" minlength="<?php echo O::escapeHtml(''.O::config(['security','password','min_length']).'') ?>" value="<?php echo O::escapeHtml(''.@$password1.'') ?>" class="<?php echo O::escapeHtml('or- or-input') ?>" /><?php echo O::escapeHtml('') ?> + <input type="<?php echo O::escapeHtml('password') ?>" name="<?php echo O::escapeHtml('password2') ?>" size="<?php echo O::escapeHtml('40') ?>" maxlength="<?php echo O::escapeHtml('256') ?>" required="<?php echo O::escapeHtml('required') ?>" placeholder="<?php echo O::escapeHtml(''.@O::lang('USER_NEW_PASSWORD_REPEAT').'') ?>" minlength="<?php echo O::escapeHtml(''.O::config(['security','password','min_length']).'') ?>" value="<?php echo O::escapeHtml(''.@$password2.'') ?>" class="<?php echo O::escapeHtml('or- or-input') ?>" /><?php echo O::escapeHtml('') ?> </div> </section> </div> diff --git a/modules/cms/ui/themes/default/html/views/project/prop.php b/modules/cms/ui/themes/default/html/views/project/prop.php @@ -46,7 +46,7 @@ <input name="<?php echo O::escapeHtml('target_dir') ?>" type="<?php echo O::escapeHtml('text') ?>" maxlength="<?php echo O::escapeHtml('255') ?>" value="<?php echo O::escapeHtml(''.@$target_dir.'') ?>" class="<?php echo O::escapeHtml('or-filename or-input') ?>" /><?php echo O::escapeHtml('') ?> </div> </section> - <?php $if4=(O::config('publish','project','override_system_command')); if($if4) { ?> + <?php $if4=(O::config(['publish','project','override_system_command'])); if($if4) { ?> <section class="<?php echo O::escapeHtml('or-fieldset') ?>"><?php echo O::escapeHtml('') ?> <h3 class="<?php echo O::escapeHtml('or-fieldset-label') ?>"><?php echo O::escapeHtml(''.@O::lang('PROJECT_CMD_AFTER_PUBLISH').'') ?> </h3> diff --git a/modules/cms/ui/themes/default/html/views/projectlist/edit.php b/modules/cms/ui/themes/default/html/views/projectlist/edit.php @@ -25,10 +25,10 @@ <?php } ?> <tr class="<?php echo O::escapeHtml('or-data') ?>"><?php echo O::escapeHtml('') ?> <td class="<?php echo O::escapeHtml('or-act-clickable') ?>"><?php echo O::escapeHtml('') ?> - <a target="<?php echo O::escapeHtml('_self') ?>" date-name="<?php echo O::escapeHtml(''.@O::lang('new').'') ?>" name="<?php echo O::escapeHtml(''.@O::lang('new').'') ?>" data-type="<?php echo O::escapeHtml('dialog') ?>" data-action="<?php echo O::escapeHtml('') ?>" data-method="<?php echo O::escapeHtml('add') ?>" data-id="<?php echo O::escapeHtml('') ?>" data-extra-dialogAction="<?php echo O::escapeHtml('') ?>" data-extra-dialogMethod="<?php echo O::escapeHtml('add') ?>" data-extra="<?php echo O::escapeHtml('{\'dialogAction\':null,\'dialogMethod\':\'add\'}') ?>" href="<?php echo O::escapeHtml('') ?>" class="<?php echo O::escapeHtml('or-link') ?>"><?php echo O::escapeHtml('') ?> + <a target="<?php echo O::escapeHtml('_self') ?>" date-name="<?php echo O::escapeHtml(''.@O::lang('add').'') ?>" name="<?php echo O::escapeHtml(''.@O::lang('add').'') ?>" data-type="<?php echo O::escapeHtml('dialog') ?>" data-action="<?php echo O::escapeHtml('') ?>" data-method="<?php echo O::escapeHtml('add') ?>" data-id="<?php echo O::escapeHtml('') ?>" data-extra-dialogAction="<?php echo O::escapeHtml('') ?>" data-extra-dialogMethod="<?php echo O::escapeHtml('add') ?>" data-extra="<?php echo O::escapeHtml('{\'dialogAction\':null,\'dialogMethod\':\'add\'}') ?>" href="<?php echo O::escapeHtml('') ?>" class="<?php echo O::escapeHtml('or-link') ?>"><?php echo O::escapeHtml('') ?> <i class="<?php echo O::escapeHtml('or-image-icon or-image-icon--method-add') ?>"><?php echo O::escapeHtml('') ?> </i> - <span><?php echo O::escapeHtml(''.@O::lang('new').'') ?> + <span><?php echo O::escapeHtml(''.@O::lang('add').'') ?> </span> </a> </td> diff --git a/modules/cms/ui/themes/default/html/views/search/edit.php b/modules/cms/ui/themes/default/html/views/search/edit.php @@ -35,31 +35,31 @@ <br /><?php echo O::escapeHtml('') ?> </div> <div class="<?php echo O::escapeHtml('or-value') ?>"><?php echo O::escapeHtml('') ?> - <input type="<?php echo O::escapeHtml('checkbox') ?>" name="<?php echo O::escapeHtml('id') ?>" value="<?php echo O::escapeHtml('1') ?>" <?php if(O::config('search','quicksearch','flag','id')){ ?>checked="<?php echo O::escapeHtml('checked') ?>"<?php } ?> class="<?php echo O::escapeHtml('or-form-checkbox') ?>" /><?php echo O::escapeHtml('') ?> + <input type="<?php echo O::escapeHtml('checkbox') ?>" name="<?php echo O::escapeHtml('id') ?>" value="<?php echo O::escapeHtml('1') ?>" <?php if(O::config(['search','quicksearch','flag','id'])){ ?>checked="<?php echo O::escapeHtml('checked') ?>"<?php } ?> class="<?php echo O::escapeHtml('or-form-checkbox') ?>" /><?php echo O::escapeHtml('') ?> <label class="<?php echo O::escapeHtml('or-label') ?>"><?php echo O::escapeHtml('') ?> <span><?php echo O::escapeHtml(''.@O::lang('id').'') ?> </span> </label> <br /><?php echo O::escapeHtml('') ?> - <input type="<?php echo O::escapeHtml('checkbox') ?>" name="<?php echo O::escapeHtml('name') ?>" value="<?php echo O::escapeHtml('1') ?>" <?php if(O::config('search','quicksearch','flag','name')){ ?>checked="<?php echo O::escapeHtml('checked') ?>"<?php } ?> class="<?php echo O::escapeHtml('or-form-checkbox') ?>" /><?php echo O::escapeHtml('') ?> + <input type="<?php echo O::escapeHtml('checkbox') ?>" name="<?php echo O::escapeHtml('name') ?>" value="<?php echo O::escapeHtml('1') ?>" <?php if(O::config(['search','quicksearch','flag','name'])){ ?>checked="<?php echo O::escapeHtml('checked') ?>"<?php } ?> class="<?php echo O::escapeHtml('or-form-checkbox') ?>" /><?php echo O::escapeHtml('') ?> <label class="<?php echo O::escapeHtml('or-label') ?>"><?php echo O::escapeHtml('') ?> <span><?php echo O::escapeHtml(''.@O::lang('name').'') ?> </span> </label> <br /><?php echo O::escapeHtml('') ?> - <input type="<?php echo O::escapeHtml('checkbox') ?>" name="<?php echo O::escapeHtml('filename') ?>" value="<?php echo O::escapeHtml('1') ?>" <?php if(O::config('search','quicksearch','flag','filename')){ ?>checked="<?php echo O::escapeHtml('checked') ?>"<?php } ?> class="<?php echo O::escapeHtml('or-form-checkbox') ?>" /><?php echo O::escapeHtml('') ?> + <input type="<?php echo O::escapeHtml('checkbox') ?>" name="<?php echo O::escapeHtml('filename') ?>" value="<?php echo O::escapeHtml('1') ?>" <?php if(O::config(['search','quicksearch','flag','filename'])){ ?>checked="<?php echo O::escapeHtml('checked') ?>"<?php } ?> class="<?php echo O::escapeHtml('or-form-checkbox') ?>" /><?php echo O::escapeHtml('') ?> <label class="<?php echo O::escapeHtml('or-label') ?>"><?php echo O::escapeHtml('') ?> <span><?php echo O::escapeHtml(''.@O::lang('filename').'') ?> </span> </label> <br /><?php echo O::escapeHtml('') ?> - <input type="<?php echo O::escapeHtml('checkbox') ?>" name="<?php echo O::escapeHtml('description') ?>" value="<?php echo O::escapeHtml('1') ?>" <?php if(O::config('search','quicksearch','flag','description')){ ?>checked="<?php echo O::escapeHtml('checked') ?>"<?php } ?> class="<?php echo O::escapeHtml('or-form-checkbox') ?>" /><?php echo O::escapeHtml('') ?> + <input type="<?php echo O::escapeHtml('checkbox') ?>" name="<?php echo O::escapeHtml('description') ?>" value="<?php echo O::escapeHtml('1') ?>" <?php if(O::config(['search','quicksearch','flag','description'])){ ?>checked="<?php echo O::escapeHtml('checked') ?>"<?php } ?> class="<?php echo O::escapeHtml('or-form-checkbox') ?>" /><?php echo O::escapeHtml('') ?> <label class="<?php echo O::escapeHtml('or-label') ?>"><?php echo O::escapeHtml('') ?> <span><?php echo O::escapeHtml(''.@O::lang('description').'') ?> </span> </label> <br /><?php echo O::escapeHtml('') ?> - <input type="<?php echo O::escapeHtml('checkbox') ?>" name="<?php echo O::escapeHtml('content') ?>" value="<?php echo O::escapeHtml('1') ?>" <?php if(O::config('search','quicksearch','flag','content')){ ?>checked="<?php echo O::escapeHtml('checked') ?>"<?php } ?> class="<?php echo O::escapeHtml('or-form-checkbox') ?>" /><?php echo O::escapeHtml('') ?> + <input type="<?php echo O::escapeHtml('checkbox') ?>" name="<?php echo O::escapeHtml('content') ?>" value="<?php echo O::escapeHtml('1') ?>" <?php if(O::config(['search','quicksearch','flag','content'])){ ?>checked="<?php echo O::escapeHtml('checked') ?>"<?php } ?> class="<?php echo O::escapeHtml('or-form-checkbox') ?>" /><?php echo O::escapeHtml('') ?> <label class="<?php echo O::escapeHtml('or-label') ?>"><?php echo O::escapeHtml('') ?> <span><?php echo O::escapeHtml(''.@O::lang('content').'') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/template/pub.php b/modules/cms/ui/themes/default/html/views/template/pub.php @@ -1,5 +1,5 @@ <?php /* THIS FILE IS GENERATED from pub.tpl.src.xml - DO NOT CHANGE */ defined('APP_STARTED') || die('Forbidden'); use \template_engine\Output as O; ?> - <?php $if2=(O::config('security','nopublish')); if($if2) { ?> + <?php $if2=(O::config(['security','nopublish'])); if($if2) { ?> <div class="<?php echo O::escapeHtml('or-message warn') ?>"><?php echo O::escapeHtml('') ?> <span class="<?php echo O::escapeHtml('or-help') ?>"><?php echo O::escapeHtml(''.@O::lang('NOPUBLISH_DESC').'') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/templatelist/show.php b/modules/cms/ui/themes/default/html/views/templatelist/show.php @@ -34,7 +34,7 @@ <a target="<?php echo O::escapeHtml('_self') ?>" data-type="<?php echo O::escapeHtml('dialog') ?>" data-action="<?php echo O::escapeHtml('') ?>" data-method="<?php echo O::escapeHtml('add') ?>" data-id="<?php echo O::escapeHtml('') ?>" data-extra-dialogAction="<?php echo O::escapeHtml('') ?>" data-extra-dialogMethod="<?php echo O::escapeHtml('add') ?>" data-extra="<?php echo O::escapeHtml('{\'dialogAction\':null,\'dialogMethod\':\'add\'}') ?>" href="<?php echo O::escapeHtml('') ?>" class="<?php echo O::escapeHtml('or-link') ?>"><?php echo O::escapeHtml('') ?> <i class="<?php echo O::escapeHtml('or-image-icon or-image-icon--method-add') ?>"><?php echo O::escapeHtml('') ?> </i> - <span><?php echo O::escapeHtml(''.@O::lang('new').'') ?> + <span><?php echo O::escapeHtml(''.@O::lang('add').'') ?> </span> </a> </td> diff --git a/modules/cms/ui/themes/default/html/views/text/pub.php b/modules/cms/ui/themes/default/html/views/text/pub.php @@ -1,5 +1,5 @@ <?php /* THIS FILE IS GENERATED from pub.tpl.src.xml - DO NOT CHANGE */ defined('APP_STARTED') || die('Forbidden'); use \template_engine\Output as O; ?> - <?php $if2=(O::config('security','nopublish')); if($if2) { ?> + <?php $if2=(O::config(['security','nopublish'])); if($if2) { ?> <div class="<?php echo O::escapeHtml('or-message warn') ?>"><?php echo O::escapeHtml('') ?> <span class="<?php echo O::escapeHtml('or-help') ?>"><?php echo O::escapeHtml(''.@O::lang('NOPUBLISH_DESC').'') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/text/uncompress.php b/modules/cms/ui/themes/default/html/views/text/uncompress.php @@ -34,7 +34,7 @@ <br /><?php echo O::escapeHtml('') ?> <input type="<?php echo O::escapeHtml('radio') ?>" name="<?php echo O::escapeHtml('replace') ?>" value="<?php echo O::escapeHtml('') ?>" <?php if(@$replace=='0'){ ?>checked="<?php echo O::escapeHtml('checked') ?>"<?php } ?> class="<?php echo O::escapeHtml('or-form-radio') ?>" /><?php echo O::escapeHtml('') ?> <label class="<?php echo O::escapeHtml('or-label') ?>"><?php echo O::escapeHtml('') ?> - <span><?php echo O::escapeHtml(''.@O::lang('new').'') ?> + <span><?php echo O::escapeHtml(''.@O::lang('add').'') ?> </span> </label> </div> diff --git a/modules/cms/ui/themes/default/html/views/title/show.php b/modules/cms/ui/themes/default/html/views/title/show.php @@ -58,7 +58,7 @@ </i> <span><?php echo O::escapeHtml(''.@O::lang('menu_new').'') ?> </span> - <span class="<?php echo O::escapeHtml('or-dropdown-key or-link-keystroke') ?>"><?php echo O::escapeHtml(''.O::config('ui','keybinding','method','add').'') ?> + <span class="<?php echo O::escapeHtml('or-dropdown-key or-link-keystroke') ?>"><?php echo O::escapeHtml(''.O::config(['ui','keybinding','method','add']).'') ?> </span> </a> </div> @@ -174,7 +174,7 @@ </i> <span class="<?php echo O::escapeHtml('or-dropdown-text') ?>"><?php echo O::escapeHtml(''.@O::lang('menu_prop').'') ?> </span> - <span class="<?php echo O::escapeHtml('or-dropdown-key or-link-keystroke') ?>"><?php echo O::escapeHtml(''.O::config('ui','keybinding','method','prop').'') ?> + <span class="<?php echo O::escapeHtml('or-dropdown-key or-link-keystroke') ?>"><?php echo O::escapeHtml(''.O::config(['ui','keybinding','method','prop']).'') ?> </span> </a> </div> @@ -192,7 +192,7 @@ </i> <span class="<?php echo O::escapeHtml('or-dropdown-text') ?>"><?php echo O::escapeHtml(''.@O::lang('menu_pub').'') ?> </span> - <span class="<?php echo O::escapeHtml('or-dropdown-key or-link-keystroke') ?>"><?php echo O::escapeHtml(''.O::config('ui','keybinding','method','pub').'') ?> + <span class="<?php echo O::escapeHtml('or-dropdown-key or-link-keystroke') ?>"><?php echo O::escapeHtml(''.O::config(['ui','keybinding','method','pub']).'') ?> </span> </a> </div> @@ -202,7 +202,7 @@ </i> <span class="<?php echo O::escapeHtml('or-dropdown-text') ?>"><?php echo O::escapeHtml(''.@O::lang('menu_archive').'') ?> </span> - <span class="<?php echo O::escapeHtml('or-dropdown-key or-link-keystroke') ?>"><?php echo O::escapeHtml(''.O::config('ui','keybinding','method','archive').'') ?> + <span class="<?php echo O::escapeHtml('or-dropdown-key or-link-keystroke') ?>"><?php echo O::escapeHtml(''.O::config(['ui','keybinding','method','archive']).'') ?> </span> </a> </div> @@ -212,7 +212,7 @@ </i> <span class="<?php echo O::escapeHtml('or-dropdown-text') ?>"><?php echo O::escapeHtml(''.@O::lang('menu_rights').'') ?> </span> - <span class="<?php echo O::escapeHtml('or-dropdown-key or-link-keystroke') ?>"><?php echo O::escapeHtml(''.O::config('ui','keybinding','method','rights').'') ?> + <span class="<?php echo O::escapeHtml('or-dropdown-key or-link-keystroke') ?>"><?php echo O::escapeHtml(''.O::config(['ui','keybinding','method','rights']).'') ?> </span> </a> </div> @@ -364,7 +364,7 @@ </i> <span class="<?php echo O::escapeHtml('or-dropdown-text') ?>"><?php echo O::escapeHtml(''.@O::lang('menu_profile').'') ?> </span> - <span class="<?php echo O::escapeHtml('or-dropdown-key or-link-keystroke') ?>"><?php echo O::escapeHtml(''.O::config('ui','keybinding','action','profile').'') ?> + <span class="<?php echo O::escapeHtml('or-dropdown-key or-link-keystroke') ?>"><?php echo O::escapeHtml(''.O::config(['ui','keybinding','action','profile']).'') ?> </span> </a> </div> diff --git a/modules/cms/ui/themes/default/html/views/user/info.php b/modules/cms/ui/themes/default/html/views/user/info.php @@ -33,7 +33,7 @@ </span> </div> </section> - <?php $if4=(O::config('security','user','show_admin_mail')); if($if4) { ?> + <?php $if4=(O::config(['security','user','show_admin_mail'])); if($if4) { ?> <section class="<?php echo O::escapeHtml('or-fieldset') ?>"><?php echo O::escapeHtml('') ?> <h3 class="<?php echo O::escapeHtml('or-fieldset-label') ?>"><?php echo O::escapeHtml(''.@O::lang('user_mail').'') ?> </h3> diff --git a/modules/cms/ui/themes/default/html/views/user/prop.php b/modules/cms/ui/themes/default/html/views/user/prop.php @@ -29,7 +29,7 @@ <input name="<?php echo O::escapeHtml('fullname') ?>" type="<?php echo O::escapeHtml('text') ?>" maxlength="<?php echo O::escapeHtml('128') ?>" value="<?php echo O::escapeHtml(''.@$fullname.'') ?>" class="<?php echo O::escapeHtml('or-input') ?>" /><?php echo O::escapeHtml('') ?> </div> </section> - <?php $if4=(O::config('security','user','show_admin_mail')); if($if4) { ?> + <?php $if4=(O::config(['security','user','show_admin_mail'])); if($if4) { ?> <section class="<?php echo O::escapeHtml('or-fieldset') ?>"><?php echo O::escapeHtml('') ?> <h3 class="<?php echo O::escapeHtml('or-fieldset-label') ?>"><?php echo O::escapeHtml(''.@O::lang('user_mail').'') ?> </h3> diff --git a/modules/cms/ui/themes/default/html/views/user/pw.php b/modules/cms/ui/themes/default/html/views/user/pw.php @@ -15,7 +15,7 @@ <input type="<?php echo O::escapeHtml('hidden') ?>" name="<?php echo O::escapeHtml('password_proposal') ?>" value="<?php echo O::escapeHtml(''.@$password_proposal.'') ?>" /><?php echo O::escapeHtml('') ?> </div> </section> - <?php $if3=(O::config('mail','enabled')); if($if3) { ?> + <?php $if3=(O::config(['mail','enabled'])); if($if3) { ?> <section class="<?php echo O::escapeHtml('or-group or-collapsible or-collapsible--is-open or-collapsible--show') ?>"><?php echo O::escapeHtml('') ?> <h2 class="<?php echo O::escapeHtml('or-collapsible-title or-group-title or-collapsible-act-switch') ?>"><?php echo O::escapeHtml(''.@O::lang('options').'') ?> <i class="<?php echo O::escapeHtml('or-image-icon or-image-icon--node-closed or-collapsible--on-closed') ?>"><?php echo O::escapeHtml('') ?> diff --git a/modules/configuration/Config.class.php b/modules/configuration/Config.class.php @@ -129,4 +129,22 @@ class Config } + /** + * Merges another Configuration + * @param $otherConfig Config + */ + public function merge( $otherConfig ) { + $this->config = array_merge( $this->config, $otherConfig->config ); + return $this; + } + + public function isEmpty() + { + return (boolean) $this->config; + } + + public function hasContent() + { + return !$this->isEmpty(); + } } \ No newline at end of file diff --git a/modules/language/LanguageCompiler.class.php b/modules/language/LanguageCompiler.class.php @@ -60,6 +60,11 @@ class LanguageCompiler else throw new LogicException("File is not writable: '$this->keyFile'\n"); + file_put_contents($this->keyFile, ' public static $AVAILABLE_LANGUAGES = ['.implode(',',array_map(function ($language) { + return '\''.$language.'\''; + },$this->getIsoList($lang))).'];'."\n",FILE_APPEND); + + foreach ($lang as $key => $values) file_put_contents($this->keyFile, ' const '.strtoupper($key).' = \''.strtoupper($key).'\';'."\n",FILE_APPEND); @@ -70,26 +75,33 @@ class LanguageCompiler + private function getIsoList( $lang ) + { + $isoList = array(); - /** + foreach ($lang as $key => $values) { + foreach ($values as $isocode => $value) { + if (!in_array($isocode, $isoList)) + $isoList[] = $isocode; + } + + } + + return $isoList; + } + + + + +/** * Creates the production environment. * @param $lang */ private function updateLanguageFiles( $lang ) { // creating a list of all language iso codes. - $isoList = array(); - foreach ($lang as $key => $values) - { - foreach ($values as $isocode => $value) - { - if ( !in_array($isocode, $isoList) ) - $isoList[] = $isocode; - } - - } - foreach ($isoList as $iso) { + foreach ($this->getIsoList($lang) as $iso) { $outputFilename = $this->getOutputLanguageFile($iso); $success = file_put_contents($outputFilename, "<?php ".self::DO_NOT_CHANGE."\n"); diff --git a/modules/language/Language_CN.class.php b/modules/language/Language_CN.class.php @@ -1323,5 +1323,6 @@ Thank you.', 'TEXT'=>'Text', 'APPLY'=>'Apply', 'URL'=>'URL', +'SELF_NAME'=>'中文', ];} } \ No newline at end of file diff --git a/modules/language/Language_DE.class.php b/modules/language/Language_DE.class.php @@ -1328,5 +1328,6 @@ Vielen Dank.', 'TEXT'=>'Text', 'APPLY'=>'Übernehmen', 'URL'=>'Url', +'SELF_NAME'=>'deutsch', ];} } \ No newline at end of file diff --git a/modules/language/Language_EN.class.php b/modules/language/Language_EN.class.php @@ -1323,5 +1323,6 @@ Thank you.', 'TEXT'=>'Text', 'APPLY'=>'Apply', 'URL'=>'URL', +'SELF_NAME'=>'english', ];} } \ No newline at end of file diff --git a/modules/language/Language_ES.class.php b/modules/language/Language_ES.class.php @@ -1348,5 +1348,6 @@ MENU_INDEX_ADMINISTRATION_DESC =', 'TEXT'=>'Text', 'APPLY'=>'Apply', 'URL'=>'URL', +'SELF_NAME'=>'espanol', ];} } \ No newline at end of file diff --git a/modules/language/Language_FR.class.php b/modules/language/Language_FR.class.php @@ -1324,5 +1324,6 @@ Merci.', 'TEXT'=>'Text', 'APPLY'=>'Apply', 'URL'=>'URL', +'SELF_NAME'=>'francais', ];} } \ No newline at end of file diff --git a/modules/language/Language_IT.class.php b/modules/language/Language_IT.class.php @@ -1324,5 +1324,6 @@ Gracias.', 'TEXT'=>'Text', 'APPLY'=>'Apply', 'URL'=>'URL', +'SELF_NAME'=>'italiano', ];} } \ No newline at end of file diff --git a/modules/language/Language_RU.class.php b/modules/language/Language_RU.class.php @@ -1324,5 +1324,6 @@ if you do not know where this mail comes from, please ignore it.', 'TEXT'=>'Text', 'APPLY'=>'Apply', 'URL'=>'URL', +'SELF_NAME'=>'русский', ];} } \ No newline at end of file diff --git a/modules/language/Messages.class.php b/modules/language/Messages.class.php @@ -1,5 +1,6 @@ <?php namespace language; /* DO NOT CHANGE THIS GENERATED FILE */ class Messages { + public static $AVAILABLE_LANGUAGES = ['de','en','es','fr','it','ru','cn']; const ACCESSKEY_MAIN_ADD = 'ACCESSKEY_MAIN_ADD'; const ACCESSKEY_MAIN_ADMINISTRATION = 'ACCESSKEY_MAIN_ADMINISTRATION'; const ACCESSKEY_MAIN_CONTENT = 'ACCESSKEY_MAIN_CONTENT'; @@ -1284,4 +1285,5 @@ class Messages { const TEXT = 'TEXT'; const APPLY = 'APPLY'; const URL = 'URL'; + const SELF_NAME = 'SELF_NAME'; } \ No newline at end of file diff --git a/modules/language/language.yml b/modules/language/language.yml @@ -6427,3 +6427,11 @@ APPLY: URL: en: URL de: Url +SELF_NAME: + en: english + de: deutsch + fr: francais + cn: "中文" + ru: "русский" + es: espanol + it: italiano diff --git a/modules/template_engine/Output.class.php b/modules/template_engine/Output.class.php @@ -31,14 +31,22 @@ class Output /** * Gets a localized message * @param $key message key - * @return mixed|string + * @return string */ public static function lang($key) { return Language::lang($key); } - public static function config($part1 = null, $part2 = null, $part3 = null, $part4 = null) { - return Configuration::config($part1,$part2,$part3,$part4); + /** + * Gets a configuraton value. + * + * Delegating to the Configuration. + * + * @param $keys array + * @return mixed + */ + public static function config( $keys ) { + return Configuration::get( $keys ); } } \ No newline at end of file diff --git a/modules/template_engine/components/html/component_user/component-user.php b/modules/template_engine/components/html/component_user/component-user.php @@ -8,7 +8,7 @@ function component_user( $user ) if ( empty($fullname) ) $fullname = \cms\base\Language::lang('NO_DESCRIPTION_AVAILABLE'); - if ( !empty($mail) && \cms\base\Configuration::config('security','user','show_mail' ) ) + if ( isset($mail) && $mail && \cms\base\Configuration::subset(['security','user'])->is('show_mail',false ) ) echo "<a href=\"mailto:$mail\" title=\"$fullname\">$name</a>"; else echo "<span title=\"$fullname\">$name</span>"; diff --git a/modules/template_engine/element/PHPBlockElement.class.php b/modules/template_engine/element/PHPBlockElement.class.php @@ -65,7 +65,7 @@ class PHPBlockElement extends HtmlElement $res->addResolver('config', function($name) { $config_parts = explode('/', $name); - return TemplateEngine::OUTPUT_ALIAS.'::config(' . "'" . implode("'" . ',' . "'", $config_parts) . "'" . ')'; + return TemplateEngine::OUTPUT_ALIAS.'::config([' . "'" . implode("'" . ',' . "'", $config_parts) . "'" . '])'; }); return $res->resolveVariables( $value ); diff --git a/modules/template_engine/element/Value.class.php b/modules/template_engine/element/Value.class.php @@ -61,7 +61,7 @@ class Value $res->addResolver('config', function($name) { $config_parts = explode('/', $name); - return '\'.'.TemplateEngine::OUTPUT_ALIAS.'::config(' . "'" . implode("'" . ',' . "'", $config_parts) . "'" . ').\''; + return '\'.'.TemplateEngine::OUTPUT_ALIAS.'::config([' . "'" . implode("'" . ',' . "'", $config_parts) . "'" . ']).\''; }); diff --git a/modules/util/cache/FileCache.class.php b/modules/util/cache/FileCache.class.php @@ -49,7 +49,7 @@ class FileCache implements Cache $this->filename = $filename; $this->loader = $loader; - if ( C::config()->subset('publishing')->is('cache_enabled',false) ) + if ( C::subset('publishing')->is('cache_enabled',false) ) $this->invalidateIfOlderThan( $lastModified ); else $this->invalidateIfOlderThan( Startup::getStartTime() ); // Invalidate all before this request.