aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Web/Router.php
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs/Web/Router.php')
-rw-r--r--Zotlabs/Web/Router.php33
1 files changed, 17 insertions, 16 deletions
diff --git a/Zotlabs/Web/Router.php b/Zotlabs/Web/Router.php
index f2604b95d..122e7ff73 100644
--- a/Zotlabs/Web/Router.php
+++ b/Zotlabs/Web/Router.php
@@ -37,6 +37,7 @@ class Router {
private $modname = '';
private $controller = null;
+ private bool $module_loaded = false;
/**
* @brief Router constructor.
@@ -62,7 +63,7 @@ class Router {
include_once($route[0]);
if(class_exists($modname)) {
$this->controller = new $modname;
- App::$module_loaded = true;
+ $this->module_loaded = true;
}
}
}
@@ -70,15 +71,15 @@ class Router {
// legacy plugins - this can be removed when they have all been converted
- if(! (App::$module_loaded)) {
+ if(! ($this->module_loaded)) {
if(is_array(App::$plugins) && in_array($module, App::$plugins) && file_exists("addon/{$module}/{$module}.php")) {
include_once("addon/{$module}/{$module}.php");
if(class_exists($modname)) {
$this->controller = new $modname;
- App::$module_loaded = true;
+ $this->module_loaded = true;
}
elseif(function_exists($module . '_module')) {
- App::$module_loaded = true;
+ $this->module_loaded = true;
}
}
}
@@ -88,40 +89,40 @@ class Router {
* Otherwise, look for the standard program module
*/
- if(! (App::$module_loaded)) {
+ if(! ($this->module_loaded)) {
try {
$filename = 'Zotlabs/SiteModule/'. ucfirst($module). '.php';
if(file_exists($filename)) {
// This won't be picked up by the autoloader, so load it explicitly
require_once($filename);
$this->controller = new $modname;
- App::$module_loaded = true;
+ $this->module_loaded = true;
}
else {
$filename = 'Zotlabs/Module/'. ucfirst($module). '.php';
if(file_exists($filename)) {
$this->controller = new $modname;
- App::$module_loaded = true;
+ $this->module_loaded = true;
}
}
- if(! App::$module_loaded)
+ if(! $this->module_loaded)
throw new Exception('Module not found');
}
catch(Exception $e) {
if(file_exists("mod/site/{$module}.php")) {
include_once("mod/site/{$module}.php");
- App::$module_loaded = true;
+ $this->module_loaded = true;
}
elseif(file_exists("mod/{$module}.php")) {
include_once("mod/{$module}.php");
- App::$module_loaded = true;
+ $this->module_loaded = true;
}
}
}
$x = [
'module' => $module,
- 'installed' => App::$module_loaded,
+ 'installed' => $this->module_loaded,
'controller' => $this->controller
];
/**
@@ -138,7 +139,7 @@ class Router {
*/
call_hooks('module_loaded', $x);
if($x['installed']) {
- App::$module_loaded = true;
+ $this->module_loaded = true;
$this->controller = $x['controller'];
}
@@ -146,7 +147,7 @@ class Router {
* The URL provided does not resolve to a valid module.
*/
- if(! (App::$module_loaded)) {
+ if(! ($this->module_loaded)) {
// undo the setting of a letsencrypt acme-challenge rewrite rule
// which blocks access to our .well-known routes.
@@ -162,7 +163,7 @@ class Router {
$x = [
'module' => $module,
- 'installed' => App::$module_loaded,
+ 'installed' => $this->module_loaded,
'controller' => $this->controller
];
call_hooks('page_not_found',$x);
@@ -189,7 +190,7 @@ class Router {
// pretend this is a module so it will initialise the theme
App::$module = '404';
- App::$module_loaded = true;
+ $this->module_loaded = true;
App::$error = true;
}
}
@@ -205,7 +206,7 @@ class Router {
* Call module functions
*/
- if(App::$module_loaded) {
+ if($this->module_loaded) {
App::$page['page_title'] = App::$module;
$placeholder = '';