コード例 #1
0
ファイル: module.php プロジェクト: natepixel/reason_package
		/**
		 * Checks to make sure that the given news item is OK to display.
		 * 
		 * This should return true if the entity looks OK to be shown and false if it does not.
		 *
		 * It also does some checks and may redirect to make URLs sane (IE link given with wrong section).
		 *
		 * @param entity $entity news_item_entity
		 * @return boolean True if OK
		 */
		function further_checks_on_entity( $entity )
		{
			if(empty($this->items[$entity->id()]))
			{
				if($entity->get_value('status') == 'pending' && !user_has_access_to_site($this->site_id)) return false;
				$publication_check = ($entity->has_left_relation_with_entity($this->publication, 'news_to_publication'));
				// check that issue id is present and validated if the publication has issue
				if ($this->publication->get_value('has_issues') == 'yes')
				{
					$issue_check = (!empty($this->request['issue_id']) && ($this->request['issue_id'] == $this->issue_id));
				}
				else $issue_check = true;
				if ($publication_check && $issue_check) return true;
				else return false;
			}
			else
			{
				return true;
			}
		}
コード例 #2
0
ファイル: util.php プロジェクト: hunter2814/reason_package
/**
 * Determines if a given reason user has a given role
 *
 * Note: This function is fairly slow (requires a potentially poky db hit on every call).  If you must use it, store its results rather than asking again. Better yet, use reason_user_has_privs().
 *
 * @deprecated Use reason_user_has_privs(), for performance reasons and to allow extensibility of user roles
 * @param integer $user_id
 * @param integer $role_id
 */
function user_is_a($user_id, $role_id)
{
    $user = new entity($user_id);
    if ($user->has_left_relation_with_entity(new entity($role_id), relationship_id_of('user_to_user_role'))) {
        return true;
    } else {
        return false;
    }
}
コード例 #3
0
		settype($site_id, 'integer');
		
		$type_id = $_REQUEST['type_id'];
		settype($type_id, 'integer');
		
		if(!empty($_REQUEST['show_fields']))
		{
			$showable_fields = explode(',',$_REQUEST['show_fields']);
		}
		
		$type = new entity($type_id);
		$site = new entity($site_id);
		
		$reason_user_entity = new entity($reason_user_id);
		
		if( reason_user_has_privs( $reason_user_id, 'view_sensitive_data' ) || $site->has_left_relation_with_entity( $reason_user_entity, 'site_to_user'))
		{
		
			$es = new entity_selector( $site_id );
			$es->add_type( $type_id );
			
			if(!empty($_REQUEST['limit_field']) && !empty($_REQUEST['limit_value']) )
			{
				$limit_field = addslashes($_REQUEST['limit_field']);
				$limit_value = addslashes($_REQUEST['limit_value']);
				if(empty($_REQUEST['limit_type']) || $_REQUEST['limit_type'] != 'exact')
				{
					$relation = $limit_field.' LIKE "%'.$limit_value.'%"';
				}
				else
				{