A small patch to make the extension
tx_externalpageset work with the extension
realurl. It does also allow links to non html content like image media, as it translates only links to html pages.
Sorry my first version had an error rendering external links unusable, so please use this new patch as of 15. March 08.
--- class.tx_externalpageset_pi1_org.php 2008-03-04 19:16:46.073367155 +0100 +++ class.tx_externalpageset_pi1.php 2008-03-15 09:39:08.565002000 +0100 @@ -54,6 +54,7 @@ $fileInfo = t3lib_div::split_fileref($this->conf["rootFile"]); $vPath = ""; $this->vURL; + /* if (t3lib_div::GPvar("vURL")) { $this->vURL = t3lib_div::GPvar("vURL"); @@ -61,12 +62,21 @@ $vPath = $fileInfo["path"]; $vPath .= t3lib_div::GPvar("vURL"); } + */ + $txl=t3lib_div::_GET("tx_externalpageset_pi1"); + $vURL=urldecode($txl['vURL']); + if ($vURL) + { + $this->vURL = $vURL; + if (strncasecmp($vURL,"http:",5)!=0) + $vPath = $fileInfo["path"]; + $vPath .= $vURL; + } else { $vPath = $fileInfo["path"]; $vPath .= $fileInfo["file"]; } - // SECURITY : Make sure the link doesn't backtrack beyond the rootPath $fullBasePath = realpath($fileInfo["path"]); if (strncasecmp(realpath($vPath),$fullBasePath,strlen($fullBasePath))!=0) @@ -79,7 +89,6 @@ $cl=apache_lookup_uri($vPath); $vPathFile = $cl->filename; } - // Extract out content and extract the <TITLE> and <BODY> part $htmlContent = t3lib_div::getURL($vPathFile);$htmlTitle = ""; if ($this->conf["extractBodyTitle"] == 1) @@ -106,7 +115,7 @@ // Modified version from libraries to suit our needs // Simply builds a link to the current page. // Accounting for ID and TYPE values - function getLinkUrl($id="") + function getOldLinkUrl($id="") { $queryString=array(); $queryString["id"] = 'id='.($id ? $id : $GLOBALS["TSFE"]->id); @@ -114,6 +123,11 @@ $queryString["type"]= 'type='.$GLOBALS["TSFE"]->type; return $GLOBALS["TSFE"]->absRefPrefix.'index.php?'.implode($queryString,"&"); } + function getLinkUrl($id="") + { + //needed? $this->piVars['id']=($id ? $id : $GLOBALS["TSFE"]->id); + return $this->pi_linkTP_keepPIvars_url(); + } // Modified version of the HTML Parser one to do my special cHash needs @@ -170,9 +184,8 @@ $linkSection = $pieces[1]?"#".$pieces[1]:""; $src = $pieces[0]; - // Process the link itself - if (strncasecmp($src,"http:",5)==0) + if (strncasecmp($src,"http:",5)==0) { if ($this->conf["remapExternal"] == 1) { @@ -181,7 +194,7 @@ $addQueryParams = trim($this->cObj->stdWrap($temp_conf["additionalParams"],$temp_conf["additionalParams."])); $pA=$GLOBALS["TSFE"]->cHashParams($addQueryParams); $addQueryParams.="&cHash=".t3lib_div::shortMD5(serialize($pA)); - $params[0]["href"] = $this->getLinkUrl().$addQueryParams.$linkSection; + $params[0]["href"] = $this->getOldLinkUrl().$addQueryParams.$linkSection; $somethingDone=1; } else @@ -191,7 +204,14 @@ } else { - if ($this->conf["remapRelative"] == 1) + // non html file show direct + if ((strncasecmp(substr($src,-4),".htm",4)!=0) && + (strncasecmp(substr($src,-5),".html",5)!=0)) { + // make link to relative content absolute + $params[0]["href"]='/'.$basePath.$src; + $somethingDone=1; + } + else if ($this->conf["remapRelative"] == 1) { $temp_conf=$this->typolink_conf; @@ -210,7 +230,13 @@ $addQueryParams = trim($this->cObj->stdWrap($temp_conf["additionalParams"],$temp_conf["additionalParams."])); $pA=$GLOBALS["TSFE"]->cHashParams($addQueryParams); $addQueryParams.="&cHash=".t3lib_div::shortMD5(serialize($pA)); - $params[0]["href"] = $this->getLinkUrl().$addQueryParams.$linkSection; + $zparms=explode('&',$addQueryParams); + foreach ($zparms as $val) { + list($za,$zb)=explode('=',$val); + $this->piVars[$za]=$zb; + } + //$params[0]["href"] = $this->getLinkUrl().$addQueryParams.$linkSection; + $params[0]["href"] = $this->getLinkUrl().$linkSection; $somethingDone=1; } }
Keine Einträge
Keine Einträge im Gästebuch gefunden.