All pastes #87723 Raw Edit

k4st

public php v1 · immutable
·published 2006-07-14 04:31 UTC
rendered paste body
	function setPermissions()	{		$can_moderate = $this->_user->canDo('moderate', 'threads');		$can_tag = $this->_user->canDo('tag', 'threads');		$can_edit = $can_delete = $display_buttons = intval($can_moderate);		$can_rate = 1;		$is_author = FALSE;				//--------------------------------------------		// Now figure out if this person can rate this thread.		//--------------------------------------------		// TODO:{[for some reason, getting and looping through this list causes the actual template list of authors not to work.[setPermissions[ThreadsRecord}				$authors = &$this->getAuthors();				while($authors->next())		{			$author = &$authors->current();						if($this->_user->getId() == $this->get('user_id'))			{				$can_rate = 0;				$is_author = TRUE;				break;			}		}				//--------------------------------------------		// If this user doesn't have moderating permissions		// on this thread, see if they have other permissions.		//--------------------------------------------				if(!$can_moderate)		{			if($this->_user->canDo('edit', 'threads') && ($is_author || intval($this->get('allow_coauthors')) == 1) )			{				$can_edit = 1;			}			if ($this->_user->canDo('delete', 'threads') && $is_author)			{				$can_delete = 1;			}			if(($can_edit + $can_delete) > 0)			{				$display_buttons = 1;			}		}				if($can_tag) {			$display_buttons = 1;		}				$this->set('display_post_control_buttons', $display_buttons);		$this->set('can_edit_thread', $can_edit);		$this->set('can_delete_thread', $can_delete);		$this->set('can_rate_thread', $can_rate);		$this->set('can_tag_thread', intval($can_tag));	}