Issues (1839)

html/user/forum_banishment_vote_action.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
20
require_once("../inc/util.inc");
21
require_once("../inc/forum_db.inc");
22
require_once("../inc/forum_banishment_vote.inc");
23
24
if (DISABLE_FORUMS) error_page("Forums are disabled");
25
26
check_get_args(array("action", "userid", "tnow", "ttok"));
27
28
$config = get_config();
29
30
$logged_in_user = get_logged_in_user();
31
BoincForumPrefs::lookup($logged_in_user);
32
check_tokens($logged_in_user->authenticator);
33
34
if (!$logged_in_user->prefs->privilege(S_MODERATOR)) {
35
    error_page(tra("You are not authorized to banish users."));
36
}
37
38
// See if "action" is provided - either through post or get
39
if (!post_str('action', true)) {
40
    if (!get_str('action', true)){
41
	    error_page(tra("You must specify an action..."));
42
    } else {
43
        $action = get_str('action');
44
    }
45
} else {
46
    $action = post_str('action');
47
}
48
49
$userid = post_int('userid');
50
$user=BoincUser::lookup_id($userid);
51
52
if ($action!="start"){
53
    error_page("Unknown action");
54
}
55
56
// TODO: create a function for this in forum_banishment_vote.inc to make it more flexible
57
switch (post_int("category", true)) {
58
    case 1:
59
        $mod_category = tra("Obscene");
60
    case 2:
61
        $mod_category = tra("Flame/Hate mail");
62
    case 3:
63
        $mod_category = tra("User Request");
64
    default:
0 ignored issues
show
DEFAULT case must have a breaking statement
Loading history...
65
        $mod_category = tra("Other");
66
}
67
68
if (post_str('reason', true)){
69
    start_vote($config,$logged_in_user,$user, $mod_category,post_str("reason"));
70
} else {
71
    start_vote($config,$logged_in_user,$user, $mod_category,"None given");
72
}
73
74
$cvs_version_tracker[]="\$Id: forum_moderate_post_action.php 13718 2007-09-30 11:17:11Z Rytis $";  //Generated automatically - do not edit
75
?>
76