Project

General

Profile

« Previous | Next » 

Revision 2098

Added by darkviper over 10 years ago

! activate class Translate for all addons in admin/ (except pages/)
! class.admin >> add translation of the current theme to Translate

View differences:

delete.php
23 23
	throw new IllegalFileException();
24 24
}
25 25
/* -------------------------------------------------------- */
26
function delete_user($admin, &$aActionRequest)
26
function delete_user($admin, $aActionRequest)
27 27
{
28
	$database = WbDatabase::getInstance();
29
	$mLang = Translate::getInstance();
28
	$oDb = WbDatabase::getInstance();
29
	$oTrans = Translate::getInstance();
30
    $oTrans->enableAddon('admin\\users');
30 31
    $aUserID = array();
31 32
    $bRetVal = false;
32 33

  
......
98 99

  
99 100
		// Check if user id is a valid number and doesnt equal 1
100 101
		if($user_id == 0){
101
			msgQueue::add($mLang->MESSAGE_GENERIC_FORGOT_OPTIONS );
102
			msgQueue::add($oTrans->MESSAGE_GENERIC_FORGOT_OPTIONS );
102 103
            return $bRetVal;
103 104
        }
104 105

  
105 106
		if( ($user_id < 2 ) )
106 107
		{
107 108
			// if($admin_header) { $admin->print_header(); }
108
			msgQueue::add($mLang->MESSAGE_GENERIC_SECURITY_ACCESS );
109
			msgQueue::add($oTrans->MESSAGE_GENERIC_SECURITY_ACCESS );
109 110
            return $bRetVal;
110 111
		}
111 112

  
......
114 115

  
115 116
    	switch($action) :
116 117
    		case 'enable_outdated': // enable Users awaiting activation
117
    			$sql  = 'SELECT `display_name` FROM `'.TABLE_PREFIX.'users` '.
118
    			$sql  = 'SELECT `display_name` FROM `'.$oDb->TablePrefix.'users` '.
118 119
                        'WHERE `user_id` = '.$user_id;
119
                if( ($sDisplayUser = $database->getOne($sql)) != null ) {
120
            		$sql = 'UPDATE `'.TABLE_PREFIX.'users` '
120
                if( ($sDisplayUser = $oDb->getOne($sql)) != null ) {
121
            		$sql = 'UPDATE `'.$oDb->TablePrefix.'users` '
121 122
            		     . 'SET `active`=1, '
122 123
            		     .     '`confirm_code`=\'\', '
123 124
            		     .     '`confirm_timeout`=0 '
124 125
            		     . 'WHERE `user_id`='.$user_id;
125
            		if($database->query($sql)) {
126
                        msgQueue::add($mLang->MESSAGE_USERS_ADDED.' ('.$sDisplayUser.')', true);
126
            		if($oDb->doQuery($sql)) {
127
                        msgQueue::add($oTrans->MESSAGE_USERS_ADDED.' ('.$sDisplayUser.')', true);
127 128
                        $bRetVal = true;
128 129
                    } else {
129
                        msgQueue::add($mLang->TEXT_ENABLE.$mLang->MESSAGE_GENERIC_NOT_COMPARE.' ('.$sDisplayUser.')');
130
                        msgQueue::add($oTrans->TEXT_ENABLE.$oTrans->MESSAGE_GENERIC_NOT_COMPARE.' ('.$sDisplayUser.')');
130 131
                    }
131 132
                }
132 133
        		break;
133 134
    		default: // show userlist with empty modify mask
134
    			$sql  = 'SELECT `active` FROM `'.TABLE_PREFIX.'users` '.
135
    			$sql  = 'SELECT `active` FROM `'.$oDb->TablePrefix.'users` '.
135 136
                        'WHERE `user_id` = '.$user_id;
136
                if( ($iDeleteUser = $database->get_one($sql)) != null ) {
137
                if( ($iDeleteUser = $oDb->getOne($sql)) != null ) {
137 138
                    if($iDeleteUser) {
138 139
        				// Deactivate the user
139
            			$sql  = 'UPDATE `'.TABLE_PREFIX.'users` SET '.
140
            			$sql  = 'UPDATE `'.$oDb->TablePrefix.'users` SET '.
140 141
                                '`active` = 0 '.
141 142
                                'WHERE `user_id` = '.$user_id;
142
                        if( $database->query($sql) ) {
143
                            msgQueue::add($mLang->TEXT_USERS_MARKED_DELETED, true);
143
                        if( $oDb->doQuery($sql) ) {
144
                            msgQueue::add($oTrans->TEXT_USERS_MARKED_DELETED, true);
144 145
                        }
145 146
                    } else {
146 147

  
147 148

  
148
            			$sql  = 'DELETE FROM `'.TABLE_PREFIX.'users` '.
149
            			$sql  = 'DELETE FROM `'.$oDb->TablePrefix.'users` '.
149 150
                                'WHERE `user_id` = '.$user_id;
150
                        if( $database->query($sql) ) {
151
                            msgQueue::add($mLang->MESSAGE_USERS_DELETED, true);
151
                        if( $oDb->doQuery($sql) ) {
152
                            msgQueue::add($oTrans->MESSAGE_USERS_DELETED, true);
152 153
                        }
153 154
                    }
154 155
                    $bRetVal = true;
155 156
                }
156
                if($database->is_error()) {
157
                    msgQueue::add( implode('<br />',explode(';',$database->get_error())) );
157
                if($oDb->isError()) {
158
                    msgQueue::add( implode('<br />',explode(';',$oDb->getError())) );
158 159
                    $bRetVal = false;
159 160
               }
160 161
    	endswitch; // end of switch

Also available in: Unified diff