]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - index.php
added DB_Session support if PearDB is used.
[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 = '.:/usr/share/pear:/usr/local/httpd/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 if (!empty($include_path)) ini_set('include_path', $include_path);
77
78 /////////////////////////////////////////////////////////////////////
79 // Part Null: Don't touch this!
80
81 define ('PHPWIKI_VERSION', '1.3.4pre');
82 require "lib/prepend.php";
83 rcs_id('$Id: index.php,v 1.95 2002-09-09 15:26:08 rurban Exp $');
84
85 /////////////////////////////////////////////////////////////////////
86 //
87 // Part One:
88 // Authentication and security settings. See Part Three for more.
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 if (!defined('WIKI_NAME')) 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 if (!defined('ADMIN_USER')) define('ADMIN_USER', "");
107 if (!defined('ADMIN_PASSWD')) define('ADMIN_PASSWD', "");
108 // If you used the passencrypt.php utility to encode the password
109 // then uncomment this line. Recommended!
110 //if (!defined('ENCRYPTED_PASSWD')) define('ENCRYPTED_PASSWD', true);
111
112 // If true, only the admin user can make zip dumps, else zip dumps
113 // require no authentication.
114 if (!defined('ZIPDUMP_AUTH')) define('ZIPDUMP_AUTH', false);
115
116 // Don't do this on a publicly accessable wiki for now.
117 if (!defined('ENABLE_RAW_HTML')) define('ENABLE_RAW_HTML', false);
118
119 // If you define this to true, (MIME-type) page-dumps (either zip dumps,
120 // or "dumps to directory" will be encoded using the quoted-printable
121 // encoding.  If you're actually thinking of mailing the raw page dumps,
122 // then this might be useful, since (among other things,) it ensures
123 // that all lines in the message body are under 80 characters in length.
124 //
125 // Also, setting this will cause a few additional mail headers
126 // to be generated, so that the resulting dumps are valid
127 // RFC 2822 e-mail messages.
128 //
129 // Probably, you can just leave this set to false, in which case you get
130 // raw ('binary' content-encoding) page dumps.
131 define('STRICT_MAILABLE_PAGEDUMPS', false);
132
133 // Here you can change the filename suffix used for XHTML page dumps.
134 // If you don't want any suffix just comment this out.
135 $HTML_DUMP_SUFFIX = '.html';
136
137 // The maximum file upload size.
138 define('MAX_UPLOAD_SIZE', 16 * 1024 * 1024);
139
140 // If the last edit is older than MINOR_EDIT_TIMEOUT seconds, the
141 // default state for the "minor edit" checkbox on the edit page form
142 // will be off.
143 define("MINOR_EDIT_TIMEOUT", 7 * 24 * 3600);
144
145 // Actions listed in this array will not be allowed.
146 //$DisabledActions = array('dumpserial', 'loadfile');
147
148 // PhpWiki can generate an access_log (in "NCSA combined log" format)
149 // for you. If you want one, define this to the name of the log file.
150 //define('ACCESS_LOG', '/tmp/wiki_access_log');
151
152 /////////////////////////////////////////////////////////////////////
153 //
154 // Part Two:
155 // Database Selection
156 //
157 /////////////////////////////////////////////////////////////////////
158
159 //
160 // This array holds the parameters which select the database to use.
161 //
162 // Not all of these parameters are used by any particular DB backend.
163 //
164 $DBParams = array(
165    // Select the database type:
166    // Choose ADODB or SQL to use an SQL database with ADODB or PEAR.
167    // Choose dba to use one of the standard UNIX dbm libraries.
168    //'dbtype' => 'ADODB',
169    //'dbtype' => 'SQL',
170    'dbtype'   => 'dba',
171    
172    // For SQL based backends, specify the database as a DSN
173    // The most general form of a DSN looks like:
174    //
175    //   phptype(dbsyntax)://username:password@protocol+hostspec/database
176    //
177    // For a MySQL database, the following should work:
178    //
179    //   mysql://user:password@host/databasename
180    //
181    // FIXME: My version Pear::DB seems to be broken enough that there
182    //        is no way to connect to a mysql server over a socket right now.
183    //'dsn' => 'mysql://guest@:/var/lib/mysql/mysql.sock/test',
184    //'dsn' => 'mysql://guest@localhost/test',
185    //'dsn' => 'pgsql://localhost/test',
186
187    // experimental
188    'db_session_table'   => 'session',
189    
190    // Used by all DB types:
191
192    // prefix for filenames or table names
193    /* 
194     * currently you MUST EDIT THE SQL file too (in the schemas/
195     * directory because we aren't doing on the fly sql generation
196     * during the installation.
197    */
198    //'prefix' => 'phpwiki_',
199    
200    // Used only by 'dba'
201    'directory'     => "/tmp",
202    'dba_handler'   => 'gdbm',   // Either of 'gdbm' or 'db2' work great for me.
203    //'dba_handler'   => 'db2',
204    //'dba_handler'   => 'db3',    // Works fine on Windows, but not on every linux.
205    //'dba_handler'     => 'dbm',    // dbm suffers from limits on size of data items?
206    // On sf.net redhat there's dbm and gdbm
207
208    'timeout'   => 20,
209    //'timeout' => 5
210 );
211
212 //define('USE_DB_SESSION',true);
213
214 /////////////////////////////////////////////////////////////////////
215 //
216 // The next section controls how many old revisions of each page are
217 // kept in the database.
218 //
219 // There are two basic classes of revisions: major and minor. Which
220 // class a revision belongs in is determined by whether the author
221 // checked the "this is a minor revision" checkbox when they saved the
222 // page.
223 // 
224 // There is, additionally, a third class of revisions: author
225 // revisions. The most recent non-mergable revision from each distinct
226 // author is and author revision.
227 //
228 // The expiry parameters for each of those three classes of revisions
229 // can be adjusted seperately. For each class there are five
230 // parameters (usually, only two or three of the five are actually
231 // set) which control how long those revisions are kept in the
232 // database.
233 //
234 //   max_keep: If set, this specifies an absolute maximum for the
235 //             number of archived revisions of that class. This is
236 //             meant to be used as a safety cap when a non-zero
237 //             min_age is specified. It should be set relatively high,
238 //             and it's purpose is to prevent malicious or accidental
239 //             database overflow due to someone causing an
240 //             unreasonable number of edits in a short period of time.
241 //
242 //   min_age:  Revisions younger than this (based upon the supplanted
243 //             date) will be kept unless max_keep is exceeded. The age
244 //             should be specified in days. It should be a
245 //             non-negative, real number,
246 //
247 //   min_keep: At least this many revisions will be kept.
248 //
249 //   keep:     No more than this many revisions will be kept.
250 //
251 //   max_age:  No revision older than this age will be kept.
252 //
253 // Supplanted date: Revisions are timestamped at the instant that they
254 // cease being the current revision. Revision age is computed using
255 // this timestamp, not the edit time of the page.
256 //
257 // Merging: When a minor revision is deleted, if the preceding
258 // revision is by the same author, the minor revision is merged with
259 // the preceding revision before it is deleted. Essentially: this
260 // replaces the content (and supplanted timestamp) of the previous
261 // revision with the content after the merged minor edit, the rest of
262 // the page metadata for the preceding version (summary, mtime, ...)
263 // is not changed.
264 //
265 // Keep up to 8 major edits, but keep them no longer than a month.
266 $ExpireParams['major'] = array('max_age' => 32,
267                                'keep'    => 8);
268 // Keep up to 4 minor edits, but keep them no longer than a week.
269 $ExpireParams['minor'] = array('max_age' => 7,
270                                'keep'    => 4);
271 // Keep the latest contributions of the last 8 authors up to a year.
272 // Additionally, (in the case of a particularly active page) try to
273 // keep the latest contributions of all authors in the last week (even
274 // if there are more than eight of them,) but in no case keep more
275 // than twenty unique author revisions.
276 $ExpireParams['author'] = array('max_age'  => 365,
277                                 'keep'     => 8,
278                                 'min_age'  => 7,
279                                 'max_keep' => 20);
280
281 /////////////////////////////////////////////////////////////////////
282 //
283 // Part Three: (optional)
284 // User Authentification
285 //
286 /////////////////////////////////////////////////////////////////////
287
288 // The wiki can be protected by HTTP Auth. Use the username and password 
289 // from there, but this is not sufficient. Try the other methods also.
290 if (!defined('ALLOW_HTTP_AUTH_LOGIN')) define('ALLOW_HTTP_AUTH_LOGIN', false);
291
292 // If ALLOW_USER_LOGIN is true, any defined internal and external
293 // authentification method is tried. 
294 // If not, we don't care about passwords, but listen to the next 
295 // two constants.
296 if (!defined('ALLOW_USER_LOGIN')) define('ALLOW_USER_LOGIN', true); 
297
298 // If ALLOW_BOGO_LOGIN is true, users are allowed to login (with
299 // any/no password) using any userid which: 
300 //  1) is not the ADMIN_USER,
301 //  2) is a valid WikiWord (matches $WikiNameRegexp.)
302 // If true, users may be created by themselves. Otherwise we need seperate auth. 
303 // This might be renamed to ALLOW_SELF_REGISTRATION.
304 if (!defined('ALLOW_BOGO_LOGIN')) define('ALLOW_BOGO_LOGIN', true);
305
306 // This will go away, with true page permissions.
307 // If set, then if an anonymous user attempts to edit a page he will
308 // be required to sign in.  (If ALLOW_BOGO_LOGIN is true, of course,
309 // no password is required, but the user must still sign in under
310 // some sort of BogoUserId.)
311 if (!defined('REQUIRE_SIGNIN_BEFORE_EDIT')) define('REQUIRE_SIGNIN_BEFORE_EDIT', false);
312
313 // The login code now uses PHP's session support. Usually, the default
314 // configuration of PHP is to store the session state information in
315 // /tmp. That probably will work fine, but fails e.g. on clustered
316 // servers where each server has their own distinct /tmp (this is the
317 // case on SourceForge's project web server.) You can specify an
318 // alternate directory in which to store state information like so
319 // (whatever user your httpd runs as must have read/write permission
320 // in this directory):
321
322 //ini_set('session.save_path', 'some_other_directory');
323
324 // If your php was compiled with --enable-trans-sid it tries to
325 // add a PHPSESSID query argument to all URL strings when cookie
326 // support isn't detected in the client browser.  For reasons
327 // which aren't entirely clear (PHP bug) this screws up the URLs
328 // generated by PhpWiki.  Therefore, transparent session ids
329 // should be disabled.  This next line does that.
330 //
331 // (At the present time, you will not be able to log-in to PhpWiki,
332 // unless your browser supports cookies.)
333 @ini_set('session.use_trans_sid', 0);
334
335 // LDAP auth
336 if (!defined('ALLOW_LDAP_LOGIN')) define('ALLOW_LDAP_LOGIN', true and function_exists('ldap_connect'));
337 if (!defined('LDAP_AUTH_HOST'))   define('LDAP_AUTH_HOST', 'localhost');
338 // Give the right LDAP root search information in next statement. 
339 if (!defined('LDAP_AUTH_SEARCH')) define('LDAP_AUTH_SEARCH', "ou=mycompany.com,o=My Company");
340
341 // IMAP auth: check userid/passwords from a imap server, defaults to localhost
342 if (!defined('ALLOW_IMAP_LOGIN')) define('ALLOW_IMAP_LOGIN', true and function_exists('imap_open'));
343 if (!defined('IMAP_AUTH_HOST'))   define('IMAP_AUTH_HOST', 'localhost');
344
345 // Sample of external AuthDB mysql tables to check against
346 /*
347 use phpwiki;
348 CREATE TABLE pref (
349   userid char(48) binary NOT NULL UNIQUE,
350   preferences text NULL default '',
351   PRIMARY KEY (userid)
352 ) TYPE=MyISAM;
353 INSERT INTO user VALUES ('ReiniUrban', 'a:1:{s:6:"passwd";s:13:"7cyrcMAh0grMI";}');
354
355 // or password only
356 CREATE TABLE user (
357   userid char(48) binary NOT NULL UNIQUE,
358   passwd char(48) binary default '*',
359   PRIMARY KEY (userid)
360 ) TYPE=MyISAM;
361
362 */
363 // external mysql member table
364 /*
365  CREATE TABLE member (
366    user  char(48) NOT NULL,
367    group char(48) NOT NULL default 'users',
368    PRIMARY KEY (user),
369    KEY groupname (groupname)
370  ) TYPE=MyISAM;
371  INSERT INTO member VALUES ('wikiadmin', 'root');
372  INSERT INTO member VALUES ('TestUser', 'users');
373 */
374
375 // 
376 // Seperate DB User Authentification. 
377 //   Can be external, like radius, phpnuke, courier authmysql,
378 //   apache auth_mysql or something else.
379 // We default to store them as metadata in WikiPages.
380 // The most likely option is the same dsn as the wikipages.
381 $DBAuthParams = array(
382    //'auth_dsn'         => 'mysql://localhost/phpwiki',
383    //'auth_user_file'  => '/etc/shadow', // '/etc/httpd/.htpasswd'
384    //'auth_group_file' => '/etc/groups', // '/etc/httpd/.htgroup'
385
386    // USER => PASSWORD
387    'auth_check'  => 'SELECT passwd FROM user WHERE username="$userid"',
388
389    'auth_crypt_method'  => 'crypt',     // 'crypt' (unix) or 'md5' (mysql) or just 'plain'
390    // 'auth_crypt_method'  => 'md5',    // for 'mysql://localhost/mysql' users
391    // 'auth_crypt_method'  => 'plain',
392    'auth_update'  => 'UPDATE user SET passwd="$crypt_passwd" WHERE username="$userid"',
393    //'auth_update'  => 'UPDATE user SET passwd="$md5_passwd" WHERE username="$userid"',
394    //'auth_update'  => 'UPDATE user SET passwd="$plain_passwd" WHERE username="$userid"',
395
396    // USER => PREFERENCES
397    //'pref_select' => 'SELECT pref from user WHERE username="$userid"',
398    //'pref_update' => 'UPDATE user SET prefs="$pref_blob" WHERE username="$userid"',
399
400    // USERS <=> GROUPS
401    // all members of the group
402    'group_members' => 'SELECT username FROM grouptable WHERE groupname="$group"',
403    // all groups this user belongs to
404    'user_groups' => 'SELECT groupname FROM grouptable WHERE username="$userid"',
405
406    'dummy' => false,
407 );
408
409 /////////////////////////////////////////////////////////////////////
410 // 
411 // Part Four:
412 // Page appearance and layout
413 //
414 /////////////////////////////////////////////////////////////////////
415
416 /* THEME
417  *
418  * Most of the page appearance is controlled by files in the theme
419  * subdirectory.
420  *
421  * There are a number of pre-defined themes shipped with PhpWiki.
422  * Or you may create your own (e.g. by copying and then modifying one of
423  * stock themes.)
424  *
425  * Pick one.
426  */
427 if (!defined('THEME')) {
428 define('THEME', 'default');
429 //define('THEME', 'Hawaiian');
430 //define('THEME', 'MacOSX');
431 //define('THEME', 'Portland');
432 //define('THEME', 'Sidebar');
433 //define('THEME', 'SpaceWiki');
434 }
435
436 // Select a valid charset name to be inserted into the xml/html pages,
437 // and to reference links to the stylesheets (css). For more info see:
438 // <http://www.iana.org/assignments/character-sets>. Note that PhpWiki
439 // has been extensively tested only with the latin1 (iso-8859-1)
440 // character set.
441 //
442 // If you change the default from iso-8859-1 PhpWiki may not work
443 // properly and it will require code modifications. However, character
444 // sets similar to iso-8859-1 may work with little or no modification
445 // depending on your setup. The database must also support the same
446 // charset, and of course the same is true for the web browser. (Some
447 // work is in progress hopefully to allow more flexibility in this
448 // area in the future).
449 define("CHARSET", "iso-8859-1");
450
451 // Select your language/locale - default language is "C" for English.
452 // Other languages available:
453 // English "C"  (English    - HomePage)
454 // Dutch   "nl" (Nederlands - ThuisPagina)
455 // Spanish "es" (Español    - PáginaPrincipal)
456 // French  "fr" (Français   - Accueil)
457 // German  "de" (Deutsch    - StartSeite)
458 // Swedish "sv" (Svenska    - Framsida)
459 // Italian "it" (Italiano   - PaginaPrincipale)
460 //
461 // If you set $LANG to the empty string, your systems default language
462 // (as determined by the applicable environment variables) will be
463 // used.
464 //
465 // Note that on some systems, apprently using these short forms for
466 // the locale won't work. On my home system 'LANG=de' won't result in
467 // german pages. Somehow the system must recognize the locale as a
468 // valid locale before gettext() will work, i.e., use 'de_DE',
469 // 'nl_NL'.
470 if (empty($LANG)) $LANG='en';
471 //$LANG='nl_NL';
472
473 // Setting the LANG environment variable (accomplished above) may or
474 // may not be sufficient to cause PhpWiki to produce dates in your
475 // native language. (It depends on the configuration of the operating
476 // system on your http server.)  The problem is that, e.g. 'de' is
477 // often not a valid locale.
478 //
479 // A standard locale name is typically of  the  form
480 // language[_territory][.codeset][@modifier],  where  language is
481 // an ISO 639 language code, territory is an ISO 3166 country code,
482 // and codeset  is  a  character  set or encoding identifier like
483 // ISO-8859-1 or UTF-8.
484 //
485 // You can tailor the locale used for time and date formatting by
486 // setting the LC_TIME environment variable. You'll have to experiment
487 // to find the correct setting.
488 // gettext() fix: With setlocale() we must use the long form, 
489 // like 'de_DE','nl_NL', 'es_MX', 'es_AR', 'fr_FR'. 
490 // For Windows maybe even 'german'. You might fix this accordingly.
491 $language_locales = array(
492                           'en' => 'C',
493                           'de' => 'de_DE',
494                           'es' => 'es_MX',
495                           'nl' => 'nl_NL',
496                           'fr' => 'fr_FR',
497                           'it' => 'it_IT',
498                           'sv' => 'sv_SV'
499                           );
500 if (empty($LC_ALL)) {
501   if (empty($language_locales['LANG'])) 
502      $LC_ALL = $LANG;
503   else
504      $LC_ALL = $language_locales['LANG'];
505 }
506 putenv("LC_TIME=$LC_ALL");
507
508 /* WIKI_PGSRC -- specifies the source for the initial page contents of
509  * the Wiki. The setting of WIKI_PGSRC only has effect when the wiki is
510  * accessed for the first time (or after clearing the database.)
511  * WIKI_PGSRC can either name a directory or a zip file. In either case
512  * WIKI_PGSRC is scanned for files -- one file per page.
513  */
514 if (!defined('WIKI_PGSRC')) define('WIKI_PGSRC', "pgsrc"); // Default (old) behavior.
515 //define('WIKI_PGSRC', 'wiki.zip'); // New style.
516 //define('WIKI_PGSRC', '../../../Logs/Hamwiki/hamwiki-20010830.zip'); // New style.
517
518 /*
519  * DEFAULT_WIKI_PGSRC is only used when the language is *not* the
520  * default (English) and when reading from a directory: in that case
521  * some English pages are inserted into the wiki as well.
522  * DEFAULT_WIKI_PGSRC defines where the English pages reside.
523  */
524 // FIXME: is this really needed?  Can't we just copy these pages into
525 // the localized pgsrc?
526 define('DEFAULT_WIKI_PGSRC', "pgsrc");
527 // These are the pages which will get loaded from DEFAULT_WIKI_PGSRC.   
528 $GenericPages = array("ReleaseNotes", "SteveWainstead", "TestPage");
529
530 /////////////////////////////////////////////////////////////////////
531 //
532 // Part Five:
533 // Mark-up options.
534 // 
535 /////////////////////////////////////////////////////////////////////
536
537 // allowed protocols for links - be careful not to allow "javascript:"
538 // URL of these types will be automatically linked.
539 // within a named link [name|uri] one more protocol is defined: phpwiki
540 $AllowedProtocols = "http|https|mailto|ftp|news|nntp|ssh|gopher";
541
542 // URLs ending with the following extension should be inlined as images
543 $InlineImages = "png|jpg|gif";
544
545 // Perl regexp for WikiNames ("bumpy words")
546 // (?<!..) & (?!...) used instead of '\b' because \b matches '_' as well
547 $WikiNameRegexp = "(?<![[:alnum:]])(?:[[:upper:]][[:lower:]]+){2,}(?![[:alnum:]])";
548
549 // Defaults to '/', but '.' was also used.
550 if (!defined('SUBPAGE_SEPARATOR')) define('SUBPAGE_SEPARATOR', '/');
551
552 // InterWiki linking -- wiki-style links to other wikis on the web
553 //
554 // The map will be taken from a page name InterWikiMap.
555 // If that page is not found (or is not locked), or map
556 // data can not be found in it, then the file specified
557 // by INTERWIKI_MAP_FILE (if any) will be used.
558 define('INTERWIKI_MAP_FILE', "lib/interwiki.map");
559
560 // Display a warning if the internal lib/interwiki.map is used, and 
561 // not the public InterWikiMap page. This map is not readable from outside.
562 //define('WARN_NONPUBLIC_INTERWIKIMAP', false);
563
564 /////////////////////////////////////////////////////////////////////
565 //
566 // Part Six:
567 // URL options -- you can probably skip this section.
568 //
569 /////////////////////////////////////////////////////////////////////
570 /******************************************************************
571  *
572  * The following section contains settings which you can use to tailor
573  * the URLs which PhpWiki generates.
574  *
575  * Any of these parameters which are left undefined will be deduced
576  * automatically. You need only set them explicitly if the
577  * auto-detected values prove to be incorrect.
578  *
579  * In most cases the auto-detected values should work fine, so
580  * hopefully you don't need to mess with this section.
581  *
582  * In case of local overrides of short placeholders, which themselves 
583  * include index.php, we check for most constants. See '/wiki'.
584  * We can override DATA_PATH and PHPWIKI_DIR to support multiple phpwiki 
585  * versions (for development), but most likely other values like 
586  * THEME, $LANG and $DbParams for a WikiFarm.
587  *
588  ******************************************************************/
589
590 /*
591  * Canonical name and httpd port of the server on which this PhpWiki
592  * resides.
593  */
594 //if (!defined('SERVER_NAME')) define('SERVER_NAME', 'some.host.com');
595 //define('SERVER_PORT', 80);
596
597 /*
598  * Relative URL (from the server root) of the PhpWiki
599  * script.
600  */
601 //if (!defined('SCRIPT_NAME')) define('SCRIPT_NAME', '/some/where/index.php');
602
603 /*
604  * URL of the PhpWiki install directory.  (You only need to set this
605  * if you've moved index.php out of the install directory.)  This can
606  * be either a relative URL (from the directory where the top-level
607  * PhpWiki script is) or an absolute one.
608  */
609 //if (!defined('DATA_PATH')) define('DATA_PATH', '/home/user/phpwiki');
610
611 /*
612  * Path to the PhpWiki install directory.  This is the local
613  * filesystem counterpart to DATA_PATH.  (If you have to set
614  * DATA_PATH, your probably have to set this as well.)  This can be
615  * either an absolute path, or a relative path interpreted from the
616  * directory where the top-level PhpWiki script (normally index.php)
617  * resides.
618  */
619 //if (!defined('PHPWIKI_DIR')) define('PHPWIKI_DIR', 'C:/Apache/phpwiki');
620 //if (!defined('PHPWIKI_DIR')) define('PHPWIKI_DIR', '/home/user/public_html/phpwiki');
621
622 /*
623  * Define to false to NOT use PATH_INFO to pass the pagename's.
624  * e.g. the old http://www.some.where/index.php?pagename=HomePage
625  * instead of http://www.some.where/index.php/HomePage
626  * or even better http://www.some.where/wiki/HomePage
627  *
628  * FIXME: more docs (maybe in README).
629  * Default: true
630  */
631 //if (!defined('USE_PATH_INFO')) define('USE_PATH_INFO', false);
632
633 /*
634  * VIRTUAL_PATH is the canonical URL path under which your your wiki
635  * appears. Normally this is the same as dirname(SCRIPT_NAME), however
636  * using, e.g. apaches mod_actions (or mod_rewrite), you can make it
637  * something different.
638  *
639  * If you do this, you should set VIRTUAL_PATH here.
640  *
641  * E.g. your phpwiki might be installed at at /scripts/phpwiki/index.php,
642  * but  * you've made it accessible through eg. /wiki/HomePage.
643  *
644  * One way to do this is to create a directory named 'wiki' in your
645  * server root. The directory contains only one file: an .htaccess
646  * file which reads something like:
647  *
648  *    Action x-phpwiki-page /scripts/phpwiki/index.php
649  *    SetHandler x-phpwiki-page
650  *    DirectoryIndex /scripts/phpwiki/index.php
651  *
652  * In that case you should set VIRTUAL_PATH to '/wiki'.
653  *
654  * (VIRTUAL_PATH is only used if USE_PATH_INFO is true.)
655  */
656 //if (!defined('VIRTUAL_PATH')) define('VIRTUAL_PATH', '/SomeWiki');
657
658
659 ////////////////////////////////////////////////////////////////
660 // Check if we were included by some other wiki version (getimg, en, ...) 
661 // or not. 
662 // If the server requested this index.php fire up the code by loading lib/main.php.
663 // Parallel wiki scripts can now simply include /index.php for the 
664 // main configuration, extend or redefine some settings and 
665 // load lib/main.php by themselves. 
666 // This overcomes the index as config problem.
667 ////////////////////////////////////////////////////////////////
668
669 // Tested: Works with CGI also.
670 if (defined('VIRTUAL_PATH') and defined('USE_PATH_INFO')) {
671     if ($HTTP_SERVER_VARS['SCRIPT_NAME'] == VIRTUAL_PATH) {
672         include "lib/main.php";
673     }
674 } else {
675     if (defined('SCRIPT_NAME') and 
676         ($HTTP_SERVER_VARS['SCRIPT_NAME'] == SCRIPT_NAME)) {
677         include "lib/main.php";
678     } elseif (strstr($HTTP_SERVER_VARS['PHP_SELF'],'index.php')) {
679         include "lib/main.php";
680     }
681 }
682
683 // (c-file-style: "gnu")
684 // Local Variables:
685 // mode: php
686 // tab-width: 8
687 // c-basic-offset: 4
688 // c-hanging-comment-ender-p: nil
689 // indent-tabs-mode: nil
690 // End:   
691 ?>