public static function loader() { $data = ""; if (isset($_GET['page']) && $_GET['page'] == "modules") { if (isset($_GET['act'])) { if ($_GET['act'] == ACTIVATE) { if (!Token::isExist($_GET['token'])) { $alertred[] = TOKEN_NOT_EXIST; } if (!isset($alertred)) { self::activate($_GET['modules']); $GLOBALS['alertgreen'] = MODULES_ACTIVATED; } else { $GLOBALS['alertred'] = $alertred; } } elseif ($_GET['act'] == DEACTIVATE) { if (!Token::isExist($_GET['token'])) { $alertred[] = TOKEN_NOT_EXIST; } if (!isset($alertred)) { self::deactivate($_GET['modules']); $GLOBALS['alertgreen'] = MODULES_DEACTIVATED; } else { $GLOBALS['alertred'] = $alertred; } } elseif ($_GET['act'] == 'remove') { if (!Token::isExist($_GET['token'])) { $alertred[] = TOKEN_NOT_EXIST; } if (Mod::isActive($_GET['modules'])) { $alertred[] = "Module is Active. Please deactivate first."; } if (!isset($alertred)) { self::deactivate($_GET['modules']); Files::delTree(GX_MOD . "/" . $_GET['modules']); $GLOBALS['alertgreen'] = MODULES_DELETED; } else { $GLOBALS['alertred'] = $alertred; } } } } $json = Options::get('modules'); $mods = json_decode($json, true); if (!is_array($mods) || $mods == "") { $mods = array(); } foreach ($mods as $m) { if (self::exist($m)) { self::load($m); } } return $data; }
</thead> <tbody> <?php if (count($data['mods']) > 0) { foreach ($data['mods'] as $mod) { $m = Mod::data($mod); if (Mod::isActive($mod)) { # code... $btnact = "warning"; $act = DEACTIVATE; } else { $btnact = "success"; $act = ACTIVATE; } echo "\n <tr>\n <td>\n {$m['icon']} <strong>{$m['name']}</strong><br />\n <small>" . VERSION . ": {$m['version']} - " . LICENSE . ": {$m['license']}</small>\n </td>\n <td>\n <p title=\"{$m['desc']}\">" . substr($m['desc'], 0, 180) . "</p>\n <small>author: <a href=\"{$m['url']}\">{$m['developer']}</a></small>\n </td>\n <td>\n <a href=\"index.php?page=modules&act={$act}&modules={$mod}&token=" . TOKEN . "\" class=\"label label-{$btnact}\">{$act}</a> \n "; if (!Mod::isActive($mod)) { echo "<a href=\"index.php?page=modules&act=remove&modules={$mod}&token=" . TOKEN . "\" class=\"label label-danger\" disable>" . REMOVE . "</a>"; } echo "\n </td>\n </tr>"; //echo $m; } } else { echo "<div class=\"col-md-12\">" . NO_MODULES_FOUND . "</div>"; } ?> </tbody> <tfoot> <td></td> <td></td> <td></td>