2006-10-27 16:06:42 +00:00
|
|
|
<?php
|
|
|
|
|
2007-11-07 23:59:08 +00:00
|
|
|
// action = 'transfer':
|
|
|
|
// handle a user's request to initiate a foundership transfer
|
|
|
|
// action = 'decline':
|
|
|
|
// handle the current founder's declining of the request
|
2007-06-17 15:34:43 +00:00
|
|
|
|
2007-10-26 21:14:35 +00:00
|
|
|
require_once("../inc/boinc_db.inc");
|
2006-10-27 16:06:42 +00:00
|
|
|
require_once("../inc/util.inc");
|
|
|
|
require_once("../inc/team.inc");
|
|
|
|
require_once("../inc/email.inc");
|
|
|
|
|
2007-11-07 23:59:08 +00:00
|
|
|
$user = get_logged_in_user();
|
2006-11-02 19:43:54 +00:00
|
|
|
if (!$user->teamid) {
|
2007-11-07 23:59:08 +00:00
|
|
|
error_page("You must be a member of a team to access this page.");
|
2006-11-02 19:43:54 +00:00
|
|
|
}
|
2006-10-27 16:06:42 +00:00
|
|
|
|
2007-07-23 20:30:30 +00:00
|
|
|
function send_founder_transfer_email($team, $user) {
|
|
|
|
$body = "Team member ".$user->name." has asked that you
|
|
|
|
transfer foundership of $team->name in ".PROJECT.".
|
|
|
|
Please visit
|
2007-11-18 22:42:47 +00:00
|
|
|
".URL_BASE."team_change_founder_form.php?teamid=".$team->id."
|
2007-11-07 23:59:08 +00:00
|
|
|
to transfer foundership or decline the request.
|
2007-07-23 20:30:30 +00:00
|
|
|
|
|
|
|
If you do not respond to this request within two months, ".$user->name." will
|
|
|
|
be given the option to become the team founder.
|
|
|
|
|
|
|
|
Please do not respond to this email.
|
|
|
|
The mailbox is not monitored and the email
|
|
|
|
was sent using an automated system.";
|
|
|
|
|
|
|
|
$founder = lookup_user_id($team->userid);
|
|
|
|
|
|
|
|
return send_email($founder, PROJECT." team founder transfer", $body);
|
|
|
|
}
|
|
|
|
|
|
|
|
function send_founder_transfer_decline_email($team, $user) {
|
|
|
|
$body = "The founder of ".$team->name." has declined your request
|
2007-11-07 23:59:08 +00:00
|
|
|
to become the founder in ".PROJECT.".
|
|
|
|
You can repeat the request at least 90 days after the initial request.
|
2007-07-23 20:30:30 +00:00
|
|
|
|
|
|
|
Please do not respond to this email.
|
|
|
|
The mailbox is not monitored and the email
|
|
|
|
was sent using an automated system.";
|
|
|
|
|
|
|
|
return send_email($user, PROJECT." team founder transfer declined", $body);
|
|
|
|
}
|
|
|
|
|
2006-10-27 16:06:42 +00:00
|
|
|
$action = post_str("action");
|
|
|
|
|
|
|
|
if ($action == "transfer") {
|
2007-10-26 21:14:35 +00:00
|
|
|
$team = BoincTeam::lookup_id($user->teamid);
|
2007-11-07 23:59:08 +00:00
|
|
|
page_head("Request foundership of ".$team->name);
|
2006-10-27 16:06:42 +00:00
|
|
|
$now = time();
|
|
|
|
|
2007-11-07 23:59:08 +00:00
|
|
|
if (new_transfer_request_ok($team, $now)) {
|
|
|
|
$success = send_founder_transfer_email($team, $user);
|
|
|
|
if ($success) {
|
|
|
|
$team->update("ping_user=$user->id, ping_time=$now");
|
|
|
|
echo "<p>
|
|
|
|
The current founder has been notified of your request by email.
|
|
|
|
<p>
|
|
|
|
If the founder does not respond within 60 days you will be
|
|
|
|
allowed to become the founder.
|
|
|
|
";
|
|
|
|
} else {
|
|
|
|
echo "Couldn't send notification email; please try again later.";
|
|
|
|
}
|
2006-10-27 16:06:42 +00:00
|
|
|
} else {
|
2007-06-17 15:34:43 +00:00
|
|
|
if ($team->ping_user) {
|
|
|
|
if ($user->id == $team->ping_user) {
|
2007-11-07 23:59:08 +00:00
|
|
|
if (transfer_ok($team, $now)) {
|
2008-03-28 03:05:19 +00:00
|
|
|
$team->update("userid=$user->id, ping_user=0, ping_time=0");
|
2007-06-17 15:34:43 +00:00
|
|
|
echo "<p>Congratulations, you are now the new founder of team ".$team->name."
|
2007-11-18 22:42:47 +00:00
|
|
|
Go to <a href=\"".URL_BASE."home.php\">Your Account page</a>
|
2007-11-07 23:59:08 +00:00
|
|
|
to find the Team Admin options.";
|
|
|
|
} else {
|
|
|
|
echo "<p>
|
|
|
|
You have already requested the foundership
|
|
|
|
of $team->name.
|
|
|
|
<p>
|
|
|
|
Team founder has been notified about your request.
|
|
|
|
If he/she does not respond by ".time_str(transfer_ok_time($team))."
|
|
|
|
you will be given the option to assume team foundership.
|
|
|
|
";
|
2007-06-17 15:34:43 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$ping_user = lookup_user_id($team->ping_user);
|
2007-11-07 23:59:08 +00:00
|
|
|
echo "<p>Foundership was requested by ".user_links($ping_user)." on ".time_str($team->ping_time);
|
2007-06-17 15:34:43 +00:00
|
|
|
}
|
|
|
|
} else {
|
2007-11-07 23:59:08 +00:00
|
|
|
echo "<p>A foundership change has been requested in the last three
|
|
|
|
months and new requests are currently disabled.
|
|
|
|
";
|
2007-06-17 15:34:43 +00:00
|
|
|
}
|
2006-10-27 16:06:42 +00:00
|
|
|
}
|
|
|
|
} else if ($action == "decline") {
|
|
|
|
$teamid = post_int("teamid");
|
|
|
|
$team = lookup_team($teamid);
|
|
|
|
require_founder_login($user, $team);
|
|
|
|
page_head("Decline founder change request");
|
|
|
|
|
|
|
|
if ($team->ping_user) {
|
2007-10-26 21:14:35 +00:00
|
|
|
$ping_user = BoincUser::lookup_id($team->ping_user);
|
2007-06-17 15:34:43 +00:00
|
|
|
|
2007-10-26 21:14:35 +00:00
|
|
|
$team->update("ping_user=0");
|
2007-06-17 15:34:43 +00:00
|
|
|
send_founder_transfer_decline_email($team, $ping_user);
|
2007-11-07 23:59:08 +00:00
|
|
|
echo "<p>The foundership request from ".user_links($ping_user)
|
|
|
|
." has been declined.
|
2007-06-17 15:34:43 +00:00
|
|
|
";
|
2006-10-27 16:06:42 +00:00
|
|
|
} else {
|
2007-11-07 23:59:08 +00:00
|
|
|
echo "<p>There were no foundership requests.";
|
2006-10-27 16:06:42 +00:00
|
|
|
}
|
2007-11-07 23:59:08 +00:00
|
|
|
} else {
|
|
|
|
error_page("no action");
|
2006-10-27 16:06:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
echo "<a href='team_display.php?teamid=$team->id'>Return to team page</a>";
|
|
|
|
|
|
|
|
page_tail();
|
|
|
|
|
2007-11-07 23:59:08 +00:00
|
|
|
$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit
|
|
|
|
|
2006-10-27 16:06:42 +00:00
|
|
|
?>
|