mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=3579
This commit is contained in:
parent
34b7319223
commit
b87634c90f
|
@ -13571,3 +13571,21 @@ Karl 2004-06-15
|
|||
|
||||
api/
|
||||
boinc_api_fortran.C
|
||||
|
||||
Daniel 15 June 2004
|
||||
- html: replaced uses of mysql_fetch_assoc with mysql_fetch_object
|
||||
when possible
|
||||
- html: got rid of file descriptor parameters for a lot of
|
||||
functions (esp. those used by gallery.inc). using output
|
||||
buffering now (ob_start(), ob_get_contents(), etc.)
|
||||
|
||||
html/
|
||||
inc/
|
||||
gallery.inc
|
||||
profile.inc
|
||||
util.inc
|
||||
project.sample/
|
||||
project.inc
|
||||
user/
|
||||
project.inc.sample
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ require_once("../inc/uotd.inc");
|
|||
|
||||
$alphabet = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','0','1','2','3','4','5','6','7','8','9');
|
||||
|
||||
|
||||
// Generates the html files which comprise the photo gallery.
|
||||
// $room: which gallery to generate (user, computer).
|
||||
// $width: the width of the table of images.
|
||||
|
@ -55,50 +56,65 @@ function build_picture_pages($width, $height) {
|
|||
$count = 0;
|
||||
|
||||
for ($page = 1; $page <= $numPages; $page++) {
|
||||
$file = PROFILE_PATH . "user_gallery_" . $page . ".html";
|
||||
$descriptor = fopen($file, "w");
|
||||
$filename = PROFILE_PATH . "user_gallery_" . $page . ".html";
|
||||
//$descriptor = fopen($file, "w");
|
||||
open_output_buffer();
|
||||
|
||||
page_head("User Picture Gallery: Page $page of $numPages", $descriptor);
|
||||
page_head("User Picture Gallery: Page $page of $numPages");
|
||||
|
||||
fwrite($descriptor,
|
||||
"Last updated "
|
||||
. pretty_time_str(time())
|
||||
. "\n<p>Browse the user profiles by picture.
|
||||
Only user profiles with pictures are listed here."
|
||||
);
|
||||
//fwrite($descriptor,
|
||||
// "Last updated "
|
||||
// . pretty_time_str(time())
|
||||
// . "\n<p>Browse the user profiles by picture.
|
||||
// Only user profiles with pictures are listed here."
|
||||
//);
|
||||
echo "Last updated ", pretty_time_str(time()),
|
||||
"\n<p>Browse the user profiles by picture.
|
||||
Only user profiles with pictures are listed here.";
|
||||
|
||||
fwrite($descriptor, "<table class=bordered border=1 cellpadding=5>\n");
|
||||
|
||||
//fwrite($descriptor, "<table class=bordered border=1 cellpadding=5>\n");
|
||||
echo "<table class=bordered border=1 cellpadding=5\n";
|
||||
|
||||
for ($row = 0; $row < $height; $row++) {
|
||||
fwrite($descriptor, "<tr>");
|
||||
//fwrite($descriptor, "<tr>");
|
||||
echo "<tr>";
|
||||
for ($col = 0; $col < $width; $col++) {
|
||||
if ($count < $numIds) {
|
||||
fwrite($descriptor,
|
||||
"<td class=bordered align=\"center\"><a href=\""
|
||||
. URL_BASE . "view_profile.php?userid="
|
||||
. $userIds[$count] . "\"><img src=\""
|
||||
. URL_BASE . IMAGE_URL . $userIds[$count] . '_sm.jpg'
|
||||
. "\"></a></td>"
|
||||
);
|
||||
//fwrite($descriptor,
|
||||
// "<td class=bordered align=\"center\"><a href=\""
|
||||
// . URL_BASE . "view_profile.php?userid="
|
||||
// . $userIds[$count] . "\"><img src=\""
|
||||
// . URL_BASE . IMAGE_URL . $userIds[$count] . '_sm.jpg'
|
||||
// . "\"></a></td>"
|
||||
//);
|
||||
echo "<td class=bordered align=\"center\"><a href=\"",
|
||||
URL_BASE, "view_profile.php?userid=",
|
||||
$userIds[$count], "\"><img src=\"",
|
||||
URL_BASE, IMAGE_URL, $userIds[$count],
|
||||
"_sm.jpg\"></a></td>";
|
||||
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
fwrite($descriptor, "</tr>\n");
|
||||
//fwrite($descriptor, "</tr>\n");
|
||||
echo "</tr>\n";
|
||||
if ($count == $numIds) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fwrite($descriptor, "</table>\n");
|
||||
//fwrite($descriptor, "</table>\n");
|
||||
echo "</table>\n";
|
||||
|
||||
// Previous and Next links
|
||||
|
||||
write_page_links("user_gallery", $page, $numPages, $descriptor);
|
||||
write_page_links("user_gallery", $page, $numPages);
|
||||
|
||||
page_tail(false, $descriptor);
|
||||
|
||||
fclose($descriptor);
|
||||
page_tail(false);
|
||||
|
||||
//fclose($descriptor);
|
||||
close_output_buffer($filename);
|
||||
}
|
||||
|
||||
//echo "<br><br><a href=\"" .PROFILE_PATH . "user_gallery_1.html\">Go to the first generated page.</a>";
|
||||
|
@ -220,21 +236,24 @@ function build_profile_pages($members, $pageHead, $pageTitle, $rowsPerPage, $col
|
|||
for ($page = 1; $page <= $numPages; $page++) {
|
||||
|
||||
$filename = $filePath . $baseFileName . "_" . $page . ".html";
|
||||
$descriptor = fopen($filename, "w");
|
||||
//$descriptor = fopen($filename, "w");
|
||||
open_output_buffer();
|
||||
|
||||
$head = $pageHead . ": Page $page of $numPages";
|
||||
page_head($pageTitle, $descriptor);
|
||||
page_head($pageTitle);
|
||||
|
||||
fwrite($descriptor, "Last updated " . pretty_time_str(time()) . "<p>\n");
|
||||
//fwrite($descriptor, "Last updated " . pretty_time_str(time()) . "<p>\n");
|
||||
echo "Last updated ", pretty_time_str(time()), "<p>\n";
|
||||
|
||||
$offset = (($page-1) * $rowsPerPage * $colsPerPage);
|
||||
|
||||
show_user_table($members, $offset, $numPerPage, $colsPerPage, $descriptor);
|
||||
show_user_table($members, $offset, $numPerPage, $colsPerPage);
|
||||
|
||||
write_page_links($baseFileName, $page, $numPages, $descriptor);
|
||||
write_page_links($baseFileName, $page, $numPages);
|
||||
|
||||
page_tail(false, $descriptor);
|
||||
fclose($descriptor);
|
||||
page_tail(false);
|
||||
|
||||
close_output_buffer($filename);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -243,50 +262,51 @@ function build_country_summary_page($countryMembers) {
|
|||
$countries = array_keys($countryMembers);
|
||||
|
||||
$filename = PROFILE_PATH . "profile_country.html";
|
||||
$descriptor = fopen($filename, "w");
|
||||
//$descriptor = fopen($filename, "w");
|
||||
open_output_buffer();
|
||||
|
||||
page_head("User Profiles by Country", $descriptor);
|
||||
fwrite($descriptor, "Last updated " . pretty_time_str(time()) . "<p>");
|
||||
page_head("User Profiles by Country");
|
||||
echo "Last updated " . pretty_time_str(time()) . "<p>";
|
||||
|
||||
fwrite($descriptor, "<table border=0>\n");
|
||||
fwrite($descriptor, "<tr><td><b>Country</b></td><td align=\"center\"><b>Profiles</b></td></tr>\n");
|
||||
echo "<table border=0>\n";
|
||||
echo "<tr><td><b>Country</b></td><td align=\"center\"><b>Profiles</b></td></tr>\n";
|
||||
|
||||
foreach ($countries as $country) {
|
||||
$numMembers = count($countryMembers[$country]);
|
||||
$name = get_legal_filename($country);
|
||||
|
||||
fwrite($descriptor,
|
||||
"<tr>\n<td><a href=\"profile_country_"
|
||||
. $name . "_1.html\">$country</a></td><td align=\"center\">$numMembers</td></td>\n"
|
||||
);
|
||||
echo "<tr>\n<td><a href=\"profile_country_",
|
||||
"{$name}_1.html\">$country</a></td><td align=\"center\">$numMembers</td></td>\n";
|
||||
}
|
||||
|
||||
fwrite($descriptor, "</table>");
|
||||
page_tail(false, $descriptor);
|
||||
echo "</table>";
|
||||
page_tail(false);
|
||||
|
||||
fclose($descriptor);
|
||||
//fclose($descriptor);
|
||||
close_output_buffer($filename);
|
||||
}
|
||||
|
||||
function build_alpha_summary_page($characters) {
|
||||
global $alphabet;
|
||||
|
||||
$filename = PROFILE_PATH."profile_alpha.html";
|
||||
$descriptor = fopen($filename, "w");
|
||||
//$descriptor = fopen($filename, "w");
|
||||
open_output_buffer();
|
||||
|
||||
foreach ($alphabet as $character) {
|
||||
if (in_array($character, $characters)) {
|
||||
fwrite($descriptor, "<a href=" . URL_BASE . PROFILE_URL . "profile_" . $character . "_1.html>$character</a> ");
|
||||
echo "<a href=", URL_BASE, PROFILE_URL, "profile_{$character}_1.html>$character</a> ";
|
||||
unset($characters[$character]);
|
||||
} else {
|
||||
fwrite($descriptor, "$character ");
|
||||
echo "$character ";
|
||||
}
|
||||
}
|
||||
|
||||
// Link to the 'Other' page if necessary.
|
||||
if (!empty($characters)) {
|
||||
fwrite($descriptor, "<a href=" . URL_BASE . PROFILE_URL . "profile_other_1.html>Other</a> ");
|
||||
echo "<a href=", URL_BASE, PROFILE_URL, "profile_other_1.html>Other</a> ";
|
||||
}
|
||||
fclose($descriptor);
|
||||
close_output_buffer($filename);
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -330,8 +330,7 @@ Your profile was successfully entered into our database.<br><br>
|
|||
page_tail();
|
||||
}
|
||||
|
||||
// Builds a summary table of user profiles, writing it to $descriptor if it is
|
||||
// available, or echoing if it is not.
|
||||
// Builds a summary table of user profiles.
|
||||
//
|
||||
// $members is an array of userIDs;
|
||||
// $offset indicates which entry to begin the table with
|
||||
|
@ -339,10 +338,8 @@ Your profile was successfully entered into our database.<br><br>
|
|||
// $cols indicates how many profile summaries should be written per row
|
||||
// $descriptor is an optional file descriptor to write the table to.
|
||||
|
||||
function show_user_table(
|
||||
$members, $offset, $numToDisplay, $cols, $descriptor=null
|
||||
) {
|
||||
write_fd($descriptor, "<table class=bordered border=1 cellpadding=5>\n");
|
||||
function show_user_table($members, $offset, $numToDisplay, $cols) {
|
||||
echo "<table class=bordered border=1 cellpadding=5>\n";
|
||||
|
||||
$rows = ceil($numToDisplay / $cols);
|
||||
$count = $offset;
|
||||
|
@ -353,30 +350,30 @@ function show_user_table(
|
|||
break;
|
||||
}
|
||||
|
||||
write_fd($descriptor, "<tr>\n");
|
||||
echo "<tr>\n";
|
||||
|
||||
for ($col = 0; $col < $cols; $col++) {
|
||||
if ($count < $numMembers) {
|
||||
write_fd($descriptor, "<td class=bordered width=7% height=64><center>");
|
||||
echo "<td class=bordered width=7% height=64><center>";
|
||||
|
||||
// Only link an image if the user has uploaded one.;
|
||||
$profile = get_profile($members[$count]);
|
||||
if ($profile->has_picture) {
|
||||
write_fd($descriptor, "<a href=\"" . URL_BASE . "view_profile.php?userid=" . $members[$count] . "\"><img src=\"" . URL_BASE . IMAGE_URL . $members[$count] . '_sm.jpg' . "\"></a>");
|
||||
echo "<a href=\"", URL_BASE, "view_profile.php?userid={$members[$count]}\"><img src=\"", URL_BASE, IMAGE_URL, "{$members[$count]}_sm.jpg\"></a>";
|
||||
|
||||
} else {
|
||||
write_fd($descriptor, " ");
|
||||
echo " ";
|
||||
}
|
||||
|
||||
write_fd($descriptor, "</center></td><td class=bordered width=33% height=64>\n". get_profile_summary($profile). "</td>");
|
||||
echo "</center></td><td class=bordered width=33% height=64>\n", get_profile_summary($profile), "</td>";
|
||||
$count++;
|
||||
} else {
|
||||
write_fd($descriptor, "<td width=7% height=64></td><td width=33% height=64></td>");
|
||||
echo "<td width=7% height=64></td><td width=33% height=64></td>";
|
||||
}
|
||||
}
|
||||
write_fd($descriptor, "</tr>\n");
|
||||
echo "</tr>\n";
|
||||
}
|
||||
write_fd($descriptor, "</table>\n");
|
||||
echo "</table>\n";
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -102,38 +102,26 @@ function show_combo_box($name, $filename, $selection=null) {
|
|||
fclose($file);
|
||||
}
|
||||
|
||||
// write to the given fd if non-null; else echo
|
||||
//
|
||||
function write_fd($fd, $str) {
|
||||
if ($fd) {
|
||||
fwrite($fd, $str);
|
||||
} else {
|
||||
echo $str;
|
||||
}
|
||||
}
|
||||
|
||||
function page_head($title, $fd=null) {
|
||||
function page_head($title) {
|
||||
$styleSheet = URL_BASE . STYLESHEET;
|
||||
|
||||
write_fd($fd,
|
||||
"<html><head><title>".strip_tags($title)."</title>
|
||||
echo "<html><head><title>".strip_tags($title)."</title>
|
||||
<link rel=stylesheet type=text/css href=\"$styleSheet\">
|
||||
</head>
|
||||
<body bgcolor=ffffff>
|
||||
"
|
||||
);
|
||||
project_banner($title, $fd);
|
||||
";
|
||||
project_banner($title);
|
||||
}
|
||||
|
||||
function page_tail($is_main=false, $fd=null) {
|
||||
write_fd($fd, "<br><hr noshade size=1><center>");
|
||||
function page_tail($is_main=false) {
|
||||
echo "<br><hr noshade size=1><center>";
|
||||
if (!$is_main) {
|
||||
write_fd($fd, "<a href=".MASTER_URL.">Return to ".PROJECT." main page</a><br>\n");
|
||||
echo "<a href=".MASTER_URL.">Return to ".PROJECT." main page</a><br>\n";
|
||||
}
|
||||
|
||||
// put your copyright notice etc. here
|
||||
|
||||
write_fd($fd, "<br><br>Copyright © 2004 ".COPYRIGHT_HOLDER."</center>\n</body>\n</html>");
|
||||
echo "<br><br>Copyright © 2004 ".COPYRIGHT_HOLDER."</center>\n</body>\n</html>";
|
||||
}
|
||||
|
||||
function db_error_page() {
|
||||
|
@ -347,33 +335,37 @@ function split_munged_email_addr($addr, $auth, &$email) {
|
|||
// Generates a standard set of links between associated multi-page documents.
|
||||
// All linked files must be of the form "$filename_<page number>.html".
|
||||
|
||||
function write_page_links($filename, $currPageNum, $numPages, $descriptor) {
|
||||
fwrite($descriptor, "<p>Page $currPageNum of $numPages</p>");
|
||||
function write_page_links($filename, $currPageNum, $numPages) {
|
||||
echo "<p>Page $currPageNum of $numPages</p>";
|
||||
|
||||
$nextPageNum = $currPageNum + 1;
|
||||
$prevPageNum = $currPageNum - 1;
|
||||
|
||||
// Make the 'previous' and 'next' page links as appropriate.
|
||||
if ($currPageNum > 1) {
|
||||
fwrite($descriptor, "<a href=$filename" . "_" . $prevPageNum . ".html>Previous Page</a>");
|
||||
echo "<a href={$filename}_{$prevPageNum}.html>Previous Page</a>";
|
||||
|
||||
if ($currPageNum != $numPages) {
|
||||
fwrite($descriptor, " | ");
|
||||
echo " | ";
|
||||
}
|
||||
}
|
||||
if ($currPageNum != $numPages) {
|
||||
fwrite($descriptor, "<a href=$filename" . "_" . $nextPageNum . ".html>Next Page</a>");
|
||||
//fwrite($descriptor, "<a href=$filename" . "_" . $nextPageNum . ".html>Next Page</a>");
|
||||
echo "<a href={$filename}_{$nextPageNum}.html>Next Page</a>";
|
||||
}
|
||||
|
||||
fwrite($descriptor, "<p>Jump to Page:\n");
|
||||
//fwrite($descriptor, "<p>Jump to Page:\n");
|
||||
echo "<p>Jump to Page:\n";
|
||||
|
||||
// Make the individual page links (or a bold non-link for the current page).
|
||||
//
|
||||
for ($i = 1; $i <= $numPages; $i++) {
|
||||
if ($i != $currPageNum) {
|
||||
fwrite($descriptor, "<a href=$filename" . "_" . $i . ".html>$i</a>\n");
|
||||
//fwrite($descriptor, "<a href=$filename" . "_" . $i . ".html>$i</a>\n");
|
||||
echo "<a href={$filename}_{$i}.html>$i</a>\n";
|
||||
} else {
|
||||
fwrite($descriptor, "<b>$i</b>\n");
|
||||
//fwrite($descriptor, "<b>$i</b>\n");
|
||||
echo "<b>$i</b>\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -441,4 +433,17 @@ function host_link($hostid) {
|
|||
}
|
||||
}
|
||||
|
||||
function open_output_buffer() {
|
||||
ob_start();
|
||||
ob_implicit_flush(0);
|
||||
}
|
||||
|
||||
function close_output_buffer($filename) {
|
||||
$fh = fopen($filename, "w");
|
||||
$page = ob_get_contents();
|
||||
ob_end_clean();
|
||||
fwrite($fh, $page);
|
||||
fclose($fh);
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -17,16 +17,16 @@ define("COPYRIGHT_HOLDER", "Test Group");
|
|||
define("SYS_ADMIN_EMAIL", "foo@a.b.c");
|
||||
|
||||
|
||||
function project_banner($title, $fd) {
|
||||
function project_banner($title) {
|
||||
// Put your project title and logo here
|
||||
|
||||
write_fd($fd, "<link rel=stylesheet type=text/css href=white.css>
|
||||
echo "<link rel=stylesheet type=text/css href=white.css>
|
||||
<table width=100%>
|
||||
<tr>
|
||||
<td><h2>$title</h2></td>
|
||||
<td align=right>
|
||||
</td></tr></table>
|
||||
");
|
||||
";
|
||||
}
|
||||
|
||||
// NOTE: These functions appear here and not in profile.inc because they contain
|
||||
|
|
|
@ -23,16 +23,16 @@ function project_intro() {
|
|||
";
|
||||
}
|
||||
|
||||
function project_banner($user, $fd) {
|
||||
function project_banner($user) {
|
||||
// Put your project title and logo here
|
||||
|
||||
write_fd($fd, "<table width=100%><tr><td><h2>".PROJECT."</h2></td><td align=right>\n");
|
||||
echo "<table width=100%><tr><td><h2>".PROJECT."</h2></td><td align=right>\n");
|
||||
if ($user) {
|
||||
write_fd($fd, "Logged in as $user->name");
|
||||
echo "Logged in as $user->name");
|
||||
} else {
|
||||
write_fd($fd, "<br>");
|
||||
echo "<br>");
|
||||
}
|
||||
write_fd($fd, "</td></tr></table><hr>\n");
|
||||
echo "</td></tr></table><hr>\n");
|
||||
}
|
||||
|
||||
// NOTE: These functions appear here and not in profile.inc because they contain
|
||||
|
|
Loading…
Reference in New Issue