diff options
author | Jörn Friedrich Dreyer <jfd@butonic.de> | 2014-01-07 22:28:58 -0800 |
---|---|---|
committer | Jörn Friedrich Dreyer <jfd@butonic.de> | 2014-01-07 22:28:58 -0800 |
commit | f356894aa3f30c12cf4d6da0a98e1c0cd2881865 (patch) | |
tree | 16b0c426f0e5ab30a4d9b2bb914539f99f8d9727 /lib | |
parent | a7d0ab96c100a5a94b36bf7b311df02e1606a1d2 (diff) | |
parent | 6254f0a403e315461f8e20ebccf71cb91e9313a3 (diff) | |
download | nextcloud-server-f356894aa3f30c12cf4d6da0a98e1c0cd2881865.tar.gz nextcloud-server-f356894aa3f30c12cf4d6da0a98e1c0cd2881865.zip |
Merge pull request #6594 from owncloud/kill-index.php-from-url
Kill index.php from url
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/server.php | 5 | ||||
-rw-r--r-- | lib/private/template/cssresourcelocator.php | 2 | ||||
-rw-r--r-- | lib/private/urlgenerator.php | 25 |
3 files changed, 28 insertions, 4 deletions
diff --git a/lib/private/server.php b/lib/private/server.php index bee70dec2df..5977ee9b5a0 100644 --- a/lib/private/server.php +++ b/lib/private/server.php @@ -128,7 +128,8 @@ class Server extends SimpleContainer implements IServerContainer { return new \OC\L10N\Factory(); }); $this->registerService('URLGenerator', function($c) { - return new \OC\URLGenerator(); + $config = $this->getConfig(); + return new \OC\URLGenerator($config); }); $this->registerService('AppHelper', function($c) { return new \OC\AppHelper(); @@ -257,7 +258,7 @@ class Server extends SimpleContainer implements IServerContainer { } /** - * @return \OC\Config + * @return \OCP\IConfig */ function getConfig() { return $this->query('AllConfig'); diff --git a/lib/private/template/cssresourcelocator.php b/lib/private/template/cssresourcelocator.php index 8e7831ca549..e26daa25827 100644 --- a/lib/private/template/cssresourcelocator.php +++ b/lib/private/template/cssresourcelocator.php @@ -22,7 +22,7 @@ class CSSResourceLocator extends ResourceLocator { $app = substr($style, 0, strpos($style, '/')); $style = substr($style, strpos($style, '/')+1); $app_path = \OC_App::getAppPath($app); - $app_url = $this->webroot . '/index.php/apps/' . $app; + $app_url = \OC_App::getAppWebPath($app); if ($this->appendIfExist($app_path, $style.$this->form_factor.'.css', $app_url) || $this->appendIfExist($app_path, $style.'.css', $app_url) ) { diff --git a/lib/private/urlgenerator.php b/lib/private/urlgenerator.php index 7795011fd06..4e3c1109000 100644 --- a/lib/private/urlgenerator.php +++ b/lib/private/urlgenerator.php @@ -15,6 +15,19 @@ use RuntimeException; * Class to generate URLs */ class URLGenerator implements IURLGenerator { + + /** + * @var \OCP\IConfig + */ + private $config; + + /** + * @param \OCP\IConfig $config + */ + public function __construct($config) { + $this->config = $config; + } + /** * @brief Creates an url using a defined route * @param $route @@ -41,12 +54,18 @@ class URLGenerator implements IURLGenerator { * Returns a url to the given app and file. */ public function linkTo( $app, $file, $args = array() ) { + $frontControllerActive=($this->config->getSystemValue('front_controller_active', 'false') == 'true'); + if( $app != '' ) { $app_path = \OC_App::getAppPath($app); // Check if the app is in the app folder if ($app_path && file_exists($app_path . '/' . $file)) { if (substr($file, -3) == 'php' || substr($file, -3) == 'css') { + $urlLinkTo = \OC::$WEBROOT . '/index.php/apps/' . $app; + if ($frontControllerActive) { + $urlLinkTo = \OC::$WEBROOT . '/apps/' . $app; + } $urlLinkTo .= ($file != 'index.php') ? '/' . $file : ''; } else { $urlLinkTo = \OC_App::getAppWebPath($app) . '/' . $file; @@ -58,7 +77,11 @@ class URLGenerator implements IURLGenerator { if (file_exists(\OC::$SERVERROOT . '/core/' . $file)) { $urlLinkTo = \OC::$WEBROOT . '/core/' . $file; } else { - $urlLinkTo = \OC::$WEBROOT . '/' . $file; + if ($frontControllerActive && $file === 'index.php') { + $urlLinkTo = \OC::$WEBROOT; + } else { + $urlLinkTo = \OC::$WEBROOT . '/' . $file; + } } } |