PHP_SMART_HOME_V3/app/views/Plugins.php
2020-10-26 00:01:30 +01:00

39 lines
924 B
PHP

<?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();
}
}