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