2004-08-03 16:59:27 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
function xml_header() {
|
|
|
|
header('Content-type: text/xml');
|
|
|
|
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
function xml_error($msg) {
|
|
|
|
xml_header();
|
|
|
|
echo "<error>$msg</error>\n";
|
2005-06-15 04:53:08 +00:00
|
|
|
exit();
|
2004-08-03 16:59:27 +00:00
|
|
|
}
|
|
|
|
|
2005-06-15 04:53:08 +00:00
|
|
|
function show_host_xml($host) {
|
|
|
|
echo " <host>
|
2005-06-15 22:22:26 +00:00
|
|
|
<id>$host->id</id>
|
2005-11-23 03:28:31 +00:00
|
|
|
<create_time>$host->create_time</create_time>
|
|
|
|
<rpc_seqno>$host->rpc_seqno</rpc_seqno>
|
2005-06-15 22:22:26 +00:00
|
|
|
<host_cpid>$host->host_cpid</host_cpid>
|
2005-06-15 04:53:08 +00:00
|
|
|
<total_credit>$host->total_credit</total_credit>
|
|
|
|
<expavg_credit>$host->expavg_credit</expavg_credit>
|
|
|
|
<expavg_time>$host->expavg_time</expavg_time>
|
|
|
|
<domain_name>$host->domain_name</domain_name>
|
|
|
|
<p_ncpus>$host->p_ncpus</p_ncpus>
|
|
|
|
<p_vendor>$host->p_vendor</p_vendor>
|
|
|
|
<p_model>$host->p_model</p_model>
|
|
|
|
<p_fpops>$host->p_fpops</p_fpops>
|
|
|
|
<p_iops>$host->p_iops</p_iops>
|
|
|
|
<os_name>$host->os_name</os_name>
|
|
|
|
<os_version>$host->os_version</os_version>
|
2005-11-14 18:38:09 +00:00
|
|
|
<venue>$host->venue</venue>
|
2005-06-15 04:53:08 +00:00
|
|
|
</host>
|
|
|
|
";
|
|
|
|
}
|
|
|
|
|
|
|
|
function show_user_xml($user, $show_hosts) {
|
2004-08-03 16:59:27 +00:00
|
|
|
xml_header();
|
2005-11-14 18:38:09 +00:00
|
|
|
$cpid = md5($user->cross_project_id.$user->email_addr);
|
2004-08-03 16:59:27 +00:00
|
|
|
echo "<user>
|
2005-06-15 04:53:08 +00:00
|
|
|
<id>$user->id</id>
|
2005-11-14 18:38:09 +00:00
|
|
|
<cpid>$cpid</cpid>
|
2004-08-03 16:59:27 +00:00
|
|
|
<create_time>$user->create_time</create_time>
|
|
|
|
<name>".htmlspecialchars($user->name)."</name>
|
|
|
|
<country>$user->country</country>
|
|
|
|
<total_credit>$user->total_credit</total_credit>
|
|
|
|
<expavg_credit>$user->expavg_credit</expavg_credit>
|
|
|
|
<expavg_time>$user->expavg_time</expavg_time>
|
|
|
|
<teamid>$user->teamid</teamid>
|
|
|
|
<url>".htmlspecialchars($user->url)."</url>
|
|
|
|
<has_profile>$user->has_profile</has_profile>
|
2005-06-15 04:53:08 +00:00
|
|
|
";
|
|
|
|
$result = mysql_query("select * from host where userid=$user->id");
|
|
|
|
if ($show_hosts) {
|
2005-11-14 18:38:09 +00:00
|
|
|
echo " <venue>$user->venue</venue>\n";
|
2005-06-15 04:53:08 +00:00
|
|
|
while ($host = mysql_fetch_object($result)) {
|
|
|
|
show_host_xml($host);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
echo"</user>
|
2004-08-03 16:59:27 +00:00
|
|
|
";
|
|
|
|
}
|
|
|
|
|
2006-01-10 23:21:23 +00:00
|
|
|
function show_team_xml($team) {
|
|
|
|
echo "<team>
|
|
|
|
<id>$team->id</id>
|
|
|
|
<name>".htmlspecialchars($team->name)."</name>
|
|
|
|
<country>$team->country</country>
|
|
|
|
</team>
|
|
|
|
";
|
|
|
|
}
|
|
|
|
|
2004-08-03 16:59:27 +00:00
|
|
|
?>
|