Пример #1
0
	public function fetch_rendered_tag_list()
	{
		require_once(DIR . "/includes/blog_functions_tag.php");
		$contentinfo = $this->fetch_content_info();
		$contentinfo['taglist'] = implode(', ',  $this->fetch_existing_tag_list());
	
		//I don't really like this, but I don't know how else to handle it.
		//the blog tag rendering needs an extra parameter, so we grab it from
		//the ether.
		$userid = $this->registry->input->clean_gpc('r', 'userid');
		$userinfo = array();
		if($userid)
		{
			$userinfo['userid'] = $userid;
		}

		return fetch_entry_tagbits($contentinfo, $userinfo);
	}
Пример #2
0
	function process_display()
	{
		global $show, $vbphrase;
		static $delete, $approve;

		$blog =& $this->blog;

		if ($this->blog['ratingnum'] >= $this->registry->options['vbblog_ratingpost'] AND $this->blog['ratingnum'])
		{
			$this->blog['ratingavg'] = vb_number_format($this->blog['ratingtotal'] / $this->blog['ratingnum'], 2);
			$this->blog['rating'] = intval(round($this->blog['ratingtotal'] / $this->blog['ratingnum']));
			$show['rating'] = true;
		}
		else
		{
			$show['rating'] = false;
		}

		if (!$this->blog['blogtitle'])
		{
			$this->blog['blogtitle'] = $this->blog['username'];
		}

		$categorybits = array();

		if (!empty($this->categories["{$this->blog[blogid]}"]))
		{
			foreach ($this->categories["{$this->blog[blogid]}"] AS $index => $category)
			{
				$category['blogtitle']= $this->blog['blogtitle'];
				$show['cattitleonly'] = (!$category['creatorid'] AND !($this->registry->userinfo['blogcategorypermissions']["$category[blogcategoryid]"] & $this->registry->bf_ugp_vbblog_general_permissions['blog_canviewcategory']));
				$templater = vB_Template::create('blog_entry_category');
					$templater->register('category', $category);
					$templater->register('pageinfo', array('blogcategoryid' => $category['blogcategoryid']));
				$categorybits[] = $templater->render();
			}
		}
		else
		{
			$category = array(
				'blogcategoryid' => -1,
				'title'          => $vbphrase['uncategorized'],
				'userid'         => $this->blog['userid'],
				'blogtitle'      => $this->blog['blogtitle'],
			);
			$templater = vB_Template::create('blog_entry_category');
				$templater->register('category', $category);
				$templater->register('pageinfo', array('blogcategoryid' => $category['blogcategoryid']));
			$categorybits[] = $templater->render();
		}

		$show['category'] = true;
		$this->blog['categorybits'] = implode(', ', $categorybits);

		$show['trackback_moderation'] = ($this->blog['trackback_moderation'] AND ($this->blog['userid'] == $this->registry->userinfo['userid'] OR can_moderate_blog('canmoderatecomments'))) ? true : false;
		$show['comment_moderation'] = ($this->blog['hidden'] AND ($this->blog['userid'] == $this->registry->userinfo['userid'] OR can_moderate_blog('canmoderatecomments'))) ? true : false;

		$show['edit'] = fetch_entry_perm('edit', $this->blog);
		$show['delete'] = fetch_entry_perm('delete', $this->blog);
		$show['remove'] = fetch_entry_perm('remove', $this->blog);
		$show['undelete'] = fetch_entry_perm('undelete', $this->blog);
		$show['approve'] = fetch_entry_perm('moderate', $this->blog);

		$show['inlinemod'] = (($show['delete'] OR $show['remove'] OR $show['approve'] OR $show['undelete'])
			AND
		(
			can_moderate_blog()
				OR
			(
				!empty($this->userinfo)
					AND
				is_member_of_blog($this->registry->userinfo, $this->userinfo)
			)
		));

		if ($this->blog['dateline'] > TIMENOW OR $this->blog['pending'])
		{
			$this->status['phrase'] = $vbphrase['pending_blog_entry'];
			$this->status['image'] = vB_Template_Runtime::fetchStyleVar('imgdir_misc') . "/blog/pending.gif";
			$show['status'] = true;
		}
		else if ($this->blog['state'] == 'deleted')
		{
			$this->status['image'] = vB_Template_Runtime::fetchStyleVar('imgdir_misc') . "/trashcan.gif";
			$this->status['phrase'] = $vbphrase['deleted_blog_entry'];
			$show['status'] = true;
		}
		else if ($this->blog['state'] == 'moderation')
		{
			$this->status['phrase'] = $vbphrase['moderated_blog_entry'];
			$this->status['image'] = vB_Template_Runtime::fetchStyleVar('imgdir_misc') . "/moderated.gif";
			$show['status'] = true;
		}
		else if ($this->blog['state'] == 'draft')
		{
			$this->status['phrase'] = $vbphrase['draft_blog_entry'];
			$this->status['image'] = vB_Template_Runtime::fetchStyleVar('imgdir_misc') . "/blog/draft.gif";
			$show['status'] = true;
		}
		else
		{
			$show['status'] = false;
		}

		$show['private'] = false;
		if ($blog['private'])
		{
			$show['private'] = true;
		}
		else if (can_moderate() AND !is_member_of_blog($this->registry->userinfo, $blog))
		{
			$membercanview = $blog['options_member'] & $this->registry->bf_misc_vbblogsocnetoptions['canviewmyblog'];
			$buddiescanview = $blog['options_buddy'] & $this->registry->bf_misc_vbblogsocnetoptions['canviewmyblog'];
			if (!$membercanview AND (!$blog['buddyid'] OR !$buddiescanview))
			{
				$show['private'] = true;
			}
		}

		if ($this->blog['edit_userid'])
		{
			$this->blog['edit_date'] = vbdate($this->registry->options['dateformat'], $this->blog['edit_dateline'], true);
			$this->blog['edit_time'] = vbdate($this->registry->options['timeformat'], $this->blog['edit_dateline']);
			if ($this->blog['edit_reason'])
			{
				$this->blog['edit_reason'] = fetch_word_wrapped_string($this->blog['edit_reason']);
			}
			$show['entryedited'] = true;
		}
		else
		{
			$show['entryedited'] = false;
		}

		$show['tags'] = false;
		if ($this->registry->options['vbblog_tagging'])
		{
			require_once(DIR . '/includes/blog_functions_tag.php');

			$this->blog['tag_list'] = fetch_entry_tagbits($this->blog, $this->userinfo);
			$show['tag_edit'] = (
				(($this->registry->userinfo['permissions']['vbblog_entry_permissions'] & $this->registry->bf_ugp_vbblog_entry_permissions['blog_cantagown']) AND $this->bloginfo['userid'] == $this->registry->userinfo['userid'])
				OR ($this->registry->userinfo['permissions']['vbblog_entry_permissions'] & $this->registry->bf_ugp_vbblog_entry_permissions['blog_cantagothers'])
				OR (($this->registry->userinfo['permissions']['vbblog_entry_permissions'] & $this->registry->bf_ugp_vbblog_entry_permissions['blog_candeletetagown']) AND $this->bloginfo['userid'] == $this->registry->userinfo['userid'])
				OR can_moderate_blog('caneditentries')
			);
			$show['tags'] = ($show['tag_edit'] OR $this->blog['taglist']);
			$show['notags'] = !$this->blog['taglist'];
		}
	}