Exemple #1
0
	/**
	 * Inflate dynamic segments to canonical values.
	 */
	public function inflateSegments()
	{
		$node = new vBCms_Item_Content($this->node);

		if (!$node->isValid())
		{
			return;
		}

		if ($this->node != ($segment = $node->getUrlSegment()))
		{
			$this->setSegment('node', $segment, true);
		}
	}
Exemple #2
0
	/**
	 * Fetches the URL segment of the content.
	 *
	 * @return string
	 */
	public function getNodeURLSegment()
	{
		$this->loadContent();

		return $this->content->getUrlSegment();
	}
Exemple #3
0
	/**
	 * Inflate dynamic segments to canonical values.
	 */
	public function inflateSegments()
	{
		// Ensure we can resolve the value
		if (!$value = intval($this->value))
		{
			return;
		}

		// Inflate section
		if ('section' == $this->type)
		{
			$node = new vBCms_Item_Content($value);

			if (!$node->isValid())
			{
				return;
			}

			if ($this->value != ($segment = $node->getUrlSegment()))
			{
				$this->setSegment('value', $segment, true);
			}

			return;
		}

		// Inflate author
		if ('author' == $this->type)
		{
			// TODO: Need a model for users
			$result = vB::$vbulletin->db->query_first("
				SELECT username FROM " . TABLE_PREFIX . "user
				WHERE userid = $value
				AND username != ''
			");

			if ($result)
			{
				$this->setSegment('value', vBCms_Item_Content::buildUrlSegment($value, $result['username']), true);
			}

			return;
		}

		// Inflate category
		if ('category' == $this->type)
		{
			// TODO: Need a model for categories
			$result = vB::$vbulletin->db->query_first("
				SELECT category FROM " . TABLE_PREFIX . "cms_category
				WHERE categoryid = $value
				AND category != ''
			");

			if ($result)
			{
				$url = vB_Search_Searchtools::stripHtmlTags($record['category']);
				$segments['value'] .= '-' . str_replace(' ', '-', $url) ;

				$this->setSegment('value', vBCms_Item_Content::buildUrlSegment($value, $result['category']), true);
			}
		}
	}