Fixes index to pass the plugin to only load the internal page

main
Yasen Pramatarov 2026-01-20 11:46:21 +02:00
parent 1dde66a9f1
commit 0165896a0b
1 changed files with 24 additions and 31 deletions

View File

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