예제 #1
0
파일: blog.php 프로젝트: Kheros/MMOver
     $show['nextprevtitle'] = true;
     if ($next = $db->query_first_slave("\r\n\t\t\tSELECT blog.blogid, blog.title\r\n\t\t\tFROM " . TABLE_PREFIX . "blog AS blog\r\n\t\t\t{$joinsql}\r\n\t\t\tWHERE " . implode(" AND ", $wheresql) . "\r\n\t\t\t\tAND blog.dateline > {$bloginfo['dateline']}\r\n\t\t\tORDER BY blog.dateline\r\n\t\t\tLIMIT 1\r\n\t\t")) {
         $show['nexttitle'] = true;
     }
     if ($prev = $db->query_first_slave("\r\n\t\t\tSELECT blog.blogid, blog.title\r\n\t\t\tFROM " . TABLE_PREFIX . "blog AS blog\r\n\t\t\t{$joinsql}\r\n\t\t\tWHERE " . implode(" AND ", $wheresql) . "\r\n\t\t\t\tAND blog.dateline < {$bloginfo['dateline']}\r\n\t\t\tORDER BY blog.dateline DESC\r\n\t\t\tLIMIT 1\r\n\t\t")) {
         $show['prevtitle'] = true;
     }
     $show['blognav'] = ($show['prevtitle'] or $show['nexttitle']);
 } else {
     $show['blognav'] = true;
 }
 // this fetches permissions for the user who created the blog
 cache_permissions($bloginfo, false);
 $displayed_dateline = 0;
 $show['quickcomment'] = ($vbulletin->options['quickreply'] and $vbulletin->userinfo['userid'] and $bloginfo['cancommentmyblog'] and ($bloginfo['allowcomments'] or is_member_of_blog($vbulletin->userinfo, $bloginfo) or can_moderate_blog()) and ($vbulletin->userinfo['permissions']['vbblog_comment_permissions'] & $vbulletin->bf_ugp_vbblog_comment_permissions['blog_cancommentown'] and $bloginfo['userid'] == $vbulletin->userinfo['userid'] or $vbulletin->userinfo['permissions']['vbblog_comment_permissions'] & $vbulletin->bf_ugp_vbblog_comment_permissions['blog_cancommentothers'] and $bloginfo['userid'] != $vbulletin->userinfo['userid']) and ($bloginfo['state'] == 'moderation' and (can_moderate_blog('canmoderateentries') or $vbulletin->userinfo['userid'] and $bloginfo['userid'] == $vbulletin->userinfo['userid'] and $bloginfo['postedby_userid'] != $vbulletin->userinfo['userid'] and $bloginfo['membermoderate']) or $bloginfo['state'] == 'visible') and !$bloginfo['pending']);
 $show['postcomment'] = fetch_can_comment($bloginfo, $vbulletin->userinfo);
 // *********************************************************************************
 // display ratings
 if ($bloginfo['ratingnum'] >= $vbulletin->options['vbblog_ratingpost']) {
     $bloginfo['ratingavg'] = vb_number_format($bloginfo['ratingtotal'] / $bloginfo['ratingnum'], 2);
     $bloginfo['rating'] = intval(round($bloginfo['ratingtotal'] / $bloginfo['ratingnum']));
     $show['rating'] = true;
 } else {
     $show['rating'] = false;
 }
 // this is for a guest
 $rated = intval(fetch_bbarray_cookie('blog_rate', $bloginfo['blogid']));
 // voted already
 if ($bloginfo['vote'] or $rated) {
     $rate_index = $rated;
     if ($bloginfo['vote']) {
예제 #2
0
	function process_display()
	{
		global $show;

		if (empty($this->bloginfo))
		{
			if ($this->factory->blog_cache["{$this->response['blogid']}"])
			{
				$this->bloginfo = $this->factory->blog_cache["{$this->response['blogid']}"];
			}
			else
			{
				$this->bloginfo = array(
					'blogid'             => $this->response['blogid'],
					'userid'             => $this->response['blog_userid'],
					'usergroupid'        => $this->response['blog_usergroupid'],
					'infractiongroupids' => $this->response['blog_infractiongroupids'],
					'membergroupids'     => $this->response['blog_membergroupids'],
					'memberids'          => $this->response['memberids'],
					'memberblogids'      => $this->response['memberblogids'],
					'postedby_userid'    => $this->response['postedby_userid'],
					'postedby_username'  => $this->response['postedby_username'],
					'grouppermissions'   => $this->response['grouppermissions'],
					'membermoderate'     => $this->response['membermoderate'],
					'allowcomments'      => $this->response['allowcomments'],
					'state'              => $this->response['blog_state'],
					'pending'            => $this->response['pending'],
				);

				if (!isset($this->factory->perm_cache_blog["{$this->bloginfo['userid']}"]))
				{
					$this->factory->perm_cache_blog["{$this->bloginfo['userid']}"] = cache_permissions($this->bloginfo, false);
				}
				else
				{
					$this->bloginfo['permissions'] =& $this->factory->perm_cache_blog["{$this->bloginfo['userid']}"];
				}

				foreach ($this->registry->bf_misc_vbblogsocnetoptions AS $optionname => $optionval)
				{

					if ($this->response['private'])
					{
						$this->bloginfo["guest_$optionname"] = false;
						$this->bloginfo["ignore_$optionname"] = false;
						$this->bloginfo["member_$optionname"] = false;
					}
					else
					{
						$this->bloginfo["member_$optionname"] = ($this->response['options_member'] & $optionval ? 1 : 0);
						$this->bloginfo["guest_$optionname"] = ($this->response['options_guest'] & $optionval ? 1 : 0);
						$this->bloginfo["ignore_$optionname"] = ($this->response['options_ignore'] & $optionval ? 1 : 0);
					}
					$this->bloginfo["buddy_$optionname"] = ($this->response['options_buddy'] & $optionval ? 1 : 0);

					$this->bloginfo["$optionname"] = (
						(
							(
								!$this->response['buddyid']
									OR
								$this->bloginfo["buddy_$optionname"]
							)
							AND
							(
								!$this->response['ignoreid']
									OR
								$this->bloginfo["ignore_$optionname"]
							)
							AND
							(
								(
									$this->bloginfo["member_$optionname"]
										AND
									$this->registry->userinfo['userid']
								)
								OR
								(
									$this->bloginfo["guest_$optionname"]
										AND
									!$this->registry->userinfo['userid']
								)
							)
						)
						OR
						(
							$this->bloginfo["ignore_$optionname"]
								AND
							$this->response['ignoreid']
						)
						OR
						(
							$this->bloginfo["buddy_$optionname"]
								AND
							$this->response['buddyid']
						)
						OR
							is_member_of_blog($this->registry->userinfo, $this->bloginfo)
						OR
							can_moderate_blog()
					) ? true : false;
				}

				$this->factory->blog_cache["{$this->response['blogid']}"] = $this->bloginfo;
			}
		}

		$show['quotecomment'] = fetch_can_comment($this->bloginfo, $this->registry->userinfo);
		$show['entryposter'] = ($this->userinfo AND $this->response['userid'] == $this->bloginfo['postedby_userid']);
		$show['moderation'] = ($this->response['state'] == 'moderation');
		$show['private'] = false;
		if ($this->response['private'])
		{
			$show['private'] = true;
		}
		else if (can_moderate() AND $this->response['blog_userid'] != $this->registry->userinfo['userid'])
		{
			$membercanview = $this->response['options_member'] & $this->registry->bf_misc_vbblogsocnetoptions['canviewmyblog'];
			$buddiescanview = $this->response['options_buddy'] & $this->registry->bf_misc_vbblogsocnetoptions['canviewmyblog'];

			if (!$membercanview AND (!$this->response['buddyid'] OR !$buddiescanview))
			{
				$show['private'] = true;
			}
		}

		$show['edit'] = fetch_comment_perm('caneditcomments', $this->bloginfo, $this->response);
		$show['inlinemod'] = (
			(
				fetch_comment_perm('canremovecomments', $this->bloginfo)
					OR
				fetch_comment_perm('candeletecomments', $this->bloginfo)
					OR
				fetch_comment_perm('canmoderatecomments', $this->bloginfo)
					OR
				fetch_comment_perm('canundeletecomments', $this->bloginfo)
			)
				AND
			(
				can_moderate_blog()
					OR
				(
					!empty($this->userinfo)
						AND
					is_member_of_blog($this->registry->userinfo, $this->userinfo)
				)
			)
		);

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

	}