Exemplo n.º 1
0
             // We have EXITed already at this point!!
         }
     }
     break;
 case 'delete':
     // Delete region:
     // Check that this action request is not a CSRF hacked request:
     $Session->assert_received_crumb('region');
     // Check permission:
     $current_User->check_perm('options', 'edit', true);
     // Make sure we got an rgn_ID:
     param('rgn_ID', 'integer', true);
     if (param('confirm', 'integer', 0)) {
         // confirmed, Delete from DB:
         $msg = sprintf(T_('Region «%s» deleted.'), $edited_Region->dget('name'));
         $edited_Region->dbdelete();
         unset($edited_Region);
         forget_param('rgn_ID');
         $Messages->add($msg, 'success');
         // Redirect so that a reload doesn't write to the DB twice:
         header_redirect('?ctrl=regions', 303);
         // Will EXIT
         // We have EXITed already at this point!!
     } else {
         // not confirmed, Check for restrictions:
         if (!$edited_Region->check_delete(sprintf(T_('Cannot delete region «%s»'), $edited_Region->dget('name')))) {
             // There are restrictions:
             $action = 'view';
         }
     }
     break;
Exemplo n.º 2
0
             // We have EXITed already at this point!!
         }
     }
     break;
 case 'delete':
     // Delete region:
     // Check that this action request is not a CSRF hacked request:
     $Session->assert_received_crumb('region');
     // Check permission:
     $current_User->check_perm('options', 'edit', true);
     // Make sure we got an rgn_ID:
     param('rgn_ID', 'integer', true);
     if (param('confirm', 'integer', 0)) {
         // confirmed, Delete from DB:
         $msg = sprintf(T_('Region «%s» deleted.'), $edited_Region->dget('name'));
         $edited_Region->dbdelete(true);
         unset($edited_Region);
         forget_param('rgn_ID');
         $Messages->add($msg, 'success');
         // Redirect so that a reload doesn't write to the DB twice:
         header_redirect('?ctrl=regions', 303);
         // Will EXIT
         // We have EXITed already at this point!!
     } else {
         // not confirmed, Check for restrictions:
         if (!$edited_Region->check_delete(sprintf(T_('Cannot delete region «%s»'), $edited_Region->dget('name')))) {
             // There are restrictions:
             $action = 'view';
         }
     }
     break;