[Pmwiki-users] About sample-config.php

Jonathan Scott Duff duff
Tue Jul 27 09:07:18 CDT 2004


On Tue, Jul 27, 2004 at 04:39:46PM +0200, chr at home.se wrote:
> On Tue, 27 Jul 2004, Jonathan Scott Duff wrote:
> 
> > On Tue, Jul 27, 2004 at 08:29:22AM +0200, Christian Ridderstr??m wrote:
> > > Hi
> > > 
> > > Is there anything that prevents 'sample-config.php' from being executed 
> > > where it currently is found (i.e. next to 'pmwiki.php')?
> > > 
> > > Maybe we should let sample-config.php start with:
> > > 
> > > 	if(!defined('PmWiki')) { highlight_file(__FILE__); exit; }
> > 
> > Why do you want sample-config.php to be executed?  How does showing the
> > source code in a browser help the wiki admin?
> 
> I do *not* want it to accidentally executed... the idea is that if it for 
> some reason is, all it will do is show the code.

Oh, I see.  Isn't everything in sample-config.php commented out
anyway?  In any case, showing the code doesn't seem right to me
either. Perhaps if there were a message that said something like:

        This is the sample configuration file for PmWiki. See the source
        for information about how to use this file.

and maybe provide a link to their own pmwiki isntallation.  Have a
look at http://meridian.tamucc.edu/~duff/pmwiki/sample-config.php.
Here's a diff for it too:

-----BEGIN DIFF-----
--- sample-config.php   2004-07-27 10:02:23.000000000 -0500
+++ sample-config.php.new       2004-07-27 10:02:05.000000000 -0500
@@ -5,6 +5,12 @@
 ##  for more details on the types of customizations that can be added
 ##  to PmWiki.
 
+$pmwiki = preg_replace('/sample-config/', 'pmwiki', $_SERVER['SCRIPT_NAME']);
+$uri = "http://" . $_SERVER['HTTP_HOST'] . $pmwiki;
+echo "
+This is a sample configuration file for <a href='http://www.pmwiki.org/'>PmWiki</a>.  For information about how to use this file see the source. Or perhaps you just meant to go to <a href='$uri'>your pmwiki installation</a>.
+";
+
 ##  $WikiTitle is the name that appears in the browser's title bar
 $WikiTitle = 'PmWiki';
 
-----END DIFF-----


-Scott
-- 
Jonathan Scott Duff
duff at pobox.com



More information about the pmwiki-users mailing list