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