Revision 1493
Added by Luisehahne about 14 years ago
| groups.php | ||
|---|---|---|
| 23 | 23 |
// Set parameter 'action' as alternative to javascript mechanism |
| 24 | 24 |
$action = 'cancel'; |
| 25 | 25 |
// Set parameter 'action' as alternative to javascript mechanism |
| 26 |
$action = (isset($_POST['action']) && ($_POST['action'] ='modify') ? 'modify' : $action ); |
|
| 26 | 27 |
$action = (isset($_POST['modify']) ? 'modify' : $action ); |
| 27 | 28 |
$action = (isset($_POST['delete']) ? 'delete' : $action ); |
| 28 | 29 |
|
| ... | ... | |
| 33 | 34 |
$admin = new admin('Access', 'groups_modify' );
|
| 34 | 35 |
// Check if group group_id is a valid number and doesnt equal 1 |
| 35 | 36 |
$group_id = intval($admin->checkIDKEY('group_id', 0, $_SERVER['REQUEST_METHOD']));
|
| 37 |
if($group_id == 0){
|
|
| 38 |
$admin->print_error($MESSAGE['USERS_NO_GROUP'] ); |
|
| 39 |
} |
|
| 36 | 40 |
if( ($group_id < 2 ) ) |
| 37 | 41 |
{
|
| 38 | 42 |
// if($admin_header) { $admin->print_header(); }
|
| ... | ... | |
| 49 | 53 |
$template->set_var( array( |
| 50 | 54 |
'ACTION_URL' => ADMIN_URL.'/groups/save.php', |
| 51 | 55 |
'SUBMIT_TITLE' => $TEXT['SAVE'], |
| 52 |
'GROUP_ID' => $group['group_id'],
|
|
| 56 |
'GROUP_ID' => $admin->getIDKEY($group['group_id']),
|
|
| 53 | 57 |
'GROUP_NAME' => $group['name'], |
| 54 |
'ADVANCED_ACTION' => 'groups.php',
|
|
| 58 |
'ADVANCED_LINK' => 'groups.php',
|
|
| 55 | 59 |
'FTAN' => $admin->getFTAN() |
| 56 | 60 |
)); |
| 57 | 61 |
// Tell the browser whether or not to show advanced options |
| ... | ... | |
| 155 | 159 |
// Parse template object |
| 156 | 160 |
$template->parse('main', 'main_block', false);
|
| 157 | 161 |
$template->pparse('output', 'page');
|
| 158 |
break; |
|
| 162 |
// Print admin footer |
|
| 163 |
$admin->print_footer(); break; |
|
| 159 | 164 |
case 'delete' : |
| 160 | 165 |
// Create new admin object |
| 161 | 166 |
$admin = new admin('Access', 'groups_delete');
|
| 162 | 167 |
$group_id = intval($admin->checkIDKEY('group_id', 0, $_SERVER['REQUEST_METHOD']));
|
| 168 |
if($group_id == 0){
|
|
| 169 |
$admin->print_error($MESSAGE['USERS_NO_GROUP'] ); |
|
| 170 |
} |
|
| 163 | 171 |
// Check if user id is a valid number and doesnt equal 1 |
| 164 | 172 |
if( ($group_id < 2 ) ) |
| 165 | 173 |
{
|
| ... | ... | |
| 169 | 177 |
// Print header |
| 170 | 178 |
$admin->print_header(); |
| 171 | 179 |
// Delete the group |
| 172 |
$database->query("DELETE FROM ".TABLE_PREFIX."groups WHERE group_id = '".$group_id."' LIMIT 1");
|
|
| 180 |
$database->query("DELETE FROM `".TABLE_PREFIX."groups` WHERE `group_id` = '".$group_id."' LIMIT 1");
|
|
| 173 | 181 |
if($database->is_error()) {
|
| 174 | 182 |
$admin->print_error($database->get_error()); |
| 175 | 183 |
} else {
|
| 176 | 184 |
// Delete users in the group |
| 177 |
$database->query("DELETE FROM ".TABLE_PREFIX."users WHERE group_id = '".$group_id."'");
|
|
| 185 |
$database->query("DELETE FROM `".TABLE_PREFIX."users` WHERE `group_id` = '".$group_id."'");
|
|
| 178 | 186 |
if($database->is_error()) {
|
| 179 | 187 |
$admin->print_error($database->get_error()); |
| 180 | 188 |
} else {
|
| 181 | 189 |
$admin->print_success($MESSAGE['GROUPS']['DELETED']); |
| 182 | 190 |
} |
| 183 | 191 |
} |
| 192 |
// Print admin footer |
|
| 193 |
$admin->print_footer(); |
|
| 184 | 194 |
break; |
| 185 | 195 |
default: |
| 186 | 196 |
break; |
| 187 | 197 |
endswitch; |
| 188 |
|
|
| 189 |
// Print admin footer |
|
| 190 |
$admin->print_footer(); |
|
Also available in: Unified diff
Ticket #1106 FatalError in groups module