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.22 2001-01-21 11:00:00 ahollosi 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.
41 // The option 'default' will choose either dbm or dba, depending on
42 // the version of PHP you are running.
43 /////////////////////////////////////////////////////////////////////
45 $WhichDatabase = 'default'; // use one of "dbm", "dba", "mysql",
46 // "pgsql", "msql", 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";
60 // try this many times if the dbm is unavailable
61 define("MAX_DBM_ATTEMPTS", 20);
63 // for PHP3 use dbmlib, else use dbalib for PHP4
64 if (($WhichDatabase == 'default') and (floor(phpversion())) == 3) {
65 $WhichDatabase = 'dbm';
67 $WhichDatabase = 'dba';
70 if ($WhichDatabase == 'dbm') {
71 include "lib/dbmlib.php";
73 include "lib/dbalib.php";
76 // MySQL settings -- see INSTALL.mysql for details on using MySQL
77 } elseif ($WhichDatabase == 'mysql') {
78 $WikiPageStore = "wiki";
79 $ArchivePageStore = "archive";
80 $WikiLinksStore = "wikilinks";
81 $WikiScoreStore = "wikiscore";
82 $HitCountStore = "hitcount";
83 $mysql_server = 'localhost';
87 include "lib/mysql.php";
89 // PostgreSQL settings -- see INSTALL.pgsql for more details
90 } elseif ($WhichDatabase == 'pgsql') {
91 $pg_dbhost = "localhost";
93 $WikiDataBase = "wiki"; // name of the database in Postgresql
94 $WikiPageStore = "wiki";
95 $ArchivePageStore = "archive";
96 $WikiLinksPageStore = "wikilinks";
97 $HotTopicsPageStore = "hottopics";
98 $HitCountPageStore = "hitcount";
99 include "lib/pgsql.php";
101 // MiniSQL (mSQL) settings -- see INSTALL.msql for details on using mSQL
102 } elseif ($WhichDatabase == 'msql') {
104 $WikiPageStore = array();
105 $ArchivePageStore = array();
106 $WikiPageStore['table'] = "wiki";
107 $WikiPageStore['page_table'] = "wikipages";
108 $ArchivePageStore['table'] = "archive";
109 $ArchivePageStore['page_table'] = "archivepages";
110 // should be the same as wikipages.line
111 define("MSQL_MAX_LINE_LENGTH", 128);
112 include "lib/msql.php";
114 // Filesystem DB settings
115 } elseif ($WhichDatabase == 'file') {
116 $DBdir = "/tmp/wiki";
117 $WikiPageStore = "wiki";
118 $ArchivePageStore = "archive";
119 $WikiDB['wiki'] = "$DBdir/pages";
120 $WikiDB['archive'] = "$DBdir/archive";
121 $WikiDB['wikilinks'] = "$DBdir/links";
122 $WikiDB['hottopics'] = "$DBdir/hottopics";
123 $WikiDB['hitcount'] = "$DBdir/hitcount";
124 include "lib/db_filesystem.php";
126 } else die("Invalid '\$WhichDatabase' in lib/config.php");
129 /////////////////////////////////////////////////////////////////////
132 /////////////////////////////////////////////////////////////////////
134 // logo image (path relative to index.php)
135 $logo = "images/wikibase.png";
136 // signature image which is shown after saving an edited page
137 $SignatureImg = "images/signature.png";
139 // date & time formats used to display modification times, etc.
140 // formats are given as format strings to PHP date() function
141 $datetimeformat = "F j, Y"; // may contain time of day
142 $dateformat = "F j, Y"; // must not contain time
144 // this defines how many page names to list when displaying
145 // the MostPopular pages; the default is to show the 20 most popular pages
146 define("MOST_POPULAR_LIST_LENGTH", 20);
148 // this defines how many page names to list when displaying related pages
149 define("NUM_RELATED_PAGES", 5);
151 // number of user-defined external references, i.e. "[1]"
152 define("NUM_LINKS", 12);
154 // allowed protocols for links - be careful not to allow "javascript:"
155 // within a named link [name|uri] one more protocol is defined: phpwiki
156 $AllowedProtocols = "http|https|mailto|ftp|news|gopher";
158 // URLs ending with the following extension should be inlined as images
159 $InlineImages = "png|jpg|gif";
161 // Perl regexp for WikiNames
162 // (?<!..) & (?!...) used instead of '\b' because \b matches '_' as well
163 $WikiNameRegexp = "(?<![A-Za-z0-9])([A-Z][a-z]+){2,}(?![A-Za-z0-9])";
167 /////////////////////////////////////////////////////////////////////
169 // Original pages and layout
170 /////////////////////////////////////////////////////////////////////
172 // need to define localization function first -- skip this
173 if (!function_exists ('gettext')) {
174 $lcfile = "locale/$LANG/LC_MESSAGES/phpwiki.php";
175 if (file_exists($lcfile)) { include($lcfile); }
176 else { $locale = array(); }
178 function gettext ($text) {
180 if (!empty ($locale[$text]))
181 return $locale[$text];
185 putenv ("LANG=$LANG");
186 bindtextdomain ("phpwiki", "./locale");
187 textdomain ("phpwiki");
189 // end of localization function
191 // Template files (filenames are relative to script position)
193 "BROWSE" => gettext("templates/browse.html"),
194 "EDITPAGE" => gettext("templates/editpage.html"),
195 "EDITLINKS" => gettext("templates/editlinks.html"),
196 "MESSAGE" => gettext("templates/message.html")
199 /* WIKI_PGSRC -- specifies the source for the initial page contents
200 * of the Wiki. The setting of WIKI_PGSRC only has effect when
201 * the wiki is accessed for the first time (or after clearing the
202 * database.) WIKI_PGSRC can either name a directory or a zip file.
203 * In either case WIKI_PGSRC is scanned for files --- one file per page.
205 * If the files appear to be MIME formatted messages, they are
206 * scanned for application/x-phpwiki content-types. Any suitable
207 * content is added to the wiki.
208 * The files can also be plain text files, in which case the page name
209 * is taken from the file name.
212 define('WIKI_PGSRC', gettext("./pgsrc")); // Default (old) behavior.
213 //define('WIKI_PGSRC', './wiki.zip'); // New style.
215 // DEFAULT_WIKI_PGSRC is only used when the language is *not*
216 // the default (English) and when reading from a directory:
217 // in that case some English pages are inserted into the wiki as well
218 // DEFAULT_WIKI_PGSRC defines where the English pages reside
219 define('DEFAULT_WIKI_PGSRC', "./pgsrc");
223 //////////////////////////////////////////////////////////////////////
224 // you shouldn't have to edit anyting below this line
226 if (empty($ScriptUrl)) {
227 $port = ($SERVER_PORT == 80) ? '' : ":$SERVER_PORT";
228 $ScriptUrl = "http://$SERVER_NAME$port$SCRIPT_NAME";
230 if (defined('WIKI_ADMIN') && !empty($AdminUrl))
231 $ScriptUrl = $AdminUrl;
233 $LogoImage = "<img src=\"$logo\" border=0 ALT=\"[PhpWiki!]\">";
234 $LogoImage = "<a href=\"$ScriptUrl\">$LogoImage</a>";
236 $FieldSeparator = "\263";
238 if (isset($PHP_AUTH_USER)) {
239 $remoteuser = $PHP_AUTH_USER;
242 // Apache won't show REMOTE_HOST unless the admin configured it
243 // properly. We'll be nice and see if it's there.
245 getenv('REMOTE_HOST') ? ($remoteuser = getenv('REMOTE_HOST'))
246 : ($remoteuser = getenv('REMOTE_ADDR'));
249 // constants used for HTML output. HTML tags may allow nesting
250 // other tags always start at level 0
251 define("ZERO_LEVEL", 0);
252 define("NESTED_LEVEL", 1);
254 // constants for flags in $pagehash
255 define("FLAG_PAGE_LOCKED", 1);