diff --git a/lib/Controller/NavigationController.php b/lib/Controller/NavigationController.php index ba50f74a..0409ef90 100644 --- a/lib/Controller/NavigationController.php +++ b/lib/Controller/NavigationController.php @@ -145,20 +145,32 @@ class NavigationController extends Controller { try { $data['serverData']['cloudAddress'] = $this->configService->getCloudAddress(); } catch (SocialAppConfigException $e) { - $data['serverData']['setup'] = true; - $data['serverData']['isAdmin'] = \OC::$server->getGroupManager() - ->isAdmin($this->userId); - if ($data['serverData']['isAdmin']) { - $cloudAddress = $this->request->getParam('cloudAddress'); - if ($cloudAddress !== null) { - $this->configService->setCloudAddress($cloudAddress); - } else { - $data['serverData']['cliUrl'] = $this->config->getSystemValue( - 'overwrite.cli.url', \OC::$server->getURLGenerator() - ->getBaseUrl() - ); + $cloudAddress = rtrim( + $this->config->getSystemValue('overwrite.cli.url', ''), '/' + ); + $frontControllerActive = ($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true'); + if ($cloudAddress !== ''){ + if (!$frontControllerActive){ + $cloudAddress .= '/index.php'; + } + $this->configService->setCloudAddress($cloudAddress); + $data['serverData']['cloudAddress'] = $cloudAddress; + } else { + $data['serverData']['setup'] = true; + $data['serverData']['isAdmin'] = \OC::$server->getGroupManager() + ->isAdmin($this->userId); + if ($data['serverData']['isAdmin']) { + $cloudAddress = $this->request->getParam('cloudAddress'); + if ($cloudAddress !== null) { + $this->configService->setCloudAddress($cloudAddress); + } else { + $data['serverData']['cliUrl'] = $this->config->getSystemValue( + 'overwrite.cli.url', \OC::$server->getURLGenerator() + ->getBaseUrl() + ); - return new TemplateResponse(Application::APP_NAME, 'main', $data); + return new TemplateResponse(Application::APP_NAME, 'main', $data); + } } } }