2 rcs_id('$Id: config.php,v 1.32 2001-02-14 22:02:05 dairiki Exp $');
4 * NOTE: the settings here should probably not need to be changed.
7 * (The user-configurable settings have been moved to index.php.)
10 // essential internal stuff
12 set_magic_quotes_runtime(0);
16 // "\x80"-"\x9f" (and "\x00" - "\x1f") are non-printing control
17 // chars in iso-8859-*
18 // $FieldSeparator = "\263"; //this is a superscript 3 in ISO-8859-1.
19 $FieldSeparator = "\x81";
22 // constants for flags in $pagehash
23 define("FLAG_PAGE_LOCKED", 1);
25 //////////////////////////////////////////////////////////////////
27 // Set up localization
34 // Search PHP's include_path to find file or directory.
35 function FindFile ($file, $missing_okay = false)
37 // FIXME: This wont work for DOS filenames.
38 if (ereg('^/', $file))
41 if (file_exists($file))
46 $include_path = ini_get('include_path');
47 if (empty($include_path))
49 // FIXME: This wont work for DOS filenames.
50 $path = explode(':', $include_path);
51 while (list($i, $dir) = each ($path))
52 if (file_exists("$dir/$file"))
57 ExitWiki("$file: file not found");
61 // Search PHP's include_path to find file or directory.
62 // Searches for "locale/$LANG/$file", then for "$file".
63 function FindLocalizedFile ($file, $missing_okay = false)
67 // FIXME: This wont work for DOS filenames.
68 if (!ereg('^/', $file))
70 if ( ($path = FindFile("locale/$LANG/$file", 'missing_is_okay')) )
73 return FindFile($file, $missing_okay);
76 if (!function_exists ('gettext'))
80 function gettext ($text) {
82 if (!empty ($locale[$text]))
83 return $locale[$text];
87 if ( ($lcfile = FindLocalizedFile("LC_MESSAGES/phpwiki.php", 'missing_ok')) )
94 putenv ("LANG=$LANG");
95 bindtextdomain ("phpwiki", "./locale");
96 textdomain ("phpwiki");
99 //////////////////////////////////////////////////////////////////
100 // Autodetect URL settings:
102 if (!defined('SERVER_NAME')) define('SERVER_NAME', $SERVER_NAME);
103 if (!defined('SERVER_PORT')) define('SERVER_PORT', $SERVER_PORT);
104 if (!defined('SCRIPT_NAME')) define('SCRIPT_NAME', $SCRIPT_NAME);
105 if (!defined('DATA_PATH'))
106 define('DATA_PATH', dirname(SCRIPT_NAME));
107 if (!defined('USE_PATH_INFO'))
110 * If SCRIPT_NAME does not look like php source file,
111 * or user cgi we assume that php is getting run by an
112 * action handler in /cgi-bin. In this case,
113 * I think there is no way to get Apache to pass
114 * useful PATH_INFO to the php script (PATH_INFO
115 * is used to the the php interpreter where the
118 if (php_sapi_name() == 'apache')
119 define('USE_PATH_INFO', true);
121 define('USE_PATH_INFO', ereg('\.(php3?|cgi)$', $SCRIPT_NAME));
123 if (!defined('VIRTUAL_PATH'))
125 if (USE_PATH_INFO and isset($REDIRECT_URL))
127 // FIXME: This is a hack, and won't work if the requested
128 // pagename has a slash in it.
129 define('VIRTUAL_PATH', dirname($REDIRECT_URL . 'x'));
132 define('VIRTUAL_PATH', SCRIPT_NAME);
135 if (SERVER_PORT && SERVER_PORT != 80)
137 "http://" . SERVER_NAME . ':' . SERVER_PORT);
140 "http://" . SERVER_NAME);
142 if (VIRTUAL_PATH != SCRIPT_NAME)
144 // Apache action handlers are used.
145 define('PATH_INFO_PREFIX', VIRTUAL_PATH . "/");
148 define("PATH_INFO_PREFIX", '/');
151 //////////////////////////////////////////////////////////////////
154 if (empty($DBParams['dbtype']))
156 if ( floor(phpversion()) == 3) {
157 $DBParams['dbtype'] = 'dbm';
159 $DBParams['dbtype'] = 'dba';
163 switch ($DBParams['dbtype'])
166 include 'lib/dbmlib.php';
169 include 'lib/dbalib.php';
172 include 'lib/mysql.php';
175 include 'lib/pgsql.php';
178 include 'lib/msql.php';
181 include "lib/db_filesystem.php";
184 ExitWiki($DBParams['dbtype'] . ": unknown DBTYPE");
187 // InterWiki linking -- wiki-style links to other wikis on the web
189 if (defined('INTERWIKI_MAP_FILE'))
191 include ('lib/interwiki.php');
197 // c-file-style: "ellemtel"