$v) { if (defined($k)) $rs[$k] = constant($k); elseif (!isset($rs[$k])) $rs[$k] = $v; } foreach ($_IC_VALID_VALUE as $item) { if (defined($item)) continue; if (array_key_exists($item, $rs)) { define($item, $rs[$item]); //} elseif (array_key_exists($item, $rsdef)) { // define($item, $rsdef[$item]); // calculate them later or not at all: } elseif (in_array($item,array('DATABASE_PREFIX', 'SERVER_NAME', 'SERVER_PORT', 'SCRIPT_NAME', 'DATA_PATH', 'PHPWIKI_DIR', 'VIRTUAL_PATH', 'LDAP_AUTH_HOST','IMAP_AUTH_HOST','POP3_AUTH_HOST'))) { ; } else { trigger_error(sprintf("missing config setting for %s",$item)); } } // Boolean options are slightly special - if they're set to any of // '', 'false', '0', or 'no' (all case-insensitive) then the value will // be a boolean false, otherwise if there is anything set it'll // be true. foreach ($_IC_VALID_BOOL as $item) { if (defined($item)) continue; if (array_key_exists($item, $rs)) { $val = $rs[$item]; //} elseif (array_key_exists($item, $rsdef)) { // $val = $rsdef[$item]; } else { $val = false; //trigger_error(sprintf("missing boolean config setting for %s",$item)); } // calculate them later: old or dynamic constants if (!array_key_exists($item, $rs) and in_array($item,array('USE_PATH_INFO','USE_DB_SESSION', 'ALLOW_HTTP_AUTH_LOGIN','ALLOW_LDAP_LOGIN', 'ALLOW_IMAP_LOGIN','ALLOW_USER_LOGIN', 'REQUIRE_SIGNIN_BEFORE_EDIT', 'WIKIDB_NOCACHE_MARKUP'))) { ; } elseif (!$val) { define($item, false); } elseif (strtolower($val) == 'false' || strtolower($val) == 'no' || $val == '' || $val == false || $val == '0') { define($item, false); } else { define($item, true); } } // Special handling for some config options if ($val = @$rs['INCLUDE_PATH']) { ini_set('include_path', $val); } if ($val = @$rs['SESSION_SAVE_PATH']) { ini_set('session.save_path', $val); } // Database global $DBParams; $DBParams['dbtype'] = @$rs['DATABASE_TYPE']; if (isset($rs['DATABASE_DSN'])) $DBParams['dsn'] = $rs['DATABASE_DSN']; if (isset($rs['DATABASE_PREFIX'])) $DBParams['prefix'] = $rs['DATABASE_PREFIX']; $DBParams['db_session_table'] = @$rs['DATABASE_SESSION_TABLE']; $DBParams['dba_handler'] = @$rs['DATABASE_DBA_HANDLER']; $DBParams['directory'] = @$rs['DATABASE_DIRECTORY']; $DBParams['timeout'] = @$rs['DATABASE_TIMEOUT']; if (!defined('USE_DB_SESSION') and $DBParams['db_session_table'] and in_array($DBParams['dbtype'],array('SQL','ADODB'/*,'dba'*/))) { define('USE_DB_SESSION', true); } // Expiry stuff global $ExpireParams; $ExpireParams['major'] = array( 'max_age' => @$rs['MAJOR_MAX_AGE'], 'min_age' => @$rs['MAJOR_MIN_AGE'], 'min_keep' => @$rs['MAJOR_MIN_KEEP'], 'keep' => @$rs['MAJOR_KEEP'], 'max_keep' => @$rs['MAJOR_MAX_KEEP'] ); $ExpireParams['minor'] = array( 'max_age' => @$rs['MINOR_MAX_AGE'], 'min_age' => @$rs['MINOR_MIN_AGE'], 'min_keep' => @$rs['MINOR_MIN_KEEP'], 'keep' => @$rs['MINOR_KEEP'], 'max_keep' => @$rs['MINOR_MAX_KEEP'] ); $ExpireParams['author'] = array( 'max_age' => @$rs['AUTHOR_MAX_AGE'], 'min_age' => @$rs['AUTHOR_MIN_AGE'], 'min_keep' => @$rs['AUTHOR_MIN_KEEP'], 'keep' => @$rs['AUTHOR_KEEP'], 'max_keep' => @$rs['AUTHOR_MAX_KEEP'] ); // User authentication if (!isset($GLOBALS['USER_AUTH_ORDER'])) if (isset($rs['USER_AUTH_ORDER'])) $GLOBALS['USER_AUTH_ORDER'] = preg_split('/\s*:\s*/', $rs['USER_AUTH_ORDER']); else $GLOBALS['USER_AUTH_ORDER'] = array("PersonalPage"); // LDAP bind options global $LDAP_SET_OPTION; if (isset($rs['LDAP_SET_OPTION'])) { $optlist = preg_split('/\s*:\s*/', @$rs['LDAP_SET_OPTION']); foreach ($optlist as $opt) { $bits = preg_split('/\s*=\s*/', $opt, 2); if (count($bits) == 2) { $LDAP_SET_OPTION[$bits[0]] = $bits[1]; } else { // Possibly throw some sort of error? } } } // Now it's the external DB authentication stuff's turn if (in_array('Db', $GLOBALS['USER_AUTH_ORDER']) && empty($rs['DBAUTH_AUTH_DSN'])) { $rs['DBAUTH_AUTH_DSN'] = $DBParams['dsn']; } global $DBAuthParams; $DBAP_MAP = array('DBAUTH_AUTH_DSN' => 'auth_dsn', 'DBAUTH_AUTH_CHECK' => 'auth_check', 'DBAUTH_AUTH_USER_EXISTS' => 'auth_user_exists', 'DBAUTH_AUTH_CRYPT_METHOD' => 'auth_crypt_method', 'DBAUTH_AUTH_UPDATE' => 'auth_update', 'DBAUTH_AUTH_CREATE' => 'auth_create', 'DBAUTH_PREF_SELECT' => 'pref_select', 'DBAUTH_PREF_UPDATE' => 'pref_update', 'DBAUTH_IS_MEMBER' => 'is_member', 'DBAUTH_GROUP_MEMBERS' => 'group_members', 'DBAUTH_USER_GROUPS' => 'user_groups' ); foreach ($DBAP_MAP as $rskey => $apkey) { if (isset($rs[$rskey])) { $DBAuthParams[$apkey] = $rs[$rskey]; } elseif (isset($rsdef[$rskey])) { $DBAuthParams[$apkey] = $rsdef[$rskey]; } } // Default Wiki pages to force loading from pgsrc global $GenericPages; $GenericPages = preg_split('/\s*:\s*/', @$rs['DEFAULT_WIKI_PAGES']); // Wiki name regexp: Should be a define(), but might needed to be changed at runtime // (different LC_CHAR need different posix classes) global $WikiNameRegexp; $WikiNameRegexp = constant('WIKI_NAME_REGEXP'); if (!trim($WikiNameRegexp)) $WikiNameRegexp = '(?getParam and WikiDB->getAuthParam method to get rid of globals // remove leading slash in error message // added force_unlock parameter to File_Passwd (no return on stale locks) // fixed adodb session AffectedRows // added FileFinder helpers to unify local filenames and DATA_PATH names // editpage.php: new edit toolbar javascript on ENABLE_EDIT_TOOLBAR // // Revision 1.24 2004/05/18 13:33:13 rurban // we already have a CGI function // // Revision 1.23 2004/05/17 17:43:29 rurban // CGI: no PATH_INFO fix // // Revision 1.22 2004/05/16 22:07:35 rurban // check more config-default and predefined constants // various PagePerm fixes: // fix default PagePerms, esp. edit and view for Bogo and Password users // implemented Creator and Owner // BOGOUSERS renamed to BOGOUSER // fixed syntax errors in signin.tmpl // // Revision 1.21 2004/05/08 22:55:12 rurban // Fixed longstanding sf.net:demo problem. endless loop, caused by an empty definition of // WIKI_NAME_REGEXP. Exactly this constant wasn't checked for its default setting. // // Revision 1.20 2004/05/08 20:21:00 rurban // remove php tags in Log // // Revision 1.19 2004/05/08 19:55:29 rurban // support inlined plugin-result: // if the plugin is parsed inside a line, use instead of //
// e.g. for "This is the current Phpwiki version. // // Revision 1.18 2004/05/08 16:58:19 rurban // don't ignore some false config values (e.g. USE_PATH_INFO false was ignored) // // Revision 1.17 2004/05/06 19:26:15 rurban // improve stability, trying to find the InlineParser endless loop on sf.net // // remove end-of-zip comments to fix sf.net bug #777278 and probably #859628 // // Revision 1.16 2004/05/02 15:10:05 rurban // new finally reliable way to detect if /index.php is called directly // and if to include lib/main.php // new global AllActionPages // SetupWiki now loads all mandatory pages: HOME_PAGE, action pages, and warns if not. // WikiTranslation what=buttons for Carsten to create the missing MacOSX buttons // PageGroupTestOne => subpages // renamed PhpWikiRss to PhpWikiRecentChanges // more docs, default configs, ... // // Revision 1.15 2004/05/01 15:59:29 rurban // more php-4.0.6 compatibility: superglobals // // Revision 1.14 2004/04/29 23:25:12 rurban // re-ordered locale init (as in 1.3.9) // fixed loadfile with subpages, and merge/restore anyway // (sf.net bug #844188) // // Revision 1.13 2004/04/29 21:54:05 rurban // typo // // Revision 1.12 2004/04/27 16:16:27 rurban // more subtle config problems with defaults // // Revision 1.11 2004/04/26 20:44:34 rurban // locking table specific for better databases // // Revision 1.10 2004/04/26 13:22:32 rurban // calculate bool old or dynamic constants later // // Revision 1.9 2004/04/26 12:15:01 rurban // check default config values // // Revision 1.8 2004/04/23 16:55:59 zorloc // If using Db auth and DBAUTH_AUTH_DSN is empty set DBAUTH_AUTH_DSN to $DBParams['dsn'] // // Revision 1.7 2004/04/20 22:26:27 zorloc // Removed Pear_Config for parse_ini_file(). // // Revision 1.6 2004/04/20 18:10:27 rurban // config refactoring: // FileFinder is needed for WikiFarm scripts calling index.php // config run-time calls moved to lib/IniConfig.php:fix_configs() // added PHPWIKI_DIR smart-detection code (Theme finder) // moved FileFind to lib/FileFinder.php // cleaned lib/config.php // // Revision 1.5 2004/04/20 17:21:57 rurban // WikiFarm code: honor predefined constants // // Revision 1.4 2004/04/20 17:08:19 rurban // Some IniConfig fixes: prepend our private lib/pear dir // switch from " to ' in the auth statements // use error handling. // WikiUserNew changes for the new "'$variable'" syntax // in the statements // TODO: optimization to put config vars into the session. // // (c-file-style: "gnu") // Local Variables: // mode: php // tab-width: 8 // c-basic-offset: 4 // c-hanging-comment-ender-p: nil // indent-tabs-mode: nil // End: ?>