?> /** * 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. */ /** * Poseidon PHP Content Document * Author: Torben Jensen * Contact: Torben@GreyStork.com * * User listing and administration script for use as an * active PHP document in Poseidon content management system. * * February 23, 2004: V1.2.0 * + Added setting for number of users to display per page. * February 6, 2004: V1.1.3 * - Fixed a couple of security issues. * December 10, 2003: V1.1.2 * + Added option to turn off display of e-mail addresses. * October 10, 2003: V1.1.1 * + All UI text is now defined as variables for easy translation. * October 9, 2003: V1.1.0 * + Added code for automatic addition of menu item. * (Requires Poseidon 0.6 or better) * August 22, 2003: V1.0.0 Release * ! Admins will be able to set user levels and reset passwords, * while everyone else will only see the uneditable list. * ! Admins will see the actual user level figure in the listing, * while everyone else will see the ratings Admin, Writer or Reader. */ /** * Whether to show e-mail addresses in the list. * Set to false if you don't want them to show up. */ $ShowEmailAddr = true; /** * How many users to show per page. * Set to zero if you want to display all users. */ $UsersPerPage = 25; $UserListVersion = "1.2.0"; $MenuSection = "User Tools"; $MenuItemText = "Registered Users"; $MenuItemTooltip = "Cast in order of appearance"; $MenuErrorText = "Failed to create menu item"; $ListHeadings = array ( array ( "Mark", "center" ), array ( "Name", "center" ), array ( "EMail", "left" ), array ( "Time Zone", "left" ), array ( "Joined", "left" ), array ( "Comments", "center" ), array ( "Level", "center" ) ); $WhatToDoText = "What to do with marked users"; $ResetPasswordText = "Reset Password to"; $OrText = "OR"; $SetLevelText = "Set UserLevel to"; $ErrorHeading = "No Users Found In Database"; $ErrorText = "I can't find find any users! Either something terrible has happened that wiped humanity from the face of the earth or I can't find the database anywhere, although I sure looked for it. I'm very confused..."; $MustLogin = "You must log in to view this page."; $nl = chr(13) . chr(10); global $db; if (($userlist = $db->query("SELECT u.id, u.username, u.email, u.timezone, u.created, u.userlevel, COUNT(c.userid) AS numcomments FROM ".DBTABLEPREFIX."users AS u LEFT JOIN ".DBTABLEPREFIX."comments AS c ON u.id = c.userid GROUP BY u.id ORDER BY u.id ASC")) && count($result) > 0) { if ($userinfo->userlevel >= USERLEVEL_ADMIN) { if (isset($_POST['action']) && isset($_POST['userlist'])) { if ($_POST['action'] == $ResetPasswordText) { if ($db->query("UPDATE ".DBTABLEPREFIX."users SET pass='" . $_POST['setpassword'] . "' WHERE id IN (" . implode(",",$_POST['userlist']) . ")")) print "Password(s) updated!" . $nl; } elseif ($_POST['action'] == $SetLevelText) { if ($db->query("UPDATE ".DBTABLEPREFIX."users SET userlevel=" . $_POST['setlevel'] . " WHERE id IN (" . implode(",",$_POST['userlist']) . ")")) print "User level(s) updated!" . $nl; } } elseif (POSEIDON_VERSION >= "0.6" && count($db->query("SELECT name FROM ".DBTABLEPREFIX."plugins WHERE name='UserList'")) == 0) { $UserListCode = "\$poseidon->createMenuItem(\"" . $MenuSection . "\", \"" . $MenuItemText . "\", \"content.php?title=" . urlencode($item->title) . "\", \"" . $MenuItemTooltip . ".\", 10);" . $nl; if (!installPlugin ("UserList", $UserListVersion, "", $UserListCode, 1)) { print "
" . $MenuErrorText . ".
"; } } ?>