mirror of https://github.com/BOINC/boinc.git
parent
bfe11d85c0
commit
f98c7f0644
|
@ -3870,3 +3870,10 @@ Eric March 19, 2003
|
|||
win/
|
||||
wingui_mainwindow.cpp
|
||||
|
||||
David Mar 19 2003
|
||||
- general cleanup of user web
|
||||
|
||||
html_user/
|
||||
*
|
||||
show_hosts.php (removed)
|
||||
|
||||
|
|
6
db/db.h
6
db/db.h
|
@ -114,10 +114,10 @@ struct USER {
|
|||
double total_credit;
|
||||
double expavg_credit; // credit per second, recent average
|
||||
double expavg_time; // when the above was computed
|
||||
char global_prefs[MAX_BLOB_SIZE]; // global preferences
|
||||
// within <global_preferences> tag
|
||||
char global_prefs[MAX_BLOB_SIZE];
|
||||
// global preferences, within <global_preferences> tag
|
||||
char project_prefs[MAX_BLOB_SIZE];
|
||||
// within <project_preferences> tag
|
||||
// project preferences, within <project_preferences> tag
|
||||
int teamid; // if user is part of a team
|
||||
char venue[256]; // home/work/school (default)
|
||||
};
|
||||
|
|
|
@ -2,11 +2,9 @@
|
|||
require_once("db.inc");
|
||||
require_once("util.inc");
|
||||
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
|
||||
$user = get_user_from_auth($authenticator);
|
||||
require_login($user);
|
||||
$user = get_logged_in_user();
|
||||
|
||||
page_head("Account setup", $user);
|
||||
echo "
|
||||
|
|
|
@ -4,14 +4,9 @@ include_once("db.inc");
|
|||
include_once("util.inc");
|
||||
include_once("prefs.inc");
|
||||
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
|
||||
$user = get_user_from_auth($authenticator);
|
||||
if ($user == NULL) {
|
||||
print_login_form();
|
||||
exit();
|
||||
}
|
||||
$user = get_logged_in_user();
|
||||
|
||||
// TODO: consolidate the three DB updates into one
|
||||
|
||||
|
|
|
@ -5,12 +5,7 @@ require_once("util.inc");
|
|||
require_once("download.inc");
|
||||
|
||||
db_init();
|
||||
$authenticator = init_session();
|
||||
$user = get_user_from_auth($authenticator);
|
||||
if ($user == NULL) {
|
||||
print_login_form();
|
||||
exit();
|
||||
}
|
||||
$user = get_logged_in_user();
|
||||
|
||||
page_head("Download BOINC software", $user);
|
||||
|
||||
|
|
|
@ -4,14 +4,9 @@ include_once("db.inc");
|
|||
include_once("util.inc");
|
||||
include_once("prefs.inc");
|
||||
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
|
||||
$user = get_user_from_auth($authenticator);
|
||||
if ($user == NULL) {
|
||||
print_login_form();
|
||||
exit();
|
||||
}
|
||||
$user = get_logged_in_user();
|
||||
page_head("Account setup: resource share", $user);
|
||||
echo "
|
||||
<h3>Account setup</h3>
|
||||
|
|
|
@ -4,14 +4,9 @@ include_once("db.inc");
|
|||
include_once("util.inc");
|
||||
include_once("prefs.inc");
|
||||
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
|
||||
$user = get_user_from_auth($authenticator);
|
||||
if ($user == NULL) {
|
||||
print_login_form();
|
||||
exit();
|
||||
}
|
||||
$user = get_logged_in_user();
|
||||
|
||||
$prefs = prefs_parse_global($user->global_prefs);
|
||||
prefs_resource_parse_form($prefs);
|
||||
|
|
|
@ -4,14 +4,9 @@ include_once("db.inc");
|
|||
include_once("util.inc");
|
||||
include_once("prefs.inc");
|
||||
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
$user = get_logged_in_user();
|
||||
|
||||
$user = get_user_from_auth($authenticator);
|
||||
if ($user == NULL) {
|
||||
print_login_form();
|
||||
exit();
|
||||
}
|
||||
page_head("Account setup: done", $user);
|
||||
echo "
|
||||
<h3>Account setup: done</h3>
|
||||
|
|
|
@ -3,11 +3,9 @@
|
|||
require_once("util.inc");
|
||||
require_once("prefs.inc");
|
||||
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
|
||||
$user = get_user_from_auth($authenticator);
|
||||
require_login($user);
|
||||
$user = get_logged_in_user();
|
||||
|
||||
$venue = $_GET["venue"];
|
||||
$subset = $_GET["subset"];
|
||||
|
|
|
@ -3,11 +3,9 @@
|
|||
require_once("util.inc");
|
||||
require_once("prefs.inc");
|
||||
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
|
||||
$user = get_user_from_auth($authenticator);
|
||||
require_login($user);
|
||||
$user = get_logged_in_user();
|
||||
|
||||
$venue = $_GET["venue"];
|
||||
$subset = $_GET["subset"];
|
||||
|
|
|
@ -3,34 +3,29 @@
|
|||
include_once("db.inc");
|
||||
include_once("util.inc");
|
||||
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
db_init();
|
||||
|
||||
$user = get_user_from_auth($authenticator);
|
||||
if ($user == NULL) {
|
||||
print_login_form();
|
||||
exit();
|
||||
}
|
||||
$user = get_logged_in_user();
|
||||
|
||||
$f = fopen("bug_reports.xml", "a");
|
||||
$x = sprintf("<bug>
|
||||
<userid>$user->id</userid>
|
||||
<platform>%s</platform>
|
||||
<problem>
|
||||
%s
|
||||
</problem>
|
||||
</bug>
|
||||
",
|
||||
$_POST["platform"],
|
||||
$_POST["problem"]
|
||||
);
|
||||
fputs($f, $x);
|
||||
fclose($f);
|
||||
$f = fopen("bug_reports.xml", "a");
|
||||
$x = sprintf("<bug>
|
||||
<userid>$user->id</userid>
|
||||
<platform>%s</platform>
|
||||
<problem>
|
||||
%s
|
||||
</problem>
|
||||
</bug>
|
||||
",
|
||||
$_POST["platform"],
|
||||
$_POST["problem"]
|
||||
);
|
||||
fputs($f, $x);
|
||||
fclose($f);
|
||||
|
||||
page_head("Problem report recorded", $user);
|
||||
echo "
|
||||
Your problem report has been recorded.
|
||||
We apologize for any inconvience you may have experienced.
|
||||
";
|
||||
page_tail();
|
||||
page_head("Problem report recorded", $user);
|
||||
echo "
|
||||
Your problem report has been recorded.
|
||||
We apologize for any inconvience you may have experienced.
|
||||
";
|
||||
page_tail();
|
||||
?>
|
||||
|
|
|
@ -18,32 +18,28 @@ function print_platform_select() {
|
|||
echo "</select>\n";
|
||||
}
|
||||
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
db_init();
|
||||
|
||||
$user = get_user_from_auth($authenticator);
|
||||
if ($user == NULL) {
|
||||
print_login_form();
|
||||
exit();
|
||||
}
|
||||
page_head("Problem Report Form", $user);
|
||||
$user = get_logged_in_user();
|
||||
|
||||
echo "
|
||||
<h3>Problem Report Form</h3>
|
||||
<form method=post action=bug_report_action.php>
|
||||
";
|
||||
start_table();
|
||||
row2_init("Computer type", "");
|
||||
print_platform_select();
|
||||
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();
|
||||
page_head("Problem Report Form", $user);
|
||||
|
||||
echo "
|
||||
<h3>Problem Report Form</h3>
|
||||
<form method=post action=bug_report_action.php>
|
||||
";
|
||||
start_table();
|
||||
row2_init("Computer type", "");
|
||||
print_platform_select();
|
||||
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();
|
||||
|
||||
?>
|
||||
|
|
|
@ -11,7 +11,7 @@ function show_error($str) {
|
|||
exit();
|
||||
}
|
||||
|
||||
$authenticator = init_session();
|
||||
init_session();
|
||||
db_init();
|
||||
|
||||
$new_name = $HTTP_POST_VARS["new_name"];
|
||||
|
|
|
@ -4,7 +4,7 @@ require_once("db.inc");
|
|||
require_once("util.inc");
|
||||
require_once("download.inc");
|
||||
|
||||
$authenticator = init_session();
|
||||
init_session();
|
||||
db_init();
|
||||
|
||||
page_head("Download BOINC software");
|
||||
|
|
|
@ -15,10 +15,8 @@ To confirm this change, please visit the following URL:
|
|||
);
|
||||
}
|
||||
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
$user = get_user_from_auth($authenticator);
|
||||
require_login($user);
|
||||
$user = get_logged_in_user();
|
||||
|
||||
$email_addr = $HTTP_POST_VARS["email_addr"];
|
||||
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
<?php
|
||||
|
||||
require_once("edit.inc");
|
||||
require_once("util.inc");
|
||||
|
||||
db_init();
|
||||
$authenticator = init_session();
|
||||
$user = get_user_from_auth($authenticator);
|
||||
require_login($user);
|
||||
$user = get_logged_in_user();
|
||||
|
||||
page_head("Edit email address");
|
||||
|
||||
|
|
|
@ -3,10 +3,8 @@
|
|||
require_once("user.inc");
|
||||
require_once("db.inc");
|
||||
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
$user = get_user_from_auth($authenticator);
|
||||
require_login($user);
|
||||
$user = get_logged_in_user();
|
||||
|
||||
page_head("User info update");
|
||||
$name = $HTTP_POST_VARS["user_name"];
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
<?php
|
||||
|
||||
require_once("edit.inc");
|
||||
require_once("util.inc");
|
||||
|
||||
db_init();
|
||||
$authenticator = init_session();
|
||||
$user = get_user_from_auth($authenticator);
|
||||
require_login($user);
|
||||
$user = get_logged_in_user();
|
||||
|
||||
page_head("Edit user information");
|
||||
page_head("Edit user information", $user);
|
||||
|
||||
echo "<form method=post action=edit_user_info_action.php>";
|
||||
start_table();
|
||||
|
|
|
@ -4,19 +4,17 @@ require_once("util.inc");
|
|||
require_once("user.inc");
|
||||
|
||||
page_head("Account key");
|
||||
echo "<h2>Get your ".PROJECT." account key</h2>
|
||||
<p>
|
||||
<br clear=all>
|
||||
<table width=600 border=0 cellpadding=0 cellspacing=0><tr><td>
|
||||
|
||||
<form method=post action=mail_passwd.php>
|
||||
Email address: <input name=email_addr>
|
||||
<input type=submit value=Submit>
|
||||
</form>
|
||||
</table>
|
||||
<p>
|
||||
Your account key will be emailed to this address.
|
||||
You should receive it in a few minutes.<p>";
|
||||
|
||||
echo "<form method=post action=mail_passwd.php>\n";
|
||||
start_table();
|
||||
row1("Get your ".PROJECT." account key");
|
||||
row2("Email address","<input size=40 name=email_addr");
|
||||
row2("", "<input type=submit value=Submit>");
|
||||
echo "</table></form>
|
||||
Your account key will be emailed to you.
|
||||
You should receive it in a few minutes.<p>
|
||||
";
|
||||
|
||||
page_tail();
|
||||
|
||||
|
|
|
@ -5,15 +5,9 @@
|
|||
|
||||
// show the home page of whoever's logged in
|
||||
|
||||
$authenticator = init_session();
|
||||
|
||||
db_init();
|
||||
$user = get_user_from_auth($authenticator);
|
||||
if ($user) {
|
||||
page_head("User page", $user);
|
||||
show_user_page_private($user);
|
||||
page_tail();
|
||||
} else {
|
||||
print_login_form();
|
||||
}
|
||||
$user = get_logged_in_user();
|
||||
page_head("User page", $user);
|
||||
show_user_page_private($user);
|
||||
page_tail();
|
||||
?>
|
||||
|
|
|
@ -26,6 +26,9 @@ function show_host($host, $private) {
|
|||
$x = $host->timezone/3600;
|
||||
row2("Time zone", "UTC - $x hours");
|
||||
}
|
||||
if ($private) {
|
||||
row2("Name", $host->domain_name);
|
||||
}
|
||||
row2("Created", time_str($host->create_time));
|
||||
row2("Total Credit", $host->total_credit);
|
||||
row2("Recent average credit", $host->expavg_credit);
|
||||
|
@ -85,12 +88,18 @@ function show_host($host, $private) {
|
|||
|
||||
}
|
||||
|
||||
function host_table_start($title) {
|
||||
function host_table_start($title, $private) {
|
||||
start_table();
|
||||
row1($title, 6);
|
||||
echo "<tr>
|
||||
<th>Rank<br><font size=-2>Click for more info</font></th>
|
||||
<th>Owner</th>
|
||||
";
|
||||
if ($private) {
|
||||
echo "<th>Name</th>\n";
|
||||
} else {
|
||||
echo "<th>Owner</th>\n";
|
||||
}
|
||||
echo "
|
||||
<th>Total credit</th>
|
||||
<th>Recent average credit</th>
|
||||
<th>CPU type</th>
|
||||
|
@ -99,13 +108,19 @@ function host_table_start($title) {
|
|||
";
|
||||
}
|
||||
|
||||
function show_host_row($host, $i) {
|
||||
function show_host_row($host, $i, $private) {
|
||||
$result = mysql_query("select * from user where id = $host->userid");
|
||||
$user = mysql_fetch_object($result);
|
||||
mysql_free_result($result);
|
||||
echo "<tr>
|
||||
<td><a href=show_host_public.php?hostid=$host->id>$i</a></td>
|
||||
<td><a href=show_user.php?userid=$user->id>$user->name</a></td>
|
||||
";
|
||||
if ($private) {
|
||||
echo"<td>$host->domain_name</td>";
|
||||
} else {
|
||||
echo"<td><a href=show_user.php?userid=$user->id>$user->name</a></td>";
|
||||
}
|
||||
echo"
|
||||
<td>$host->total_credit</td>
|
||||
<td>$host->expavg_credit</td>
|
||||
<td>$host->p_vendor $host->p_model</td>
|
||||
|
|
|
@ -2,11 +2,9 @@
|
|||
require_once("db.inc");
|
||||
require_once("util.inc");
|
||||
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
|
||||
$user = get_user_from_auth($authenticator);
|
||||
require_login($user);
|
||||
$user = get_logged_in_user();
|
||||
|
||||
$venue = $_GET["venue"];
|
||||
$hostid = $_GET["hostid"];
|
||||
|
|
|
@ -1,19 +1,30 @@
|
|||
<?php
|
||||
// show all the hosts for a user.
|
||||
// if $userid is absent, show hosts of logged-in user
|
||||
|
||||
require_once("util.inc");
|
||||
require_once("host.inc");
|
||||
|
||||
$max_hosts_display = 100;
|
||||
db_init();
|
||||
$userid = $_GET["userid"];
|
||||
$result = mysql_query("select * from user where id=$userid");
|
||||
$user = mysql_fetch_object($result);
|
||||
mysql_free_result($result);
|
||||
host_table_start("Hosts belonging to $user->name");
|
||||
if ($userid) {
|
||||
$result = mysql_query("select * from user where id=$userid");
|
||||
$user = mysql_fetch_object($result);
|
||||
mysql_free_result($result);
|
||||
page_head("Computers belonging to $user->name");
|
||||
host_table_start("Computers belonging to $user->name", false);
|
||||
$private = false;
|
||||
} else {
|
||||
$user = get_logged_in_user();
|
||||
$userid = $user->id;
|
||||
page_head("Your computers");
|
||||
host_table_start("Your computers", true);
|
||||
$private = true;
|
||||
}
|
||||
$i = 1;
|
||||
$result = mysql_query("select * from host where userid=$userid order by expavg_credit desc limit $max_hosts_display");
|
||||
while (($host = mysql_fetch_object($result)) && $max_hosts_display > 0) {
|
||||
show_host_row($host, $i);
|
||||
$max_hosts_display--;
|
||||
$result = mysql_query("select * from host where userid=$userid order by expavg_credit desc");
|
||||
while ($host = mysql_fetch_object($result)) {
|
||||
show_host_row($host, $i, $private);
|
||||
$i++;
|
||||
}
|
||||
mysql_free_result($result);
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<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_hosts.php>Top computers</a>
|
||||
<li><a href=top_teams.php>Top teams</a>
|
||||
</ul>
|
||||
<!--
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
require_once("user.inc");
|
||||
require_once("db.inc");
|
||||
|
||||
$authenticator = init_session();
|
||||
init_session();
|
||||
db_init();
|
||||
$authenticator = trim($_POST["authenticator"]);
|
||||
if (strlen($authenticator)) {
|
||||
|
|
|
@ -3,11 +3,9 @@
|
|||
require_once("util.inc");
|
||||
require_once("prefs.inc");
|
||||
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
|
||||
$user = get_user_from_auth($authenticator);
|
||||
require_login($user);
|
||||
$user = get_logged_in_user();
|
||||
|
||||
$subset = $_GET["subset"];
|
||||
page_head(subset_name($subset)." preferences");
|
||||
|
|
|
@ -6,12 +6,7 @@ include_once("prefs.inc");
|
|||
|
||||
db_init();
|
||||
|
||||
$authenticator = init_session();
|
||||
$user = get_user_from_auth($authenticator);
|
||||
if ($user == NULL) {
|
||||
print_login_form();
|
||||
exit();
|
||||
}
|
||||
$user = get_logged_in_user();
|
||||
|
||||
$subset = $_GET["subset"];
|
||||
$venue = $_GET["venue"];
|
||||
|
|
|
@ -4,14 +4,9 @@ include_once("db.inc");
|
|||
include_once("util.inc");
|
||||
include_once("prefs.inc");
|
||||
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
|
||||
$user = get_user_from_auth($authenticator);
|
||||
if ($user == NULL) {
|
||||
print_login_form();
|
||||
exit();
|
||||
}
|
||||
$user = get_logged_in_user();
|
||||
|
||||
$subset = $_GET["subset"];
|
||||
$venue = $_GET["venue"];
|
||||
|
|
|
@ -6,12 +6,7 @@ include_once("prefs.inc");
|
|||
|
||||
db_init();
|
||||
|
||||
$authenticator = init_session();
|
||||
$user = get_user_from_auth($authenticator);
|
||||
if ($user == NULL) {
|
||||
print_login_form();
|
||||
exit();
|
||||
}
|
||||
$user = get_logged_in_user();
|
||||
|
||||
$subset = $_GET["subset"];
|
||||
$venue = $_GET["venue"];
|
||||
|
|
|
@ -4,28 +4,23 @@
|
|||
require_once("user.inc");
|
||||
require_once("host.inc");
|
||||
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
$user = get_user_from_auth($authenticator);
|
||||
$user = get_logged_in_user();
|
||||
$hostid = $HTTP_GET_VARS["hostid"];
|
||||
if ($user && $hostid) {
|
||||
page_head("Host stats");
|
||||
page_head("Computer stats");
|
||||
|
||||
$result = mysql_query("select * from host where id = $hostid");
|
||||
$host = mysql_fetch_object($result);
|
||||
mysql_free_result($result);
|
||||
$result = mysql_query("select * from host where id = $hostid");
|
||||
$host = mysql_fetch_object($result);
|
||||
mysql_free_result($result);
|
||||
|
||||
if ($host) {
|
||||
if ($host->userid != $user->id) {
|
||||
echo "Not your host\n";
|
||||
} else {
|
||||
show_host($host, true);
|
||||
}
|
||||
if ($host) {
|
||||
if ($host->userid != $user->id) {
|
||||
echo "Not your computer\n";
|
||||
} else {
|
||||
echo "Couldn't find host or user.<p>";
|
||||
show_host($host, true);
|
||||
}
|
||||
page_tail();
|
||||
} else {
|
||||
print_login_form();
|
||||
echo "Couldn't find host or user.<p>";
|
||||
}
|
||||
page_tail();
|
||||
?>
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
<?php
|
||||
require_once("util.inc");
|
||||
require_once("user.inc");
|
||||
require_once("db.inc");
|
||||
require_once("user.inc");
|
||||
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
$user = get_user_from_auth($authenticator);
|
||||
require_login($user);
|
||||
|
||||
page_head("Hosts stats");
|
||||
show_hosts($user);
|
||||
page_tail();
|
||||
?>
|
|
@ -14,7 +14,7 @@
|
|||
if ($user) {
|
||||
page_head("Account data for $user->name");
|
||||
start_table();
|
||||
show_user_stats($user);
|
||||
show_user_stats($user, false);
|
||||
end_table();
|
||||
page_tail();
|
||||
} else {
|
||||
|
|
|
@ -88,7 +88,6 @@ function require_team($team) {
|
|||
// requires that the user is logged in as the founder of
|
||||
// the team trying to be edited
|
||||
function require_founder_login($user, $team) {
|
||||
require_login($user);
|
||||
require_team($team);
|
||||
if ($user->id != $team->userid) {
|
||||
page_head("Permission denied");
|
||||
|
|
|
@ -4,7 +4,7 @@ include_once("db.inc");
|
|||
include_once("util.inc");
|
||||
include_once("team.inc");
|
||||
|
||||
$authenticator = init_session();
|
||||
init_session();
|
||||
db_init();
|
||||
|
||||
page_head("Teams");
|
||||
|
|
|
@ -4,72 +4,68 @@
|
|||
require_once("team.inc");
|
||||
require_once("db.inc");
|
||||
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
|
||||
$user = get_user_from_auth($authenticator);
|
||||
if (!$user) {
|
||||
print_login_form();
|
||||
} else {
|
||||
if (!strlen($HTTP_POST_VARS["name"])) {
|
||||
page_head("Error");
|
||||
echo "You must specify a name for your team.";
|
||||
} else {
|
||||
$query = sprintf(
|
||||
"insert into team (userid, create_time, name, name_lc, url, type, name_html, description, country, nusers) values(%d, %d, '%s', '%s', '%s', %d, '%s', '%s', '%s', %d)",
|
||||
$user->id,
|
||||
time(),
|
||||
$HTTP_POST_VARS["name"],
|
||||
strtolower($HTTP_POST_VARS["name"]),
|
||||
$HTTP_POST_VARS["url"],
|
||||
$HTTP_POST_VARS["type"],
|
||||
$HTTP_POST_VARS["name_html"],
|
||||
$HTTP_POST_VARS["description"],
|
||||
$HTTP_POST_VARS["country"],
|
||||
1
|
||||
$user = get_logged_in_user();
|
||||
if (!strlen($HTTP_POST_VARS["name"])) {
|
||||
page_head("Error");
|
||||
echo "You must specify a name for your team.";
|
||||
exit();
|
||||
}
|
||||
$query = sprintf(
|
||||
"insert into team (userid, create_time, name, name_lc, url, type, name_html, description, country, nusers) values(%d, %d, '%s', '%s', '%s', %d, '%s', '%s', '%s', %d)",
|
||||
$user->id,
|
||||
time(),
|
||||
$HTTP_POST_VARS["name"],
|
||||
strtolower($HTTP_POST_VARS["name"]),
|
||||
$HTTP_POST_VARS["url"],
|
||||
$HTTP_POST_VARS["type"],
|
||||
$HTTP_POST_VARS["name_html"],
|
||||
$HTTP_POST_VARS["description"],
|
||||
$HTTP_POST_VARS["country"],
|
||||
1
|
||||
);
|
||||
|
||||
// TODO: the following logic is very confused
|
||||
|
||||
$result = mysql_query($query);
|
||||
if ($result) {
|
||||
$query_team = sprintf(
|
||||
"select * from team where name = '%s'",
|
||||
$HTTP_POST_VARS["name"]
|
||||
);
|
||||
$result_team = mysql_query($query_team);
|
||||
$team = mysql_fetch_object($result_team);
|
||||
if ($user->teamid != 0) {
|
||||
$query_team_other = sprintf(
|
||||
"select * from team where id = %d",
|
||||
$user->teamid
|
||||
);
|
||||
|
||||
// TODO: the following logic is very confused
|
||||
|
||||
$result = mysql_query($query);
|
||||
if ($result) {
|
||||
$query_team = sprintf(
|
||||
"select * from team where name = '%s'",
|
||||
$HTTP_POST_VARS["name"]
|
||||
);
|
||||
$result_team = mysql_query($query_team);
|
||||
$team = mysql_fetch_object($result_team);
|
||||
if ($user->teamid != 0) {
|
||||
$query_team_other = sprintf(
|
||||
"select * from team where id = %d",
|
||||
$user->teamid
|
||||
);
|
||||
$result_team_other = mysql_query($query_team_other);
|
||||
$first_team = mysql_fetch_object($result_team_other);
|
||||
$first_nusers = $first_team->nusers;
|
||||
$first_new_nusers = $first_nusers - 1;
|
||||
$query_team_table_other = sprintf(
|
||||
"update team set nusers = %d where id = %d",
|
||||
$first_new_nusers,
|
||||
$first_team->id
|
||||
);
|
||||
$result_team_table_other = mysql_query($query_team_table_other);
|
||||
}
|
||||
$query_user_table = sprintf(
|
||||
"update user set teamid = %d where id = %d",
|
||||
$team->id,
|
||||
$user->id
|
||||
);
|
||||
$result_user_table = mysql_query($query_user_table);
|
||||
}
|
||||
if ($result && $result_user_table) {
|
||||
display_team_page($team);
|
||||
} else {
|
||||
page_head("Error");
|
||||
echo "Couldn't create team - please try later.<br>\n";
|
||||
echo "You may need to try a different team name.\n";
|
||||
page_tail();
|
||||
}
|
||||
$result_team_other = mysql_query($query_team_other);
|
||||
$first_team = mysql_fetch_object($result_team_other);
|
||||
$first_nusers = $first_team->nusers;
|
||||
$first_new_nusers = $first_nusers - 1;
|
||||
$query_team_table_other = sprintf(
|
||||
"update team set nusers = %d where id = %d",
|
||||
$first_new_nusers,
|
||||
$first_team->id
|
||||
);
|
||||
$result_team_table_other = mysql_query($query_team_table_other);
|
||||
}
|
||||
$query_user_table = sprintf(
|
||||
"update user set teamid = %d where id = %d",
|
||||
$team->id,
|
||||
$user->id
|
||||
);
|
||||
$result_user_table = mysql_query($query_user_table);
|
||||
}
|
||||
if ($result && $result_user_table) {
|
||||
display_team_page($team);
|
||||
} else {
|
||||
page_head("Error");
|
||||
echo "Couldn't create team - please try later.<br>\n";
|
||||
echo "You may need to try a different team name.\n";
|
||||
page_tail();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -3,17 +3,11 @@
|
|||
require_once("util.inc");
|
||||
require_once("team.inc");
|
||||
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
|
||||
$user = get_user_from_auth($authenticator);
|
||||
$user = get_logged_in_user();
|
||||
|
||||
if ($user == NULL) {
|
||||
print_login_form();
|
||||
exit();
|
||||
}
|
||||
|
||||
page_head("Create a team");
|
||||
page_head("Create a team");
|
||||
|
||||
echo "<form method=post action=team_create_action.php>\n";
|
||||
start_table();
|
||||
|
@ -64,5 +58,5 @@ row2("",
|
|||
end_table();
|
||||
echo "</form>\n";
|
||||
|
||||
page_tail();
|
||||
page_tail();
|
||||
?>
|
||||
|
|
|
@ -4,9 +4,8 @@
|
|||
require_once("team.inc");
|
||||
require_once("db.inc");
|
||||
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
$user = get_user_from_auth($authenticator);
|
||||
$user = get_logged_in_user();
|
||||
|
||||
$query = sprintf(
|
||||
"select * from team where id = %d",
|
||||
|
@ -19,23 +18,23 @@
|
|||
}
|
||||
require_founder_login($user, $team);
|
||||
|
||||
$query_team_table = sprintf(
|
||||
"delete from team where id = %d",
|
||||
$team->id
|
||||
);
|
||||
if ($team->nusers == 0) {
|
||||
$result_team_table = mysql_query($query_team_table);
|
||||
}
|
||||
if ($result_team_table) {
|
||||
$team_name = $team->name;
|
||||
page_head("$team_name disbanded");
|
||||
echo "<h2>Disband Complete</h2>";
|
||||
echo "You have disbanded $team_name.";
|
||||
} else {
|
||||
page_head("Error");
|
||||
echo "Couldn't disband team - please try later.\n";
|
||||
}
|
||||
$query_team_table = sprintf(
|
||||
"delete from team where id = %d",
|
||||
$team->id
|
||||
);
|
||||
if ($team->nusers == 0) {
|
||||
$result_team_table = mysql_query($query_team_table);
|
||||
}
|
||||
if ($result_team_table) {
|
||||
$team_name = $team->name;
|
||||
page_head("$team_name disbanded");
|
||||
echo "<h2>Disband Complete</h2>";
|
||||
echo "You have disbanded $team_name.";
|
||||
} else {
|
||||
page_head("Error");
|
||||
echo "Couldn't disband team - please try later.\n";
|
||||
}
|
||||
|
||||
page_tail();
|
||||
page_tail();
|
||||
|
||||
?>
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
require_once("util.inc");
|
||||
require_once("team.inc");
|
||||
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
$user = get_user_from_auth($authenticator);
|
||||
$id = $HTTP_GET_VARS["id"];
|
||||
db_init();
|
||||
$user = get_logged_in_user();
|
||||
|
||||
$id = $HTTP_GET_VARS["id"];
|
||||
|
||||
$query = sprintf(
|
||||
"select * from team where id = %d",
|
||||
|
|
|
@ -4,8 +4,8 @@ require_once("util.inc");
|
|||
require_once("team.inc");
|
||||
require_once("db.inc");
|
||||
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
init_session();
|
||||
|
||||
$query = sprintf(
|
||||
"select * from team where id=%d",
|
||||
|
|
|
@ -4,9 +4,8 @@
|
|||
require_once("team.inc");
|
||||
require_once("db.inc");
|
||||
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
$user = get_user_from_auth($authenticator);
|
||||
$user = get_logged_in_user();
|
||||
$id = $HTTP_POST_VARS["id"];
|
||||
|
||||
$query = "select * from team where id = $id";
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
require_once("util.inc");
|
||||
require_once("team.inc");
|
||||
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
$user = get_user_from_auth($authenticator);
|
||||
db_init();
|
||||
$user = get_logged_in_user();
|
||||
|
||||
$id = $HTTP_GET_VARS["id"];
|
||||
|
||||
$query = "select * from team where id = $id";
|
||||
|
@ -23,30 +23,31 @@ $user = get_user_from_auth($authenticator);
|
|||
$team_type = $team->type;
|
||||
page_head("Edit $team_name");
|
||||
echo "<table width=780>
|
||||
<tr><td>
|
||||
<form method=post action=team_edit_action.php>
|
||||
<input type=hidden name=id value=$team_id>
|
||||
</td></tr></table>
|
||||
<table><tr>
|
||||
<td>Team name (plain-text version):<br><br> </td>
|
||||
<td><input name=name size=50 value=\"$team_name\">
|
||||
<br><font size=2>This name will be print as-is
|
||||
<br>and is the name you should use when searching for your team.
|
||||
</td></tr></tr>
|
||||
<td>Team name (HTML version):<br><br> </td>
|
||||
<td><input name=name_html size=50 value=\"$team_name_html\">
|
||||
<br><font size=2>This name will be printed as HTML source, so you may include any HTML
|
||||
<br>code that you want. This will only be displayed in your team's page.
|
||||
<br>If you don't know HTML, just leave this box blank.
|
||||
</td></tr><tr>
|
||||
<td>URL of team web page, if any:<br><font size=2>(without "http://")</td>
|
||||
<td><input name=url size=60 value=$team_url>
|
||||
<br><font size=2>This page will be linked to from the project's team page.
|
||||
</td></tr><tr>
|
||||
<td valign=top>Description of team:</td>
|
||||
<td><textarea name=description cols=60 rows=10>$team_description</textarea>
|
||||
</td></tr><tr>
|
||||
<td valign=top>Type of team:</td><td>";
|
||||
<tr><td>
|
||||
<form method=post action=team_edit_action.php>
|
||||
<input type=hidden name=id value=$team_id>
|
||||
</td></tr></table>
|
||||
<table><tr>
|
||||
<td>Team name (plain-text version):<br><br> </td>
|
||||
<td><input name=name size=50 value=\"$team_name\">
|
||||
<br><font size=2>This name will be print as-is
|
||||
<br>and is the name you should use when searching for your team.
|
||||
</td></tr></tr>
|
||||
<td>Team name (HTML version):<br><br> </td>
|
||||
<td><input name=name_html size=50 value=\"$team_name_html\">
|
||||
<br><font size=2>This name will be printed as HTML source, so you may include any HTML
|
||||
<br>code that you want. This will only be displayed in your team's page.
|
||||
<br>If you don't know HTML, just leave this box blank.
|
||||
</td></tr><tr>
|
||||
<td>URL of team web page, if any:<br><font size=2>(without "http://")</td>
|
||||
<td><input name=url size=60 value=$team_url>
|
||||
<br><font size=2>This page will be linked to from the project's team page.
|
||||
</td></tr><tr>
|
||||
<td valign=top>Description of team:</td>
|
||||
<td><textarea name=description cols=60 rows=10>$team_description</textarea>
|
||||
</td></tr><tr>
|
||||
<td valign=top>Type of team:</td><td>
|
||||
";
|
||||
printf("<input type=radio name=type value=4%s>Club<br>", ($team->type==4)?" checked":"");
|
||||
printf("<input type=radio name=type value=1%s>Small Company (< 50 employees)<br>", ($team->type==1)?" checked":"");
|
||||
printf("<input type=radio name=type value=2%s>Medium Company (50-1000 employees)<br>", ($team->type==2)?" checked":"");
|
||||
|
|
|
@ -4,20 +4,19 @@ require_once("util.inc");
|
|||
require_once("team.inc");
|
||||
require_once("db.inc");
|
||||
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
db_init();
|
||||
|
||||
$user = get_user_from_auth($authenticator);
|
||||
$user = get_logged_in_user();
|
||||
|
||||
$query = sprintf(
|
||||
"select * from team where id=%d",
|
||||
$HTTP_GET_VARS["id"]
|
||||
);
|
||||
$result = mysql_query($query);
|
||||
if ($result) {
|
||||
$team = mysql_fetch_object($result);
|
||||
mysql_free_result($result);
|
||||
}
|
||||
$query = sprintf(
|
||||
"select * from team where id=%d",
|
||||
$HTTP_GET_VARS["id"]
|
||||
);
|
||||
$result = mysql_query($query);
|
||||
if ($result) {
|
||||
$team = mysql_fetch_object($result);
|
||||
mysql_free_result($result);
|
||||
}
|
||||
|
||||
require_founder_login($user, $team);
|
||||
|
||||
|
@ -42,6 +41,6 @@ if ($result) {
|
|||
}
|
||||
echo "</table>";
|
||||
|
||||
page_tail();
|
||||
page_tail();
|
||||
|
||||
?>
|
||||
|
|
|
@ -4,10 +4,8 @@
|
|||
require_once("team.inc");
|
||||
require_once("db.inc");
|
||||
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
$user = get_user_from_auth($authenticator);
|
||||
require_login($user);
|
||||
$user = get_logged_in_user();
|
||||
|
||||
$query = sprintf(
|
||||
"select * from team where id = %d",
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
require_once("util.inc");
|
||||
require_once("team.inc");
|
||||
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
$user = get_logged_in_user();
|
||||
$id = $HTTP_GET_VARS["id"];
|
||||
|
||||
$query = "select * from team where id = $id";
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
require_once("team.inc");
|
||||
require_once("db.inc");
|
||||
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
init_session();
|
||||
|
||||
$team_name = $HTTP_POST_VARS["team_name"];
|
||||
$words = preg_split("/[\s,]+/", $team_name);
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
<?php
|
||||
|
||||
require_once("util.inc");
|
||||
require_once("team.inc");
|
||||
require_once("db.inc");
|
||||
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
$user = get_user_from_auth($authenticator);
|
||||
require_login($user);
|
||||
$user = get_logged_in_user();
|
||||
|
||||
$query = sprintf(
|
||||
"select * from team where id = %d",
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
|
||||
require_once("util.inc");
|
||||
require_once("team.inc");
|
||||
$authenticator = init_session();
|
||||
|
||||
db_init();
|
||||
$user = get_logged_in_user();
|
||||
$id = $HTTP_GET_VARS["id"];
|
||||
|
||||
$query = sprintf(
|
||||
|
|
|
@ -4,16 +4,15 @@
|
|||
require_once("team.inc");
|
||||
require_once("db.inc");
|
||||
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
$user = get_user_from_auth($authenticator);
|
||||
$user = get_logged_in_user();
|
||||
|
||||
$query = sprintf(
|
||||
"select * from team where id = %d",
|
||||
$HTTP_POST_VARS["id"]
|
||||
);
|
||||
$result = mysql_query($query);
|
||||
if($result) {
|
||||
if ($result) {
|
||||
$team = mysql_fetch_object($result);
|
||||
mysql_free_result($result);
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
|
||||
require_once("util.inc");
|
||||
require_once("team.inc");
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
$user = get_user_from_auth($authenticator);
|
||||
$id = $HTTP_GET_VARS["id"];
|
||||
require_once("util.inc");
|
||||
require_once("team.inc");
|
||||
|
||||
db_init();
|
||||
$user = get_logged_in_user();
|
||||
$id = $HTTP_GET_VARS["id"];
|
||||
|
||||
$query = sprintf(
|
||||
"select * from team where id = %d",
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
|
||||
$max_hosts_display = 100;
|
||||
db_init();
|
||||
page_head("Top hosts");
|
||||
page_head("Top computers");
|
||||
$result = mysql_query("select * from host order by expavg_credit desc limit $max_hosts_display");
|
||||
host_table_start("Top hosts");
|
||||
host_table_start("Top computers", false);
|
||||
$i = 1;
|
||||
while (($host = mysql_fetch_object($result)) && $max_hosts_display > 0) {
|
||||
show_host_row($host, $i);
|
||||
show_host_row($host, $i, false);
|
||||
$max_hosts_display--;
|
||||
$i++;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
<?php
|
||||
|
||||
function show_user_stats($user) {
|
||||
row1("Account data for $user->name");
|
||||
function show_user_stats($user, $private) {
|
||||
if ($private) {
|
||||
row1("Your account statistics");
|
||||
} else {
|
||||
row1("Account statistics for $user->name");
|
||||
}
|
||||
$row = sprintf("%s User since", $project);
|
||||
row2($row, time_str($user->create_time));
|
||||
row2("Total credit", $user->total_credit);
|
||||
|
@ -14,43 +18,30 @@ function show_user_stats($user) {
|
|||
row2("Team", "None");
|
||||
}
|
||||
row2("Country", $user->country);
|
||||
row2("Hosts", "<a href=hosts_user.php?userid=$user->id>Click to view</a>");
|
||||
if ($private) {
|
||||
row2("Computers", "<a href=hosts_user.php>View</a>");
|
||||
} else {
|
||||
row2("Computers", "<a href=hosts_user.php?userid=$user->id>View</a>");
|
||||
}
|
||||
}
|
||||
|
||||
function show_user_profile($user) {
|
||||
function show_user_profile_private($user) {
|
||||
if (is_valid_email_addr($user->email_addr)) {
|
||||
$email_text = $user->email_addr;
|
||||
} else {
|
||||
$email_text = "Verification pending";
|
||||
}
|
||||
row1("Account information");
|
||||
row1("Your account information");
|
||||
row2("Email address<br>
|
||||
<font size=-1><a href=edit_email_form.php>Edit</a></font>",
|
||||
$email_text
|
||||
);
|
||||
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) {
|
||||
$result = mysql_query("select * from host where userid=$user->id order by rpc_time desc");
|
||||
start_table();
|
||||
echo "<tr><td>Host name</td><td>Total Credit</td><td>Recent credit</td></tr>";
|
||||
while ($host = mysql_fetch_object($result)) {
|
||||
echo "<p>\n";
|
||||
show_host_brief($host);
|
||||
}
|
||||
echo "</table>\n";
|
||||
mysql_free_result($result);
|
||||
}
|
||||
|
||||
function show_host_brief($host) {
|
||||
echo "<tr>
|
||||
<td><a href=show_host_detail.php?hostid=$host->id>$host->domain_name</a></td>
|
||||
<td>$host->total_credit</td>
|
||||
<td>$host->expavg_credit</td>
|
||||
</tr>
|
||||
";
|
||||
row2("", "<a href=edit_user_info_form.php>Edit account info</a>");
|
||||
row2("General preferences", "<a href=prefs.php?subset=global>View</a>");
|
||||
row2(PROJECT." preferences", "<a href=prefs.php?subset=project>View</a>");
|
||||
}
|
||||
|
||||
// show a summary of the user.
|
||||
|
@ -59,14 +50,9 @@ function show_host_brief($host) {
|
|||
|
||||
function show_user_page_private($user) {
|
||||
start_table();
|
||||
show_user_profile($user);
|
||||
show_user_stats($user);
|
||||
show_user_profile_private($user);
|
||||
show_user_stats($user, true);
|
||||
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 preferences</a></li>";
|
||||
echo "<li><a href=prefs.php?subset=project>".PROJECT." preferences</a></li>";
|
||||
echo "</ul>";
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -40,6 +40,13 @@ function get_user_from_auth($auth) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
function get_logged_in_user() {
|
||||
$authenticator = init_session();
|
||||
$user = get_user_from_auth($authenticator);
|
||||
require_login($user);
|
||||
return $user;
|
||||
}
|
||||
|
||||
function show_login($user) {
|
||||
if ($user) {
|
||||
echo "Logged in as %s.\n", $user->name;
|
||||
|
|
6
todo
6
todo
|
@ -32,6 +32,12 @@ THINGS TO TEST (preferably with test scripts)
|
|||
MEDIUM-PRIORITY (should do before public release)
|
||||
-----------------------
|
||||
|
||||
add to user table:
|
||||
URL field (in XML)
|
||||
"show hosts to others" flag (in XML)
|
||||
move "send email" flag from XML to DB
|
||||
remove "show email" flag
|
||||
|
||||
add user control for HD write frequency
|
||||
|
||||
decide what to do with invalid result files in upload directory
|
||||
|
|
Loading…
Reference in New Issue