Improve App->runFrontend formatting
- Use single-quotes instead of double - Use strpos() instead of substr() - Add/remove comments - Use Config::get default value and drop the exact match for config.private_addons
This commit is contained in:
parent
e2ac36e43e
commit
e2c5a423c5
1 changed files with 9 additions and 16 deletions
25
src/App.php
25
src/App.php
|
@ -1649,12 +1649,13 @@ class App
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->getMode()->isInstall()) {
|
if (!$this->getMode()->isInstall()) {
|
||||||
|
// Force SSL redirection
|
||||||
if (Core\Config::get('system', 'force_ssl') && ($this->getScheme() == "http")
|
if (Core\Config::get('system', 'force_ssl') && ($this->getScheme() == "http")
|
||||||
&& (intval(Core\Config::get('system', 'ssl_policy')) == SSL_POLICY_FULL)
|
&& intval(Core\Config::get('system', 'ssl_policy')) == SSL_POLICY_FULL
|
||||||
&& (substr($this->getBaseURL(), 0, 8) == "https://")
|
&& strpos($this->getBaseURL(), 'https://') === 0
|
||||||
&& ($_SERVER['REQUEST_METHOD'] == 'GET')) {
|
&& $_SERVER['REQUEST_METHOD'] == 'GET') {
|
||||||
header("HTTP/1.1 302 Moved Temporarily");
|
header('HTTP/1.1 302 Moved Temporarily');
|
||||||
header("Location: " . $this->getBaseURL() . "/" . $this->query_string);
|
header('Location: ' . $this->getBaseURL() . '/' . $this->query_string);
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1666,14 +1667,6 @@ class App
|
||||||
|
|
||||||
Core\L10n::loadTranslationTable($lang);
|
Core\L10n::loadTranslationTable($lang);
|
||||||
|
|
||||||
/**
|
|
||||||
* Important stuff we always need to do.
|
|
||||||
*
|
|
||||||
* The order of these may be important so use caution if you think they're all
|
|
||||||
* intertwingled with no logical order and decide to sort it out. Some of the
|
|
||||||
* dependencies have changed, but at least at one time in the recent past - the
|
|
||||||
* order was critical to everything working properly
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Exclude the backend processes from the session management
|
// Exclude the backend processes from the session management
|
||||||
if (!$this->isBackend()) {
|
if (!$this->isBackend()) {
|
||||||
|
@ -1705,6 +1698,7 @@ class App
|
||||||
Core\L10n::loadTranslationTable($lang);
|
Core\L10n::loadTranslationTable($lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ZRL
|
||||||
if (!empty($_GET['zrl']) && $this->getMode()->isNormal()) {
|
if (!empty($_GET['zrl']) && $this->getMode()->isNormal()) {
|
||||||
$this->query_string = Model\Profile::stripZrls($this->query_string);
|
$this->query_string = Model\Profile::stripZrls($this->query_string);
|
||||||
if (!local_user()) {
|
if (!local_user()) {
|
||||||
|
@ -1813,11 +1807,10 @@ class App
|
||||||
$this->module = "login";
|
$this->module = "login";
|
||||||
}
|
}
|
||||||
|
|
||||||
$privateapps = Core\Config::get('config', 'private_addons');
|
$privateapps = Core\Config::get('config', 'private_addons', false);
|
||||||
|
|
||||||
if (is_array($this->addons) && in_array($this->module, $this->addons) && file_exists("addon/{$this->module}/{$this->module}.php")) {
|
if (is_array($this->addons) && in_array($this->module, $this->addons) && file_exists("addon/{$this->module}/{$this->module}.php")) {
|
||||||
//Check if module is an app and if public access to apps is allowed or not
|
//Check if module is an app and if public access to apps is allowed or not
|
||||||
if ((!local_user()) && Core\Addon::isApp($this->module) && $privateapps === "1") {
|
if ((!local_user()) && Core\Addon::isApp($this->module) && $privateapps) {
|
||||||
info(Core\L10n::t("You must be logged in to use addons. "));
|
info(Core\L10n::t("You must be logged in to use addons. "));
|
||||||
} else {
|
} else {
|
||||||
include_once "addon/{$this->module}/{$this->module}.php";
|
include_once "addon/{$this->module}/{$this->module}.php";
|
||||||
|
|
Loading…
Reference in a new issue