]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - index.php
WikiUserNew support (temp. ENABLE_USER_NEW constant)
[SourceForge/phpwiki.git] / index.php
1 <?php // -*-php-*-
2 // iso-8859-1
3
4 // IMPORTANT NOTE: Use of the ***configurator.php*** to generate an
5 // index.php is depreciated, because it is out of date and a new
6 // configuration system is in the works (see the config directory, not
7 // finished yet though). DO compare or diff the configurator's output
8 // against this file if you feel you must use it to generate an
9 // index.php!
10
11 /*
12 Copyright 1999, 2000, 2001, 2002 $ThePhpWikiProgrammingTeam = array(
13 "Steve Wainstead", "Clifford A. Adams", "Lawrence Akka", 
14 "Scott R. Anderson", "Jon Åslund", "Neil Brown", "Jeff Dairiki",
15 "Stéphane Gourichon", "Jan Hidders", "Arno Hollosi", "John Jorgensen",
16 "Antti Kaihola", "Jeremie Kass", "Carsten Klapp", "Marco Milanesi",
17 "Grant Morgan", "Jan Nieuwenhuizen", "Aredridel Niothke", 
18 "Pablo Roca Rozas", "Sandino Araico Sánchez", "Joel Uckelman", 
19 "Reini Urban", "Tim Voght", "Jochen Kalmbach");
20
21 This file is part of PhpWiki.
22
23 PhpWiki is free software; you can redistribute it and/or modify
24 it under the terms of the GNU General Public License as published by
25 the Free Software Foundation; either version 2 of the License, or
26 (at your option) any later version.
27
28 PhpWiki is distributed in the hope that it will be useful,
29 but WITHOUT ANY WARRANTY; without even the implied warranty of
30 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
31 GNU General Public License for more details.
32
33 You should have received a copy of the GNU General Public License
34 along with PhpWiki; if not, write to the Free Software
35 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
36 */
37
38
39 /////////////////////////////////////////////////////////////////////
40 /*
41   This is the starting file for PhpWiki. All this file does is set
42   configuration options, and at the end of the file it includes() the
43   file lib/main.php, where the real action begins.
44
45   This file is divided into seven parts: Parts Zero, One, Two, Three,
46   Four, Five and Six. Each one has different configuration settings you can
47   change; in all cases the default should work on your system,
48   however, we recommend you tailor things to your particular setting.
49 */
50
51 /////////////////////////////////////////////////////////////////////
52 // Part Zero: If PHP needs help in finding where you installed the
53 //   rest of the PhpWiki code, you can set the include_path here.
54
55 // Define PHP's include path so that it can find the PHP source code
56 // for this PhpWiki.
57 // 
58 // You shouldn't need to do this unless you've moved index.php out
59 // of the PhpWiki install directory.
60 //
61 // Note that on Windows-based servers, you should use ; rather than :
62 // as the path separator.
63 //ini_set('include_path', '.:/usr/local/httpd/phpwiki');
64
65 // Set DEBUG to 1 to view the XHTML and CSS validator icons, page
66 // processing timer, and possibly other debugging messages at the
67 // bottom of each page.
68 if (!defined('DEBUG')) define ('DEBUG', 0);
69 define('ENABLE_USER_NEW',true);
70
71 /////////////////////////////////////////////////////////////////////
72 // Part Null: Don't touch this!
73
74 define ('PHPWIKI_VERSION', '1.3.7');
75 require "lib/prepend.php";
76 rcs_id('$Id: index.php,v 1.116 2004-01-25 04:21:02 rurban Exp $');
77
78 /////////////////////////////////////////////////////////////////////
79 //
80 // Part One:
81 // Authentication and security settings. See Part Three for more.
82 // 
83 /////////////////////////////////////////////////////////////////////
84
85 // The name of your wiki.
86 //
87 // This is used to generate a keywords meta tag in the HTML templates,
88 // in bookmark titles for any bookmarks made to pages in your wiki,
89 // and during RSS generation for the <title> of the RSS channel.
90 //
91 // To use your own logo and signature files, name them PhpWikiLogo.png
92 // and PhpWikiSignature.png and put them into themes/default/images
93 // (substituting "PhpWiki" in the filename with the name you define
94 // here).
95 //
96 // It is recommended this be a relatively short WikiWord like the
97 // InterWiki monikers found in the InterWikiMap. (For examples, see
98 // lib/interwiki.map).
99 if (!defined('WIKI_NAME')) define('WIKI_NAME', 'PhpWiki');
100
101 // Visitor Hostname Lookup
102 //
103 // If set, reverse dns lookups will be performed to attempt to convert
104 // the user's IP number into a host name, in the case where the http
105 // server does not do this.
106 if (!defined('ENABLE_REVERSE_DNS')) define('ENABLE_REVERSE_DNS', true);
107
108 // Username and password of administrator.
109 //
110 // Set these to your preferences. For heaven's sake pick a good
111 // password and use the passencrypt.php tool. See:
112 // http://wolfram.org/writing/howto/password.html
113 // 
114 // Log into the wiki with the admin user and password to lock, unlock,
115 // or remove pages and to perform other PhpWikiAdministration
116 // functions. On all other occasions you should simply log in with
117 // your regular WikiName.
118 if (!defined('ADMIN_USER')) define('ADMIN_USER', "");
119 if (!defined('ADMIN_PASSWD')) define('ADMIN_PASSWD', "");
120 // It is recommended to use the passencrypt.php utility to encode the
121 // admin password, in the unlikely event someone gains ftp or ssh
122 // access to the server and directory containing phpwiki. Once you
123 // have pasted the encrypted password into ADMIN_PASSWD, uncomment
124 // this next line.
125 //if (!defined('ENCRYPTED_PASSWD')) define('ENCRYPTED_PASSWD', true);
126
127 // Private ZIP Dumps of All Wiki Pages
128 //
129 // If true, only the admin user can make zip dumps. Otherwise anyone
130 // may download all wiki pages as a single zip archive.
131 if (!defined('ZIPDUMP_AUTH')) define('ZIPDUMP_AUTH', false);
132
133 // Define to false to disable the RawHtml plugin.
134 //if (!defined('ENABLE_RAW_HTML')) define('ENABLE_RAW_HTML', false);
135
136 // If you define this to true, (MIME-type) page-dumps (either zip dumps,
137 // or "dumps to directory" will be encoded using the quoted-printable
138 // encoding.  If you're actually thinking of mailing the raw page dumps,
139 // then this might be useful, since (among other things,) it ensures
140 // that all lines in the message body are under 80 characters in length.
141 //
142 // Also, setting this will cause a few additional mail headers
143 // to be generated, so that the resulting dumps are valid
144 // RFC 2822 e-mail messages.
145 //
146 // Probably you can just leave this set to false, in which case you get
147 // raw ('binary' content-encoding) page dumps.
148 if (!defined('STRICT_MAILABLE_PAGEDUMPS')) define('STRICT_MAILABLE_PAGEDUMPS', false);
149
150 // Here you can change the filename suffix used for XHTML page dumps.
151 // If you don't want any suffix just comment this out.
152 $HTML_DUMP_SUFFIX = '.html';
153
154 // The maximum file upload size.
155 if (!defined('MAX_UPLOAD_SIZE')) define('MAX_UPLOAD_SIZE', 16 * 1024 * 1024);
156
157 // If the last edit is older than MINOR_EDIT_TIMEOUT seconds, the
158 // default state for the "minor edit" checkbox on the edit page form
159 // will be off.
160 if (!defined('MINOR_EDIT_TIMEOUT')) define("MINOR_EDIT_TIMEOUT", 7 * 24 * 3600);
161
162 // Actions listed in this array will not be allowed. The complete list
163 // of actions can be found in lib/main.php within the function
164 // getActionDescription.
165 //$DisabledActions = array('dumpserial', 'loadfile');
166
167 // PhpWiki can generate an access_log (in "NCSA combined log" format)
168 // for you. If you want one, define this to the name of the log
169 // file. The server must have write access to the directory specified.
170 //define('ACCESS_LOG', '/var/tmp/wiki_access_log');
171
172
173 // By default PhpWiki will try to have PHP compress its output
174 // before sending it to the browser (if you have a recent enough
175 // version of PHP and the browser supports it.)
176 // Define COMPRESS_OUTPUT to false to prevent output compression.
177 // Define COMPRESS_OUTPUT to true to force output compression,
178 // even if we think your version of PHP does this in a buggy
179 // fashion.
180 // Leave it undefined to leave the choice up to PhpWiki.
181 //define('COMPRESS_OUTPUT', false);
182
183
184 // HTTP CACHE_CONTROL
185 //
186 // This controls how PhpWiki sets the HTTP cache control
187 // headers (Expires: and Cache-Control:) 
188 //
189 // Choose one of:
190 //
191 // NONE: This is roughly the old (pre 1.3.4) behavior.  PhpWiki will
192 //       instruct proxies and browsers never to cache PhpWiki output.
193 //
194 // STRICT: Cached pages will be invalidated whenever the database global
195 //       timestamp changes.  This should behave just like NONE (modulo
196 //       bugs in PhpWiki and your proxies and browsers), except that
197 //       things will be slightly more efficient.
198 //
199 // LOOSE: Cached pages will be invalidated whenever they are edited,
200 //       or, if the pages include plugins, when the plugin output could
201 //       concievably have changed.
202 //
203 //       Behavior should be much like STRICT, except that sometimes
204 //       wikilinks will show up as undefined (with the question mark)
205 //       when in fact they refer to (recently) created pages.
206 //       (Hitting your browsers reload or perhaps shift-reload button
207 //       should fix the problem.)
208 //
209 // ALLOW_STALE: Proxies and browsers will be allowed to used stale pages.
210 //       (The timeout for stale pages is controlled by CACHE_CONTROL_MAX_AGE.)
211 //
212 //       This setting will result in quirky behavior.  When you edit a
213 //       page your changes may not show up until you shift-reload the
214 //       page, etc...
215 //
216 //       This setting is generally not advisable, however it may be useful
217 //       in certain cases (e.g. if your wiki gets lots of page views,
218 //       and few edits by knowledgable people who won't freak over the quirks.)
219 //
220 // The default is currently LOOSE.
221 //
222 if (!defined('CACHE_CONTROL')) define('CACHE_CONTROL', 'LOOSE');
223
224 // Maximum page staleness, in seconds.
225 //
226 // This only has effect if CACHE_CONTROL is set to ALLOW_STALE.
227 if (!defined('CACHE_CONTROL_MAX_AGE')) define('CACHE_CONTROL_MAX_AGE', 600);
228
229
230 // MARKUP CACHING
231 //
232 // PhpWiki normally caches a preparsed version (i.e. mostly
233 // converted to HTML) of the most recent version of each page.
234 // (Parsing the wiki-markup takes a fair amount of CPU.)
235 //
236 // Define WIKIDB_NOCACHE_MARKUP to true to disable the
237 // caching of marked-up page content.
238 //
239 // Note that you can also disable markup caching on a per-page
240 // temporary basis by addinging a query arg of '?nocache=1'
241 // to the URL to the page.  (Use '?nocache=purge' to completely
242 // discard the cached version of the page.)
243 //
244 // You can also purge the cached markup globally by using the
245 // "Purge Markup Cache" button on the PhpWikiAdministration page.
246 //if (!defined('WIKIDB_NOCACHE_MARKUP')) define ('WIKIDB_NOCACHE_MARKUP', true);
247
248 /////////////////////////////////////////////////////////////////////
249 // PHP Session settings:
250 //
251 // Only for 'dbtype' => 'SQL'. See schemas/mysql.sql or schemas/psql.sql
252 //  $DBParams['db_session_table'] must be defined
253 //define('USE_DB_SESSION',true);
254
255 // If your php was compiled with --enable-trans-sid it tries to
256 // add a PHPSESSID query argument to all URL strings when cookie
257 // support isn't detected in the client browser.  For reasons
258 // which aren't entirely clear (PHP bug) this screws up the URLs
259 // generated by PhpWiki.  Therefore, transparent session ids
260 // should be disabled.  This next line does that.
261 //
262 // (At the present time, you will not be able to log-in to PhpWiki,
263 // unless your browser supports cookies.)
264 @ini_set('session.use_trans_sid', 0);
265
266 // The login code now uses PHP's session support. Usually, the default
267 // configuration of PHP is to store the session state information in
268 // /tmp. That probably will work fine, but fails e.g. on clustered
269 // servers where each server has their own distinct /tmp (this is the
270 // case on SourceForge's project web server.) You can specify an
271 // alternate directory in which to store state information like so
272 // (whatever user your httpd runs as must have read/write permission
273 // in this directory):
274
275 //ini_set('session.save_path', 'some_other_directory');
276
277 /////////////////////////////////////////////////////////////////////
278 //
279 // Part Two:
280 // Database Selection
281 //
282 /////////////////////////////////////////////////////////////////////
283
284 //
285 // This array holds the parameters which select the database to use.
286 //
287 // Not all of these parameters are used by any particular DB backend.
288 //
289 $DBParams = array(
290    // Select the database type:
291    //
292    // Choose ADODB or SQL to use an SQL database with ADODB or PEAR
293    // respectively (both ADODB and PEAR libraries are already included
294    // with PhpWiki).
295    // Choose dba to use one of the standard UNIX dbm libraries.
296    // Choose file to use a flat file database.
297    //'dbtype' => 'ADODB',
298    //'dbtype' => 'SQL',
299    'dbtype'   => 'dba',
300    //'dbtype' => 'file',
301    
302    // For SQL based backends, specify the database as a DSN
303    // The most general form of a DSN looks like:
304    //
305    //   phptype(dbsyntax)://username:password@protocol+hostspec/database
306    //
307    // For a MySQL database, the following should work:
308    //
309    //   mysql://user:password@host/databasename
310    //
311    // To connect over a unix socket, use something like
312    //
313    //   mysql://user:password@unix(/path/to/socket)/databasename
314    //
315    //'dsn' => 'mysql://guest@unix(/var/lib/mysql/mysql.sock)/test',
316    //'dsn' => 'mysql://guest@localhost/test',
317    //'dsn' => 'pgsql://localhost/test',
318
319    // experimental
320    'db_session_table'   => 'session',
321    
322    // Used by all DB types:
323
324    // prefix for filenames or table names
325    /* 
326     * currently you MUST EDIT THE SQL file too (in the schemas/
327     * directory because we aren't doing on the fly sql generation
328     * during the installation.
329    */
330    //'prefix' => 'phpwiki_',
331    
332    // Used by either 'dba' or 'file' and must be writable by the web
333    // server If you leave this as '/tmp' you will probably lose all
334    // your files eventually
335    'directory'     => "/tmp",
336
337    // choose the type of DB database file to use; most GNU systems have gdbm
338    'dba_handler'   => 'gdbm',   // Either of 'gdbm' or 'db2' work great for me.
339    //'dba_handler' => 'db2',
340    //'dba_handler' => 'db3',    // Works fine on Windows, but not on every linux.
341    //'dba_handler' => 'dbm',    // On sf.net redhat there's dbm and gdbm.
342                                 // dbm suffers from limits on size of data items?
343
344    'timeout'   => 20,
345    //'timeout' => 5
346 );
347
348 /////////////////////////////////////////////////////////////////////
349 //
350 // The next section controls how many old revisions of each page are
351 // kept in the database.
352 //
353 // There are two basic classes of revisions: major and minor. Which
354 // class a revision belongs in is determined by whether the author
355 // checked the "this is a minor revision" checkbox when they saved the
356 // page.
357 // 
358 // There is, additionally, a third class of revisions: author
359 // revisions. The most recent non-mergable revision from each distinct
360 // author is and author revision.
361 //
362 // The expiry parameters for each of those three classes of revisions
363 // can be adjusted seperately. For each class there are five
364 // parameters (usually, only two or three of the five are actually
365 // set) which control how long those revisions are kept in the
366 // database.
367 //
368 //   max_keep: If set, this specifies an absolute maximum for the
369 //             number of archived revisions of that class. This is
370 //             meant to be used as a safety cap when a non-zero
371 //             min_age is specified. It should be set relatively high,
372 //             and it's purpose is to prevent malicious or accidental
373 //             database overflow due to someone causing an
374 //             unreasonable number of edits in a short period of time.
375 //
376 //   min_age:  Revisions younger than this (based upon the supplanted
377 //             date) will be kept unless max_keep is exceeded. The age
378 //             should be specified in days. It should be a
379 //             non-negative, real number,
380 //
381 //   min_keep: At least this many revisions will be kept.
382 //
383 //   keep:     No more than this many revisions will be kept.
384 //
385 //   max_age:  No revision older than this age will be kept.
386 //
387 // Supplanted date: Revisions are timestamped at the instant that they
388 // cease being the current revision. Revision age is computed using
389 // this timestamp, not the edit time of the page.
390 //
391 // Merging: When a minor revision is deleted, if the preceding
392 // revision is by the same author, the minor revision is merged with
393 // the preceding revision before it is deleted. Essentially: this
394 // replaces the content (and supplanted timestamp) of the previous
395 // revision with the content after the merged minor edit, the rest of
396 // the page metadata for the preceding version (summary, mtime, ...)
397 // is not changed.
398 //
399 // Keep up to 8 major edits, but keep them no longer than a month.
400 $ExpireParams['major'] = array('max_age' => 32,
401                                'keep'    => 8);
402 // Keep up to 4 minor edits, but keep them no longer than a week.
403 $ExpireParams['minor'] = array('max_age' => 7,
404                                'keep'    => 4);
405 // Keep the latest contributions of the last 8 authors up to a year.
406 // Additionally, (in the case of a particularly active page) try to
407 // keep the latest contributions of all authors in the last week (even
408 // if there are more than eight of them,) but in no case keep more
409 // than twenty unique author revisions.
410 $ExpireParams['author'] = array('max_age'  => 365,
411                                 'keep'     => 8,
412                                 'min_age'  => 7,
413                                 'max_keep' => 20);
414
415 /////////////////////////////////////////////////////////////////////
416 //
417 // Part Three: (optional)
418 // User Authentication
419 //
420 /////////////////////////////////////////////////////////////////////
421 // 
422 // New user authentification configuration:
423 // We support three basic authentification methods and a stacked array 
424 // of auth methods to get and check the passwords:
425 //
426 // ALLOW_ANON_USER         default true
427 // ALLOW_BOGO_LOGIN        default true
428 // ALLOW_USER_PASSWORDS    default true
429
430 // allow anon users to view pages! (not edit)
431 if (!defined('ALLOW_ANON_USER')) define('ALLOW_ANON_USER', true); 
432
433 // If ALLOW_BOGO_LOGIN is true, users are allowed to login (with
434 // any/no password) using any userid which: 
435 //  1) is not the ADMIN_USER,
436 //  2) is a valid WikiWord (matches $WikiNameRegexp.)
437 // If true, users may be created by themselves. Otherwise we need seperate auth. 
438 if (!defined('ALLOW_BOGO_LOGIN')) define('ALLOW_BOGO_LOGIN', true);
439
440 // This will go away, with true page permissions.
441 // If set, then if an anonymous user attempts to edit a page he will
442 // be required to sign in.  (If ALLOW_BOGO_LOGIN is true, of course,
443 // no password is required, but the user must still sign in under
444 // some sort of WikiWordName.)
445 if (!defined('REQUIRE_SIGNIN_BEFORE_EDIT')) define('REQUIRE_SIGNIN_BEFORE_EDIT', true);
446
447 // True User Authentification:
448 // To require user passwords:
449 //   ALLOW_BOGO_LOGIN = false,
450 //   ALLOW_USER_PASSWORDS = true.
451 // Otherwise any anon or bogo user might login without any or a wrong password.
452 if (!defined('ALLOW_USER_PASSWORDS')) define('ALLOW_USER_PASSWORDS', true);
453
454 // Below we define which methods exists and in which order theys are used:
455 // PersonalPage:  Store passwords in the users homepage metadata (simple)
456 // HttpAuth:  Use the protection by the webserver, either .htaccess or httpd.conf
457 // Db:        Use $DBAuthParams[] (see below) with the PearDB or ADODB only.
458 //            If 'auth_dsn' is undefined, and wiki pages are stored via SQL or ADODB,
459 //            it uses the same database. (fastest)
460 // LDAP:      Authenticate against LDAP_AUTH_HOST with the LDAP_AUTH_SEARCH settings
461 // IMAP:      Authenticate against IMAP_AUTH_HOST (e.g. an existing email account)
462 // File:      Store username:crypted-passwords in .htaccess like files. 
463 //            Use Apache's htpasswd to manage this file.
464
465 if (defined('ALLOW_USER_PASSWORDS')) {
466
467     if (!defined('PASSWORD_LENGTH_MINIMUM')) define('PASSWORD_LENGTH_MINIMUM', 6);
468     
469     // use the following order of authentification methods:
470     if (!isset($USER_AUTH_ORDER))
471         $USER_AUTH_ORDER = 
472             array(
473                   "PersonalPage",
474 //                "HttpAuth",
475                   "Db",
476 //                "LDAP",  // define LDAP_AUTH_HOST and LDAP_AUTH_SEARCH
477 //                "IMAP",  // define IMAP_AUTH_HOST
478 //                "File"   // define AUTH_USER_FILE and opt. AUTH_USER_FILE_STORABLE
479                   ) ;
480
481     if (!defined('USER_AUTH_POLICY'))
482         // we support the following auth policies:
483         // first-only: use only the first method in USER_AUTH_ORDER
484         // old:        ignore USER_AUTH_ORDER and try to use all available 
485         //             methods as in the previous PhpWiki releases (slow)
486         // strict:     check if the user exists for all methods: 
487         //             on the first existing user, try the password. 
488         //             dont try the other methods on failure then
489         // stacked:    check the given user - password combination for all methods and return 
490         //             true on the first success.
491         //define('USER_AUTH_POLICY','first-only');
492         define('USER_AUTH_POLICY','old');
493         //define('USER_AUTH_POLICY','strict');
494         //define('USER_AUTH_POLICY','stacked');
495 }
496
497 // LDAP auth
498 if (!defined('LDAP_AUTH_HOST'))   define('LDAP_AUTH_HOST', 'localhost');
499 // Give the right LDAP root search information in the next statement. 
500 if (!defined('LDAP_AUTH_SEARCH')) define('LDAP_AUTH_SEARCH', "ou=mycompany.com,o=My Company");
501
502 // IMAP auth: 
503 //   check userid/passwords from a imap server, defaults to localhost
504 if (!defined('IMAP_AUTH_HOST'))   define('IMAP_AUTH_HOST', 'localhost');
505
506 // File auth:
507 //if (!defined('AUTH_USER_FILE')) define('AUTH_USER_FILE', '/etc/shadow'); // or '/etc/httpd/.htpasswd'
508 // set this to true if the user may change his password into this file.
509 //if (!defined('AUTH_USER_FILE_STORABLE')) define('AUTH_USER_FILE_STORABLE',false);
510 //if (!defined('AUTH_GROUP_FILE')) define('AUTH_GROUP_FILE', '/etc/groups'); // or '/etc/httpd/.htgroup'
511
512 // Sample of external AuthDB mysql tables to check against
513 //TODO: PhpNuke setup
514 /*
515 use phpwiki;
516 CREATE TABLE pref (
517   userid char(48) binary NOT NULL UNIQUE,
518   preferences text NULL default '',
519   PRIMARY KEY (userid)
520 ) TYPE=MyISAM;
521 INSERT INTO user VALUES ('ReiniUrban', 'a:1:{s:6:"passwd";s:13:"7cyrcMAh0grMI";}');
522
523 // or password only
524 CREATE TABLE user (
525   userid char(48) binary NOT NULL UNIQUE,
526   passwd char(48) binary default '*',
527   PRIMARY KEY (userid)
528 ) TYPE=MyISAM;
529
530 */
531 // external mysql member table
532 /*
533  CREATE TABLE member (
534    user  char(48) NOT NULL,
535    group char(48) NOT NULL default 'users',
536    PRIMARY KEY (user),
537    KEY groupname (groupname)
538  ) TYPE=MyISAM;
539  INSERT INTO member VALUES ('wikiadmin', 'root');
540  INSERT INTO member VALUES ('TestUser', 'users');
541 */
542
543 // 
544 // Seperate DB User Authentication. 
545 //   Can be external, like radius, phpnuke, courier authmysql,
546 //   apache auth_mysql or something else.
547 // The default is to store the data as metadata in the users PersonalPage.
548 // The most likely dsn option is the same dsn as the wikipages.
549 $DBAuthParams = array(
550    //'auth_dsn'         => 'mysql://localhost/phpwiki',
551
552    // USER => PASSWORD
553    'auth_check'  => 'SELECT passwd FROM user WHERE username="$userid"',
554
555    'auth_crypt_method'  => 'crypt',     // 'crypt' (unix) or 'plain' (also for mysql md5)
556    // 'auth_crypt_method'  => 'plain',
557
558    // If 'auth_update' is not defined but 'auth_check' is defined, the user cannot 
559    // change his password.
560    // $password is processed  by the 'auth_crypt_method'.
561    'auth_update'  => 'UPDATE user SET password="$password" WHERE username="$userid"',
562    // for mysql md5 use 'auth_crypt_method'  => 'plain'
563    //'auth_update'  => 'UPDATE user SET password=PASSWORD("$password") WHERE username="$userid"',
564
565    // USER => PREFERENCES
566    //   This can be optionally defined in an external DB. 
567    //   The default is the users homepage.
568    'pref_select' => 'SELECT pref from user WHERE username="$userid"',
569    'pref_update' => 'UPDATE user SET prefs="$pref_blob" WHERE username="$userid"',
570
571    // USERS <=> GROUPS
572    //   DB methods for lib/WikiGroup.php, see also AUTH_GROUP_FILE above.
573    //   This can be optionally defined in an external DB. The default is a 
574    //   special locked wikipage for groupmembers .(which?)
575    // All members of the group:
576    'group_members' => 'SELECT username FROM grouptable WHERE groupname="$group"',
577    // All groups this user belongs to:
578    'user_groups' => 'SELECT groupname FROM grouptable WHERE username="$userid"',
579
580    'dummy' => false,
581 );
582
583 // Old settings, only needed for ENABLE_USER_NEW = false
584 //
585 // The wiki can be protected by HTTP Auth. Use the username and password 
586 // from there, but this is not sufficient. Try the other methods also.
587 if (!defined('ALLOW_HTTP_AUTH_LOGIN')) define('ALLOW_HTTP_AUTH_LOGIN', false);
588 // If ALLOW_USER_LOGIN is true, any defined internal and external
589 // authentication method is tried. If not, we don't care about
590 // passwords, but listen to the next two constants. Note that external
591 // authentication is not supported at this time, you will likely have
592 // to patch code yourself to get PhpWiki to recognise userids and
593 // passwords from an external source.
594 if (!defined('ALLOW_USER_LOGIN')) define('ALLOW_USER_LOGIN', false);
595
596 //if (!defined('ALLOW_LDAP_LOGIN')) define('ALLOW_LDAP_LOGIN', true and function_exists('ldap_connect'));
597 //if (!defined('ALLOW_IMAP_LOGIN')) define('ALLOW_IMAP_LOGIN', true and function_exists('imap_open'));
598
599 /////////////////////////////////////////////////////////////////////
600 //
601 // Part Four:
602 // Page appearance and layout
603 //
604 /////////////////////////////////////////////////////////////////////
605
606 /* THEME
607  *
608  * Most of the page appearance is controlled by files in the theme
609  * subdirectory.
610  *
611  * There are a number of pre-defined themes shipped with PhpWiki.
612  * Or you may create your own (e.g. by copying and then modifying one of
613  * stock themes.)
614  *
615  * Pick one.
616  */
617 if (!defined('THEME')) {
618 define('THEME', 'default');
619 //define('THEME', 'Hawaiian');
620 //define('THEME', 'MacOSX');
621 //define('THEME', 'Portland');
622 //define('THEME', 'Sidebar');
623 //define('THEME', 'SpaceWiki');
624 }
625
626 // Select a valid charset name to be inserted into the xml/html pages,
627 // and to reference links to the stylesheets (css). For more info see:
628 // <http://www.iana.org/assignments/character-sets>. Note that PhpWiki
629 // has been extensively tested only with the latin1 (iso-8859-1)
630 // character set.
631 //
632 // If you change the default from iso-8859-1 PhpWiki may not work
633 // properly and will require code modifications, at the very least you
634 // will have to convert the files in pgsrc or locale/xx/pgsrc to
635 // match!
636 //
637 // Character sets similar to iso-8859-1 may work with little or no
638 // modification depending on your setup. The database must also
639 // support the same charset, and of course the same is true for the
640 // web browser. (Some work is in progress hopefully to allow more
641 // flexibility in this area in the future).
642 if (!defined('CHARSET')) define("CHARSET", "iso-8859-1");
643
644 // Select your language/locale - default language is "en" for English.
645 // Other languages available:
646 // English "en"  (English    - HomePage)
647 // Dutch   "nl" (Nederlands - ThuisPagina)
648 // Spanish "es" (Español    - PáginaPrincipal)
649 // French  "fr" (Français   - Accueil)
650 // German  "de" (Deutsch    - StartSeite)
651 // Swedish "sv" (Svenska    - Framsida)
652 // Italian "it" (Italiano   - PaginaPrincipale)
653 //
654 // If you set DEFAULT_LANGUAGE to the empty string, your system's
655 // default language (as determined by the applicable environment
656 // variables) will be used.
657 //
658 if (!defined('DEFAULT_LANGUAGE')) define('DEFAULT_LANGUAGE', 'en');
659
660 /* WIKI_PGSRC -- specifies the source for the initial page contents of
661  * the Wiki. The setting of WIKI_PGSRC only has effect when the wiki is
662  * accessed for the first time (or after clearing the database.)
663  * WIKI_PGSRC can either name a directory or a zip file. In either case
664  * WIKI_PGSRC is scanned for files -- one file per page.
665  */
666 if (!defined('WIKI_PGSRC')) define('WIKI_PGSRC', "pgsrc"); // Default (old) behavior.
667 //define('WIKI_PGSRC', 'wiki.zip'); // New style.
668 //define('WIKI_PGSRC', '../../../Logs/Hamwiki/hamwiki-20010830.zip'); // New style.
669
670 /*
671  * DEFAULT_WIKI_PGSRC is only used when the language is *not* the
672  * default (English) and when reading from a directory: in that case
673  * some English pages are inserted into the wiki as well.
674  * DEFAULT_WIKI_PGSRC defines where the English pages reside.
675  */
676 // FIXME: is this really needed?  Can't we just copy these pages into
677 // the localized pgsrc?
678 define('DEFAULT_WIKI_PGSRC', "pgsrc");
679 // These are the pages which will get loaded from DEFAULT_WIKI_PGSRC.   
680 $GenericPages = array("ReleaseNotes", "SteveWainstead", "TestPage");
681
682 /////////////////////////////////////////////////////////////////////
683 //
684 // Part Five:
685 // Mark-up options.
686 // 
687 /////////////////////////////////////////////////////////////////////
688
689 // allowed protocols for links - be careful not to allow "javascript:"
690 // URL of these types will be automatically linked.
691 // within a named link [name|uri] one more protocol is defined: phpwiki
692 $AllowedProtocols = "http|https|mailto|ftp|news|nntp|ssh|gopher";
693
694 // URLs ending with the following extension should be inlined as images
695 $InlineImages = "png|jpg|gif";
696
697 // Perl regexp for WikiNames ("bumpy words")
698 // (?<!..) & (?!...) used instead of '\b' because \b matches '_' as well
699 $WikiNameRegexp = "(?<![[:alnum:]])(?:[[:upper:]][[:lower:]]+){2,}(?![[:alnum:]])";
700
701 // Defaults to '/', but '.' was also used.
702 if (!defined('SUBPAGE_SEPARATOR')) define('SUBPAGE_SEPARATOR', '/');
703
704 // InterWiki linking -- wiki-style links to other wikis on the web
705 //
706 // The map will be taken from a page name InterWikiMap.
707 // If that page is not found (or is not locked), or map
708 // data can not be found in it, then the file specified
709 // by INTERWIKI_MAP_FILE (if any) will be used.
710 define('INTERWIKI_MAP_FILE', "lib/interwiki.map");
711
712 // Display a warning if the internal lib/interwiki.map is used, and 
713 // not the public InterWikiMap page. This file is not readable from outside.
714 //define('WARN_NONPUBLIC_INTERWIKIMAP', false);
715
716 // Regexp used for automatic keyword extraction.
717 //
718 // Any links on a page to pages whose names match this regexp will
719 // be used keywords in the keywords meta tag.  (This is an aid to
720 // classification by search engines.)  The value of the match is
721 // used as the keyword.
722 //
723 // The default behavior is to match Category* and Topic* links.
724 $keywords = array("Category", "Topic");
725 $KeywordLinkRegexp = '(?<=^'. join('|^', $keywords) . ')[[:upper:]].*$';
726
727 // Author and Copyright Site Navigation Links
728 //
729 // These will be inserted as <link rel> tags in the html header of
730 // every page, for search engines and for browsers like Mozilla which
731 // take advantage of link rel site navigation.
732 //
733 // If you have your own copyright and contact information pages change
734 // these as appropriate.
735 if (!defined('COPYRIGHTPAGE_TITLE')) define('COPYRIGHTPAGE_TITLE',
736     "GNU General Public License");
737 if (!defined('COPYRIGHTPAGE_URL')) define('COPYRIGHTPAGE_URL',
738     'http://www.gnu.org/copyleft/gpl.html#SEC1');
739 if (!defined('AUTHORPAGE_TITLE')) define('AUTHORPAGE_TITLE',
740     "The PhpWiki Programming Team");
741 if (!defined('AUTHORPAGE_URL')) define('AUTHORPAGE_URL',
742     'http://phpwiki.sourceforge.net/phpwiki/ThePhpWikiProgrammingTeam');
743
744
745 /////////////////////////////////////////////////////////////////////
746 //
747 // Part Six:
748 // URL options -- you can probably skip this section.
749 //
750 /////////////////////////////////////////////////////////////////////
751 /******************************************************************
752  *
753  * The following section contains settings which you can use to tailor
754  * the URLs which PhpWiki generates.
755  *
756  * Any of these parameters which are left undefined will be deduced
757  * automatically. You need only set them explicitly if the
758  * auto-detected values prove to be incorrect.
759  *
760  * In most cases the auto-detected values should work fine, so
761  * hopefully you don't need to mess with this section.
762  *
763  * In case of local overrides of short placeholders, which themselves 
764  * include index.php, we check for most constants. See '/wiki'.
765  * We can override DATA_PATH and PHPWIKI_DIR to support multiple phpwiki 
766  * versions (for development), but most likely other values like 
767  * THEME, $LANG and $DbParams for a WikiFarm.
768  *
769  ******************************************************************/
770
771 /*
772  * Canonical name and httpd port of the server on which this PhpWiki
773  * resides.
774  */
775 //if (!defined('SERVER_NAME')) define('SERVER_NAME', 'some.host.com');
776 //define('SERVER_PORT', 80);
777
778 /*
779  * Relative URL (from the server root) of the PhpWiki
780  * script.
781  */
782 //if (!defined('SCRIPT_NAME')) define('SCRIPT_NAME', '/some/where/index.php');
783
784 /*
785  * URL of the PhpWiki install directory.  (You only need to set this
786  * if you've moved index.php out of the install directory.)  This can
787  * be either a relative URL (from the directory where the top-level
788  * PhpWiki script is) or an absolute one.
789  */
790 //if (!defined('DATA_PATH')) define('DATA_PATH', '/home/user/phpwiki');
791
792 /*
793  * Path to the PhpWiki install directory.  This is the local
794  * filesystem counterpart to DATA_PATH.  (If you have to set
795  * DATA_PATH, your probably have to set this as well.)  This can be
796  * either an absolute path, or a relative path interpreted from the
797  * directory where the top-level PhpWiki script (normally index.php)
798  * resides.
799  */
800 //if (!defined('PHPWIKI_DIR')) define('PHPWIKI_DIR', 'C:/Apache/phpwiki');
801 //if (!defined('PHPWIKI_DIR')) define('PHPWIKI_DIR', '/home/user/public_html/phpwiki');
802
803 /*
804  * PhpWiki will try to use short urls to pages, eg 
805  * http://www.example.com/index.php/HomePage
806  * If you want to use urls like 
807  * http://www.example.com/index.php?pagename=HomePage
808  * then define 'USE_PATH_INFO' as false by uncommenting the line below.
809  * NB:  If you are using Apache >= 2.0.30, then you may need to to use
810  * the directive "AcceptPathInfo On" in your Apache configuration file
811  * (or in an appropriate <.htaccess> file) for the short urls to work:  
812  * See http://httpd.apache.org/docs-2.0/mod/core.html#acceptpathinfo
813  * 
814  * See also http://phpwiki.sourceforge.net/phpwiki/PrettyWiki for more ideas
815  * on prettifying your urls.
816  *
817  * Default: PhpWiki will try to divine whether use of PATH_INFO
818  * is supported in by your webserver/PHP configuration, and will
819  * use PATH_INFO if it thinks that is possible.
820  */
821 //if (!defined('USE_PATH_INFO')) define('USE_PATH_INFO', false);
822
823 /*
824  * VIRTUAL_PATH is the canonical URL path under which your your wiki
825  * appears. Normally this is the same as dirname(SCRIPT_NAME), however
826  * using, e.g. apaches mod_actions (or mod_rewrite), you can make it
827  * something different.
828  *
829  * If you do this, you should set VIRTUAL_PATH here.
830  *
831  * E.g. your phpwiki might be installed at at /scripts/phpwiki/index.php,
832  * but  * you've made it accessible through eg. /wiki/HomePage.
833  *
834  * One way to do this is to create a directory named 'wiki' in your
835  * server root. The directory contains only one file: an .htaccess
836  * file which reads something like:
837  *
838  *    Action x-phpwiki-page /scripts/phpwiki/index.php
839  *    SetHandler x-phpwiki-page
840  *    DirectoryIndex /scripts/phpwiki/index.php
841  *
842  * In that case you should set VIRTUAL_PATH to '/wiki'.
843  *
844  * (VIRTUAL_PATH is only used if USE_PATH_INFO is true.)
845  */
846 //if (!defined('VIRTUAL_PATH')) define('VIRTUAL_PATH', '/SomeWiki');
847
848 /////////////////////////////////////////////////////////////////////
849 //
850 // Part Seven:
851 // Miscellaneous settings
852 //
853 /////////////////////////////////////////////////////////////////////
854
855 /*
856  * Disable HTTP redirects.
857  *
858  * (You probably don't need to touch this.)
859  *
860  * PhpWiki uses HTTP redirects for some of it's functionality.
861  * (e.g. after saving changes, PhpWiki redirects your browser to
862  * view the page you just saved.)
863  *
864  * Some web service providers (notably free European Lycos) don't seem to
865  * allow these redirects.  (On Lycos the result in an "Internal Server Error"
866  * report.)  In that case you can set DISABLE_HTTP_REDIRECT to true.
867  * (In which case, PhpWiki will revert to sneakier tricks to try to
868  * redirect the browser...)
869  */
870 //if (!defined('DISABLE_HTTP_REDIRECT')) define ('DISABLE_HTTP_REDIRECT', true);
871
872 ////////////////////////////////////////////////////////////////
873 // Check if we were included by some other wiki version 
874 // (getimg.php, en, de, wiki, ...) or not. 
875 // If the server requested this index.php fire up the code by loading lib/main.php.
876 // Parallel wiki scripts can now simply include /index.php for the 
877 // main configuration, extend or redefine some settings and 
878 // load lib/main.php by themselves. See the file 'wiki'.
879 // This overcomes the IndexAsConfigProblem.
880 ////////////////////////////////////////////////////////////////
881
882 /*
883 // Tested: Works with CGI also.
884 if (defined('VIRTUAL_PATH') and defined('USE_PATH_INFO')) {
885     if ($HTTP_SERVER_VARS['SCRIPT_NAME'] == VIRTUAL_PATH) {
886         include "lib/main.php";
887     }
888     elseif (defined('SCRIPT_NAME') and 
889             ($HTTP_SERVER_VARS['SCRIPT_NAME'] == SCRIPT_NAME)) {
890         include "lib/main.php";
891     }
892 } else {
893     if (defined('SCRIPT_NAME') and 
894         ($HTTP_SERVER_VARS['SCRIPT_NAME'] == SCRIPT_NAME)) {
895         include "lib/main.php";
896     } elseif (strstr($HTTP_SERVER_VARS['PHP_SELF'],'index.php')) {
897         include "lib/main.php";
898     }
899 }
900 */
901 include "lib/main.php";
902
903 // $Log: not supported by cvs2svn $
904 // Revision 1.115  2003/12/22 04:58:11  carstenklapp
905 // Incremented release version.
906 //
907 // Revision 1.114  2003/12/05 16:00:42  carstenklapp
908 // ACK! gettext is not available at this point in index.php.
909 //
910 // Revision 1.113  2003/12/05 15:51:37  carstenklapp
911 // Added note that use of the configurator is depreciated.
912 //
913 // Enable localization/gettextification of $KeywordLinkRegexp. (Also, now
914 // users not familiar with regex can more easily just edit the $keywords
915 // array).
916 //
917 // Added four new constants to define author and copyright link rel~s
918 // used in html head. This makes it easier to run multiple wikis off of
919 // one set of code.
920 //
921 // Eliminated RECENT_CHANGES constant for RSS auto discovery because it's
922 // another step to watch out for when running a non-english wiki. Now
923 // simply defined as _("RecentChanges") in head.tmpl itself. Non-standard
924 // wikis where the RecentChanges page has been named to something else
925 // will have to modify this in head.tmpl (along with all other places the
926 // word RecentChanges appears in the code, something that already would
927 // have had to be done on such a wiki anyway).
928 //
929 // Added a little more info and instructions to flesh out:
930 // DEBUG, WIKI_NAME, ADMIN_USER, $DisabledActions, $DBParams, CHARSET.
931 //
932 // A few typos and spelling mistakes corrected, and some text rewrapped.
933 //
934 // Revision 1.112  2003/11/17 15:49:21  carstenklapp
935 // Updated version number to 1.3.7pre (beyond current release
936 // 1.3.6). Disabled DEBUG output by default (hide DebugInfo, XHTML &
937 // CSS validator buttons). Note the DebugInfo button remains visible
938 // for the Admin, and can be accessed by anyone else by adding
939 // "?action=DebugInfo" to the URL for the occasional use.
940 //
941 // Revision 1.111  2003/03/18 21:40:04  dairiki
942 // Copy Lawrence's memo on USE_PATH_INFO/AcceptPathInfo to configurator.php
943 // (as promised).
944 //
945 // Plus slight clarification of default (auto-detect) behavior.
946 //
947 // Revision 1.110  2003/03/18 20:51:10  lakka
948 // Revised comments on use of USE_PATH_INFO with Apache 2
949 //
950 // Revision 1.109  2003/03/17 21:24:50  dairiki
951 // Fix security bugs in the RawHtml plugin.
952 //
953 // Change the default configuration to allow use of plugin, since
954 // I believe the plugin is now safe for general use. (Raw HTML will only
955 // work on locked pages.)
956 //
957 // Revision 1.108  2003/03/07 22:47:01  dairiki
958 // A few more if(!defined(...))'s
959 //
960 // Revision 1.107  2003/03/07 20:51:54  dairiki
961 // New feature: Automatic extraction of keywords (for the meta keywords tag)
962 // from Category* and Topic* links on each page.
963 //
964 // Revision 1.106  2003/03/07 02:48:23  dairiki
965 // Add option to prevent HTTP redirect.
966 //
967 // Revision 1.105  2003/03/04 02:08:08  dairiki
968 // Fix and document the WIKIDB_NOCACHE_MARKUP config define.
969 //
970 // Revision 1.104  2003/02/26 02:55:52  dairiki
971 // New config settings in index.php to control cache control strictness.
972 //
973 // Revision 1.103  2003/02/22 19:43:50  dairiki
974 // Fix comment regarding connecting to SQL server over a unix socket.
975 //
976 // Revision 1.102  2003/02/22 18:53:38  dairiki
977 // Renamed method Request::compress_output to Request::buffer_output.
978 //
979 // Added config option to disable compression.
980 //
981 // Revision 1.101  2003/02/21 19:29:30  dairiki
982 // Update PHPWIKI_VERSION to 1.3.5pre.
983 //
984 // Revision 1.100  2003/01/04 03:36:58  wainstead
985 // Added 'file' as a database type alongside 'dbm'; added cvs log tag
986 //
987
988 // (c-file-style: "gnu")
989 // Local Variables:
990 // mode: php
991 // tab-width: 8
992 // c-basic-offset: 4
993 // c-hanging-comment-ender-p: nil
994 // indent-tabs-mode: nil
995 // End:   
996 ?>