Make plugins list and switcher

This commit is contained in:
haitem
2020-10-26 00:01:30 +01:00
parent 64ccd91469
commit ea00f7a295
13 changed files with 303 additions and 15 deletions

38
app/views/Plugins.php Normal file
View File

@@ -0,0 +1,38 @@
<?php
class Plugins extends Template
{
function __construct()
{
$userManager = new UserManager();
$langMng = new LanguageManager('en');
if (!$userManager->isLogin()){
header('Location: ' . BASEURL . 'login');
}
$dir = $_SERVER['DOCUMENT_ROOT'] . BASEDIR . 'app/plugins/';
$pluginsFiles = array_diff(scandir($dir), ['..', '.']);
$plugins = array();
foreach ($pluginsFiles as $key => $pluginFile) {
$status = (strpos($pluginFile, "!") !== false ? false : true);
$plugins[$key]['name'] = str_replace("!", "", str_replace(".php", "", $pluginFile));
$plugins[$key]['status'] = $status;
}
sort($plugins);
$template = new Template('plugins');
$template->prepare('baseDir', BASEDIR);
$template->prepare('debugMod', DEBUGMOD);
$template->prepare('title', 'Plugins');
$template->prepare('langMng', $langMng);
$template->prepare('plugins', $plugins);
$template->render();
}
}