예제 #1
0
}
$pagenumber = $vbulletin->GPC['pagenumber'];
if (!$show['threadrating'] or !$vbulletin->options['allowthreadedmode']) {
    $nodhtmlcolspan = 'colspan="2"';
}
$pageinfo_linear = array('p' => $FIRSTPOSTID, 'mode' => 'linear');
$pageinfo_hybrid = array('mode' => 'hybrid');
$pageinfo_threaded = array('p' => $FIRSTPOSTID, 'mode' => 'threaded');
if ($vbulletin->GPC['highlight']) {
    $pageinfo_linear['highlight'] = $pageinfo_hybrid['highlight'] = $pageinfo_threaded['highlight'] = urlencode($vbulletin->GPC['highlight']);
}
if ($show['guestview']) {
    // facebook options
    if (is_facebookenabled()) {
        // display publish to Facebook checkbox in quick editor?
        $fbpublishcheckbox = construct_fbpublishcheckbox();
    }
    // display the like button for this thread?
    $fblikebutton = construct_fblikebutton();
}
// Record thread as viewed.
if ($vbulletin->options['who_read']) {
    mark_content_read('vBForum_Thread', $thread['threadid'], 'view');
}
($hook = vBulletinHook::fetch_hook('showthread_complete')) ? eval($hook) : false;
$thread_url = vB_Friendly_Url::fetchLibrary($vbulletin, 'thread|js', $threadinfo, array('pagenumber' => $vbulletin->GPC['pagenumber']))->get_url();
// #############################################################################
// output page
$templater = vB_Template::create('SHOWTHREAD');
$templater->register_page_templates();
$templater->register('pagenumbers', fetch_start_end_total_array($vbulletin->GPC['pagenumber'], $perpage, $totalposts));
예제 #2
0
	/**
	 * Fetches the standard page view .
	 * @param integer $nodeid - node for which we are displaying comments
	 *
	 * @return vBCms_View				- The resolved view, or array of views
	 */
	public function getPageView($nodeid, $target_url)
	{
		global $vbphrase;

		require_once DIR . '/includes/functions_editor.php';

			vB::$vbulletin->input->clean_array_gpc('r', array(
			'nodeid'     => vB_Input::TYPE_INT,
			'page' => vB_Input::TYPE_INT,
			'direction' => vB_Input::TYPE_STR,
			'postid' => vB_Input::TYPE_UINT
		));

		if (! $row = vB::$vbulletin->db->query_first("SELECT node.comments_enabled, node.setpublish, node.publishdate,
		 nodeinfo.associatedthreadid,	thread.forumid FROM "
		. TABLE_PREFIX . "cms_node AS node LEFT JOIN "
		. TABLE_PREFIX . "cms_nodeinfo AS nodeinfo ON node.nodeid = nodeinfo.nodeid LEFT JOIN "
		. TABLE_PREFIX . "thread AS thread on thread.threadID = nodeinfo.associatedthreadid
			WHERE	nodeinfo.nodeid = $nodeid LIMIT 1;" ))
		{
			return false;
		}

		if (! $row['comments_enabled'] OR !$row['setpublish'] OR ($row['publishdate'] > TIMENOW))
		{
			return false;
		}

		if (! intval($row['forumid']))
		{
			$this->repairComments($row['associatedthreadid']);
		}

		if (!intval($row['associatedthreadid']))
		{
			return false;
		}

		$associatedthreadid = $row['associatedthreadid'];
		
		$base_url = empty($target_url) ? vB_Router::getCurrentURL() : $target_url;


		// Create view
		$view = new vB_View('vbcms_comments_page');
		$view->nodeid = $nodeid;
		$view->threadid = $row['associatedthreadid'];
		$view->this_url = str_replace('&', '&', $base_url);

		// display publish to Facebook checkbox in quick editor?
		if (is_facebookenabled())
		{
			$view->fbpublishcheckbox = construct_fbpublishcheckbox();
		}

		$this_user = new vB_Legacy_CurrentUser();

		$pageno = vB::$vbulletin->GPC_exists['page'] ?
			vB::$vbulletin->GPC['page'] : 1;
		$view->pageno = $pageno;
		$view->node_comments = self::showComments($view->nodeid,
			$this_user, $pageno, 20, $target_url, $associatedthreadid);

		// make sure user has permission to post comment before displaying comment editor
		if (self::canPostComment($view->threadid, $this_user))
		{
			// prepare the wyswiwig editor for comments
			$view->show_comment_editor = true;
			global $messagearea;
			$editor_name = construct_edit_toolbar('');
			$view->messagearea = $messagearea;//
			$view->editor_name = $editor_name;

			// include captcha validation and guest username field
			if (fetch_require_hvcheck('post'))
			{
				require_once(DIR . '/includes/class_humanverify.php');
				$reg = vB::$vbulletin;
				$verification =& vB_HumanVerify::fetch_library($reg);
				$human_verify = $verification->output_token();
			}
			else
			{
				$human_verify = '';
			}
			$view->human_verify = $human_verify;
			$view->usernamecode = new vB_View('newpost_usernamecode');
		}
		else
		{
			$view->show_comment_editor = false;
		}

		return $view;
	}