示例#1
0
 public static function sortByNickName($a, $b)
 {
     $a = TmNick::toText($a['NickName']);
     $b = TmNick::toText($b['NickName']);
     if ($a == $b) {
         return 0;
     }
     return $a < $b ? -1 : 1;
 }
示例#2
0
 /**
  * Récupère les lignes du chat serveur
  *
  * @param bool $hideServerLines -> Masquer les lignes provenant d'un gestionnaire de serveur
  * @return string
  */
 public static function getChatServerLines($hideServerLines = false)
 {
     global $client;
     $out = null;
     if (!$client->query('GetChatLines')) {
         $out = '[' . $client->getErrorCode() . '] ' . $client->getErrorMessage();
     } else {
         $langCode = AdminServUI::lang();
         $chatLines = $client->getResponse();
         foreach ($chatLines as $line) {
             if (self::isServerLine($line)) {
                 if ($hideServerLines) {
                     unset($line);
                 } else {
                     $tradLines = array('$99FThis round is a draw.', '$99FThe $<$00FBlue team$> wins this round.', '$99FThe $<$F00Red team$> wins this round.');
                     if (in_array($line, $tradLines)) {
                         foreach ($tradLines as $tradLine) {
                             if ($line == $tradLine) {
                                 if ($langCode == 'en') {
                                     $line = '$999' . TmNick::toText(TmNick::stripNadeoCode($tradLine, array('$<', '$>')));
                                 } else {
                                     $line = '$999' . TmNick::toText(Utils::t($tradLine));
                                 }
                                 break;
                             }
                         }
                     } else {
                         if (strstr($line, '$fffAdmin:')) {
                             $pattern = '$ff0]$z';
                             $lineEx = explode($pattern, $line);
                             $nickname = $lineEx[0] . $pattern;
                             $message = TmNick::toText(trim($lineEx[1]));
                             $line = $nickname . ' $666' . $message;
                         } else {
                             $line = '$999' . TmNick::toText($line);
                         }
                     }
                 }
             } else {
                 $lineEx = explode('$>', $line);
                 $nickname = TmNick::stripNadeoCode($lineEx[0], array('$s', '[$<'));
                 $message = TmNick::toText(substr($lineEx[1], 2));
                 $line = '$s$ff0[' . $nickname . '$g$ff0]$z $666' . $message;
             }
             if (isset($line)) {
                 $out .= TmNick::toHtml($line, 10);
             }
         }
     }
     return $out;
 }
示例#3
0
文件: ui.php 项目: keverage/adminserv
 /**
  * Récupère la liste des joueurs
  *
  * @param string $currentPlayerLogin -> Le login joueur à sélectionner
  * @return string
  */
 public static function getPlayerList($currentPlayerLogin = null)
 {
     global $client;
     $out = '<option value="null">' . Utils::t('No player available') . '</option>';
     if (!$client->query('GetPlayerList', AdminServConfig::LIMIT_PLAYERS_LIST, 0, 1)) {
         AdminServ::error();
     } else {
         $playerList = $client->getResponse();
         if (count($playerList) > 0) {
             $out = null;
             foreach ($playerList as $player) {
                 if ($currentPlayerLogin == $player['Login']) {
                     $selected = ' selected="selected"';
                 } else {
                     $selected = null;
                 }
                 $out .= '<option value="' . $player['Login'] . '"' . $selected . '>' . TmNick::toText($player['NickName']) . '</option>';
             }
         }
     }
     return $out;
 }