/
admin.listuser.tmpl.php
265 lines (229 loc) · 12 KB
/
admin.listuser.tmpl.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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
<?php
/**
* phpwcms content management system
*
* @author Oliver Georgi <og@phpwcms.org>
* @copyright Copyright (c) 2002-2020, Oliver Georgi
* @license http://opensource.org/licenses/GPL-2.0 GNU GPL-2
* @link http://www.phpwcms.org
*
**/
// ----------------------------------------------------------------
// obligate check for phpwcms constants
if (!defined('PHPWCMS_ROOT')) {
die("You Cannot Access This Script Directly, Have a Nice Day.");
}
// ----------------------------------------------------------------
// create paginating for users
if(isset($_GET['c'])) {
$_SESSION['list_user_count'] = (trim($_GET['c']) == 'all') ? '99999' : intval($_GET['c']);
}
if(isset($_GET['page'])) {
$_SESSION['list_user_page'] = intval($_GET['page']);
}
// set default values for paginating
if(empty($_SESSION['list_user_count'])) {
$_SESSION['list_user_count'] = 25;
}
$_userInfo = array();
// get filter and paginating form values
if(isset($_POST['do_pagination'])) {
$_SESSION['list_admin'] = empty($_POST['showadmin']) ? 0 : 1;
$_SESSION['list_befe'] = empty($_POST['showbefe']) ? 0 : 1;
$_SESSION['list_norm'] = empty($_POST['shownorm']) ? 0 : 1;
$_SESSION['list_fe'] = empty($_POST['showfe']) ? 0 : 1;
$_SESSION['list_user_page'] = intval($_POST['page']);
$_SESSION['filter_results'] = clean_slweg($_POST['filter']);
if(empty($_SESSION['filter_results'])) {
unset($_SESSION['filter_results']);
} else {
$_SESSION['filter_results'] = convertStringToArray($_SESSION['filter_results'], ' ');
}
}
if(empty($_SESSION['list_user_page'])) {
$_SESSION['list_user_page'] = 1;
}
$_userInfo['list_admin'] = isset($_SESSION['list_admin']) ? $_SESSION['list_admin'] : 0;
$_userInfo['list_befe'] = isset($_SESSION['list_befe']) ? $_SESSION['list_befe'] : 0;
$_userInfo['list_norm'] = isset($_SESSION['list_norm']) ? $_SESSION['list_norm'] : 0;
$_userInfo['list_fe'] = isset($_SESSION['list_fe']) ? $_SESSION['list_fe'] : 0;
$_userInfo['list'] = array();
// if admin user should be listed
$_userInfo['where_query'] = ' WHERE usr_aktiv != 9';
if($_userInfo['list_admin']) {
$_userInfo['where_query'] .= ' AND usr_admin=1';
}
if($_userInfo['list_befe']) {
$_userInfo['list'][] = ' usr_fe=2 ';
}
if($_userInfo['list_norm']) {
$_userInfo['list'][] = ' usr_fe=1 ';
}
if($_userInfo['list_fe']) {
$_userInfo['list'][] = ' usr_fe=0 ';
}
$_userInfo['list'] = trim(implode('OR', $_userInfo['list']));
if($_userInfo['list']) {
$_userInfo['where_query'] .= ' AND ('.$_userInfo['list'].')';
}
if(isset($_SESSION['filter_results']) && count($_SESSION['filter_results'])) {
$_userInfo['filter_array'] = array();
foreach($_SESSION['filter_results'] as $_userInfo['filter']) {
//usr_name, usr_login, usr_email
$_userInfo['filter_array'][] = "CONCAT(usr_name, usr_login, usr_email) LIKE '%".aporeplace($_userInfo['filter'])."%'";
}
if(count($_userInfo['filter_array'])) {
$_userInfo['where_query'] .= ' AND ('.implode('OR', $_userInfo['filter_array']).')';
}
}
// paginating values
$_userInfo['count_total'] = _dbQuery("SELECT COUNT(*) FROM ".DB_PREPEND."phpwcms_user ".$_userInfo['where_query'], 'COUNT');
$_userInfo['pages_total'] = ceil($_userInfo['count_total'] / $_SESSION['list_user_count']);
if($_SESSION['list_user_page'] > $_userInfo['pages_total']) {
$_SESSION['list_user_page'] = empty($_userInfo['pages_total']) ? 1 : $_userInfo['pages_total'];
}
?><table width="538" border="0" cellpadding="0" cellspacing="0" summary="">
<tr><td colspan="3" class="title"><?php echo $BL['be_admin_usr_ltitle'] ?></td></tr>
<tr><td colspan="3"><img src="img/leer.gif" alt="" width="1" height="5"></td></tr>
<tr><td colspan="3"><form action="phpwcms.php?do=admin" method="post" name="paginate" id="paginate"><input type="hidden" name="do_pagination" value="1" />
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="paginate" summary="">
<tr>
<td><table border="0" cellpadding="0" cellspacing="0" summary="">
<tr>
<td><input type="checkbox" name="showadmin" id="showadmin" value="1" onclick="this.form.submit();"<?php is_checked(1, $_userInfo['list_admin'], 1) ?> /></td>
<td><label for="showadmin"><img src="img/usricon/usr_admin.gif" alt="" /></label></td>
<td><input type="checkbox" name="showbefe" id="showbefe" value="1" onclick="this.form.submit();"<?php is_checked(1, $_userInfo['list_befe'], 1) ?> /></td>
<td><label for="showbefe"><img src="img/usricon/usr_befe.gif" alt="" /></label></td>
<td><input type="checkbox" name="shownorm" id="shownorm" value="1" onclick="this.form.submit();"<?php is_checked(1, $_userInfo['list_norm'], 1) ?> /></td>
<td><label for="shownorm"><img src="img/usricon/usr_norm.gif" alt="" /></label></td>
<td><input type="checkbox" name="showfe" id="showfe" value="1" onclick="this.form.submit();"<?php is_checked(1, $_userInfo['list_fe'], 1) ?> /></td>
<td><label for="showfe"><img src="img/usricon/usr_16.gif" alt="" /></label></td>
<?php
if($_userInfo['pages_total'] > 1) {
echo '<td class="chatlist">| </td>';
echo '<td>';
if($_SESSION['list_user_page'] > 1) {
echo '<a href="phpwcms.php?do=admin&page='.($_SESSION['list_user_page']-1).'">';
echo '<img src="img/famfamfam/action_back.gif" alt="" border="0" /></a>';
} else {
echo '<img src="img/famfamfam/action_back.gif" alt="" border="0" class="inactive" />';
}
echo '</td>';
echo '<td><input type="text" name="page" id="page" maxlength="4" size="4" value="'.$_SESSION['list_user_page'];
echo '" class="textinput" style="margin:0 3px 0 5px;width:30px;font-weight:bold;" /></td>';
echo '<td class="chatlist">/'.$_userInfo['pages_total'].' </td>';
echo '<td>';
if($_SESSION['list_user_page'] < $_userInfo['pages_total']) {
echo '<a href="phpwcms.php?do=admin&page='.($_SESSION['list_user_page']+1).'">';
echo '<img src="img/famfamfam/action_forward.gif" alt="" border="0" /></a>';
} else {
echo '<img src="img/famfamfam/action_forward.gif" alt="" border="0" class="inactive" />';
}
echo '</td><td class="chatlist"> | </td>';
} else {
echo '<td class="chatlist">| <input type="hidden" name="page" id="page" value="1" /></td>';
}
?>
<td><input type="search" name="filter" id="filter" size="10" value="<?php
if(isset($_SESSION['filter_results']) && count($_SESSION['filter_results']) ) {
echo html(implode(' ', $_SESSION['filter_results']));
}
?>" class="textinput" style="margin:0 2px 0 0;width:110px;text-align:left;" title="filter results by username, name or email" /></td>
<td><input type="image" name="gofilter" src="img/famfamfam/action_go.gif" alt="" /></td>
</table></td>
<td class="chatlist" align="right">
<a href="phpwcms.php?do=admin&c=10">10</a>
<a href="phpwcms.php?do=admin&c=25">25</a>
<a href="phpwcms.php?do=admin&c=50">50</a>
<a href="phpwcms.php?do=admin&c=100">100</a>
<a href="phpwcms.php?do=admin&c=250">250</a>
<a href="phpwcms.php?do=admin&c=all"><?php echo $BL['be_ftptakeover_all'] ?></a>
</td>
</tr>
</table>
</form></td></tr>
<tr><td colspan="3"><img src="img/leer.gif" alt="" width="1" height="3"></td></tr>
<tr><td colspan="3" bgcolor="#92A1AF"><img src="img/leer.gif" alt="" width="1" height="1"></td></tr>
<?php
$bg_color1 = "#FFFFFF";
$bg_color2 = "#F3F5F8";
$zaehler = 0;
if(!isset($new_user_id)) {
$new_user_id = 0;
}
// Generate list of all users
$sql = "SELECT * FROM ".DB_PREPEND."phpwcms_user ".$_userInfo['where_query'].' ';
$sql .= "ORDER BY usr_aktiv DESC, usr_fe DESC, usr_admin DESC, usr_name ASC ";
$sql .= "LIMIT ".(($_SESSION['list_user_page']-1) * $_SESSION['list_user_count']).','.$_SESSION['list_user_count'];
$result = _dbQuery($sql);
if(isset($result[0]['usr_id'])) {
foreach($result as $userlist) {
$bg_color = ($zaehler % 2) ? $bg_color2 : $bg_color1;
if($userlist["usr_id"] == $new_user_id) {
$bg_color = "#FFCC00";
}
$goto = "phpwcms.php?do=admin&s=2&u=".$userlist["usr_id"];
?>
<tr><td colspan="3"><img src="img/leer.gif" alt="" width="1" height="1"></td></tr>
<tr bgcolor="<?php echo $bg_color ?>" onmouseover="bgColor='#DBFF48'" onmouseout="bgColor='<?php echo $bg_color ?>'">
<td width="19" align="center"><img src="img/usricon/usr_<?php
if($userlist["usr_aktiv"] == 1) {
if(!$userlist["usr_admin"]) {
switch($userlist["usr_fe"]) {
case 0: echo '16'; break;
case 1: echo 'norm'; break;
case 2: echo 'befe'; break;
}
} else {
echo "admin";
}
} else {
echo "inaktiv";
}
?>.gif" alt="" width="19" height="16" border="0"></td>
<td width="458" <?php if($userlist["usr_aktiv"]==1) {echo "class=\"dir\"";} else {echo "class=\"inaktiv\"";} ?>><a href="<?php echo $goto ?>"><?php
if($userlist["usr_name"]) {
$userlist["usr_name"] = html($userlist["usr_name"]." (".$userlist["usr_login"].")");
} else {
$userlist["usr_name"] = html($userlist["usr_login"]);
}
echo $userlist["usr_name"];
?></a></td>
<td width="61" align="right"><a href="include/inc_act/act_user.php?aktiv=<?php
echo $userlist["usr_id"].":";
if($userlist["usr_aktiv"]) {
echo "0";
} else {
echo "1";
}
?>"><img src="img/button/<?php
if(!$userlist["usr_aktiv"]) echo "in";
?>aktiv_mini.gif" alt="" width="14" height="15" border="0"></a><a href="<?php echo $goto ?>"><img src="img/button/edit.gif" alt="" width="24" height="15" border="0" title="<?php echo $BL['be_admin_usr_editusr'].": ".html($userlist["usr_login"]) ?>"></a><a href="include/inc_act/act_user.php?del=<?php
echo urlencode($userlist["usr_id"].":".$userlist["usr_email"]);
?>" onclick="return confirm('Delete user <?php echo js_singlequote($userlist["usr_name"]) ?>');"><img src="img/button/del_message_final.gif" alt="" width="22" height="15" border="0" title="<?php echo $BL['be_admin_usr_ldel']." ".html($userlist["usr_login"]) ?>"></a></td>
</tr>
<?php
$zaehler++;
}
} //Ende Schleife Anzeige User
if($zaehler) {
echo '<tr><td colspan="3"><img src="img/leer.gif" alt="" width="1" height="1"></td></tr>';
echo '<tr><td colspan="3" bgcolor="#92A1AF"><img src="img/leer.gif" alt="" width="1" height="1"></td></tr>';
}
?>
<tr>
<td><img src="img/leer.gif" alt="" width="19" height="5"></td>
<td><img src="img/leer.gif" alt="" width="458" height="1"></td>
<td><img src="img/leer.gif" alt="" width="61" height="1"></td>
</tr>
<tr>
<td colspan="3"><table width="538" border="0" cellpadding="0" cellspacing="0" summary="">
<tr>
<td><form action="phpwcms.php?do=admin&s=1" method="post"><input type="submit" value="<?php echo $BL['be_admin_usr_create'] ?>" class="button" title="<?php echo $BL['be_admin_usr_create'] ?>"></form></td>
<td> </td>
<td align="right"><img src="img/symbols/userlegende1.gif" alt="" width="225" height="13"></td>
</tr>
</table></td>
</tr>
<tr><td colspan="3"><img src="img/leer.gif" alt="" width="1" height="7"></td></tr>
</table>