]> source.dussan.org Git - nextcloud-server.git/commitdiff
initialize OC_Defaults in template constructorX
authorBjörn Schießle <schiessle@owncloud.com>
Wed, 24 Jul 2013 09:51:21 +0000 (11:51 +0200)
committerBjörn Schießle <schiessle@owncloud.com>
Wed, 24 Jul 2013 09:51:21 +0000 (11:51 +0200)
apps/files_sharing/templates/public.php
core/templates/altmail.php
core/templates/layout.base.php
core/templates/layout.guest.php
core/templates/layout.user.php
core/templates/mail.php
lib/template.php
lib/template/base.php
settings/templates/admin.php
settings/templates/personal.php

index 8875d5a8fbdfac91a8a2f5584c6b92d40d9dea85..746a715f3cc3d95d6e523c348399e49ae9ab3684 100644 (file)
@@ -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>
index a7df29a2446d244cc27371d81d0cfdd649424b46..2551473c6f0939364d95f3739201709281b08a41 100644 (file)
@@ -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());
index 2399512eacd456fe61635b34c675e99c443831df..ea10c3042b592f7f192d9723be89e68493a14e6e 100644 (file)
@@ -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')); ?>" />
index e20d28970a5d89cbcf30b9377b5abbced2234574..9f645b6500d7e5996e726a58b3dab06bb767abc2 100644 (file)
@@ -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">
        <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>
index 87c02a83d3b470c9aaa30345f43852ff37d518a3..b7405ea273b7f2c6bc8b70cf8e3bc3c3f1086eb5 100644 (file)
@@ -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>
index a9fdff06067cacc223def5d2a2f3994c1aa0d09d..de72b136b135149a73b09bf04b7dbb2b55b12cc4 100644 (file)
@@ -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">&nbsp;</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">&nbsp;</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">&nbsp;</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">&nbsp;</td>
index d17be753db86870f36d962c2d40250f1d7693d11..9b2c1211e61c8e2b3dbb21c02c2dabfe87a5399d 100644 (file)
@@ -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
index c7ddaa2e8e1ed58155361a249f56ea68f2aeb27b..88941bc7132d7144ee05d7eaa9875c50f2809ee7 100644 (file)
@@ -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 );
index 52127f6710dc880bf92af937c03d2b522ffdfda3..2b14c1460d6b538316c50dc9c98c170a1079dee0 100644 (file)
@@ -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>
index ee5ebae708ffa022755a61f3d151dff67444640c..b9d9b09f5d0149b7416a1eef743991a1a9cf346f 100644 (file)
@@ -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>