1 | <?php |
||
2 | // This file is part of BOINC. |
||
3 | // http://boinc.berkeley.edu |
||
4 | // Copyright (C) 2014 University of California |
||
5 | // |
||
6 | // BOINC is free software; you can redistribute it and/or modify it |
||
7 | // under the terms of the GNU Lesser General Public License |
||
8 | // as published by the Free Software Foundation, |
||
9 | // either version 3 of the License, or (at your option) any later version. |
||
10 | // |
||
11 | // BOINC is distributed in the hope that it will be useful, |
||
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
14 | // See the GNU Lesser General Public License for more details. |
||
15 | // |
||
16 | // You should have received a copy of the GNU Lesser General Public License |
||
17 | // along with BOINC. If not, see <http://www.gnu.org/licenses/>. |
||
18 | |||
19 | require_once("../inc/boinc_db.inc"); |
||
20 | require_once("../inc/util.inc"); |
||
21 | require_once("../inc/team.inc"); |
||
22 | |||
23 | if (DISABLE_TEAMS) error_page("Teams are disabled"); |
||
24 | |||
25 | check_get_args(array("teamid", "tnow", "ttok")); |
||
26 | |||
27 | $user = get_logged_in_user(true); |
||
28 | check_tokens($user->authenticator); |
||
29 | |||
30 | $teamid = get_int("teamid"); |
||
31 | $team = BoincTeam::lookup_id($teamid); |
||
32 | require_team($team); |
||
33 | if (!$team->joinable) { |
||
34 | error_page(tra("The team %1 is not joinable.", $team->name)); |
||
35 | } |
||
36 | if ($user->teamid == $team->id) { |
||
37 | page_head(tra("Already a member")); |
||
38 | echo tra("You are already a member of %1.", $team->name); |
||
39 | } else { |
||
40 | $success = user_join_team($team, $user); |
||
41 | if ($success) { |
||
42 | Header("Location: ".HOME_PAGE); |
||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
43 | } else { |
||
44 | error_page(tra("Couldn't join team - please try again later.")); |
||
45 | } |
||
46 | } |
||
47 | |||
48 | page_tail(); |
||
49 | |||
50 | ?> |
||
51 |