From 7ea717200cfe5d46dcbc96a4b20ea5ea8ac57939 Mon Sep 17 00:00:00 2001 From: SamBrishes Date: Fri, 15 May 2020 07:50:22 +0200 Subject: [PATCH 1/4] Custom admin pages --- bl-kernel/admin/themes/booty/index.php | 2 ++ bl-kernel/boot/admin.php | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/bl-kernel/admin/themes/booty/index.php b/bl-kernel/admin/themes/booty/index.php index cf34121f..9f0ab96f 100644 --- a/bl-kernel/admin/themes/booty/index.php +++ b/bl-kernel/admin/themes/booty/index.php @@ -80,6 +80,8 @@ adminView(); } else { echo '

'.$L->g('Page not found').'

'; echo '

'.$L->g('Choose a page from the sidebar.').'

'; diff --git a/bl-kernel/boot/admin.php b/bl-kernel/boot/admin.php index 4e67d145..604c32a4 100644 --- a/bl-kernel/boot/admin.php +++ b/bl-kernel/boot/admin.php @@ -63,8 +63,8 @@ else } // Define variables - $ADMIN_CONTROLLER = $layout['controller']; - $ADMIN_VIEW = $layout['view']; + $ADMIN_CONTROLLER = $layout['controller']; + $ADMIN_VIEW = $layout['view']; // Load plugins before the admin area will be load. Theme::plugins('beforeAdminLoad'); @@ -77,6 +77,10 @@ else // Load controller. if (Sanitize::pathFile(PATH_ADMIN_CONTROLLERS, $layout['controller'].'.php')) { include(PATH_ADMIN_CONTROLLERS.$layout['controller'].'.php'); + } else if (($plugin = getPlugin($layout['controller'])) !== false) { + if (method_exists($plugin, "adminController") && method_exists($plugin, "adminView")) { + $plugin->adminController(); + } } // Load view and theme. From 5187cbc4d017098b41b10a2aeb8b75594d58daec Mon Sep 17 00:00:00 2001 From: SamBrishes Date: Fri, 15 May 2020 07:54:51 +0200 Subject: [PATCH 2/4] Fix Space / Tabs --- bl-kernel/boot/admin.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bl-kernel/boot/admin.php b/bl-kernel/boot/admin.php index 604c32a4..25d6239c 100644 --- a/bl-kernel/boot/admin.php +++ b/bl-kernel/boot/admin.php @@ -63,8 +63,8 @@ else } // Define variables - $ADMIN_CONTROLLER = $layout['controller']; - $ADMIN_VIEW = $layout['view']; + $ADMIN_CONTROLLER = $layout['controller']; + $ADMIN_VIEW = $layout['view']; // Load plugins before the admin area will be load. Theme::plugins('beforeAdminLoad'); From 1214b12bf71ef330ea31f58b65fc57192da38fc7 Mon Sep 17 00:00:00 2001 From: SamBrishes Date: Fri, 22 May 2020 23:55:22 +0200 Subject: [PATCH 3/4] Namespace Plugin Pages --- bl-kernel/admin/themes/booty/index.php | 4 ++-- bl-kernel/boot/admin.php | 22 +++++++++++++--------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/bl-kernel/admin/themes/booty/index.php b/bl-kernel/admin/themes/booty/index.php index 9f0ab96f..2972c3ae 100644 --- a/bl-kernel/admin/themes/booty/index.php +++ b/bl-kernel/admin/themes/booty/index.php @@ -80,8 +80,8 @@ adminView(); + } else if (!empty($layout['plugin']) && method_exists($layout['plugin'], 'adminView')) { + echo $layout['plugin']->adminView(); } else { echo '

'.$L->g('Page not found').'

'; echo '

'.$L->g('Choose a page from the sidebar.').'

'; diff --git a/bl-kernel/boot/admin.php b/bl-kernel/boot/admin.php index 25d6239c..16d6cd39 100644 --- a/bl-kernel/boot/admin.php +++ b/bl-kernel/boot/admin.php @@ -13,18 +13,24 @@ $layout = array( 'view'=>null, 'template'=>'index.php', 'slug'=>null, + 'plugin'=>false, 'parameters'=>null, 'title'=>'Bludit' ); -// Get the view, controller, and the parameters from the URL. +// Get the Controller $explodeSlug = $url->explodeSlug(); $layout['controller'] = $layout['view'] = $layout['slug'] = empty($explodeSlug[0])?'dashboard':$explodeSlug[0]; unset($explodeSlug[0]); -$layout['parameters'] = implode('/', $explodeSlug); -// Boot plugins rules +// Get the Plugin include(PATH_RULES.'60.plugins.php'); +if ($layout['controller'] === 'plugin' && !empty($explodeSlug)) { + $layout['plugin'] = getPlugin(array_shift($explodeSlug)); +} + +// Get the URL parameters +$layout['parameters'] = implode('/', $explodeSlug); // --- AJAX --- if ($layout['slug']==='ajax') { @@ -63,8 +69,8 @@ else } // Define variables - $ADMIN_CONTROLLER = $layout['controller']; - $ADMIN_VIEW = $layout['view']; + $ADMIN_CONTROLLER = $layout['controller']; + $ADMIN_VIEW = $layout['view']; // Load plugins before the admin area will be load. Theme::plugins('beforeAdminLoad'); @@ -77,10 +83,8 @@ else // Load controller. if (Sanitize::pathFile(PATH_ADMIN_CONTROLLERS, $layout['controller'].'.php')) { include(PATH_ADMIN_CONTROLLERS.$layout['controller'].'.php'); - } else if (($plugin = getPlugin($layout['controller'])) !== false) { - if (method_exists($plugin, "adminController") && method_exists($plugin, "adminView")) { - $plugin->adminController(); - } + } else if(!empty($layout['plugin']) && method_exists($layout['plugin'], 'adminController')) { + $layout['plugin']->adminController(); } // Load view and theme. From c7f0393062c319cb2d3601383718a5867d2f716e Mon Sep 17 00:00:00 2001 From: SamBrishes Date: Sat, 23 May 2020 00:04:16 +0200 Subject: [PATCH 4/4] Repair Spaces --- bl-kernel/boot/admin.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bl-kernel/boot/admin.php b/bl-kernel/boot/admin.php index 16d6cd39..cdb20f01 100644 --- a/bl-kernel/boot/admin.php +++ b/bl-kernel/boot/admin.php @@ -69,8 +69,8 @@ else } // Define variables - $ADMIN_CONTROLLER = $layout['controller']; - $ADMIN_VIEW = $layout['view']; + $ADMIN_CONTROLLER = $layout['controller']; + $ADMIN_VIEW = $layout['view']; // Load plugins before the admin area will be load. Theme::plugins('beforeAdminLoad');