Revision 2076
Added by darkviper almost 11 years ago
- some fixes in admin/users
- some fixes in admin/pages
delete.php | ||
---|---|---|
32 | 32 |
|
33 | 33 |
$action = 'default'; |
34 | 34 |
$action = (isset($aActionRequest['delete']) ? 'delete' : $action ); |
35 |
$action = (isset($aActionRequest['delete_outdated']) ? 'delete_outdated' : $action ); |
|
35 |
$action = (isset($aActionRequest['delete_outdated']) ? 'delete_outdated' : $action ); |
|
36 |
$action = (isset($aActionRequest['enable_outdated']) ? 'enable_outdated' : $action ); |
|
36 | 37 |
|
37 | 38 |
switch($action) : |
38 | 39 |
case 'delete': // delete the user |
... | ... | |
42 | 43 |
} else { |
43 | 44 |
$aUserID = $aActionRequest['user_id']; |
44 | 45 |
} |
45 |
}
|
|
46 |
} |
|
46 | 47 |
break; |
47 | 48 |
case 'delete_outdated': // delete Users awaiting activation |
48 | 49 |
if(isset($aActionRequest['activation_user_id'])) { |
... | ... | |
53 | 54 |
} |
54 | 55 |
} |
55 | 56 |
break; |
57 |
case 'enable_outdated': // enable Users awaiting activation |
|
58 |
if(isset($aActionRequest['activation_user_id'])) { |
|
59 |
if(!is_array($aActionRequest['activation_user_id'])) { |
|
60 |
$aUserID[] = $aActionRequest['activation_user_id']; |
|
61 |
} else { |
|
62 |
$aUserID = $aActionRequest['activation_user_id']; |
|
63 |
} |
|
64 |
} |
|
65 |
break; |
|
56 | 66 |
default: // show userlist with empty modify mask |
57 | 67 |
endswitch; // end of switch |
58 |
|
|
68 |
|
|
59 | 69 |
// if(isset($aActionRequest['activation_user_id'])) { |
60 | 70 |
// if(!is_array($aActionRequest['activation_user_id'])) { |
61 |
//
|
|
71 |
// |
|
62 | 72 |
// $aUserID[] = $aActionRequest['activation_user_id']; |
63 | 73 |
// } else { |
64 | 74 |
// $aUserID = $aActionRequest['activation_user_id']; |
... | ... | |
66 | 76 |
// } else { |
67 | 77 |
// if(isset($aActionRequest['user_id'])) { |
68 | 78 |
// if(!is_array($aActionRequest['user_id'])) { |
69 |
//
|
|
79 |
// |
|
70 | 80 |
// $aUserID[] = $aActionRequest['user_id']; |
71 | 81 |
// } else { |
72 | 82 |
// $aUserID = $aActionRequest['user_id']; |
73 | 83 |
// } |
74 |
// } |
|
75 |
// } |
|
76 |
|
|
84 |
// } |
|
85 |
// } |
|
77 | 86 |
|
87 |
|
|
78 | 88 |
foreach ( $aUserID AS $key => $value) |
79 | 89 |
{ |
80 | 90 |
switch ($_SERVER['REQUEST_METHOD']) : |
... | ... | |
101 | 111 |
|
102 | 112 |
if( ($msg = msgQueue::getError()) == '') |
103 | 113 |
{ |
104 |
$sql = 'SELECT `active` FROM `'.TABLE_PREFIX.'users` '. |
|
105 |
'WHERE `user_id` = '.$user_id; |
|
106 |
if( ($iDeleteUser = $database->get_one($sql)) != null ) { |
|
107 |
if($iDeleteUser) { |
|
108 |
// Deactivate the user |
|
109 |
$sql = 'UPDATE `'.TABLE_PREFIX.'users` SET '. |
|
110 |
'`active` = 0 '. |
|
111 |
'WHERE `user_id` = '.$user_id; |
|
112 |
if( $database->query($sql) ) { |
|
113 |
msgQueue::add($mLang->TEXT_USERS_MARKED_DELETED, true); |
|
114 |
|
|
115 |
switch($action) : |
|
116 |
case 'enable_outdated': // enable Users awaiting activation |
|
117 |
$sql = 'SELECT `display_name` FROM `'.TABLE_PREFIX.'users` '. |
|
118 |
'WHERE `user_id` = '.$user_id; |
|
119 |
if( ($sDisplayUser = $database->getOne($sql)) != null ) { |
|
120 |
$sql = 'UPDATE `'.TABLE_PREFIX.'users` ' |
|
121 |
. 'SET `active`=1, ' |
|
122 |
. '`confirm_code`=\'\', ' |
|
123 |
. '`confirm_timeout`=0 ' |
|
124 |
. 'WHERE `user_id`='.$user_id; |
|
125 |
if($database->query($sql)) { |
|
126 |
msgQueue::add($mLang->MESSAGE_USERS_ADDED.' ('.$sDisplayUser.')', true); |
|
127 |
$bRetVal = true; |
|
128 |
} else { |
|
129 |
msgQueue::add($mLang->TEXT_ENABLE.$mLang->MESSAGE_GENERIC_NOT_COMPARE.' ('.$sDisplayUser.')'); |
|
114 | 130 |
} |
115 |
} else { |
|
131 |
} |
|
132 |
break; |
|
133 |
default: // show userlist with empty modify mask |
|
134 |
$sql = 'SELECT `active` FROM `'.TABLE_PREFIX.'users` '. |
|
135 |
'WHERE `user_id` = '.$user_id; |
|
136 |
if( ($iDeleteUser = $database->get_one($sql)) != null ) { |
|
137 |
if($iDeleteUser) { |
|
138 |
// Deactivate the user |
|
139 |
$sql = 'UPDATE `'.TABLE_PREFIX.'users` SET '. |
|
140 |
'`active` = 0 '. |
|
141 |
'WHERE `user_id` = '.$user_id; |
|
142 |
if( $database->query($sql) ) { |
|
143 |
msgQueue::add($mLang->TEXT_USERS_MARKED_DELETED, true); |
|
144 |
} |
|
145 |
} else { |
|
116 | 146 |
|
117 | 147 |
|
118 |
$sql = 'DELETE FROM `'.TABLE_PREFIX.'users` '. |
|
119 |
'WHERE `user_id` = '.$user_id; |
|
120 |
if( $database->query($sql) ) { |
|
121 |
msgQueue::add($mLang->MESSAGE_USERS_DELETED, true); |
|
148 |
$sql = 'DELETE FROM `'.TABLE_PREFIX.'users` '. |
|
149 |
'WHERE `user_id` = '.$user_id; |
|
150 |
if( $database->query($sql) ) { |
|
151 |
msgQueue::add($mLang->MESSAGE_USERS_DELETED, true); |
|
152 |
} |
|
122 | 153 |
} |
154 |
$bRetVal = true; |
|
123 | 155 |
} |
124 |
$bRetVal = true; |
|
125 |
} |
|
126 |
if($database->is_error()) { |
|
127 |
msgQueue::add( implode('<br />',explode(';',$database->get_error())) ); |
|
128 |
$bRetVal = false; |
|
129 |
} |
|
130 |
} |
|
131 |
} |
|
156 |
if($database->is_error()) { |
|
157 |
msgQueue::add( implode('<br />',explode(';',$database->get_error())) ); |
|
158 |
$bRetVal = false; |
|
159 |
} |
|
160 |
endswitch; // end of switch |
|
161 |
} // getError |
|
162 |
} // foreach users |
|
132 | 163 |
if(isset($aActionRequest['clearmsg'])) { msgQueue::clear(); } |
133 | 164 |
return $bRetVal; |
134 | 165 |
} |
... | ... | |
137 | 168 |
$requestMethod = '_'.strtoupper($_SERVER['REQUEST_METHOD']); |
138 | 169 |
$aActionRequest = (isset(${$requestMethod})) ? ${$requestMethod} : null; |
139 | 170 |
$aActionRequest['clearmsg'] = true; |
140 |
} |
|
171 |
} |
Also available in: Unified diff