3 // essential internal stuff -- skip it. Go down to Part One. There
4 // are four parts to this file that interest you, all labeled Part
5 // One, Two, Three and Four.
7 set_magic_quotes_runtime(0);
8 error_reporting(E_ALL ^ E_NOTICE);
9 if (!ini_get('register_globals') or (ini_get('register_globals') == 'off')) {
10 import_request_variables('gps');
11 extract($HTTP_SERVER_VARS);
14 if (!function_exists('rcs_id')) {
15 function rcs_id($id) { echo "<!-- $id -->\n"; };
17 rcs_id('$Id: config.php,v 1.24.2.14 2005-07-23 11:13:02 rurban Exp $');
18 define('PHPWIKI_VERSION', '1.2.8');
19 // end essential internal stuff
22 /////////////////////////////////////////////////////////////////////
24 // Constants and settings. Edit the values below for your site.
25 /////////////////////////////////////////////////////////////////////
28 // URL of index.php e.g. http://yoursite.com/phpwiki/index.php
29 // you can leave this empty - it will be calculated automatically
31 // URL of admin.php e.g. http://yoursite.com/phpwiki/admin.php
32 // you can leave this empty - it will be calculated automatically
33 // if you fill in $ScriptUrl you *MUST* fill in $AdminUrl as well!
36 // Select your language - default language "C": English
37 // other languages available: Dutch "nl", Spanish "es", German "de",
41 /////////////////////////////////////////////////////////////////////
44 // set your database here and edit the according section below.
45 // For PHP 4.0.4 and later you must use "dba" if you are using
46 // DBM files for storage. "dbm" uses the older deprecated interface.
47 // The option 'default' will choose either dbm or dba, depending on
48 // the version of PHP you are running.
49 /////////////////////////////////////////////////////////////////////
51 $WhichDatabase = 'default'; // use one of "dbm", "dba", "mysql",
52 // "pgsql", "msql", "mssql", or "file"
54 if ($WhichDatabase == 'default' and function_exists("dba_open"))
55 $WhichDatabase = 'dba';
56 if ($WhichDatabase == 'default' and function_exists("dbmopen")
57 and floor(phpversion()) == 3)
58 $WhichDatabase = 'dbm';
60 // DBM and DBA settings (default)
61 if ($WhichDatabase == 'dbm' or $WhichDatabase == 'dba' or
62 $WhichDatabase == 'default') {
64 $WikiPageStore = "wiki";
65 $ArchivePageStore = "archive";
66 $WikiDB['wiki'] = "$DBMdir/wikipagesdb";
67 $WikiDB['archive'] = "$DBMdir/wikiarchivedb";
68 $WikiDB['wikilinks'] = "$DBMdir/wikilinksdb";
69 $WikiDB['hottopics'] = "$DBMdir/wikihottopicsdb";
70 $WikiDB['hitcount'] = "$DBMdir/wikihitcountdb";
72 // This is the type of DBA handler for your system. For most Linuxen
73 // 'gdbm' is best; 'db2', 'db3' or 'db4' (BerkeleyDB) are another common types.
74 // 'ndbm' appears on Solaris but won't work because it won't store pages larger
76 // We do now some smart auto-detection, which will be the best.
77 // You can override it by defining DBM_FILE_TYPE earlier.
78 if (!defined("DBM_FILE_TYPE")) {
79 if (function_exists("dba_handlers")) { // since 4.3.0
80 foreach (array('gdbm','db4','db3','db2','sdbm','ndbm') as $handler) {
81 if (in_array($handler, dba_handlers())) {
82 define("DBM_FILE_TYPE", $handler);
88 if (!defined("DBM_FILE_TYPE"))
89 define("DBM_FILE_TYPE", (substr(PHP_OS,0,3) == 'WIN') ? 'db3' : 'gdbm');
91 // time in seconds to try if the dbm is unavailable
92 define("MAX_DBM_ATTEMPTS", 20);
94 // for PHP3 use dbmlib, else use dbalib for PHP4
95 if ($WhichDatabase == 'default') {
96 if ( floor(phpversion()) == 3) {
97 $WhichDatabase = 'dbm';
99 $WhichDatabase = 'dba';
103 if ($WhichDatabase == 'dbm') {
104 include "lib/dbmlib.php";
106 include "lib/dbalib.php";
109 // MySQL settings -- see INSTALL.mysql for details on using MySQL
110 } elseif ($WhichDatabase == 'mysql') {
111 // MySQL server host:
112 $mysql_server = 'localhost';
114 // username as used in step 2 of INSTALL.mysql:
115 $mysql_user = 'wikiuser';
117 // password of above user (or leave blank if none):
120 // name of the mysql database
121 // (this used to default to 'wiki' prior to phpwiki-1.2.2)
122 $mysql_db = 'phpwiki';
124 // Names of the tables.
125 // You probably don't need to change these. If you do change
126 // them you will also have to make corresponding changes in
127 // schemas/schema.mysql before you initialize the database.
128 $WikiPageStore = "wiki";
129 $ArchivePageStore = "archive";
130 $WikiLinksStore = "wikilinks";
131 $WikiScoreStore = "wikiscore";
132 $HitCountStore = "hitcount";
134 include "lib/mysql.php";
136 // PostgreSQL settings -- see INSTALL.pgsql for more details
137 } elseif ($WhichDatabase == 'pgsql') {
138 $pg_dbhost = "localhost";
140 $pg_dbuser = ""; // username as used in step 2 of INSTALL.mysql
141 $pg_dbpass = ""; // password of above user (or leave blank if none)
142 $WikiDataBase = "wiki"; // name of the database in Postgresql
143 $WikiPageStore = "wiki";
144 $ArchivePageStore = "archive";
145 $WikiLinksPageStore = "wikilinks";
146 $HotTopicsPageStore = "hottopics";
147 $HitCountPageStore = "hitcount";
148 include "lib/pgsql.php";
150 // MiniSQL (mSQL) settings -- see INSTALL.msql for details on using mSQL
151 } elseif ($WhichDatabase == 'msql') {
153 $WikiPageStore = array();
154 $ArchivePageStore = array();
155 $WikiPageStore['table'] = "wiki";
156 $WikiPageStore['page_table'] = "wikipages";
157 $ArchivePageStore['table'] = "archive";
158 $ArchivePageStore['page_table'] = "archivepages";
159 // should be the same as wikipages.line
160 define("MSQL_MAX_LINE_LENGTH", 128);
161 include "lib/msql.php";
163 // Filesystem DB settings
164 } elseif ($WhichDatabase == 'file') {
165 $DBdir = "/tmp/wiki";
166 $WikiPageStore = "wiki";
167 $ArchivePageStore = "archive";
168 $WikiDB[$WikiPageStore] = "$DBdir/pages";
169 $WikiDB[$ArchivePageStore] = "$DBdir/archive";
170 //$WikiDB['wikilinks'] = "$DBdir/links";
171 //$WikiDB['hottopics'] = "$DBdir/hottopics";
172 $WikiDB['hitcount'] = "$DBdir/hitcount";
173 include "lib/db_filesystem.php";
175 // MS SQLServer settings
176 } elseif ($WhichDatabase == 'mssql') {
177 $WikiPageStore = "wiki";
178 $ArchivePageStore = "archive";
179 $WikiLinksStore = "wikilinks";
180 $WikiScoreStore = "wikiscore";
181 $HitCountStore = "hitcount";
182 $mssql_server = 'servername';
186 include "lib/mssql.php";
188 } else die("Invalid '\$WhichDatabase' in lib/config.php");
191 /////////////////////////////////////////////////////////////////////
194 /////////////////////////////////////////////////////////////////////
196 // logo image (path relative to index.php)
197 $logo = "images/wikibase.png";
199 // Signature image which is shown after saving an edited page
200 // If this is left blank (or unset), the signature will be omitted.
201 $SignatureImg = "images/signature.png";
203 // this turns on url indicator icons, inserted before embedded links
204 //define("USE_LINK_ICONS", 1);
205 if (defined('USE_LINK_ICONS') and !defined('DATA_PATH'))
206 define("DATA_PATH", dirname($SCRIPT_NAME));
208 // date & time formats used to display modification times, etc.
209 // formats are given as format strings to PHP date() function
210 $datetimeformat = "F j, Y"; // may contain time of day
211 $dateformat = "F j, Y"; // must not contain time
213 // this defines how many page names to list when displaying
214 // the MostPopular pages; the default is to show the 20 most popular pages
215 define("MOST_POPULAR_LIST_LENGTH", 20);
217 // this defines how many page names to list when displaying related pages
218 define("NUM_RELATED_PAGES", 5);
220 // number of user-defined external references, i.e. "[1]"
221 define("NUM_LINKS", 12);
223 // allowed protocols for links - be careful not to allow "javascript:"
224 // within a named link [name|uri] one more protocol is defined: phpwiki
225 $AllowedProtocols = "http|https|mailto|ftp|news|nntp|gopher";
227 // URLs ending with the following extension should be inlined as images
228 $InlineImages = "png|jpg|gif";
230 // Uncomment this to automatically split WikiWords by inserting spaces.
231 // The default is to leave WordsSmashedTogetherLikeSo in the body text.
232 //define("AUTOSPLIT_WIKIWORDS", 1);
234 // Perl regexp for WikiNames
235 // (?<!..) & (?!...) used instead of '\b' because \b matches '_' as well
236 //$WikiNameRegexp = "(?<![A-Za-z0-9])([A-Z][a-z]+){2,}(?![A-Za-z0-9])";
237 // This should work for all ISO-8859-1 languages:
238 $WikiNameRegexp = "(?<![A-Za-z0-9µÀ-ÖØ-öø-ÿ])([A-ZÀ-ÖØ-Þ][a-zµß-öø-ÿ]+){2,}(?![A-Za-z0-9µÀ-ÖØ-öø-ÿ])";
240 /////////////////////////////////////////////////////////////////////
242 // Original pages and layout
243 /////////////////////////////////////////////////////////////////////
245 // need to define localization function first -- skip this
246 if (!function_exists ('gettext')) {
247 $lcfile = "locale/$LANG/LC_MESSAGES/phpwiki.php";
248 if (file_exists($lcfile)) { include($lcfile); }
249 else { $locale = array(); }
251 function gettext ($text) {
253 if (!empty ($locale[$text]))
254 return $locale[$text];
258 // This putenv() fails when safe_mode is on.
259 @putenv("LC_ALL=$LANG");
260 @putenv("LANG=$LANG");
261 @putenv("LANGUAGE=$LANG");
262 if (!defined("LC_ALL")) {
263 // Backwards compatibility (for PHP < 4.0.5)
264 define("LC_ALL", "LC_ALL");
266 setlocale(LC_ALL, "$LANG");
267 bindtextdomain ("phpwiki", "./locale");
268 textdomain ("phpwiki");
270 // end of localization function
272 // Template files (filenames are relative to script position)
274 "BROWSE" => gettext("templates/browse.html"),
275 "EDITPAGE" => gettext("templates/editpage.html"),
276 "EDITLINKS" => gettext("templates/editlinks.html"),
277 "MESSAGE" => gettext("templates/message.html")
280 /* WIKI_PGSRC -- specifies the source for the initial page contents
281 * of the Wiki. The setting of WIKI_PGSRC only has effect when
282 * the wiki is accessed for the first time (or after clearing the
283 * database.) WIKI_PGSRC can either name a directory or a zip file.
284 * In either case WIKI_PGSRC is scanned for files --- one file per page.
286 * If the files appear to be MIME formatted messages, they are
287 * scanned for application/x-phpwiki content-types. Any suitable
288 * content is added to the wiki.
289 * The files can also be plain text files, in which case the page name
290 * is taken from the file name.
293 define('WIKI_PGSRC', gettext("./pgsrc")); // Default (old) behavior.
294 //define('WIKI_PGSRC', './wiki.zip'); // New style.
296 // DEFAULT_WIKI_PGSRC is only used when the language is *not*
297 // the default (English) and when reading from a directory:
298 // in that case some English pages are inserted into the wiki as well
299 // DEFAULT_WIKI_PGSRC defines where the English pages reside
300 define('DEFAULT_WIKI_PGSRC', "./pgsrc");
304 //////////////////////////////////////////////////////////////////////
305 // you shouldn't have to edit anything below this line
306 function compute_default_scripturl() {
307 global $HTTP_SERVER_VARS, $SERVER_PORT, $SERVER_NAME, $SCRIPT_NAME, $HTTPS;
308 if (!ini_get('register_globals') or (ini_get('register_globals') == 'off')) {
309 extract($HTTP_SERVER_VARS);
312 if (!empty($HTTPS) && $HTTPS != 'off') {
320 $port = ($SERVER_PORT == $dflt_port) ? '' : ":$SERVER_PORT";
321 return $proto . '://' . $SERVER_NAME . $port . $SCRIPT_NAME;
324 if (empty($ScriptUrl)) {
325 $ScriptUrl = compute_default_scripturl();
327 if (defined('WIKI_ADMIN') && !empty($AdminUrl))
328 $ScriptUrl = $AdminUrl;
330 $FieldSeparator = "\263";
332 if (isset($PHP_AUTH_USER)) {
333 $remoteuser = $PHP_AUTH_USER;
336 // Apache won't show REMOTE_HOST unless the admin configured it
337 // properly. We'll be nice and see if it's there.
339 getenv('REMOTE_HOST') ? ($remoteuser = getenv('REMOTE_HOST'))
340 : ($remoteuser = getenv('REMOTE_ADDR'));
343 // constants used for HTML output. HTML tags may allow nesting
344 // other tags always start at level 0
345 define("ZERO_LEVEL", 0);
346 define("NESTED_LEVEL", 1);
348 // constants for flags in $pagehash
349 define("FLAG_PAGE_LOCKED", 1);