]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - index.php
Added better example how to use include_path for various platforms (and also multi...
[SourceForge/phpwiki.git] / index.php
1 <?php // -*-php-*-\r
2 \r
3 /*\r
4 Copyright 1999, 2000, 2001, 2002 $ThePhpWikiProgrammingTeam = array(\r
5 "Steve Wainstead", "Clifford A. Adams", "Lawrence Akka", \r
6 "Scott R. Anderson", "Jon Åslund", "Neil Brown", "Jeff Dairiki",\r
7 "Stéphane Gourichon", "Jan Hidders", "Arno Hollosi", "John Jorgensen",\r
8 "Antti Kaihola", "Jeremie Kass", "Carsten Klapp", "Marco Milanesi",\r
9 "Grant Morgan", "Jan Nieuwenhuizen", "Aredridel Niothke", \r
10 "Pablo Roca Rozas", "Sandino Araico Sánchez", "Joel Uckelman", \r
11 "Reini Urban", "Tim Voght");\r
12 \r
13 This file is part of PhpWiki.\r
14 \r
15 PhpWiki is free software; you can redistribute it and/or modify\r
16 it under the terms of the GNU General Public License as published by\r
17 the Free Software Foundation; either version 2 of the License, or\r
18 (at your option) any later version.\r
19 \r
20 PhpWiki is distributed in the hope that it will be useful,\r
21 but WITHOUT ANY WARRANTY; without even the implied warranty of\r
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
23 GNU General Public License for more details.\r
24 \r
25 You should have received a copy of the GNU General Public License\r
26 along with PhpWiki; if not, write to the Free Software\r
27 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
28 */\r
29 \r
30 \r
31 /////////////////////////////////////////////////////////////////////\r
32 /*\r
33   This is the starting file for PhpWiki. All this file does is set\r
34   configuration options, and at the end of the file it includes() the\r
35   file lib/main.php, where the real action begins.\r
36 \r
37   This file is divided into six parts: Parts Zero, One, Two, Three,\r
38   Four and Five. Each one has different configuration settings you can\r
39   change; in all cases the default should work on your system,\r
40   however, we recommend you tailor things to your particular setting.\r
41 */\r
42 \r
43 /////////////////////////////////////////////////////////////////////\r
44 // Part Zero: If PHP needs help in finding where you installed the\r
45 //   rest of the PhpWiki code, you can set the include_path here.\r
46 \r
47 // NOTE: phpwiki uses the PEAR library of php code for SQL database\r
48 // access. Your PHP is probably already configured to set\r
49 // include_path so that PHP can find the pear code. If not (or if you\r
50 // change include_path here) make sure you include the path to the\r
51 // PEAR code in include_path. (To find the PEAR code on your system,\r
52 // search for a file named 'PEAR.php'. Some common locations are:\r
53 //\r
54 //   Unixish systems:\r
55 //     /usr/share/php\r
56 //     /usr/local/share/php\r
57 //   Mac OS X:\r
58 //     /System/Library/PHP\r
59 //\r
60 // The above examples are already included by PhpWiki. You shouldn't\r
61 // have to change this unless you see a WikiFatalError:\r
62 //\r
63 //     lib/FileFinder.php:82: Fatal[256]: DB.php: file not found\r
64 //\r
65 // Define the include path for this wiki: pear plus the phpwiki path\r
66 // $include_path = '.:/Apache/php/pear:/prog/php/phpwiki';\r
67 //\r
68 // // Windows needs ';' as path delimiter. cygwin, mac and unix ':'\r
69 // if (substr(PHP_OS,0,3) == 'WIN') {\r
70 //     $include_path = implode(';',explode(':',$include_path));\r
71 // } elseif (substr(PHP_OS,0,6) == 'CYGWIN') {\r
72 //     $include_path = '.:/usr/local/lib/php/pear:/usr/src/php/phpwiki';\r
73 // } else {\r
74 //     ;\r
75 // }\r
76 //ini_set('include_path', $include_path);\r
77 \r
78 /////////////////////////////////////////////////////////////////////\r
79 // Part Null: Don't touch this!\r
80 \r
81 define ('PHPWIKI_VERSION', '1.3.2-jeffs-hacks');\r
82 require "lib/prepend.php";\r
83 rcs_id('$Id: index.php,v 1.70 2002-01-20 18:19:25 rurban Exp $');\r
84 \r
85 /////////////////////////////////////////////////////////////////////\r
86 //\r
87 // Part One:\r
88 // Authentication and security settings:\r
89 // \r
90 /////////////////////////////////////////////////////////////////////\r
91 \r
92 // The name of your wiki.\r
93 // This is used to generate a keywords meta tag in the HTML templates,\r
94 // in bookmark titles for any bookmarks made to pages in your wiki,\r
95 // and during RSS generation for the <title> of the RSS channel.\r
96 //define('WIKI_NAME', 'PhpWiki');\r
97 \r
98 // If set, we will perform reverse dns lookups to try to convert the\r
99 // users IP number to a host name, even if the http server didn't do\r
100 // it for us.\r
101 define('ENABLE_REVERSE_DNS', true);\r
102 \r
103 // Username and password of administrator.\r
104 // Set these to your preferences. For heaven's sake\r
105 // pick a good password!\r
106 define('ADMIN_USER', "");\r
107 define('ADMIN_PASSWD', "");\r
108 \r
109 // If true, only the admin user can make zip dumps, else zip dumps\r
110 // require no authentication.\r
111 define('ZIPDUMP_AUTH', false);\r
112 \r
113 // This setting determines the type of page dumps. Must be one of\r
114 // "quoted-printable" or "binary".\r
115 $pagedump_format = "quoted-printable";\r
116 \r
117 // The maximum file upload size.\r
118 define('MAX_UPLOAD_SIZE', 16 * 1024 * 1024);\r
119 \r
120 // If the last edit is older than MINOR_EDIT_TIMEOUT seconds, the\r
121 // default state for the "minor edit" checkbox on the edit page form\r
122 // will be off.\r
123 define("MINOR_EDIT_TIMEOUT", 7 * 24 * 3600);\r
124 \r
125 // Actions listed in this array will not be allowed.\r
126 //$DisabledActions = array('dumpserial', 'loadfile');\r
127 \r
128 // PhpWiki can generate an access_log (in "NCSA combined log" format)\r
129 // for you. If you want one, define this to the name of the log file.\r
130 //define('ACCESS_LOG', '/tmp/wiki_access_log');\r
131 \r
132 \r
133 // If ALLOW_BOGO_LOGIN is true, users are allowed to login (with\r
134 // any/no password) using any userid which: 1) is not the ADMIN_USER,\r
135 // 2) is a valid WikiWord (matches $WikiNameRegexp.)\r
136 define('ALLOW_BOGO_LOGIN', true);\r
137 \r
138 // The login code now uses PHP's session support. Usually, the default\r
139 // configuration of PHP is to store the session state information in\r
140 // /tmp. That probably will work fine, but fails e.g. on clustered\r
141 // servers where each server has their own distinct /tmp (this is the\r
142 // case on SourceForge's project web server.) You can specify an\r
143 // alternate directory in which to store state information like so\r
144 // (whatever user your httpd runs as must have read/write permission\r
145 // in this directory):\r
146 \r
147 //ini_set('session.save_path', 'some_other_directory');\r
148 \r
149 \r
150 /////////////////////////////////////////////////////////////////////\r
151 //\r
152 // Part Two:\r
153 // Database Selection\r
154 //\r
155 /////////////////////////////////////////////////////////////////////\r
156 \r
157 //\r
158 // This array holds the parameters which select the database to use.\r
159 //\r
160 // Not all of these parameters are used by any particular DB backend.\r
161 //\r
162 $DBParams = array(\r
163    // Select the database type:\r
164    //'dbtype' => 'SQL',\r
165    'dbtype'   => 'dba',\r
166    \r
167    // For SQL based backends, specify the database as a DSN\r
168    // The most general form of a DSN looks like:\r
169    //\r
170    //   phptype(dbsyntax)://username:password@protocol+hostspec/database\r
171    //\r
172    // For a MySQL database, the following should work:\r
173    //\r
174    //   mysql://user:password@host/databasename\r
175    //\r
176    // FIXME: My version Pear::DB seems to be broken enough that there\r
177    //        is no way to connect to a mysql server over a socket right now.\r
178    //'dsn' => 'mysql://guest@:/var/lib/mysql/mysql.sock/test',\r
179    //'dsn' => 'mysql://guest@localhost/test',\r
180    //'dsn' => 'pgsql://localhost/test',\r
181    \r
182    // Used by all DB types:\r
183 \r
184    // prefix for filenames or table names\r
185    /* \r
186     * currently you MUST EDIT THE SQL file too (in the schemas/\r
187     * directory because we aren't doing on the fly sql generation\r
188     * during the installation.\r
189    */\r
190    //'prefix' => 'phpwiki_',\r
191    \r
192    // Used by 'dba'\r
193    'directory'     => "/tmp",\r
194    'dba_handler'   => 'gdbm',   // Either of 'gdbm' or 'db2' work great for me.\r
195    //'dba_handler' => 'db2',\r
196    //'dba_handler' => 'db3',    // doesn't work at all for me....\r
197    'timeout'   => 20,\r
198    //'timeout' => 5\r
199 );\r
200 \r
201 /////////////////////////////////////////////////////////////////////\r
202 //\r
203 // The next section controls how many old revisions of each page are\r
204 // kept in the database.\r
205 //\r
206 // There are two basic classes of revisions: major and minor. Which\r
207 // class a revision belongs in is determined by whether the author\r
208 // checked the "this is a minor revision" checkbox when they saved the\r
209 // page.\r
210 // \r
211 // There is, additionally, a third class of revisions: author\r
212 // revisions. The most recent non-mergable revision from each distinct\r
213 // author is and author revision.\r
214 //\r
215 // The expiry parameters for each of those three classes of revisions\r
216 // can be adjusted seperately. For each class there are five\r
217 // parameters (usually, only two or three of the five are actually\r
218 // set) which control how long those revisions are kept in the\r
219 // database.\r
220 //\r
221 //   max_keep: If set, this specifies an absolute maximum for the\r
222 //             number of archived revisions of that class. This is\r
223 //             meant to be used as a safety cap when a non-zero\r
224 //             min_age is specified. It should be set relatively high,\r
225 //             and it's purpose is to prevent malicious or accidental\r
226 //             database overflow due to someone causing an\r
227 //             unreasonable number of edits in a short period of time.\r
228 //\r
229 //   min_age:  Revisions younger than this (based upon the supplanted\r
230 //             date) will be kept unless max_keep is exceeded. The age\r
231 //             should be specified in days. It should be a\r
232 //             non-negative, real number,\r
233 //\r
234 //   min_keep: At least this many revisions will be kept.\r
235 //\r
236 //   keep:     No more than this many revisions will be kept.\r
237 //\r
238 //   max_age:  No revision older than this age will be kept.\r
239 //\r
240 // Supplanted date: Revisions are timestamped at the instant that they\r
241 // cease being the current revision. Revision age is computed using\r
242 // this timestamp, not the edit time of the page.\r
243 //\r
244 // Merging: When a minor revision is deleted, if the preceding\r
245 // revision is by the same author, the minor revision is merged with\r
246 // the preceding revision before it is deleted. Essentially: this\r
247 // replaces the content (and supplanted timestamp) of the previous\r
248 // revision with the content after the merged minor edit, the rest of\r
249 // the page metadata for the preceding version (summary, mtime, ...)\r
250 // is not changed.\r
251 //\r
252 // Keep up to 8 major edits, but keep them no longer than a month.\r
253 $ExpireParams['major'] = array('max_age' => 32,\r
254                                'keep'    => 8);\r
255 // Keep up to 4 minor edits, but keep them no longer than a week.\r
256 $ExpireParams['minor'] = array('max_age' => 7,\r
257                                'keep'    => 4);\r
258 // Keep the latest contributions of the last 8 authors up to a year.\r
259 // Additionally, (in the case of a particularly active page) try to\r
260 // keep the latest contributions of all authors in the last week (even\r
261 // if there are more than eight of them,) but in no case keep more\r
262 // than twenty unique author revisions.\r
263 $ExpireParams['author'] = array('max_age'  => 365,\r
264                                 'keep'     => 8,\r
265                                 'min_age'  => 7,\r
266                                 'max_keep' => 20);\r
267 \r
268 /////////////////////////////////////////////////////////////////////\r
269 // \r
270 // Part Three:\r
271 // Page appearance and layout\r
272 //\r
273 /////////////////////////////////////////////////////////////////////\r
274 \r
275 /* THEME\r
276  *\r
277  * Most of the page appearance is controlled by files in the theme\r
278  * subdirectory.\r
279  *\r
280  * There are a number of pre-defined themes shipped with PhpWiki.\r
281  * Or you may create your own (e.g. by copying and then modifying one of\r
282  * stock themes.)\r
283  *\r
284  * Pick one.\r
285  */\r
286 //define('THEME', 'default');\r
287 //define('THEME', 'Hawaiian');\r
288 //define('THEME', 'MacOSX');\r
289 //define('THEME', 'Portland');\r
290 //define('THEME', 'WikiTrek');\r
291 \r
292 // Select a valid charset name to be inserted into the xml/html pages,\r
293 // and to reference links to the stylesheets (css). For more info see:\r
294 // <http://www.iana.org/assignments/character-sets>. Note that PhpWiki\r
295 // has been extensively tested only with the latin1 (iso-8859-1)\r
296 // character set.\r
297 //\r
298 // If you change the default from iso-8859-1 PhpWiki may not work\r
299 // properly and it will require code modifications. However, character\r
300 // sets similar to iso-8859-1 may work with little or no modification\r
301 // depending on your setup. The database must also support the same\r
302 // charset, and of course the same is true for the web browser. (Some\r
303 // work is in progress hopefully to allow more flexibility in this\r
304 // area in the future).\r
305 define("CHARSET", "iso-8859-1");\r
306 \r
307 // Select your language/locale - default language is "C" for English.\r
308 // Other languages available:\r
309 // English "C"  (English    - HomePage)\r
310 // Dutch   "nl" (Nederlands - ThuisPagina)\r
311 // Spanish "es" (Español    - PáginaPrincipal)\r
312 // French  "fr" (Français   - Accueil)\r
313 // German  "de" (Deutsch    - StartSeite)\r
314 // Swedish "sv" (Svenska    - Framsida)\r
315 // Italian "it" (Italiano   - PaginaPrincipale)\r
316 //\r
317 // If you set $LANG to the empty string, your systems default language\r
318 // (as determined by the applicable environment variables) will be\r
319 // used.\r
320 //\r
321 // Note that on some systems, apprently using these short forms for\r
322 // the locale won't work. On my home system 'LANG=de' won't result in\r
323 // german pages. Somehow the system must recognize the locale as a\r
324 // valid locale before gettext() will work, i.e., use 'de_DE',\r
325 // 'nl_NL'.\r
326 $LANG='C';\r
327 //$LANG='nl_NL';\r
328 \r
329 // Setting the LANG environment variable (accomplished above) may or\r
330 // may not be sufficient to cause PhpWiki to produce dates in your\r
331 // native language. (It depends on the configuration of the operating\r
332 // system on your http server.)  The problem is that, e.g. 'de' is\r
333 // often not a valid locale.\r
334 //\r
335 // A standard locale name is typically of  the  form\r
336 // language[_territory][.codeset][@modifier],  where  language is\r
337 // an ISO 639 language code, territory is an ISO 3166 country code,\r
338 // and codeset  is  a  character  set or encoding identifier like\r
339 // ISO-8859-1 or UTF-8.\r
340 //\r
341 // You can tailor the locale used for time and date formatting by\r
342 // setting the LC_TIME environment variable. You'll have to experiment\r
343 // to find the correct setting:\r
344 //putenv('LC_TIME=de_DE');\r
345 \r
346 \r
347 /* WIKI_PGSRC -- specifies the source for the initial page contents of\r
348  * the Wiki. The setting of WIKI_PGSRC only has effect when the wiki is\r
349  * accessed for the first time (or after clearing the database.)\r
350  * WIKI_PGSRC can either name a directory or a zip file. In either case\r
351  * WIKI_PGSRC is scanned for files -- one file per page.\r
352  */\r
353 define('WIKI_PGSRC', "pgsrc"); // Default (old) behavior.\r
354 //define('WIKI_PGSRC', 'wiki.zip'); // New style.\r
355 //define('WIKI_PGSRC', '../../../Logs/Hamwiki/hamwiki-20010830.zip'); // New style.\r
356 \r
357 /*\r
358  * DEFAULT_WIKI_PGSRC is only used when the language is *not* the\r
359  * default (English) and when reading from a directory: in that case\r
360  * some English pages are inserted into the wiki as well.\r
361  * DEFAULT_WIKI_PGSRC defines where the English pages reside.\r
362  */\r
363 // FIXME: is this really needed?  Can't we just copy these pages into\r
364 // the localized pgsrc?\r
365 define('DEFAULT_WIKI_PGSRC', "pgsrc");\r
366 // These are the pages which will get loaded from DEFAULT_WIKI_PGSRC.   \r
367 $GenericPages = array("ReleaseNotes", "SteveWainstead", "TestPage");\r
368 \r
369 /////////////////////////////////////////////////////////////////////\r
370 //\r
371 // Part four:\r
372 // Mark-up options.\r
373 // \r
374 /////////////////////////////////////////////////////////////////////\r
375 \r
376 // allowed protocols for links - be careful not to allow "javascript:"\r
377 // URL of these types will be automatically linked.\r
378 // within a named link [name|uri] one more protocol is defined: phpwiki\r
379 $AllowedProtocols = "http|https|mailto|ftp|news|nntp|ssh|gopher";\r
380 \r
381 // URLs ending with the following extension should be inlined as images\r
382 $InlineImages = "png|jpg|gif|tiff|tif";\r
383 \r
384 // Perl regexp for WikiNames ("bumpy words")\r
385 // (?<!..) & (?!...) used instead of '\b' because \b matches '_' as well\r
386 $WikiNameRegexp = "(?<![[:alnum:]])([[:upper:]][[:lower:]]+){2,}(?![[:alnum:]])";\r
387 \r
388 // InterWiki linking -- wiki-style links to other wikis on the web\r
389 //\r
390 // Intermap file for InterWikiLinks -- define other wikis there\r
391 // Leave this undefined to disable InterWiki linking.\r
392 define('INTERWIKI_MAP_FILE', "lib/interwiki.map");\r
393 \r
394 \r
395 /////////////////////////////////////////////////////////////////////\r
396 //\r
397 // Part five:\r
398 // URL options -- you can probably skip this section.\r
399 //\r
400 /////////////////////////////////////////////////////////////////////\r
401 /******************************************************************\r
402  *\r
403  * The following section contains settings which you can use to tailor\r
404  * the URLs which PhpWiki generates.\r
405  *\r
406  * Any of these parameters which are left undefined will be deduced\r
407  * automatically. You need only set them explicitly if the\r
408  * auto-detected values prove to be incorrect.\r
409  *\r
410  * In most cases the auto-detected values should work fine, so\r
411  * hopefully you don't need to mess with this section.\r
412  *\r
413  ******************************************************************/\r
414 \r
415 /*\r
416  * Canonical name and httpd port of the server on which this PhpWiki\r
417  * resides.\r
418  */\r
419 //define('SERVER_NAME', 'some.host.com');\r
420 //define('SERVER_PORT', 80);\r
421 \r
422 /*\r
423  * Relative URL (from the server root) of the PhpWiki\r
424  * script.\r
425  */\r
426 //define('SCRIPT_NAME', '/some/where/index.php');\r
427 \r
428 /*\r
429  * URL of the PhpWiki install directory.  (You only need to set this\r
430  * if you've moved index.php out of the install directory.)  This can\r
431  * be either a relative URL (from the directory where the top-level\r
432  * PhpWiki script is) or an absolute one.\r
433  */\r
434 //define('DATA_PATH', '/some/where/phpwiki');\r
435 \r
436 /*\r
437  * Path to the PhpWiki install directory.  This is the local\r
438  * filesystem counterpart to DATA_PATH.  (If you have to set\r
439  * DATA_PATH, your probably have to set this as well.)  This can be\r
440  * either an absolute path, or a relative path interpreted from the\r
441  * directory where the top-level PhpWiki script (normally index.php)\r
442  * resides.\r
443  */\r
444 //define('PHPWIKI_DIR', '/htdocs/some/where/phpwiki');\r
445 \r
446 \r
447 /*\r
448  * Define to 'true' to use PATH_INFO to pass the pagename's.\r
449  * e.g. http://www.some.where/index.php/HomePage instead\r
450  * of http://www.some.where/index.php?pagename=HomePage\r
451  * FIXME: more docs (maybe in README).\r
452  */\r
453 //define('USE_PATH_INFO', false);\r
454 \r
455 /*\r
456  * VIRTUAL_PATH is the canonical URL path under which your your wiki\r
457  * appears. Normally this is the same as dirname(SCRIPT_NAME), however\r
458  * using, e.g. apaches mod_actions (or mod_rewrite), you can make it\r
459  * something different.\r
460  *\r
461  * If you do this, you should set VIRTUAL_PATH here.\r
462  *\r
463  * E.g. your phpwiki might be installed at at /scripts/phpwiki/index.php,\r
464  * but  * you've made it accessible through eg. /wiki/HomePage.\r
465  *\r
466  * One way to do this is to create a directory named 'wiki' in your\r
467  * server root. The directory contains only one file: an .htaccess\r
468  * file which reads something like:\r
469  *\r
470  *    Action x-phpwiki-page /scripts/phpwiki/index.php\r
471  *    SetHandler x-phpwiki-page\r
472  *    DirectoryIndex /scripts/phpwiki/index.php\r
473  *\r
474  * In that case you should set VIRTUAL_PATH to '/wiki'.\r
475  *\r
476  * (VIRTUAL_PATH is only used if USE_PATH_INFO is true.)\r
477  */\r
478 //define('VIRTUAL_PATH', '/SomeWiki');\r
479 \r
480 \r
481 ////////////////////////////////////////////////////////////////\r
482 // Okay... fire up the code:\r
483 ////////////////////////////////////////////////////////////////\r
484 \r
485 include "lib/main.php";\r
486 \r
487 // (c-file-style: "gnu")\r
488 // Local Variables:\r
489 // mode: php\r
490 // tab-width: 8\r
491 // c-basic-offset: 4\r
492 // c-hanging-comment-ender-p: nil\r
493 // indent-tabs-mode: nil\r
494 // End:   \r
495 ?>\r