diff --git a/checkin_notes b/checkin_notes
index e5661ef6d4..670c51b490 100755
--- a/checkin_notes
+++ b/checkin_notes
@@ -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
+
diff --git a/html/inc/gallery.inc b/html/inc/gallery.inc
index 6fd10d718d..3bda697059 100644
--- a/html/inc/gallery.inc
+++ b/html/inc/gallery.inc
@@ -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
Browse the user profiles by picture.
- Only user profiles with pictures are listed here."
- );
+ //fwrite($descriptor,
+ // "Last updated "
+ // . pretty_time_str(time())
+ // . "\n
Browse the user profiles by picture.
+ // Only user profiles with pictures are listed here."
+ //);
+ echo "Last updated ", pretty_time_str(time()),
+ "\n
Browse the user profiles by picture.
+ Only user profiles with pictures are listed here.";
- fwrite($descriptor, "
\n");
+
+ //fwrite($descriptor, "
\n");
+ echo "
");
+ //fwrite($descriptor, "
");
+ echo "
";
for ($col = 0; $col < $width; $col++) {
if ($count < $numIds) {
- fwrite($descriptor,
- "
";
+ 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, "$character ");
+ echo "$character ";
unset($characters[$character]);
} else {
- fwrite($descriptor, "$character ");
+ echo "$character ";
}
}
// Link to the 'Other' page if necessary.
if (!empty($characters)) {
- fwrite($descriptor, "Other ");
+ echo "Other ";
}
- fclose($descriptor);
+ close_output_buffer($filename);
}
?>
diff --git a/html/inc/profile.inc b/html/inc/profile.inc
index a22bcb3ad9..824c180630 100644
--- a/html/inc/profile.inc
+++ b/html/inc/profile.inc
@@ -330,8 +330,7 @@ Your profile was successfully entered into our database.
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.
// $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, "
\n";
for ($col = 0; $col < $cols; $col++) {
if ($count < $numMembers) {
- write_fd($descriptor, "
");
+ echo "
";
// Only link an image if the user has uploaded one.;
$profile = get_profile($members[$count]);
if ($profile->has_picture) {
- write_fd($descriptor, "");
+ echo "";
} else {
- write_fd($descriptor, " ");
+ echo " ";
}
- write_fd($descriptor, "
\n\n";
}
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_.html".
-function write_page_links($filename, $currPageNum, $numPages, $descriptor) {
- fwrite($descriptor, "
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, "$i\n");
+ //fwrite($descriptor, "$i\n");
+ echo "$i\n";
} else {
- fwrite($descriptor, "$i\n");
+ //fwrite($descriptor, "$i\n");
+ echo "$i\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);
+}
+
?>
diff --git a/html/project.sample/project.inc b/html/project.sample/project.inc
index 017d90ccf0..d0a00c2681 100644
--- a/html/project.sample/project.inc
+++ b/html/project.sample/project.inc
@@ -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, "
+ echo "
$title
- ");
+ ";
}
// NOTE: These functions appear here and not in profile.inc because they contain
diff --git a/html/user/project.inc.sample b/html/user/project.inc.sample
index 20cb28545b..ae0f77ebfb 100644
--- a/html/user/project.inc.sample
+++ b/html/user/project.inc.sample
@@ -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, "
".PROJECT."
\n");
+ echo "
".PROJECT."
\n");
if ($user) {
- write_fd($fd, "Logged in as $user->name");
+ echo "Logged in as $user->name");
} else {
- write_fd($fd, " ");
+ echo " ");
}
- write_fd($fd, "
\n");
+ echo "
\n");
}
// NOTE: These functions appear here and not in profile.inc because they contain