Issues (1963)

html/user/team_manage.php (1 issue)

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", "action", "tnow", "ttok"));
26
27
function show_admin_page($user, $team) {
28
    page_head(tra("Team administration for %1", $team->name));
29
    echo "
30
        <ul>
31
        <li><a href=team_edit_form.php?teamid=$team->id>".tra("Edit team info")."</a>
32
            <br><small>".tra("Change team name, URL, description, type, or country")."</small>
33
        <li><a href=pm.php?action=new&teamid=$team->id>".tra("Send message to team")."</a>
34
        <li>
35
            ".tra("Member list:")."
36
        <a href=team_email_list.php?teamid=$team->id>".tra("HTML")."</a>
37
        &middot; <a href=team_email_list.php?teamid=$team->id&plain=1>".tra("text")."</a>
38
        &middot; <a href=team_email_list.php?teamid=$team->id&xml=1>".tra("XML")."</a>
39
            <br><small>".tra("View member info")."</small>
40
        <li>".tra("View change history:")."
41
            <a href=team_delta.php?teamid=$team->id>".tra("HTML")."</a>
42
            &middot; <a href=team_delta.php?teamid=$team->id&xml=1>".tra("XML")."</a>
43
            <br><small>".tra("See when members joined or quit this team")."</small>
44
    ";
45
46
    // founder-only stuff follows
47
    //
48
    if ($team->userid == $user->id) {
49
        $tokens = url_tokens($user->authenticator);
50
        if ($team->ping_user > 0) {
51
            $user2 = BoincUser::lookup_id($team->ping_user);
52
            $deadline = date_str(transfer_ok_time($team));
53
            echo "<li>
54
                <a href=team_change_founder_form.php?teamid=$team->id><font color=red><strong>".tra("Respond to foundership request.")."</strong></font></a>  ".tra("If you don't respond by %1, %2 may assume foundership of this team.", $deadline, $user2->name)
55
                ;
0 ignored issues
show
Space found before semicolon; expected ");" but found ")
;"
Loading history...
56
        }
57
        echo "
58
            <li><a href=team_remove_inactive_form.php?teamid=$team->id>".tra("Remove members")."</a>
59
                <br><small>".tra("Remove inactive or unwanted members from this team")."</small>
60
            <li><a href=team_change_founder_form.php?teamid=$team->id>".tra("Change founder")."</a>
61
                <br><small>".tra("Transfer foundership to another member")."</small>
62
            <li><a href=team_admins.php?teamid=$team->id>".tra("Add/remove Team Admins")."</a>
63
                <br><small>".tra("Give selected team members Team Admin privileges")."</small>
64
65
            <li><a href=team_manage.php?teamid=$team->id&action=delete&$tokens>".tra("Remove team")."</a>
66
                <br><small>".tra("Allowed only if team has no members")."</small>
67
            <li><a href=team_forum.php?teamid=$team->id&cmd=manage>".tra("Message board")."</a>
68
                <br><small>".tra("Create or manage a team message board")."</small>
69
        ";
70
    }
71
    echo "
72
        <li>
73
            ".tra("To have this team created on all BOINC projects (current and future) you can make it into a %1 BOINC-wide team %2.", "<a href=https://boinc.berkeley.edu/teams/>", "</a>")."
74
        <li>
75
            ".tra("Team admins are encouraged to join and participate in the Google %1 boinc-team-founders %2 group.", "<a href=https://groups.google.com/forum/#!forum/boinc-team-founders>", "</a>")."
76
    </ul>
77
    ";
78
79
    page_tail();
80
}
81
82
$user = get_logged_in_user(true);
83
$teamid = get_int('teamid');
84
$team = BoincTeam::lookup_id($teamid);
85
if (!$team) error_page(tra("No such team"));
86
87
$action = get_str('action', true);
88
if ($action == 'delete') {
89
    require_founder_login($user, $team);
90
    if (team_count_members($team->id) > 0) {
91
        error_page(tra("Can't delete non-empty team"));
92
    }
93
    check_tokens($user->authenticator);
94
    $team->delete();
95
    page_head(tra("Team %1 deleted", $team->name));
96
    page_tail();
97
} else {
98
    require_admin($user, $team);
99
    show_admin_page($user, $team);
100
}
101
?>
102