]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - index.php
Jeff's hacks II.
[SourceForge/phpwiki.git] / index.php
1 <?php
2
3 /*
4   This is the starting file for PhpWiki. All this file does
5    is set configuration options, and at the end of the file 
6    it includes() the file lib/main.php, where the real action begins.
7
8    This file is divided into six parts: Parts Zero, One, Two, Three,
9    Four and Five. Each one has different configuration settings you 
10    can change; in all cases the default should work on your system, 
11    however, we recommend you tailor things to your particular setting.
12 */
13
14 /////////////////////////////////////////////////////////////////////
15 // Part Zero: If PHP needs help in finding where you installed the
16 //   rest of the PhpWiki code, you can set the include_path here.
17
18
19 //ini_set('include_path', '.:/where/you/installed/phpwiki');
20
21 /////////////////////////////////////////////////////////////////////
22 // Part Null: Don't touch this!
23
24 define ('PHPWIKI_VERSION', '1.3.0-jeffs-hacks');
25 require "lib/prepend.php";
26 rcs_id('$Id: index.php,v 1.21 2001-09-18 19:16:23 dairiki Exp $');
27
28 /////////////////////////////////////////////////////////////////////
29 //
30 // Part One:
31 // Authentication and security settings:
32 // 
33 /////////////////////////////////////////////////////////////////////
34
35 // If set, we will perform reverse dns lookups to try to convert the users
36 // IP number to a host name, even if the http server didn't do it for us.
37 define('ENABLE_REVERSE_DNS', true);
38
39 // Username and password of administrator.
40 // Set these to your preferences. For heaven's sake
41 // pick a good password!
42 define('ADMIN_USER', "");
43 define('ADMIN_PASSWD', "");
44
45 // If true, only the admin user can make zip dumps, else
46 // zip dumps require no authentication.
47 define('ZIPDUMP_AUTH', false);
48
49 // The maximum file upload size.
50 define('MAX_UPLOAD_SIZE', 16 * 1024 * 1024);
51
52 // If the last edit is older than MINOR_EDIT_TIMEOUT seconds, the default
53 // state for the "minor edit" checkbox on the edit page form will be off.
54 define("MINOR_EDIT_TIMEOUT", 7 * 24 * 3600);
55
56 // Actions listed in this array will not be allowed.
57 //$DisabledActions = array('dumpserial', 'loadfile');
58
59 // PhpWiki can generate an access_log (in "NCSA combined log" format)
60 // for you.  If you want one, define this to the name of the log file.
61 define('ACCESS_LOG', '/tmp/wiki_access_log');
62
63
64 // If ALLOW_BOGO_LOGIN is true, users are allowed to login
65 // (with any/no password) using any userid which: 1) is not
66 // the ADMIN_USER, 2) is a valid WikiWord (matches $WikiNameRegexp.)
67 define('ALLOW_BOGO_LOGIN', true);
68
69 /////////////////////////////////////////////////////////////////////
70 //
71 // Part Two:
72 // Database Selection
73 //
74 /////////////////////////////////////////////////////////////////////
75
76 //
77 // This array holds the parameters which select the database to use.
78 //
79 // Not all of these parameters are used by any particular DB backend.
80 //
81 $DBParams = array(
82    // Select the database type:
83    //'dbtype' => 'SQL',
84    'dbtype' => 'dba',
85    
86    // For SQL based backends, specify the database as a DSN
87    // The most general form of a DSN looks like:
88    //
89    //   phptype(dbsyntax)://username:password@protocol+hostspec/database
90    //
91    // For a MySQL database, the following should work:
92    //
93    //   mysql://user:password@host/databasename
94    //
95    // FIXME: My version Pear::DB seems to be broken enough that there is
96    //    no way to connect to a mysql server over a socket right now.
97    //'dsn' => 'mysql://guest@:/var/lib/mysql/mysql.sock/test',
98    //'dsn' => 'mysql://guest@localhost/test',
99    'dsn' => 'pgsql://localhost/test',
100    
101    // Used by all DB types:
102
103    // prefix for filenames or table names
104    /* 
105     * currently you MUST EDIT THE SQL file too (in the schemas/ directory
106     * because we aren't doing on the fly sql generation during the
107     * installation.
108    */
109    //'prefix' => 'phpwiki_',
110    
111    // Used by 'dba'
112    'directory' => "/tmp",
113    'dba_handler' => 'gdbm',   // Either of 'gdbm' or 'db2' work great for me.
114    //'dba_handler' => 'db2',
115    //'dba_handler' => 'db3',    // doesn't work at all for me....
116    'timeout' => 20,
117    //'timeout' => 5
118 );
119
120 /////////////////////////////////////////////////////////////////////
121 //
122 // The next section controls how many old revisions of each page
123 // are kept in the database.
124 //
125 // There are two basic classes of revisions: major and minor.
126 // Which class a revision belongs in is determined by whether the
127 // author checked the "this is a minor revision" checkbox when they
128 // saved the page.
129 // 
130 // There is, additionally, a third class of revisions: author revisions.
131 // The most recent non-mergable revision from each distinct author is
132 // and author revision.
133 //
134 // The expiry parameters for each of those three classes of revisions
135 // can be adjusted seperately.   For each class there are five
136 // parameters (usually, only two or three of the five are actually set)
137 // which control how long those revisions are kept in the database.
138 //
139 //   max_keep: If set, this specifies an absolute maximum for the number
140 //             of archived revisions of that class.  This is meant to be
141 //             used as a safety cap when a non-zero min_age is specified.
142 //             It should be set relatively high, and it's purpose is to
143 //             prevent malicious or accidental database overflow due
144 //             to someone causing an unreasonable number of edits in a short
145 //             period of time.
146 //
147 //   min_age:  Revisions younger than this (based upon the supplanted date)
148 //             will be kept unless max_keep is exceeded.  The age should
149 //             be specified in days.  It should be a non-negative,
150 //             real number,
151 //
152 //   min_keep: At least this many revisions will be kept.
153 //
154 //   keep:     No more than this many revisions will be kept.
155 //
156 //   max_age:  No revision older than this age will be kept.
157 //
158 // Supplanted date:  Revisions are timestamped at the instant that they cease
159 // being the current revision.  Revision age is computed using this timestamp,
160 // not the edit time of the page.
161 //
162 // Merging: When a minor revision is deleted, if the preceding revision is by
163 // the same author, the minor revision is merged with the preceding revision
164 // before it is deleted.  Essentially: this replaces the content (and supplanted
165 // timestamp) of the previous revision with the content after the merged minor
166 // edit, the rest of the page metadata for the preceding version (summary, mtime, ...)
167 // is not changed.
168 //
169 // Keep up to 8 major edits, but keep them no longer than a month.
170 $ExpireParams['major'] = array('max_age' => 32,
171                                'keep'      => 8);
172 // Keep up to 4 minor edits, but keep them no longer than a week.
173 $ExpireParams['minor'] = array('max_age' => 7,
174                                'keep'    => 4);
175 // Keep the latest contributions of the last 8 authors up to a year.
176 // Additionally, (in the case of a particularly active page) try to keep the
177 // latest contributions of all authors in the last week (even if there are
178 // more than eight of them,) but in no case keep more than twenty unique
179 // author revisions.
180 $ExpireParams['author'] = array('max_age'  => 365,
181                                 'keep'     => 8,
182                                 'min_age'  => 7,
183                                 'max_keep' => 20);
184
185 /////////////////////////////////////////////////////////////////////
186 // 
187 // Part Three:
188 // Page appearance and layout
189 //
190 /////////////////////////////////////////////////////////////////////
191
192 // Select your language/locale - default language "C": English
193 // other languages available: Dutch "nl", Spanish "es", German "de",
194 // Swedish "sv", and Italian, "it".
195 //
196 // Note that on some systems, apprently using these short forms for
197 // the locale won't work.  On my home system 'LANG=de' won't result
198 // in german pages.  Somehow the system must recognize the locale
199 // as a valid locale before gettext() will work, i.e., use 'de_DE',
200 // 'nl_NL'.
201 $LANG='C';
202 //$LANG='nl_NL';
203
204 // Setting the LANG environment variable (accomplished above) may or
205 // may not be sufficient to cause PhpWiki to produce dates in your
206 // native language.  (It depends on the configuration of the operating
207 // system on your http server.)  The problem is that, e.g. 'de' is
208 // often not a valid locale.
209 //
210 // A standard locale name is typically of  the  form
211 // language[_territory][.codeset][@modifier],  where  language is
212 // an ISO 639 language code, territory is an ISO 3166 country code,
213 // and codeset  is  a  character  set or encoding identifier like
214 // ISO-8859-1 or UTF-8.
215 //
216 // You can tailor the locale used for time and date formatting by setting
217 // the LC_TIME environment variable.  You'll have to experiment to find
218 // the correct setting:
219 //putenv('LC_TIME=de_DE');
220
221 // If you specify a relative URL for the CSS and images,
222 // the are interpreted relative to DATA_PATH (see below).
223 // (The default value of DATA_PATH is the directory in which
224 // index.php (this file) resides.)
225
226 // CSS location
227 //
228 // Note that if you use the stock phpwiki style sheet, 'phpwiki.css',
229 // you should make sure that it's companion 'phpwiki-heavy.css'
230 // is installed in the same directory that the base style file is.
231 define("CSS_URL", "phpwiki.css");
232
233 // logo image (path relative to index.php)
234 $logo = "images/wikibase.png";
235
236 // Signature image which is shown after saving an edited page
237 // If this is left blank (or unset), the signature will be omitted.
238 //$SignatureImg = "images/signature.png";
239
240 // Date & time formats used to display modification times, etc.
241 // Formats are given as format strings to PHP strftime() function
242 // See http://www.php.net/manual/en/function.strftime.php for details.
243 $datetimeformat = "%B %e, %Y";  // may contain time of day
244 $dateformat = "%B %e, %Y";      // must not contain time
245
246 // FIXME: delete
247 // this defines how many page names to list when displaying
248 // the MostPopular pages; the default is to show the 20 most popular pages
249 define("MOST_POPULAR_LIST_LENGTH", 20);
250
251 // this defines how many page names to list when displaying related pages
252 define("NUM_RELATED_PAGES", 5);
253
254 // Template files (filenames are relative to script position)
255 // However, if a LANG is set, they we be searched for in a locale
256 // specific location first.
257 $templates = array("BROWSE" =>    "templates/browse.html",
258                    "EDITPAGE" =>  "templates/editpage.html",
259                    "MESSAGE" =>   "templates/message.html");
260
261 /* WIKI_PGSRC -- specifies the source for the initial page contents
262  * of the Wiki.  The setting of WIKI_PGSRC only has effect when
263  * the wiki is accessed for the first time (or after clearing the
264  * database.) WIKI_PGSRC can either name a directory or a zip file.
265  * In either case WIKI_PGSRC is scanned for files --- one file per page.
266  */
267 define('WIKI_PGSRC', "pgsrc"); // Default (old) behavior.
268 //define('WIKI_PGSRC', 'wiki.zip'); // New style.
269 //define('WIKI_PGSRC', '../../../Logs/Hamwiki/hamwiki-20010830.zip'); // New style.
270
271 // DEFAULT_WIKI_PGSRC is only used when the language is *not*
272 // the default (English) and when reading from a directory:
273 // in that case some English pages are inserted into the wiki as well
274 // DEFAULT_WIKI_PGSRC defines where the English pages reside 
275 // FIXME: is this really needed?  Can't we just copy
276 //  these pages into the localized pgsrc?
277 define('DEFAULT_WIKI_PGSRC', "pgsrc");
278 // These are the pages which will get loaded from DEFAULT_WIKI_PGSRC.   
279 $GenericPages = array("ReleaseNotes", "SteveWainstead", "TestPage");
280
281 /////////////////////////////////////////////////////////////////////
282 //
283 // Part four:
284 // Mark-up options.
285 // 
286 /////////////////////////////////////////////////////////////////////
287
288 // allowed protocols for links - be careful not to allow "javascript:"
289 // URL of these types will be automatically linked.
290 // within a named link [name|uri] one more protocol is defined: phpwiki
291 $AllowedProtocols = "http|https|mailto|ftp|news|gopher";
292
293 // URLs ending with the following extension should be inlined as images
294 $InlineImages = "png|jpg|gif";
295
296 // Perl regexp for WikiNames ("bumpy words")
297 // (?<!..) & (?!...) used instead of '\b' because \b matches '_' as well
298 $WikiNameRegexp = "(?<![[:alnum:]])([[:upper:]][[:lower:]]+){2,}(?![[:alnum:]])";
299
300 // InterWiki linking -- wiki-style links to other wikis on the web
301 //
302 // Intermap file for InterWikiLinks -- define other wikis there
303 // Leave this undefined to disable InterWiki linking.
304 define('INTERWIKI_MAP_FILE', "lib/interwiki.map");
305
306 /////////////////////////////////////////////////////////////////////
307 //
308 // Part five:
309 // URL options -- you can probably skip this section.
310 //
311 /////////////////////////////////////////////////////////////////////
312 /******************************************************************
313  *
314  * The following section contains settings which you can use to tailor
315  * the URLs which PhpWiki generates. 
316  *
317  * Any of these parameters which are left undefined will be
318  * deduced automatically.  You need only set them explicitly
319  * if the auto-detected values prove to be incorrect.
320  *
321  * In most cases the auto-detected values should work fine,
322  * so hopefully you don't need to mess with this section.
323  *
324  ******************************************************************/
325
326 /*
327  * Canonical name and httpd port of the server on which this
328  * PhpWiki resides.
329  */
330 //define('SERVER_NAME', 'some.host.com');
331 //define('SERVER_PORT', 80);
332
333 /*
334  * Absolute URL (from the server root) of the PhpWiki
335  * script.
336  */
337 //define('SCRIPT_NAME', '/some/where/index.php');
338
339 /*
340  * Absolute URL (from the server root) of the directory
341  * in which relative URL's for images and other support files
342  * are interpreted.
343  */
344 //define('DATA_PATH', '/some/where');
345
346 /*
347  * Define to 'true' to use PATH_INFO to pass the pagename's.
348  * e.g. http://www.some.where/index.php/HomePage instead
349  * of http://www.some.where/index.php?pagename=HomePage
350  * FIXME: more docs (maybe in README).
351  */
352 //define('USE_PATH_INFO', false);
353
354 /*
355  * VIRTUAL_PATH is the canonical URL path under which your
356  * your wiki appears.  Normally this is the same as
357  * dirname(SCRIPT_NAME), however using, e.g. apaches mod_actions
358  * (or mod_rewrite), you can make it something different.
359  *
360  * If you do this, you should set VIRTUAL_PATH here.
361  *
362  * E.g. your phpwiki might be installed at at /scripts/phpwiki/index.php,
363  * but  * you've made it accessible through eg. /wiki/HomePage.
364  *
365  * One way to do this is to create a directory named 'wiki' in your
366  * server root.  The directory contains only one file: an .htaccess
367  * file which reads something like:
368  *
369  *    Action x-phpwiki-page /scripts/phpwiki/index.php
370  *    SetHandler x-phpwiki-page
371  *    DirectoryIndex /scripts/phpwiki/index.php
372  *
373  * In that case you should set VIRTUAL_PATH to '/wiki'.
374  *
375  * (VIRTUAL_PATH is only used if USE_PATH_INFO is true.)
376  */
377 //define('VIRTUAL_PATH', '/SomeWiki');
378
379
380 ////////////////////////////////////////////////////////////////
381 // Okay... fire up the code:
382 ////////////////////////////////////////////////////////////////
383
384 include "lib/main.php";
385
386 // (c-file-style: "gnu")
387 // Local Variables:
388 // mode: php
389 // tab-width: 8
390 // c-basic-offset: 4
391 // c-hanging-comment-ender-p: nil
392 // indent-tabs-mode: nil
393 // End:   
394 ?>