diff options
author | Björn Schießle <bjoern@schiessle.org> | 2013-07-24 06:42:52 -0700 |
---|---|---|
committer | Björn Schießle <bjoern@schiessle.org> | 2013-07-24 06:42:52 -0700 |
commit | 651479322b234eefff15031b188b353793cc7af5 (patch) | |
tree | 10d154129e3bc54d4fa5b2b3fab96b3f6293b25f | |
parent | 98858e6f00bbafc6b93a9c01b3ad8a6d826d5373 (diff) | |
parent | 003ae7b9165b6493abe75d1d81b5a763efef7280 (diff) | |
download | nextcloud-server-651479322b234eefff15031b188b353793cc7af5.tar.gz nextcloud-server-651479322b234eefff15031b188b353793cc7af5.zip |
Merge pull request #4177 from owncloud/move_defaults_to_template_constructor
Move defaults to template constructor
-rw-r--r-- | apps/files_sharing/templates/public.php | 8 | ||||
-rw-r--r-- | apps/user_ldap/templates/settings.php | 4 | ||||
-rw-r--r-- | core/templates/altmail.php | 6 | ||||
-rw-r--r-- | core/templates/installation.php | 4 | ||||
-rw-r--r-- | core/templates/layout.base.php | 4 | ||||
-rw-r--r-- | core/templates/layout.guest.php | 10 | ||||
-rw-r--r-- | core/templates/layout.user.php | 8 | ||||
-rw-r--r-- | core/templates/mail.php | 9 | ||||
-rw-r--r-- | lib/template.php | 3 | ||||
-rw-r--r-- | lib/template/base.php | 5 | ||||
-rw-r--r-- | settings/templates/admin.php | 12 | ||||
-rw-r--r-- | settings/templates/personal.php | 8 |
12 files changed, 35 insertions, 46 deletions
diff --git a/apps/files_sharing/templates/public.php b/apps/files_sharing/templates/public.php index 8875d5a8fbd..746a715f3cc 100644 --- a/apps/files_sharing/templates/public.php +++ b/apps/files_sharing/templates/public.php @@ -2,16 +2,14 @@ <div id="notification" style="display: none;"></div> </div> -<?php $defaults = new OCP\Defaults(); // initialize themable default strings and urls ?> - <input type="hidden" name="dir" value="<?php p($_['dir']) ?>" id="dir"> <input type="hidden" name="downloadURL" value="<?php p($_['downloadURL']) ?>" id="downloadURL"> <input type="hidden" name="filename" value="<?php p($_['filename']) ?>" id="filename"> <input type="hidden" name="mimetype" value="<?php p($_['mimetype']) ?>" id="mimetype"> <header><div id="header"> <a href="<?php print_unescaped(link_to('', 'index.php')); ?>" title="" id="owncloud"><img class="svg" - src="<?php print_unescaped(image_path('', 'logo-wide.svg')); ?>" alt="<?php p($defaults->getName()); ?>" /></a> - <div id="logo-claim" style="display:none;"><?php p($defaults->getLogoClaim()); ?></div> + src="<?php print_unescaped(image_path('', 'logo-wide.svg')); ?>" alt="<?php p($theme->getName()); ?>" /></a> + <div id="logo-claim" style="display:none;"><?php p($theme->getLogoClaim()); ?></div> <div class="header-right"> <?php if (isset($_['folder'])): ?> <span id="details"><?php p($l->t('%s shared the folder %s with you', @@ -95,6 +93,6 @@ </div> <footer> <p class="info"> - <?php print_unescaped($defaults->getLongFooter()); ?> + <?php print_unescaped($theme->getLongFooter()); ?> </p> </footer> diff --git a/apps/user_ldap/templates/settings.php b/apps/user_ldap/templates/settings.php index 48a9a7aec6d..95aa592594b 100644 --- a/apps/user_ldap/templates/settings.php +++ b/apps/user_ldap/templates/settings.php @@ -75,7 +75,7 @@ <p><label for="ldap_override_main_server"><?php p($l->t('Disable Main Server'));?></label><input type="checkbox" id="ldap_override_main_server" name="ldap_override_main_server" value="1" data-default="<?php p($_['ldap_override_main_server_default']); ?>" title="<?php p($l->t('Only connect to the replica server.'));?>" /></p> <p><label for="ldap_tls"><?php p($l->t('Use TLS'));?></label><input type="checkbox" id="ldap_tls" name="ldap_tls" value="1" data-default="<?php p($_['ldap_tls_default']); ?>" title="<?php p($l->t('Do not use it additionally for LDAPS connections, it will fail.'));?>" /></p> <p><label for="ldap_nocase"><?php p($l->t('Case insensitve LDAP server (Windows)'));?></label><input type="checkbox" id="ldap_nocase" name="ldap_nocase" data-default="<?php p($_['ldap_nocase_default']); ?>" value="1"<?php if (isset($_['ldap_nocase']) && ($_['ldap_nocase'])) p(' checked'); ?>></p> - <p><label for="ldap_turn_off_cert_check"><?php p($l->t('Turn off SSL certificate validation.'));?></label><input type="checkbox" id="ldap_turn_off_cert_check" name="ldap_turn_off_cert_check" title="<?php p($l->t('If connection only works with this option, import the LDAP server\'s SSL certificate in your %s server.', $defaults->getName() ));?>" data-default="<?php p($_['ldap_turn_off_cert_check_default']); ?>" value="1"><br/><small><?php p($l->t('Not recommended, use for testing only.'));?></small></p> + <p><label for="ldap_turn_off_cert_check"><?php p($l->t('Turn off SSL certificate validation.'));?></label><input type="checkbox" id="ldap_turn_off_cert_check" name="ldap_turn_off_cert_check" title="<?php p($l->t('If connection only works with this option, import the LDAP server\'s SSL certificate in your %s server.', $theme->getName() ));?>" data-default="<?php p($_['ldap_turn_off_cert_check_default']); ?>" value="1"><br/><small><?php p($l->t('Not recommended, use for testing only.'));?></small></p> <p><label for="ldap_cache_ttl"><?php p($l->t('Cache Time-To-Live'));?></label><input type="number" id="ldap_cache_ttl" name="ldap_cache_ttl" title="<?php p($l->t('in seconds. A change empties the cache.'));?>" data-default="<?php p($_['ldap_cache_ttl_default']); ?>" /></p> </div> <h3><?php p($l->t('Directory Settings'));?></h3> @@ -108,7 +108,7 @@ <p class="ldapIndent"><?php p($l->t('Usernames are used to store and assign (meta) data. In order to precisely identify and recognize users, each LDAP user will have a internal username. This requires a mapping from username to LDAP user. The created username is mapped to the UUID of the LDAP user. Additionally the DN is cached as well to reduce LDAP interaction, but it is not used for identification. If the DN changes, the changes will be found. The internal username is used all over. Clearing the mappings will have leftovers everywhere. Clearing the mappings is not configuration sensitive, it affects all LDAP configurations! Never clear the mappings in a production environment, only in a testing or experimental stage.'));?></p> <p class="ldapIndent"><button id="ldap_action_clear_user_mappings" name="ldap_action_clear_user_mappings"><?php p($l->t('Clear Username-LDAP User Mapping'));?></button><br/><button id="ldap_action_clear_group_mappings" name="ldap_action_clear_group_mappings"><?php p($l->t('Clear Groupname-LDAP Group Mapping'));?></button></p> </fieldset> - <input id="ldap_submit" type="submit" value="Save" /> <button id="ldap_action_test_connection" name="ldap_action_test_connection"><?php p($l->t('Test Configuration'));?></button> <a href="<?php p($defaults->getDocBaseUrl()); ?>/server/5.0/admin_manual/auth_ldap.html" target="_blank"><img src="<?php print_unescaped(OCP\Util::imagePath('', 'actions/info.png')); ?>" style="height:1.75ex" /> <?php p($l->t('Help'));?></a> + <input id="ldap_submit" type="submit" value="Save" /> <button id="ldap_action_test_connection" name="ldap_action_test_connection"><?php p($l->t('Test Configuration'));?></button> <a href="<?php p($theme->getDocBaseUrl()); ?>/server/5.0/admin_manual/auth_ldap.html" target="_blank"><img src="<?php print_unescaped(OCP\Util::imagePath('', 'actions/info.png')); ?>" style="height:1.75ex" /> <?php p($l->t('Help'));?></a> </div> </form> diff --git a/core/templates/altmail.php b/core/templates/altmail.php index a7df29a2446..2551473c6f0 100644 --- a/core/templates/altmail.php +++ b/core/templates/altmail.php @@ -1,9 +1,7 @@ <?php -$defaults = new OC_Defaults(); - print_unescaped($l->t("Hey there,\n\njust letting you know that %s shared %s with you.\nView it: %s\n\nCheers!", array($_['user_displayname'], $_['filename'], $_['link']))); ?> -- -<?php p($defaults->getName() . ' - ' . $defaults->getSlogan()); ?> -<?php print_unescaped("\n".$defaults->getBaseUrl()); +<?php p($theme->getName() . ' - ' . $theme->getSlogan()); ?> +<?php print_unescaped("\n".$theme->getBaseUrl()); diff --git a/core/templates/installation.php b/core/templates/installation.php index a87853cbef3..6de67a83d42 100644 --- a/core/templates/installation.php +++ b/core/templates/installation.php @@ -23,7 +23,7 @@ <fieldset class="warning"> <legend><strong><?php p($l->t('Security Warning'));?></strong></legend> <p><?php p($l->t('Your PHP version is vulnerable to the NULL Byte attack (CVE-2006-7243)'));?><br/> - <?php p($l->t('Please update your PHP installation to use %s securely.', $defaults->getName() )); ?></p> + <?php p($l->t('Please update your PHP installation to use %s securely.', $theme->getName() )); ?></p> </fieldset> <?php endif; ?> <?php if(!$_['secureRNG']): ?> @@ -39,7 +39,7 @@ <p><?php p($l->t('Your data directory and files are probably accessible from the internet because the .htaccess file does not work.'));?><br> <?php print_unescaped($l->t( 'For information how to properly configure your server, please see the <a href="%s" target="_blank">documentation</a>.', - $defaults->getDocBaseUrl().'/server/5.0/admin_manual/installation.html' + $theme->getDocBaseUrl().'/server/5.0/admin_manual/installation.html' )); ?></p> </fieldset> <?php endif; ?> diff --git a/core/templates/layout.base.php b/core/templates/layout.base.php index 2399512eacd..ea10c3042b5 100644 --- a/core/templates/layout.base.php +++ b/core/templates/layout.base.php @@ -6,11 +6,9 @@ <!--[if gt IE 9]><html class="ng-csp ie"><![endif]--> <!--[if !IE]><!--><html class="ng-csp"><!--<![endif]--> - <?php $defaults = new OC_Defaults(); // initialize themable default strings and urls ?> - <head> <title> - <?php p($defaults->getTitle()); ?> + <?php p($theme->getTitle()); ?> </title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="shortcut icon" href="<?php print_unescaped(image_path('', 'favicon.png')); ?>" /> diff --git a/core/templates/layout.guest.php b/core/templates/layout.guest.php index e20d28970a5..9f645b6500d 100644 --- a/core/templates/layout.guest.php +++ b/core/templates/layout.guest.php @@ -6,11 +6,9 @@ <!--[if gt IE 9]><html class="ng-csp ie"><![endif]--> <!--[if !IE]><!--><html class="ng-csp"><!--<![endif]--> - <?php $defaults = new OC_Defaults(); // initialize themable default strings and urls ?> - <head data-requesttoken="<?php p($_['requesttoken']); ?>"> <title> - <?php p($defaults->getTitle()); ?> + <?php p($theme->getTitle()); ?> </title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="apple-itunes-app" content="app-id=543672169"> @@ -37,14 +35,14 @@ <body id="body-login"> <div id="login"> <header><div id="header"> - <img src="<?php print_unescaped(image_path('', 'logo.svg')); ?>" class="svg" alt="<?php p($defaults->getName()); ?>" /> - <div id="logo-claim" style="display:none;"><?php p($defaults->getLogoClaim()); ?></div> + <img src="<?php print_unescaped(image_path('', 'logo.svg')); ?>" class="svg" alt="<?php p($theme->getName()); ?>" /> + <div id="logo-claim" style="display:none;"><?php p($theme->getLogoClaim()); ?></div> </div></header> <?php print_unescaped($_['content']); ?> </div> <footer> <p class="info"> - <?php print_unescaped($defaults->getLongFooter()); ?> + <?php print_unescaped($theme->getLongFooter()); ?> </p></footer> </body> </html> diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php index 87c02a83d3b..b7405ea273b 100644 --- a/core/templates/layout.user.php +++ b/core/templates/layout.user.php @@ -6,12 +6,10 @@ <!--[if gt IE 9]><html class="ng-csp ie"><![endif]--> <!--[if !IE]><!--><html class="ng-csp"><!--<![endif]--> - <?php $defaults = new OC_Defaults(); // initialize themable default strings and urls ?> - <head data-user="<?php p($_['user_uid']); ?>" data-requesttoken="<?php p($_['requesttoken']); ?>"> <title> <?php p(!empty($_['application'])?$_['application'].' | ':''); - p($defaults->getTitle()); + p($theme->getTitle()); p(trim($_['user_displayname']) != '' ?' ('.$_['user_displayname'].') ':'') ?> </title> <meta charset="utf-8"> @@ -45,8 +43,8 @@ </div> <header><div id="header"> <a href="<?php print_unescaped(link_to('', 'index.php')); ?>" title="" id="owncloud"><img class="svg" - src="<?php print_unescaped(image_path('', 'logo-wide.svg')); ?>" alt="<?php p($defaults->getName()); ?>" /></a> - <div id="logo-claim" style="display:none;"><?php p($defaults->getLogoClaim()); ?></div> + src="<?php print_unescaped(image_path('', 'logo-wide.svg')); ?>" alt="<?php p($theme->getName()); ?>" /></a> + <div id="logo-claim" style="display:none;"><?php p($theme->getLogoClaim()); ?></div> <ul id="settings" class="svg"> <span id="expand" tabindex="0" role="link"> <span id="expandDisplayName"><?php p(trim($_['user_displayname']) != '' ? $_['user_displayname'] : $_['user_uid']) ?></span> diff --git a/core/templates/mail.php b/core/templates/mail.php index a9fdff06067..de72b136b13 100644 --- a/core/templates/mail.php +++ b/core/templates/mail.php @@ -1,11 +1,10 @@ -<?php $defaults = new OC_Defaults() // initialize themable default strings and urls ?> <table cellspacing="0" cellpadding="0" border="0" width="100%"> <tr><td> <table cellspacing="0" cellpadding="0" border="0" width="600px"> <tr> <td bgcolor="#1d2d44" width="20px"> </td> <td bgcolor="#1d2d44"> -<img src="<?php print_unescaped(OC_Helper::makeURLAbsolute(image_path('', 'logo-mail.gif'))); ?>" alt="<?php p($defaults->getName()); ?>"/> +<img src="<?php print_unescaped(OC_Helper::makeURLAbsolute(image_path('', 'logo-mail.gif'))); ?>" alt="<?php p($theme->getName()); ?>"/> </td> </tr> <tr><td bgcolor="#f8f8f8" colspan="2"> </td></tr> @@ -21,9 +20,9 @@ print_unescaped($l->t('Hey there,<br><br>just letting you know that %s shared » <tr> <td bgcolor="#f8f8f8" width="20px"> </td> <td bgcolor="#f8f8f8" style="font-weight:normal; font-size:0.8em; line-height:1.2em; font-family:verdana,'arial',sans;">--<br> -<?php p($defaults->getName()); ?> - -<?php p($defaults->getSlogan()); ?> -<br><a href="<?php print_unescaped($defaults->getBaseUrl()); ?>"><?php print_unescaped($defaults->getBaseUrl());?></a></td> +<?php p($theme->getName()); ?> - +<?php p($theme->getSlogan()); ?> +<br><a href="<?php print_unescaped($theme->getBaseUrl()); ?>"><?php print_unescaped($theme->getBaseUrl());?></a></td> </tr> <tr> <td bgcolor="#f8f8f8" colspan="2"> </td> diff --git a/lib/template.php b/lib/template.php index d17be753db8..9b2c1211e61 100644 --- a/lib/template.php +++ b/lib/template.php @@ -55,6 +55,7 @@ class OC_Template extends \OC\Template\Base { $parts = explode('/', $app); // fix translation when app is something like core/lostpassword $l10n = OC_L10N::get($parts[0]); + $themeDefaults = new OC_Defaults(); list($path, $template) = $this->findTemplate($theme, $app, $name, $fext); @@ -62,7 +63,7 @@ class OC_Template extends \OC\Template\Base { $this->renderas = $renderas; $this->path = $path; - parent::__construct($template, $requesttoken, $l10n); + parent::__construct($template, $requesttoken, $l10n, $themeDefaults); // Some headers to enhance security header('X-XSS-Protection: 1; mode=block'); // Enforce browser based XSS filters diff --git a/lib/template/base.php b/lib/template/base.php index c7ddaa2e8e1..88941bc7132 100644 --- a/lib/template/base.php +++ b/lib/template/base.php @@ -12,12 +12,14 @@ class Base { private $template; // The template private $vars; // Vars private $l10n; // The l10n-Object + private $theme; // theme defaults - public function __construct( $template, $requesttoken, $l10n ) { + public function __construct( $template, $requesttoken, $l10n, $theme ) { $this->vars = array(); $this->vars['requesttoken'] = $requesttoken; $this->l10n = $l10n; $this->template = $template; + $this->theme = $theme; } protected function getAppTemplateDirs($theme, $app, $serverroot, $app_dir) { @@ -113,6 +115,7 @@ class Base { // Register the variables $_ = $this->vars; $l = $this->l10n; + $theme = $this->theme; if( !is_null($additionalparams)) { $_ = array_merge( $additionalparams, $this->vars ); diff --git a/settings/templates/admin.php b/settings/templates/admin.php index 52127f6710d..2b14c1460d6 100644 --- a/settings/templates/admin.php +++ b/settings/templates/admin.php @@ -4,8 +4,6 @@ * See the COPYING-README file. */ $levels = array('Debug', 'Info', 'Warning', 'Error', 'Fatal'); - -$defaults = new OC_Defaults(); // initialize themable default strings and urls ?> <?php @@ -32,7 +30,7 @@ if (!$_['isWebDavWorking']) { <span class="securitywarning"> <?php p($l->t('Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken.')); ?> - <?php print_unescaped($l->t('Please double check the <a href="%s">installation guides</a>.', $defaults->getDocBaseUrl().'/server/5.0/admin_manual/installation.html')); ?> + <?php print_unescaped($l->t('Please double check the <a href="%s">installation guides</a>.', $theme->getDocBaseUrl().'/server/5.0/admin_manual/installation.html')); ?> </span> </fieldset> @@ -193,13 +191,13 @@ if (!$_['internetconnectionworking']) { <label for="forcessl"><?php p($l->t('Enforce HTTPS'));?></label><br/> <em><?php p($l->t( 'Forces the clients to connect to %s via an encrypted connection.', - $defaults->getName() + $theme->getName() )); ?></em> <?php if (!$_['isConnectedViaHTTPS']) { print_unescaped("<br/><em>"); p($l->t( 'Please connect to your %s via HTTPS to enable or disable the SSL enforcement.', - $defaults->getName() + $theme->getName() )); print_unescaped("</em>"); } @@ -250,7 +248,7 @@ endfor;?> <fieldset class="personalblock"> <legend><strong><?php p($l->t('Version'));?></strong></legend> - <strong><?php p($defaults->getTitle()); ?></strong> <?php p(OC_Util::getVersionString()); ?> + <strong><?php p($theme->getTitle()); ?></strong> <?php p(OC_Util::getVersionString()); ?> <?php if (OC_Util::getEditionString() === ''): ?> <p> <?php print_unescaped($l->t('Developed by the <a href="http://ownCloud.org/contact" target="_blank">ownCloud community</a>, the <a href="https://github.com/owncloud" target="_blank">source code</a> is licensed under the <a href="http://www.gnu.org/licenses/agpl-3.0.html" target="_blank"><abbr title="Affero General Public License">AGPL</abbr></a>.')); ?> @@ -259,6 +257,6 @@ endfor;?> </fieldset> <fieldset class="personalblock credits-footer"> <p> - <?php print_unescaped($defaults->getShortFooter()); ?> + <?php print_unescaped($theme->getShortFooter()); ?> </p> </fieldset> diff --git a/settings/templates/personal.php b/settings/templates/personal.php index ee5ebae708f..b9d9b09f5d0 100644 --- a/settings/templates/personal.php +++ b/settings/templates/personal.php @@ -4,8 +4,6 @@ * See the COPYING-README file. */?> -<?php $defaults = new OC_Defaults(); // initialize themable default strings and urls ?> - <div class="clientsbox"> <h2><?php p($l->t('Get the apps to sync your files'));?></h2> <a href="<?php p($_['clients']['desktop']); ?>" target="_blank"> @@ -105,7 +103,7 @@ if($_['passwordChangeSupported']) { <fieldset class="personalblock"> <legend><strong><?php p($l->t('WebDAV'));?></strong></legend> <code><?php print_unescaped(OC_Helper::linkToRemote('webdav')); ?></code><br /> - <em><?php print_unescaped($l->t('Use this address to <a href="%s/server/5.0/user_manual/files/files.html" target="_blank">access your Files via WebDAV</a>', array($defaults->getDocBaseUrl())));?></em> + <em><?php print_unescaped($l->t('Use this address to <a href="%s/server/5.0/user_manual/files/files.html" target="_blank">access your Files via WebDAV</a>', array($theme->getDocBaseUrl())));?></em> </fieldset> <?php foreach($_['forms'] as $form) { @@ -114,13 +112,13 @@ if($_['passwordChangeSupported']) { <fieldset class="personalblock"> <legend><strong><?php p($l->t('Version'));?></strong></legend> - <strong><?php p($defaults->getName()); ?></strong> <?php p(OC_Util::getVersionString()); ?><br/> + <strong><?php p($theme->getName()); ?></strong> <?php p(OC_Util::getVersionString()); ?><br/> <?php if (OC_Util::getEditionString() === ''): ?> <?php print_unescaped($l->t('Developed by the <a href="http://ownCloud.org/contact" target="_blank">ownCloud community</a>, the <a href="https://github.com/owncloud" target="_blank">source code</a> is licensed under the <a href="http://www.gnu.org/licenses/agpl-3.0.html" target="_blank"><abbr title="Affero General Public License">AGPL</abbr></a>.')); ?> <?php endif; ?> </fieldset> <fieldset class="personalblock credits-footer"> <p> - <?php print_unescaped($defaults->getShortFooter()); ?> + <?php print_unescaped($theme->getShortFooter()); ?> </p> </fieldset> |