2004-08-03 16:59:27 +00:00
|
|
|
<?php
|
|
|
|
|
2006-09-06 20:56:55 +00:00
|
|
|
require_once("../inc/db.inc");
|
|
|
|
require_once("../inc/util.inc");
|
|
|
|
|
|
|
|
function db_init_xml() {
|
|
|
|
if (project_is_stopped()) {
|
|
|
|
return -183;
|
|
|
|
}
|
|
|
|
$retval = db_init_aux();
|
|
|
|
if ($retval) return -138;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2004-08-03 16:59:27 +00:00
|
|
|
function xml_header() {
|
2006-09-06 20:56:55 +00:00
|
|
|
global $generating_xml;
|
2004-08-03 16:59:27 +00:00
|
|
|
header('Content-type: text/xml');
|
|
|
|
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n";
|
2006-09-06 20:56:55 +00:00
|
|
|
$generating_xml = true;
|
2004-08-03 16:59:27 +00:00
|
|
|
}
|
|
|
|
|
2006-09-06 20:56:55 +00:00
|
|
|
function xml_error($num, $msg=null) {
|
|
|
|
if (!$msg) {
|
|
|
|
switch($num) {
|
2006-09-08 19:51:33 +00:00
|
|
|
case -112: $msg = "Invalid XML"; break;
|
2006-09-06 20:56:55 +00:00
|
|
|
case -136: $msg = "Invalid ID"; break;
|
2006-09-08 19:51:33 +00:00
|
|
|
case -137: $msg = "Name or email address is not unique"; break;
|
2006-09-06 20:56:55 +00:00
|
|
|
case -138: $msg = "Can't access database"; break;
|
|
|
|
case -183: $msg = "Project is temporarily offline"; break;
|
2006-09-08 19:51:33 +00:00
|
|
|
case -205: $msg = "Email address has invalid syntax"; break;
|
2006-09-06 20:56:55 +00:00
|
|
|
case -206: $msg = "Invalid password"; break;
|
2006-09-08 19:51:33 +00:00
|
|
|
case -207: $msg = "Email address is not unique"; break;
|
|
|
|
case -208: $msg = "Account creation is disabled"; break;
|
2006-10-19 18:09:02 +00:00
|
|
|
case -209: $msg = "Invalid invitation code"; break;
|
2006-11-09 19:06:20 +00:00
|
|
|
case -210: $msg = "Invalid request method"; break;
|
2006-09-06 20:56:55 +00:00
|
|
|
default: "Unknown error"; break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
echo "<error>
|
|
|
|
<error_num>$num</error_num>
|
|
|
|
<error_msg>$msg</error_msg>
|
|
|
|
</error>
|
|
|
|
";
|
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) {
|
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
|
|
|
";
|
|
|
|
if ($show_hosts) {
|
2006-03-24 23:37:32 +00:00
|
|
|
$result = mysql_query("select * from host where userid=$user->id");
|
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-03-30 00:45:24 +00:00
|
|
|
function show_team_member($user, $show_email) {
|
2006-03-24 23:37:32 +00:00
|
|
|
$cpid = md5($user->cross_project_id.$user->email_addr);
|
|
|
|
echo "<user>
|
|
|
|
<id>$user->id</id>
|
2006-03-30 00:45:24 +00:00
|
|
|
";
|
|
|
|
if ($show_email) {
|
|
|
|
echo "<email_addr>$user->email_addr</email_addr>
|
|
|
|
";
|
|
|
|
}
|
|
|
|
echo "<cpid>$cpid</cpid>
|
2006-03-24 23:37:32 +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>
|
|
|
|
<url>".htmlspecialchars($user->url)."</url>
|
|
|
|
<has_profile>$user->has_profile</has_profile>
|
|
|
|
</user>
|
|
|
|
";
|
|
|
|
}
|
|
|
|
|
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
|
|
|
?>
|