Created
July 16, 2009 06:45
-
-
Save jawngee/148272 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<? | |
class HasAccessScreen extends Screen | |
{ | |
public function before($controller,$metadata,&$data) | |
{ | |
// make sure we have a valid user id from current session | |
if (!$uid=$controller->session->id) | |
throw new InvalidParametersException(); | |
// fetch the forum ID | |
if (!$id=$controller->request->input->get_num($metadata->key)) | |
throw new NotFoundException(); | |
// find the forum model in the database | |
$forum=filter($metadata->to)-> | |
->id->equals($id) | |
->owner_id->equals($uid) | |
->first(); | |
// no forum, no love! | |
if (!$forum) | |
throw new NotFoundException(); | |
// ... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment