-
Notifications
You must be signed in to change notification settings - Fork 0
/
rights.php
183 lines (169 loc) · 5.66 KB
/
rights.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
<?PHP
/***************************************************************************
* $Source: /cvsroot/pmtool/pmtool/rights.php,v $
* $Revision: 1.5 $
* $Date: 2003/11/18 02:00:00 $
* $Author: willuhn $
* $Locker: $
* $State: Exp $
*
* Copyright (c) by willuhn.webdesign
* All rights reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
***************************************************************************/
?>
<?PHP
#######################################################################
## check login again
if (!$loginInst->id) {
echo $lang['common_accessDenied']."\n";
exit;
}
?>
<h1><?PHP echo $lang['common_rights'];?></h1>
<?PHP
$accessInst = new access();
#######################################################################
## perform action
if (tool::securePost('id')) {
$accessInst->activate(tool::securePost('id'));
if (!DEMO_MODE) {
if (is_array(tool::securePost('remove'))) $accessInst->removeRights(tool::securePost('remove'));
if (is_array(tool::securePost('add'))) $accessInst->addRights(tool::securePost('add'));
}
else {
$toolInst->errorStatus("not allowed in this demo. Sorry ;)");
}
}
#######################################################################
## make edit / new form
if (tool::securePost('action') == "edit") { ?>
<h2><?PHP echo $lang['common_editRecord'];?></h2>
<form method="post">
<input type="hidden" name="action" value="edit">
<input type="hidden" name="id" value="<?PHP echo tool::securePost('id');?>">
<table border="0" cellpadding="2" cellspacing="0">
<tr>
<td><b><?PHP echo $lang['right_available'];?></b></td>
<td> </td>
<td><b><?PHP echo $lang['right_included'];?></b></td>
</tr>
<tr>
<td>
<select name="add[]" size="16" multiple>
<?PHP
$list = $accessInst->getNotRights();
while ($element = current($list)) {
echo "<option value=\"".$element."\">".$accessInst->getRightName($element)."\n";
next($list);
}
?>
</select>
</td>
<td align="center">
<input type="submit" value="< <?PHP echo $lang['common_switch'];?> >">
</td>
<td>
<select name="remove[]" size="16" multiple>
<?PHP
$list = $accessInst->getRights();
while ($element = current($list)) {
echo "<option value=\"".$element."\">".$accessInst->getRightName($element)."\n";
next($list);
}
?>
</select>
</td>
</tr>
</table>
</form>
<?PHP
}
#######################################################################
## list existing records
?>
<br><br>
<h2><?PHP echo $lang['right_existing'];?></h2>
<form method="post" name="form1">
<input type=hidden name="id">
<input type=hidden name="action">
<table border="0" cellpadding="2" cellspacing="1" width="99%" bgcolor="#ffffff">
<tr>
<th width="40%"><?PHP echo $lang['group_name'];?></th>
<th width="50%"><?PHP echo $lang['right_included'];?></th>
<th><?PHP echo $lang['common_action'];?></th>
</tr>
<?PHP
$list = $accessInst->getList();
$style = "light";
while ($element = current($list)) {
$accessInst->activate($element);
?><tr class="<?PHP echo $style;?>" onmouseover="this.style.backgroundColor='#fafafa'" onmouseout="this.style.backgroundColor=''"><?PHP
echo "<td>".$accessInst->name."</td>\n";
echo "<td><table border=0 cellpadding=0 cellspacing=0>";
$rightList = $accessInst->getRights();
while ($right = current($rightList)) {
echo "<tr>\n";
echo "<td>".$accessInst->getRightName($right)." </td>";
next($rightList);
$right = current($rightList);
echo "<td>".$accessInst->getRightName($right)."</td>";
next($rightList);
echo "</tr>\n";
}
echo "</table>\n";
echo "</td>\n";
echo "<td align=center><input type=submit value=".$lang['common_edit']." onclick=\"document.form1.id.value='".$element."';document.form1.action.value='edit'\"></td>\n";
echo "</tr>\n";
next($list);
if ($style == "light") $style = "dark";
else $style = "light";
}
?>
</table>
</form>
<?PHP
/***************************************************************************
* $Log: rights.php,v $
* Revision 1.5 2003/11/18 02:00:00 willuhn
* *** empty log message ***
*
* Revision 1.4 2003/10/09 18:28:10 willuhn
* @B bug fixed in encodeString and rights page (array were not handled correctly via POST)
*
* Revision 1.3 2003/09/27 19:15:50 willuhn
* @B fix on logon page (empty passwords enabled again)
* @N added DEMO_MODE
*
* Revision 1.2 2003/09/27 18:23:45 willuhn
* *** empty log message ***
*
* Revision 1.1.1.1 2003/07/28 19:22:21 willuhn
* reimport
*
* Revision 1.6 2002/04/13 20:46:35 willuhn
* @N added some more multilanguage stuff
*
* Revision 1.5 2002/03/31 17:17:52 willuhn
* @N added some more colors ;)
*
* Revision 1.4 2002/02/09 19:38:27 willuhn
* @N added CVS log
* @N added french language file
*
*
***************************************************************************/
?>