Pastoid

the slow version

The page you are looking at now is at this URL: http://pastoid.com/anl

This paste was last updated on February 11, 2009 at 11:35 pm.

Pasted Coderaw

	public function get_access( $user = null )
	{
		if ( ! $user instanceof User ) {
			$user = User::identify();
		}
 
		// collect all possible token accesses on the given post
		$token_accesses = array(
			ACL::get_user_token_access( 'own_posts' ),
			ACL::get_user_token_access( 'post_any' ),
			ACL::get_user_token_access( 'post_' . $this->content_type() ),
		);
 
		$post_tokens = DB::get_column( 'SELECT token_id FROM {post_tokens} WHERE post_id=?', array( $this->id ) );
		foreach ( $post_tokens as $token ) {
			$token_accesses []= ACL::get_user_token_access( $token );
		}
 
		// now that we have all the accesses, loop through them to build the access to the particular post
		$result = 0;
		foreach ( $token_accesses as $access ) {
			if ( $access == 0 ) {
				$mask = 0;
				break;
			}
			else {
				$result |= $access;
			}
		}
 
		return ACL::get_bitmask( $result );
 

Toggle wordwrap

Referring DomainHits
Unknown Referer 127
pastoid.com 10
search.live.com 2
drunkenmonkey.org 1
mibbit.com 1
Is this paste spam?
<Hide