| 1 |
<?php |
|---|
| 2 |
require('system-config.php'); |
|---|
| 3 |
|
|---|
| 4 |
$site_title = get_settings('site_title'); |
|---|
| 5 |
|
|---|
| 6 |
if ( isset($_POST['action']) ) { |
|---|
| 7 |
check_admin_referer(); |
|---|
| 8 |
|
|---|
| 9 |
if(!('0'==$_POST['action'] || '1' == $_POST['action'] || 'delete' == $_POST['action'])) |
|---|
| 10 |
die; |
|---|
| 11 |
|
|---|
| 12 |
validateToken($_POST['token'], 'user-management.php', $_POST['action']); |
|---|
| 13 |
|
|---|
| 14 |
$whichuser = $_POST['whichuser']; |
|---|
| 15 |
$action = $_POST['action']; |
|---|
| 16 |
|
|---|
| 17 |
if ('delete' == $_POST['action']) { |
|---|
| 18 |
if ($wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_locked='1' AND user_login='$whichuser'")) { |
|---|
| 19 |
delete_user(mysql_real_escape_string($whichuser)); |
|---|
| 20 |
} |
|---|
| 21 |
|
|---|
| 22 |
} else { |
|---|
| 23 |
$wpdb->query("UPDATE `$wpdb->users` SET `user_locked`='$action' WHERE `user_login`='".mysql_real_escape_string($whichuser)."'"); |
|---|
| 24 |
} |
|---|
| 25 |
} |
|---|
| 26 |
|
|---|
| 27 |
$lockedaccounts = $wpdb->get_col("SELECT `user_login` FROM `$wpdb->users` WHERE `user_locked` = '1'"); |
|---|
| 28 |
arrayify($lockedaccounts); |
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
?> |
|---|
| 32 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
|---|
| 33 |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|---|
| 34 |
|
|---|
| 35 |
<head> |
|---|
| 36 |
<title><?php echo $site_title ?>: Lyceum System Settings: Manage Users</title> |
|---|
| 37 |
|
|---|
| 38 |
<link rel="stylesheet" href="<?php echo LURL ?>/wp-admin/wp-admin.css" type="text/css" /> |
|---|
| 39 |
<link rel="stylesheet" href="<?php echo LURL ?>/system-admin/lyceum.css" type="text/css" /> |
|---|
| 40 |
|
|---|
| 41 |
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" /> |
|---|
| 42 |
</head> |
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 |
<div id="PageWrapper" class="AdminUsers"> |
|---|
| 46 |
|
|---|
| 47 |
<?php require(ABSPATH . '/system-admin/lyceum-header.php'); ?> |
|---|
| 48 |
|
|---|
| 49 |
<hr /> |
|---|
| 50 |
|
|---|
| 51 |
<!-- BEGIN: body --> |
|---|
| 52 |
<div id="BodyWrapper"> |
|---|
| 53 |
|
|---|
| 54 |
<!-- BEGIN: main column --> |
|---|
| 55 |
<div id="MainColumn"> |
|---|
| 56 |
|
|---|
| 57 |
<!-- BEGIN: main nav --> |
|---|
| 58 |
<ul id="MainNav"> |
|---|
| 59 |
<li><span><a href="settings.php">System Settings</a></span></li> |
|---|
| 60 |
<li><span><a href="blog-management.php">Blogs</a></span></li> |
|---|
| 61 |
<li class="Selected"><span><a href="user-management.php">Users</a></span></li> |
|---|
| 62 |
<li><span><a href="systemplugins.php">Plugins</a></span></li> |
|---|
| 63 |
<li><span><a href="rewriterules.php">Apache Rewrite Rules</a></span></li> |
|---|
| 64 |
</ul> |
|---|
| 65 |
<div class="ClearFix TabBorder"><!-- do not remove --></div> |
|---|
| 66 |
<!-- END: main nav --> |
|---|
| 67 |
|
|---|
| 68 |
<div class="wrap"> |
|---|
| 69 |
|
|---|
| 70 |
<!-- BEGIN: batch creation form --> |
|---|
| 71 |
<form name="batch_user_creation_form" id="batch_user_creation_form" action="createusers.php" method="post" enctype="multipart/form-data"> |
|---|
| 72 |
<h2>Batch-create Users</h2> |
|---|
| 73 |
|
|---|
| 74 |
<p>Import a plain file of this format:</p> |
|---|
| 75 |
<blockquote> |
|---|
| 76 |
<code>username1,email1@example.com;username2,email2@example.com</code> |
|---|
| 77 |
</blockquote> |
|---|
| 78 |
|
|---|
| 79 |
<strong>NOTE: Lyceum does not go out of its way to check for a properly formated file, so please construct your file carefully.</strong> |
|---|
| 80 |
|
|---|
| 81 |
<fieldset> |
|---|
| 82 |
<legend>Batch User Creation</legend> |
|---|
| 83 |
|
|---|
| 84 |
<div class="Field"> |
|---|
| 85 |
<label for="newuserlist">Data File:</label> |
|---|
| 86 |
<input type="file" name="newuserlist" id="newuserlist" /> |
|---|
| 87 |
</div> |
|---|
| 88 |
|
|---|
| 89 |
<ul class="Inputs"> |
|---|
| 90 |
<li><input type="checkbox" name="create_blog" id="create_blog" value="yes" checked="checked" /> <label for="create_blog">Create blog for each new user?</label></li> |
|---|
| 91 |
</ul> |
|---|
| 92 |
|
|---|
| 93 |
<?php echo tokeninput('createusers.php')?> |
|---|
| 94 |
|
|---|
| 95 |
<div class="FormAction"> |
|---|
| 96 |
<input type="submit" value="Upload File" /> |
|---|
| 97 |
</div> |
|---|
| 98 |
|
|---|
| 99 |
</fieldset> |
|---|
| 100 |
</form> |
|---|
| 101 |
<!-- END: batch creation form --> |
|---|
| 102 |
|
|---|
| 103 |
</div> |
|---|
| 104 |
|
|---|
| 105 |
<div class="wrap"> |
|---|
| 106 |
|
|---|
| 107 |
<!-- BEGIN: change password --> |
|---|
| 108 |
<form name="change_user_password_form" id="change_user_password_form" action="changeuserdata.php" method="post"> |
|---|
| 109 |
<h2>Change a User's Password</h2> |
|---|
| 110 |
|
|---|
| 111 |
<fieldset> |
|---|
| 112 |
<legend>Change User Password</legend> |
|---|
| 113 |
|
|---|
| 114 |
<table class="FormTable" summary=""> |
|---|
| 115 |
<col width="40%" /> |
|---|
| 116 |
<col width="60%" /> |
|---|
| 117 |
|
|---|
| 118 |
<tbody> |
|---|
| 119 |
<tr> |
|---|
| 120 |
<th scope="row"><label for="user_login_password">Username:</label></th> |
|---|
| 121 |
<td><input type="text" name="user_login" id="user_login_password" class="TextInput" /></td> |
|---|
| 122 |
</tr> |
|---|
| 123 |
|
|---|
| 124 |
<tr> |
|---|
| 125 |
<th scope="row"><label for="data_value_password">New Password:</label></th> |
|---|
| 126 |
<td><input type="text" name="data_value" id="data_value_password" class="TextInput" /></td> |
|---|
| 127 |
</tr> |
|---|
| 128 |
</tbody> |
|---|
| 129 |
</table> |
|---|
| 130 |
|
|---|
| 131 |
<?php echo tokeninput('changeuserdata.php')?> |
|---|
| 132 |
|
|---|
| 133 |
<input type="hidden" value="user_pass" name="data_name" /> |
|---|
| 134 |
|
|---|
| 135 |
<div class="FormAction"> |
|---|
| 136 |
<input type="submit" name="submit" value="Change Password" /> |
|---|
| 137 |
</div> |
|---|
| 138 |
</fieldset> |
|---|
| 139 |
</form> |
|---|
| 140 |
<!-- END: change password --> |
|---|
| 141 |
|
|---|
| 142 |
</div> |
|---|
| 143 |
|
|---|
| 144 |
<div class="wrap"> |
|---|
| 145 |
|
|---|
| 146 |
<!-- BEGIN: change email --> |
|---|
| 147 |
<form name="change_user_email_form" id="change_user_email_form" action="changeuserdata.php" method="post"> |
|---|
| 148 |
<h2>Change a User's Email Address</h2> |
|---|
| 149 |
|
|---|
| 150 |
<fieldset> |
|---|
| 151 |
<legend>Change User Email</legend> |
|---|
| 152 |
|
|---|
| 153 |
<table class="FormTable" summary=""> |
|---|
| 154 |
<col width="40%" /> |
|---|
| 155 |
<col width="60%" /> |
|---|
| 156 |
|
|---|
| 157 |
<tbody> |
|---|
| 158 |
<tr> |
|---|
| 159 |
<th scope="row"><label for="user_login_email">Username:</label></th> |
|---|
| 160 |
<td><input type="text" name="user_login" id="user_login_email" class="TextInput" /></td> |
|---|
| 161 |
</tr> |
|---|
| 162 |
|
|---|
| 163 |
<tr> |
|---|
| 164 |
<th scope="row"><label for="data_value_email">New Email Address:</label></th> |
|---|
| 165 |
<td><input type="text" name="data_value" id="data_value_email" class="TextInput" /></td> |
|---|
| 166 |
</tr> |
|---|
| 167 |
</tbody> |
|---|
| 168 |
</table> |
|---|
| 169 |
|
|---|
| 170 |
<?php echo tokeninput('changeuserdata.php')?> |
|---|
| 171 |
|
|---|
| 172 |
<input type="hidden" value="user_email" name="data_name" /> |
|---|
| 173 |
|
|---|
| 174 |
<div class="FormAction"> |
|---|
| 175 |
<input type="submit" name="submit" value="Change Email Address" /> |
|---|
| 176 |
</div> |
|---|
| 177 |
</fieldset> |
|---|
| 178 |
</form> |
|---|
| 179 |
<!-- END: change email --> |
|---|
| 180 |
|
|---|
| 181 |
</div> |
|---|
| 182 |
|
|---|
| 183 |
<div class="wrap"> |
|---|
| 184 |
|
|---|
| 185 |
<!-- BEGIN: restrict registration form --> |
|---|
| 186 |
<form name="restrict_registration_form" id="restrict_registration_form" action="registrationlist.php" method="post" enctype="multipart/form-data"> |
|---|
| 187 |
<h2>Restrict Registration</h2> |
|---|
| 188 |
<p>Restrict registration to a fixed list of email addresses.</p> |
|---|
| 189 |
|
|---|
| 190 |
<p>Import a plain text file of this format:</p> |
|---|
| 191 |
<blockquote> |
|---|
| 192 |
<code>email1@example.com,email2@example.com</code> |
|---|
| 193 |
</blockquote> |
|---|
| 194 |
|
|---|
| 195 |
<strong>NOTE: uploading a file will replace the existing list.</strong> |
|---|
| 196 |
|
|---|
| 197 |
<fieldset> |
|---|
| 198 |
<legend>Registration Restriction List</legend> |
|---|
| 199 |
|
|---|
| 200 |
<div class="Field"> |
|---|
| 201 |
<label for="emaillist">Data File:</label> |
|---|
| 202 |
<input type="file" name="emaillist" id="emaillist" /> |
|---|
| 203 |
</div> |
|---|
| 204 |
|
|---|
| 205 |
<?php echo tokeninput('registrationlist.php')?> |
|---|
| 206 |
|
|---|
| 207 |
<div class="FormAction"> |
|---|
| 208 |
<input type="submit" value="Upload File" /> |
|---|
| 209 |
</div> |
|---|
| 210 |
|
|---|
| 211 |
</fieldset> |
|---|
| 212 |
|
|---|
| 213 |
<ul> |
|---|
| 214 |
<li><a href="viewregistrationlist.php?token=<?php echo formtoken('viewregistrationlist.php')?>" target='_blank'>View existing list of allowed email addresses »</a></li> |
|---|
| 215 |
</ul> |
|---|
| 216 |
|
|---|
| 217 |
</form> |
|---|
| 218 |
<!-- END: restrict registration form --> |
|---|
| 219 |
|
|---|
| 220 |
</div> |
|---|
| 221 |
|
|---|
| 222 |
<div class="wrap"> |
|---|
| 223 |
|
|---|
| 224 |
<!-- BEGIN: lock user --> |
|---|
| 225 |
<form name="lock_user_form" id="lock_user_form" action="user-management.php" method="post"> |
|---|
| 226 |
<h2>Lock an Account</h2> |
|---|
| 227 |
|
|---|
| 228 |
<fieldset> |
|---|
| 229 |
<legend>Lock Account</legend> |
|---|
| 230 |
|
|---|
| 231 |
<div class="Field"> |
|---|
| 232 |
<label for="whichuser_lock">Username to lock:</label> |
|---|
| 233 |
<input type="text" name="whichuser" id="whichuser_lock" class="TextInput" /> |
|---|
| 234 |
</div> |
|---|
| 235 |
|
|---|
| 236 |
<?php echo tokeninput('user-management.php', '1')?> |
|---|
| 237 |
|
|---|
| 238 |
<input type="hidden" value="1" name="action" /> |
|---|
| 239 |
|
|---|
| 240 |
<div class="FormAction"> |
|---|
| 241 |
<input type="submit" name="submit" value="Lock User" /> |
|---|
| 242 |
</div> |
|---|
| 243 |
</fieldset> |
|---|
| 244 |
</form> |
|---|
| 245 |
<!-- END: lock user --> |
|---|
| 246 |
|
|---|
| 247 |
</div> |
|---|
| 248 |
|
|---|
| 249 |
<div class="wrap"> |
|---|
| 250 |
|
|---|
| 251 |
<!-- BEGIN: unlock user --> |
|---|
| 252 |
<form name="unlock_user_form" id="unlock_user_form" action="user-management.php" method="post"> |
|---|
| 253 |
<h2>Unlock an Account</h2> |
|---|
| 254 |
|
|---|
| 255 |
<fieldset> |
|---|
| 256 |
<legend>Unlock Account</legend> |
|---|
| 257 |
|
|---|
| 258 |
<div class="Field"> |
|---|
| 259 |
<label for="whichuser_unlock">Username to unlock:</label> |
|---|
| 260 |
<input type="text" name="whichuser" id="whichuser_unlock" class="TextInput" /> |
|---|
| 261 |
</div> |
|---|
| 262 |
|
|---|
| 263 |
<?php echo tokeninput('user-management.php', '0')?> |
|---|
| 264 |
|
|---|
| 265 |
<input type="hidden" value="0" name="action" /> |
|---|
| 266 |
|
|---|
| 267 |
<div class="FormAction"> |
|---|
| 268 |
<input type="submit" name="submit" value="Unlock User" /> |
|---|
| 269 |
</div> |
|---|
| 270 |
</fieldset> |
|---|
| 271 |
</form> |
|---|
| 272 |
<!-- END: unlock user --> |
|---|
| 273 |
|
|---|
| 274 |
</div> |
|---|
| 275 |
|
|---|
| 276 |
<div class="wrap"> |
|---|
| 277 |
|
|---|
| 278 |
<!-- BEGIN: delete user --> |
|---|
| 279 |
<form name="delete_user_form" id="delete_user_form" action="user-management.php" method="post"> |
|---|
| 280 |
<h2>Delete a User from the System</h2> |
|---|
| 281 |
<p>Completely delete a user and all the comments, posts, and usermeta information for that user. Before deletion, user must be in Locked Accounts list below.</p> |
|---|
| 282 |
|
|---|
| 283 |
<fieldset> |
|---|
| 284 |
<legend>User Deletion</legend> |
|---|
| 285 |
|
|---|
| 286 |
<div class="Field"> |
|---|
| 287 |
<label for="whichuser_delete">Username to delete:</label> |
|---|
| 288 |
<input type="text" name="whichuser" id="whichuser_delete" class="TextInput" /> |
|---|
| 289 |
</div> |
|---|
| 290 |
|
|---|
| 291 |
<?php echo tokeninput('user-management.php', 'delete')?> |
|---|
| 292 |
|
|---|
| 293 |
<input type="hidden" value="delete" name="action" /> |
|---|
| 294 |
|
|---|
| 295 |
<div class="FormAction"> |
|---|
| 296 |
<input type="submit" name="submit" value="Delete User" /> |
|---|
| 297 |
</div> |
|---|
| 298 |
</fieldset> |
|---|
| 299 |
</form> |
|---|
| 300 |
<!-- END: delete user --> |
|---|
| 301 |
|
|---|
| 302 |
</div> |
|---|
| 303 |
|
|---|
| 304 |
<div class="wrap"> |
|---|
| 305 |
|
|---|
| 306 |
<!-- BEGIN: locked accounts --> |
|---|
| 307 |
<h2>Locked Accounts</h2> |
|---|
| 308 |
<?php |
|---|
| 309 |
if (count($lockedaccounts) > 0) { |
|---|
| 310 |
?> |
|---|
| 311 |
<ul> |
|---|
| 312 |
<?php |
|---|
| 313 |
foreach($lockedaccounts as $account) { |
|---|
| 314 |
?> |
|---|
| 315 |
<li><?php echo $account ?></li> |
|---|
| 316 |
<?php |
|---|
| 317 |
} |
|---|
| 318 |
?> |
|---|
| 319 |
</ul> |
|---|
| 320 |
<?php |
|---|
| 321 |
} else { |
|---|
| 322 |
?> |
|---|
| 323 |
<p><em>There are no locked accounts in this system at the moment.</em></p> |
|---|
| 324 |
<?php |
|---|
| 325 |
} |
|---|
| 326 |
?> |
|---|
| 327 |
<!-- END: locked accounts --> |
|---|
| 328 |
|
|---|
| 329 |
</div> |
|---|
| 330 |
|
|---|
| 331 |
</div> |
|---|
| 332 |
<!-- END: main column --> |
|---|
| 333 |
|
|---|
| 334 |
</div> |
|---|
| 335 |
<!-- END: body --> |
|---|
| 336 |
|
|---|
| 337 |
<hr /> |
|---|
| 338 |
|
|---|
| 339 |
<?php include(ABSPATH . 'wp-admin/admin-footer.php'); ?> |
|---|
| 340 |
|
|---|
| 341 |
</div> |
|---|
| 342 |
|
|---|
| 343 |
|
|---|
| 344 |
</body> |
|---|
| 345 |
|
|---|
| 346 |
</html> |
|---|
| 347 |
|
|---|