summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwjames5 <will@tekimaki.com>2008-02-14 18:49:49 +0000
committerwjames5 <will@tekimaki.com>2008-02-14 18:49:49 +0000
commite590eaebd052a5d4de62f613a0a10125b71235ca (patch)
tree357bbea9c54c7d68903464bd7e11f54f7c014203
parentd5eea31bf059cc29560fbba2347a6ae9693f3372 (diff)
downloadusers-e590eaebd052a5d4de62f613a0a10125b71235ca.tar.gz
users-e590eaebd052a5d4de62f613a0a10125b71235ca.tar.bz2
users-e590eaebd052a5d4de62f613a0a10125b71235ca.zip
add quick ban option for users - sets status_id to suspended
-rw-r--r--BitUser.php26
-rw-r--r--admin/index.php52
-rw-r--r--bit_setup_inc.php3
-rw-r--r--templates/users_list.tpl5
4 files changed, 71 insertions, 15 deletions
diff --git a/BitUser.php b/BitUser.php
index 97d44b4..95d2a30 100644
--- a/BitUser.php
+++ b/BitUser.php
@@ -1,6 +1,6 @@
<?php
/**
- * $Header: /cvsroot/bitweaver/_bit_users/BitUser.php,v 1.170 2008/02/13 00:56:46 spiderr Exp $
+ * $Header: /cvsroot/bitweaver/_bit_users/BitUser.php,v 1.171 2008/02/14 18:49:49 wjames5 Exp $
*
* Lib for user administration, groups and permissions
* This lib uses pear so the constructor requieres
@@ -12,7 +12,7 @@
* All Rights Reserved. See copyright.txt for details and a complete list of authors.
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details
*
- * $Id: BitUser.php,v 1.170 2008/02/13 00:56:46 spiderr Exp $
+ * $Id: BitUser.php,v 1.171 2008/02/14 18:49:49 wjames5 Exp $
* @package users
*/
@@ -40,7 +40,7 @@ define("ACCOUNT_DISABLED", -6);
* Class that holds all information for a given user
*
* @author spider <spider@steelsun.com>
- * @version $Revision: 1.170 $
+ * @version $Revision: 1.171 $
* @package users
* @subpackage BitUser
*/
@@ -910,6 +910,24 @@ class BitUser extends LibertyAttachable {
}
}
+ // sets the user account status to -201 suspended
+ function ban(){
+ global $gBitSystem;
+ if( $this->mUserId == ANONYMOUS_USER_ID || $this->mUserId == ROOT_USER_ID || $this->isAdmin()) {
+ $gBitSystem->fatalError( tra( 'You can not ban user'." ".$this->mInfo['login'] ) );
+ }else{
+ $this->storeStatus( -201 );
+ return TRUE;
+ }
+ }
+
+ // unban the user
+ function unban(){
+ global $gBitSystem;
+ $this->storeStatus( 50 );
+ return TRUE;
+ }
+
function genPass( $pLength=NULL ) {
global $gBitSystem;
// AWC: enable mixed case and digits, don't return too short password
@@ -1906,7 +1924,7 @@ class BitUser extends LibertyAttachable {
$mid = '';
$bindvars = array();
}
- $query = "SELECT uu.*, tf_ava.`storage_path` AS `avatar_storage_path`
+ $query = "SELECT uu.*, lc.`content_status_id`, tf_ava.`storage_path` AS `avatar_storage_path`
FROM `".BIT_DB_PREFIX."users_users` uu
INNER JOIN `".BIT_DB_PREFIX."liberty_content` lc ON (uu.`content_id`=lc.`content_id`)
LEFT OUTER JOIN `".BIT_DB_PREFIX."liberty_content_hits` lch ON ( lc.`content_id` = lch.`content_id` )
diff --git a/admin/index.php b/admin/index.php
index cce1b75..0f976f3 100644
--- a/admin/index.php
+++ b/admin/index.php
@@ -1,5 +1,5 @@
<?php
-// $Header: /cvsroot/bitweaver/_bit_users/admin/index.php,v 1.23 2007/11/15 19:27:20 joasch Exp $
+// $Header: /cvsroot/bitweaver/_bit_users/admin/index.php,v 1.24 2008/02/14 18:49:49 wjames5 Exp $
// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
@@ -89,23 +89,55 @@ if( isset( $_REQUEST["action"] ) ) {
);
$gBitSystem->confirmDialog( $formHash, $msgHash );
}
- } elseif( $_REQUEST["action"] == 'delete' ) {
+ } elseif( $_REQUEST["action"] == 'delete' || $_REQUEST["action"] == 'ban' || $_REQUEST["action"] == 'unban' ) {
$gBitUser->verifyTicket();
$formHash['user_id'] = $_REQUEST['user_id'];
$userInfo = $gBitUser->getUserInfo( array( 'user_id' => $_REQUEST["user_id"] ) );
if( !empty( $userInfo['user_id'] ) ) {
if( isset( $_REQUEST["confirm"] ) ) {
$userClass = $gBitSystem->getConfig( 'user_class', 'BitPermUser' );
- $expungeUser = new $userClass( $_REQUEST["user_id"] );
- if( $expungeUser->load() && $expungeUser->expunge() ) {
- $feedback['success'][] = tra( 'User deleted' )." <strong>{$userInfo['real_name']} ({$userInfo['login']})</strong>";
+ $reqUser = new $userClass( $_REQUEST["user_id"] );
+ switch( $_REQUEST["action"] ){
+ case 'delete':
+ if( $reqUser->load() && $reqUser->expunge() ) {
+ $feedback['success'][] = tra( 'User deleted' )." <strong>{$userInfo['real_name']} ({$userInfo['login']})</strong>";
+ }
+ break;
+ case 'ban':
+ if( $reqUser->load() && $reqUser->ban() ) {
+ $feedback['success'][] = tra( 'User banned' )." <strong>{$userInfo['real_name']} ({$userInfo['login']})</strong>";
+ }
+ break;
+ case 'unban':
+ if( $reqUser->load() && $reqUser->unban() ) {
+ $feedback['success'][] = tra( 'User restored' )." <strong>{$userInfo['real_name']} ({$userInfo['login']})</strong>";
+ }
+ break;
}
} else {
- $gBitSystem->setBrowserTitle( 'Delete user' );
- $msgHash = array(
- 'confirm_item' => tra( 'Are you sure you want to remove the user?' ),
- 'warning' => tra( 'This will permentally delete the user' )." <strong>$userInfo[real_name] ($userInfo[login])</strong>",
- );
+ switch( $_REQUEST["action"] ){
+ case 'delete':
+ $gBitSystem->setBrowserTitle( tra( 'Delete user' ) );
+ $msgHash = array(
+ 'confirm_item' => tra( 'Are you sure you want to remove the user?' ),
+ 'warning' => tra( 'This will permentally delete the user' )." <strong>$userInfo[real_name] ($userInfo[login])</strong>",
+ );
+ break;
+ case 'ban':
+ $gBitSystem->setBrowserTitle( tra( 'Ban user' ) );
+ $msgHash = array(
+ 'confirm_item' => tra( 'Are you sure you want to ban this user?' ),
+ 'warning' => tra( 'This will suspend the account for user' )." <strong>$userInfo[real_name] ($userInfo[login])</strong>",
+ );
+ break;
+ case 'unban':
+ $gBitSystem->setBrowserTitle( tra( 'Unban user' ) );
+ $msgHash = array(
+ 'confirm_item' => tra( 'Are you sure you want to unban this user?' ),
+ 'warning' => tra( 'This will restore the account for user' )." <strong>$userInfo[real_name] ($userInfo[login])</strong>",
+ );
+ break;
+ }
$gBitSystem->confirmDialog( $formHash,$msgHash );
}
} else {
diff --git a/bit_setup_inc.php b/bit_setup_inc.php
index 3b72c16..f5d31c1 100644
--- a/bit_setup_inc.php
+++ b/bit_setup_inc.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Header: /cvsroot/bitweaver/_bit_users/bit_setup_inc.php,v 1.43 2007/07/11 06:51:34 squareing Exp $
+ * @version $Header: /cvsroot/bitweaver/_bit_users/bit_setup_inc.php,v 1.44 2008/02/14 18:49:49 wjames5 Exp $
* @package users
*/
global $gBitDbType, $gBitDbHost, $gBitDbUser, $gBitDbPassword, $gBitDbName, $gBitThemes;
@@ -183,4 +183,5 @@ if( $gBitUser->isValid() && ( $gBitUser->isRegistered() || !$gBitSystem->isFeatu
}
require_once( USERS_PKG_PATH.'BaseAuth.php' );
+
?>
diff --git a/templates/users_list.tpl b/templates/users_list.tpl
index ea9f570..6a08a1a 100644
--- a/templates/users_list.tpl
+++ b/templates/users_list.tpl
@@ -25,6 +25,11 @@
{smartlink ipackage=users ifile="admin/assign_user.php" assign_user=$users[user].user_id ititle="Assign Group" ibiticon="icons/emblem-shared" iforce=icon}
{smartlink ipackage=liberty ifile="list_content.php" user_id=$users[user].user_id ititle="User Content" ibiticon="icons/format-justify-fill" iforce="icon"}
{if $users[user].user_id != $smarty.const.ANONYMOUS_USER_ID && $users[user].user_id != $smarty.const.ROOT_USER_ID && $users[user].user_id != $gBitUser->mUserId}
+ {if $users[user].content_status_id > 0}
+ {smartlink ipackage=users ifile="admin/index.php" user_id=$users[user].user_id action=ban ititle="Ban User" ibiticon="icons/dialog-cancel" iforce=icon}
+ {else}
+ {smartlink ipackage=users ifile="admin/index.php" user_id=$users[user].user_id action=unban ititle="Restore the User Account" ibiticon="icons/view-refresh" iforce=icon}
+ {/if}
{smartlink ipackage=users ifile="admin/index.php" user_id=$users[user].user_id action=delete ititle="Remove" ibiticon="icons/edit-delete" iforce=icon}
<input type="checkbox" name="batch_user_ids[]" value="{$users[user].user_id}" />
{/if}