function preview()
 {
     $config = $this->fetchAndAssertConfig(_('starting it'));
     $server = $this->session->get('server');
     $this->response->configFile = $this->session->get('configFile', \ManiaLib\Utils\Formatting::stripStyles($server->name));
     $header = \DedicatedManager\Helpers\Header::getInstance();
     $header->rightText = _('Back to plugins');
     $header->rightIcon = 'back';
     $header->rightLink = $this->request->createLinkArgList('../plugins');
 }
Example #2
0
 function getConnectUrl($login)
 {
     $player = \ManiaLive\Data\Storage::getInstance()->getPlayerObject($login);
     $queryArgs = 'nickname=' . rawurlencode(substr(\ManiaLib\Utils\Formatting::stripStyles($player->nickName), 0, 30));
     if ($channel = Structures\Channel::GetDefault()) {
         $queryArgs .= '&channel=' . rawurlencode($channel->getPath());
     }
     $queryArgs .= '&token=' . rawurlencode(Connection::getInstance()->getToken($login));
     if ($this->voicePassword) {
         $queryArgs .= '&password='******'ts3server://' . $this->voiceHost . ':' . $this->voicePort . '?' . $queryArgs;
 }
 function onLoad()
 {
     $config = Config::getInstance();
     if (!$config->serverChannelName) {
         $config->serverChannelName = substr('ManiaPlanet> ' . Formatting::stripStyles($this->connection->getMainServerPlayerInfo()->nickName), 0, 40);
     }
     $this->tsConnection = Connection::getInstance();
     $this->tsConnection->open();
     if (!$this->tsConnection->isConnected()) {
         $this->enableTickerEvent();
     }
     Signal::getInstance()->subscribe('notifyEvent', array($this, 'onTeamSpeakEvent'));
     $this->enableDedicatedEvents(ServerEvent::ON_PLAYER_CONNECT | ServerEvent::ON_PLAYER_DISCONNECT | ServerEvent::ON_PLAYER_INFO_CHANGED);
 }
 function spectate()
 {
     list($options) = $this->fetchAndAssertConfig(_('starting it'));
     $defaultFileName = \ManiaLib\Utils\Formatting::stripStyles($options->name);
     $this->response->configFile = $this->session->get('configFile', $defaultFileName);
     $service = new \DedicatedManager\Services\ServerService();
     $this->response->servers = $service->getLives();
     $this->response->spectate = $this->session->get('spectate', new \DedicatedManager\Services\Spectate());
     if (!$this->response->servers) {
         $this->response->spectate->method = 'login';
     }
     $header = \DedicatedManager\Helpers\Header::getInstance();
     $header->rightText = _('Back to relay server configuration');
     $header->rightIcon = 'back';
     $header->rightLink = $this->request->createLinkArgList('../config');
 }
Example #5
0
 protected function postFilter()
 {
     parent::postFilter();
     if ($this->text !== null) {
         if (\ManiaLib\Gui\Manialink::$linksEnabled) {
             $this->xml->setAttribute('text', $this->text);
         } else {
             $this->xml->setAttribute('text', \ManiaLib\Utils\Formatting::stripLinks($this->text));
         }
     }
     if ($this->textid !== null) {
         if (\ManiaLib\Gui\Manialink::$linksEnabled) {
             $this->xml->setAttribute('textid', $this->textid);
         } else {
             $this->xml->setAttribute('textid', \ManiaLib\Utils\Formatting::stripLinks($this->textid));
         }
     }
     if ($this->autonewline !== null) {
         $this->xml->setAttribute('autonewline', $this->autonewline);
     }
     if ($this->maxline !== null) {
         $this->xml->setAttribute('maxline', $this->maxline);
     }
     if ($this->focusAreaColor1 !== null) {
         $this->xml->setAttribute('focusareacolor1', $this->focusAreaColor1);
     }
     if ($this->focusAreaColor2 !== null) {
         $this->xml->setAttribute('focusareacolor2', $this->focusAreaColor2);
     }
 }
Example #6
0
 function onBeginMap($map, $warmUp, $matchContinuation)
 {
     $this->checkpoints = array();
     $oldMap = $this->currentMap;
     $this->currentMap = Map::fromArray($map);
     if ($oldMap) {
         Console::printlnFormatted('Map change: ' . Formatting::stripStyles($oldMap->name) . ' -> ' . Formatting::stripStyles($this->currentMap->name));
     }
     $this->resetScores();
     if ($warmUp) {
         $this->isWarmUp = true;
     }
     $gameInfos = $this->connection->getCurrentGameInfo();
     if ($gameInfos != $this->gameInfos) {
         foreach ($gameInfos as $key => $value) {
             $this->gameInfos->{$key} = $value;
         }
     }
     $serverOptions = $this->connection->getServerOptions();
     if ($serverOptions != $this->server) {
         foreach ($serverOptions as $key => $value) {
             $this->server->{$key} = $value;
         }
     }
 }
Example #7
0
        $r->set('port', $server->rpcPort);
        ?>
			<li>
				<a href="<?php 
        echo htmlentities($r->createLinkArgList('/server', 'host', 'port'), ENT_QUOTES, 'UTF-8');
        ?>
" data-ajax="false"
				   data-host="<?php 
        echo $server->rpcHost;
        ?>
" data-port="<?php 
        echo $server->rpcPort;
        ?>
" class="server">
					<?php 
        echo ManiaLib\Utils\StyleParser::toHtml(\ManiaLib\Utils\Formatting::stripLinks($server->name)) ?: '&nbsp;';
        ?>
				</a>
			<?php 
        if ($isAdmin) {
            ?>
				<a href="<?php 
            echo htmlentities($r->createLinkArgList('../remove', 'host', 'port'), ENT_QUOTES, 'UTF-8');
            ?>
" data-icon="minus" data-theme="c" data-ajax="false"></a>
			<?php 
        }
        ?>
			</li>
		<?php 
    }
						<select id="spectateManaged" name="spectate[managed]" data-native-menu="false">
						<?php 
    foreach ($servers as $server) {
        ?>
							<?php 
        $serverId = $server->rpcHost . ':' . $server->rpcPort . ':' . $server->rpcPassword;
        ?>
							<option value="<?php 
        echo $serverId;
        ?>
" <?php 
        echo $serverId == $spectate->managed ? 'selected="selected"' : '';
        ?>
>
								<?php 
        echo \ManiaLib\Utils\Formatting::stripStyles($server->name);
        ?>
							</option>
						<?php 
    }
    ?>
						</select>
					</li>
				</ul>
			</fieldset>
		<?php 
}
?>
			<fieldset id="fieldset-spectate-login" class="relay-method" data-theme="b">
				<ul data-role="listview" data-inset="true">
					<li data-role="list-divider"><?php 
 function doVote($login, $vote)
 {
     $player = $this->storage->players[$login];
     $this->db->execute('INSERT INTO `Votes` (`login`, `lp`, `mapUid`, `mapName`, `vote`) ' . 'VALUES (%s, %d, %s, %s, %d) ' . 'ON DUPLICATE KEY UPDATE vote=VALUES(vote), lp=VALUES(lp), mapName=VALUES(mapName)', $this->db->quote($login), $player->ladderStats['PlayerRankings'][0]['Score'], $this->db->quote($this->storage->currentMap->uId), $this->db->quote(\ManiaLib\Utils\Formatting::stripStyles($this->storage->currentMap->name)), $vote);
     return $this->db->affectedRows() > 0;
 }
Example #10
0
 protected function formatForTwitter($text)
 {
     return \ManiaLib\Utils\Formatting::stripStyles($text);
 }
Example #11
0
 protected function runJumper()
 {
     foreach ($this->countDown as $matchId => $countDown) {
         switch (--$countDown) {
             case -15:
                 unset($this->countDown[$matchId]);
                 break;
             case -10:
                 //nobreak;
             //nobreak;
             case -5:
                 $match = $this->matchMakingService->getMatch($matchId);
                 //FIXME: maybe use storage which is a safer way to know if a player is still here
                 $players = array_filter($match->players, function ($p) {
                     return !Services\PlayerInfo::Get($p)->isAway();
                 });
                 if ($players) {
                     \ManiaLive\Utilities\Logger::debug('re-display jumper for: ' . implode(',', $players));
                     $this->sendToServer($players, $match->matchServerLogin);
                 } else {
                     //no need to keep this countdown if all player are gone
                     unset($this->countDown[$matchId]);
                     continue;
                 }
                 $this->countDown[$matchId] = $countDown;
                 break;
             case 0:
                 \ManiaLive\Utilities\Logger::debug(sprintf('prepare jump for match : %d', $matchId));
                 $match = $this->matchMakingService->getMatch($matchId);
                 if ($match->state >= Match::PREPARED) {
                     \ManiaLive\Utilities\Logger::debug(sprintf('jumping to server : %s', $match->matchServerLogin));
                     $players = array_map(array($this->storage, 'getPlayerObject'), $match->players);
                     $this->sendToServer($match->players, $match->matchServerLogin);
                     $nicknames = array();
                     foreach ($players as $player) {
                         if ($player && !array_key_exists($player->login, $this->blockedPlayers)) {
                             $nicknames[] = '$<' . \ManiaLib\Utils\Formatting::stripStyles($player->nickName) . '$>';
                             $this->connection->addGuest($player, true);
                         }
                     }
                     $this->connection->chatSendServerMessageToLanguage($this->dictionary->getChat(array(array('textId' => 'matchJoin', 'params' => array(self::PREFIX, implode(' & ', $nicknames))))));
                 } else {
                     \ManiaLive\Utilities\Logger::debug(sprintf('jump cancel match state is : %d', $match->state));
                     foreach ($match->players as $player) {
                         $this->setReadyLabel($player);
                     }
                 }
                 unset($match);
                 //nobreak
             //nobreak
             default:
                 $this->countDown[$matchId] = $countDown;
                 break;
         }
     }
 }
 function preview()
 {
     list($options) = $this->fetchAndAssertConfig(_('starting it'));
     $this->fetchAndAssertSettings(_('starting server'));
     $this->fetchAndAssertMaps(_('starting server'));
     $defaultFileName = \ManiaLib\Utils\Formatting::stripStyles($options->name);
     $this->response->configFile = $this->session->get('configFile', $defaultFileName);
     $this->response->matchFile = $this->session->get('matchFile', $defaultFileName);
     $header = \DedicatedManager\Helpers\Header::getInstance();
     $header->rightText = _('Back to map selection');
     $header->rightIcon = 'back';
     $header->rightLink = $this->request->createLinkArgList('../maps');
 }