Ejemplo n.º 1
0
         // Will EXIT
         // We have EXITed already at this point!!
     }
     $action = 'edit';
     break;
 case 'delete':
     // Delete slug:
     // Check that this action request is not a CSRF hacked request:
     $Session->assert_received_crumb('slug');
     // Check that current user has permission to edit slugs:
     $current_User->check_perm('slugs', 'edit', true);
     // Make sure we got an slug_ID:
     param('slug_ID', 'integer', true);
     if (param('confirm', 'integer', 0)) {
         // confirmed, Delete from DB:
         $msg = sprintf(T_('Slug «%s» deleted.'), $edited_Slug->dget('title'));
         $edited_Slug->dbdelete(true);
         unset($edited_Slug);
         forget_param('slug_ID');
         $Messages->add($msg, 'success');
         // Redirect so that a reload doesn't write to the DB twice:
         header_redirect(regenerate_url('action', '', '', '&'), 303);
         // Will EXIT
         // We have EXITed already at this point!!
     } else {
         // not confirmed, Check for restrictions:
         if (!$edited_Slug->check_delete(sprintf(T_('Cannot delete slug «%s»'), $edited_Slug->dget('title')), array(), true)) {
             // There are restrictions:
             $action = 'list';
         }
     }