DeanC, on 20 October 2009 - 09:03 AM, said:
- ta Dean.
Here's an "unofficial manager mod" but I've posted it here because it follows on...
//define characters to be passed (ignored)through snippet parameters
$newParams = array("&&" , "??" );
$tempReplace=array("%amp%", "%quest%");
$oldParams = array("&", "?" );
for($i=0; $i<$nrSnippetsToGet; $i++) {
$parameter = array();
$snippetName = $this->currentSnippet = $snippets[$i]['name'];
$currentSnippetParams = $snippetParams[$i];
if(!empty($currentSnippetParams)) {
//replace & and ? in parameters to catch later
//substitute flagged characters with a temporary placeholder
$tempSnippetParams = str_replace($newParams, $tempReplace, $currentSnippetParams);
$tempSnippetParams = str_replace("?", "", $tempSnippetParams);
$splitter = strpos($tempSnippetParams, "&")> 0 ? "&" : "&";
$tempSnippetParams = explode($splitter, $tempSnippetParams);
for($x=0; $x<count($tempSnippetParams); $x++) {
$parameterTemp = explode("=", $tempSnippetParams[$x],2);
//put required characters back in
$parameter[$parameterTemp[0]] = str_replace($tempReplace, $oldParams, $parameterTemp[1]);
}
}
$executedSnippets[$i] = $this->evalSnippet($snippets[$i]['snippet'], $parameter);
if($this->config['dumpSnippets']==1) {
echo "<fieldset><legend><b>$snippetName</b></legend><textarea style='width:60%; height:200px'>".htmlentities($executedSnippets[$i])."</textarea></fieldset>
";
}
$documentSource = str_replace("[[".$snippetName.$currentSnippetParams."]]", $executedSnippets[$i], $documentSource);
}
return $documentSource;
}
This section of the index.php will effectively let any & or ? character pass through the snippet parameters if you use it twice in a row (&& or ??). If you read the code above, it simply replaces flagged charaters with a temporary placeholder then when the snippet parameters are exploded, replaces them back with the required characters. Although only the & and ? characters are messed with in the existing code, this method will allow any html entitity to be passed- good for URLs and special characters.
To try use it, simply pass your parameters like this:
snippet?u=http://mysite.com/index.php??id=12&&key1=value1&&key2=value2¶m2=value2
This will pass:
[u]=>[
http://mysite.com/in...38;key2=value2]
(which will render XHTML compiant:
http://mysite.com/in...mp;key2=value2)
[param2]=>[value2]
Edited by Cris D., 20 October 2009 - 11:21 AM.