コード例 #1
0
<?php

// this page should only be accessed via AJAX
// as it contains invalid markup otherwise
require_once 'includes/inc.global.php';
if (empty($_SESSION['game_file'])) {
    exit;
}
try {
    $Review = new Review($_SESSION['game_file'], $_SESSION['step']);
    $table_format = array(array('SPECIAL_CLASS', true, '[[[class]]]'), array(' ', ' *** '), array('Message', 'message'));
    $table_meta = array('no_data' => '<p>There is nothing to show yet</p>', 'caption' => 'Game History &nbsp; &nbsp; <span class="info">Newest entries on top</span>', 'class' => 'history', 'alt_class' => '');
    if (!isset($history)) {
        $logs = $Review->get_steps(true, $_SESSION['step']);
        $players = $Review->get_players();
        $colors = array();
        foreach ($players as $key => $player) {
            $colors[$player['color']] = htmlentities($GLOBALS['_PLAYERS'][$key]) . ' [' . $key . ']';
        }
        foreach ($logs as &$log) {
            // wrap the first all uppercase word in a class of the same name
            $log['message'] = preg_replace_callback('/^([ -+=]*)([A-Z]+)/', 'make_class', $log['message']);
            // add outcome class to attack outcome
            if (' - - ' == substr($log['message'], 0, 5)) {
                $log['message'] = str_replace('">', ' outcome">', $log['message']);
                $log['message'] = str_replace('and was defeated', '<span class="defeat">and was defeated</span>', $log['message']);
            }
            // test the data or the message and add a class to the message
            $class = '';
            switch ($log['data'][0]) {
                #				case 'A' : $class = 'attack'; break;
コード例 #2
0
ファイル: review.php プロジェクト: studywithyou/webrisk
        call('ERROR ACCESSING GAME :' . $e->outputMessage());
    }
    exit;
}
$chat_html = '';
unset($Chat);
$meta['title'] = htmlentities($Review->name, ENT_QUOTES, 'UTF-8', false) . ' - #' . $_SESSION['game_file'];
$meta['show_menu'] = false;
$meta['head_data'] = '
	<link rel="stylesheet" type="text/css" media="screen" href="css/game.css" />

	<script type="text/javascript">//<![CDATA[
		var state = "watching";
		var game_file = ' . json_encode($_SESSION['game_file']) . ';
		var step = ' . json_encode($Review->step) . ';
		var steps = ' . json_encode($Review->get_steps()) . ';
	/*]]>*/</script>
	<script type="text/javascript" src="scripts/review.js"></script>
';
echo get_header($meta);
?>

		<div id="contents">
			<ul id="buttons">
				<li><a href="index.php<?php 
echo $GLOBALS['_?_DEBUG_QUERY'];
?>
">Main Page</a></li>
				<li><a href="game.php<?php 
echo $GLOBALS['_?_DEBUG_QUERY'];
?>