*** empty log message ***

svn path=/trunk/boinc/; revision=2983
This commit is contained in:
David Anderson 2004-02-10 07:02:38 +00:00
parent b43d33ba8b
commit abd3561274
10 changed files with 63 additions and 397 deletions

View File

@ -9971,3 +9971,28 @@ David Feb 8 2004
tools_work.php
validate.php
web_site.php (removed)
David Feb 9 2004
- Scheduler: when last work request was too recent,
send request_delay to tell client to wait
- code that generates user profile gallery pages (inc/gallery.inc)
has a nightmare of hardwired URL and path names.
I unraveled things enough to make them work again.
Should revisit at some point.
- page_tail() wasn't working when writing to files
html/
inc/
gallery.inc
profile.inc
util.inc
ops/
gallery.inc (removed)
project.sample/
project.inc
user/
debug.php
profile_menu.php
project.inc.sample
sched/
handle_request.C

View File

@ -56,7 +56,7 @@ function build_picture_pages($width, $height) {
$count = 0;
for ($page = 1; $page <= $numPages; $page++) {
$file = "../html_user/" . PROFILE_PATH . "user_gallery_" . $page . ".html";
$file = PROFILE_PATH . "user_gallery_" . $page . ".html";
$descriptor = fopen($file, "w");
page_head("User Picture Gallery: Page $page of $numPages", null, $descriptor);
@ -77,8 +77,8 @@ function build_picture_pages($width, $height) {
fwrite($descriptor,
"<td class=bordered align=\"center\"><a href=\""
. URL_BASE . "view_profile.php?userid="
. $userIds[$count] . "\"><img src=\"" . '../'
. IMAGE_PATH . $userIds[$count] . '_sm.jpg'
. $userIds[$count] . "\"><img src=\""
. IMAGE_URL . $userIds[$count] . '_sm.jpg'
. "\"></a></td>"
);
$count++;
@ -96,13 +96,13 @@ function build_picture_pages($width, $height) {
write_page_links("user_gallery", $page, $numPages, $descriptor);
page_tail($descriptor);
page_tail(false, $descriptor);
fclose($descriptor);
}
//echo "<br><br><a href=\"" . "../html_user/" .PROFILE_PATH . "user_gallery_1.html\">Go to the first generated page.</a>";
//echo "<br><br><a href=\"" .PROFILE_PATH . "user_gallery_1.html\">Go to the first generated page.</a>";
}
// Creates pages grouping user profiles by country. Filenames are of the
@ -147,11 +147,11 @@ function build_country_pages() {
foreach ($countries as $country) {
$baseFileName = "profile_country_" . get_legal_filename($country);
$filePath = "../html_user/" . PROFILE_PATH;
$filePath = PROFILE_PATH;
build_profile_pages(
$countryMembers[$country],
"User Profiles from $country", $country, 5, 2,
$filePath, $baseFileName, "../html_user/"
$filePath, $baseFileName, "../html/"
);
}
@ -159,7 +159,7 @@ function build_country_pages() {
build_country_summary_page($countryMembers);
//echo "<br><a href=\"" . "../html_user/" . PROFILE_PATH . "profile_country.html\">View Summary Page</a>";
//echo "<br><a href=\"" . PROFILE_PATH . "profile_country.html\">View Summary Page</a>";
//echo "<br><br>Done";
}
@ -194,7 +194,7 @@ function build_alpha_pages() {
foreach ($letters as $letter) {
// NOTE: Array indexing is case sensitive.
$filePath = "../html_user/" . PROFILE_PATH;
$filePath = PROFILE_PATH;
if (in_array($letter, $alphabet)) {
build_profile_pages(
$members[$letter],
@ -242,7 +242,7 @@ function build_profile_pages($members, $pageHead, $pageTitle, $rowsPerPage, $col
write_page_links($baseFileName, $page, $numPages, $descriptor);
page_tail($descriptor);
page_tail(false, $descriptor);
fclose($descriptor);
}
@ -251,7 +251,7 @@ function build_profile_pages($members, $pageHead, $pageTitle, $rowsPerPage, $col
function build_country_summary_page($countryMembers) {
$countries = array_keys($countryMembers);
$filename = "../html_user/" . PROFILE_PATH . "profile_country.html";
$filename = PROFILE_PATH . "profile_country.html";
$descriptor = fopen($filename, "w");
page_head("User Profiles by Country", null, $descriptor);
@ -271,7 +271,7 @@ function build_country_summary_page($countryMembers) {
}
fwrite($descriptor, "</table>");
page_tail($descriptor);
page_tail(false, $descriptor);
fclose($descriptor);
}
@ -279,7 +279,7 @@ function build_country_summary_page($countryMembers) {
function build_alpha_summary_page($characters) {
global $alphabet;
$filename = "../html_user/profile_alpha.html";
$filename = PROFILE_PATH."profile_alpha.html";
$descriptor = fopen($filename, "w");
foreach ($alphabet as $character) {
@ -299,12 +299,12 @@ function build_alpha_summary_page($characters) {
}
function generate_uod_page($profile, $user) {
$filename = "../html_user/uotd.html";
$filename = PROFILE_PATH."uotd.html";
$descriptor = fopen($filename, "w");
if ($profile->has_picture) {
fwrite($descriptor,
"<a href=view_profile?userid=$user->id><img align=left src=" . IMAGE_PATH . $user->id . "_sm.jpg></a>"
"<a href=view_profile?userid=$user->id><img align=left src=" . IMAGE_URL . $user->id . "_sm.jpg></a>"
);
}
$x = user_links($user);

View File

@ -104,7 +104,7 @@ function show_picture_option() {
<tr><td colspan=2>
<table border=0 cellpadding=5
<tr>
<td><a href=\"" . IMAGE_PATH . $profile_info['userid'] . '.jpg' . "\"><img src=\"" . IMAGE_PATH . $profile_info['userid'] . '_sm.jpg' . "\"></a><p>
<td><a href=\"" . IMAGE_URL . $profile_info['userid'] . '.jpg' . "\"><img src=\"" . IMAGE_URL . $profile_info['userid'] . '_sm.jpg' . "\"></a><p>
<input type=\"checkbox\" name=\"delete_pic\">Delete
</td>
<td>You have previously uploaded a picture of yourself
@ -380,7 +380,7 @@ function show_user_table(
$profile = mysql_fetch_assoc($result);
if ($profile['has_picture']) {
write_fd($descriptor, "<a href=\"" . URL_BASE . "view_profile.php?userid=" . $members[$count] . "\"><img src=\"" . URL_BASE . IMAGE_PATH . $members[$count] . '_sm.jpg' . "\"></a>");
write_fd($descriptor, "<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, "&nbsp;");
@ -486,8 +486,8 @@ function show_profile_summary($user, $profile_info, $can_edit, $verify_mode) {
// Only display an image if the user has uploaded one;
if ($profile_info['has_picture']) {
//echo "<a href=\"" , URL_BASE, IMAGE_PATH , $user->id , '.jpg' . "\"><img align=left vspace=6 hspace=9 src=\"" , URL_BASE, IMAGE_PATH , $user->id , '_sm.jpg' . "\"></a>\n";
echo "<br><img vspace=6 hspace=9 src=\"" , URL_BASE, IMAGE_PATH , $user->id , '.jpg' . "\">\n";
//echo "<a href=\"" , URL_BASE, IMAGE_URL , $user->id , '.jpg' . "\"><img align=left vspace=6 hspace=9 src=\"" , URL_BASE, IMAGE_URL , $user->id , '_sm.jpg' . "\"></a>\n";
echo "<br><img vspace=6 hspace=9 src=\"" , URL_BASE, IMAGE_URL , $user->id , '.jpg' . "\">\n";
}
echo "

View File

@ -134,15 +134,15 @@ function page_head($title, $user=null, $fd=null, $styleSheet=null) {
project_banner($user, $fd);
}
function page_tail($is_main=false) {
echo "<br><hr noshade size=1><center>";
function page_tail($is_main=false, $fd=null) {
write_fd($fd, "<br><hr noshade size=1><center>");
if (!$is_main) {
echo "<a href=".MASTER_URL.">Return to ".PROJECT." main page</a><br>\n";
write_fd($fd, "<a href=".MASTER_URL.">Return to ".PROJECT." main page</a><br>\n");
}
// put your copyright notice etc. here
echo "<br><br>Copyright &copy; 2004 ".COPYRIGHT_HOLDER."</center>\n</body>\n</html>";
write_fd($fd, "<br><br>Copyright &copy; 2004 ".COPYRIGHT_HOLDER."</center>\n</body>\n</html>");
}
function db_error_page() {

View File

@ -1,363 +0,0 @@
<?php
require_once("../html_user/project_specific/project.inc");
require_once("../html_user/profile.inc");
require_once("../html_user/util.inc");
// OK, so it's not quite the alphabet,
// but alphanumerabet is a bad variable name.
//
$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.
// $height: the height of the table of images.
function build_picture_pages($width, $height) {
// TODO: Add support for a computer image gallery.
// TODO: Should we eliminate the has_picture flag? Doesn't really
// seem necessary when we're building static pages- could just use
// file_exists on the username...
// TODO: Standardize "Last modified" string to a function call (util.inc).
$query = "SELECT userid FROM profile WHERE has_picture = 1";
$result = mysql_query($query);
$numIds = mysql_num_rows($result);
//echo "Result has $numIds rows.<br>";
// Build an array of IDs of all users with pictures in their profiles.
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
$userIds[] = $row[0];
}
mysql_free_result($result);
if (count($userIds) > 0) {
// Randomize the ordering of users.
shuffle($userIds);
}
$numPages = ceil(count($userIds)/($width * $height));
// Make sure that a page is generated even when no profiles with pictures
// exist in order to avoid 404 errors from the profile_menu page.
if ($numPages == 0) {
$numPages = 1;
}
//echo "Generating $numPages pages.<br>";
$count = 0;
for ($page = 1; $page <= $numPages; $page++) {
$file = "../html_user/" . PROFILE_PATH . "user_gallery_" . $page . ".html";
$descriptor = fopen($file, "w");
page_head("User Picture Gallery: Page $page of $numPages", null, $descriptor);
fwrite($descriptor,
"<h2>User Profile Pictures</h2>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");
for ($row = 0; $row < $height; $row++) {
fwrite($descriptor, "<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=\"" . '../'
. IMAGE_PATH . $userIds[$count] . '_sm.jpg'
. "\"></a></td>"
);
$count++;
}
}
fwrite($descriptor, "</tr>\n");
if ($count == $numIds) {
break;
}
}
fwrite($descriptor, "</table>\n");
// Previous and Next links
write_page_links("user_gallery", $page, $numPages, $descriptor);
page_tail($descriptor);
fclose($descriptor);
}
//echo "<br><br><a href=\"" . "../html_user/" .PROFILE_PATH . "user_gallery_1.html\">Go to the first generated page.</a>";
}
// Creates pages grouping user profiles by country. Filenames are of the
// format "profile_country_<country name>_<page number>.html"
// Also creates a summary page listing all countries which have profiled
// members, the number of such members, and links to the created pages for
// each country.
function build_country_pages() {
$query = "SELECT * FROM profile";
$result = mysql_query($query);
$numIds = 0;
// Build a multi-dimensional array of countries,
// each element of which contains an array
// of the userids who belong to those countries.
// Format: array[country][index] = userid.
while ($profile = mysql_fetch_object($result)) {
$query2 = "SELECT * FROM user WHERE id=$profile->userid";
$result2 = mysql_query($query2);
$row2 = mysql_fetch_object($result2);
if ($row2->country) {
$countryMembers[$row2->country][] = $row2->id;
$numIds++;
} else {
$countryMembers['Other'][] = $row2->id;
}
}
mysql_free_result($result);
mysql_free_result($result2);
//echo "$numIds users have profiles AND non-null country entries.<br>";
$countries = array_keys($countryMembers);
sort($countries);
// Build the pages.
// TODO: Define a constant for the desired number of rows per page.
foreach ($countries as $country) {
$baseFileName = "profile_country_" . get_legal_filename($country);
$filePath = "../html_user/" . PROFILE_PATH;
build_profile_pages(
$countryMembers[$country],
"User Profiles from $country", $country, 5, 2,
$filePath, $baseFileName, "../html_user/"
);
}
// Build the summary page linking to the individual country pages.
build_country_summary_page($countryMembers);
//echo "<br><a href=\"" . "../html_user/" . PROFILE_PATH . "profile_country.html\">View Summary Page</a>";
//echo "<br><br>Done";
}
// Creates pages grouping users by the first letter of their names.
function build_alpha_pages() {
global $alphabet;
$query = "SELECT * FROM profile";
$result = mysql_query($query);
$numIds = 0;
while ($row = mysql_fetch_assoc($result)) {
$query2 = "SELECT * FROM user WHERE id = " . $row['userid'];
$result2 = mysql_query($query2);
$row2 = mysql_fetch_assoc($result2);
if ($row2['name']) {
$name = ltrim($row2['name']);
$members[strtoupper($name[0])][] = $row2['id'];
$numIds++;
}
}
mysql_free_result($result);
mysql_free_result($result2);
//echo "$numIds users have profiles AND non-null country entries.<br>";
$letters = array_keys($members);
foreach ($letters as $letter) {
// NOTE: Array indexing is case sensitive.
$filePath = "../html_user/" . PROFILE_PATH;
if (in_array($letter, $alphabet)) {
build_profile_pages(
$members[$letter],
"User Profiles - Names beginning with $letter",
"Names beginning with $letter", 5, 2, $filePath,
"profile_$letter"
);
} else {
build_profile_pages(
$members[$letter],
"User Profiles - Names beginning with other characters",
"Names beginning with other characters", 5, 2, $filePath,
"profile_other"
);
}
}
build_alpha_summary_page($letters);
}
// A generalized function to produce some number of pages summarizing a
// set of user profiles.
function build_profile_pages($members, $pageHead, $pageTitle, $rowsPerPage, $colsPerPage, $filePath, $baseFileName) {
$numMembers = count($members);
$numPerPage = $rowsPerPage * $colsPerPage;
$numPages = ceil(count($members) / $numPerPage);
$count = 0;
for ($page = 1; $page <= $numPages; $page++) {
$filename = $filePath . $baseFileName . "_" . $page . ".html";
$descriptor = fopen($filename, "w");
$head = $pageHead . ": Page $page of $numPages";
page_head($pageHead, null, $descriptor);
fwrite($descriptor, "<h2>$pageTitle</h2>\n");
fwrite($descriptor, "Last updated " . pretty_time_str(time()) . "<p>\n");
$offset = (($page-1) * $rowsPerPage * $colsPerPage);
show_user_table($members, $offset, $numPerPage, $colsPerPage, $descriptor);
write_page_links($baseFileName, $page, $numPages, $descriptor);
page_tail($descriptor);
fclose($descriptor);
}
}
function build_country_summary_page($countryMembers) {
$countries = array_keys($countryMembers);
$filename = "../html_user/" . PROFILE_PATH . "profile_country.html";
$descriptor = fopen($filename, "w");
page_head("User Profiles by Country", null, $descriptor);
fwrite($descriptor, "<h2>User Profiles by Country</h2>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");
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"
);
}
fwrite($descriptor, "</table>");
page_tail($descriptor);
fclose($descriptor);
}
function build_alpha_summary_page($characters) {
global $alphabet;
$filename = "../html_user/profile_alpha.html";
$descriptor = fopen($filename, "w");
foreach ($alphabet as $character) {
if (in_array($character, $characters)) {
fwrite($descriptor, "<a href=" . PROFILE_PATH . "profile_" . $character . "_1.html>$character</a>&nbsp;");
unset($characters[$character]);
} else {
fwrite($descriptor, "$character ");
}
}
// Link to the 'Other' page if necessary.
if (!empty($characters)) {
fwrite($descriptor, "<a href=" . PROFILE_PATH . "profile_other_1.html>Other</a>&nbsp;");
}
fclose($descriptor);
}
function generate_uod_page($profile, $user) {
$filename = "../html_user/uotd.html";
$descriptor = fopen($filename, "w");
if ($profile->has_picture) {
fwrite($descriptor,
"<a href=view_profile?userid=$user->id><img align=left src=" . IMAGE_PATH . $user->id . "_sm.jpg></a>"
);
}
$x = user_links($user);
fwrite($descriptor, "The " . PROJECT . " User of the Day is $x");
fclose($descriptor);
}
// see if it's time to pick a new UOD.
// Either way, generate the UOD page
//
function build_uotd_page() {
// Check if the current UOTD has had their 24 hours of fame - if so, pick a new one.
$result = mysql_query("SELECT * FROM profile ORDER BY uotd_time DESC LIMIT 1");
if (mysql_num_rows($result) > 0) {
$current_uotd = mysql_fetch_object($result);
$assigned = getdate($current_uotd->uotd_time);
$now = getdate(time());
if ($assigned['mday'] == $now['mday']) {
$user = lookup_user_id($current_uotd->userid);
generate_uod_page($current_uotd, $user);
exit();
}
}
// TODO: Verify that adding RAND() didn't screw this up.
$result = mysql_query("SELECT * FROM profile WHERE verification = 1 AND uotd_time IS NULL ORDER BY RAND()");
// If the number of approved profiles dips below a threshold, email the sys admin every time we pick a new one.
if ($result && mysql_num_rows($result) < UOTD_THRESHOLD) {
mail(SYS_ADMIN_EMAIL, PROJECT . ": User of the Day pool is running low!", "The pool of approved candidates for User of the Day has reached your assigned threshold: there are now only " . mysql_num_rows($result) . " approved users.\n\nTo approve more candidates for User of the Day, direct your web browser to the " . PROJECT . " administration page and click \"Unrated profile\"");
}
if ($result && mysql_num_rows($result) == 0) {
// If all verified profiles have been selected as UOTD, reshow the one that was shown least recently.
$result = mysql_query("SELECT * FROM profile WHERE verification = 1 ORDER BY uotd_time ASC LIMIT 1");
}
if (!$result || mysql_num_rows($result) == 0) {
// No valid users of the day - do something.
exit();
}
$profile = mysql_fetch_object($result);
$user = lookup_user_id($profile->userid);
generate_uod_page($profile);
$sql = "UPDATE profile SET uotd_time = " . time() . " WHERE userid=$user->id";
mysql_query($sql);
mail($user->email_addr,
"You're the " . PROJECT . " user of the day!",
"Congratulations!\n\nYou've been chosen as the "
. PROJECT . " user of the day! Your profile will be featured on the " . PROJECT . " website for the next 24 hours. Thanks again for supporting us- it's members like you that make distributed computing projects like ours such a success.\n\nBest regards and much thanks,\n\nThe " . PROJECT . " team."
);
}
?>

View File

@ -1,4 +1,5 @@
<?php
//z
// This is a sample project file.
// Modify it to suit your project.
@ -9,8 +10,8 @@ require_once("../inc/util.inc");
define("PROJECT", "Test Project");
define("MASTER_URL", "http://boinc.berkeley.edu/");
define("URL_BASE", "");
define('IMAGE_PATH', 'images/user_profile/');
define('PROFILE_PATH', 'user_profile/');
define('IMAGE_PATH', '../user_profile/images/');
define('PROFILE_PATH', '../user_profile/');
define('LANGUAGE_FILE', 'languages.txt');
define('STYLESHEET', 'white.css');
define('COPYRIGHT_HOLDER', 'Test Group');

View File

@ -18,9 +18,9 @@ require_once("../inc/util.inc");
<p>
<b>BOINC core client</b>
<p>
The zipped symbol file(s) are for the BOINC core client 2.24
The zipped symbol file(s) are for the BOINC core client 2.25
(both GUI and CLI versions) are here:
<a href=http://setiboinc.ssl.berkeley.edu/ap/download/boinc_224_pdb.zip>boinc_224_pdb.zip</a>
<a href=http://setiboinc.ssl.berkeley.edu/ap/download/boinc_225_pdb.zip>boinc_225_pdb.zip</a>
<p>
Place the extracted file(s) in the same directory as the executable(s)
(usually <code>C:/Program Files/BOINC</code>).

View File

@ -6,7 +6,6 @@ require_once("../inc/profile.inc");
db_init();
page_head("Profile Zone");
$cmd = $_GET['cmd'];
if ($cmd) {
@ -14,6 +13,8 @@ if ($cmd) {
exit();
}
page_head("Profile Zone");
start_table_noborder();
rowify("
@ -32,15 +33,15 @@ $today = getdate(time());
$UOTD_heading = "User of the Day -- " . $today['month'] . " " . $today['mday'] . ", " . $today['year'];
row1($UOTD_heading);
echo "<tr><td>";
include("uotd.html");
include("user_profile/uotd.html");
echo "</td></tr>";
rowify("<br>");
row1("User Profile Explorer");
echo "<tr><td>
<ul>
<li>View the <a href=" . PROFILE_PATH . "user_gallery_1.html>User Picture Gallery</a>.
<li>Browse profiles <a href=" . PROFILE_PATH . "profile_country.html>by country</a>.
<li>View the <a href=" . PROFILE_URL . "user_gallery_1.html>User Picture Gallery</a>.
<li>Browse profiles <a href=" . PROFILE_URL . "profile_country.html>by country</a>.
<li>Browse profiles <a href=" . $_SERVER['PHP_SELF'] . "?cmd=rand&pic=-1>at random</a>,
<a href=" . $_SERVER['PHP_SELF'] . "?cmd=rand&pic=1>at random with pictures</a>, or
<a href=" . $_SERVER['PHP_SELF'] . "?cmd=rand&pic=0>at random without pictures</a>.

View File

@ -4,13 +4,14 @@
// Modify it to suit your project.
// Put your version in html_user/project_specific/project.inc
require_once("util.inc");
require_once("../inc/util.inc");
define("PROJECT", "Test Project");
define("MASTER_URL", "http://boinc.berkeley.edu/");
define("URL_BASE", "");
define('IMAGE_PATH', 'images/user_profile/');
define('PROFILE_PATH', 'user_profile/');
define('IMAGE_PATH', '../user_profile/images/');
define('PROFILE_PATH', '../user_profile/');
define('PROFILE_URL', 'user_profile/');
define('LANGUAGE_FILE', 'languages.txt');
define('STYLESHEET', 'white.css');
define('COPYRIGHT_HOLDER', 'Test Group');

View File

@ -1126,6 +1126,7 @@ void process_request(
"Not sending work - last RPC too recent: %d sec", (int)diff
);
strcpy(reply.message_priority, "low");
reply.request_delay = config.min_sendwork_interval;
}
}
if (ok_to_send) {