2004-08-03 16:59:27 +00:00
|
|
|
<?php
|
2008-08-05 22:43:14 +00:00
|
|
|
// This file is part of BOINC.
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2008 University of California
|
|
|
|
//
|
|
|
|
// BOINC is free software; you can redistribute it and/or modify it
|
|
|
|
// under the terms of the GNU Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation,
|
|
|
|
// either version 3 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
2004-08-03 16:59:27 +00:00
|
|
|
|
2007-10-28 15:03:14 +00:00
|
|
|
require_once("../inc/boinc_db.inc");
|
2006-09-06 20:56:55 +00:00
|
|
|
require_once("../inc/util.inc");
|
|
|
|
|
|
|
|
function db_init_xml() {
|
2006-12-07 23:39:23 +00:00
|
|
|
if (web_stopped()) {
|
2006-09-06 20:56:55 +00:00
|
|
|
return -183;
|
|
|
|
}
|
2007-10-28 15:03:14 +00:00
|
|
|
$db = BoincDb::get();
|
|
|
|
if (!$db) return -138;
|
2006-09-06 20:56:55 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
|
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>
|
2010-03-25 16:38:17 +00:00
|
|
|
<m_nbytes>$host->m_nbytes</m_nbytes>
|
|
|
|
<d_free>$host->d_free</d_free>
|
|
|
|
<d_total>$host->d_total</d_total>
|
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) {
|
2007-10-28 15:03:14 +00:00
|
|
|
$hosts = BoincHost::enum("userid=$user->id");
|
2005-11-14 18:38:09 +00:00
|
|
|
echo " <venue>$user->venue</venue>\n";
|
2007-10-28 15:03:14 +00:00
|
|
|
foreach ($hosts as $host) {
|
2005-06-15 04:53:08 +00:00
|
|
|
show_host_xml($host);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
echo"</user>
|
2004-08-03 16:59:27 +00:00
|
|
|
";
|
|
|
|
}
|
|
|
|
|
2010-06-20 08:35:36 +00:00
|
|
|
function show_team_member($user, $show_email, $creditonly = false) {
|
|
|
|
if ($creditonly && !$user->total_credit) { return; }
|
2006-03-24 23:37:32 +00:00
|
|
|
$cpid = md5($user->cross_project_id.$user->email_addr);
|
|
|
|
echo "<user>
|
|
|
|
<id>$user->id</id>
|
2010-06-20 08:35:36 +00:00
|
|
|
<cpid>$cpid</cpid>
|
2006-03-30 00:45:24 +00:00
|
|
|
";
|
2007-11-16 21:31:43 +00:00
|
|
|
if ($show_email && $user->send_email) {
|
2010-06-20 08:35:36 +00:00
|
|
|
echo " <email_addr>$user->email_addr</email_addr>
|
2006-03-30 00:45:24 +00:00
|
|
|
";
|
|
|
|
}
|
2010-06-20 08:35:36 +00:00
|
|
|
echo " <total_credit>$user->total_credit</total_credit>";
|
|
|
|
if (!$creditonly) {
|
|
|
|
echo " <create_time>$user->create_time</create_time>
|
2006-03-24 23:37:32 +00:00
|
|
|
<name>".htmlspecialchars($user->name)."</name>
|
|
|
|
<country>$user->country</country>
|
|
|
|
<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>
|
2010-06-20 08:35:36 +00:00
|
|
|
";
|
|
|
|
}
|
|
|
|
echo "</user>
|
2006-03-24 23:37:32 +00:00
|
|
|
";
|
|
|
|
}
|
|
|
|
|
2006-01-10 23:21:23 +00:00
|
|
|
function show_team_xml($team) {
|
|
|
|
echo "<team>
|
|
|
|
<id>$team->id</id>
|
2007-05-11 18:41:36 +00:00
|
|
|
<create_time>$team->create_time</create_time>
|
|
|
|
<userid>$team->userid</userid>
|
2006-01-10 23:21:23 +00:00
|
|
|
<name>".htmlspecialchars($team->name)."</name>
|
2011-05-05 16:12:12 +00:00
|
|
|
<url>".htmlspecialchars($team->url)."</url>
|
2007-05-11 18:41:36 +00:00
|
|
|
<type>$team->type</type>
|
2006-01-10 23:21:23 +00:00
|
|
|
<country>$team->country</country>
|
2007-05-11 18:41:36 +00:00
|
|
|
<total_credit>$team->total_credit</total_credit>
|
|
|
|
<expavg_credit>$team->expavg_credit</expavg_credit>
|
|
|
|
<expavg_time>$team->expavg_time</expavg_time>
|
2006-01-10 23:21:23 +00:00
|
|
|
</team>
|
|
|
|
";
|
|
|
|
}
|
|
|
|
|
2004-08-03 16:59:27 +00:00
|
|
|
?>
|