From: Neil B. <ne...@cs...> - 2000-10-10 22:55:13
|
On Monday October 9, sw...@wc... wrote: > > Well, this might not count for much, but the http: solution does not work > in Emacs' w3 mode. This makes me nervous that it will break other > browsers... it also won't let me use lwp-rget to write a regression test, > since the URLs all come out like this: > Ho hum.... There is an RFC which describes what different URLs and URIs are, or should be, valid! However I think it is an after-the-fact RFC which is a suggesting of how things should be done and not a standard which everybody already adheres to.... > > > I'm looking for another solution. Perhaps the way the diffurl is encoded > can be changed: > > if($isnewpage) { > $newpage[$k++] = "\t* [$pagename] (new) ..... $remoteuser\r"; > } else { > $diffurl = "$ScriptUrl?diff=" . rawurlencode($pagename); > $newpage[$k++] = "\t* [$pagename] ([diff|$diffurl]) > ..... $remoteuser\r"; > } > > but I don't think there's an easy answer there either, and I don't want to > kluge it with an if/else... > I agree that the diffurl needs to be different. On reflection, putting something like http://myserver.mdomain.thing/thisbit/wiki/?diff=SomePage in a wikipage is not a good idea as it means that the wiki cannot be moved without changing the RecentChanges page. Having: index.php?diff=SomePage is a problem because it doesn't look distictively enough like a url for transform.php to recognise it. Having http:index.php?diff=SomePage is a bit better, but stuff would break if the index file name changed, and doesn't work for w3 mode or lwp-rget, and probably others.... My first thought was to have diff:SomePage and have transform.php recognise this inside [] and convert it to $ScriptUrl?diff=SomePage An alternative would be to have http:?diff=SomePage or maybe even wiki:diff=SomePage which can apply more generally than just diff. I like this last one the most. The follow patch effects it. With this patch, setting $ServerAddress=""; works fine for diffs an emacs-w3 and lpw-rget. WhaDaYaThink? NeilBrown --- /home/src/phpwiki/lib/stdlib.php Mon Oct 9 04:33:26 2000 +++ lib/stdlib.php Wed Oct 11 09:35:43 2000 @@ -360,7 +362,7 @@ if($isnewpage) { $newpage[$k++] = "\t* [$pagename] (new) ..... $remoteuser\r"; } else { - $diffurl = "$ScriptUrl?diff=" . rawurlencode($pagename); + $diffurl = "wiki:diff=" . rawurlencode($pagename); $newpage[$k++] = "\t* [$pagename] ([diff|$diffurl]) ..... $remoteuser\r"; } @@ -383,7 +385,7 @@ function ParseAndLink($bracketlink) { - global $dbi, $AllowedProtocols; + global $dbi, $AllowedProtocols, $ScriptUrl; // $bracketlink will start and end with brackets; in between // will be either a page name, a URL or both separated by a pipe. @@ -417,7 +419,10 @@ $URL = trim($matches[3]); $linkname = htmlspecialchars(trim($matches[1])); // assert proper URL's - if (preg_match("#^($AllowedProtocols):#", $URL)) { + if (preg_match("#wiki:(.*)#", $URL, $umatch)) { + $link['type'] = 'meta-wiki'; + $link['link'] = "<a href=\"$ScriptUrl?".$umatch[1]."\">$linkname</a>"; + } elseif (preg_match("#^($AllowedProtocols):#", $URL)) { $link['type'] = 'url-named'; $link['link'] = "<a href=\"$URL\">$linkname</a>"; } else { @@ -437,6 +442,9 @@ if (IsWikiPage($dbi, $linkname)) { $link['type'] = 'wiki'; $link['link'] = LinkExistingWikiWord($linkname); + } elseif (preg_match("#^wiki:(.*)#", $linkname, $umatch)) { + $link['type'] = 'meta-wiki'; + $link['link'] = "<a href=\"$ScriptUrl?".$umatch[1]."\">".urldecode($umatch[1])."</a>"; } elseif (preg_match("#^($AllowedProtocols):#", $linkname)) { // if it's an image, embed it; otherwise, it's a regular link if (preg_match("/jpg$|png$|gif$/i", $linkname)) { |