Mac os x web server - CHAPTER 11 MODIFYING PHPBB 341 The
CHAPTER 11 MODIFYING PHPBB 341 The level of authorization to check The forum ID to check authorization on A handle to the user s data (obtained via get_userdata()) The forum object on which to check access control lists (if necessary) If the permission is granted, auth()returns true; if not, it returns false. Table 11-5 lists the possible auth() values that you can check. Table 11-5. Available auth() Values Value Explanation AUTH_VIEW Checks if the user is able to view the object (topic, forum, and so on) AUTH_READ Checks if the user is able to view and read the object in question AUTH_POST Checks if the user is able to make new topics in the forum in question AUTH_REPLY Checks if the user is able to reply to posts in the forum in question AUTH_EDIT Checks if the user is able to edit posts in the forum in question AUTH_DELETE Checks if the user can delete posts in the forum in question AUTH_ANNOUNCE Checks if the user is permitted to post announcements in the forum in question AUTH_STICKY Checks if the user is permitted to post sticky topics in the forum in question AUTH_POLLCREATE Checks if the user is permitted to create polls in the forum in question AUTH_VOTE Checks if the user is able to vote in polls in the forum in question AUTH_ALL Returns all auth()values in an array, permitting you to pick and choose between multiple authorization levels if needed For example, Listing 11-6, which comes from viewtopic.php, gives an example of phpBB checking permissions on a topic. Listing 11-6. Using auth() to Check Topic Permissions, from viewtopic.php // // Start auth check // $is_auth = array(); $is_auth = auth(AUTH_ALL, $forum_id, $userdata, $forum_topic_data); if( !$is_auth[’auth_view’] || !$is_auth[’auth_read’] ) { if ( !$userdata[’session_logged_in’] ) { $redirect = ( isset($post_id) ) ? POST_POST_URL . “=:. $post_id” POST_TOPIC_URL . “=$topic_id”; $redirect .= ( isset($start) ) ? “&start=$start” : ‘’; redirect(append_sid(”login.$phpEx?redirect=. viewtopic.$phpEx&$redirect”, true)); }
In case you need quality webspace to host and run your web applications, try our personal web hosting services.