Ejemplo n.º 1
0
								<ol>
									<?php 
    $topUsers = getTopUsers(10);
    foreach ($topUsers as $user) {
        echo "<li>" . $user->linkName() . " (" . formatInt($user->xp) . ")</li>";
    }
    ?>
								</ol>
							</div>
						</div>
						<div class="block">
							<div class="blocktitle">Top 10 songs</div>
							<div class="blockcontent">
								<ol>
									<?php 
    $topSongs = getTopSongs(10);
    foreach ($topSongs as $song) {
        echo "<li>" . $song->linkName() . " (" . formatInt($song->played) . ")</li>";
    }
    ?>
								</ol>
							</div>
						</div>
					</div>
					<div class="content">
						<?php 
    $page = "home";
    if (isset($_GET['page'])) {
        if (preg_match("/^([a-z_]+)\$/", $_GET['page'])) {
            $page = $_GET['page'];
        }
Ejemplo n.º 2
0
 function rest_getTopSongs($limit = 100, $fmt)
 {
     if (empty($fmt)) {
         $fmt = 'html';
     }
     $result = getTopSongs($limit);
     switch ($fmt) {
         case 'php':
             print serialize($result);
             break;
         case "xml":
             header('Content-Type: application/xml', true);
             print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
             $result = array("topSongs" => $result);
             $result['topSongs']['tag'] = "topSong";
             $this->dumpXml($result);
             break;
         case "text":
             // TODO: IMPLEMENT
             // TODO: IMPLEMENT
         // TODO: IMPLEMENT
         // TODO: IMPLEMENT
         case "html":
             // TODO: IMPLEMENT
             // TODO: IMPLEMENT
         // TODO: IMPLEMENT
         // TODO: IMPLEMENT
         default:
         case "json":
         case "realjson":
             $this->writeRealJSON($result);
             break;
     }
 }