Fixes index to pass the plugin to only load the internal page
parent
1dde66a9f1
commit
0165896a0b
|
|
@ -425,22 +425,16 @@ if ($page == 'logout') {
|
||||||
'logger' => $logObject,
|
'logger' => $logObject,
|
||||||
'time_now' => $timeNow ?? null,
|
'time_now' => $timeNow ?? null,
|
||||||
];
|
];
|
||||||
if (PluginRouteRegistry::match($page)) {
|
// Check if this is a PluginRouteRegistry route
|
||||||
$handled = PluginRouteRegistry::dispatch($page, $routeContext);
|
$pluginRouteMatch = PluginRouteRegistry::match($page);
|
||||||
if ($handled !== false) {
|
$isPluginRoute = $pluginRouteMatch !== null;
|
||||||
ob_end_flush();
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// page building
|
// page building
|
||||||
if (in_array($page, $allowed_urls)) {
|
if ($isPluginRoute) {
|
||||||
// The page is in allowed URLs
|
// The page is from a PluginRouteRegistry route (a plugin's page)
|
||||||
if (isset($mapped_plugin_controllers[$page]) && file_exists($mapped_plugin_controllers[$page])) {
|
|
||||||
// The page is from a plugin controller
|
|
||||||
if (defined('PLUGIN_PAGE_DIRECT_OUTPUT') && PLUGIN_PAGE_DIRECT_OUTPUT === true) {
|
if (defined('PLUGIN_PAGE_DIRECT_OUTPUT') && PLUGIN_PAGE_DIRECT_OUTPUT === true) {
|
||||||
// Barebone page controller, we don't output anything extra
|
// Barebone page controller, we don't output anything extra (no common header/footer etc.)
|
||||||
include $mapped_plugin_controllers[$page];
|
PluginRouteRegistry::dispatch($page, $routeContext);
|
||||||
ob_end_flush();
|
ob_end_flush();
|
||||||
exit;
|
exit;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -449,10 +443,10 @@ if ($page == 'logout') {
|
||||||
if ($validSession) {
|
if ($validSession) {
|
||||||
\App\Helpers\Theme::include('page-sidebar');
|
\App\Helpers\Theme::include('page-sidebar');
|
||||||
}
|
}
|
||||||
include $mapped_plugin_controllers[$page];
|
PluginRouteRegistry::dispatch($page, $routeContext);
|
||||||
\App\Helpers\Theme::include('page-footer');
|
\App\Helpers\Theme::include('page-footer');
|
||||||
}
|
}
|
||||||
} else {
|
} elseif (in_array($page, $allowed_urls)) {
|
||||||
// The page is from a core controller
|
// The page is from a core controller
|
||||||
\App\Helpers\Theme::include('page-header');
|
\App\Helpers\Theme::include('page-header');
|
||||||
\App\Helpers\Theme::include('page-menu');
|
\App\Helpers\Theme::include('page-menu');
|
||||||
|
|
@ -465,7 +459,6 @@ if ($page == 'logout') {
|
||||||
include APP_PATH . 'templates/error-notfound.php';
|
include APP_PATH . 'templates/error-notfound.php';
|
||||||
}
|
}
|
||||||
\App\Helpers\Theme::include('page-footer');
|
\App\Helpers\Theme::include('page-footer');
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// The page is not in allowed URLs
|
// The page is not in allowed URLs
|
||||||
\App\Helpers\Theme::include('page-header');
|
\App\Helpers\Theme::include('page-header');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue