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')) {
10 extract($HTTP_SERVER_VARS);
13 if (!function_exists('rcs_id')) {
14 function rcs_id($id) { echo "<!-- $id -->\n"; };
16 rcs_id('$Id: config.php,v 1.24.2.13.2.2 2005-01-07 13:59:58 rurban Exp $');
17 // end essential internal stuff
20 /////////////////////////////////////////////////////////////////////
22 // Constants and settings. Edit the values below for your site.
23 /////////////////////////////////////////////////////////////////////
26 // URL of index.php e.g. http://yoursite.com/phpwiki/index.php
27 // you can leave this empty - it will be calculated automatically
29 // URL of admin.php e.g. http://yoursite.com/phpwiki/admin.php
30 // you can leave this empty - it will be calculated automatically
31 // if you fill in $ScriptUrl you *MUST* fill in $AdminUrl as well!
34 // Select your language - default language "C": English
35 // other languages available: Dutch "nl", Spanish "es", German "de",
39 /////////////////////////////////////////////////////////////////////
42 // set your database here and edit the according section below.
43 // For PHP 4.0.4 and later you must use "dba" if you are using
44 // DBM files for storage. "dbm" uses the older deprecated interface.
45 // The option 'default' will choose either dbm or dba, depending on
46 // the version of PHP you are running.
47 /////////////////////////////////////////////////////////////////////
49 $WhichDatabase = 'default'; // use one of "dbm", "dba", "mysql",
50 // "pgsql", "msql", "mssql", or "file"
52 // DBM and DBA settings (default)
53 if ($WhichDatabase == 'dbm' or $WhichDatabase == 'dba' or
54 $WhichDatabase == 'default') {
56 $WikiPageStore = "wiki";
57 $ArchivePageStore = "archive";
58 $WikiDB['wiki'] = "$DBMdir/wikipagesdb";
59 $WikiDB['archive'] = "$DBMdir/wikiarchivedb";
60 $WikiDB['wikilinks'] = "$DBMdir/wikilinksdb";
61 $WikiDB['hottopics'] = "$DBMdir/wikihottopicsdb";
62 $WikiDB['hitcount'] = "$DBMdir/wikihitcountdb";
64 // this is the type of DBM file on your system. For most Linuxen
65 // 'gdbm' is fine; 'db2' is another common type. 'ndbm' appears
66 // on Solaris but won't work because it won't store pages larger
68 define("DBM_FILE_TYPE", 'gdbm');
70 // try this many times if the dbm is unavailable
71 define("MAX_DBM_ATTEMPTS", 20);
73 // for PHP3 use dbmlib, else use dbalib for PHP4
74 if ($WhichDatabase == 'default') {
75 if ( floor(phpversion()) == 3) {
76 $WhichDatabase = 'dbm';
78 $WhichDatabase = 'dba';
82 if ($WhichDatabase == 'dbm') {
83 include "lib/dbmlib.php";
85 include "lib/dbalib.php";
88 // MySQL settings -- see INSTALL.mysql for details on using MySQL
89 } elseif ($WhichDatabase == 'mysql') {
91 $mysql_server = 'localhost';
93 // username as used in step 2 of INSTALL.mysql:
94 $mysql_user = 'wikiuser';
96 // password of above user (or leave blank if none):
99 // name of the mysql database
100 // (this used to default to 'wiki' prior to phpwiki-1.2.2)
101 $mysql_db = 'phpwiki';
103 // Names of the tables.
104 // You probably don't need to change these. If you do change
105 // them you will also have to make corresponding changes in
106 // schemas/schema.mysql before you initialize the database.
107 $WikiPageStore = "wiki";
108 $ArchivePageStore = "archive";
109 $WikiLinksStore = "wikilinks";
110 $WikiScoreStore = "wikiscore";
111 $HitCountStore = "hitcount";
113 include "lib/mysql.php";
115 // PostgreSQL settings -- see INSTALL.pgsql for more details
116 } elseif ($WhichDatabase == 'pgsql') {
117 $pg_dbhost = "localhost";
119 $pg_dbuser = ""; // username as used in step 2 of INSTALL.mysql
120 $pg_dbpass = ""; // password of above user (or leave blank if none)
121 $WikiDataBase = "wiki"; // name of the database in Postgresql
122 $WikiPageStore = "wiki";
123 $ArchivePageStore = "archive";
124 $WikiLinksPageStore = "wikilinks";
125 $HotTopicsPageStore = "hottopics";
126 $HitCountPageStore = "hitcount";
127 include "lib/pgsql.php";
129 // MiniSQL (mSQL) settings -- see INSTALL.msql for details on using mSQL
130 } elseif ($WhichDatabase == 'msql') {
132 $WikiPageStore = array();
133 $ArchivePageStore = array();
134 $WikiPageStore['table'] = "wiki";
135 $WikiPageStore['page_table'] = "wikipages";
136 $ArchivePageStore['table'] = "archive";
137 $ArchivePageStore['page_table'] = "archivepages";
138 // should be the same as wikipages.line
139 define("MSQL_MAX_LINE_LENGTH", 128);
140 include "lib/msql.php";
142 // Filesystem DB settings
143 } elseif ($WhichDatabase == 'file') {
144 $DBdir = "/tmp/wiki";
145 $WikiPageStore = "wiki";
146 $ArchivePageStore = "archive";
147 $WikiDB['wiki'] = "$DBdir/pages";
148 $WikiDB['archive'] = "$DBdir/archive";
149 $WikiDB['wikilinks'] = "$DBdir/links";
150 $WikiDB['hottopics'] = "$DBdir/hottopics";
151 $WikiDB['hitcount'] = "$DBdir/hitcount";
152 include "lib/db_filesystem.php";
154 // MS SQLServer settings
155 } elseif ($WhichDatabase == 'mssql') {
156 $WikiPageStore = "wiki";
157 $ArchivePageStore = "archive";
158 $WikiLinksStore = "wikilinks";
159 $WikiScoreStore = "wikiscore";
160 $HitCountStore = "hitcount";
161 $mssql_server = 'servername';
165 include "lib/mssql.php";
167 } else die("Invalid '\$WhichDatabase' in lib/config.php");
170 /////////////////////////////////////////////////////////////////////
173 /////////////////////////////////////////////////////////////////////
175 // logo image (path relative to index.php)
176 $logo = "images/wikibase.png";
178 // Signature image which is shown after saving an edited page
179 // If this is left blank (or unset), the signature will be omitted.
180 $SignatureImg = "images/signature.png";
182 // date & time formats used to display modification times, etc.
183 // formats are given as format strings to PHP date() function
184 $datetimeformat = "F j, Y"; // may contain time of day
185 $dateformat = "F j, Y"; // must not contain time
187 // this defines how many page names to list when displaying
188 // the MostPopular pages; the default is to show the 20 most popular pages
189 define("MOST_POPULAR_LIST_LENGTH", 20);
191 // this defines how many page names to list when displaying related pages
192 define("NUM_RELATED_PAGES", 5);
194 // number of user-defined external references, i.e. "[1]"
195 define("NUM_LINKS", 12);
197 // allowed protocols for links - be careful not to allow "javascript:"
198 // within a named link [name|uri] one more protocol is defined: phpwiki
199 $AllowedProtocols = "http|https|mailto|ftp|news|gopher";
201 // URLs ending with the following extension should be inlined as images
202 $InlineImages = "png|jpg|gif";
204 // Perl regexp for WikiNames
205 // (?<!..) & (?!...) used instead of '\b' because \b matches '_' as well
206 $WikiNameRegexp = "(?<![A-Za-z0-9])([A-Z][a-z]+){2,}(?![A-Za-z0-9])";
210 /////////////////////////////////////////////////////////////////////
212 // Original pages and layout
213 /////////////////////////////////////////////////////////////////////
215 // need to define localization function first -- skip this
216 if (!function_exists ('gettext')) {
217 $lcfile = "locale/$LANG/LC_MESSAGES/phpwiki.php";
218 if (file_exists($lcfile)) { include($lcfile); }
219 else { $locale = array(); }
221 function gettext ($text) {
223 if (!empty ($locale[$text]))
224 return $locale[$text];
228 // This putenv() fails when safe_mode is on.
229 // I think it is unnecessary.
230 //putenv ("LANG=$LANG");
231 bindtextdomain ("phpwiki", "./locale");
232 textdomain ("phpwiki");
233 if (!defined("LC_ALL")) {
234 // Backwards compatibility (for PHP < 4.0.5)
235 define("LC_ALL", "LC_ALL");
237 setlocale(LC_ALL, "$LANG");
239 // end of localization function
241 // Template files (filenames are relative to script position)
243 "BROWSE" => gettext("templates/browse.html"),
244 "EDITPAGE" => gettext("templates/editpage.html"),
245 "EDITLINKS" => gettext("templates/editlinks.html"),
246 "MESSAGE" => gettext("templates/message.html")
249 /* WIKI_PGSRC -- specifies the source for the initial page contents
250 * of the Wiki. The setting of WIKI_PGSRC only has effect when
251 * the wiki is accessed for the first time (or after clearing the
252 * database.) WIKI_PGSRC can either name a directory or a zip file.
253 * In either case WIKI_PGSRC is scanned for files --- one file per page.
255 * If the files appear to be MIME formatted messages, they are
256 * scanned for application/x-phpwiki content-types. Any suitable
257 * content is added to the wiki.
258 * The files can also be plain text files, in which case the page name
259 * is taken from the file name.
262 define('WIKI_PGSRC', gettext("./pgsrc")); // Default (old) behavior.
263 //define('WIKI_PGSRC', './wiki.zip'); // New style.
265 // DEFAULT_WIKI_PGSRC is only used when the language is *not*
266 // the default (English) and when reading from a directory:
267 // in that case some English pages are inserted into the wiki as well
268 // DEFAULT_WIKI_PGSRC defines where the English pages reside
269 define('DEFAULT_WIKI_PGSRC', "./pgsrc");
273 //////////////////////////////////////////////////////////////////////
274 // you shouldn't have to edit anyting below this line
275 function compute_default_scripturl() {
276 global $HTTP_SERVER_VARS, $SERVER_PORT, $SERVER_NAME, $SCRIPT_NAME, $HTTPS;
277 if (!ini_get('register_globals')) {
278 extract($HTTP_SERVER_VARS);
281 if (!empty($HTTPS) && $HTTPS != 'off') {
289 $port = ($SERVER_PORT == $dflt_port) ? '' : ":$SERVER_PORT";
290 return $proto . '://' . $SERVER_NAME . $port . $SCRIPT_NAME;
293 if (empty($ScriptUrl)) {
294 $ScriptUrl = compute_default_scripturl();
296 if (defined('WIKI_ADMIN') && !empty($AdminUrl))
297 $ScriptUrl = $AdminUrl;
299 $FieldSeparator = "\263";
301 if (isset($PHP_AUTH_USER)) {
302 $remoteuser = $PHP_AUTH_USER;
305 // Apache won't show REMOTE_HOST unless the admin configured it
306 // properly. We'll be nice and see if it's there.
308 getenv('REMOTE_HOST') ? ($remoteuser = getenv('REMOTE_HOST'))
309 : ($remoteuser = getenv('REMOTE_ADDR'));
312 // constants used for HTML output. HTML tags may allow nesting
313 // other tags always start at level 0
314 define("ZERO_LEVEL", 0);
315 define("NESTED_LEVEL", 1);
317 // constants for flags in $pagehash
318 define("FLAG_PAGE_LOCKED", 1);