From: Steve W. <sw...@pa...> - 2000-10-06 21:10:42
|
This patch sounds like a good idea: no default server name. Another "why didn't I think of that?" idea. Anybody see any holes in it? sw http://wcsb.org/~swain/ | "In a calendar year, America's entire * * * * * * | recorded music industry has revenues * * * * * * | roughly equal to one month's sales by * * * * * * | IBM." --Philip Greenspun ---------- Forwarded message ---------- Date: Fri, 6 Oct 2000 14:16:52 +1100 (EST) From: Neil Brown <ne...@cs...> To: Steve Wainstead <Wai...@us...> Subject: phpwiki - I like it. hi, I was introduced to phpwiki recently through http://kernelbook.sourceforge.net/wiki/KernelWiki and I like it. I tried building something vaguely similar a while back, but made the mistake of over designing, and it never quite got off the ground. phpwiki looks like a much better starting point. I have been playing with if for all of a day and a half now and have a few changes I would like to suggest. So, you can expect to received a few patches in the mail from me. I hope that's ok. My first patch addresses the setting of ServerAddress. I have found that the best value for ServerAddress (for me) is an empty string. This causes relative URI's to appear in the html which browsers cope with quite well. I need this because I am running it from a web server on my note book (for testing) and often I don't have an internet address and haveto use localhost. But if I set ServerAddress to be localhost, then when I am plugged in, I cannot access the pages from else where. This should work out-of-the-box for everybody. I cannot think of a case when specifing a server address is needed, but there might be one. The following patch makes empty string the default, but still leave the other possibilities as options. I also needed to removed ServerAddress from SignatureImg (in line wit $logo) so that it is used as a relative URI too. NeilBrown --- ./wiki_config.php3 2000/10/06 02:21:24 1.1 +++ ./wiki_config.php3 2000/10/06 02:23:24 1.2 @@ -13,19 +13,21 @@ can just give the URL without the script name. */ - // You should set the $ServerAddress below, and comment out - // the if/else that follows. The if/else sets the server address - // dynamically, and you can save some cycles on the server by - // setting $ServerAddress yourself. + // An empty server address: + $ServerAddress = ""; + // works quite well thanks to relative URIs. If find that you + // want an explicit address, you can set one yourself by changing + // and uncommenting: //$ServerAddress = "http://127.0.0.1:8080/phpwiki/"; - - + // Or you could use the if/else statement below to deduce + // the $ServerAddress dynamically. + /* if (preg_match("#(.*?)([^/]*$)#", $REQUEST_URI, $matches)) { $ServerAddress = "http://$SERVER_NAME:$SERVER_PORT" . $matches[1]; } else { $ServerAddress = "http://$SERVER_NAME:$SERVER_PORT$REQUEST_URI"; } - + */ // if you are using MySQL instead of a DBM to store your // Wiki pages, use wiki_mysql.php3 instead of wiki_dbmlib.php3 // See INSTALL.mysql for details on using MySQL @@ -138,7 +140,7 @@ "MESSAGE" => "templates/message.html" ); - $SignatureImg = "$ServerAddress/signature.png"; + $SignatureImg = "signature.png"; $logo = "wikibase.png"; // date & time formats used to display modification times, etc. |
From: Arno H. <aho...@in...> - 2000-10-09 21:00:57
|
Steve, > This patch sounds like a good idea: no default server name. Another "why > didn't I think of that?" idea. Anybody see any holes in it? this breaks the diff links in RecentChanges. Unless we invent a new wiki-syntax they will remain broken. /Arno |
From: Steve W. <sw...@pa...> - 2000-10-09 21:20:03
|
I'll fix it when I get home tonight... sw On Mon, 9 Oct 2000, Arno Hollosi wrote: > Steve, > > > This patch sounds like a good idea: no default server name. Another "why > > didn't I think of that?" idea. Anybody see any holes in it? > > this breaks the diff links in RecentChanges. > Unless we invent a new wiki-syntax they will remain broken. > > /Arno > http://wcsb.org/~swain/ | "In a calendar year, America's entire * * * * * * | recorded music industry has revenues * * * * * * | roughly equal to one month's sales by * * * * * * | IBM." --Philip Greenspun |
From: Neil B. <ne...@cs...> - 2000-10-09 22:41:32
|
On Monday October 9, aho...@in... wrote: > Steve, > > > This patch sounds like a good idea: no default server name. Another "why > > didn't I think of that?" idea. Anybody see any holes in it? > > this breaks the diff links in RecentChanges. > Unless we invent a new wiki-syntax they will remain broken. > > /Arno Ahhh.. that was the problem with my diff links. I hadn't had a chance to look into them, and it didn't click that the break might be related to that change. Instead of $ServerAddress = ""; use $ServerAddress = "http:"; That has the same effect of using relatvie URI's, doesn't break the diff links in RecentChanges NeilBrown |
From: Steve W. <sw...@wc...> - 2000-10-10 01:23:45
|
Done. Ran tests on all the pages (I hope) and found no errors. It has occurred to me lately that a Perl-based regression test is possible... using the LWP one would only have to enter the FrontPage, and let the script retrieve all pages and compare them to a previous set. A diff output would show any changes in the way pages render. It would remove the uncertainty of whether you tested all the pages or not... sw On Tue, 10 Oct 2000, Neil Brown wrote: > On Monday October 9, aho...@in... wrote: > > Steve, > > > > > This patch sounds like a good idea: no default server name. Another "why > > > didn't I think of that?" idea. Anybody see any holes in it? > > > > this breaks the diff links in RecentChanges. > > Unless we invent a new wiki-syntax they will remain broken. > > > > /Arno > > Ahhh.. that was the problem with my diff links. I hadn't had a chance > to look into them, and it didn't click that the break might be related > to that change. > Instead of > $ServerAddress = ""; > use > $ServerAddress = "http:"; > > That has the same effect of using relatvie URI's, doesn't break the > diff links in RecentChanges > > NeilBrown > _______________________________________________ > Phpwiki-talk mailing list > Php...@li... > http://lists.sourceforge.net/mailman/listinfo/phpwiki-talk > ...............................ooo0000ooo................................. Hear FM quality freeform radio through the Internet: http://wcsb.org/ home page: www.wcsb.org/~swain |
From: Steve W. <sw...@wc...> - 2000-10-10 02:13:53
|
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: [swain@localhost tmptmp]$ lwp-rget --verbose http://127.0.0.1:8080/phpwiki/ Use of uninitialized value at /usr/bin/lwp-rget line 222. START = http://127.0.0.1:8080/phpwiki/ MAX_DEPTH = 5 MAX_DOCS = 50 PREFIX = http://127.0.0.1:8080/phpwiki/ http://127.0.0.1:8080/phpwiki/ ............................. index.html http:index.php ............................................ *outsider* http://127.0.0.1:8080/phpwiki/images/wikibase.png ......... wikibase.png http:index.php?full=FrontPage ............................. *outsider* http:index.php?WikiWikiWeb ................................ *outsider* http:index.php?HowToUseWiki ............................... *outsider* http:index.php?AddingPages ................................ *outsider* http:index.php?SandBox .................................... *outsider* http:index.php?RecentVisitors ............................. *outsider* http:index.php?RecentChanges .............................. *outsider* http:index.php?MostPopular ................................ *outsider* http:index.php?ReleaseNotes ............................... *outsider* http:index.php?edit=FrontPage ............................. *outsider* http:index.php?info=FrontPage ............................. *outsider* http:index.php?diff=FrontPage ............................. *outsider* http:index.php?FindPage ................................... *outsider* index.html 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... sw On Tue, 10 Oct 2000, Neil Brown wrote: > On Monday October 9, aho...@in... wrote: > > Steve, > > > > > This patch sounds like a good idea: no default server name. Another "why > > > didn't I think of that?" idea. Anybody see any holes in it? > > > > this breaks the diff links in RecentChanges. > > Unless we invent a new wiki-syntax they will remain broken. > > > > /Arno > > Ahhh.. that was the problem with my diff links. I hadn't had a chance > to look into them, and it didn't click that the break might be related > to that change. > Instead of > $ServerAddress = ""; > use > $ServerAddress = "http:"; > > That has the same effect of using relatvie URI's, doesn't break the > diff links in RecentChanges > > NeilBrown > _______________________________________________ > Phpwiki-talk mailing list > Php...@li... > http://lists.sourceforge.net/mailman/listinfo/phpwiki-talk > ...............................ooo0000ooo................................. Hear FM quality freeform radio through the Internet: http://wcsb.org/ home page: www.wcsb.org/~swain |
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)) { |
From: Arno H. <aho...@in...> - 2000-10-11 08:21:59
|
> > 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 I tried: Netscape, lynx, Konqueror (KDE's browser), Mozilla. They all are able to use http: -- looks to me that Emcas got it wrong. > or maybe even > wiki:diff=SomePage > which can apply more generally than just diff. > I like this last one the most. This looks like a clean solution. Your patch has some subtle bugs though. > --- /home/src/phpwiki/lib/stdlib.php Mon Oct 9 04:33:26 2000 > +++ lib/stdlib.php Wed Oct 11 09:35:43 2000 > - $diffurl = "$ScriptUrl?diff=" . rawurlencode($pagename); > + $diffurl = "wiki:diff=" . rawurlencode($pagename); > $newpage[$k++] = "\t* [$pagename] ([diff|$diffurl]) ..... The pagename must not be rawurlencoded now. We want the real(tm) pagename within the wikipage. Encoding should be done when creating the link. Otherwise people would have to rawurlencode by hand if they would like to add such a link to a wikipage. About names for the link-type: you name both 'meta-wiki' which is not consistent with the naming scheme. I suggest: 'wiki-meta' and 'wiki-meta-named'. Also, doing > + if (preg_match("#wiki:(.*)#", $URL, $umatch)) { > + $link['type'] = 'meta-wiki'; > + $link['link'] = "<a > href=\"$ScriptUrl?".$umatch[1]."\">$linkname</a>"; + } elseif seems too simplistic. Assuming that the link has to be encoded here, you must ensure that there's always a sub-type (diff=, edit=, search=) so that encoding works. This means that another type has to be introduced: 'page=' Those types should be checked for. Everything following the subtype can then be safely urlencoded. /Arno |
From: Neil B. <ne...@cs...> - 2000-10-12 00:32:39
|
On Wednesday October 11, aho...@in... wrote: > > > or maybe even > > wiki:diff=SomePage > > which can apply more generally than just diff. > > I like this last one the most. > > This looks like a clean solution. Your patch has some subtle bugs though. > > > --- /home/src/phpwiki/lib/stdlib.php Mon Oct 9 04:33:26 2000 > > +++ lib/stdlib.php Wed Oct 11 09:35:43 2000 > > - $diffurl = "$ScriptUrl?diff=" . rawurlencode($pagename); > > + $diffurl = "wiki:diff=" . rawurlencode($pagename); > > $newpage[$k++] = "\t* [$pagename] ([diff|$diffurl]) ..... > > The pagename must not be rawurlencoded now. We want the real(tm) pagename > within the wikipage. Encoding should be done when creating the link. > Otherwise people would have to rawurlencode by hand if they would like to add > such a link to a wikipage. My reasoning went that other URLs must already be urlencoded, so this one should too. However I acknowledge that there is a small awkwardness in people needing to hand-urlencode wikinames. I'm probably happy to not urlencode here. > > About names for the link-type: you name both 'meta-wiki' which is not > consistent with the naming scheme. I suggest: 'wiki-meta' and > 'wiki-meta-named'. There is a consistent naming scheme ;-? I couldn't pick it, though I didn't try very hard. After poking around in the code a bit more, I am quite happy with wiki-meta and wiki-meta-named. > > Also, doing > > + if (preg_match("#wiki:(.*)#", $URL, $umatch)) { > > + $link['type'] = 'meta-wiki'; > > + $link['link'] = "<a > > href=\"$ScriptUrl?".$umatch[1]."\">$linkname</a>"; + } elseif > > seems too simplistic. Assuming that the link has to be encoded here, you must > ensure that there's always a sub-type (diff=, edit=, search=) so that > encoding works. This means that another type has to be introduced: 'page=' > Those types should be checked for. Everything following the subtype can then > be safely urlencoded. Yes.. If we don't urlencode above we do need to do more work here. If we are checking the prefx, would it be sensible to include that into the 'protocol'. e.g. wikidiff: wikiedit: wikisearch: wikifile: etc. Which doesn't seem very elegant to me. On the whole, I think I would go back to wiki:diff=url-encoded-wikiname and people who choose wierd wikinames live with the consequenses. Anyone else have an opinion? NeilBrown |
From: Steve W. <sw...@wc...> - 2000-10-12 03:58:31
|
On Thu, 12 Oct 2000, Neil Brown wrote: > Yes.. If we don't urlencode above we do need to do more work here. > If we are checking the prefx, would it be sensible to include that > into the 'protocol'. e.g. > wikidiff: > wikiedit: > wikisearch: > wikifile: > > etc. Which doesn't seem very elegant to me. > > On the whole, I think I would go back to > wiki:diff=url-encoded-wikiname > > and people who choose wierd wikinames live with the consequenses. > > Anyone else have an opinion? Yes, I think we should leave it as an administrator configuration option; at the moment the default is to dynamically determine the host name. Admins can set the $ServerName to either the full URL or http: based on their needs. I think this works for all cases, the choice is not hard to make, and we don't have to risk introducing more bugs. Keep the details out of the code and in the config file. sw ...............................ooo0000ooo................................. Hear FM quality freeform radio through the Internet: http://wcsb.org/ home page: www.wcsb.org/~swain |
From: Neil B. <ne...@cs...> - 2000-10-12 04:31:01
|
On Wednesday October 11, sw...@wc... wrote: > On Thu, 12 Oct 2000, Neil Brown wrote: > > > Yes.. If we don't urlencode above we do need to do more work here. > > If we are checking the prefx, would it be sensible to include that > > into the 'protocol'. e.g. > > wikidiff: > > wikiedit: > > wikisearch: > > wikifile: > > > > etc. Which doesn't seem very elegant to me. > > > > On the whole, I think I would go back to > > wiki:diff=url-encoded-wikiname > > > > and people who choose wierd wikinames live with the consequenses. > > > > Anyone else have an opinion? > > Yes, I think we should leave it as an administrator configuration option; > at the moment the default is to dynamically determine the host name. > Admins can set the $ServerName to either the full URL or http: based on > their needs. I think this works for all cases, the choice is not hard to > make, and we don't have to risk introducing more bugs. Keep the details > out of the code and in the config file. yes....but..... This means that RecentChanges will have absolute URLs hard coded into it, so once the ServerName has been set for a wiki, it cannot be easily changed. I want to keep the detail out of the Wiki database too. NeilBrown |