Esempio n. 1
0
	/**
		* moves cached files from temporary cache-dir to their final destination
		* 
	 */
	function launchCache($spid, $variation) {
		global $c;

		if ($c["renderstatichtml"]) {
			forceDirectories ($c["tmpcachepath"]);

			$spname = getSPNameUrlSafe($spid);
			nxCopy($c["tmpcachepath"] .$spname ."_" . $spid . "_v" . $variation . ".html", $c["cachepath"], $spname."_". $spid . "_v" . $variation . ".html");
			@unlink ($c["tmpcachepath"]. $spname ."_" . $spid . "_v" . $variation . ".html");
		}
	}
Esempio n. 2
0
	/**
	 * returns the uri for a menu-item
	 * @param integer ID of the Sitepage
	 * @param integer ID of the VARIATION
	 * @param array additional parameters, use: array('varname1'=>'value1', 'varname2'=>'value2'), the routine encodes the values with rawurlencode (RFC 1738), using array('value1','value2') results in '&var0=value1&var1=value2'
	 * @return string uri for menu-item.
	 */
	function getMenuLink($spid, $variation = 0, $addparas = null) {
		global $c, $is_development;

		global $c_sessionidname;
		global $v;

		if ($variation == 0)
			$variation = $v;

		$sessionid = $addparas[$c_sessionidname];
		$sessionid = ($sessionid != "") ? $sessionid : value($c_sessionidname, "NOSPACES");
		$linkadd = ($sessionid != "") ? ('&' . $c_sessionidname . '=' . $sessionid) : "";

		if (is_array($addparas))
			foreach ($addparas as $key => $value) {
				if ($key != $c_sessionidname)
					$linkadd .= '&' . ((is_int($key)) ? 'var' . $key : $key) . '=' . rawurlencode($value);
			}

		//if (isSPVarLive($spid, $variation)) { // Live-Version
		if (!isset($is_development) || $is_development == false) { // Live-Version
			$mn = getDBCell("sitepage", "MENU_ID", "SPID = $spid");

			$lc = getDBCell("sitemap", "IS_CACHED", "MENU_ID = $mn");

			if ($c["renderstatichtml"] && $lc == 1) {
				$spname = getSPNameUrlSafe($spid);

				$link_uri = $c["cachedocroot"] . $spname . "_" . $spid . "_v" . $variation . ".html";
				// $link_uri = $c["cachedocroot"]."p".$spid."_v".$variation.(($linkadd=="")?".html":".php?");
				return ($link_uri);
			} else {
				$template = getTemplate($spid);

				$link_uri = $c["docroothtml"] . $template . "?page=" . $spid . "&v=" . $variation;
				return ($link_uri . $linkadd);
			}
		} else { // Development- (Template-) Version
			$template = getTemplate($spid);

			$link_uri = $c["devdocroot"] . $template . "?page=" . $spid . "&v=" . $variation;
			return ($link_uri . $linkadd);
		}
	}
Esempio n. 3
0
	/**
	 * returns the uri for this menu-item
	 * @param array additional parameters, use: array('varname1'=>'value1', 'varname2'=>'value2'), the routine encodes the values with rawurlencode (RFC 1738), using array('value1','value2') results in '&var0=value1&var1=value2'
	 * @return string uri for menu-item.
	 */
	function getLink($addparas = null) {
		global $c;

		$sessionid = $addparas[$c["sessionidname"]];
		$sessionid = ($sessionid != "") ? $sessionid : value($c["sessionidname"], "NOSPACES");
		$linkadd = ($sessionid != "" && $sessionid != "0") ? ('&' . $c["sessionidname"] . '=' . $sessionid) : "";

		if (is_array($addparas)) {
			foreach ($addparas as $key => $value) {
				if ($key != $c["sessionidname"])
					$linkadd .= '&' . ((is_int($key)) ? 'var' . $key : $key) . '=' . rawurlencode($value);
			}
		}
				
		
		if ($this->level == 10) { // Live-Version			
			$cached = getDBCell("sitemap", "IS_CACHED", "MENU_ID = $this->menuId");

			if (!$c["classicurls"]) {
			  return $c["docroothtml"].getPageURL($this->menuId, $this->variation);
			} else {
				if ($c["renderstatichtml"] && ($cached == 1)) {
					$spname = getSPNameUrlSafe($this->pageId);
					$link_uri = $c["cachedocroot"] . $spname . "_" . $this->pageId . "_v" . $this->variation . ".html";

					return ($link_uri);
				} else {
					$template = $this->getTemplate();
					$link_uri = $c["docroothtml"] . $template . "?page=" . $this->pageId . "&v=" . $this->variation;
					return ($link_uri . $linkadd);
				}
			}
		} else { // Development- (Template-) Version
			$template = $this->getTemplate();
			$link_uri = $c["devdocroot"] . $template . "?page=" . $this->pageId . "&v=" . $this->variation;
			return ($link_uri . $linkadd);
		}
	}