From: Alexander Ebert Date: Sun, 5 Feb 2012 20:43:20 +0000 (+0100) Subject: Implemented application paths in template X-Git-Tag: 2.0.0_Beta_1~1360^2~23 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ef1f1061b6fd709bb546e838415a839234031997;p=GitHub%2FWoltLab%2FWCF.git 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. --- 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.]]>