]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/IniConfig.php
don't ignore some false config values (e.g. USE_PATH_INFO false was ignored)
[SourceForge/phpwiki.git] / lib / IniConfig.php
1 <?php
2 rcs_id('$Id: IniConfig.php,v 1.18 2004-05-08 16:58:19 rurban Exp $');
3
4 /**
5  * A configurator intended to read it's config from a PHP-style INI file,
6  * instead of a PHP file.
7  *
8  * Pass a filename to the IniConfig() function and it will read all it's
9  * definitions from there, all by itself, and proceed to do a mass-define
10  * of all valid PHPWiki config items.  In this way, we can hopefully be
11  * totally backwards-compatible with the old index.php method, while still
12  * providing a much tastier on-going experience.
13  *
14  * @author: Joby Walker, Reini Urban, Matthew Palmer
15  */
16 /*
17  * Copyright 2004 $ThePhpWikiProgrammingTeam
18  *
19  * This file is part of PhpWiki.
20  *
21  * PhpWiki is free software; you can redistribute it and/or modify
22  * it under the terms of the GNU General Public License as published by
23  * the Free Software Foundation; either version 2 of the License, or
24  * (at your option) any later version.
25  * 
26  * PhpWiki is distributed in the hope that it will be useful,
27  * but WITHOUT ANY WARRANTY; without even the implied warranty of
28  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
29  * GNU General Public License for more details.
30  * 
31  * You should have received a copy of the GNU General Public License
32  * along with PhpWiki; if not, write to the Free Software
33  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
34  */
35
36 /** TODO
37  * - Convert the value lists to provide defaults, so that every "if
38  *      (defined())" and "if (!defined())" can fuck off to the dismal hole
39  *      it belongs in.
40  *
41  * - Resurrect the larger "config object" code (in config/) so it'll aid the
42  *      GUI config writers, and allow us to do proper validation and default
43  *      value handling.
44  *
45  * - Get rid of WikiNameRegexp and KeywordLinkRegexp as globals by finding
46  *      everywhere that uses them as variables and modify the code to use
47  *      them as constants.  Will involve hacking around
48  *      pcre_fix_posix_classes (probably with redefines()).
49  */
50
51 include_once (dirname(__FILE__)."/config.php");
52 include_once (dirname(__FILE__)."/FileFinder.php");
53
54 function IniConfig($file) {
55     
56     //FindFile("pear/Config.php");
57     //require_once("Config.php");
58  
59     // List of all valid config options to be define()d which take "values" (not
60     // booleans). Needs to be categorised, and generally made a lot tidier. 
61    $_IC_VALID_VALUE = array
62         ('DEBUG', 'WIKI_NAME', 'ADMIN_USER', 'ADMIN_PASSWD',
63          'HTML_DUMP_SUFFIX', 'MAX_UPLOAD_SIZE', 'MINOR_EDIT_TIMEOUT',
64          'ACCESS_LOG', 'CACHE_CONTROL', 'CACHE_CONTROL_MAX_AGE',
65          'PASSWORD_LENGTH_MINIMUM', 'USER_AUTH_POLICY', 'LDAP_AUTH_HOST',
66          'LDAP_BASE_DN', 'LDAP_AUTH_USER', 'LDAP_AUTH_PASSWORD',
67          'LDAP_SEARCH_FIELD', 'IMAP_AUTH_HOST', 'POP3_AUTH_HOST',
68          'AUTH_USER_FILE', 'AUTH_SESS_USER', 'AUTH_SESS_LEVEL', 'GROUP_METHOD',
69          'AUTH_GROUP_FILE', 'EDITING_POLICY', 'THEME', 'CHARSET',
70          'DEFAULT_LANGUAGE', 'WIKI_PGSRC', 'DEFAULT_WIKI_PGSRC',
71          'ALLOWED_PROTOCOLS', 'INLINE_IMAGES', 'SUBPAGE_SEPARATOR',
72          'INTERWIKI_MAP_FILE', 'COPYRIGHTPAGE_TITLE', 'COPYRIGHTPAGE_URL',
73          'AUTHORPAGE_TITLE', 'AUTHORPAGE_URL', 'SERVER_NAME', 'SERVER_PORT',
74          'SCRIPT_NAME', 'DATA_PATH', 'PHPWIKI_DIR', 'VIRTUAL_PATH');
75
76     // List of all valid config options to be define()d which take booleans.
77     $_IC_VALID_BOOL = array
78         ('ENABLE_USER_NEW', 'ENABLE_EDIT_TOOLBAR', 'JS_SEARCHREPLACE',
79          'ENABLE_REVERSE_DNS', 'ENCRYPTED_PASSWD', 'ZIPDUMP_AUTH', 
80          'ENABLE_RAW_HTML', 'STRICT_MAILABLE_PAGEDUMPS', 'COMPRESS_OUTPUT',
81          'WIKIDB_NOCACHE_MARKUP', 'ALLOW_ANON_USER', 'ALLOW_ANON_EDIT',
82          'ALLOW_BOGO_LOGIN', 'ALLOW_USER_PASSWORDS',
83          'AUTH_USER_FILE_STORABLE', 'ALLOW_HTTP_AUTH_LOGIN',
84          'ALLOW_USER_LOGIN', 'ALLOW_LDAP_LOGIN', 'ALLOW_IMAP_LOGIN',
85          'WARN_NONPUBLIC_INTERWIKIMAP', 'USE_PATH_INFO',
86          'DISABLE_HTTP_REDIRECT');
87
88     if(!file_exists($file)){
89         trigger_error("Datasource file '$file' does not exist", E_USER_ERROR);
90         exit();
91     }
92          
93     $rs = @parse_ini_file($file);
94     $rsdef = @parse_ini_file(dirname(__FILE__)."/../config/config-default.ini");
95
96     foreach ($_IC_VALID_VALUE as $item) {
97         if (defined($item)) continue;
98         if (array_key_exists($item, $rs)) {
99             define($item, $rs[$item]);
100         } elseif (array_key_exists($item, $rsdef)) {
101             define($item, $rsdef[$item]);
102         // calculate them later:
103         } elseif (in_array($item,array('DATABASE_PREFIX', 'SERVER_NAME', 'SERVER_PORT',
104                 'SCRIPT_NAME', 'DATA_PATH', 'PHPWIKI_DIR', 'VIRTUAL_PATH'))) {
105             ;
106         } else {
107             trigger_error(sprintf("missing config setting for %s",$item));
108         }
109     }
110
111     // Boolean options are slightly special - if they're set to any of
112     // '', 'false', '0', or 'no' (all case-insensitive) then the value will
113     // be a boolean false, otherwise if there is anything set it'll
114     // be true.
115     foreach ($_IC_VALID_BOOL as $item) {
116         if (defined($item)) continue;
117         if (array_key_exists($item, $rs)) {
118             $val = $rs[$item];
119         } elseif (array_key_exists($item, $rsdef)) {
120             $val = $rsdef[$item];
121         } else {
122             $val = false; //trigger_error(sprintf("missing boolean config setting for %s",$item));
123         }
124         
125         // calculate them later: old or dynamic constants
126         if (!$val and $val != '' and 
127             in_array($item,array('USE_PATH_INFO','USE_DB_SESSION',
128                                  'ALLOW_HTTP_AUTH_LOGIN','ALLOW_LDAP_LOGIN',
129                                  'ALLOW_IMAP_LOGIN','ALLOW_USER_LOGIN',
130                                  'REQUIRE_SIGNIN_BEFORE_EDIT',
131                                  'WIKIDB_NOCACHE_MARKUP')))
132         {
133             ;
134         }
135         elseif (!$val) {
136             define($item, false);
137         }
138         elseif (strtolower($val) == 'false' ||
139                 strtolower($val) == 'no' ||
140                 $val == '0') {
141             define($item, false);
142         }
143         else {
144             define($item, true);
145         }
146     }
147
148     // Special handling for some config options
149     if ($val = @$rs['INCLUDE_PATH']) {
150         ini_set('include_path', $val);
151     }
152
153     if ($val = @$rs['SESSION_SAVE_PATH']) {
154         ini_set('session.save_path', $val);
155     }
156
157     // Database
158     global $DBParams;
159     $DBParams['dbtype'] = @$rs['DATABASE_TYPE'];
160     if (isset($rs['DATABASE_DSN']))
161         $DBParams['dsn'] = $rs['DATABASE_DSN'];
162     if (isset($rs['DATABASE_PREFIX']))
163         $DBParams['prefix'] = $rs['DATABASE_PREFIX'];
164     $DBParams['db_session_table'] = @$rs['DATABASE_SESSION_TABLE'];
165     $DBParams['dba_handler'] = @$rs['DATABASE_DBA_HANDLER'];
166     $DBParams['directory'] = @$rs['DATABASE_DIRECTORY'];
167     $DBParams['timeout'] = @$rs['DATABASE_TIMEOUT'];
168     if (!defined('USE_DB_SESSION') and $DBParams['db_session_table'] and 
169         in_array($DBParams['dbtype'],array('SQL','ADODB','dba'))) {
170         define('USE_DB_SESSION', true);
171     }
172
173     // Expiry stuff
174     global $ExpireParams;
175
176     $ExpireParams['major'] = array(
177                                    'max_age' => @$rs['MAJOR_MAX_AGE'],
178                                    'min_age' => @$rs['MAJOR_MIN_AGE'],
179                                    'min_keep' => @$rs['MAJOR_MIN_KEEP'],
180                                    'keep' => @$rs['MAJOR_KEEP'],
181                                    'max_keep' => @$rs['MAJOR_MAX_KEEP']
182                                    );
183     $ExpireParams['minor'] = array(
184                                    'max_age' => @$rs['MINOR_MAX_AGE'],
185                                    'min_age' => @$rs['MINOR_MIN_AGE'],
186                                    'min_keep' => @$rs['MINOR_MIN_KEEP'],
187                                    'keep' => @$rs['MINOR_KEEP'],
188                                    'max_keep' => @$rs['MINOR_MAX_KEEP']
189                                    );
190     $ExpireParams['author'] = array(
191                                     'max_age' => @$rs['AUTHOR_MAX_AGE'],
192                                     'min_age' => @$rs['AUTHOR_MIN_AGE'],
193                                     'min_keep' => @$rs['AUTHOR_MIN_KEEP'],
194                                     'keep' => @$rs['AUTHOR_KEEP'],
195                                     'max_keep' => @$rs['AUTHOR_MAX_KEEP']
196                                     );
197
198     // User authentication
199     global $USER_AUTH_ORDER;
200     $USER_AUTH_ORDER = preg_split('/\s*:\s*/', @$rs['USER_AUTH_ORDER']);
201
202     // LDAP bind options
203     global $LDAP_SET_OPTION;
204     $optlist = preg_split('/\s*:\s*/', @$rs['LDAP_SET_OPTION']);
205     foreach ($optlist as $opt) {
206         $bits = preg_split('/\s*=\s*/', $opt, 2);
207         if (count($bits) == 2) {
208             $LDAP_SET_OPTION[$bits[0]] = $bits[1];
209         }
210         else {
211             // Possibly throw some sort of error?
212         }
213     }
214
215     // Now it's the external DB authentication stuff's turn
216     if (in_array('Db', $USER_AUTH_ORDER) && empty($rs['DBAUTH_AUTH_DSN'])) {
217         $rs['DBAUTH_AUTH_DSN'] = $DBParams['dsn'];
218     }
219     
220     global $DBAuthParams;
221     $DBAP_MAP = array('DBAUTH_AUTH_DSN' => 'auth_dsn',
222                       'DBAUTH_AUTH_CHECK' => 'auth_check',
223                       'DBAUTH_AUTH_USER_EXISTS' => 'auth_user_exists',
224                       'DBAUTH_AUTH_CRYPT_METHOD' => 'auth_crypt_method',
225                       'DBAUTH_AUTH_UPDATE' => 'auth_update',
226                       'DBAUTH_AUTH_CREATE' => 'auth_create',
227                       'DBAUTH_PREF_SELECT' => 'pref_select',
228                       'DBAUTH_PREF_UPDATE' => 'pref_update',
229                       'DBAUTH_IS_MEMBER' => 'is_member',
230                       'DBAUTH_GROUP_MEMBERS' => 'group_members',
231                       'DBAUTH_USER_GROUPS' => 'user_groups'
232                       );
233
234     foreach ($DBAP_MAP as $rskey => $apkey) {
235         if (isset($rs[$rskey])) {
236             $DBAuthParams[$apkey] = $rs[$rskey];
237         }
238     }
239
240     // Default Wiki pages to force loading from pgsrc
241     global $GenericPages;
242     $GenericPages = preg_split('/\s*:\s*/', @$rs['DEFAULT_WIKI_PAGES']);
243
244     // Wiki name regexp.  Should be a define(), but too many places want
245     // to use it as a variable for me to be bothered changing them all.
246     // Major TODO item, there.
247     global $WikiNameRegexp;
248     $WikiNameRegexp = @$rs['WIKI_NAME_REGEXP'];
249
250     // Another "too-tricky" redefine
251     global $KeywordLinkRegexp;
252     if (!isset($rs['KEYWORDS']))
253         $rs['KEYWORDS'] = "Category:Topic";
254     $keywords = preg_split('/\s*:\s*/', $rs['KEYWORDS']);
255     if (empty($keywords))
256         $keywords = array("Category","Topic");
257     $KeywordLinkRegexp = '(?<=' . implode('|^', $keywords) . ')[[:upper:]].*$';
258         
259     global $DisabledActions;
260     $DisabledActions = preg_split('/\s*:\s*/', @$rs['DISABLED_ACTIONS']);
261
262     fix_configs();
263 }
264
265 // moved from lib/config.php
266 function fix_configs() {
267     global $FieldSeparator, $charset, $WikiNameRegexp, $KeywordLinkRegexp, $AllActionPages;
268     global $DisabledActions, $HTTP_SERVER_VARS, $DBParams, $LANG;
269
270     // "\x80"-"\x9f" (and "\x00" - "\x1f") are non-printing control
271     // chars in iso-8859-*
272     // $FieldSeparator = "\263"; // this is a superscript 3 in ISO-8859-1.
273     // $FieldSeparator = "\xFF"; // this byte should never appear in utf-8
274     // FIXME: get rid of constant. pref is dynamic and language specific
275     $charset = CHARSET;
276     if (isset($LANG) and in_array($LANG,array('ja','zh')))
277         $charset = 'utf-8';
278     if (strtolower($charset) == 'utf-8')
279         $FieldSeparator = "\xFF";
280     else
281         $FieldSeparator = "\x81";
282
283     if (!defined('DEFAULT_LANGUAGE'))
284         define('DEFAULT_LANGUAGE', 'en');
285     update_locale(isset($LANG) ? $LANG : DEFAULT_LANGUAGE);
286
287     // Set up (possibly fake) gettext()
288     //
289     if (!function_exists ('bindtextdomain')) {
290         $locale = array();
291
292         function gettext ($text) { 
293             global $locale;
294             if (!empty ($locale[$text]))
295                 return $locale[$text];
296             return $text;
297         }
298
299         function _ ($text) {
300             return gettext($text);
301         }
302     }
303     else {
304         // Working around really weird gettext problems: (4.3.2, 4.3.6 win)
305         // bindtextdomain() returns the current domain path.
306         // 1. If the script is not index.php but something like "de", on a different path
307         //    then bindtextdomain() fails, but after chdir to the correct path it will work okay.
308         // 2. But the weird error "Undefined variable: bindtextdomain" is generated then.
309         $bindtextdomain_path = FindFile("locale", false, true);
310         if (isWindows())
311             $bindtextdomain_path = str_replace("/","\\",$bindtextdomain_path);
312         $bindtextdomain_real = @bindtextdomain("phpwiki", $bindtextdomain);
313         if ($bindtextdomain_real != $bindtextdomain_path) {
314             // this will happen with virtual_paths. chdir and try again.
315             chdir($bindtextdomain_path);
316             $bindtextdomain_real = @bindtextdomain("phpwiki", $bindtextdomain);
317         }
318         textdomain("phpwiki");
319         if ($bindtextdomain_real != $bindtextdomain_path) { // change back
320             chdir($bindtextdomain_real . (isWindows() ? "\\.." : "/.."));
321         }
322     }
323
324     $WikiNameRegexp = pcre_fix_posix_classes($WikiNameRegexp);
325     $KeywordLinkRegexp = pcre_fix_posix_classes($KeywordLinkRegexp);
326
327     $AllActionPages = explode(':','AllPages:BackLinks:DebugInfo:FindPage:FullRecentChanges:'
328                               .'FullTextSearch:FuzzyPages:InterWikiSearch:LikePages:MostPopular:'
329                               .'OrphanedPages:PageDump:PageHistory:PageInfo:RandomPage:RateIt:'
330                               .'RecentChanges:RecentEdits:RelatedChanges:TitleSearch:TranslateText:'
331                               .'UpLoad:UserPreferences:WantedPages:WhoIsOnline');
332
333     //////////////////////////////////////////////////////////////////
334     // Autodetect URL settings:
335     //
336     if (!defined('SERVER_NAME')) define('SERVER_NAME', $HTTP_SERVER_VARS['SERVER_NAME']);
337     if (!defined('SERVER_PORT')) define('SERVER_PORT', $HTTP_SERVER_VARS['SERVER_PORT']);
338     if (!defined('SERVER_PROTOCOL')) {
339         if (empty($HTTP_SERVER_VARS['HTTPS']) || $HTTP_SERVER_VARS['HTTPS'] == 'off')
340             define('SERVER_PROTOCOL', 'http');
341         else
342             define('SERVER_PROTOCOL', 'https');
343     }
344
345     if (!defined('SCRIPT_NAME'))
346         define('SCRIPT_NAME', deduce_script_name());
347
348     if (!defined('USE_PATH_INFO')) {
349             /*
350              * If SCRIPT_NAME does not look like php source file,
351              * or user cgi we assume that php is getting run by an
352              * action handler in /cgi-bin.  In this case,
353              * I think there is no way to get Apache to pass
354              * useful PATH_INFO to the php script (PATH_INFO
355              * is used to the the php interpreter where the
356              * php script is...)
357              */
358             switch (php_sapi_name()) {
359             case 'apache':
360             case 'apache2handler':
361                 define('USE_PATH_INFO', true);
362                 break;
363             case 'cgi':
364             case 'apache2filter':
365                 define('USE_PATH_INFO', false);
366                 break;
367             default:
368                 define('USE_PATH_INFO', ereg('\.(php3?|cgi)$', SCRIPT_NAME));
369                 break;
370             }
371         }
372      
373     // If user has not defined PHPWIKI_DIR, and we need it
374     if (!defined('PHPWIKI_DIR') and !file_exists("themes/default")) {
375         $themes_dir = FindFile("themes");
376         define('PHPWIKI_DIR', dirname($themes_dir));
377     }
378         
379     if (!defined('VIRTUAL_PATH')) {
380         // We'd like to auto-detect when the cases where apaches
381         // 'Action' directive (or similar means) is used to
382         // redirect page requests to a cgi-handler.
383         //
384         // In cases like this, requests for e.g. /wiki/HomePage
385         // get redirected to a cgi-script called, say,
386         // /path/to/wiki/index.php.  The script gets all
387         // of /wiki/HomePage as it's PATH_INFO.
388         //
389         // The problem is:
390         //   How to detect when this has happened reliably?
391         //   How to pick out the "virtual path" (in this case '/wiki')?
392         //
393         // (Another time an redirect might occur is to a DirectoryIndex
394         // -- the requested URI is '/wikidir/', the request gets
395         // passed to '/wikidir/index.php'.  In this case, the
396         // proper VIRTUAL_PATH is '/wikidir/index.php', since the
397         // pages will appear at e.g. '/wikidir/index.php/HomePage'.
398         //
399
400         $REDIRECT_URL = &$HTTP_SERVER_VARS['REDIRECT_URL'];
401         if (USE_PATH_INFO and isset($REDIRECT_URL)
402             and ! IsProbablyRedirectToIndex()) {
403             // FIXME: This is a hack, and won't work if the requested
404             // pagename has a slash in it.
405             $temp = strtr(dirname($REDIRECT_URL . 'x'),"\\",'/');
406             if ( ($temp == '/') || ($temp == '\\') )
407                 $temp = '';
408             define('VIRTUAL_PATH', $temp);
409         } else {
410             define('VIRTUAL_PATH', SCRIPT_NAME);
411         }
412     }
413
414     // If user has not defined DATA_PATH, we want to use relative URLs.
415     if (!defined('DATA_PATH')) {
416         // fix similar to the one suggested by jkalmbach for 
417         // installations in the webrootdir, like "http://phpwiki.org/HomePage"
418         $temp = dirname(SCRIPT_NAME);
419         if ( ($temp == '/') || ($temp == '\\') )
420             $temp = '';
421         define('DATA_PATH', $temp);
422         /*
423         if (USE_PATH_INFO)
424             define('DATA_PATH', '..');
425         */
426     }
427
428     if (SERVER_PORT
429         && SERVER_PORT != (SERVER_PROTOCOL == 'https' ? 443 : 80)) {
430         define('SERVER_URL',
431                SERVER_PROTOCOL . '://' . SERVER_NAME . ':' . SERVER_PORT);
432     }
433     else {
434         define('SERVER_URL',
435                SERVER_PROTOCOL . '://' . SERVER_NAME);
436     }
437
438     if (VIRTUAL_PATH != SCRIPT_NAME) {
439         // Apache action handlers are used.
440         define('PATH_INFO_PREFIX', VIRTUAL_PATH . '/');
441     }
442     else
443         define('PATH_INFO_PREFIX', '/');
444
445     define('PHPWIKI_BASE_URL',
446            SERVER_URL . (USE_PATH_INFO ? VIRTUAL_PATH . '/' : SCRIPT_NAME));
447
448     // Detect PrettyWiki setup (not loading index.php directly)
449     // $SCRIPT_FILENAME should be the same as __FILE__ in index.php
450     if (!isset($SCRIPT_FILENAME))
451         $SCRIPT_FILENAME = @$HTTP_SERVER_VARS['SCRIPT_FILENAME'];
452     if (!isset($SCRIPT_FILENAME))
453         $SCRIPT_FILENAME = @$HTTP_ENV_VARS['SCRIPT_FILENAME'];
454     if (!isset($SCRIPT_FILENAME))
455         $SCRIPT_FILENAME = dirname(__FILE__.'/../') . '/index.php';
456     if (isWindows())
457         $SCRIPT_FILENAME = strtr($SCRIPT_FILENAME,'/','\\');
458     define('SCRIPT_FILENAME',$SCRIPT_FILENAME);
459
460     //////////////////////////////////////////////////////////////////
461     // Select database
462     //
463     if (empty($DBParams['dbtype']))
464         $DBParams['dbtype'] = 'dba';
465
466     if (!defined('THEME'))
467         define('THEME', 'default');
468
469     if (!defined('WIKI_NAME'))
470         define('WIKI_NAME', _("An unnamed PhpWiki"));
471
472     if (!defined('HOME_PAGE'))
473         define('HOME_PAGE', _("HomePage"));
474
475     // FIXME: delete
476     // Access log
477     if (!defined('ACCESS_LOG'))
478         define('ACCESS_LOG', '');
479
480     // FIXME: delete
481     // Get remote host name, if apache hasn't done it for us
482     if (empty($HTTP_SERVER_VARS['REMOTE_HOST']) && ENABLE_REVERSE_DNS)
483         $HTTP_SERVER_VARS['REMOTE_HOST'] = gethostbyaddr($HTTP_SERVER_VARS['REMOTE_ADDR']);
484
485     // check whether the crypt() function is needed and present
486     if (defined('ENCRYPTED_PASSWD') && !function_exists('crypt')) {
487         $error = sprintf(_("Encrypted passwords cannot be used: %s."),
488                          "'function crypt()' not available in this version of php");
489         trigger_error($error);
490     }
491
492     if (!defined('ADMIN_PASSWD') or ADMIN_PASSWD == '')
493         trigger_error(_("The admin password cannot be empty. Please update your /index.php"));
494
495     if (defined('USE_DB_SESSION') and USE_DB_SESSION) {
496         if (! $DBParams['db_session_table'] ) {
497             trigger_error(_("Empty db_session_table. Turn USE_DB_SESSION off or define the table name."), 
498                           E_USER_ERROR);
499             // this is flawed. constants cannot be changed.
500             define('USE_DB_SESSION',false);
501             $DBParams['db_session_table'] = @$DBParams['prefix'] . 'session';
502         }
503     } else {
504         // default: true (since v1.3.8)
505         if (!defined('USE_DB_SESSION'))
506             define('USE_DB_SESSION',true);
507     }
508     // legacy:
509     if (!defined('ENABLE_USER_NEW')) define('ENABLE_USER_NEW',true);
510     if (!defined('ALLOW_USER_LOGIN'))
511         define('ALLOW_USER_LOGIN', defined('ALLOW_USER_PASSWORDS') && ALLOW_USER_PASSWORDS);
512     if (!defined('ALLOW_ANON_USER')) define('ALLOW_ANON_USER', true); 
513     if (!defined('ALLOW_ANON_EDIT')) define('ALLOW_ANON_EDIT', false); 
514     if (!defined('REQUIRE_SIGNIN_BEFORE_EDIT')) define('REQUIRE_SIGNIN_BEFORE_EDIT', ! ALLOW_ANON_EDIT);
515     if (!defined('ALLOW_BOGO_LOGIN')) define('ALLOW_BOGO_LOGIN', true);
516
517     if (ALLOW_USER_LOGIN and !empty($DBAuthParams) and empty($DBAuthParams['auth_dsn'])) {
518         if (isset($DBParams['dsn']))
519             $DBAuthParams['auth_dsn'] = $DBParams['dsn'];
520     }
521 }
522
523 // $Log: not supported by cvs2svn $
524 // Revision 1.17  2004/05/06 19:26:15  rurban
525 // improve stability, trying to find the InlineParser endless loop on sf.net
526 //
527 // remove end-of-zip comments to fix sf.net bug #777278 and probably #859628
528 //
529 // Revision 1.16  2004/05/02 15:10:05  rurban
530 // new finally reliable way to detect if /index.php is called directly
531 //   and if to include lib/main.php
532 // new global AllActionPages
533 // SetupWiki now loads all mandatory pages: HOME_PAGE, action pages, and warns if not.
534 // WikiTranslation what=buttons for Carsten to create the missing MacOSX buttons
535 // PageGroupTestOne => subpages
536 // renamed PhpWikiRss to PhpWikiRecentChanges
537 // more docs, default configs, ...
538 //
539 // Revision 1.15  2004/05/01 15:59:29  rurban
540 // more php-4.0.6 compatibility: superglobals
541 //
542 // Revision 1.14  2004/04/29 23:25:12  rurban
543 // re-ordered locale init (as in 1.3.9)
544 // fixed loadfile with subpages, and merge/restore anyway
545 //   (sf.net bug #844188)
546 //
547 // Revision 1.13  2004/04/29 21:54:05  rurban
548 // typo
549 //
550 // Revision 1.12  2004/04/27 16:16:27  rurban
551 // more subtle config problems with defaults
552 //
553 // Revision 1.11  2004/04/26 20:44:34  rurban
554 // locking table specific for better databases
555 //
556 // Revision 1.10  2004/04/26 13:22:32  rurban
557 // calculate bool old or dynamic constants later
558 //
559 // Revision 1.9  2004/04/26 12:15:01  rurban
560 // check default config values
561 //
562 // Revision 1.8  2004/04/23 16:55:59  zorloc
563 // If using Db auth and DBAUTH_AUTH_DSN is empty set DBAUTH_AUTH_DSN to $DBParams['dsn']
564 //
565 // Revision 1.7  2004/04/20 22:26:27  zorloc
566 // Removed Pear_Config for parse_ini_file().
567 //
568 // Revision 1.6  2004/04/20 18:10:27  rurban
569 // config refactoring:
570 //   FileFinder is needed for WikiFarm scripts calling index.php
571 //   config run-time calls moved to lib/IniConfig.php:fix_configs()
572 //   added PHPWIKI_DIR smart-detection code (Theme finder)
573 //   moved FileFind to lib/FileFinder.php
574 //   cleaned lib/config.php
575 //
576 // Revision 1.5  2004/04/20 17:21:57  rurban
577 // WikiFarm code: honor predefined constants
578 //
579 // Revision 1.4  2004/04/20 17:08:19  rurban
580 // Some IniConfig fixes: prepend our private lib/pear dir
581 //   switch from " to ' in the auth statements
582 //   use error handling.
583 // WikiUserNew changes for the new "'$variable'" syntax
584 //   in the statements
585 // TODO: optimization to put config vars into the session.
586 //
587
588 // (c-file-style: "gnu")
589 // Local Variables:
590 // mode: php
591 // tab-width: 8
592 // c-basic-offset: 4
593 // c-hanging-comment-ender-p: nil
594 // indent-tabs-mode: nil
595 // End:   
596 ?>