openrat-cms

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

commit bdc9dbc7b444c72fe83a3641b6a09d46f3138b21
parent 4f94f9de61503f6a9b4d3620c33b7e8894bc92cc
Author: Jan Dankert <develop@jandankert.de>
Date:   Sat, 26 Sep 2020 04:26:55 +0200

Refactoring: read configuration values with a class.

Diffstat:
modules/cms/Dispatcher.class.php | 20++++++++++----------
modules/cms/action/Action.class.php | 10+++++-----
modules/cms/action/ElementAction.class.php | 8++++----
modules/cms/action/FileAction.class.php | 4++--
modules/cms/action/LanguageAction.class.php | 2+-
modules/cms/action/LoginAction.class.php | 26+++++++++++++-------------
modules/cms/action/PageAction.class.php | 4++--
modules/cms/action/ProfileAction.class.php | 21+++++++++++----------
modules/cms/action/StartAction.class.php | 8++++----
modules/cms/action/UserAction.class.php | 6+++---
modules/cms/auth/InternalAuth.class.php | 4++--
modules/cms/auth/OpenIdAuth.class.php | 8++++----
modules/cms/auth/RememberAuth.class.php | 2+-
modules/cms/auth/SSLAuth.class.php | 6+++---
modules/cms/base/Configuration.class.php | 82+++++++++++++++++++++++++++++++++++++------------------------------------------
modules/cms/base/Language.class.php | 8--------
modules/cms/base/Startup.class.php | 7+------
modules/cms/generator/PageGenerator.class.php | 12++++++------
modules/cms/generator/Publisher.class.php | 4++--
modules/cms/generator/ValueGenerator.class.php | 3++-
modules/cms/generator/link/PublicLink.class.php | 12++++++------
modules/cms/generator/target/Ftp.class.php | 2+-
modules/cms/generator/target/Local.class.php | 2+-
modules/cms/model/BaseObject.class.php | 4++--
modules/cms/model/Folder.class.php | 2+-
modules/cms/model/Language.class.php | 2+-
modules/cms/model/User.class.php | 4++--
modules/cms/model/Value.class.php | 4++--
modules/cms/ui/UI.class.php | 2+-
modules/cms/ui/action/IndexAction.class.php | 34+++++++++++++++++-----------------
modules/cms/ui/action/TitleAction.class.php | 4++--
modules/cms/ui/themes/default/html/views/element/advanced.php | 2+-
modules/cms/ui/themes/default/html/views/file/pub.php | 2+-
modules/cms/ui/themes/default/html/views/folder/pub.php | 2+-
modules/cms/ui/themes/default/html/views/image/pub.php | 2+-
modules/cms/ui/themes/default/html/views/login/login.php | 20++++++++++----------
modules/cms/ui/themes/default/html/views/login/openid.php | 6+++---
modules/cms/ui/themes/default/html/views/login/password.php | 2+-
modules/cms/ui/themes/default/html/views/login/register.php | 2+-
modules/cms/ui/themes/default/html/views/page/pub.php | 2+-
modules/cms/ui/themes/default/html/views/pageelement/pub.php | 2+-
modules/cms/ui/themes/default/html/views/pageelement/value.php | 32++++++++++++++++----------------
modules/cms/ui/themes/default/html/views/project/prop.php | 4++--
modules/cms/ui/themes/default/html/views/search/edit.php | 10+++++-----
modules/cms/ui/themes/default/html/views/template/pub.php | 2+-
modules/cms/ui/themes/default/html/views/text/pub.php | 2+-
modules/cms/ui/themes/default/html/views/title/show.php | 12++++++------
modules/cms/ui/themes/default/html/views/user/info.php | 2+-
modules/cms/ui/themes/default/html/views/user/prop.php | 2+-
modules/cms/ui/themes/default/html/views/user/pw.php | 4++--
modules/cms/ui/themes/default/layout/index.php | 4++--
modules/template_engine/Output.class.php | 6++++++
modules/template_engine/components/html/user/component-user.php | 2+-
modules/template_engine/element/PHPBlockElement.class.php | 2+-
modules/template_engine/element/Value.class.php | 2+-
modules/util/GlobalFunctions.class.php | 5+----
modules/util/Html.class.php | 2+-
modules/util/cache/FileCache.class.php | 2+-
modules/util/text/variables/VariableResolver.class.php | 28++++++++++++++++++++++++++++
59 files changed, 248 insertions(+), 234 deletions(-)

diff --git a/modules/cms/Dispatcher.class.php b/modules/cms/Dispatcher.class.php @@ -52,7 +52,7 @@ class Dispatcher global $conf; $conf = Session::getConfig(); - define('PRODUCTION', Conf()->is('production',true)); + define('PRODUCTION', \cms\base\Configuration::Conf()->is('production',true)); define('DEVELOPMENT', !PRODUCTION); if( DEVELOPMENT) @@ -159,7 +159,7 @@ class Dispatcher private function checkPostToken() { global $REQ; - if (config('security', 'use_post_token') && $_SERVER['REQUEST_METHOD'] == 'POST' && @$REQ[REQ_PARAM_TOKEN] != Session::token()) { + if (\cms\base\Configuration::config('security', 'use_post_token') && $_SERVER['REQUEST_METHOD'] == 'POST' && @$REQ[REQ_PARAM_TOKEN] != Session::token()) { Logger::error('Token mismatch: Needed ' . Session::token() . ' but got ' . Logger::sanitizeInput(@$REQ[REQ_PARAM_TOKEN]) . '. Maybe an attacker?'); throw new SecurityException("Token mismatch"); } @@ -171,7 +171,7 @@ class Dispatcher private function initializeLogger() { - $logConfig = config('log'); + $logConfig = \cms\base\Configuration::config('log'); $logFile = $logConfig['file']; @@ -362,7 +362,7 @@ class Dispatcher else { $dbids = array(); - $databases = Conf()->get('database'); + $databases = \cms\base\Configuration::Conf()->get('database'); if ( !is_array($databases)) throw new \RuntimeException('Corrupt configuration: Database configuration must be a list'); @@ -372,13 +372,13 @@ class Dispatcher if ( !is_array($dbconf)) throw new \LogicException("Corrupt configuration: Database configuration '".$key."' must be an array.'"); - $dbconf += config('database-default','defaults'); // Add Default-Values + $dbconf += \cms\base\Configuration::config('database-default','defaults'); // Add Default-Values if ( is_array($dbconf) && $dbconf['enabled'] ) // Database-Connection is enabled $dbids[] = $key; } - $defaultDbId = config('database-default','default-id'); + $defaultDbId = \cms\base\Configuration::config('database-default','default-id'); if ( $defaultDbId && in_array($defaultDbId,$dbids) ) // Default-Datenbankverbindung ist konfiguriert und vorhanden. $dbid = $defaultDbId; @@ -391,7 +391,7 @@ class Dispatcher } - $dbConfig = config()->subset('database'); + $dbConfig = \cms\base\Configuration::config()->subset('database'); if ( ! $dbConfig->has( $dbid ) ) throw new \LogicException( 'unknown DB-Id: '.$dbid ); @@ -431,7 +431,7 @@ class Dispatcher */ private function updateDatabase($dbid) { - $dbConfig = Conf()->subset('database')->subset($dbid); + $dbConfig = \cms\base\Configuration::Conf()->subset('database')->subset($dbid); if ( ! $dbConfig->is('check_version',true)) return; // Check for DB version is disabled. @@ -520,7 +520,7 @@ class Dispatcher */ private function setContentLanguageHeader() { - header('Content-Language: ' . Conf()->subset('language')->get('language_code') ); + header('Content-Language: ' . \cms\base\Configuration::Conf()->subset('language')->get('language_code') ); } @@ -531,7 +531,7 @@ class Dispatcher if ( ! $this->request->isAction ) return; - $auditConfig = config()->subset('audit-log'); + $auditConfig = \cms\base\Configuration::config()->subset('audit-log'); if ( $auditConfig->is('enabled',false)) { diff --git a/modules/cms/action/Action.class.php b/modules/cms/action/Action.class.php @@ -379,7 +379,7 @@ namespace cms\action { return; // Conditional-Get eingeschaltet? - if (!config('cache', 'conditional_get')) + if (!\cms\base\Configuration::config('cache', 'conditional_get')) return; $expires = substr(date('r', time() + $expirationDuration - date('Z')), 0, -5) . 'GMT'; @@ -449,11 +449,11 @@ namespace cms\action { if (empty($value)) $expire = time(); // Cookie wird gelöscht. else - $expire = time() + 60 * 60 * 24 * config('security', 'cookie', 'expire'); + $expire = time() + 60 * 60 * 24 * \cms\base\Configuration::config('security', 'cookie', 'expire'); - $secure = config('security', 'cookie', 'secure'); - $httponly = config('security', 'cookie', 'httponly'); - $samesite = config('security', 'cookie', 'samesite'); + $secure = \cms\base\Configuration::config('security', 'cookie', 'secure'); + $httponly = \cms\base\Configuration::config('security', 'cookie', 'httponly'); + $samesite = \cms\base\Configuration::config('security', 'cookie', 'samesite'); $cookieAttributes = [ rawurlencode($name).'='.rawurlencode($value), diff --git a/modules/cms/action/ElementAction.class.php b/modules/cms/action/ElementAction.class.php @@ -94,7 +94,7 @@ class ElementAction extends BaseAction public function advancedPost() { global $conf; - $ini_date_format = config('date','format'); + $ini_date_format = \cms\base\Configuration::config('date','format'); if ( $this->hasRequestVar('format')) @@ -302,9 +302,9 @@ class ElementAction extends BaseAction case 'dateformat': - //$ini_date_format = config('date','format'); - //$ini_date_format = Conf()->subset('date')->get('format'); - $ini_date_format = config()->subset('date')->get('format'); + //$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'); $dateformat = array(); $this->setTemplateVar('dateformat',''); diff --git a/modules/cms/action/FileAction.class.php b/modules/cms/action/FileAction.class.php @@ -231,8 +231,8 @@ class FileAction extends ObjectAction // Unterscheidung, ob PHP-Code in der Datei ausgefuehrt werden soll. - $phpActive = ( config('publish','enable_php_in_file_content')=='auto' && $this->file->getRealExtension()=='php') || - config('publish','enable_php_in_file_content')===true; + $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; if ( $phpActive ) { diff --git a/modules/cms/action/LanguageAction.class.php b/modules/cms/action/LanguageAction.class.php @@ -103,7 +103,7 @@ class LanguageAction extends BaseAction } else { - $countryList = config()['countries']; + $countryList = \cms\base\Configuration::config()['countries']; $iso = $this->getRequestVar('isocode'); $this->language->name = $countryList[$iso]; $this->language->isoCode = strtolower( $iso ); diff --git a/modules/cms/action/LoginAction.class.php b/modules/cms/action/LoginAction.class.php @@ -272,7 +272,7 @@ class LoginAction extends BaseAction $dbids = array(); - $databases = Conf()->get('database'); + $databases = \cms\base\Configuration::Conf()->get('database'); if ( !is_array($databases)) throw new \LogicException("Corrupt configuration: Databases configuration must be an array."); @@ -382,9 +382,9 @@ class LoginAction extends BaseAction $openid_provider = array(); foreach( explode(',',$conf['security']['openid']['provider']['name']) as $provider ) - $openid_provider[$provider] = config('security','openid','provider.'.$provider.'.name'); + $openid_provider[$provider] = \cms\base\Configuration::config('security','openid','provider.'.$provider.'.name'); $this->setTemplateVar('openid_providers',$openid_provider); - $this->setTemplateVar('openid_user_identity',config('security','openid','user_identity')); + $this->setTemplateVar('openid_user_identity',\cms\base\Configuration::config('security','openid','user_identity')); //$this->setTemplateVar('openid_provider','identity'); @@ -608,7 +608,7 @@ class LoginAction extends BaseAction catch (ObjectNotFoundException $e) { // Gruppe fehlt. Anlegen? - if ( config('ldap','authorize','auto_add' ) ) + if ( \cms\base\Configuration::config('ldap','authorize','auto_add' ) ) { // Die Gruppe in der OpenRat-Datenbank hinzufuegen. $g = new Group(); @@ -820,7 +820,7 @@ class LoginAction extends BaseAction } // Anmeldung erfolgreich. - if ( config()->subset('security')->is('renew_session_login',false) ) + if ( \cms\base\Configuration::config()->subset('security')->is('renew_session_login',false) ) $this->recreateSession(); $this->addNotice('user',$user->name,'LOGIN_OK',OR_NOTICE_OK,array('name'=>$user->fullname)); @@ -848,7 +848,7 @@ class LoginAction extends BaseAction if ( is_object($user) ) $this->setTemplateVar('login_username',$user->name); - if ( config()->subset('security')->is('renew_session_logout',false) ) + if ( \cms\base\Configuration::config()->subset('security')->is('renew_session_logout',false) ) $this->recreateSession(); if ( @$conf['theme']['compiler']['compile_at_logout'] ) @@ -898,7 +898,7 @@ class LoginAction extends BaseAction // Style zurücksetzen. // Der Style des Benutzers koennte auch stehen bleiben. Aber dann gäbe es Rückschlüsse darauf, wer zuletzt angemeldet war (Sicherheit!). - $this->setStyle( config('interface','style','default') ); + $this->setStyle( \cms\base\Configuration::config('interface','style','default') ); $this->addNotice('user',$user->name,'LOGOUT_OK',OR_NOTICE_OK); @@ -1260,9 +1260,9 @@ class LoginAction extends BaseAction function passwordView() { // TODO: Attribut "Password" abfragen - foreach( config('database') as $dbname=>$dbconf ) + foreach( \cms\base\Configuration::config('database') as $dbname=>$dbconf ) { - $dbconf = $dbconf + config('database-default','defaults'); + $dbconf = $dbconf + \cms\base\Configuration::config('database-default','defaults'); if ( $dbconf['enabled'] ) $dbids[$dbname] = $dbconf['description']; } @@ -1275,7 +1275,7 @@ class LoginAction extends BaseAction if ( is_object($db) ) $this->setTemplateVar('actdbid',$db->id); else - $this->setTemplateVar('actdbid',config('database-default','default-id')); + $this->setTemplateVar('actdbid',\cms\base\Configuration::config('database-default','default-id')); } @@ -1420,9 +1420,9 @@ class LoginAction extends BaseAction $this->setTemplateVar('machine' ,php_uname('m') ); $this->setTemplateVar('version' , phpversion() ); - $this->setTemplateVar('cms_name' , Conf()->subset('application')->get('name' ) ); - $this->setTemplateVar('cms_version' , Conf()->subset('application')->get('version' ) ); - $this->setTemplateVar('cms_operator', Conf()->subset('application')->get('operator') ); + $this->setTemplateVar('cms_name' , \cms\base\Configuration::Conf()->subset('application')->get('name' ) ); + $this->setTemplateVar('cms_version' , \cms\base\Configuration::Conf()->subset('application')->get('version' ) ); + $this->setTemplateVar('cms_operator', \cms\base\Configuration::Conf()->subset('application')->get('operator') ); $user = Session::getUser(); if ( !empty($user) ) diff --git a/modules/cms/action/PageAction.class.php b/modules/cms/action/PageAction.class.php @@ -681,8 +681,8 @@ class PageAction extends ObjectAction $templateModel->load(); // Executing PHP in Pages. - if ( ( config('publish','enable_php_in_page_content')=='auto' && $templateModel->extension == 'php') || - config('publish','enable_php_in_page_content')===true ) + 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 ) { ob_start(); require( $generator->getCache()->load()->getFilename() ); diff --git a/modules/cms/action/ProfileAction.class.php b/modules/cms/action/ProfileAction.class.php @@ -19,6 +19,7 @@ namespace cms\action; // You should have received a copy of the GNU General Public License // 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\model\BaseObject; use cms\model\User; use language\Language; @@ -210,9 +211,9 @@ class ProfileAction extends BaseAction { $this->addValidationError('password2','PASSWORDS_DO_NOT_MATCH'); } - elseif ( strlen($this->getRequestVar('password1'))<intval(config('security','password','min_length')) ) + elseif ( strlen($this->getRequestVar('password1'))<intval(\cms\base\Configuration::config('security','password','min_length')) ) { - $this->addValidationError('password1','PASSWORD_MINLENGTH',array('minlength'=>config('security','password','min_length'))); + $this->addValidationError('password1','PASSWORD_MINLENGTH',array('minlength'=>\cms\base\Configuration::config('security','password','min_length'))); } else { @@ -228,7 +229,7 @@ class ProfileAction extends BaseAction */ function editView() { - $issuer = urlencode(config('application','operator')); + $issuer = urlencode(\cms\base\Configuration::config('application','operator')); $account = $this->user->name.'@'.$_SERVER['SERVER_NAME']; $base32 = new Base2n(5, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567', FALSE, TRUE, TRUE); @@ -241,7 +242,7 @@ class ProfileAction extends BaseAction $this->setTemplateVar('timezone_list',timezone_identifiers_list() ); - $languages = explode(',',config('i18n','available')); + $languages = explode(',',\cms\base\Configuration::config('i18n','available')); foreach($languages as $id=>$name) { unset($languages[$id]); @@ -319,8 +320,8 @@ class ProfileAction extends BaseAction $this->setTemplateVar('style',$currentStyle); - $styleConfig = config('style-default'); // default style config - $userStyleConfig = config('style', $currentStyle); // user style config + $styleConfig = \cms\base\Configuration::config('style-default'); // default style config + $userStyleConfig = \cms\base\Configuration::config('style', $currentStyle); // user style config if (is_array($userStyleConfig)) $styleConfig = array_merge($styleConfig, $userStyleConfig ); // Merging user style into default style @@ -337,7 +338,7 @@ class ProfileAction extends BaseAction */ public function uisettingsView() { - $this->setTemplateVar('settings',Config()->get('ui') ); + $this->setTemplateVar('settings',Configuration::Conf()->get('ui') ); } @@ -346,7 +347,7 @@ class ProfileAction extends BaseAction */ public function languageView() { - $this->setTemplateVar('language',Config()->get('language') ); + $this->setTemplateVar('language',Configuration::Conf()->get('language') ); } @@ -365,10 +366,10 @@ class ProfileAction extends BaseAction private function getUserStyle( $user ) { // Theme für den angemeldeten Benuter ermitteln - if ( $user && isset(config('style')[$user->style])) + if ( $user && isset(\cms\base\Configuration::config('style')[$user->style])) $style = $user->style; else - $style = config('interface', 'style', 'default'); + $style = \cms\base\Configuration::config('interface', 'style', 'default'); return $style; } diff --git a/modules/cms/action/StartAction.class.php b/modules/cms/action/StartAction.class.php @@ -311,9 +311,9 @@ class StartAction extends BaseAction $openid_provider = array(); foreach( explode(',',$conf['security']['openid']['provider']) as $provider ) - $openid_provider[$provider] = config('security','openid','provider.'.$provider.'.name'); + $openid_provider[$provider] = \cms\base\Configuration::config('security','openid','provider.'.$provider.'.name'); $this->setTemplateVar('openid_providers',$openid_provider); - $this->setTemplateVar('openid_user_identity',config('security','openid','user_identity')); + $this->setTemplateVar('openid_user_identity',\cms\base\Configuration::config('security','openid','user_identity')); //$this->setTemplateVar('openid_provider','identity'); @@ -633,7 +633,7 @@ class StartAction extends BaseAction Logger::debug("Login successful for user '$loginName'"); // Anmeldung erfolgreich. - if ( config('security','renew_session_login') ) + if ( \cms\base\Configuration::config('security','renew_session_login') ) $this->recreateSession(); $user = Session::getUser(); @@ -655,7 +655,7 @@ class StartAction extends BaseAction if ( is_object($user) ) $this->setTemplateVar('login_username',$user->name); - if ( config('security','renew_session_logout') ) + if ( \cms\base\Configuration::config('security','renew_session_logout') ) $this->recreateSession(); session_unset(); diff --git a/modules/cms/action/UserAction.class.php b/modules/cms/action/UserAction.class.php @@ -234,7 +234,7 @@ class UserAction extends BaseAction { global $conf; - $issuer = urlencode(config('application','operator')); + $issuer = urlencode(\cms\base\Configuration::config('application','operator')); $account = $this->user->name.'@'.$_SERVER['SERVER_NAME']; $base32 = new Base2n(5, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567', FALSE, TRUE, TRUE); @@ -274,7 +274,7 @@ class UserAction extends BaseAction { $this->setTemplateVars( $this->user->getProperties() ); - $gravatarConfig = config('interface','gravatar'); + $gravatarConfig = \cms\base\Configuration::config('interface','gravatar'); $this->setTemplateVar( 'image', 'about:blank' ); if ( is_array($gravatarConfig) ) @@ -298,7 +298,7 @@ class UserAction extends BaseAction - $issuer = urlencode(config('application','operator')); + $issuer = urlencode(\cms\base\Configuration::config('application','operator')); $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 @@ -48,7 +48,7 @@ SQL // Behandeln von Klartext-Kennwoertern (Igittigitt). if ($row_user['password_algo'] == Password::ALGO_PLAIN) { - if (config('security', 'password', 'force_change_if_cleartext')) + if (\cms\base\Configuration::config('security', 'password', 'force_change_if_cleartext')) // Kennwort steht in der Datenbank im Klartext. // Das Kennwort muss geaendert werden return OR_AUTH_STATUS_PW_EXPIRED; @@ -62,7 +62,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'] + (config('security', 'deny_after_expiration_duration') * 60 * 60) < time()) + if ($row_user['password_expires'] + (\cms\base\Configuration::config('security', 'deny_after_expiration_duration') * 60 * 60) < time()) return false; // Abgelaufenes Kennwort wird nicht mehr akzeptiert. else return OR_AUTH_STATUS_PW_EXPIRED; // Kennwort ist abgelaufen, kann aber noch geändert werden. diff --git a/modules/cms/auth/OpenIdAuth.class.php b/modules/cms/auth/OpenIdAuth.class.php @@ -139,11 +139,11 @@ class OpenIdAuth implements Auth function login2() { if ($this->provider != 'identity') { - $this->user = config('security', 'openid', 'provider.' . $this->provider . '.xrds_uri'); + $this->user = \cms\base\Configuration::config('security', 'openid', 'provider.' . $this->provider . '.xrds_uri'); $this->identity = 'http://specs.openid.net/auth/2.0/identifier_select'; } - $this->supportSREG = config('security', 'openid', 'provider.' . $this->provider . '.sreg_1_0'); - $this->supportAX = config('security', 'openid', 'provider.' . $this->provider . '.ax_1_0'); + $this->supportSREG = \cms\base\Configuration::config('security', 'openid', 'provider.' . $this->provider . '.sreg_1_0'); + $this->supportAX = \cms\base\Configuration::config('security', 'openid', 'provider.' . $this->provider . '.ax_1_0'); // Schritt 1: Identity aus Yadis-Dokument laden. $this->getIdentityFromYadis(); @@ -335,7 +335,7 @@ class OpenIdAuth implements Auth $http = new Http($this->identity); return $http->url['host']; } else { - $attribute_name = config('security', 'openid', 'provider.' . $this->provider . '.map_attribute'); + $attribute_name = \cms\base\Configuration::config('security', 'openid', 'provider.' . $this->provider . '.map_attribute'); return $this->info[$attribute_name]; } } diff --git a/modules/cms/auth/RememberAuth.class.php b/modules/cms/auth/RememberAuth.class.php @@ -27,7 +27,7 @@ class RememberAuth implements Auth list($selector, $token) = array_pad(explode('.', $_COOKIE['or_token']), 2, ''); $dbid = $_COOKIE['or_dbid']; - $dbConfig = config()->subset('database'); + $dbConfig = \cms\base\Configuration::config()->subset('database'); if (!$dbConfig->has($dbid)) { diff --git a/modules/cms/auth/SSLAuth.class.php b/modules/cms/auth/SSLAuth.class.php @@ -13,9 +13,9 @@ class SSLAuth implements Auth { public function username() { - $conf = config('security', 'ssl'); - if (isset($_SERVER[config('security', 'ssl', 'client_cert_dn_env')])) - return $_SERVER[config('security', 'ssl', 'client_cert_dn_env')]; + $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')]; } diff --git a/modules/cms/base/Configuration.class.php b/modules/cms/base/Configuration.class.php @@ -1,63 +1,57 @@ <?php - - +namespace cms\base; use configuration\Config; class Configuration { - public static function registerFunctions() + /* + * 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) { + global $conf; + if ($part1 == null) + return new Config($conf); - /* - * Liest einen Schluessel aus der Konfiguration - * - * @return String, leer falls Schluessel nicht vorhanden - */ - function config($part1 = null, $part2 = null, $part3 = null, $part4 = null) - { - global $conf; - - if ($part1 == null) - return new configuration\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]; + 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 ''; - /** - * @return Config - */ - function Conf() - { + 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 ''; + } - global $conf; - return new Config($conf); - } + /** + * @return Config + */ + public static function Conf() + { + + global $conf; + return new Config($conf); } + } diff --git a/modules/cms/base/Language.class.php b/modules/cms/base/Language.class.php @@ -23,14 +23,6 @@ use util\text\variables\VariableResolver; class Language { - public static function registerFunctions() - { - - - - } - - /** * Diese Funktion stellt ein Wort in der eingestellten * Sprache zur Verfuegung. diff --git a/modules/cms/base/Startup.class.php b/modules/cms/base/Startup.class.php @@ -35,11 +35,6 @@ class Startup { self::setErrorHandler(); self::setConstants(); self::createRequest(); - - //require __DIR__.'/Language.class.php'; - require __DIR__.'/Configuration.class.php'; - Language::registerFunctions(); - \Configuration::registerFunctions(); } public static function checkPHPVersion() @@ -158,7 +153,7 @@ class Startup { public static function readonly() { // Gesamtes CMS ist readonly. - if (config('security', 'readonly')) + if (\cms\base\Configuration::config('security', 'readonly')) return true; // Aktuelle Datenbankverbindung ist readonly. diff --git a/modules/cms/generator/PageGenerator.class.php b/modules/cms/generator/PageGenerator.class.php @@ -173,7 +173,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 ( config('publish','escape_8bit_characters') ) + if ( \cms\base\Configuration::config('publish','escape_8bit_characters') ) if ( substr($this->mimeType(),-4) == 'html' ) { /* @@ -212,14 +212,14 @@ class PageGenerator extends BaseGenerator $project = $page->getProject(); $project->load(); - $format = config('publish','format'); + $format = \cms\base\Configuration::config('publish','format'); $format = str_replace('{filename}',$page->filename,$format ); $allLanguages = $project->getLanguageIds(); $allModels = $project->getModelIds(); - $withLanguage = count($allLanguages) > 1 || config('publish','filename_language') == 'always'; - $withModel = count($allModels ) > 1 || config('publish','filename_type' ) == 'always'; + $withLanguage = count($allLanguages) > 1 || \cms\base\Configuration::config('publish','filename_language') == 'always'; + $withModel = count($allModels ) > 1 || \cms\base\Configuration::config('publish','filename_type' ) == 'always'; $languagePart = ''; $typePart = ''; @@ -238,8 +238,8 @@ class PageGenerator extends BaseGenerator $typePart = $templateModel->extension; } - $languageSep = $languagePart?config('publish','language_sep') :''; - $typeSep = $typePart ?config('publish','type_sep' ) :''; + $languageSep = $languagePart?\cms\base\Configuration::config('publish','language_sep') :''; + $typeSep = $typePart ?\cms\base\Configuration::config('publish','type_sep' ) :''; $format = str_replace('{language}' ,$languagePart ,$format ); $format = str_replace('{language_sep}',$languageSep ,$format ); diff --git a/modules/cms/generator/Publisher.class.php b/modules/cms/generator/Publisher.class.php @@ -113,9 +113,9 @@ class Publisher */ public function init() { - $confPublish = config('publish'); + $confPublish = \cms\base\Configuration::config('publish'); - if ( config('security','nopublish') ) + if ( \cms\base\Configuration::config('security','nopublish') ) { $this->target = new NoBaseTarget(); Logger::warn('publishing is disabled.'); diff --git a/modules/cms/generator/ValueGenerator.class.php b/modules/cms/generator/ValueGenerator.class.php @@ -4,6 +4,7 @@ namespace cms\generator; +use cms\base\Configuration as C; use cms\base\DB; use cms\macros\MacroRunner; use cms\model\BaseObject; @@ -639,7 +640,7 @@ class ValueGenerator extends BaseGenerator case Element::ELEMENT_FORMAT_MARKDOWN: - $mdConfig = Config()->subset('editor')->subset('markdown'); + $mdConfig = C::Conf()->subset('editor')->subset('markdown'); $parser = new \util\Parsedown(); $parser->setUrlsLinked( $mdConfig->is('urls-linked',true)); diff --git a/modules/cms/generator/link/PublicLink.class.php b/modules/cms/generator/link/PublicLink.class.php @@ -97,7 +97,7 @@ class PublicLink implements LinkFormat case BaseObject::TYPEID_PAGE: - if ($fromProject->cut_index && $to->filename == config('publish', 'default')) { + if ($fromProject->cut_index && $to->filename == \cms\base\Configuration::config('publish', 'default')) { $filename = ''; // Link auf Index-Datei, der Dateiname bleibt leer. } else { @@ -107,7 +107,7 @@ class PublicLink implements LinkFormat $parentFolder = new Folder($page->parentid); $parentFolder->load(); - $format = config('publish', 'format'); + $format = \cms\base\Configuration::config('publish', 'format'); $format = str_replace('{filename}', $page->filename(), $format); $allLanguages = $fromProject->getLanguageIds(); @@ -116,12 +116,12 @@ class PublicLink implements LinkFormat $withLanguage = !$fromProject->content_negotiation && $fromProject->publishPageExtension && - (count($allLanguages) > 1 || config('publish', 'filename_language') == 'always'); + (count($allLanguages) > 1 || \cms\base\Configuration::config('publish', 'filename_language') == 'always'); $withModel = ! $fromProject->content_negotiation && ! $fromProject->publishPageExtension && - (count($allModels) > 1 || config('publish', 'filename_type') == 'always'); + (count($allModels) > 1 || \cms\base\Configuration::config('publish', 'filename_type') == 'always'); $languagePart = ''; $typePart = ''; @@ -139,8 +139,8 @@ class PublicLink implements LinkFormat $typePart = $templateModel->extension; } - $languageSep = $languagePart?config('publish','language_sep') :''; - $typeSep = $typePart ?config('publish','type_sep' ) :''; + $languageSep = $languagePart?\cms\base\Configuration::config('publish','language_sep') :''; + $typeSep = $typePart ?\cms\base\Configuration::config('publish','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 @@ -104,7 +104,7 @@ class Ftp extends BaseTarget if ($p !== false) // Wennn letzten Punkt gefunden, dann dort aufteilen { $extension = substr(basename($dest), $p + 1); - $type = config('mime-types', $extension); + $type = \cms\base\Configuration::config('mime-types', $extension); 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 @@ -46,7 +46,7 @@ class Local extends BaseTarget */ public function open() { - $confPublish = config('publish'); + $confPublish = \cms\base\Configuration::config('publish'); $targetDir = rtrim( $this->url->path,'/' ); diff --git a/modules/cms/model/BaseObject.class.php b/modules/cms/model/BaseObject.class.php @@ -299,7 +299,7 @@ SQL } $guestMask = 0; - switch( Conf()->subset('security')->get('guest-access','read') ) + switch( \cms\base\Configuration::Conf()->subset('security')->get('guest-access','read') ) { case 'read': case 'readonly': @@ -529,7 +529,7 @@ SQL $slug = str_replace(array_keys($replacements), array_values($replacements), $slug); // 2nd try is to use iconv with the current locale. - Language::setLocale( config('language','language_code' ) ); + Language::setLocale( \cms\base\Configuration::config('language','language_code' ) ); $slug = iconv('utf-8', 'ascii//TRANSLIT', $slug); // now replace every unpleasant char with a hyphen. diff --git a/modules/cms/model/Folder.class.php b/modules/cms/model/Folder.class.php @@ -420,7 +420,7 @@ class Folder extends BaseObject */ public function filename() { - $filenameConfig = config('filename'); + $filenameConfig = \cms\base\Configuration::config('filename'); if ( $filenameConfig['edit'] ) { diff --git a/modules/cms/model/Language.class.php b/modules/cms/model/Language.class.php @@ -45,7 +45,7 @@ class Language extends ModelBase public static function setLocale( $isoCode ) { - $localeConf = config()->subset('i18n')->subset('locale'); + $localeConf = \cms\base\Configuration::config()->subset('i18n')->subset('locale'); if ( $localeConf->has(strtolower($isoCode)) ) { diff --git a/modules/cms/model/User.class.php b/modules/cms/model/User.class.php @@ -225,7 +225,7 @@ SQL VALUES( {id},{userid},{selector},{token},{token_algo},{expires},{create_date},{platform},{name} ) SQL ); - $expirationPeriodDays = Conf()->subset('user')->subset('security')->get('token_expires_after_days',730); + $expirationPeriodDays = \cms\base\Configuration::Conf()->subset('user')->subset('security')->get('token_expires_after_days',730); $stmt->setInt( 'id' ,++$count ); $stmt->setInt( 'userid' ,$this->userid ); @@ -955,7 +955,7 @@ SQL */ public static function pepperPassword( $pass ) { - $salt = Conf()->subset('security')->subset('password')->get('pepper'); + $salt = \cms\base\Configuration::Conf()->subset('security')->subset('password')->get('pepper'); return $salt.$pass; } diff --git a/modules/cms/model/Value.class.php b/modules/cms/model/Value.class.php @@ -469,7 +469,7 @@ SQL $sql->query(); // Nur ausfuehren, wenn in Konfiguration aktiviert. - $limit = config('content','revision-limit'); + $limit = \cms\base\Configuration::config('content','revision-limit'); if ( isset($limit['enabled']) && $limit['enabled'] ) $this->checkLimit(); } @@ -481,7 +481,7 @@ SQL */ function checkLimit() { - $limit = config('content','revision-limit'); + $limit = \cms\base\Configuration::config('content','revision-limit'); $db = \cms\base\DB::get(); diff --git a/modules/cms/ui/UI.class.php b/modules/cms/ui/UI.class.php @@ -110,7 +110,7 @@ class UI */ private static function setContentSecurityPolicy() { - //if (config('security','content-security-policy')) // config is not loaded yet. + //if (\cms\base\Configuration::config('security','content-security-policy')) // config is not loaded yet. $contentSecurityPolicyEntries = array( 'default-src \'none\'', 'script-src \'self\'', diff --git a/modules/cms/ui/action/IndexAction.class.php b/modules/cms/ui/action/IndexAction.class.php @@ -42,14 +42,14 @@ class IndexAction extends Action $user = Session::getUser(); if ( $user ) - $this->lastModified( config('config','last_modification_time') ); + $this->lastModified( \cms\base\Configuration::config('config','last_modification_time') ); else $this->lastModified( time() ); $style = $this->getUserStyle( $user ); - $styleConfig = config('style-default'); // default style config - $userStyleConfig = config('style', $style); // user style config + $styleConfig = \cms\base\Configuration::config('style-default'); // default style config + $userStyleConfig = \cms\base\Configuration::config('style', $style); // user style config if (is_array($userStyleConfig)) $styleConfig = array_merge($styleConfig, $userStyleConfig ); // Merging user style into default style @@ -62,7 +62,7 @@ class IndexAction extends Action - $appName = config('application','name'); + $appName = \cms\base\Configuration::config('application','name'); $value = array( 'name' => $appName, @@ -99,9 +99,9 @@ class IndexAction extends Action } if ( $user ) - $this->lastModified( max( $user->loginDate,config('config','last_modification_time')) ); + $this->lastModified( max( $user->loginDate,\cms\base\Configuration::config('config','last_modification_time')) ); else - $this->lastModified( config('config','last_modification_time') ); + $this->lastModified( \cms\base\Configuration::config('config','last_modification_time') ); // Theme für den angemeldeten Benuter ermitteln $style = $this->getUserStyle($user); @@ -121,8 +121,8 @@ class IndexAction extends Action $this->setTemplateVar('jsFiles' , $this->getJSFiles() ); $this->setTemplateVar('cssFiles',$this->getCSSFiles() ); - $styleConfig = config('style-default'); // default style config - $userStyleConfig = config('style', $style); // user style config + $styleConfig = \cms\base\Configuration::config('style-default'); // default style config + $userStyleConfig = \cms\base\Configuration::config('style', $style); // user style config if (is_array($userStyleConfig)) $styleConfig = array_merge($styleConfig,$userStyleConfig); // Merging user style into default style @@ -132,7 +132,7 @@ class IndexAction extends Action // Theme base color for smartphones colorizing their status bar. $this->setTemplateVar('themeColor', UIUtils::getColorHexCode($styleConfig['title_background_color'])); - $messageOfTheDay = config('login', 'motd'); + $messageOfTheDay = \cms\base\Configuration::config('login', 'motd'); if ( !empty($messageOfTheDay) ) $this->addInfoFor( new User(),Messages::MOTD,array('motd'=>$messageOfTheDay) ); @@ -152,7 +152,7 @@ class IndexAction extends Action $methodList[] = array('name'=>$method,'open'=>$openByDefault); } $this->setTemplateVar('methodList', $methodList); - $this->setTemplateVar('favicon_url', Conf()->subset('theme')->get('favicon','modules/cms/ui/themes/default/images/openrat-logo.ico') ); + $this->setTemplateVar('favicon_url', \cms\base\Configuration::Conf()->subset('theme')->get('favicon','modules/cms/ui/themes/default/images/openrat-logo.ico') ); // HTML-Datei direkt einbinden. $vars = $this->getOutputData(); @@ -192,7 +192,7 @@ class IndexAction extends Action $css = ''; - foreach (array_keys(config('style')) as $styleId) + foreach (array_keys(\cms\base\Configuration::config('style')) as $styleId) { try { @@ -203,7 +203,7 @@ class IndexAction extends Action )); $parser->parseFile($lessFile,basename($lessFile)); - $styleConfig = array_merge( config('style-default'), config('style', $styleId) ); + $styleConfig = array_merge( \cms\base\Configuration::config('style-default'), \cms\base\Configuration::config('style', $styleId) ); $lessVars = array( 'cms-theme-id' => strtolower($styleId), 'cms-image-path' => 'themes/default/images/' @@ -426,7 +426,7 @@ class IndexAction extends Action // Das zuletzt geänderte Objekt benutzen. - if ( config('login','start','start_lastchanged_object') ) + if ( \cms\base\Configuration::config('login','start','start_lastchanged_object') ) { $objectid = Value::getLastChangedObjectByUserId($user->userid); @@ -442,7 +442,7 @@ class IndexAction extends Action } // Das einzige Projekt benutzen - if ( config('login','start','start_single_project') ) + if ( \cms\base\Configuration::config('login','start','start_single_project') ) { $projects = Project::getAllProjects(); if ( count($projects) == 1 ) { @@ -458,7 +458,7 @@ class IndexAction extends Action private function tryAutoLogin() { - $modules = config('security','autologin','modules'); + $modules = \cms\base\Configuration::config('security','autologin','modules'); $username = null; foreach( $modules as $module) @@ -514,10 +514,10 @@ class IndexAction extends Action private function getUserStyle( $user ) { // Theme für den angemeldeten Benuter ermitteln - if ( $user && isset(config('style')[$user->style])) + if ( $user && isset(\cms\base\Configuration::config('style')[$user->style])) $style = $user->style; else - $style = config('interface', 'style', 'default'); + $style = \cms\base\Configuration::config('interface', 'style', 'default'); return $style; } diff --git a/modules/cms/ui/action/TitleAction.class.php b/modules/cms/ui/action/TitleAction.class.php @@ -44,7 +44,7 @@ class TitleAction extends Action */ public function showView() { - $this->setTemplateVar('buildinfo',OR_TITLE.' '.OR_VERSION.' - build '.config('build','build') ); + $this->setTemplateVar('buildinfo',OR_TITLE.' '.OR_VERSION.' - build '.\cms\base\Configuration::config('build','build') ); $user = Session::getUser(); @@ -69,7 +69,7 @@ class TitleAction extends Action //$this->setTemplateVar('logout_url' ,Html::url( 'index','logout' )); $this->setTemplateVar('isAdmin',$this->userIsAdmin() ); - if ( config('interface','session','auto_extend') ) + if ( \cms\base\Configuration::config('interface','session','auto_extend') ) { $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 if (!defined('OR_TITLE')) exit(); ?> - <?php $if1=(config('security','disable_dynamic_code')); if($if1) { ?> + <?php $if1=(\cms\base\Configuration::config('security','disable_dynamic_code')); if($if1) { ?> <?php $if1=(!1); if($if1) { ?> <div class="<?php echo \template_engine\Output::escapeHtml('message warn') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> <span><?php echo \template_engine\Output::escapeHtml(''.@\template_engine\Output::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 if (!defined('OR_TITLE')) exit(); ?> - <?php $if1=(config('security','nopublish')); if($if1) { ?> + <?php $if1=(\cms\base\Configuration::config('security','nopublish')); if($if1) { ?> <div class="<?php echo \template_engine\Output::escapeHtml('message warn') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> <span class="<?php echo \template_engine\Output::escapeHtml('help') ?>"><?php echo \template_engine\Output::escapeHtml(''.@\template_engine\Output::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 if (!defined('OR_TITLE')) exit(); ?> - <?php $if1=(config('security','nopublish')); if($if1) { ?> + <?php $if1=(\cms\base\Configuration::config('security','nopublish')); if($if1) { ?> <div class="<?php echo \template_engine\Output::escapeHtml('message warn') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> <span class="<?php echo \template_engine\Output::escapeHtml('help') ?>"><?php echo \template_engine\Output::escapeHtml(''.@\template_engine\Output::lang('NOPUBLISH_DESC').'') ?> </span> 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 if (!defined('OR_TITLE')) exit(); ?> - <?php $if1=(config('security','nopublish')); if($if1) { ?> + <?php $if1=(\cms\base\Configuration::config('security','nopublish')); if($if1) { ?> <div class="<?php echo \template_engine\Output::escapeHtml('message warn') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> <span class="<?php echo \template_engine\Output::escapeHtml('help') ?>"><?php echo \template_engine\Output::escapeHtml(''.@\template_engine\Output::lang('NOPUBLISH_DESC').'') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/login/login.php b/modules/cms/ui/themes/default/html/views/login/login.php @@ -5,35 +5,35 @@ <input type="<?php echo \template_engine\Output::escapeHtml('hidden') ?>" name="<?php echo \template_engine\Output::escapeHtml('subaction') ?>" value="<?php echo \template_engine\Output::escapeHtml('login') ?>" /><?php echo \template_engine\Output::escapeHtml('') ?> <input type="<?php echo \template_engine\Output::escapeHtml('hidden') ?>" name="<?php echo \template_engine\Output::escapeHtml('id') ?>" value="<?php echo \template_engine\Output::escapeHtml(''.@$_id.'') ?>" /><?php echo \template_engine\Output::escapeHtml('') ?> <div><?php echo \template_engine\Output::escapeHtml('') ?> - <?php $if1=(config('login','logo','enabled')); if($if1) { ?> - <?php $if1=!((config('login','logo','url'))==FALSE); if($if1) { ?> - <a target="<?php echo \template_engine\Output::escapeHtml('_self') ?>" data-url="<?php echo \template_engine\Output::escapeHtml(''.config('login','logo','url').'') ?>" data-action="<?php echo \template_engine\Output::escapeHtml('') ?>" data-method="<?php echo \template_engine\Output::escapeHtml('') ?>" data-id="<?php echo \template_engine\Output::escapeHtml('') ?>" data-extra="<?php echo \template_engine\Output::escapeHtml('[]') ?>" href="<?php echo \template_engine\Output::escapeHtml('/#//') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> - <img src="<?php echo \template_engine\Output::escapeHtml(''.config('login','logo','image').'') ?>" /><?php echo \template_engine\Output::escapeHtml('') ?> + <?php $if1=(\cms\base\Configuration::config('login','logo','enabled')); if($if1) { ?> + <?php $if1=!((\cms\base\Configuration::config('login','logo','url'))==FALSE); if($if1) { ?> + <a target="<?php echo \template_engine\Output::escapeHtml('_self') ?>" data-url="<?php echo \template_engine\Output::escapeHtml(''.\template_engine\Output::config('login','logo','url').'') ?>" data-action="<?php echo \template_engine\Output::escapeHtml('') ?>" data-method="<?php echo \template_engine\Output::escapeHtml('') ?>" data-id="<?php echo \template_engine\Output::escapeHtml('') ?>" data-extra="<?php echo \template_engine\Output::escapeHtml('[]') ?>" href="<?php echo \template_engine\Output::escapeHtml('/#//') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> + <img src="<?php echo \template_engine\Output::escapeHtml(''.\template_engine\Output::config('login','logo','image').'') ?>" /><?php echo \template_engine\Output::escapeHtml('') ?> </a> <?php } ?> <?php if(!$if1) { ?> - <img src="<?php echo \template_engine\Output::escapeHtml(''.config('login','logo','image').'') ?>" /><?php echo \template_engine\Output::escapeHtml('') ?> + <img src="<?php echo \template_engine\Output::escapeHtml(''.\template_engine\Output::config('login','logo','image').'') ?>" /><?php echo \template_engine\Output::escapeHtml('') ?> <?php } ?> <?php } ?> - <?php $if1=!((config('login','motd'))==FALSE); if($if1) { ?> + <?php $if1=!((\cms\base\Configuration::config('login','motd'))==FALSE); if($if1) { ?> <div class="<?php echo \template_engine\Output::escapeHtml('message info') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> - <span><?php echo \template_engine\Output::escapeHtml(''.config('login','motd').'') ?> + <span><?php echo \template_engine\Output::escapeHtml(''.\template_engine\Output::config('login','motd').'') ?> </span> </div> <?php } ?> - <?php $if1=(config('login','nologin')); if($if1) { ?> + <?php $if1=(\cms\base\Configuration::config('login','nologin')); if($if1) { ?> <div class="<?php echo \template_engine\Output::escapeHtml('message error') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> <span><?php echo \template_engine\Output::escapeHtml(''.@\template_engine\Output::lang('LOGIN_NOLOGIN_DESC').'') ?> </span> </div> <?php } ?> - <?php $if1=(config('security','readonly')); if($if1) { ?> + <?php $if1=(\cms\base\Configuration::config('security','readonly')); if($if1) { ?> <div class="<?php echo \template_engine\Output::escapeHtml('message warn') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> <span><?php echo \template_engine\Output::escapeHtml(''.@\template_engine\Output::lang('READONLY_DESC').'') ?> </span> </div> <?php } ?> - <?php $if1=(!config('login','nologin')); if($if1) { ?> + <?php $if1=(!\cms\base\Configuration::config('login','nologin')); if($if1) { ?> <div class="<?php echo \template_engine\Output::escapeHtml('line') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> <div class="<?php echo \template_engine\Output::escapeHtml('label') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> <label class="<?php echo \template_engine\Output::escapeHtml('label') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> diff --git a/modules/cms/ui/themes/default/html/views/login/openid.php b/modules/cms/ui/themes/default/html/views/login/openid.php @@ -5,7 +5,7 @@ <input type="<?php echo \template_engine\Output::escapeHtml('hidden') ?>" name="<?php echo \template_engine\Output::escapeHtml('subaction') ?>" value="<?php echo \template_engine\Output::escapeHtml('login') ?>" /><?php echo \template_engine\Output::escapeHtml('') ?> <input type="<?php echo \template_engine\Output::escapeHtml('hidden') ?>" name="<?php echo \template_engine\Output::escapeHtml('id') ?>" value="<?php echo \template_engine\Output::escapeHtml(''.@$_id.'') ?>" /><?php echo \template_engine\Output::escapeHtml('') ?> <div><?php echo \template_engine\Output::escapeHtml('') ?> - <?php $if1=(config('security','openid','enable')); if($if1) { ?> + <?php $if1=(\cms\base\Configuration::config('security','openid','enable')); if($if1) { ?> <fieldset class="<?php echo \template_engine\Output::escapeHtml('or-group toggle-open-close open show') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> <legend class="<?php echo \template_engine\Output::escapeHtml('on-click-open-close') ?>"><?php echo \template_engine\Output::escapeHtml(''.@\template_engine\Output::lang('OPENID').'') ?> <img /><?php echo \template_engine\Output::escapeHtml('') ?> @@ -19,8 +19,8 @@ <div class="<?php echo \template_engine\Output::escapeHtml('label') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> <span><?php echo \template_engine\Output::escapeHtml(''.@\template_engine\Output::lang('openid_user').'') ?> </span> - <?php $if1=!((config('security','openid','logo_url'))==FALSE); if($if1) { ?> - <img src="<?php echo \template_engine\Output::escapeHtml(''.config('security','openid','logo_url').'') ?>" /><?php echo \template_engine\Output::escapeHtml('') ?> + <?php $if1=!((\cms\base\Configuration::config('security','openid','logo_url'))==FALSE); if($if1) { ?> + <img src="<?php echo \template_engine\Output::escapeHtml(''.\template_engine\Output::config('security','openid','logo_url').'') ?>" /><?php echo \template_engine\Output::escapeHtml('') ?> <?php } ?> </div> <div class="<?php echo \template_engine\Output::escapeHtml('input') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> 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 if (!defined('OR_TITLE')) exit(); ?> - <?php $if1=(config('login','send_password')); if($if1) { ?> + <?php $if1=(\cms\base\Configuration::config('login','send_password')); if($if1) { ?> <form name="<?php echo \template_engine\Output::escapeHtml('') ?>" target="<?php echo \template_engine\Output::escapeHtml('_self') ?>" data-target="<?php echo \template_engine\Output::escapeHtml('view') ?>" action="<?php echo \template_engine\Output::escapeHtml('./') ?>" data-method="<?php echo \template_engine\Output::escapeHtml('password') ?>" data-action="<?php echo \template_engine\Output::escapeHtml('login') ?>" data-id="<?php echo \template_engine\Output::escapeHtml(''.@$_id.'') ?>" method="<?php echo \template_engine\Output::escapeHtml('POST') ?>" enctype="<?php echo \template_engine\Output::escapeHtml('application/x-www-form-urlencoded') ?>" data-async="<?php echo \template_engine\Output::escapeHtml('') ?>" data-autosave="<?php echo \template_engine\Output::escapeHtml('') ?>" class="<?php echo \template_engine\Output::escapeHtml('or-form login') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> <input type="<?php echo \template_engine\Output::escapeHtml('hidden') ?>" name="<?php echo \template_engine\Output::escapeHtml('token') ?>" value="<?php echo \template_engine\Output::escapeHtml(''.@$_token.'') ?>" /><?php echo \template_engine\Output::escapeHtml('') ?> <input type="<?php echo \template_engine\Output::escapeHtml('hidden') ?>" name="<?php echo \template_engine\Output::escapeHtml('action') ?>" value="<?php echo \template_engine\Output::escapeHtml('login') ?>" /><?php echo \template_engine\Output::escapeHtml('') ?> 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 if (!defined('OR_TITLE')) exit(); ?> - <?php $if1=(config('login','register')); if($if1) { ?> + <?php $if1=(\cms\base\Configuration::config('login','register')); if($if1) { ?> <form name="<?php echo \template_engine\Output::escapeHtml('') ?>" target="<?php echo \template_engine\Output::escapeHtml('_self') ?>" data-target="<?php echo \template_engine\Output::escapeHtml('view') ?>" action="<?php echo \template_engine\Output::escapeHtml('./') ?>" data-method="<?php echo \template_engine\Output::escapeHtml('register') ?>" data-action="<?php echo \template_engine\Output::escapeHtml('login') ?>" data-id="<?php echo \template_engine\Output::escapeHtml(''.@$_id.'') ?>" method="<?php echo \template_engine\Output::escapeHtml('POST') ?>" enctype="<?php echo \template_engine\Output::escapeHtml('application/x-www-form-urlencoded') ?>" data-async="<?php echo \template_engine\Output::escapeHtml('') ?>" data-autosave="<?php echo \template_engine\Output::escapeHtml('') ?>" class="<?php echo \template_engine\Output::escapeHtml('or-form login') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> <input type="<?php echo \template_engine\Output::escapeHtml('hidden') ?>" name="<?php echo \template_engine\Output::escapeHtml('token') ?>" value="<?php echo \template_engine\Output::escapeHtml(''.@$_token.'') ?>" /><?php echo \template_engine\Output::escapeHtml('') ?> <input type="<?php echo \template_engine\Output::escapeHtml('hidden') ?>" name="<?php echo \template_engine\Output::escapeHtml('action') ?>" value="<?php echo \template_engine\Output::escapeHtml('login') ?>" /><?php echo \template_engine\Output::escapeHtml('') ?> 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 if (!defined('OR_TITLE')) exit(); ?> - <?php $if1=(config('security','nopublish')); if($if1) { ?> + <?php $if1=(\cms\base\Configuration::config('security','nopublish')); if($if1) { ?> <div class="<?php echo \template_engine\Output::escapeHtml('message warn') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> <span class="<?php echo \template_engine\Output::escapeHtml('help') ?>"><?php echo \template_engine\Output::escapeHtml(''.@\template_engine\Output::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 if (!defined('OR_TITLE')) exit(); ?> - <?php $if1=(config('security','nopublish')); if($if1) { ?> + <?php $if1=(\cms\base\Configuration::config('security','nopublish')); if($if1) { ?> <div class="<?php echo \template_engine\Output::escapeHtml('message warn') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> <span class="<?php echo \template_engine\Output::escapeHtml('help') ?>"><?php echo \template_engine\Output::escapeHtml(''.@\template_engine\Output::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 @@ -107,73 +107,73 @@ <div class="<?php echo \template_engine\Output::escapeHtml('or-table-area') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> <table width="<?php echo \template_engine\Output::escapeHtml('100%') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> <td><?php echo \template_engine\Output::escapeHtml('') ?> - <span><?php echo \template_engine\Output::escapeHtml(''.config('editor','text-markup','strong-begin').'') ?> + <span><?php echo \template_engine\Output::escapeHtml(''.\template_engine\Output::config('editor','text-markup','strong-begin').'') ?> </span> <span><?php echo \template_engine\Output::escapeHtml(''.@\template_engine\Output::lang('text_markup_strong').'') ?> </span> - <span><?php echo \template_engine\Output::escapeHtml(''.config('editor','text-markup','strong-end').'') ?> + <span><?php echo \template_engine\Output::escapeHtml(''.\template_engine\Output::config('editor','text-markup','strong-end').'') ?> </span> <br /><?php echo \template_engine\Output::escapeHtml('') ?> - <span><?php echo \template_engine\Output::escapeHtml(''.config('editor','text-markup','emphatic-begin').'') ?> + <span><?php echo \template_engine\Output::escapeHtml(''.\template_engine\Output::config('editor','text-markup','emphatic-begin').'') ?> </span> <span><?php echo \template_engine\Output::escapeHtml(''.@\template_engine\Output::lang('text_markup_emphatic').'') ?> </span> - <span><?php echo \template_engine\Output::escapeHtml(''.config('editor','text-markup','emphatic-end').'') ?> + <span><?php echo \template_engine\Output::escapeHtml(''.\template_engine\Output::config('editor','text-markup','emphatic-end').'') ?> </span> </td> <td><?php echo \template_engine\Output::escapeHtml('') ?> - <span><?php echo \template_engine\Output::escapeHtml(''.config('editor','text-markup','list-numbered').'') ?> + <span><?php echo \template_engine\Output::escapeHtml(''.\template_engine\Output::config('editor','text-markup','list-numbered').'') ?> </span> <span><?php echo \template_engine\Output::escapeHtml(''.@\template_engine\Output::lang('text_markup_numbered_list').'') ?> </span> <br /><?php echo \template_engine\Output::escapeHtml('') ?> - <span><?php echo \template_engine\Output::escapeHtml(''.config('editor','text-markup','list-numbered').'') ?> + <span><?php echo \template_engine\Output::escapeHtml(''.\template_engine\Output::config('editor','text-markup','list-numbered').'') ?> </span> <span><?php echo \template_engine\Output::escapeHtml('...') ?> </span> <br /><?php echo \template_engine\Output::escapeHtml('') ?> </td> <td><?php echo \template_engine\Output::escapeHtml('') ?> - <span><?php echo \template_engine\Output::escapeHtml(''.config('editor','text-markup','list-unnumbered').'') ?> + <span><?php echo \template_engine\Output::escapeHtml(''.\template_engine\Output::config('editor','text-markup','list-unnumbered').'') ?> </span> <span><?php echo \template_engine\Output::escapeHtml(''.@\template_engine\Output::lang('text_markup_unnumbered_list').'') ?> </span> <br /><?php echo \template_engine\Output::escapeHtml('') ?> - <span><?php echo \template_engine\Output::escapeHtml(''.config('editor','text-markup','list-unnumbered').'') ?> + <span><?php echo \template_engine\Output::escapeHtml(''.\template_engine\Output::config('editor','text-markup','list-unnumbered').'') ?> </span> <span><?php echo \template_engine\Output::escapeHtml('...') ?> </span> <br /><?php echo \template_engine\Output::escapeHtml('') ?> </td> <td><?php echo \template_engine\Output::escapeHtml('') ?> - <span><?php echo \template_engine\Output::escapeHtml(''.config('editor','text-markup','table-cell-sep').'') ?> + <span><?php echo \template_engine\Output::escapeHtml(''.\template_engine\Output::config('editor','text-markup','table-cell-sep').'') ?> </span> <span><?php echo \template_engine\Output::escapeHtml(''.@\template_engine\Output::lang('text_markup_table').'') ?> </span> - <span><?php echo \template_engine\Output::escapeHtml(''.config('editor','text-markup','table-cell-sep').'') ?> + <span><?php echo \template_engine\Output::escapeHtml(''.\template_engine\Output::config('editor','text-markup','table-cell-sep').'') ?> </span> <span><?php echo \template_engine\Output::escapeHtml('...') ?> </span> - <span><?php echo \template_engine\Output::escapeHtml(''.config('editor','text-markup','table-cell-sep').'') ?> + <span><?php echo \template_engine\Output::escapeHtml(''.\template_engine\Output::config('editor','text-markup','table-cell-sep').'') ?> </span> <span><?php echo \template_engine\Output::escapeHtml('...') ?> </span> - <span><?php echo \template_engine\Output::escapeHtml(''.config('editor','text-markup','table-cell-sep').'') ?> + <span><?php echo \template_engine\Output::escapeHtml(''.\template_engine\Output::config('editor','text-markup','table-cell-sep').'') ?> </span> <br /><?php echo \template_engine\Output::escapeHtml('') ?> - <span><?php echo \template_engine\Output::escapeHtml(''.config('editor','text-markup','table-cell-sep').'') ?> + <span><?php echo \template_engine\Output::escapeHtml(''.\template_engine\Output::config('editor','text-markup','table-cell-sep').'') ?> </span> <span><?php echo \template_engine\Output::escapeHtml('...') ?> </span> - <span><?php echo \template_engine\Output::escapeHtml(''.config('editor','text-markup','table-cell-sep').'') ?> + <span><?php echo \template_engine\Output::escapeHtml(''.\template_engine\Output::config('editor','text-markup','table-cell-sep').'') ?> </span> <span><?php echo \template_engine\Output::escapeHtml('...') ?> </span> - <span><?php echo \template_engine\Output::escapeHtml(''.config('editor','text-markup','table-cell-sep').'') ?> + <span><?php echo \template_engine\Output::escapeHtml(''.\template_engine\Output::config('editor','text-markup','table-cell-sep').'') ?> </span> <span><?php echo \template_engine\Output::escapeHtml('...') ?> </span> - <span><?php echo \template_engine\Output::escapeHtml(''.config('editor','text-markup','table-cell-sep').'') ?> + <span><?php echo \template_engine\Output::escapeHtml(''.\template_engine\Output::config('editor','text-markup','table-cell-sep').'') ?> </span> <br /><?php echo \template_engine\Output::escapeHtml('') ?> </td> diff --git a/modules/cms/ui/themes/default/html/views/project/prop.php b/modules/cms/ui/themes/default/html/views/project/prop.php @@ -58,7 +58,7 @@ </div> </div> </div> - <?php $if1=(config('publish','project','override_system_command')); if($if1) { ?> + <?php $if1=(\cms\base\Configuration::config('publish','project','override_system_command')); if($if1) { ?> <div class="<?php echo \template_engine\Output::escapeHtml('line') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> <div class="<?php echo \template_engine\Output::escapeHtml('label') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> <label class="<?php echo \template_engine\Output::escapeHtml('label') ?>"><?php echo \template_engine\Output::escapeHtml(''.@\template_engine\Output::lang('PROJECT_CMD_AFTER_PUBLISH').'') ?> @@ -101,7 +101,7 @@ </label> </div> </fieldset> - <?php $if1=(config('publish','ftp','enable')); if($if1) { ?> + <?php $if1=(\cms\base\Configuration::config('publish','ftp','enable')); if($if1) { ?> <fieldset class="<?php echo \template_engine\Output::escapeHtml('or-group toggle-open-close open show') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> <legend class="<?php echo \template_engine\Output::escapeHtml('on-click-open-close') ?>"><?php echo \template_engine\Output::escapeHtml(''.@\template_engine\Output::lang('project_FTP').'') ?> <img /><?php echo \template_engine\Output::escapeHtml('') ?> diff --git a/modules/cms/ui/themes/default/html/views/search/edit.php b/modules/cms/ui/themes/default/html/views/search/edit.php @@ -28,31 +28,31 @@ <br /><?php echo \template_engine\Output::escapeHtml('') ?> </div> <div class="<?php echo \template_engine\Output::escapeHtml('input') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> - <input type="<?php echo \template_engine\Output::escapeHtml('checkbox') ?>" name="<?php echo \template_engine\Output::escapeHtml('id') ?>" value="<?php echo \template_engine\Output::escapeHtml('1') ?>" <?php if(config('search','quicksearch','flag','id')){ ?>checked="<?php echo \template_engine\Output::escapeHtml('checked') ?>"<?php } ?> /><?php echo \template_engine\Output::escapeHtml('') ?> + <input type="<?php echo \template_engine\Output::escapeHtml('checkbox') ?>" name="<?php echo \template_engine\Output::escapeHtml('id') ?>" value="<?php echo \template_engine\Output::escapeHtml('1') ?>" <?php if(\cms\base\Configuration::config('search','quicksearch','flag','id')){ ?>checked="<?php echo \template_engine\Output::escapeHtml('checked') ?>"<?php } ?> /><?php echo \template_engine\Output::escapeHtml('') ?> <label class="<?php echo \template_engine\Output::escapeHtml('label') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> <span><?php echo \template_engine\Output::escapeHtml(''.@\template_engine\Output::lang('id').'') ?> </span> </label> <br /><?php echo \template_engine\Output::escapeHtml('') ?> - <input type="<?php echo \template_engine\Output::escapeHtml('checkbox') ?>" name="<?php echo \template_engine\Output::escapeHtml('name') ?>" value="<?php echo \template_engine\Output::escapeHtml('1') ?>" <?php if(config('search','quicksearch','flag','name')){ ?>checked="<?php echo \template_engine\Output::escapeHtml('checked') ?>"<?php } ?> /><?php echo \template_engine\Output::escapeHtml('') ?> + <input type="<?php echo \template_engine\Output::escapeHtml('checkbox') ?>" name="<?php echo \template_engine\Output::escapeHtml('name') ?>" value="<?php echo \template_engine\Output::escapeHtml('1') ?>" <?php if(\cms\base\Configuration::config('search','quicksearch','flag','name')){ ?>checked="<?php echo \template_engine\Output::escapeHtml('checked') ?>"<?php } ?> /><?php echo \template_engine\Output::escapeHtml('') ?> <label class="<?php echo \template_engine\Output::escapeHtml('label') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> <span><?php echo \template_engine\Output::escapeHtml(''.@\template_engine\Output::lang('name').'') ?> </span> </label> <br /><?php echo \template_engine\Output::escapeHtml('') ?> - <input type="<?php echo \template_engine\Output::escapeHtml('checkbox') ?>" name="<?php echo \template_engine\Output::escapeHtml('filename') ?>" value="<?php echo \template_engine\Output::escapeHtml('1') ?>" <?php if(config('search','quicksearch','flag','filename')){ ?>checked="<?php echo \template_engine\Output::escapeHtml('checked') ?>"<?php } ?> /><?php echo \template_engine\Output::escapeHtml('') ?> + <input type="<?php echo \template_engine\Output::escapeHtml('checkbox') ?>" name="<?php echo \template_engine\Output::escapeHtml('filename') ?>" value="<?php echo \template_engine\Output::escapeHtml('1') ?>" <?php if(\cms\base\Configuration::config('search','quicksearch','flag','filename')){ ?>checked="<?php echo \template_engine\Output::escapeHtml('checked') ?>"<?php } ?> /><?php echo \template_engine\Output::escapeHtml('') ?> <label class="<?php echo \template_engine\Output::escapeHtml('label') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> <span><?php echo \template_engine\Output::escapeHtml(''.@\template_engine\Output::lang('filename').'') ?> </span> </label> <br /><?php echo \template_engine\Output::escapeHtml('') ?> - <input type="<?php echo \template_engine\Output::escapeHtml('checkbox') ?>" name="<?php echo \template_engine\Output::escapeHtml('description') ?>" value="<?php echo \template_engine\Output::escapeHtml('1') ?>" <?php if(config('search','quicksearch','flag','description')){ ?>checked="<?php echo \template_engine\Output::escapeHtml('checked') ?>"<?php } ?> /><?php echo \template_engine\Output::escapeHtml('') ?> + <input type="<?php echo \template_engine\Output::escapeHtml('checkbox') ?>" name="<?php echo \template_engine\Output::escapeHtml('description') ?>" value="<?php echo \template_engine\Output::escapeHtml('1') ?>" <?php if(\cms\base\Configuration::config('search','quicksearch','flag','description')){ ?>checked="<?php echo \template_engine\Output::escapeHtml('checked') ?>"<?php } ?> /><?php echo \template_engine\Output::escapeHtml('') ?> <label class="<?php echo \template_engine\Output::escapeHtml('label') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> <span><?php echo \template_engine\Output::escapeHtml(''.@\template_engine\Output::lang('description').'') ?> </span> </label> <br /><?php echo \template_engine\Output::escapeHtml('') ?> - <input type="<?php echo \template_engine\Output::escapeHtml('checkbox') ?>" name="<?php echo \template_engine\Output::escapeHtml('content') ?>" value="<?php echo \template_engine\Output::escapeHtml('1') ?>" <?php if(config('search','quicksearch','flag','content')){ ?>checked="<?php echo \template_engine\Output::escapeHtml('checked') ?>"<?php } ?> /><?php echo \template_engine\Output::escapeHtml('') ?> + <input type="<?php echo \template_engine\Output::escapeHtml('checkbox') ?>" name="<?php echo \template_engine\Output::escapeHtml('content') ?>" value="<?php echo \template_engine\Output::escapeHtml('1') ?>" <?php if(\cms\base\Configuration::config('search','quicksearch','flag','content')){ ?>checked="<?php echo \template_engine\Output::escapeHtml('checked') ?>"<?php } ?> /><?php echo \template_engine\Output::escapeHtml('') ?> <label class="<?php echo \template_engine\Output::escapeHtml('label') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> <span><?php echo \template_engine\Output::escapeHtml(''.@\template_engine\Output::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 if (!defined('OR_TITLE')) exit(); ?> - <?php $if1=(config('security','nopublish')); if($if1) { ?> + <?php $if1=(\cms\base\Configuration::config('security','nopublish')); if($if1) { ?> <div class="<?php echo \template_engine\Output::escapeHtml('message warn') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> <span class="<?php echo \template_engine\Output::escapeHtml('help') ?>"><?php echo \template_engine\Output::escapeHtml(''.@\template_engine\Output::lang('NOPUBLISH_DESC').'') ?> </span> 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 if (!defined('OR_TITLE')) exit(); ?> - <?php $if1=(config('security','nopublish')); if($if1) { ?> + <?php $if1=(\cms\base\Configuration::config('security','nopublish')); if($if1) { ?> <div class="<?php echo \template_engine\Output::escapeHtml('message warn') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> <span class="<?php echo \template_engine\Output::escapeHtml('help') ?>"><?php echo \template_engine\Output::escapeHtml(''.@\template_engine\Output::lang('NOPUBLISH_DESC').'') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/title/show.php b/modules/cms/ui/themes/default/html/views/title/show.php @@ -56,7 +56,7 @@ </i> <span><?php echo \template_engine\Output::escapeHtml(''.@\template_engine\Output::lang('menu_new').'') ?> </span> - <span class="<?php echo \template_engine\Output::escapeHtml('keystroke') ?>"><?php echo \template_engine\Output::escapeHtml(''.config('ui','keybinding','method','add').'') ?> + <span class="<?php echo \template_engine\Output::escapeHtml('keystroke') ?>"><?php echo \template_engine\Output::escapeHtml(''.\template_engine\Output::config('ui','keybinding','method','add').'') ?> </span> </a> </div> @@ -172,7 +172,7 @@ </i> <span><?php echo \template_engine\Output::escapeHtml(''.@\template_engine\Output::lang('menu_prop').'') ?> </span> - <span class="<?php echo \template_engine\Output::escapeHtml('keystroke') ?>"><?php echo \template_engine\Output::escapeHtml(''.config('ui','keybinding','method','prop').'') ?> + <span class="<?php echo \template_engine\Output::escapeHtml('keystroke') ?>"><?php echo \template_engine\Output::escapeHtml(''.\template_engine\Output::config('ui','keybinding','method','prop').'') ?> </span> </a> </div> @@ -190,7 +190,7 @@ </i> <span><?php echo \template_engine\Output::escapeHtml(''.@\template_engine\Output::lang('menu_pub').'') ?> </span> - <span class="<?php echo \template_engine\Output::escapeHtml('keystroke') ?>"><?php echo \template_engine\Output::escapeHtml(''.config('ui','keybinding','method','pub').'') ?> + <span class="<?php echo \template_engine\Output::escapeHtml('keystroke') ?>"><?php echo \template_engine\Output::escapeHtml(''.\template_engine\Output::config('ui','keybinding','method','pub').'') ?> </span> </a> </div> @@ -200,7 +200,7 @@ </i> <span><?php echo \template_engine\Output::escapeHtml(''.@\template_engine\Output::lang('menu_archive').'') ?> </span> - <span class="<?php echo \template_engine\Output::escapeHtml('keystroke') ?>"><?php echo \template_engine\Output::escapeHtml(''.config('ui','keybinding','method','archive').'') ?> + <span class="<?php echo \template_engine\Output::escapeHtml('keystroke') ?>"><?php echo \template_engine\Output::escapeHtml(''.\template_engine\Output::config('ui','keybinding','method','archive').'') ?> </span> </a> </div> @@ -210,7 +210,7 @@ </i> <span><?php echo \template_engine\Output::escapeHtml(''.@\template_engine\Output::lang('menu_rights').'') ?> </span> - <span class="<?php echo \template_engine\Output::escapeHtml('keystroke') ?>"><?php echo \template_engine\Output::escapeHtml(''.config('ui','keybinding','method','rights').'') ?> + <span class="<?php echo \template_engine\Output::escapeHtml('keystroke') ?>"><?php echo \template_engine\Output::escapeHtml(''.\template_engine\Output::config('ui','keybinding','method','rights').'') ?> </span> </a> </div> @@ -362,7 +362,7 @@ </i> <span><?php echo \template_engine\Output::escapeHtml(''.@\template_engine\Output::lang('menu_profile').'') ?> </span> - <span class="<?php echo \template_engine\Output::escapeHtml('keystroke') ?>"><?php echo \template_engine\Output::escapeHtml(''.config('ui','keybinding','action','profile').'') ?> + <span class="<?php echo \template_engine\Output::escapeHtml('keystroke') ?>"><?php echo \template_engine\Output::escapeHtml(''.\template_engine\Output::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 @@ -43,7 +43,7 @@ </span> </div> </div> - <?php $if1=(config('security','user','show_admin_mail')); if($if1) { ?> + <?php $if1=(\cms\base\Configuration::config('security','user','show_admin_mail')); if($if1) { ?> <div class="<?php echo \template_engine\Output::escapeHtml('line') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> <div class="<?php echo \template_engine\Output::escapeHtml('label') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> <label class="<?php echo \template_engine\Output::escapeHtml('label') ?>"><?php echo \template_engine\Output::escapeHtml(''.@\template_engine\Output::lang('user_mail').'') ?> diff --git a/modules/cms/ui/themes/default/html/views/user/prop.php b/modules/cms/ui/themes/default/html/views/user/prop.php @@ -36,7 +36,7 @@ </div> </div> </div> - <?php $if1=(config('security','user','show_admin_mail')); if($if1) { ?> + <?php $if1=(\cms\base\Configuration::config('security','user','show_admin_mail')); if($if1) { ?> <div class="<?php echo \template_engine\Output::escapeHtml('line') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> <div class="<?php echo \template_engine\Output::escapeHtml('label') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> <label class="<?php echo \template_engine\Output::escapeHtml('label') ?>"><?php echo \template_engine\Output::escapeHtml(''.@\template_engine\Output::lang('user_mail').'') ?> diff --git a/modules/cms/ui/themes/default/html/views/user/pw.php b/modules/cms/ui/themes/default/html/views/user/pw.php @@ -21,7 +21,7 @@ <input type="<?php echo \template_engine\Output::escapeHtml('hidden') ?>" name="<?php echo \template_engine\Output::escapeHtml('password_proposal') ?>" value="<?php echo \template_engine\Output::escapeHtml(''.@$password_proposal.'') ?>" /><?php echo \template_engine\Output::escapeHtml('') ?> </div> </div> - <?php $if1=(config('mail','enabled')); if($if1) { ?> + <?php $if1=(\cms\base\Configuration::config('mail','enabled')); if($if1) { ?> <div class="<?php echo \template_engine\Output::escapeHtml('line') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> <div class="<?php echo \template_engine\Output::escapeHtml('label') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> </div> @@ -74,7 +74,7 @@ <div class="<?php echo \template_engine\Output::escapeHtml('closable') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> </div> </fieldset> - <?php $if1=(config('mail','enabled')); if($if1) { ?> + <?php $if1=(\cms\base\Configuration::config('mail','enabled')); if($if1) { ?> <?php $if1=(isset($mail)); if($if1) { ?> <div class="<?php echo \template_engine\Output::escapeHtml('line') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> <div class="<?php echo \template_engine\Output::escapeHtml('label') ?>"><?php echo \template_engine\Output::escapeHtml('') ?> diff --git a/modules/cms/ui/themes/default/layout/index.php b/modules/cms/ui/themes/default/layout/index.php @@ -3,9 +3,9 @@ if (!defined('OR_VERSION')) die('Forbidden'); if (!headers_sent()) header('Content-Type: text/html; charset=UTF-8') ?><!DOCTYPE html> -<html class="theme-<?php echo strtolower($style) ?> nojs" lang="<?php echo Conf()->subset('language')->get('language_code') ?>"> +<html class="theme-<?php echo strtolower($style) ?> nojs" lang="<?php echo \cms\base\Configuration::Conf()->subset('language')->get('language_code') ?>"> <head> -<?php $appName = config('application','name'); $appOperator = config('application','operator'); +<?php $appName = \cms\base\Configuration::config('application','name'); $appOperator = \cms\base\Configuration::config('application','operator'); $title = $appName.(($appOperator!=$appName)?' - '.$appOperator:''); ?> <title data-default="<?php echo htmlentities($title,ENT_QUOTES|ENT_HTML5) ?>"><?php echo htmlentities($title,ENT_COMPAT|ENT_HTML5) ?></title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> diff --git a/modules/template_engine/Output.class.php b/modules/template_engine/Output.class.php @@ -4,6 +4,7 @@ namespace template_engine; +use cms\base\Configuration; use cms\base\Language; use util\Text; @@ -27,4 +28,9 @@ class Output public static function lang($key) { return Language::lang($key); } + + + public static function config($part1 = null, $part2 = null, $part3 = null, $part4 = null) { + Configuration::config($part1,$part2,$part3,$part4); + } } \ No newline at end of file diff --git a/modules/template_engine/components/html/user/component-user.php b/modules/template_engine/components/html/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) && config('security','user','show_mail' ) ) + if ( !empty($mail) && \cms\base\Configuration::config('security','user','show_mail' ) ) 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 @@ -64,7 +64,7 @@ class PHPBlockElement extends HtmlElement $res->addResolver('config', function($name) { $config_parts = explode('/', $name); - return 'config(' . "'" . implode("'" . ',' . "'", $config_parts) . "'" . ')'; + return '\cms\base\Configuration::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 @@ -54,7 +54,7 @@ class Value $res->addResolver('config', function($name) { $config_parts = explode('/', $name); - return '\'.config(' . "'" . implode("'" . ',' . "'", $config_parts) . "'" . ').\''; + return '\'.\template_engine\Output::config(' . "'" . implode("'" . ',' . "'", $config_parts) . "'" . ').\''; }); diff --git a/modules/util/GlobalFunctions.class.php b/modules/util/GlobalFunctions.class.php @@ -19,7 +19,7 @@ class GlobalFunctions } - public static function \cms\base\Language::lang($text) + public static function lang($text) { global $SESS; $text = strtoupper($text); @@ -33,5 +33,3 @@ class GlobalFunctions } - -?>- \ No newline at end of file diff --git a/modules/util/Html.class.php b/modules/util/Html.class.php @@ -71,7 +71,7 @@ class Html if ($conf['interface']['url']['add_sessionid']) $params[session_name()] = session_id(); - if (config('security', 'use_post_token')) + if (\cms\base\Configuration::config('security', 'use_post_token')) $params['token'] = Session::token(); $fake_urls = $conf['interface']['url']['fake_url']; diff --git a/modules/util/cache/FileCache.class.php b/modules/util/cache/FileCache.class.php @@ -43,7 +43,7 @@ class FileCache implements Cache $this->filename = $filename; $this->loader = $loader; - if ( config()->subset('publishing')->is('cache_enabled',false) ) + if ( \cms\base\Configuration::config()->subset('publishing')->is('cache_enabled',false) ) $this->invalidateIfOlderThan( $lastModified ); else $this->invalidateIfOlderThan( START_TIME ); // Invalidate all before this request. diff --git a/modules/util/text/variables/VariableResolver.class.php b/modules/util/text/variables/VariableResolver.class.php @@ -16,15 +16,38 @@ class VariableResolver public $defaultSeparator = ':'; public $renderOnlyVariables = false; + /** + * @var callable + */ + private $filterValue = null; + private $resolvers = []; private $value = null; + /** + * Adding a filter function for values. + * @param $filter callable + */ + public function addFilter( $filter ) { + $this->filterValue = $filter; + } + /** + * Adding a default variable resolver. + * @param $resolver callable + */ public function addDefaultResolver( $resolver ) { $this->resolvers[''] = $resolver; } + + /** + * Adding a variable resolver for a key. + * + * @param $key key + * @param $resolver callable + */ public function addResolver( $key, $resolver ) { $this->resolvers[$key] = $resolver; } @@ -97,6 +120,11 @@ class VariableResolver if ( ! $v ) $v = $this->render($expression->default); + if ( $this->filterValue ) { + $filter = $this->filterValue; + $v = $filter( $v ); + } + $text .= $v; }else { $text .= strval( $expression );