コード例 #1
0
  
  <p>Processing...<tt><?php 
$use_metadata = false;
if ($_GET['gameid'] == '') {
    trigger_error('No Game ID given', E_USER_ERROR);
}
if (array_key_exists('use_metadata', $_GET) and $_GET['use_metadata'] == 'true') {
    if (is_readable(METADATA_FILE)) {
        $use_metadata = true;
        $metadata = unserialize(file_get_contents(METADATA_FILE));
    } else {
        trigger_error('Error, could not read the metadata file. Please <a href="metadata.php" title="Generate local metadata copy">generate the local copy</a>.', E_USER_WARNING);
    }
}
$game = new ODSTGame();
$game->get_game($_GET['gameid']);
$game->load_game();
?>
</tt> Done.</p>

  <h3>Error</h3>
  <dl>
    <dt>Error:</dt>
    <dd><?php 
echo btt($game->error);
?>
<br /></dd>
    
    <dt>Status Code:</dt>
    <dd><?php 
echo $game->error_details[0];
コード例 #2
0
    trigger_error("No mode given", E_USER_ERROR);
}
switch ($_GET['mode']) {
    case 'odst_game':
        // Check for a Game ID
        if ($_GET['gameid'] == '') {
            echo "Error: No Game ID given. Aborting...";
            trigger_error("No Game ID given", E_USER_ERROR);
        }
        $gameid = $_GET['gameid'];
        // Set the HTTP headers
        header('Content-Type: text/xml; charset=utf-8');
        header("Content-Disposition: attachment; filename=\"game_{$gameid}.xml\"");
        // Download and return the game XML
        $odst_game = new ODSTGame();
        $odst_game->get_game($gameid);
        echo $odst_game->dump_xml();
        break;
    case 'odst_metadata':
        // Set the HTTP headers
        header('Content-Type: text/xml; charset=utf-8');
        header('Content-Disposition: attachment; filename="game_metadata.xml"');
        // Download and return the metadata XML
        $metadata = new ODSTMetadata();
        $metadata->get_metadata();
        echo $metadata->dump_xml();
        break;
    default:
        // Given nothing to do.
        echo 'No operation selected.';
        break;