Esempio n. 1
0
	/**
	* Processes any attachments to this post.
	*/
	function process_attachments()
	{
		$forumperms = fetch_permissions($this->thread['forumid']);
		require_once(DIR . '/packages/vbattach/attach.php');
		$attach = new vB_Attach_Display_Content($this->registry, 'vBForum_Post');
		$attach->process_attachments(
			$this->post,
			$this->post['attachments'],
			(THIS_SCRIPT == 'external'),
			can_moderate($this->forum['forumid'], 'canmoderateattachments'),
			$forumperms & $this->registry->bf_ugp_forumpermissions['cangetattachment'],
			$forumperms & $this->registry->bf_ugp_forumpermissions['canseethumbnails']
		);
	}
Esempio n. 2
0
	public function getRendered($forceload = false)
	{
		$context = new vB_Context($this->package . '_' . $this->class . '_pagetext_' ,
			array( 'nodeid' => $this->nodeid,
			'permissions' => vB::$vbulletin->userinfo['permissions']['cms']));
		$hashkey = strval($context);
		if (!$forceload AND ($rendered = vB_Cache::instance()->read($hashkey, true, true)))
		{
			return $rendered;
		}
		$this->Load(self::INFO_CONTENT);

		$bbcode_parser = new vBCms_BBCode_HTML(vB::$vbulletin, vBCms_BBCode_HTML::fetchCmsTags());
		$bbcode_parser->setCanDownload($this->canDownload());
		$pages = array();
		// Articles will generally have an attachment but they should still keep a counter so that this query isn't always running
		require_once(DIR . '/packages/vbattach/attach.php');
		if ($this->canDownload())
		{
			$viewinfo = array();
			$attach = new vB_Attach_Display_Content(vB::$vbulletin, 'vBCms_Article');
			$attachments = $attach->fetch_postattach(0, $this->nodeid);
			$bbcode_parser->attachments = $attachments;
			$bbcode_parser->unsetattach = true;
		}

		$validpage = true;
		$pageno = 1;

		require_once DIR . '/includes/functions.php';
		while($validpage)
		{
			$bbcode_parser->setOutputPage($pageno);

			$pagetext = fetch_censored_text($bbcode_parser->do_parse(
				$this->pagetext,
				vBCMS_Permissions::canUseHtml($this->nodeid, $this->contenttypeid, $this->userid),
				$this->htmlstate
				));

			$validpage = $bbcode_parser->fetchedValidPage();

			if ($pageno == 1)
			{
				$pagelist = $bbcode_parser->getPageTitles();
			}

			if ($validpage)
			{
				$pages[$pageno] = $pagetext;
			}

			$pageno++;
		}
		if ($this->canDownload())
		{
			$attach->process_attachments($viewinfo, $bbcode_parser->attachments, false, false, true, false, true);
		}

		$rendered = array('pages' => $pages, 'attachments' => $bbcode_parser->attachments,
			'viewinfo' => $viewinfo, 'pagelist' => $pagelist);
		vB_Cache::instance()->write($hashkey ,
			$rendered, 1440, array_merge($this->getCacheEvents(), array($this->getContentCacheEvent())));
		//If we updated the page text we need to also update the preview.
		$this->getPreviewText(true);
		return $rendered;
	}
Esempio n. 3
0
 /**
  * Processes any attachments to this post.
  */
 function process_attachments()
 {
     global $show;
     $forumperms = fetch_permissions($this->thread['forumid']);
     require_once DIR . '/packages/vbattach/attach.php';
     $attach = new vB_Attach_Display_Content($this->registry, 'vBForum_Post');
     if ($this->post['allattachments']) {
         foreach ($this->post['allattachments'] as $attachmentid => $info) {
             if (!$this->post['attachments'][$attachmentid]) {
                 unset($this->post['allattachments'][$attachmentid]);
             }
         }
         $attach->process_attachments($this->post, $this->post['allattachments'], THIS_SCRIPT == 'external', can_moderate($this->forum['forumid'], 'canmoderateattachments'), $forumperms & $this->registry->bf_ugp_forumpermissions['cangetattachment'], $forumperms & $this->registry->bf_ugp_forumpermissions['canseethumbnails']);
     } else {
         $show['attachments'] = $show['moderatedattachment'] = $show['thumbnailattachment'] = $show['otherattachment'] = false;
         $show['imageattachment'] = $show['imageattachmentlink'] = false;
     }
 }
Esempio n. 4
0
	/**
	* Processes any attachments to this entry.
	*/
	function process_attachments()
	{
		require_once(DIR . '/packages/vbattach/attach.php');
		$attach = new vB_Attach_Display_Content($this->registry, 'vBBlog_BlogEntry');
		$attach->process_attachments($this->blog, $this->attachments, (THIS_SCRIPT == 'blogexternal'), true, true, true);
	}