From ef1f1061b6fd709bb546e838415a839234031997 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sun, 5 Feb 2012 21:43:20 +0100 Subject: [PATCH] Implemented application paths in template Important notice: Do NOT use RELATIVE_WCF_DIR (or equal) in templates anymore, please use WCF::getPath('...') (use abbreviation) instead which resolves to the real domain path (e.g. WCF is on another domain/subdomain) Removed image viewer templates, they're worthless anyway. --- com.woltlab.wcf/template/headInclude.tpl | 16 ++++----- com.woltlab.wcf/template/imageViewer.tpl | 31 ----------------- .../files/acp/templates/imageViewer.tpl | 31 ----------------- .../install/files/lib/system/WCF.class.php | 33 +++++++++++++++++++ wcfsetup/install/lang/de.xml | 2 +- wcfsetup/install/lang/en.xml | 2 +- 6 files changed, 43 insertions(+), 72 deletions(-) delete mode 100644 com.woltlab.wcf/template/imageViewer.tpl delete mode 100644 wcfsetup/install/files/acp/templates/imageViewer.tpl diff --git a/com.woltlab.wcf/template/headInclude.tpl b/com.woltlab.wcf/template/headInclude.tpl index f1dd857c30..d0a0a6bb2d 100644 --- a/com.woltlab.wcf/template/headInclude.tpl +++ b/com.woltlab.wcf/template/headInclude.tpl @@ -7,14 +7,14 @@ - - - - + + + + - \ No newline at end of file diff --git a/wcfsetup/install/files/acp/templates/imageViewer.tpl b/wcfsetup/install/files/acp/templates/imageViewer.tpl deleted file mode 100644 index be642a90c3..0000000000 --- a/wcfsetup/install/files/acp/templates/imageViewer.tpl +++ /dev/null @@ -1,31 +0,0 @@ - - \ No newline at end of file diff --git a/wcfsetup/install/files/lib/system/WCF.class.php b/wcfsetup/install/files/lib/system/WCF.class.php index 4414239bcd..b94c769825 100644 --- a/wcfsetup/install/files/lib/system/WCF.class.php +++ b/wcfsetup/install/files/lib/system/WCF.class.php @@ -41,6 +41,12 @@ if (!defined('NO_IMPORTS')) { * @category Community Framework */ class WCF { + /** + * list of currently loaded applications + * @var array + */ + protected $applications = array(); + /** * list of autoload directories * @var array @@ -394,6 +400,10 @@ class WCF { $application = ApplicationHandler::getInstance()->getActiveApplication(); $this->loadApplication($application); + // register primary application + $abbreviation = ApplicationHandler::getInstance()->getAbbreviation($application->packageID); + $this->applications[$abbreviation] = $application; + // start dependent applications $applications = ApplicationHandler::getInstance()->getDependentApplications(); foreach ($applications as $application) { @@ -446,6 +456,9 @@ class WCF { // assign base tag $this->getTPL()->assign('baseHref', $application->domainName . $application->domainPath); } + + // register application + $this->applications[$abbreviation] = $application; } /** @@ -589,4 +602,24 @@ class WCF { if (!defined('ENABLE_BENCHMARK') || ENABLE_BENCHMARK) return true; return false; } + + /** + * Returns domain path for given application. + * + * @param string $abbreviation + * @return string + */ + public function getPath($abbreviation = 'wcf') { + if (empty($this->applications)) { + $this->applications = array( + 'wcf' => new Application(1) + ); + } + + if (!isset($this->applications[$abbreviation])) { + $abbreviation = 'wcf'; + } + + return $this->applications[$abbreviation]->domainName . $this->applications[$abbreviation]->domainPath; + } } diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 0d0410cf6a..1dc8f031f9 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -26,7 +26,7 @@ - Newbie: Intro to cron]]> + getPath('wcf')}acp/dereferrer.php?url={"http://www.unixgeeks.org/security/newbie/unix/cron-1.html"|rawurlencode}" class="externalURL">Newbie: Intro to cron]]> diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index 20eb892862..a742d0fa84 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -26,7 +26,7 @@ - Newbie: Intro to cron.]]> + getPath('wcf')}acp/dereferrer.php?url={"http://www.unixgeeks.org/security/newbie/unix/cron-1.html"|rawurlencode}" class="externalURL">Newbie: Intro to cron.]]> -- 2.20.1