コード例 #1
0
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
require_once "../inc/boinc_db.inc";
require_once "../inc/util.inc";
require_once "../inc/team.inc";
check_get_args(array("tnow", "ttok"));
$user = get_logged_in_user(true);
check_tokens($user->authenticator);
$teamid = post_int("teamid");
$team = BoincTeam::lookup_id($teamid);
require_team($team);
if (!$team->joinable) {
    error_page(tra("The team %1 is not joinable.", $team->name));
}
if ($user->teamid == $team->id) {
    page_head(tra("Already a member"));
    echo tra("You are already a member of %1.", $team->name);
} else {
    $success = user_join_team($team, $user);
    if ($success) {
        page_head(tra("Joined %1", $team->name));
        echo tra("You have joined %1.", "<a href=team_display.php?teamid={$team->id}>{$team->name}</a>");
    } else {
        error_page(tra("Couldn't join team - please try again later."));
    }
}
page_tail();
$cvs_version_tracker[] = "\$Id\$";
//Generated automatically - do not edit
コード例 #2
0
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
require_once "../inc/boinc_db.inc";
require_once "../inc/util.inc";
require_once "../inc/team.inc";
check_get_args(array());
$user = get_logged_in_user();
$name = post_str("name", true);
if (strlen($name) == 0) {
    error_page(tra("You must choose a non-blank team name"));
}
$new_team = lookup_team_name($name);
if ($new_team) {
    error_page(tra("A team named %1 already exists - try another name", htmlentities($name)));
}
$url = post_str("url", true);
$type = post_str("type", true);
$name_html = post_str("name_html", true);
$description = post_str("description", true);
$country = post_str("country", true);
if ($country == "") {
    $country = "International";
}
$new_team = make_team($user->id, $name, $url, $type, $name_html, $description, $country);
if ($new_team) {
    user_join_team($new_team, $user);
    Header("Location: team_display.php?teamid={$new_team->id}");
} else {
    error_page(tra("Could not create team - please try later."));
}
コード例 #3
0
ファイル: create_account.php プロジェクト: CalvinZhu/boinc
    xml_error(ERR_BAD_EMAIL_ADDR);
}
if (strlen($passwd_hash) != 32) {
    xml_error(-1, "password hash length not 32");
}
$user = BoincUser::lookup_email_addr($email_addr);
if ($user) {
    if ($user->passwd_hash != $passwd_hash) {
        xml_error(ERR_DB_NOT_UNIQUE);
    } else {
        $authenticator = $user->authenticator;
    }
} else {
    $user = make_user($email_addr, $user_name, $passwd_hash, 'International');
    if (!$user) {
        xml_error(ERR_DB_NOT_UNIQUE);
    }
    if (defined('INVITE_CODES')) {
        error_log("Account for '{$email_addr}' created using invitation code '{$invite_code}'");
    }
}
if ($team_name) {
    $team_name = BoincDb::escape_string($team_name);
    $team = BoincTeam::lookup("name='{$team_name}'");
    if ($team && $team->joinable) {
        user_join_team($team, $user);
    }
}
echo " <account_out>\n";
echo "   <authenticator>{$user->authenticator}</authenticator>\n";
echo "</account_out>\n";