Exemple #1
0
<?php

require_once 'common/config.php';
require_once 'common/time.php';
require_once 'common/xml_utils.php';
if (RYAPI_MODE == 'server') {
    require_once 'server/config.php';
    require_once 'server/time.php';
} else {
    require_once 'client/time.php';
}
$format = 'raw';
if (isset($_GET['format'])) {
    $format = trim($_GET['format']);
}
// Compute
$tick = ryzom_time_tick();
switch ($format) {
    case 'raw':
        echo $tick;
        break;
    case 'txt':
        $rytime = ryzom_time_array($tick);
        echo ryzom_time_txt($rytime);
        break;
    case 'xml':
        $rytime = ryzom_time_array($tick);
        ryzom_display_xml_header();
        echo ryzom_time_xml($rytime)->asXML();
        break;
}
Exemple #2
0
 static function bb_date($attr, $txt)
 {
     $time = strtotime($txt);
     $shardid = isset($attr['shard']) ? $attr['shard'] : self::$shardid;
     if ($time === false || $shardid === false) {
         return 'ERR:[' . $txt . ']';
     }
     if (isset(self::$legacy_shard[$shardid])) {
         $tick = self::$legacy_shard[$shardid];
         if (self::$legacy_sync > $time) {
             // only modify game cycle when asked time is before sync
             $tick = ($time - self::$legacy_sync) * 10 + $tick;
         }
     } else {
         $tick = ryzom_time_tick($shardid);
         // tick is for NOW, adjust it to match time given
         $now = time();
         $tick = ($time - $now) * 10 + $tick;
     }
     $rytime = ryzom_time_array($tick, $shardid);
     $txt = ryzom_time_txt($rytime, self::$lang);
     return $txt;
 }
Exemple #3
0
printf("<tr><td class=\"hh\" colspan=\"2\">Important dates: </td>");
// STATISTICS: date of the first APIKEY registered
$sql = "SELECT date_first AS date FROM guild_history ORDER BY date_first ASC LIMIT 1";
$req = mysql_query($sql) or die('SQL Error !<br>' . $sql . '<br>' . mysql_error());
$data = mysql_fetch_array($req);
printf("<tr><td class=\"e\">Date of the first registered Key: </td> <td class=\"v\" >%s</td></tr>", ryzom_time_txt(ryzom_time_array($data['date'], 'anyshard')));
// STATISTICS: date of the last APIKEY registered
$sql = "SELECT date_first AS date FROM guild_history ORDER BY date_first DESC LIMIT 1";
$req = mysql_query($sql) or die('SQL Error !<br>' . $sql . '<br>' . mysql_error());
$data = mysql_fetch_array($req);
printf("<tr><td class=\"e\">Date of the last registered Key: </td> <td class=\"v\" >%s</td></tr>", ryzom_time_txt(ryzom_time_array($data['date'], 'anyshard')));
// STATISTICS: date of the last  modification in APIKEY
$sql = "SELECT date_last AS date FROM guild_history ORDER BY date_last DESC LIMIT 1";
$req = mysql_query($sql) or die('SQL Error !<br>' . $sql . '<br>' . mysql_error());
$data = mysql_fetch_array($req);
printf("<tr><td class=\"e\">Date of the last change: </td> <td class=\"v\" >%s</td></tr>", ryzom_time_txt(ryzom_time_array($data['date'], 'anyshard')));
?>
			<tr class="hh"><td colspan="2"><h3>Tools</h3></td></tr>
			<tr><td class="e">Register a new Guild key</td>
				<td class="v">
					<form action="guild_history.php" method="GET">
						<input type="text" name="key" size="40" />
						<input type="submit" />
					</form>
				</td>
			</tr>
		</table>

		<p/>
		
		<table width="600" cellpadding="3" border="0">
function render_guild($xml)
{
    $content = '<h1>' . $xml->name . '</h1>';
    $content .= '<ul>';
    $content .= '<li>Created: <b>' . ryzom_time_txt(ryzom_time_array($xml->creation_date, '')) . '</b></li>';
    $content .= '<li>Cult: <b>' . $xml->cult . '</b></li>';
    $content .= '<li>Civilization: <b>' . $xml->civ . '</b></li>';
    $guild_icon = ryzom_guild_icon_image($xml->icon, 'b');
    $guild_icon_small = ryzom_guild_icon_image($xml->icon, 's');
    $content .= "<li>Guild Icon: {$guild_icon} {$guild_icon_small}</li>";
    $content .= '</ul>';
    // read the members, then sort them by grade and name
    $result = $xml->xpath('/guild/members/*');
    $members = array();
    $s_gk = array();
    // multi array sort keys
    $s_nk = array();
    $key = 0;
    while (list(, $item) = each($result)) {
        $members[$key] = array('joined' => intval($item->joined_date), 'grade' => (string) $item->grade, 'name' => (string) $item->name);
        $s_gk[$key] = memberGrade($members[$key]['grade']);
        $s_nk[$key] = $members[$key]['name'];
        $key++;
    }
    // sort members by grade, then by name
    array_multisort($s_gk, SORT_ASC, $s_nk, SORT_ASC, $members);
    $content .= '<h2>Members:' . count($members) . '</h2>';
    $content .= '<table width="500px" border="1" cellpadding="1" cellspacing="0">';
    $content .= '<thead><tr><td>Name</td><td>Rank</td><td>Joined</td></thead>';
    foreach ($members as $member) {
        $content .= '<tr>' . '<td>' . $member['name'] . '</td>' . '<td>' . $member['grade'] . '</td>' . '<td>' . ryzom_time_txt(ryzom_time_array($member['joined'], '')) . '</td>' . '</tr>';
    }
    $content .= '</table>';
    $content .= '<hr/><a class="ryzom-ui-button" href="?">Back</a>';
    return $content;
}