define('USER_THEME', AdminServUI::theme($args['theme'])); // LANG define('USER_LANG', AdminServUI::lang($args['lang'])); // VÉRIFICATION DES DROITS $checkRightsList = array('./config/adminserv.cfg.php' => 666, './config/servers.cfg.php' => 666, './config/adminlevel.cfg.php' => 666); if (in_array(true, AdminServConfig::$LOGS)) { if (!Utils::isWinServer()) { $checkRightsList['./logs/'] = 777; } } AdminServ::checkRights($checkRightsList); // LOGOUT AdminServEvent::logout(); // LOGS AdminServLogs::initialize(); // PLUGINS define('USER_PLUGIN', AdminServPlugin::getCurrent()); // INDEX unset($args['theme'], $args['lang']); if (AdminServEvent::isLoggedIn()) { // SWITCH SERVER AdminServEvent::switchServer(); // SERVER CONNECTION if (AdminServ::initialize()) { // PAGES BACKOFFICE AdminServUI::initBackPage(); } } else { // PAGES FRONTOFFICE AdminServUI::initFrontPage(); }
<section class="plugins hasMenu"> <section class="cadre left menu"> <?php echo AdminServPlugin::getMenuList(); ?> </section> <section class="cadre right"> <h1><?php echo Utils::t('Plugins'); ?> </h1> <div class="title-detail"> <ul> <li class="last"> <?php echo $data['nbplugins']['count'] . ' ' . $data['nbplugins']['title']; ?> </li> </ul> </div> <div class="content"> <p><?php echo Utils::t('Plugins are extensions to add features to Adminserv.'); ?> </p> </div> <h2><?php echo Utils::t('Install a plugin'); ?>
<?php // Nombre de plugins $data['nbplugins'] = AdminServPlugin::countPlugins(); if ($data['nbplugins']['count'] === 0) { Utils::redirection(); }
/** * Ititialise une page en back office */ public static function initBackPage() { global $client, $data, $args; // Pages list $pagesList = array('general', 'srvopts', 'gameinfos', 'chat', 'plugins-list', 'guestban'); $pagesList = array_merge($pagesList, array_keys(ExtensionConfig::$MAPSMENU)); $firstPage = array_shift($pagesList); // Render page if (in_array(USER_PAGE, $pagesList)) { $pageKey = array_search(USER_PAGE, $pagesList); if (AdminServAdminLevel::hasAccess($pagesList[$pageKey])) { self::renderPage($pagesList[$pageKey]); } else { $data = array('errorTitle' => Utils::t('Erreur d\'accès à la page'), 'errorMessage' => Utils::t('Vous n\'avez pas les droits requis pour accéder à cette page. Veuillez contacter votre administrateur.')); self::renderPage('page-error'); } } else { if (self::isPageType('config')) { session_unset(); session_destroy(); Utils::redirection(false, './config/'); } elseif (USER_PLUGIN) { AdminServPlugin::renderPlugin(); } else { self::renderPage($firstPage); } } }
?> " href="?p=srvopts"><?php echo Utils::t('Server options'); ?> </a></li> <?php } ?> <?php if (AdminServAdminLevel::hasAccess('game_infos')) { ?> <li><a tabindex="4" class="button light<?php if (USER_PAGE == 'gameinfos') { echo ' active'; } ?> " href="?p=gameinfos"><?php echo Utils::t('Game infos'); ?> </a></li> <?php } ?> <?php if (AdminServAdminLevel::hasAccess('chat')) { ?> <li><a tabindex="5" class="button light<?php if (USER_PAGE == 'chat') { echo ' active'; } ?>
<?php /* INCLUDES */ $path = AdminServPlugin::getPluginPath(); $langFile = $path . 'lang/' . USER_LANG . '.php'; if (file_exists($langFile)) { include_once $langFile; } /* ACTIONS */ if (isset($_POST['transferplanets'])) { // Server > Server if (isset($_POST['serverToServerAmout']) && isset($_POST['serverToServerLogin'])) { $serverToServerAmout = intval($_POST['serverToServerAmout']); $serverToServerLogin = trim($_POST['serverToServerLogin']); if ($serverToServerAmout > 0 && $serverToServerLogin != Utils::t('Server login')) { if (!$client->query('Pay', $serverToServerLogin, $serverToServerAmout, Utils::t('Transfered by AdminServ'))) { AdminServ::error(); } else { $_SESSION['adminserv']['transfer_billid'] = $client->getResponse(); AdminServLogs::add('action', 'Transfer ' . $serverToServerAmout . ' planets to ' . $serverToServerLogin . ' server login'); } } } // Server > Player if (isset($_POST['serverToPlayerAmount']) && isset($_POST['serverToPlayerLogin'])) { $serverToPlayerAmount = intval($_POST['serverToPlayerAmount']); $serverToPlayerMessage = trim($_POST['serverToPlayerMessage']); $serverToPlayerLogin = trim($_POST['serverToPlayerLogin']); $serverToPlayerLogin2 = trim($_POST['serverToPlayerLogin2']); if ($serverToPlayerAmount > 0) { // Message