예제 #1
0
	/**
	* Processes miscellaneous post items at the end of the construction process.
	*/
	function prep_post_end()
	{
		global $show;

		// check for autoscrolling
		global $postid, $onload, $threadedmode;
		if ($this->post['postid'] == $postid)
		{
			$this->post['scrolltothis'] = ' id="currentPost"';
			if ($threadedmode == 0)
			{
				$onload = htmlspecialchars_uni("if (document.body.scrollIntoView && fetch_object('currentPost') && (window.location.href.indexOf('#') == -1 || window.location.href.indexOf('#post') > -1)) { fetch_object('currentPost').scrollIntoView(true); }");
			}
		}
		else
		{
			$this->post['scrolltothis'] = '';
		}

		// highlight words from search engine ($_REQUEST[highlight])
		// Highlight word in all posts even if we link to one post since if we come from "Last Page" in thread search results, we don't only care about the last post!
		if (!empty($this->highlight) AND is_array($this->highlight)) // AND ($_REQUEST['postid'] == $post['postid'] OR empty($_REQUEST['postid'])) )
		{
			$this->post['message'] = preg_replace('#(^|>)([^<]+)(?=<|$)#sUe', "\$this->process_highlight_postbit('\\2', \$this->highlight, '\\1')", $this->post['message']);
			$this->post['message'] = preg_replace('#<vb_highlight>(.*)</vb_highlight>#siU', '<span class="highlight">$1</span>', $this->post['message']);
		}

		// hide edit button if they can't use it
		$forumperms = fetch_permissions($this->thread['forumid']);
		if (
			!$this->thread['isdeleted'] AND !$this->post['isdeleted'] AND (
			can_moderate($this->thread['forumid'], 'caneditposts') OR
			//can_moderate($this->thread['forumid'], 'candeleteposts') OR
			(
				$this->thread['open'] AND
				$this->post['userid'] == $this->registry->userinfo['userid'] AND
				($forumperms & $this->registry->bf_ugp_forumpermissions['caneditpost']) AND
				(	$this->post['dateline'] >= (TIMENOW - ($this->registry->options['edittimelimit'] * 60)) OR
					$this->registry->options['edittimelimit'] == 0
				)
			))
		)
		{
			// can edit or delete this post, so show the link
			$this->post['editlink'] = 'editpost.php?' . $this->registry->session->vars['sessionurl'] . 'do=editpost&amp;p=' . $this->post['postid'];
			if ($this->registry->options['quickedit'])
			{
				$show['ajax_js'] = true;
			}
		}
		else
		{
			$this->post['editlink'] = '';
		}

		if (
			!$this->thread['isdeleted'] AND
			!$this->post['isdeleted'] AND
			 $this->forum['allowposting'] AND
			!$show['search_engine'] AND
			($this->thread['open'] OR can_moderate($this->thread['forumid'], 'canopenclose'))
		)
		{
			$this->post['replylink'] = 'newreply.php?' . $this->registry->session->vars['sessionurl'] . 'do=newreply&amp;p=' . $this->post['postid'];
			if ($show['multiquote_global'])
			{
				$show['multiquote_post'] = true;
				$show['multiquote_selected'] = (is_array($this->registry->GPC['vbulletin_multiquote']) AND in_array($this->post['postid'], $this->registry->GPC['vbulletin_multiquote']));
			}
		}
		else
		{
			$this->post['replylink'] = '';
			$show['multiquote_post'] = false;
		}

		if (!empty($this->post['del_reason']))
		{
			$this->post['del_reason'] = fetch_censored_text($this->post['del_reason']);
		}

		$this->post['forwardlink'] = '';

		$this->post['reportlink'] = 'report.php?' . $this->registry->session->vars['sessionurl'] . 'p=' . $this->post['postid'];
		$show['reportlink'] = (
			$this->registry->userinfo['userid']
			AND ($this->registry->options['rpforumid'] OR
				($this->registry->options['enableemail'] AND $this->registry->options['rpemail']))
		);
		$show['postcount'] = (!empty($this->post['postcount']) AND !$show['search_engine']);
		$show['reputationlink'] = (
			($this->registry->userinfo['permissions']['genericpermissions'] & $this->registry->bf_ugp_genericpermissions['canuserep']
				OR $this->post['userid'] == $this->registry->userinfo['userid'])
			AND $this->registry->options['reputationenable']
			AND $this->registry->userinfo['userid']
			AND $this->post['userid']
			AND $this->post['visible'] != 2
			AND $this->registry->usergroupcache[$this->post['usergroupid']]['genericoptions'] & $this->registry->bf_ugp_genericoptions['isnotbannedgroup']
		);

		$show['infractionlink'] = (
			// Must have 'cangiveinfraction' permission. Branch dies right here majority of the time
			$this->registry->userinfo['permissions']['genericpermissions'] & $this->registry->bf_ugp_genericpermissions['cangiveinfraction']
			// Can not give yourself an infraction
			AND $this->post['userid'] != $this->registry->userinfo['userid']
			// Can not give an infraction to a post that already has one
			AND empty($this->post['infraction'])
			// Can not give an admin an infraction
			AND !($this->cache['perms'][$this->post['userid']]['adminpermissions'] & $this->registry->bf_ugp_adminpermissions['cancontrolpanel'])
			// Only Admins can give a supermod an infraction
			AND 			(
				!($this->cache['perms'][$this->post['userid']]['adminpermissions'] & $this->registry->bf_ugp_adminpermissions['ismoderator'])
				OR $this->registry->userinfo['permissions']['adminpermissions'] & $this->registry->bf_ugp_adminpermissions['cancontrolpanel']
			)
			// Can not give guests infractions
			AND $this->post['userid']
		);

		// need to see the card to be able to remove it. 'cansee' is designed for groups who can't give infractions
		$canseeinfraction = (
			$this->registry->userinfo['permissions']['genericpermissions'] & $this->registry->bf_ugp_genericpermissions['canreverseinfraction']
			OR $this->registry->userinfo['permissions']['genericpermissions'] & $this->registry->bf_ugp_genericpermissions['canseeinfraction']
			OR $this->registry->userinfo['permissions']['genericpermissions'] & $this->registry->bf_ugp_genericpermissions['cangiveinfraction']
			OR ($this->post['userid'] == $this->registry->userinfo['userid'] /*AND $this->registry->options['canseeown']*/)
		);
		$show['redcard'] = ($this->post['infraction'] == 2 AND $canseeinfraction);
		$show['yellowcard'] = ($this->post['infraction'] == 1 AND $canseeinfraction);
		$show['moderated'] = (!$this->post['visible'] OR (!$this->thread['visible'] AND $this->post['postcount'] == 1)) ? true : false;
		$show['spam'] = ($show['moderated'] AND $this->post['spamlog_postid']) ? true : false;
		$show['deletedpost'] = ($this->post['visible'] == 2 OR ($this->thread['visible'] == 2 AND $this->post['postcount'] == 1)) ? true : false;

		parent::prep_post_end();
	}
예제 #2
0
 /**
  * Processes miscellaneous post items at the end of the construction process.
  */
 function prep_post_end()
 {
     global $show;
     // check for autoscrolling
     global $postid, $onload, $threadedmode;
     if ($this->post['postid'] == $postid) {
         $this->post['scrolltothis'] = ' id="currentPost"';
         if ($threadedmode == 0) {
             $onload = htmlspecialchars_uni("if (document.body.scrollIntoView && fetch_object('currentPost') && (window.location.href.indexOf('#') == -1 || window.location.href.indexOf('#post') > -1)) { fetch_object('currentPost').scrollIntoView(true); }");
         }
     } else {
         $this->post['scrolltothis'] = '';
     }
     // highlight words from search engine ($_REQUEST[highlight])
     // Highlight word in all posts even if we link to one post since if we come from "Last Page" in thread search results, we don't only care about the last post!
     if (!empty($this->highlight) and is_array($this->highlight)) {
         $this->post['message'] = preg_replace('#(^|>)([^<]+)(?=<|$)#sUe', "\$this->process_highlight_postbit('\\2', \$this->highlight, '\\1')", $this->post['message']);
         $this->post['message'] = preg_replace('#<vb_highlight>(.*)</vb_highlight>#siU', '<span class="highlight">$1</span>', $this->post['message']);
     }
     // hide edit button if they can't use it
     $forumperms = fetch_permissions($this->thread['forumid']);
     if (!$this->thread['isdeleted'] and !$this->post['isdeleted'] and (can_moderate($this->thread['forumid'], 'caneditposts') or $this->thread['open'] and $this->post['userid'] == $this->registry->userinfo['userid'] and $forumperms & $this->registry->bf_ugp_forumpermissions['caneditpost'] and ($this->post['dateline'] >= TIMENOW - $this->registry->options['edittimelimit'] * 60 or $this->registry->options['edittimelimit'] == 0))) {
         // can edit or delete this post, so show the link
         $this->post['editlink'] = fetch_seo_url('editpost', $this->post, array('do' => 'editpost'));
         if ($this->registry->options['quickedit']) {
             $show['ajax_js'] = true;
         }
     } else {
         $this->post['editlink'] = '';
     }
     if (!$this->thread['isdeleted'] and !$this->post['isdeleted'] and $this->forum['allowposting'] and !$show['search_engine'] and ($this->thread['open'] or can_moderate($this->thread['forumid'], 'canopenclose'))) {
         $this->post['replylink'] = fetch_seo_url('newreply', array(), array('do' => 'newreply', 'p' => $this->post['postid']));
         if ($show['multiquote_global']) {
             $show['multiquote_post'] = true;
             $show['multiquote_selected'] = (is_array($this->registry->GPC['vbulletin_multiquote']) and in_array($this->post['postid'], $this->registry->GPC['vbulletin_multiquote']));
         }
     } else {
         $this->post['replylink'] = '';
         $show['multiquote_post'] = false;
     }
     if (!empty($this->post['del_reason'])) {
         $this->post['del_reason'] = fetch_censored_text($this->post['del_reason']);
     }
     if (!empty($this->registry->options['apipostidmanage']['enable']) and $this->registry->options['apipostidmanage']['enable'] and $this->post['mobile_platformname']) {
         $platformname = strtolower($this->post['mobile_platformname']);
         if (preg_match('#^(iphone|ipad|ipod)#s', $platformname)) {
             $platformname = 'iphone';
         }
         if (isset($this->registry->options['apipostidmanage'][$platformname])) {
             $this->post['api_platform'] = $platformname;
             $this->post['api_platform_link'] = $this->registry->options['apipostidmanage'][$platformname] ? $this->registry->options['apipostidmanage'][$platformname] : '';
             $this->post['api_platform_link_phrase'] = 'posted_from_app_' . $platformname;
             $this->post['api_platform_link_title'] = 'goto_app_' . $platformname;
         } else {
             $this->post['api_platform'] = '';
         }
     }
     $this->post['forwardlink'] = '';
     $this->post['reportlink'] = 'report.php?' . $this->registry->session->vars['sessionurl'] . 'p=' . $this->post['postid'];
     $show['reportlink'] = ($this->registry->userinfo['userid'] and ($this->registry->options['rpforumid'] or $this->registry->options['enableemail'] and $this->registry->options['rpemail']));
     $show['postcount'] = (!empty($this->post['postcount']) and !$show['search_engine']);
     $show['reputationlink'] = (($this->registry->userinfo['permissions']['genericpermissions'] & $this->registry->bf_ugp_genericpermissions['canuserep'] or $this->post['userid'] == $this->registry->userinfo['userid']) and $this->registry->options['reputationenable'] and $this->registry->userinfo['userid'] and $this->post['userid'] and $this->post['visible'] != 2 and $this->forum['options'] & $this->registry->bf_misc_forumoptions['canreputation'] and ($this->registry->options['showrepinown'] or $this->registry->userinfo['userid'] != $this->post['userid']) and $this->registry->usergroupcache[$this->post['usergroupid']]['genericoptions'] & $this->registry->bf_ugp_genericoptions['isnotbannedgroup']);
     $show['infractionlink'] = ($this->registry->userinfo['permissions']['genericpermissions'] & $this->registry->bf_ugp_genericpermissions['cangiveinfraction'] and $this->post['userid'] != $this->registry->userinfo['userid'] and empty($this->post['infraction']) and !($this->cache['perms'][$this->post['userid']]['adminpermissions'] & $this->registry->bf_ugp_adminpermissions['cancontrolpanel']) and (!($this->cache['perms'][$this->post['userid']]['adminpermissions'] & $this->registry->bf_ugp_adminpermissions['ismoderator']) or $this->registry->userinfo['permissions']['adminpermissions'] & $this->registry->bf_ugp_adminpermissions['cancontrolpanel']) and $this->post['userid']);
     // need to see the card to be able to remove it. 'cansee' is designed for groups who can't give infractions
     $canseeinfraction = ($this->registry->userinfo['permissions']['genericpermissions'] & $this->registry->bf_ugp_genericpermissions['canreverseinfraction'] or $this->registry->userinfo['permissions']['genericpermissions'] & $this->registry->bf_ugp_genericpermissions['canseeinfraction'] or $this->registry->userinfo['permissions']['genericpermissions'] & $this->registry->bf_ugp_genericpermissions['cangiveinfraction'] or $this->post['userid'] == $this->registry->userinfo['userid']);
     $show['redcard'] = ($this->post['infraction'] == 2 and $canseeinfraction);
     $show['yellowcard'] = ($this->post['infraction'] == 1 and $canseeinfraction);
     $show['moderated'] = (!$this->post['visible'] or !$this->thread['visible'] and $this->post['postcount'] == 1) ? true : false;
     $show['spam'] = ($show['moderated'] and $this->post['spamlog_postid']) ? true : false;
     $show['deletedpost'] = ($this->post['visible'] == 2 or $this->thread['visible'] == 2 and $this->post['postcount'] == 1) ? true : false;
     parent::prep_post_end();
 }