コード例 #1
0
ファイル: newAdminPanel.php プロジェクト: CSchool/AIBattle
function printPageTitle()
{
    $page = $_GET["page"] or "";
    if ($page == "") {
        printTitleItem("Главная", "");
    } else {
        printTitleItem("Главная", "?page=");
        if ($page == "tournament") {
            $id = intval($_GET["id"]);
            printTournamentTitle($id, false);
            echo '<li><a href="?page=tournament&id=' . $id . '&action=edit" role=button class="btn btn-default">Редактировать турнир</a></li>';
        } else {
            if ($page == "round") {
                printTournamentTitle(intval($_GET["tournament"]), true);
                $id = intval($_GET["id"]);
                if ($id == -1) {
                    printTitleItem("Новый раунд", "");
                } else {
                    $round = getRoundData($id);
                    printTitleItem($round['name'], "");
                }
            } else {
                if ($page == "games") {
                    printTitleItem(getRusTitle("games"), "");
                } else {
                    if ($page == "game") {
                        printTitleItem(getRusTitle("games"), "?page=games");
                        printTitleItem(getGameName($_GET["id"]), "");
                    } else {
                        printTitleItem(getRusTitle($page), "");
                    }
                }
            }
        }
    }
}
コード例 #2
0
ファイル: procedures.php プロジェクト: CSchool/AIBattle
function createGameZip($gameId, $filename)
{
    $gameId = intval($gameId);
    $z = new ZipArchive();
    $z->open($filename, ZIPARCHIVE::CREATE);
    $checkers = getCheckerListByGameId($gameId);
    $game = getFromDB("games", "id={$gameId}");
    $meta = "NAME=" . getGameName($gameId) . "\nDESCRIPTION=" . getGameDescription($gameId) . "\nTL=" . $game[0]["timeLimit"] . "\nML=" . $game[0]["memoryLimit"];
    $i = 0;
    foreach ($checkers as $a) {
        $z->addFile(getcwd() . "./testers/" . $a["id"], ++$i . ".checker");
        $z->addFromString($i . ".checkermeta", "LANG=cpp\nname=" . $a["name"] . "\nSEED=" . $a["hasSeed"]);
    }
    $attachments = getAttachments($gameId);
    $i = 0;
    foreach ($attachments as $b) {
        $z->addFile("./attachments/" . $b["id"], ++$i . ".attachment");
        $z->addFromString($i . ".attachmentmeta", "NAME=" . $b["originalName"] . "\nDESCRIPTION=" . $b["description"]);
    }
    $z->addFromString("META", $meta);
    $z->close();
}
コード例 #3
0
ファイル: handler.php プロジェクト: jtamayo/StanfordAssassins
function handleGamePending($gameId)
{
    $gameName = getGameName($gameId);
    $sql = "SELECT players.email, participations.codeword, participations.alias ";
    $sql .= "FROM players INNER JOIN participations ON players.playerId = participations.playerId ";
    $sql .= "WHERE participations.gameId='{$gameId}';";
    $result = mysql_query($sql) or sql_error_report($sql, $_SERVER["SCRIPT_NAME"]);
    while ($row = mysql_fetch_assoc($result)) {
        sendGamePending($row['email'], $gameName, $row['alias']);
    }
}
コード例 #4
0
} else {
    $playerObj->setOption("sort", 'eventTime');
}
$newSort = "ASC";
if (isset($_GET["sortorder"])) {
    $check = validateInput($_GET['sortorder'], 'nospace');
    if ($check === true) {
        $playerObj->setOption("sortorder", $_GET['sortorder']);
    }
    if ($_GET["sortorder"] == "ASC") {
        $newSort = "DESC";
    }
} else {
    $playerObj->setOption("sortorder", 'DESC');
}
$gamename = getGameName($playerObj->getParam("game"));
$pl_name = makeSavePlayerName($playerObj->getParam('name'));
pageHeader(array($gamename, l("Chat History"), $pl_name), array($gamename => "index.php?game=" . $playerObj->getParam('game'), l("Player Rankings") => "index.php?mode=players&amp;game=" . $playerObj->getParam('game'), l("Player Details") => "index.php?mode=playerinfo&amp;player={$player}", l("Chat History") => ""), $pl_name);
?>

<div id="sidebar">
	<h1><?php 
echo l('Options');
?>
</h1>
	<div class="left-box">
		<ul class="sidemenu">
			<li>
				<a href="index.php?mode=playerchathistory&amp;player=<?php 
echo $player;
?>
コード例 #5
0
ファイル: Subs-ArcadeAdmin.php プロジェクト: nikop/SMF-Arcade
function gameCacheInsertGames($games, $return = false)
{
    global $scripturl, $txt, $db_prefix, $modSettings, $context, $sourcedir, $smcFunc, $boarddir;
    $filesAvailable = array();
    $filesKeys = array();
    foreach ($games as $id => $game) {
        if ($game['type'] == 'game') {
            if (!empty($game['directory'])) {
                $game_directory = $modSettings['gamesDirectory'] . '/' . $game['directory'];
                $game_file = $modSettings['gamesDirectory'] . '/' . $game['directory'] . '/' . $game['filename'];
            } else {
                $game_directory = $modSettings['gamesDirectory'];
                $game_file = $modSettings['gamesDirectory'] . '/' . $game['filename'];
            }
            $filesAvailable[$game_file] = $id;
            $filesKeys[$game_file] = $id;
            // Move gamedata file for IBP arcade games
            if (file_exists($game_directory . '/gamedata')) {
                $from = $game_directory . '/gamedata';
                $to = $boarddir . '/arcade/gamedata';
                if (!file_exists($boarddir . '/arcade/')) {
                    if (!mkdir($boarddir . '/arcade/', 0755)) {
                        fatal_lang_error('unable_to_make', false, array($boarddir . '/arcade/'));
                    }
                }
                if (!file_exists($to)) {
                    if (!mkdir($to, 0755)) {
                        fatal_lang_error('unable_to_make', false, array($to));
                    }
                } elseif (!is_dir($to)) {
                    fatal_lang_error('unable_to_make', false, array($to));
                }
                if (!is_writable($to)) {
                    fatal_lang_error('unable_to_chmod', false, array($to));
                }
                /*  Changed rename to copy  */
                $dir = opendir($from);
                $success = true;
                while ($fileFrom = readdir($dir)) {
                    if ($fileFrom == '.' || $fileFrom == '..') {
                        continue;
                    }
                    copy_arcade_directory($from, $to);
                    deleteArcadeArchives($from);
                    /* $success &= rename($from . '/' . $fileFrom, $to . '/' . $fileFrom); */
                }
                closedir($dir);
                if (!file_exists($to)) {
                    fatal_lang_error('unable_to_move', false, array($from, $to));
                }
                /* if (!$success)
                			fatal_lang_error('unable_to_move', false, array($from, $to)); */
            }
        }
    }
    // Installed games
    $request = $smcFunc['db_query']('', '
		SELECT id_game, game_name, internal_name, game_file, game_directory
		FROM {db_prefix}arcade_games');
    while ($row = $smcFunc['db_fetch_assoc']($request)) {
        if (!empty($row['game_directory'])) {
            $game_file = $modSettings['gamesDirectory'] . '/' . $row['game_directory'] . '/' . $row['game_file'];
        } else {
            $game_file = $modSettings['gamesDirectory'] . '/' . $row['game_file'];
        }
        if (isset($filesKeys[$game_file])) {
            $games[$filesKeys[$game_file]] += array('type' => 'game', 'id' => $row['id_game'], 'name' => $row['game_name'], 'directory' => $row['game_directory'], 'filename' => $row['game_file'], 'internal_name' => $row['internal_name'], 'installed' => true);
        } else {
            $fileKeys[$game_file] = count($games);
            $games[] = array('type' => 'game', 'id' => $row['id_game'], 'name' => $row['game_name'], 'directory' => $row['game_directory'], 'filename' => $row['game_file'], 'internal_name' => $row['internal_name'], 'missing_files' => true);
        }
    }
    $smcFunc['db_free_result']($request);
    $rows = array();
    // Last step
    foreach ($games as $id => $game) {
        if (!empty($game['directory'])) {
            $game_directory = $modSettings['gamesDirectory'] . '/' . $game['directory'];
            $game_file = $modSettings['gamesDirectory'] . '/' . $game['directory'] . '/' . $game['filename'];
        } else {
            $game_directory = $modSettings['gamesDirectory'];
            $game_file = $modSettings['gamesDirectory'] . '/' . $game['filename'];
        }
        // Regular game?
        if ($game['type'] == 'game') {
            // Use game info if possible
            if (file_exists($game_directory . '/game-info.xml') && !isset($game['gameinfo'])) {
                $gameinfo = readGameInfo($game_directory . '/game-info.xml');
            }
        } elseif ($game['type'] == 'gamepackage') {
            $gameinfo = read_tgz_data(file_get_contents($game_file), 'game-info.xml', true);
            $gameinfo = new xmlArray($gameinfo);
            $gameinfo = $gameinfo->path('game-info[0]');
            $gameinfo = $gameinfo->to_array();
        } elseif ($game['type'] == 'gamepackage-multi') {
            $game['name'] = 'GamePack ' . substr($game['filename'], 0, strrpos($game['filename'], '.'));
        }
        if (isset($gameinfo) && !isset($game['name'])) {
            $game['name'] = $gameinfo['name'];
        } elseif (!isset($game['name'])) {
            $game['name'] = getGameName(getInternalName($game['filename'], $game_directory));
        }
        // Status of game
        $status = 10;
        if (!empty($game['missing_files'])) {
            $status = 2;
        } elseif (!empty($game['installed'])) {
            $status = 1;
        }
        if (!isset($game['id'])) {
            $game['id'] = 0;
        }
        if (!isset($game['directory'])) {
            $game['directory'] = '';
        }
        if (!isset($game['filename'])) {
            $game['filename'] = '';
        }
        // Escape data to be inserted into database
        $rows[] = array($game['id'], $game['type'], $game['name'], $status, $game['filename'], $game['directory']);
        unset($gameinfo);
    }
    if (!empty($rows)) {
        $smcFunc['db_insert']('insert', '{db_prefix}arcade_files', array('id_game' => 'int', 'file_type' => 'string-30', 'game_name' => 'string-255', 'status' => 'int', 'game_file' => 'string-255', 'game_directory' => 'string-255'), $rows, array('internal_name'));
    }
    if ($return) {
        return $rows;
    }
}
コード例 #6
0
				<div class="row-fluid">
					<div class="span4">
						<h2>Metadata</h2>
						<b>SQL</b>
						<table class="table table-striped">
						  <thead>
							<tr>
							  <th>Key</th>
							  <th>Value</th>
							</tr>
						  </thead>
						  <tbody>
							<tr>
							  <td>name</td>
							  <td><?php 
echo getGameName();
?>
</td>
							</tr>
							<tr>
							  <td>apikey</td>
							  <td><?php 
echo getAPIKey();
?>
</td>
							</tr>
							<tr>
							  <td>numachievements</td>
							  <td><?php 
echo getNumAchievements();
?>
コード例 #7
0
ファイル: visualize.php プロジェクト: CSchool/AIBattle
                    $s = next($file);
                }
            } else {
                if (strpos($s, "INPUT") === 0) {
                    while ($s !== false && $s != "END_OF_INPUT\n") {
                        $s = next($file);
                    }
                }
            }
        }
        $s = next($file);
    }
    $link = getDBConnection();
    if (mysqli_select_db($link, getDBName())) {
        $res = mysqli_query($link, "SELECT strategy1, strategy2, duels.status FROM duels WHERE duels.id={$duel}");
        $game = getGameName($gameId);
        $user1 = getNicknameByStrategy(mysqli_result($res, 0, 0));
        $user2 = getNicknameByStrategy(mysqli_result($res, 0, 1));
        $status = mysqli_result($res, 0, 2);
    }
    ?>

            <h2>Партия по игре <?php 
    echo $game;
    ?>
 между <?php 
    echo $user1;
    ?>
 и <?php 
    echo $user2;
    ?>
コード例 #8
0
function userList($cursor, $input)
{
    $userList = array();
    foreach ($cursor as $document) {
        array_push($userList, $document['_id']);
    }
    $upToDateUserData = checkCurrentUserData($userList);
    //print_r_html($upToDateUserData);
    if ($upToDateUserData === 0) {
        echo "could not get updated data due to steam servers.<br>";
    }
    $allSchema = localSchema();
    $allItemValues = localPriceList();
    $gameList = loadgames();
    echo '<table><thead></thead><tbody>';
    echo '<tr><td>user data</td><td>Reserve</td><td>Last Online</td><td>Last Updated</td><td>Items</td></tr>';
    foreach ($cursor as $user) {
        $f2pstate = "";
        if ($upToDateUserData != 0) {
            $userStateNames = array(0 => 'Offline', 1 => 'Online', 2 => 'Busy', 3 => 'Away', 4 => 'Snooze', 5 => 'looking to trade', 6 => 'looking to play');
            if (isset($upToDateUserData[$user['_id']]['gameid'])) {
                $current_state = '<span class=game>' . getGameName($upToDateUserData[$user['_id']]['gameid'], $gameList) . '</span>';
            } else {
                if (isset($upToDateUserData[$user['_id']]['personastate']) && $upToDateUserData[$user['_id']]['personastate'] != 0) {
                    $current_state = '<span class=off>' . $userStateNames[$upToDateUserData[$user['_id']]['personastate']] . '</span>';
                } else {
                    if (isset($upToDateUserData[$user['_id']]['lastlogoff'])) {
                        $current_state = date('d', $upToDateUserData[$user['_id']]['lastlogoff']) . ' ' . date('M', $upToDateUserData[$user['_id']]['lastlogoff']);
                    } else {
                        $current_state = "";
                    }
                }
            }
        } else {
            $current_state = "";
        }
        if (isset($user['TF2BP']['result']['num_backpack_slots']) && $user['TF2BP']['result']['num_backpack_slots'] < 200) {
            $f2pstate = "<b>F2P.</b>";
        }
        $lastScanned = date('d', $user['recent']) . ' ' . date('M', $user['recent']);
        echo profileBlockArea($user, 440, $user['hrs']) . '<td><form action=""><input type="submit" name="' . $user['_id'] . '" value="' . ($_SERVER['PHP_SELF'] == '/dblist.php' ? 'un' : '') . 'reserve"/></form></td>' . '<td>' . $current_state . '</td><td>' . $lastScanned . '</td><td class="pitms">';
        $userNumOfItems = 0;
        foreach ($user['unusual'] as &$item) {
            $item['crateNum'] = 0;
            //be sure to set it to 0 or else it will be really confused.
            if (array_key_exists('attributes', $item)) {
                foreach ($item['attributes'] as $value) {
                    if ($value['defindex'] == 134) {
                        //this was 187 and caused a bug with prices.
                        $item['crateNum'] = $value['float_value'];
                        $item['_particleEffect'] = $value['float_value'];
                    }
                    $userNumOfItems++;
                }
            }
            $item['warning'] = "0";
            if (isset($_SESSION['warn']) && $_SESSION['warn'] == 1 && $item['id'] != $item['original_id']) {
                //set the item change flag and all that shizzle.
                $item['warning'] = ' Item ID is different than original ID.';
            }
            item_prepare($item);
            item_price($item);
            if ((!isset($input['defindex']) || in_array($item['defindex'], $input['defindex'])) && (!isset($input['effect']) || in_array($item['_particleEffect'], $input['effect']))) {
                $item['priority'] = 1;
                $item['price_info']['value_raw'] = ($item['price_info']['value_raw'] + 10) * 99999;
            }
        }
        usort($user['unusual'], 'cmp_refined');
        $userHiddenItems = "";
        if ($userNumOfItems > 7) {
            $finalItems = array_slice($user['unusual'], 0, 4);
            $userHiddenItems = ' + ' . ($userNumOfItems - 4) . ' more unusuals.';
        } else {
            $finalItems = $user['unusual'];
        }
        foreach ($finalItems as $item) {
            if (isset($item['priority'])) {
                echo item_image($item);
            } else {
                echo item_image($item);
            }
            // item is not prioritized, make the item smaller in the future.
        }
        echo $userHiddenItems . '</td></tr>';
    }
    echo '</table>';
}
コード例 #9
0
ファイル: lobby.php プロジェクト: ADarkHero/HexaTriad
    $opponent = parseGameOpponent($yourgames[$i], $uid);
    echo 'Game versus ' . $opponent . ': <a href="game.php?id=' . $yourgames[$i] . '">' . getGameName($yourgames[$i]) . '</a><br />';
}
?>

<h2>Create Game</h2>

<form action="lobby.php" method="post">
    <input type="text" size="50" name="gamename" placeholder="Lobby Name">
    <select name="creategame">
        <option value="blue">Blue side</option>
        <option value="red">Red side</option>
    </select>
    <input type="hidden" value="0" name="deck">
    <input type="submit" value="Create new game!">
</form>

<h2>Join Game</h2>
<?php 
$opengames = getOpenGames($uid);
$available = 0;
for ($i = 0; $i < sizeof($opengames); $i++) {
    $opponent = parseGameOpponent($opengames[$i], $uid);
    if ($opponent == "undefined") {
        echo 'Game from ' . $opponent . ': <a href="game.php?id=' . $opengames[$i] . '&join=true&deck=' . $deck . '">' . getGameName($opengames[$i]) . '</a><br />';
        $available++;
    }
}
if ($available == 0) {
    echo "No other games available! Create one!";
}
コード例 #10
0
ファイル: tournaments.php プロジェクト: CSchool/AIBattle
<script>
    changeActiveAdminButton('tournamentsButton');
</script>

<table class="table table-hover">
<thead>
<tr>
<td>Название</td>
<td>Игра</td>
<td>Тестировщик</td>
<td>Статус</td>
</tr>
</thead>
<tbody>
<?php 
$tours = getTournamentList();
foreach ($tours as $tour) {
    $checker = getCheckerList($tour['defaultChecker']);
    echo '<tr>';
    echo '<td><a href="?page=tournament&id=' . $tour['id'] . '"</a>' . $tour['name'] . '</td>';
    echo '<td><a href="?page=games&id=' . $tour['game'] . '">' . getGameName($tour['game']) . '</a></td>';
    echo '<td>' . $checker[0]['name'] . '</td>';
    echo '<td>' . $tour['state'] . '</td>';
    echo '</tr>';
}
?>
</tbody>
</table>