示例#1
0
 /**
  * removes user and associated private data
  *
  * @access public
  * @return always FALSE???
  * TODO: fix return
  */
 function expunge($pExpungeContent = NULL)
 {
     global $gBitSystem, $gBitUser;
     $this->clearFromCache();
     if ($this->isValid()) {
         $this->StartTrans();
         if ($this->mUserId == $gBitUser->mUserId) {
             $this->mDb->RollbackTrans();
             $gBitSystem->fatalError(tra('You cannot delete yourself'));
         } elseif ($this->mUserId != ANONYMOUS_USER_ID) {
             $userTables = array('users_roles_map');
             foreach ($userTables as $table) {
                 $query = "DELETE FROM `" . BIT_DB_PREFIX . $table . "` WHERE `user_id` = ?";
                 $result = $this->mDb->query($query, array($this->mUserId));
             }
             if (parent::expunge($pExpungeContent)) {
                 $this->CompleteTrans();
                 return TRUE;
             } else {
                 $this->mDb->RollbackTrans();
             }
         } else {
             $this->mDb->RollbackTrans();
             $gBitSystem->fatalError(tra('The anonymous user cannot be deleted'));
         }
     }
     return FALSE;
 }