diff options
| -rw-r--r-- | BitPermUser.php | 10 | ||||
| -rw-r--r-- | BitUser.php | 21 | ||||
| -rw-r--r-- | admin/index.php | 11 |
3 files changed, 31 insertions, 11 deletions
diff --git a/BitPermUser.php b/BitPermUser.php index 93b90ae..bd5b056 100644 --- a/BitPermUser.php +++ b/BitPermUser.php @@ -1,6 +1,6 @@ <?php /** - * $Header: /cvsroot/bitweaver/_bit_users/BitPermUser.php,v 1.75 2009/01/24 19:16:14 tekimaki_admin Exp $ + * $Header: /cvsroot/bitweaver/_bit_users/BitPermUser.php,v 1.76 2009/02/12 19:25:21 spiderr Exp $ * * Lib for user administration, groups and permissions * This lib uses pear so the constructor requieres @@ -11,7 +11,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: BitPermUser.php,v 1.75 2009/01/24 19:16:14 tekimaki_admin Exp $ + * $Id: BitPermUser.php,v 1.76 2009/02/12 19:25:21 spiderr Exp $ * @package users */ @@ -24,7 +24,7 @@ require_once( USERS_PKG_PATH.'/BitUser.php' ); * Class that holds all information for a given user * * @author spider <spider@steelsun.com> - * @version $Revision: 1.75 $ + * @version $Revision: 1.76 $ * @package users * @subpackage BitPermUser */ @@ -191,7 +191,7 @@ class BitPermUser extends BitUser { * @return always FALSE??? * TODO: fix return */ - function expunge() { + function expunge( $pExpungeContent=NULL) { global $gBitSystem, $gBitUser; if( $this->isValid() ) { $this->mDb->StartTrans(); @@ -208,7 +208,7 @@ class BitPermUser extends BitUser { $result = $this->mDb->query( $query, array( $this->mUserId ) ); } - if( BitUser::expunge( $this->mUserId ) ) { + if( parent::expunge( $pExpungeContent ) ) { $this->mDb->CompleteTrans(); return TRUE; } else { diff --git a/BitUser.php b/BitUser.php index a7f4e75..ab21ab4 100644 --- a/BitUser.php +++ b/BitUser.php @@ -1,6 +1,6 @@ <?php /** - * $Header: /cvsroot/bitweaver/_bit_users/BitUser.php,v 1.213 2009/02/06 01:30:41 tekimaki_admin Exp $ + * $Header: /cvsroot/bitweaver/_bit_users/BitUser.php,v 1.214 2009/02/12 19:25:21 spiderr 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.213 2009/02/06 01:30:41 tekimaki_admin Exp $ + * $Id: BitUser.php,v 1.214 2009/02/12 19:25:21 spiderr Exp $ * @package users */ @@ -42,7 +42,7 @@ define( "ACCOUNT_DISABLED", -6 ); * Class that holds all information for a given user * * @author spider <spider@steelsun.com> - * @version $Revision: 1.213 $ + * @version $Revision: 1.214 $ * @package users * @subpackage BitUser */ @@ -867,9 +867,22 @@ class BitUser extends LibertyMime { * @access public * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure */ - function expunge() { + function expunge( $pExpungeContent = NULL ) { global $gBitSystem; $this->mDb->StartTrans(); + + if( !empty( $pExpungeContent ) ) { + if( $pExpungeContent == 'all' ) { + if( $userContent = $this->mDb->getAssoc( "SELECT content_id, content_type_guid FROM `".BIT_DB_PREFIX."liberty_content` WHERE `user_id`=? AND `content_type_guid` != 'bituser'", array( $this->mUserId ) ) ) { + foreach( $userContent as $contentId=>$contentTypeGuid ) { + if( $delContent = LibertyBase::getLibertyObject( $contentId, $contentTypeGuid ) ) { + $delContent->expunge(); + } + } + } + } + } + if( $this->mUserId != ANONYMOUS_USER_ID ) { $this->purgeImage( 'avatar' ); $this->purgeImage( 'portrait' ); diff --git a/admin/index.php b/admin/index.php index 97d6d1f..6f5b1d6 100644 --- a/admin/index.php +++ b/admin/index.php @@ -1,5 +1,5 @@ <?php -// $Header: /cvsroot/bitweaver/_bit_users/admin/index.php,v 1.29 2008/10/16 10:22:41 squareing Exp $ +// $Header: /cvsroot/bitweaver/_bit_users/admin/index.php,v 1.30 2009/02/12 19:25:22 spiderr 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. @@ -103,9 +103,11 @@ if( isset( $_REQUEST["action"] ) ) { $reqUser = new $userClass( $_REQUEST["user_id"] ); switch( $_REQUEST["action"] ){ case 'delete': - if( $reqUser->load() && $reqUser->expunge() ) { + $reqUser->mDb->StartTrans(); + if( $reqUser->load() && $reqUser->expunge( !empty( $_REQUEST['delete_user_content'] ) ? $_REQUEST['delete_user_content'] : NULL ) ) { $feedback['success'][] = tra( 'User deleted' )." <strong>{$userInfo['real_name']} ({$userInfo['login']})</strong>"; } + $reqUser->mDb->CompleteTrans(); break; case 'ban': if( $reqUser->load() && $reqUser->ban() ) { @@ -121,6 +123,11 @@ if( isset( $_REQUEST["action"] ) ) { } else { switch( $_REQUEST["action"] ){ case 'delete': + $formHash['input'][] = "<input type='checkbox' name='delete_user_content' value='all' checked='checked'/>".tra( 'Delete all content created by this user' ); + foreach( $gLibertySystem->mContentTypes as $contentTypeGuid => $contentTypeHash ) { +// $formHash['input'][] = "<input type='checkbox' name='delete_user_content' checked='checked' value='$contentTypeGuid'/>Delete All User's $contentTypeHash[content_description]"; + } + $gBitSystem->setBrowserTitle( tra( 'Delete user' ) ); $msgHash = array( 'confirm_item' => tra( 'Are you sure you want to remove the user?' ), |
