]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - index.php
Add option to prevent HTTP redirect.
[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", "Jochen Kalmbach");
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 seven parts: Parts Zero, One, Two, Three,
38   Four, Five and Six. 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 define ('DEBUG', 1);
78
79 /////////////////////////////////////////////////////////////////////
80 // Part Null: Don't touch this!
81
82 define ('PHPWIKI_VERSION', '1.3.5pre');
83 require "lib/prepend.php";
84 rcs_id('$Id: index.php,v 1.106 2003-03-07 02:48:23 dairiki Exp $');
85
86 /////////////////////////////////////////////////////////////////////
87 //
88 // Part One:
89 // Authentication and security settings. See Part Three for more.
90 // 
91 /////////////////////////////////////////////////////////////////////
92
93 // The name of your wiki.
94 // This is used to generate a keywords meta tag in the HTML templates,
95 // in bookmark titles for any bookmarks made to pages in your wiki,
96 // and during RSS generation for the <title> of the RSS channel.
97 if (!defined('WIKI_NAME')) define('WIKI_NAME', 'PhpWiki');
98
99 // If set, we will perform reverse dns lookups to try to convert the
100 // users IP number to a host name, even if the http server didn't do
101 // it for us.
102 define('ENABLE_REVERSE_DNS', true);
103
104 // Username and password of administrator.
105 // Set these to your preferences. For heaven's sake
106 // pick a good password or use our passwordencrypt.php tool.
107 if (!defined('ADMIN_USER')) define('ADMIN_USER', "");
108 if (!defined('ADMIN_PASSWD')) define('ADMIN_PASSWD', "");
109 // If you used the passencrypt.php utility to encode the password
110 // then uncomment this line. Recommended!
111 //if (!defined('ENCRYPTED_PASSWD')) define('ENCRYPTED_PASSWD', true);
112
113 // If true, only the admin user can make zip dumps, else zip dumps
114 // require no authentication.
115 if (!defined('ZIPDUMP_AUTH')) define('ZIPDUMP_AUTH', false);
116
117 // Don't do this on a publicly accessable wiki for now.
118 if (!defined('ENABLE_RAW_HTML')) define('ENABLE_RAW_HTML', false);
119
120 // If you define this to true, (MIME-type) page-dumps (either zip dumps,
121 // or "dumps to directory" will be encoded using the quoted-printable
122 // encoding.  If you're actually thinking of mailing the raw page dumps,
123 // then this might be useful, since (among other things,) it ensures
124 // that all lines in the message body are under 80 characters in length.
125 //
126 // Also, setting this will cause a few additional mail headers
127 // to be generated, so that the resulting dumps are valid
128 // RFC 2822 e-mail messages.
129 //
130 // Probably, you can just leave this set to false, in which case you get
131 // raw ('binary' content-encoding) page dumps.
132 define('STRICT_MAILABLE_PAGEDUMPS', false);
133
134 // Here you can change the filename suffix used for XHTML page dumps.
135 // If you don't want any suffix just comment this out.
136 $HTML_DUMP_SUFFIX = '.html';
137
138 // The maximum file upload size.
139 define('MAX_UPLOAD_SIZE', 16 * 1024 * 1024);
140
141 // If the last edit is older than MINOR_EDIT_TIMEOUT seconds, the
142 // default state for the "minor edit" checkbox on the edit page form
143 // will be off.
144 define("MINOR_EDIT_TIMEOUT", 7 * 24 * 3600);
145
146 // Actions listed in this array will not be allowed.
147 //$DisabledActions = array('dumpserial', 'loadfile');
148
149 // PhpWiki can generate an access_log (in "NCSA combined log" format)
150 // for you. If you want one, define this to the name of the log file.
151 //define('ACCESS_LOG', '/tmp/wiki_access_log');
152
153
154 // By default PhpWiki will try to have PHP compress it's output
155 // before sending it to the browser (if you have a recent enough
156 // version of PHP and the browser supports it.)
157 // Define COMPRESS_OUTPUT to false to prevent output compression.
158 // Define COMPRESS_OUTPUT to true to force output compression,
159 // even if we think your version of PHP does this in a buggy
160 // fashion.
161 // Leave it undefined to leave the choice up to PhpWiki.
162 //define('COMPRESS_OUTPUT', false);
163
164
165 // HTTP CACHE_CONTROL
166 //
167 // This controls how PhpWiki sets the HTTP cache control
168 // headers (Expires: and Cache-Control:) 
169 //
170 // Choose one of:
171 //
172 // NONE: This is roughly the old (pre 1.3.4) behavior.  PhpWiki will
173 //       instruct proxies and browsers never to cache PhpWiki output.
174 //
175 // STRICT: Cached pages will be invalidated whenever the database global
176 //       timestamp changes.  This should behave just like NONE (modulo
177 //       bugs in PhpWiki and your proxies and browsers), except that
178 //       things will be slightly more efficient.
179 //
180 // LOOSE: Cached pages will be invalidated whenever they are edited,
181 //       or, if the pages include plugins, when the plugin output could
182 //       concievably have changed.
183 //
184 //       Behavior should be much like STRICT, except that sometimes
185 //       wikilinks will show up as undefined (with the question mark)
186 //       when in fact they refer to (recently) created pages.
187 //       (Hitting your browsers reload or perhaps shift-reload button
188 //       should fix the problem.)
189 //
190 // ALLOW_STALE: Proxies and browsers will be allowed to used stale pages.
191 //       (The timeout for stale pages is controlled by CACHE_CONTROL_MAX_AGE.)
192 //
193 //       This setting will result in quirky behavior.  When you edit a
194 //       page your changes may not show up until you shift-reload the
195 //       page, etc...
196 //
197 //       This setting is generally not advisable, however it may be useful
198 //       in certain cases (e.g. if your wiki gets lots of page views,
199 //       and few edits by knowledgable people who won't freak over the quirks.)
200 //
201 // The default is currently LOOSE.
202 //
203 if (!defined('CACHE_CONTROL')) define('CACHE_CONTROL', 'LOOSE');
204
205 // Maximum page staleness, in seconds.
206 //
207 // This only has effect if CACHE_CONTROL is set to ALLOW_STALE.
208 if (!defined('CACHE_CONTROL_MAX_AGE')) define('CACHE_CONTROL_MAX_AGE', 600);
209
210
211 // MARKUP CACHING
212 //
213 // PhpWiki normally caches a preparsed version (i.e. mostly
214 // converted to HTML) of the most recent version of each page.
215 // (Parsing the wiki-markup takes a fair amount of CPU.)
216 //
217 // Define WIKIDB_NOCACHE_MARKUP to true to disable the
218 // caching of marked-up page content.
219 //
220 // Note that you can also disable markup caching on a per-page
221 // temporary basis by addinging a query arg of '?nocache=1'
222 // to the URL to the page.  (Use '?nocache=purge' to completely
223 // discard the cached version of the page.)
224 //
225 // You can also purge the cached markup globally by using the
226 // "Purge Markup Cache" button on the PhpWikiAdministration page.
227 //if (!defined('WIKIDB_NOCACHE_MARKUP')) define ('WIKIDB_NOCACHE_MARKUP', true);
228
229
230 /////////////////////////////////////////////////////////////////////
231 //
232 // Part Two:
233 // Database Selection
234 //
235 /////////////////////////////////////////////////////////////////////
236
237 //
238 // This array holds the parameters which select the database to use.
239 //
240 // Not all of these parameters are used by any particular DB backend.
241 //
242 $DBParams = array(
243    // Select the database type:
244    // Choose ADODB or SQL to use an SQL database with ADODB or PEAR.
245    // Choose dba to use one of the standard UNIX dbm libraries.
246    // Choose file to use a flat file database.
247    //'dbtype' => 'ADODB',
248    //'dbtype' => 'SQL',
249    'dbtype'   => 'dba',
250    //'dbtype' => 'file',
251    
252    // For SQL based backends, specify the database as a DSN
253    // The most general form of a DSN looks like:
254    //
255    //   phptype(dbsyntax)://username:password@protocol+hostspec/database
256    //
257    // For a MySQL database, the following should work:
258    //
259    //   mysql://user:password@host/databasename
260    //
261    // To connect over a unix socket, use something like
262    //
263    //   mysql://user:password@unix(/path/to/socket)/databasename
264    //
265    //'dsn' => 'mysql://guest@unix(/var/lib/mysql/mysql.sock)/test',
266    //'dsn' => 'mysql://guest@localhost/test',
267    //'dsn' => 'pgsql://localhost/test',
268
269    // experimental
270    'db_session_table'   => 'session',
271    
272    // Used by all DB types:
273
274    // prefix for filenames or table names
275    /* 
276     * currently you MUST EDIT THE SQL file too (in the schemas/
277     * directory because we aren't doing on the fly sql generation
278     * during the installation.
279    */
280    //'prefix' => 'phpwiki_',
281    
282    // Used by either 'dba' or 'file' and must be writable by the web
283    // server If you leave this as '/tmp' you will probably lose all
284    // your files eventually
285    'directory'     => "/tmp",
286
287    // choose the type of DB database file to use; most GNU systems have gdbm
288    'dba_handler'   => 'gdbm',   // Either of 'gdbm' or 'db2' work great for me.
289    //'dba_handler' => 'db2',
290    //'dba_handler' => 'db3',    // Works fine on Windows, but not on every linux.
291    //'dba_handler' => 'dbm',    // On sf.net redhat there's dbm and gdbm.
292                                 // dbm suffers from limits on size of data items?
293
294    'timeout'   => 20,
295    //'timeout' => 5
296 );
297
298 // Only for 'dbtype' => 'SQL'. See schemas/mysql.sql or schemas/psql.sql
299 //define('USE_DB_SESSION',true);
300
301 /////////////////////////////////////////////////////////////////////
302 //
303 // The next section controls how many old revisions of each page are
304 // kept in the database.
305 //
306 // There are two basic classes of revisions: major and minor. Which
307 // class a revision belongs in is determined by whether the author
308 // checked the "this is a minor revision" checkbox when they saved the
309 // page.
310 // 
311 // There is, additionally, a third class of revisions: author
312 // revisions. The most recent non-mergable revision from each distinct
313 // author is and author revision.
314 //
315 // The expiry parameters for each of those three classes of revisions
316 // can be adjusted seperately. For each class there are five
317 // parameters (usually, only two or three of the five are actually
318 // set) which control how long those revisions are kept in the
319 // database.
320 //
321 //   max_keep: If set, this specifies an absolute maximum for the
322 //             number of archived revisions of that class. This is
323 //             meant to be used as a safety cap when a non-zero
324 //             min_age is specified. It should be set relatively high,
325 //             and it's purpose is to prevent malicious or accidental
326 //             database overflow due to someone causing an
327 //             unreasonable number of edits in a short period of time.
328 //
329 //   min_age:  Revisions younger than this (based upon the supplanted
330 //             date) will be kept unless max_keep is exceeded. The age
331 //             should be specified in days. It should be a
332 //             non-negative, real number,
333 //
334 //   min_keep: At least this many revisions will be kept.
335 //
336 //   keep:     No more than this many revisions will be kept.
337 //
338 //   max_age:  No revision older than this age will be kept.
339 //
340 // Supplanted date: Revisions are timestamped at the instant that they
341 // cease being the current revision. Revision age is computed using
342 // this timestamp, not the edit time of the page.
343 //
344 // Merging: When a minor revision is deleted, if the preceding
345 // revision is by the same author, the minor revision is merged with
346 // the preceding revision before it is deleted. Essentially: this
347 // replaces the content (and supplanted timestamp) of the previous
348 // revision with the content after the merged minor edit, the rest of
349 // the page metadata for the preceding version (summary, mtime, ...)
350 // is not changed.
351 //
352 // Keep up to 8 major edits, but keep them no longer than a month.
353 $ExpireParams['major'] = array('max_age' => 32,
354                                'keep'    => 8);
355 // Keep up to 4 minor edits, but keep them no longer than a week.
356 $ExpireParams['minor'] = array('max_age' => 7,
357                                'keep'    => 4);
358 // Keep the latest contributions of the last 8 authors up to a year.
359 // Additionally, (in the case of a particularly active page) try to
360 // keep the latest contributions of all authors in the last week (even
361 // if there are more than eight of them,) but in no case keep more
362 // than twenty unique author revisions.
363 $ExpireParams['author'] = array('max_age'  => 365,
364                                 'keep'     => 8,
365                                 'min_age'  => 7,
366                                 'max_keep' => 20);
367
368 /////////////////////////////////////////////////////////////////////
369 //
370 // Part Three: (optional)
371 // User Authentification
372 //
373 /////////////////////////////////////////////////////////////////////
374
375 // The wiki can be protected by HTTP Auth. Use the username and password 
376 // from there, but this is not sufficient. Try the other methods also.
377 if (!defined('ALLOW_HTTP_AUTH_LOGIN')) define('ALLOW_HTTP_AUTH_LOGIN', false);
378
379 // If ALLOW_USER_LOGIN is true, any defined internal and external
380 // authentification method is tried. 
381 // If not, we don't care about passwords, but listen to the next 
382 // two constants.
383 if (!defined('ALLOW_USER_LOGIN')) define('ALLOW_USER_LOGIN', true); 
384
385 // If ALLOW_BOGO_LOGIN is true, users are allowed to login (with
386 // any/no password) using any userid which: 
387 //  1) is not the ADMIN_USER,
388 //  2) is a valid WikiWord (matches $WikiNameRegexp.)
389 // If true, users may be created by themselves. Otherwise we need seperate auth. 
390 // This might be renamed to ALLOW_SELF_REGISTRATION.
391 if (!defined('ALLOW_BOGO_LOGIN')) define('ALLOW_BOGO_LOGIN', true);
392
393 // This will go away, with true page permissions.
394 // If set, then if an anonymous user attempts to edit a page he will
395 // be required to sign in.  (If ALLOW_BOGO_LOGIN is true, of course,
396 // no password is required, but the user must still sign in under
397 // some sort of BogoUserId.)
398 if (!defined('REQUIRE_SIGNIN_BEFORE_EDIT')) define('REQUIRE_SIGNIN_BEFORE_EDIT', false);
399
400 // The login code now uses PHP's session support. Usually, the default
401 // configuration of PHP is to store the session state information in
402 // /tmp. That probably will work fine, but fails e.g. on clustered
403 // servers where each server has their own distinct /tmp (this is the
404 // case on SourceForge's project web server.) You can specify an
405 // alternate directory in which to store state information like so
406 // (whatever user your httpd runs as must have read/write permission
407 // in this directory):
408
409 //ini_set('session.save_path', 'some_other_directory');
410
411 // If your php was compiled with --enable-trans-sid it tries to
412 // add a PHPSESSID query argument to all URL strings when cookie
413 // support isn't detected in the client browser.  For reasons
414 // which aren't entirely clear (PHP bug) this screws up the URLs
415 // generated by PhpWiki.  Therefore, transparent session ids
416 // should be disabled.  This next line does that.
417 //
418 // (At the present time, you will not be able to log-in to PhpWiki,
419 // unless your browser supports cookies.)
420 @ini_set('session.use_trans_sid', 0);
421
422 // LDAP auth
423 if (!defined('ALLOW_LDAP_LOGIN')) define('ALLOW_LDAP_LOGIN', true and function_exists('ldap_connect'));
424 if (!defined('LDAP_AUTH_HOST'))   define('LDAP_AUTH_HOST', 'localhost');
425 // Give the right LDAP root search information in the next statement. 
426 if (!defined('LDAP_AUTH_SEARCH')) define('LDAP_AUTH_SEARCH', "ou=mycompany.com,o=My Company");
427
428 // IMAP auth: check userid/passwords from a imap server, defaults to localhost
429 if (!defined('ALLOW_IMAP_LOGIN')) define('ALLOW_IMAP_LOGIN', true and function_exists('imap_open'));
430 if (!defined('IMAP_AUTH_HOST'))   define('IMAP_AUTH_HOST', 'localhost');
431
432 // Sample of external AuthDB mysql tables to check against
433 /*
434 use phpwiki;
435 CREATE TABLE pref (
436   userid char(48) binary NOT NULL UNIQUE,
437   preferences text NULL default '',
438   PRIMARY KEY (userid)
439 ) TYPE=MyISAM;
440 INSERT INTO user VALUES ('ReiniUrban', 'a:1:{s:6:"passwd";s:13:"7cyrcMAh0grMI";}');
441
442 // or password only
443 CREATE TABLE user (
444   userid char(48) binary NOT NULL UNIQUE,
445   passwd char(48) binary default '*',
446   PRIMARY KEY (userid)
447 ) TYPE=MyISAM;
448
449 */
450 // external mysql member table
451 /*
452  CREATE TABLE member (
453    user  char(48) NOT NULL,
454    group char(48) NOT NULL default 'users',
455    PRIMARY KEY (user),
456    KEY groupname (groupname)
457  ) TYPE=MyISAM;
458  INSERT INTO member VALUES ('wikiadmin', 'root');
459  INSERT INTO member VALUES ('TestUser', 'users');
460 */
461
462 // 
463 // Seperate DB User Authentification. 
464 //   Can be external, like radius, phpnuke, courier authmysql,
465 //   apache auth_mysql or something else.
466 // The default is to store the data as metadata in WikiPages.
467 // The most likely dsn option is the same dsn as the wikipages.
468 $DBAuthParams = array(
469    //'auth_dsn'         => 'mysql://localhost/phpwiki',
470
471    // USER => PASSWORD
472    'auth_check'  => 'SELECT passwd FROM user WHERE username="$userid"',
473    // Alternatively we accept files also. (not yet)
474    //'auth_user_file'  => '/etc/shadow', // '/etc/httpd/.htpasswd'
475
476    'auth_crypt_method'  => 'crypt',     // 'crypt' (unix) or 'md5' (mysql) or just 'plain'
477    // 'auth_crypt_method'  => 'md5',    // for 'mysql://localhost/mysql' users
478    // 'auth_crypt_method'  => 'plain',
479
480    // If 'auth_update' is not defined but 'auth_check' is defined, the user cannot 
481    // change his password.
482    // $password is processed  by the 'auth_crypt_method'.
483    'auth_update'  => 'UPDATE user SET password="$password" WHERE username="$userid"',
484
485    // USER => PREFERENCES
486    //   This can be optionally defined in an external DB. 
487    //   The default is the users homepage.
488    //'pref_select' => 'SELECT pref from user WHERE username="$userid"',
489    //'pref_update' => 'UPDATE user SET prefs="$pref_blob" WHERE username="$userid"',
490
491    // USERS <=> GROUPS
492    //   This can be optionally defined in an external DB. The default is a 
493    //   special locked wikipage for groupmembers .(which?)
494    // All members of the group:
495    'group_members' => 'SELECT username FROM grouptable WHERE groupname="$group"',
496    // All groups this user belongs to:
497    'user_groups' => 'SELECT groupname FROM grouptable WHERE username="$userid"',
498    // Alternatively we accept files also. (not yet)
499    //'auth_group_file' => '/etc/groups', // '/etc/httpd/.htgroup'
500
501    'dummy' => false,
502 );
503
504 /////////////////////////////////////////////////////////////////////
505 //
506 // Part Four:
507 // Page appearance and layout
508 //
509 /////////////////////////////////////////////////////////////////////
510
511 /* THEME
512  *
513  * Most of the page appearance is controlled by files in the theme
514  * subdirectory.
515  *
516  * There are a number of pre-defined themes shipped with PhpWiki.
517  * Or you may create your own (e.g. by copying and then modifying one of
518  * stock themes.)
519  *
520  * Pick one.
521  */
522 if (!defined('THEME')) {
523 define('THEME', 'default');
524 //define('THEME', 'Hawaiian');
525 //define('THEME', 'MacOSX');
526 //define('THEME', 'Portland');
527 //define('THEME', 'Sidebar');
528 //define('THEME', 'SpaceWiki');
529 }
530
531 // Select a valid charset name to be inserted into the xml/html pages,
532 // and to reference links to the stylesheets (css). For more info see:
533 // <http://www.iana.org/assignments/character-sets>. Note that PhpWiki
534 // has been extensively tested only with the latin1 (iso-8859-1)
535 // character set.
536 //
537 // If you change the default from iso-8859-1 PhpWiki may not work
538 // properly and it will require code modifications. However, character
539 // sets similar to iso-8859-1 may work with little or no modification
540 // depending on your setup. The database must also support the same
541 // charset, and of course the same is true for the web browser. (Some
542 // work is in progress hopefully to allow more flexibility in this
543 // area in the future).
544 define("CHARSET", "iso-8859-1");
545
546 // Select your language/locale - default language is "en" for English.
547 // Other languages available:
548 // English "en"  (English    - HomePage)
549 // Dutch   "nl" (Nederlands - ThuisPagina)
550 // Spanish "es" (Español    - PáginaPrincipal)
551 // French  "fr" (Français   - Accueil)
552 // German  "de" (Deutsch    - StartSeite)
553 // Swedish "sv" (Svenska    - Framsida)
554 // Italian "it" (Italiano   - PaginaPrincipale)
555 //
556 // If you set $LANG to the empty string, your systems default language
557 // (as determined by the applicable environment variables) will be
558 // used.
559 //
560 define('DEFAULT_LANGUAGE', 'en');
561
562 /* WIKI_PGSRC -- specifies the source for the initial page contents of
563  * the Wiki. The setting of WIKI_PGSRC only has effect when the wiki is
564  * accessed for the first time (or after clearing the database.)
565  * WIKI_PGSRC can either name a directory or a zip file. In either case
566  * WIKI_PGSRC is scanned for files -- one file per page.
567  */
568 if (!defined('WIKI_PGSRC')) define('WIKI_PGSRC', "pgsrc"); // Default (old) behavior.
569 //define('WIKI_PGSRC', 'wiki.zip'); // New style.
570 //define('WIKI_PGSRC', '../../../Logs/Hamwiki/hamwiki-20010830.zip'); // New style.
571
572 /*
573  * DEFAULT_WIKI_PGSRC is only used when the language is *not* the
574  * default (English) and when reading from a directory: in that case
575  * some English pages are inserted into the wiki as well.
576  * DEFAULT_WIKI_PGSRC defines where the English pages reside.
577  */
578 // FIXME: is this really needed?  Can't we just copy these pages into
579 // the localized pgsrc?
580 define('DEFAULT_WIKI_PGSRC', "pgsrc");
581 // These are the pages which will get loaded from DEFAULT_WIKI_PGSRC.   
582 $GenericPages = array("ReleaseNotes", "SteveWainstead", "TestPage");
583
584 /////////////////////////////////////////////////////////////////////
585 //
586 // Part Five:
587 // Mark-up options.
588 // 
589 /////////////////////////////////////////////////////////////////////
590
591 // allowed protocols for links - be careful not to allow "javascript:"
592 // URL of these types will be automatically linked.
593 // within a named link [name|uri] one more protocol is defined: phpwiki
594 $AllowedProtocols = "http|https|mailto|ftp|news|nntp|ssh|gopher";
595
596 // URLs ending with the following extension should be inlined as images
597 $InlineImages = "png|jpg|gif";
598
599 // Perl regexp for WikiNames ("bumpy words")
600 // (?<!..) & (?!...) used instead of '\b' because \b matches '_' as well
601 $WikiNameRegexp = "(?<![[:alnum:]])(?:[[:upper:]][[:lower:]]+){2,}(?![[:alnum:]])";
602
603 // Defaults to '/', but '.' was also used.
604 if (!defined('SUBPAGE_SEPARATOR')) define('SUBPAGE_SEPARATOR', '/');
605
606 // InterWiki linking -- wiki-style links to other wikis on the web
607 //
608 // The map will be taken from a page name InterWikiMap.
609 // If that page is not found (or is not locked), or map
610 // data can not be found in it, then the file specified
611 // by INTERWIKI_MAP_FILE (if any) will be used.
612 define('INTERWIKI_MAP_FILE', "lib/interwiki.map");
613
614 // Display a warning if the internal lib/interwiki.map is used, and 
615 // not the public InterWikiMap page. This map is not readable from outside.
616 //define('WARN_NONPUBLIC_INTERWIKIMAP', false);
617
618 /////////////////////////////////////////////////////////////////////
619 //
620 // Part Six:
621 // URL options -- you can probably skip this section.
622 //
623 /////////////////////////////////////////////////////////////////////
624 /******************************************************************
625  *
626  * The following section contains settings which you can use to tailor
627  * the URLs which PhpWiki generates.
628  *
629  * Any of these parameters which are left undefined will be deduced
630  * automatically. You need only set them explicitly if the
631  * auto-detected values prove to be incorrect.
632  *
633  * In most cases the auto-detected values should work fine, so
634  * hopefully you don't need to mess with this section.
635  *
636  * In case of local overrides of short placeholders, which themselves 
637  * include index.php, we check for most constants. See '/wiki'.
638  * We can override DATA_PATH and PHPWIKI_DIR to support multiple phpwiki 
639  * versions (for development), but most likely other values like 
640  * THEME, $LANG and $DbParams for a WikiFarm.
641  *
642  ******************************************************************/
643
644 /*
645  * Canonical name and httpd port of the server on which this PhpWiki
646  * resides.
647  */
648 //if (!defined('SERVER_NAME')) define('SERVER_NAME', 'some.host.com');
649 //define('SERVER_PORT', 80);
650
651 /*
652  * Relative URL (from the server root) of the PhpWiki
653  * script.
654  */
655 //if (!defined('SCRIPT_NAME')) define('SCRIPT_NAME', '/some/where/index.php');
656
657 /*
658  * URL of the PhpWiki install directory.  (You only need to set this
659  * if you've moved index.php out of the install directory.)  This can
660  * be either a relative URL (from the directory where the top-level
661  * PhpWiki script is) or an absolute one.
662  */
663 //if (!defined('DATA_PATH')) define('DATA_PATH', '/home/user/phpwiki');
664
665 /*
666  * Path to the PhpWiki install directory.  This is the local
667  * filesystem counterpart to DATA_PATH.  (If you have to set
668  * DATA_PATH, your probably have to set this as well.)  This can be
669  * either an absolute path, or a relative path interpreted from the
670  * directory where the top-level PhpWiki script (normally index.php)
671  * resides.
672  */
673 //if (!defined('PHPWIKI_DIR')) define('PHPWIKI_DIR', 'C:/Apache/phpwiki');
674 //if (!defined('PHPWIKI_DIR')) define('PHPWIKI_DIR', '/home/user/public_html/phpwiki');
675
676 /*
677  * Define to false to NOT use PATH_INFO to pass the pagename's.
678  * e.g. the old http://www.some.where/index.php?pagename=HomePage
679  * instead of http://www.some.where/index.php/HomePage
680  * or even better http://www.some.where/wiki/HomePage
681  *
682  * FIXME: more docs (maybe in README).
683  * Default: true
684  */
685 //if (!defined('USE_PATH_INFO')) define('USE_PATH_INFO', false);
686
687 /*
688  * VIRTUAL_PATH is the canonical URL path under which your your wiki
689  * appears. Normally this is the same as dirname(SCRIPT_NAME), however
690  * using, e.g. apaches mod_actions (or mod_rewrite), you can make it
691  * something different.
692  *
693  * If you do this, you should set VIRTUAL_PATH here.
694  *
695  * E.g. your phpwiki might be installed at at /scripts/phpwiki/index.php,
696  * but  * you've made it accessible through eg. /wiki/HomePage.
697  *
698  * One way to do this is to create a directory named 'wiki' in your
699  * server root. The directory contains only one file: an .htaccess
700  * file which reads something like:
701  *
702  *    Action x-phpwiki-page /scripts/phpwiki/index.php
703  *    SetHandler x-phpwiki-page
704  *    DirectoryIndex /scripts/phpwiki/index.php
705  *
706  * In that case you should set VIRTUAL_PATH to '/wiki'.
707  *
708  * (VIRTUAL_PATH is only used if USE_PATH_INFO is true.)
709  */
710 //if (!defined('VIRTUAL_PATH')) define('VIRTUAL_PATH', '/SomeWiki');
711
712 /////////////////////////////////////////////////////////////////////
713 //
714 // Part Seven:
715 // Miscellaneous settings
716 //
717 /////////////////////////////////////////////////////////////////////
718
719 /*
720  * Page name of RecentChanges page.  Used for RSS Auto-discovery
721  */
722  
723 if (!defined('RECENT_CHANGES')) define ('RECENT_CHANGES', 'RecentChanges');
724
725 /*
726  * Disable HTTP redirects.
727  *
728  * (You probably don't need to touch this.)
729  *
730  * PhpWiki uses HTTP redirects for some of it's functionality.
731  * (e.g. after saving changes, PhpWiki redirects your browser to
732  * view the page you just saved.)
733  *
734  * Some web service providers (notably free European Lycos) don't seem to
735  * allow these redirects.  (On Lycos the result in an "Internal Server Error"
736  * report.)  In that case you can set DISABLE_HTTP_REDIRECT to true.
737  * (In which case, PhpWiki will revert to sneakier tricks to try to
738  * redirect the browser...)
739  */
740 //if (!defined('DISABLE_HTTP_REDIRECT')) define ('DISABLE_HTTP_REDIRECT', true);
741
742 ////////////////////////////////////////////////////////////////
743 // Check if we were included by some other wiki version 
744 // (getimg.php, en, de, wiki, ...) or not. 
745 // If the server requested this index.php fire up the code by loading lib/main.php.
746 // Parallel wiki scripts can now simply include /index.php for the 
747 // main configuration, extend or redefine some settings and 
748 // load lib/main.php by themselves. See the file 'wiki'.
749 // This overcomes the IndexAsConfigProblem.
750 ////////////////////////////////////////////////////////////////
751
752 // Tested: Works with CGI also.
753 if (defined('VIRTUAL_PATH') and defined('USE_PATH_INFO')) {
754     if ($HTTP_SERVER_VARS['SCRIPT_NAME'] == VIRTUAL_PATH) {
755         include "lib/main.php";
756     }
757 } else {
758     if (defined('SCRIPT_NAME') and 
759         ($HTTP_SERVER_VARS['SCRIPT_NAME'] == SCRIPT_NAME)) {
760         include "lib/main.php";
761     } elseif (strstr($HTTP_SERVER_VARS['PHP_SELF'],'index.php')) {
762         include "lib/main.php";
763     }
764 }
765
766 // (c-file-style: "gnu")
767 // Local Variables:
768 // mode: php
769 // tab-width: 8
770 // c-basic-offset: 4
771 // c-hanging-comment-ender-p: nil
772 // indent-tabs-mode: nil
773 // End:   
774
775 // $Log: not supported by cvs2svn $
776 // Revision 1.105  2003/03/04 02:08:08  dairiki
777 // Fix and document the WIKIDB_NOCACHE_MARKUP config define.
778 //
779 // Revision 1.104  2003/02/26 02:55:52  dairiki
780 // New config settings in index.php to control cache control strictness.
781 //
782 // Revision 1.103  2003/02/22 19:43:50  dairiki
783 // Fix comment regarding connecting to SQL server over a unix socket.
784 //
785 // Revision 1.102  2003/02/22 18:53:38  dairiki
786 // Renamed method Request::compress_output to Request::buffer_output.
787 //
788 // Added config option to disable compression.
789 //
790 // Revision 1.101  2003/02/21 19:29:30  dairiki
791 // Update PHPWIKI_VERSION to 1.3.5pre.
792 //
793 // Revision 1.100  2003/01/04 03:36:58  wainstead
794 // Added 'file' as a database type alongside 'dbm'; added cvs log tag
795 //
796
797 ?>