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