1<?php
2// This file is part of BOINC.
3// http://boinc.berkeley.edu
4// Copyright (C) 2008 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
19require_once('../inc/forum.inc');
20require_once('../inc/util_ops.inc');
21
22db_init();
23
24admin_page_head('Manage user privileges');
25
26start_table("align=\"center\"");
27row1("Current special users", '9');
28
29echo "<tr><td>User</td>";
30for ($i=0; $i<S_NFLAGS; $i++) {
31    echo "<td width=\"15\">" . $special_user_bitfield[$i] . "</td>\n";
32}
33echo "</tr>";
34
35$result = _mysql_query(
36    "SELECT prefs.userid, prefs.special_user, user.id, user.name
37    FROM forum_preferences as prefs, user
38    WHERE CONVERT(special_user, DECIMAL) > 0 and prefs.userid=user.id"
39);
40for ($i=1; $i<=_mysql_num_rows($result); $i++){
41	$foo = _mysql_fetch_object($result);
42    echo "<form action=\"manage_special_users_action.php\" method=\"POST\">\n";
43    echo "<input type=\"hidden\" name=\"userid\" value=\"$foo->userid\"
44        <tr><td>$foo->name ($foo->id)</td>
45    ";
46    for ($j=0; $j<S_NFLAGS; $j++) {
47        $bit = substr($foo->special_user, $j, 1);
48        echo "<td><input type=\"checkbox\" name=\"role".$j."\" value=\"1\"";
49        if ($bit == 1) {
50            echo " checked=\"checked\"";
51        }
52        echo "></td>\n";
53    }
54    echo "<td><input class=\"btn btn-default\" type=\"submit\" value=\"Update\"></form></td>";
55    echo "</tr>\n";
56}
57
58echo "<tr><form action=\"manage_special_users_action.php\" method=\"POST\">\n";
59echo "<td>Add UserID:<input type=\"text\" name=\"userid\" size=\"6\"></td>";
60
61for ($j=0; $j<S_NFLAGS; $j++) {
62    echo "<td><input type=\"checkbox\" name=\"role".$j."\" value=\"1\"";
63    echo "></td>\n";
64}
65echo "<td><input class=\"btn btn-default\" type=\"submit\" value=\"Update\"></form></td>";
66echo "</tr>\n";
67
68end_table();
69
70admin_page_tail();
71
72$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
73?>
74