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.20 2001-01-19 22:20:30 wainstead 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"
35 /////////////////////////////////////////////////////////////////////
38 // set your database here and edit the according section below.
39 // For PHP 4.0.4 and later you must use "dba" if you are using
40 // DBM files for storage. "dbm" uses the older deprecated interface.
42 $WhichDatabase = 'dbm'; // use one of "dbm", "dba", "mysql",
43 // "pgsql", "msql", or "file"
45 // DBM (default) and DBA settings
46 if ($WhichDatabase == 'dbm' or 'dba') {
48 $WikiPageStore = "wiki";
49 $ArchivePageStore = "archive";
50 $WikiDB['wiki'] = "$DBMdir/wikipagesdb";
51 $WikiDB['archive'] = "$DBMdir/wikiarchivedb";
52 $WikiDB['wikilinks'] = "$DBMdir/wikilinksdb";
53 $WikiDB['hottopics'] = "$DBMdir/wikihottopicsdb";
54 $WikiDB['hitcount'] = "$DBMdir/wikihitcountdb";
55 // try this many times if the dbm is unavailable
56 define("MAX_DBM_ATTEMPTS", 20);
57 if ($WhichDatabase == 'dbm') {
58 include "lib/dbmlib.php";
60 include "lib/dbalib.php";
63 // MySQL settings -- see INSTALL.mysql for details on using MySQL
64 } elseif ($WhichDatabase == 'mysql') {
65 $WikiPageStore = "wiki";
66 $ArchivePageStore = "archive";
67 $WikiLinksStore = "wikilinks";
68 $WikiScoreStore = "wikiscore";
69 $HitCountStore = "hitcount";
70 $mysql_server = 'localhost';
74 include "lib/mysql.php";
76 // PostgreSQL settings -- see INSTALL.pgsql for more details
77 } elseif ($WhichDatabase == 'pgsql') {
78 $pg_dbhost = "localhost";
80 $WikiDataBase = "wiki"; // name of the database in Postgresql
81 $WikiPageStore = "wiki";
82 $ArchivePageStore = "archive";
83 $WikiLinksPageStore = "wikilinks";
84 $HotTopicsPageStore = "hottopics";
85 $HitCountPageStore = "hitcount";
86 include "lib/pgsql.php";
88 // MiniSQL (mSQL) settings -- see INSTALL.msql for details on using mSQL
89 } elseif ($WhichDatabase == 'msql') {
91 $WikiPageStore = array();
92 $ArchivePageStore = array();
93 $WikiPageStore['table'] = "wiki";
94 $WikiPageStore['page_table'] = "wikipages";
95 $ArchivePageStore['table'] = "archive";
96 $ArchivePageStore['page_table'] = "archivepages";
97 // should be the same as wikipages.line
98 define("MSQL_MAX_LINE_LENGTH", 128);
99 include "lib/msql.php";
101 // Filesystem DB settings
102 } elseif ($WhichDatabase == 'file') {
103 $DBdir = "/tmp/wiki";
104 $WikiPageStore = "wiki";
105 $ArchivePageStore = "archive";
106 $WikiDB['wiki'] = "$DBdir/pages";
107 $WikiDB['archive'] = "$DBdir/archive";
108 $WikiDB['wikilinks'] = "$DBdir/links";
109 $WikiDB['hottopics'] = "$DBdir/hottopics";
110 $WikiDB['hitcount'] = "$DBdir/hitcount";
111 include "lib/db_filesystem.php";
113 } else die("Invalid '\$WhichDatabase' in lib/config.php");
116 /////////////////////////////////////////////////////////////////////
119 /////////////////////////////////////////////////////////////////////
121 // logo image (path relative to index.php)
122 $logo = "images/wikibase.png";
123 // signature image which is shown after saving an edited page
124 $SignatureImg = "images/signature.png";
126 // date & time formats used to display modification times, etc.
127 // formats are given as format strings to PHP date() function
128 $datetimeformat = "F j, Y"; // may contain time of day
129 $dateformat = "F j, Y"; // must not contain time
131 // this defines how many page names to list when displaying
132 // the MostPopular pages; the default is to show the 20 most popular pages
133 define("MOST_POPULAR_LIST_LENGTH", 20);
135 // this defines how many page names to list when displaying related pages
136 define("NUM_RELATED_PAGES", 5);
138 // number of user-defined external references, i.e. "[1]"
139 define("NUM_LINKS", 12);
141 // allowed protocols for links - be careful not to allow "javascript:"
142 // within a named link [name|uri] one more protocol is defined: phpwiki
143 $AllowedProtocols = "http|https|mailto|ftp|news|gopher";
145 // URLs ending with the following extension should be inlined as images
146 $InlineImages = "png|jpg|gif";
148 // Perl regexp for WikiNames
149 // (?<!..) & (?!...) used instead of '\b' because \b matches '_' as well
150 $WikiNameRegexp = "(?<![A-Za-z0-9])([A-Z][a-z]+){2,}(?![A-Za-z0-9])";
154 /////////////////////////////////////////////////////////////////////
156 // Original pages and layout
157 /////////////////////////////////////////////////////////////////////
159 // need to define localization function first -- skip this
160 if (!function_exists ('gettext')) {
161 $lcfile = "locale/$LANG/LC_MESSAGES/phpwiki.php";
162 if (file_exists($lcfile)) { include($lcfile); }
163 else { $locale = array(); }
165 function gettext ($text) {
167 if (!empty ($locale[$text]))
168 return $locale[$text];
172 putenv ("LANG=$LANG");
173 bindtextdomain ("phpwiki", "./locale");
174 textdomain ("phpwiki");
176 // end of localization function
178 // Template files (filenames are relative to script position)
180 "BROWSE" => gettext("templates/browse.html"),
181 "EDITPAGE" => gettext("templates/editpage.html"),
182 "EDITLINKS" => gettext("templates/editlinks.html"),
183 "MESSAGE" => gettext("templates/message.html")
186 /* WIKI_PGSRC -- specifies the source for the initial page contents
187 * of the Wiki. The setting of WIKI_PGSRC only has effect when
188 * the wiki is accessed for the first time (or after clearing the
189 * database.) WIKI_PGSRC can either name a directory or a zip file.
190 * In either case WIKI_PGSRC is scanned for files --- one file per page.
192 * If the files appear to be MIME formatted messages, they are
193 * scanned for application/x-phpwiki content-types. Any suitable
194 * content is added to the wiki.
195 * The files can also be plain text files, in which case the page name
196 * is taken from the file name.
199 define('WIKI_PGSRC', gettext("./pgsrc")); // Default (old) behavior.
200 //define('WIKI_PGSRC', './wiki.zip'); // New style.
202 // DEFAULT_WIKI_PGSRC is only used when the language is *not*
203 // the default (English) and when reading from a directory:
204 // in that case some English pages are inserted into the wiki as well
205 // DEFAULT_WIKI_PGSRC defines where the English pages reside
206 define('DEFAULT_WIKI_PGSRC', "./pgsrc");
210 //////////////////////////////////////////////////////////////////////
211 // you shouldn't have to edit anyting below this line
213 if (empty($ScriptUrl)) {
214 $port = ($SERVER_PORT == 80) ? '' : ":$SERVER_PORT";
215 $ScriptUrl = "http://$SERVER_NAME$port$SCRIPT_NAME";
217 if (defined('WIKI_ADMIN') && !empty($AdminUrl))
218 $ScriptUrl = $AdminUrl;
220 $LogoImage = "<img src=\"$logo\" border=0 ALT=\"[PhpWiki!]\">";
221 $LogoImage = "<a href=\"$ScriptUrl\">$LogoImage</a>";
223 $FieldSeparator = "\263";
225 if (isset($PHP_AUTH_USER)) {
226 $remoteuser = $PHP_AUTH_USER;
229 // Apache won't show REMOTE_HOST unless the admin configured it
230 // properly. We'll be nice and see if it's there.
232 getenv('REMOTE_HOST') ? ($remoteuser = getenv('REMOTE_HOST'))
233 : ($remoteuser = getenv('REMOTE_ADDR'));
236 // constants used for HTML output. HTML tags may allow nesting
237 // other tags always start at level 0
238 define("ZERO_LEVEL", 0);
239 define("NESTED_LEVEL", 1);
241 // constants for flags in $pagehash
242 define("FLAG_PAGE_LOCKED", 1);