xml;
$lines = explode("\n", $xml);
foreach ($lines as $line) {
$matches = array();
$retval = ereg('<([^>]*)>([^<]*)', $line, $matches);
$tag = $matches[1];
$val = $matches[2];
if (strstr($tag, 'text')) {
if ($val) {
$val = str_replace("\\r\\n", "\n", urldecode($val));
$val = str_replace('\\\\\\', '', $val);
$d = gmdate("g:i A \U\T\C, F d Y", $resp->update_time);
$sums[$tag][] = "$d
$val";
}
} else {
if ($val) {
$sums[$tag][$val]++;
}
}
}
}
function bar($n, $ntotal) {
if ($ntotal==0) {
return "$n ";
}
$w = (int)(100*$n/$ntotal);
if (!$w) $w=1;
return " $n ";
}
function other_link($sums, $other_name, $link_text, $ntotal) {
$y = "";
$n = count($sums[$other_name]);
if ($n) {
$fname = "poll_$other_name.html";
$b = bar($n, $ntotal);
$y .= "$b $link_text";
$f = fopen($fname, "w");
foreach ($sums[$other_name] as $text) {
fwrite($f, $text);
fwrite($f, "\n
"; list_start(); list_bar('Do you run BOINC?'); display_choices($sums, $overall_choices); list_bar('Your participation'); display_choices($sums, $project_items); list_bar('Your computers'); display_choices($sums, $comp_items); list_bar('You'); display_choices($sums, $you_items); display_countries($sums); list_bar('Comments'); list_item2( "Please suggest ways that BOINC, and the projects that use it, could be improved:", other_link($sums, $improved, "Show", 0) ); list_end(); page_tail(true); $f = fopen($cachefile, "w"); fwrite($f, ob_get_contents()); fclose($f); ?>