svn path=/trunk/boinc/; revision=1021
This commit is contained in:
David Anderson 2003-03-06 17:42:49 +00:00
parent c805370756
commit a26d8c4d1a
36 changed files with 293 additions and 315 deletions

View File

@ -3691,3 +3691,44 @@ David Mar 5 2003
sched/
Makefile.in
server_types.C
David Mar 6 2003
- new show_message() conventions (not fully implemented):
- all error conditions should call show_message() with MSG_ERROR
- all log writes should use show_message() with MSG_INFO
TODO: change Win implementation of show_message() to
write to window AND to file (stderr.txt or stdout.txt)
- messages are now timestamped and show project name
- use start_table() and row2() more uniformly in user HTML
- user HTML: show message if can't connect to DB
- standardize terminology in user HTML: "general prefs",
"default computer location", etc.
client/
client_state.C
cs_scheduler.C
main.C
message.h
scheduler_op.C
doc/
prefs.html
html_user/
add_venue_form.php
bug_report_form.php
create_account*.php
db.inc
edit_email_form.php
edit_user_info_form.php
index.php
login*.php
prefs.inc
prefs_edit_form.php
show_user.php
team_create_form.php
top_hosts.php
user.inc
util.inc
lib/
util.C,h
sched/
*.C

View File

@ -140,7 +140,7 @@ int CLIENT_STATE::init() {
//
retval = global_prefs.parse_file(host_venue);
if (retval) {
printf("No global preferences file; will use defaults.\n");
printf("Using default preferences.\n");
}
install_global_prefs();
@ -152,7 +152,7 @@ int CLIENT_STATE::init() {
//
if (gstate.should_run_time_tests()) {
time_tests_start = time(0);
show_message(NULL, "Running time tests", "low");
show_message(NULL, "Running CPU benchmarks", MSG_INFO);
#ifdef _WIN32
time_tests_handle = CreateThread(
NULL, 0, win_time_tests, NULL, 0, &time_tests_id
@ -279,7 +279,7 @@ int CLIENT_STATE::check_time_tests() {
GetExitCodeThread(time_tests_handle, &exit_code);
if(exit_code == STILL_ACTIVE) {
if(time(NULL) > time_tests_start + MAX_TIME_TESTS_SECONDS) {
show_message(NULL, "Time tests timed out, using default values", "low");
show_message(NULL, "CPU benchmarks timed out, using default values", MSG_ERROR);
TerminateThread(time_tests_handle, 0);
CloseHandle(time_tests_handle);
host_info.p_fpops = 1e9;
@ -297,7 +297,7 @@ int CLIENT_STATE::check_time_tests() {
retval = waitpid(time_tests_id, &exit_code, WNOHANG);
if(retval == 0) {
if((unsigned int)time(NULL) > time_tests_start + MAX_TIME_TESTS_SECONDS) {
show_message(NULL, "Time tests timed out, using default values", "low");
show_message(NULL, "CPU benchmarks timed out, using default values", MSG_ERROR);
kill(time_tests_id, SIGKILL);
host_info.p_fpops = 1e9;
host_info.p_iops = 1e9;
@ -310,10 +310,10 @@ int CLIENT_STATE::check_time_tests() {
}
#endif
time_tests_id = 0;
show_message(NULL, "Time tests complete", "low");
show_message(NULL, "CPU benchmarks complete", MSG_INFO);
finfo = fopen(TIME_TESTS_FILE_NAME, "r");
if(!finfo) {
show_message(NULL, "Error in time tests file, using default values", "low");
if (!finfo) {
show_message(NULL, "Can't open CPU benchmark file, using default values", MSG_ERROR);
host_info.p_fpops = 1e9;
host_info.p_iops = 1e9;
host_info.p_membw = 4e9;

View File

@ -350,7 +350,8 @@ int CLIENT_STATE::handle_scheduler_reply(
project->user_expavg_credit = sr.user_expavg_credit;
project->user_create_time = sr.user_create_time;
if (strlen(sr.message)) {
show_message(project, sr.message, sr.message_priority);
int prio = (!strcmp(sr.message_priority, "high"))?MSG_ERROR:MSG_INFO;
show_message(project, sr.message, prio);
}
if (sr.request_delay) {

View File

@ -38,11 +38,13 @@
// Display a message to the user.
// Depending on the priority, the message may be more or less obtrusive
//
void show_message(PROJECT *p, char* message, char* priority) {
if (!strcmp(priority, "high")) {
fprintf(stderr, "BOINC core client: %s (priority: %s)\n", message, priority);
} else {
printf("BOINC core client: %s (priority: %s)\n", message, priority);
void show_message(PROJECT *p, char* message, int priority) {
const char* proj = p?p->project_name:"BOINC";
switch (priority) {
case MSG_ERROR:
fprintf(stderr, "%s [%s] %s", timestamp(), proj, message);
default:
printf("%s [%s] %s", timestamp(), proj, message);
}
}

View File

@ -1,4 +1,11 @@
// show a message.
// Implemented in different ways in cmdline client versus GUI client
//
extern void show_message(PROJECT *p, char* message, char* priority);
// Show a message, preceded by timestamp and project name
// priorities:
#define MSG_INFO 1
// cmdline: write to stdout
// GUI: write to msg window
#define MSG_ERROR 2
// cmdline: write to stderr
// GUI: write to msg window in bold or red
extern void show_message(PROJECT *p, char* message, int priority);

View File

@ -351,7 +351,7 @@ bool SCHEDULER_OP::poll() {
"Could not contact %s. Make sure this is the correct project URL.",
err_url
);
show_message(project, err_msg, "high");
show_message(project, err_msg, MSG_ERROR);
project->master_fetch_failures++;
backoff(project, err_msg);
}

View File

@ -5,8 +5,8 @@
You can specify <b>preferences</b> determining and limiting
how BOINC uses your computers.
Preferences are divided into two groups:
<h3>Global preferences</h3>
<b>Global preferences</b> apply to all projects in which you participate.
<h3>General preferences</h3>
<b>General preferences</b> apply to all BOINC projects in which you participate.
They include:
<ul>
<li> Whether work (computation and network transfer) should be done
@ -29,8 +29,8 @@ Changes are automatically propagated to all your hosts;
this is done the next time the host contacts the project's server,
so there may be some delay.
<h3>Per-project preferences</h3>
There is a separate set of <b>per-project preferences</b>
<h3>Project preferences</h3>
There is a separate set of <b>project preferences</b>
for each project in which you participate.
They include:
<ul>
@ -42,5 +42,20 @@ the amount allocated to a project is proportional to this number.
e.g., to specify graphics color schemes).
</ul>
<p>
You can view and edit per-project preferences through
You can view and edit project preferences through
a web interface at the project's web site.
<h3>Location-specific preferences</h3>
If you have computers both at home and at work
you may want to use differences preferences for them.
In addition to your "primary preferences"
(which are used by default)
BOINC allows you to create separate preferences for
home, work, and school.
<p>
Your account with a project has a "default location"
(home, work, or school).
New computers registered to your account will be
given the default location.
You can change the location of an existing computer
through the project's web site.

View File

@ -13,8 +13,8 @@
$subset = $_GET["subset"];
$x = subset_name($subset);
page_head("Add $x preferences for computers at $venue");
echo "<h2>Add $x preferences for computers at $venue</h2>";
page_head("Add $x preferences for $venue");
echo "<h2>Add $x preferences for $venue</h2>";
echo "<form action=add_venue_action.php>
<input type=hidden name=venue value=$venue>
<input type=hidden name=subset value=$subset>
@ -28,7 +28,7 @@
prefs_form_resource($prefs);
prefs_form_project($prefs);
}
row2("","<input type=submit value=OK>");
row2("","<input type=submit value=\"Add preferences\">");
end_table();
echo "</form>\n";
page_tail();

View File

@ -31,22 +31,19 @@ page_head("Problem Report Form", $user);
echo "
<h3>Problem Report Form</h3>
<form method=post action=bug_report_action.php>
<table>
<tr><td align=right>Computer type</td><td>
";
";
start_table();
row2_init("Computer type", "");
print_platform_select();
echo"
</td></tr>
<tr><td valign=top align=right>
Problem description:
</td><td>
<textarea name=problem rows=10 cols=80></textarea>
</td></tr>
<tr><td><br></td><td>
<input type=submit value=OK>
</td></tr></table>
</form>
";
echo" </td></tr>\n";
row2("Problem description",
"<textarea name=problem rows=10 cols=80></textarea>"
);
row2("",
"<input type=submit value=\"Submit problem report\">"
);
end_table();
echo" </form> ";
page_tail();
?>

View File

@ -14,9 +14,17 @@ function show_error($str) {
$authenticator = init_session();
db_init();
$new_name = $HTTP_POST_VARS["new_name"];
if (strlen($new_name)==0) {
show_error("You must supply a name for your account");
}
$new_email_addr = $HTTP_POST_VARS["new_email_addr"];
if (!is_valid_email_addr($new_email_addr)) {
show_error("Invalid email address");
show_error("Invalid email address:
you must enter a valid address of the form
name@domain"
);
}
$query = "select * from user where email_addr='$new_email_addr'";
$result = mysql_query($query);
@ -28,23 +36,13 @@ function show_error($str) {
}
}
// web passwords disabled by default
if (0) {
if (strlen($HTTP_POST_VARS["new_password"]) == 0) {
show_error("Password missing");
}
if ($HTTP_POST_VARS["new_password"] != $HTTP_POST_VARS["new_password2"]) {
show_error("Different passwords entered");
}
}
$authenticator = random_string();
$munged_email_addr = munge_email_addr($new_email_addr, $authenticator);
$query = sprintf(
"insert into user (create_time, email_addr, name, web_password, authenticator, country, postal_code, total_credit, expavg_credit, expavg_time, teamid, venue) values(%d, '%s', '%s', '%s', '%s', '%s', '%s', 0, 0, 0, 0, 'home')",
time(),
$munged_email_addr,
$HTTP_POST_VARS["new_name"],
$new_name,
$HTTP_POST_VARS["new_password"],
$authenticator,
$HTTP_POST_VARS["country"],

View File

@ -3,75 +3,42 @@
include_once("util.inc");
page_head("Create account");
?>
<h3>Create an account</h3>
echo "<h3>Create an account with ".PROJECT."</h3>
<form method=post action=create_account_action.php>
";
<form method=post action=create_account_action.php>
start_table();
row2("<b>Name:</b>
<br><font size=-1>
This will identify you on our web site.
Use your real name or a nickname.
</font>",
"<input name=new_name size=30>"
);
row2("<b>Email address:</b>
<br><font size=-1>
Must be a valid address of the form name@domain.
</font>",
"<input name=new_email_addr size=50>"
);
<table cellpadding=8>
<tr><td align=right>
<b>Name:</b>
<br><font size=-1>
This will identify you on our web site.
Use your real name or a nickname.
</font>
</td><td>
<input name=new_name size=30>
</td></tr>
<tr><td align=right>
<b>Email address:</b>
<br><font size=-1>
Must be a valid address of the form name@domain.
</font>
</td><td>
<input name=new_email_addr size=50>
</td></tr>
<!--
<tr><td align=right>
<b>Password:</b>
<br><font size=-1>Used to log in to your account</font>
</td><td>
<input name=new_password type=password>
</td></tr>
<tr><td align=right>
<b>Retype password to confirm:</b>
</td><td>
<input name=new_password2 type=password>
</td></tr>
-->
<tr><td align=right>
<b>Country:</b>
<br><font size=-1>Select the country you wish to represent, if any.</font>
</td><td>
<select name=country>
<?php
row2_init("<b>Country:</b>
<br><font size=-1>Select the country you wish to represent, if any.</font>",
"<select name=country>"
);
print_country_select();
?>
</select>
echo "</select></td></tr>\n";
</td></tr>
row2("<b>Postal or ZIP code:</b>
<br><font size=-1>Optional</font>",
"<input name=postal_code size=20>"
);
<tr><td align=right>
<b>Postal or ZIP code:</b>
<br><font size=-1>Optional</font>
</td><td>
<input name=postal_code size=20>
</td></tr>
row2("", "<input type=submit value=\"Create account\">");
end_table();
echo "</form>\n";
<tr><td align=right>
<br>
</td><td>
<input type=submit value="Create account">
</td></tr>
</table>
</form>
<?php
page_tail();
?>

View File

@ -6,9 +6,9 @@
function db_init() {
$retval = mysql_pconnect();
if (!$retval) {
echo "Database error - please try again later";
exit();
}
$db_name = parse_config("<db_name>");
mysql_select_db($db_name);
}
@ -19,9 +19,8 @@ function lookup_user_auth($auth) {
$user = mysql_fetch_object($result);
mysql_free_result($result);
return $user;
} else {
return 0;
}
return null;
}
?>

View File

@ -16,14 +16,16 @@ if (is_valid_email_addr($user->email_addr)) {
$email_text = "Verification pending";
}
echo "<form method=post action=edit_email_action.php>\n
".TABLE2."\n
<tr><td align=right><b>Email address</b>
<br><font size=-1>Must be a valid address of the form 'name@domain'</font></b></td>\n
<td><input name=email_addr size=50 value='$email_text'></td></tr>
<tr><td><br></td><td><input type=submit value='OK'>\n
</table>\n
</form>";
echo "<form method=post action=edit_email_action.php>\n";
start_table();
row1("Edit email address");
row2("Email address
<br><font size=-1>Must be a valid address of the form 'name@domain'</font>",
"<input name=email_addr size=50 value='$email_text'>"
);
row2("", "<input type=submit value='Update email address'>");
end_table();
echo "</form>\n";
page_tail();
?>

View File

@ -10,19 +10,23 @@ require_login($user);
page_head("Edit user information");
echo "<form method=post action=edit_user_info_action.php>\n
".TABLE2."\n
<tr><td align=right><b>User name</b></td>\n
<td><input name=user_name size=30 value='$user->name'></td></tr>
<tr><td align=right><b>Country:</b></font></td>
<td><select name=country>";
echo "<form method=post action=edit_user_info_action.php>";
start_table();
row1("Edit account info");
row2("User name",
"<input name=user_name size=30 value='$user->name'>"
);
row2_init("Country",
"<select name=country>"
);
print_country_select($user->country);
echo "</select></td></tr>
<tr><td align=right><b>Postal (ZIP) code</b></td>
<td><input name=postal_code size=20 value='$user->postal_code'></td></tr>
<tr><td><br></td><td><input type=submit value='OK'>\n
</table>\n
</form>";
echo "</select></td></tr>\n";
row2("Postal (ZIP) code",
"<input name=postal_code size=20 value='$user->postal_code'>"
);
row2("", "<input type=submit value='Update info'>");
end_table();
echo "</form>\n";
page_tail();
?>

View File

@ -22,6 +22,9 @@
<li><a href=team.php>Teams</a> - create or join a team
<li><a href=download.php>Download BOINC</a>
<li><a href=bug_report_form.php>Report problems</a>
</ul>
<h3>Leader boards</h3>
<ul>
<li><a href=top_users.php>Top users</a>
<li><a href=top_hosts.php>Top hosts</a>
<li><a href=top_teams.php>Top teams</a>

View File

@ -6,14 +6,8 @@
$authenticator = init_session();
db_init();
$authenticator = trim($_POST["authenticator"]);
//$email_addr = $_POST["email_addr"];
//$password = $_POST["password"];
if (strlen($authenticator)) {
$query = "select * from user where authenticator='$authenticator'";
//} else if (strlen($email_addr)) {
// $query = "select * from user where email_addr='$email_addr'";
//} else {
// echo "NO SELECTION";
}
$result = mysql_query($query);
if ($result) {
@ -27,11 +21,6 @@
<br>Click <b>Back</b> to try again.
";
page_tail();
//} else if (strlen($password)) {
// page_head("Log in");
// if ($user->web_password != $_POST["existing_password"]) {
// echo "Bad password.";
// }
} else {
if (split_munged_email_addr($user->email_addr, $authenticator, $email)) {
mysql_query("update user set email_addr='$email' where id=$user->id");

View File

@ -4,15 +4,13 @@
$next_url = $_GET["next_url"];
$authenticator = init_session();
db_init();
$user = get_user_from_auth($authenticator);
if ($authenticator) {
db_init();
$user = get_user_from_auth($authenticator);
}
page_head("Log in", $user);
print_login_form_aux($next_url);
if ($user) {
echo "<br><a href=logout.php>Log out</a>";
}
print_login_form_aux($next_url, $user);
page_tail();
?>

View File

@ -286,14 +286,14 @@ function prefs_show_project($prefs) {
}
function subset_name($subset) {
if ($subset == "global") return "BOINC";
if ($subset == "global") return "general";
return PROJECT;
}
function prefs_display_venue($prefs, $venue, $subset) {
$x = $prefs->$venue;
if ($x) {
row1("Separate preferences for computers at $venue");
row1("Separate preferences for $venue");
if ($subset == "global") {
prefs_show_global($x);
} else {
@ -303,7 +303,7 @@ function prefs_display_venue($prefs, $venue, $subset) {
row2("<br>", "<a href=prefs_edit_form.php?venue=$venue&subset=$subset>Edit</a> | <a href=prefs_remove.php?venue=$venue&subset=$subset>Remove</a>");
} else {
$x = subset_name($subset);
row1("<a href=add_venue_form.php?venue=$venue&subset=$subset>Click to add separate $x preferences for computers at $venue</a>");
row1("<a href=add_venue_form.php?venue=$venue&subset=$subset>Add separate $x preferences for $venue</a>");
}
}
@ -326,7 +326,7 @@ function print_prefs_display_project($user) {
function print_prefs_display_global($user) {
$global_prefs = prefs_parse_global($user->global_prefs);
echo "<font size=+2>BOINC preferences</font><br><font size=-1>These apply to all BOINC projects in which you participate</font><br><br>";
echo "<font size=+2>General preferences</font><br><font size=-1>These apply to all BOINC projects in which you participate</font><br><br>";
start_table();
if ($global_prefs->home || $global_prefs->work || $global_prefs->school) {
@ -390,10 +390,7 @@ function prefs_form_global($user, $prefs) {
";
row2($x, $y);
echo "<tr><td colspan=2>
You can limit the disk space used by ".PROJECT." in three different ways:
</td></tr>
";
row1("Limit the disk space used by BOINC:");
row2("Use no more than",
"<input size=7 name=disk_max_used_gb value='$prefs->disk_max_used_gb'> Gbytes"
@ -406,7 +403,7 @@ function prefs_form_global($user, $prefs) {
"<input size=5 name=disk_max_used_pct value='$prefs->disk_max_used_pct'> % of total space"
);
echo "<tr><td colspan=2>You can limit BOINC's network traffic</td></tr>\n";
row1("Limit BOINC's network use:");
$d = $prefs->max_bytes_sec_down;
$dt = $d?"$d":"";
$u = $prefs->max_bytes_sec_up;
@ -459,7 +456,7 @@ function prefs_form_project($prefs_xml) {
}
function venue_show($user) {
row2("Venue", $user->venue);
row2("Default computer location", $user->venue);
}
function venue_form($user) {

View File

@ -61,7 +61,7 @@ if ($subset == "global") {
}
}
row2("<br>", "<input type=submit value=\"OK\">");
row2("<br>", "<input type=submit value=\"Update preferences\">");
end_table();
echo "</form>\n";

View File

@ -13,7 +13,10 @@
if ($user) {
page_head("User stats for $user->name");
echo("<h2>Account stats for $user->name</h2>");
start_table();
show_user_stats($user);
end_table();
page_tail();
} else {
page_head("Can't find user");

View File

@ -14,76 +14,55 @@ if ($user == NULL) {
}
page_head("Create a team");
?>
<table width=780>
<tr><td valign=top>
<p>
Use this form to create a team.
You'll become the founding member of the team.
</td></tr></table>
<p>
<form method=post action=team_create_action.php>
<table>
<tr>
<td valign=top>Team name (text version)
<br><font size=2>This name will be printed as text.
It's the name
you should use <br>when searching for your Team.
</td>
<td valign=top><input name=name type=text size=50>
</td>
</tr><tr>
<td width=30%>Team name (HTML version)
<br><font size=2>This name will be shown as HTML,
so you may include any HTML code that you want.
If you don't know HTML, just leave this box blank.
</td>
<td valign=top><input name=name_html type=text size=50>
</td>
</tr><tr>
<td valign=top>URL of team web page, if any:<br><font size=2>(without "http://")
<br><font size=2>This URL will be linked to from the team's page.
</td>
<td valign=top><input name=url size=60>
</td>
</tr><tr>
<td valign=top>Description of team:</td>
<td valign=top><textarea name=description cols=60 rows=10></textarea></td>
</tr><tr>
<td valign=top>Type of team:</td>
<td valign=top>
<input type=radio name=type value=1 checked> Club
<br>
<input type=radio name=type value=2> Company
<br>
<input type=radio name=type value=3> Primary School
<br>
<input type=radio name=type value=4> Secondary School
<br>
<input type=radio name=type value=5> Junior College
<br>
<input type=radio name=type value=6> University or Department
<br>
<input type=radio name=type value=7> Government Agency
</td>
</tr>
echo "<form method=post action=team_create_action.php>\n";
start_table();
row1("Create a team");
row2( "Team name (text version)
<br><font size=2>
Don't use any HTML tags.
This name will be used in the searchable team list.",
"<input name=name type=text size=50>"
);
row2("Team name (HTML version)
<br><font size=2>
You may include HTML formatting, link, and image tags.
If you don't know HTML, just leave this box blank.",
"<input name=name_html type=text size=50>"
);
row2("URL of team web page, if any:<br><font size=2>(without \"http://\")
This URL will be linked to from the team's page on this site.",
"<input name=url size=60>"
);
row2("Description of team:",
"<textarea name=description cols=60 rows=10></textarea>"
);
row2("Type of team:",
"<input type=radio name=type value=1 checked> Other
<br>
<input type=radio name=type value=2> Company
<br>
<input type=radio name=type value=3> Primary School
<br>
<input type=radio name=type value=4> Secondary School
<br>
<input type=radio name=type value=5> Junior College
<br>
<input type=radio name=type value=6> University or Department
<br>
<input type=radio name=type value=7> Government Agency"
);
row2_init("Country",
"<select name=country>"
);
print_country_select();
<tr><td>Country</td>
<td>
<select name=country>
<?php
print_country_select("None");
?>
echo "</select></b></td></tr>\n";
row2("",
"<input type=submit name=new value=\"Create Team\">"
);
end_table();
echo "</form>\n";
</select>
</td></tr>
<tr><td valign=top><br></td><td valign=top>
<input type=submit name=new value="Create Team">
</td></tr>
</table>
</form>
<?php
page_tail();
?>

View File

@ -28,6 +28,7 @@ function show_host_row($host) {
$max_hosts_display = 100;
db_init();
page_head("Top hosts");
echo "<h2>Top hosts</h2>\n";
$result = mysql_query("select * from host order by expavg_credit desc limit $max_hosts_display");
host_table_start();
while (($host = mysql_fetch_object($result)) && $max_hosts_display > 0) {

View File

@ -1,8 +1,7 @@
<?php
function show_user_stats($user) {
echo TABLE2."\n";
echo "<tr>".TD2.LG_FONT."<b>User stats</b></font></td></tr>\n";
row1("Account statistics");
$row = sprintf("%s User since", $project);
row2($row, time_str($user->create_time));
row2("Total credit", $user->total_credit);
@ -14,14 +13,6 @@ function show_user_stats($user) {
} else {
row2("Team", "None");
}
echo "</table>\n";
}
function edit_link() {
return "<br><font size=-1><a href=edit_user_info_form.php>edit</a></font>";
}
function edit_email_link() {
return "<br><font size=-1><a href=edit_email_form.php>edit</a></font>";
}
function show_user_profile($user) {
@ -30,13 +21,13 @@ function show_user_profile($user) {
} else {
$email_text = "Verification pending";
}
echo TABLE2."\n";
echo "<tr>".TD2.LG_FONT."<b>User information</b></font></td></tr>\n";
row2("Name", $user->name.edit_link());
row2("Email address", $email_text.edit_email_link());
row2("Country", $user->country.edit_link());
row2("Postal code", $user->postal_code.edit_link());
echo "</table>\n";
row1("Account information");
row2("Name", $user->name);
row2("Email address", $email_text);
row2("Country", $user->country);
row2("Postal code", $user->postal_code);
row2("", "<a href=edit_email_form.php>Edit email address</a>");
row2("", "<a href=edit_user_info_form.php>Edit other info</a>");
}
function show_hosts($user) {
@ -65,14 +56,14 @@ function show_host_brief($host) {
// it has info that other users aren't supposed to see
function show_user_page_private($user) {
echo "<table cellpadding=4>\n";
start_table();
show_user_profile($user);
show_user_stats($user);
echo "</table>\n";
end_table();
echo "<ul>";
echo "<li><a href=show_hosts.php>Your computer(s)</a></li>";
echo "<li><a href=prefs.php?subset=global>General (BOINC) preferences</a></li>";
echo "<li><a href=prefs.php?subset=project>Specific ".PROJECT." preferences</a></li>";
echo "<li><a href=prefs.php?subset=global>General preferences</a></li>";
echo "<li><a href=prefs.php?subset=project>".PROJECT." preferences</a></li>";
echo "</ul>";
}

View File

@ -43,9 +43,6 @@ You will need your account key to log in to the ".PROJECT." web site."
//
function init_session() {
session_start();
if (!isset($_SESSION["authenticator"])) {
$_SESSION["authenticator"] = $authenticator;
}
return $_SESSION["authenticator"];
}
@ -117,12 +114,16 @@ function end_table() {
}
function row1($x) {
echo "<tr><td bgcolor=dddddd colspan=2><b>$x</b></td></tr>\n";
echo "<tr><td bgcolor=cccccc colspan=2><b>$x</b></td></tr>\n";
}
function row2($x, $y) {
if ($x=="") $x="<br>";
echo "<tr><td bgcolor=eeeeee width=50% align=right valign=top>$x</td><td valign=top><b>$y</b></td></tr>\n";
}
function row2_init($x, $y) {
echo "<tr><td bgcolor=eeeeee width=50% align=right valign=top>$x</td><td valign=top><b>$y\n";
}
function row3($x, $y, $z) {
echo "<tr><td width=30% valign=top align=right>$x</td><td>$y</td><td>$z</td></tr>\n";
@ -132,33 +133,34 @@ function random_string() {
return md5(uniqid(rand()));
}
function print_country_select($country) {
function print_country_select($country="None") {
$x = posix_getcwd();
PassThru("$x/country_select '$country'");
}
function print_login_form_aux($next_url) {
function print_login_form_aux($next_url, $user) {
echo "<form method=post action=login_action.php>
<input type=hidden name=next_url value='$next_url'>
<table cellpadding=8>
<tr><td align=right>
Your account key:
</td><td>
<input name=authenticator size=40>
</td></tr>
<tr><td align=right>
<br>
</td><td>
<input type=submit value='Log in'>
</td></tr>
</table>
";
echo "<font size=1>
start_table();
row1("Log in");
row2("Your account key:
<br><font size=-1>
If you don't know your account key,
<a href=get_passwd.php>click here</a>.
</font>
";
</font>",
"<input name=authenticator size=40>"
);
row2("",
"<input type=submit value='Log in'>"
);
if ($user) {
row1("Log out");
row2("You are logged in as $user->name",
"<a href=logout.php>Log out</a>"
);
}
end_table();
}
function print_login_form() {
@ -168,7 +170,7 @@ function print_login_form() {
This function requires that you log in.
";
$next_url = $_SERVER[REQUEST_URI];
print_login_form_aux($next_url);
print_login_form_aux($next_url, null);
page_tail();
}

View File

@ -165,7 +165,6 @@ int read_file_malloc(char* pathname, char*& str) {
}
#if 0
// replace XML element contents. not currently used
//
void replace_element(char* buf, char* start, char* end, char* replacement) {
@ -178,7 +177,6 @@ void replace_element(char* buf, char* start, char* end, char* replacement) {
strcpy(p, replacement);
strcat(p, temp);
}
#endif
// if the given XML has an element of the form
// <venue name="venue_name">

View File

@ -30,7 +30,5 @@ extern void strcatdup(char*& p, char* buf);
extern int dup_element_contents(FILE* in, char* end_tag, char** pp);
extern int copy_element_contents(FILE* in, char* end_tag, char* p, int len);
extern int read_file_malloc(char* pathname, char*& str);
#if 0
extern void replace_element(char* buf, char* start, char* end, char* replacement);
#endif
extern void extract_venue(char* in, char* venue_name, char* out);

View File

@ -283,3 +283,10 @@ void safe_strncpy(char* dst, char* src, int len) {
strncpy(dst, src, len);
dst[len-1]=0;
}
char* timestamp() {
time_t now = time(0);
char* p = ctime(&now);
*(strchr(p, '\n')) = 0;
return p;
}

View File

@ -28,6 +28,7 @@ extern double drand();
extern void unescape_url(char *url);
extern void escape_url(char *in, char*out);
extern void safe_strncpy(char*, char*, int);
extern char* timestamp();
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))

View File

@ -34,10 +34,7 @@
CONFIG config;
void write_log(char* p) {
time_t now = time(0);
char* timestr = ctime(&now);
*(strchr(timestr, '\n')) = 0;
fprintf(stderr, "%s: %s", timestr, p);
fprintf(stderr, "%s: %s", timestamp(), p);
}
// assimilate all WUs that need it

View File

@ -66,10 +66,7 @@
CONFIG config;
void write_log(char* p) {
time_t now = time(0);
char* timestr = ctime(&now);
*(strchr(timestr, '\n')) = 0;
fprintf(stderr, "%s: %s", timestr, p);
fprintf(stderr, "%s: %s", timestamp(), p);
}
int check_triggers(SCHED_SHMEM* ssp) {

View File

@ -35,10 +35,7 @@
CONFIG config;
void write_log(char* p) {
time_t now = time(0);
char* timestr = ctime(&now);
*(strchr(timestr, '\n')) = 0;
fprintf(stderr, "%s: %s", timestr, p);
fprintf(stderr, "%s: %s", timestamp(), p);
}
int wu_delete_files(WORKUNIT& wu) {

View File

@ -30,6 +30,7 @@
#include <errno.h>
#include "parse.h"
#include "util.h"
#include "config.h"
#include "crypt.h"
@ -48,10 +49,7 @@ struct FILE_INFO {
};
void write_log(char* p) {
time_t now = time(0);
char* timestr = ctime(&now);
*(strchr(timestr, '\n')) = 0;
fprintf(stderr, "%s: %s", timestr, p);
fprintf(stderr, "%s: %s", timestamp(), p);
}
int FILE_INFO::parse(FILE* in) {

View File

@ -33,6 +33,7 @@ using namespace std;
#include "db.h"
#include "parse.h"
#include "shmem.h"
#include "util.h"
#include "config.h"
#include "server_types.h"
@ -48,10 +49,7 @@ PROJECT gproject;
CONFIG config;
void write_log(char* p) {
time_t now = time(0);
char* timestr = ctime(&now);
*(strchr(timestr, '\n')) = 0;
fprintf(stderr, "%s: %s", timestr, p);
fprintf(stderr, "%s: %s", timestamp(), p);
}
int main() {

View File

@ -49,10 +49,7 @@ int redundancy = 10;
char wu_name[256], result_template_file[256];
void write_log(char* p) {
time_t now = time(0);
char* timestr = ctime(&now);
*(strchr(timestr, '\n')) = 0;
fprintf(stderr, "%s: %s", timestr, p);
fprintf(stderr, "%s: %s", timestamp(), p);
}
// edit a WU XML doc, replacing one filename by another

View File

@ -58,10 +58,7 @@ void check_trigger() {
}
void write_log(char* p) {
time_t now = time(0);
char* timestr = ctime(&now);
*(strchr(timestr, '\n')) = 0;
fprintf(stderr, "%s: %s", timestr, p);
fprintf(stderr, "%s: %s", timestamp(), p);
}
// The scheme for generating unique output filenames is as follows.

View File

@ -74,10 +74,7 @@ int min_quorum;
#define ALPHA (LOG2/AVG_HALF_LIFE)
void write_log(char* p) {
time_t now = time(0);
char* timestr = ctime(&now);
*(strchr(timestr, '\n')) = 0;
fprintf(stderr, "%s: %s", timestr, p);
fprintf(stderr, "%s: %s", timestamp(), p);
}
// update an exponential average of credit per second.