require_once 'config/extension.cfg.php'; require_once 'config/adminlevel.cfg.php'; require_once AdminServConfig::$PATH_RESOURCES . 'core/adminserv.php'; // LOAD TIMER if (ADMINSERV_TIMER) { AdminServ::startTimer(); } // INITIALIZE AdminServ::checkPHPVersion('5.3.0'); define('PATH_ROOT', basename(__DIR__) . '/'); $_SESSION['adminserv']['path'] = AdminServConfig::MULTI_ADMINSERV ? PATH_ROOT : null; AdminServ::getClass(); // GLOBALS AdminServEvent::getArgs(); // THEME 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
/** * Add chat line on server * * @param string $message -> Text message * @param string $nickname -> Nickname * @param string $color -> Text color * @param string $destination -> Message destination: server or player login * @param string $showAdminText -> Display "Admin" before the message * @return bool or text error */ public static function addChatServerLine($message, $nickname = null, $color = '$ff0', $destination = 'server', $showAdminText = false) { global $client; $out = false; $admin = null; Utils::addCookieData('adminserv_user', array(AdminServUI::theme(), AdminServUI::lang(), $nickname, $color), AdminServConfig::COOKIE_EXPIRE); if ($showAdminText) { $admin = '$fffAdmin:'; } if ($nickname) { $nickname = '$g$ff0' . TmNick::stripNadeoCode($nickname, array('$s')); } $nickname = '$s$ff0[' . $admin . $nickname . '$z$s$ff0]$z'; $message = $nickname . ' ' . $color . $message; $_SESSION['adminserv']['chat_dst'] = $destination; if ($destination === 'server') { if (!$client->query('ChatSendServerMessage', $message)) { $out = '[' . $client->getErrorCode() . '] ' . $client->getErrorMessage(); } else { $out = true; } } else { if (!$client->query('ChatSendServerMessageToLogin', $message, $destination)) { $out = '[' . $client->getErrorCode() . '] ' . $client->getErrorMessage(); } else { $out = true; } } return $out; }