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);
10 if (!function_exists('rcs_id')) {
11 function rcs_id($id) { echo "<!-- $id -->\n"; };
13 rcs_id('$Id: config.php,v 1.24.2.5 2001-11-08 22:39:26 dairiki Exp $');
14 // end essential internal stuff
17 /////////////////////////////////////////////////////////////////////
19 // Constants and settings. Edit the values below for your site.
20 /////////////////////////////////////////////////////////////////////
23 // URL of index.php e.g. http://yoursite.com/phpwiki/index.php
24 // you can leave this empty - it will be calculated automatically
26 // URL of admin.php e.g. http://yoursite.com/phpwiki/admin.php
27 // you can leave this empty - it will be calculated automatically
28 // if you fill in $ScriptUrl you *MUST* fill in $AdminUrl as well!
31 // Select your language - default language "C": English
32 // other languages available: Dutch "nl", Spanish "es", German "de",
36 /////////////////////////////////////////////////////////////////////
39 // set your database here and edit the according section below.
40 // For PHP 4.0.4 and later you must use "dba" if you are using
41 // DBM files for storage. "dbm" uses the older deprecated interface.
42 // The option 'default' will choose either dbm or dba, depending on
43 // the version of PHP you are running.
44 /////////////////////////////////////////////////////////////////////
46 $WhichDatabase = 'default'; // use one of "dbm", "dba", "mysql",
47 // "pgsql", "msql", "mssql", or "file"
49 // DBM and DBA settings (default)
50 if ($WhichDatabase == 'dbm' or $WhichDatabase == 'dba' or
51 $WhichDatabase == 'default') {
53 $WikiPageStore = "wiki";
54 $ArchivePageStore = "archive";
55 $WikiDB['wiki'] = "$DBMdir/wikipagesdb";
56 $WikiDB['archive'] = "$DBMdir/wikiarchivedb";
57 $WikiDB['wikilinks'] = "$DBMdir/wikilinksdb";
58 $WikiDB['hottopics'] = "$DBMdir/wikihottopicsdb";
59 $WikiDB['hitcount'] = "$DBMdir/wikihitcountdb";
61 // this is the type of DBM file on your system. For most Linuxen
62 // 'gdbm' is fine; 'db2' is another common type. 'ndbm' appears
63 // on Solaris but won't work because it won't store pages larger
65 define("DBM_FILE_TYPE", 'gdbm');
67 // try this many times if the dbm is unavailable
68 define("MAX_DBM_ATTEMPTS", 20);
70 // for PHP3 use dbmlib, else use dbalib for PHP4
71 if ($WhichDatabase == 'default') {
72 if ( floor(phpversion()) == 3) {
73 $WhichDatabase = 'dbm';
75 $WhichDatabase = 'dba';
79 if ($WhichDatabase == 'dbm') {
80 include "lib/dbmlib.php";
82 include "lib/dbalib.php";
85 // MySQL settings -- see INSTALL.mysql for details on using MySQL
86 } elseif ($WhichDatabase == 'mysql') {
87 $WikiPageStore = "wiki";
88 $ArchivePageStore = "archive";
89 $WikiLinksStore = "wikilinks";
90 $WikiScoreStore = "wikiscore";
91 $HitCountStore = "hitcount";
92 $mysql_server = 'localhost';
96 include "lib/mysql.php";
98 // PostgreSQL settings -- see INSTALL.pgsql for more details
99 } elseif ($WhichDatabase == 'pgsql') {
100 $pg_dbhost = "localhost";
102 $WikiDataBase = "wiki"; // name of the database in Postgresql
103 $WikiPageStore = "wiki";
104 $ArchivePageStore = "archive";
105 $WikiLinksPageStore = "wikilinks";
106 $HotTopicsPageStore = "hottopics";
107 $HitCountPageStore = "hitcount";
108 include "lib/pgsql.php";
110 // MiniSQL (mSQL) settings -- see INSTALL.msql for details on using mSQL
111 } elseif ($WhichDatabase == 'msql') {
113 $WikiPageStore = array();
114 $ArchivePageStore = array();
115 $WikiPageStore['table'] = "wiki";
116 $WikiPageStore['page_table'] = "wikipages";
117 $ArchivePageStore['table'] = "archive";
118 $ArchivePageStore['page_table'] = "archivepages";
119 // should be the same as wikipages.line
120 define("MSQL_MAX_LINE_LENGTH", 128);
121 include "lib/msql.php";
123 // Filesystem DB settings
124 } elseif ($WhichDatabase == 'file') {
125 $DBdir = "/tmp/wiki";
126 $WikiPageStore = "wiki";
127 $ArchivePageStore = "archive";
128 $WikiDB['wiki'] = "$DBdir/pages";
129 $WikiDB['archive'] = "$DBdir/archive";
130 $WikiDB['wikilinks'] = "$DBdir/links";
131 $WikiDB['hottopics'] = "$DBdir/hottopics";
132 $WikiDB['hitcount'] = "$DBdir/hitcount";
133 include "lib/db_filesystem.php";
135 // MS SQLServer settings
136 } elseif ($WhichDatabase == 'mssql') {
137 $WikiPageStore = "wiki";
138 $ArchivePageStore = "archive";
139 $WikiLinksStore = "wikilinks";
140 $WikiScoreStore = "wikiscore";
141 $HitCountStore = "hitcount";
142 $mssql_server = 'servername';
146 include "lib/mssql.php";
148 } else die("Invalid '\$WhichDatabase' in lib/config.php");
151 /////////////////////////////////////////////////////////////////////
154 /////////////////////////////////////////////////////////////////////
156 // logo image (path relative to index.php)
157 $logo = "images/wikibase.png";
159 // Signature image which is shown after saving an edited page
160 // If this is left blank (or unset), the signature will be omitted.
161 $SignatureImg = "images/signature.png";
163 // date & time formats used to display modification times, etc.
164 // formats are given as format strings to PHP date() function
165 $datetimeformat = "F j, Y"; // may contain time of day
166 $dateformat = "F j, Y"; // must not contain time
168 // this defines how many page names to list when displaying
169 // the MostPopular pages; the default is to show the 20 most popular pages
170 define("MOST_POPULAR_LIST_LENGTH", 20);
172 // this defines how many page names to list when displaying related pages
173 define("NUM_RELATED_PAGES", 5);
175 // number of user-defined external references, i.e. "[1]"
176 define("NUM_LINKS", 12);
178 // allowed protocols for links - be careful not to allow "javascript:"
179 // within a named link [name|uri] one more protocol is defined: phpwiki
180 $AllowedProtocols = "http|https|mailto|ftp|news|gopher";
182 // URLs ending with the following extension should be inlined as images
183 $InlineImages = "png|jpg|gif";
185 // Perl regexp for WikiNames
186 // (?<!..) & (?!...) used instead of '\b' because \b matches '_' as well
187 $WikiNameRegexp = "(?<![A-Za-z0-9])([A-Z][a-z]+){2,}(?![A-Za-z0-9])";
191 /////////////////////////////////////////////////////////////////////
193 // Original pages and layout
194 /////////////////////////////////////////////////////////////////////
196 // need to define localization function first -- skip this
197 if (!function_exists ('gettext')) {
198 $lcfile = "locale/$LANG/LC_MESSAGES/phpwiki.php";
199 if (file_exists($lcfile)) { include($lcfile); }
200 else { $locale = array(); }
202 function gettext ($text) {
204 if (!empty ($locale[$text]))
205 return $locale[$text];
209 putenv ("LANG=$LANG");
210 bindtextdomain ("phpwiki", "./locale");
211 textdomain ("phpwiki");
212 setlocale("LC_ALL", "");
214 // end of localization function
216 // Template files (filenames are relative to script position)
218 "BROWSE" => gettext("templates/browse.html"),
219 "EDITPAGE" => gettext("templates/editpage.html"),
220 "EDITLINKS" => gettext("templates/editlinks.html"),
221 "MESSAGE" => gettext("templates/message.html")
224 /* WIKI_PGSRC -- specifies the source for the initial page contents
225 * of the Wiki. The setting of WIKI_PGSRC only has effect when
226 * the wiki is accessed for the first time (or after clearing the
227 * database.) WIKI_PGSRC can either name a directory or a zip file.
228 * In either case WIKI_PGSRC is scanned for files --- one file per page.
230 * If the files appear to be MIME formatted messages, they are
231 * scanned for application/x-phpwiki content-types. Any suitable
232 * content is added to the wiki.
233 * The files can also be plain text files, in which case the page name
234 * is taken from the file name.
237 define('WIKI_PGSRC', gettext("./pgsrc")); // Default (old) behavior.
238 //define('WIKI_PGSRC', './wiki.zip'); // New style.
240 // DEFAULT_WIKI_PGSRC is only used when the language is *not*
241 // the default (English) and when reading from a directory:
242 // in that case some English pages are inserted into the wiki as well
243 // DEFAULT_WIKI_PGSRC defines where the English pages reside
244 define('DEFAULT_WIKI_PGSRC', "./pgsrc");
248 //////////////////////////////////////////////////////////////////////
249 // you shouldn't have to edit anyting below this line
250 function compute_default_scripturl() {
251 global $SERVER_PORT, $SERVER_NAME, $SCRIPT_NAME, $HTTPS;
252 if (!empty($HTTPS) && $HTTPS != 'off') {
260 $port = ($SERVER_PORT == $dflt_port) ? '' : ":$SERVER_PORT";
261 return $proto . '://' . $SERVER_NAME . $port . $SCRIPT_NAME;
264 if (empty($ScriptUrl)) {
265 $ScriptUrl = compute_default_scripturl();
267 if (defined('WIKI_ADMIN') && !empty($AdminUrl))
268 $ScriptUrl = $AdminUrl;
270 $FieldSeparator = "\263";
272 if (isset($PHP_AUTH_USER)) {
273 $remoteuser = $PHP_AUTH_USER;
276 // Apache won't show REMOTE_HOST unless the admin configured it
277 // properly. We'll be nice and see if it's there.
279 getenv('REMOTE_HOST') ? ($remoteuser = getenv('REMOTE_HOST'))
280 : ($remoteuser = getenv('REMOTE_ADDR'));
283 // constants used for HTML output. HTML tags may allow nesting
284 // other tags always start at level 0
285 define("ZERO_LEVEL", 0);
286 define("NESTED_LEVEL", 1);
288 // constants for flags in $pagehash
289 define("FLAG_PAGE_LOCKED", 1);