Created
June 10, 2011 00:24
-
-
Save saltybeagle/1018042 to your computer and use it in GitHub Desktop.
Story deletion procedure with error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!isset($_POST['delete'])) { | |
return false; | |
} | |
if (UNL_ENews_Controller::getUser()->uid !== $story->uid_created) { | |
throw new Exception('You did not create that story - you can not delete it', 403); | |
} | |
foreach ($story->getNewsrooms() as $newsroom) { | |
if (UNL_ENews_Newsroom_Story::getById($newsroom->id, $story->id)->status !== 'pending') { | |
throw new Exception('A story you attempted to delete has already been approved for use by a newsroom', 403); | |
} | |
} | |
return $story->delete(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment