Fixes for the BOINC-wide teams site

- the exported team list wasn't parsing due to non-ASCII characters
    in some team descriptions.
    htmlspecialchars() wasn't doing the job.
    Use DOMDocument instead.
- If SHOW_NONVALIDATE_TEAMS is set (as on the BOINC-wide teams site)
    show teams whose founders email addresses are not validated
    (and hence won't be exported).
This commit is contained in:
David Anderson 2014-03-07 00:37:44 -08:00
parent d4292370e3
commit 0cdee0af4e
3 changed files with 29 additions and 1 deletions

View File

@ -88,6 +88,10 @@ function display_team_page($team, $user) {
if (strlen($team->description)) {
row2(tra('Description'), sanitize_html($team->description));
}
row2("Created", date_str($team->create_time));
if (defined("SHOW_NONVALIDATED_TEAMS")) {
row2("Founder email validated", $user->email_validated?"Yes":"No (team will not be exported)");
}
if (strlen($team->url)) {;
if (strstr($team->url, "http://")) {
$x = $team->url;

View File

@ -45,10 +45,21 @@ function escape2($strin) {
}
function escape($strin) {
return htmlspecialchars($strin);
$dom = new DOMDocument('1.0');
$element = $dom->createElement('Element');
$element->appendChild(
$dom->createTextNode($strin)
);
$dom->appendChild($element);
$x = $dom->saveXml();
$x = substr($x, 31);
$x = substr($x, 0, -11);
return $x;
}
function handle_team($team, $f) {
echo "Team: $team->name\n";
$user = BoincUser::lookup_id($team->userid);
if (!$user) {
echo "no user for team $team->id\n";

View File

@ -66,6 +66,11 @@ function show_list($list) {
echo "
<tr>
<th>".tra("Team name")."</th>
";
if (defined("SHOW_NONVALIDATED_TEAMS")) {
echo "<th>Validated?</th>\n";
}
echo "
<th>".tra("Description")."</th>
<th>".tra("Average credit")."</th>
<th>".tra("Type")."</th>
@ -78,6 +83,14 @@ function show_list($list) {
$j = $i++ % 2;
echo "<tr class=row$j>
<td><a href=team_display.php?teamid=$team->id>$team->name</a></td>
";
if (defined("SHOW_NONVALIDATED_TEAMS")) {
$user = BoincUser::lookup_id($team->userid);
echo "<td>";
echo $user->email_validated?"Yes":"No";
echo "</td>\n";
}
echo "
<td><span class=note>".sanitize_html($team->description)."</span></td>
<td>".format_credit($team->expavg_credit)."</td>
<td>$type</td>