2 // essential internal stuff -- skip it
3 set_magic_quotes_runtime(0);
4 error_reporting(E_ALL ^ E_NOTICE);
6 if (!function_exists('rcs_id')) {
7 function rcs_id($id) { echo "<!-- $id -->\n"; };
9 rcs_id('$Id: config.php,v 1.18 2000-12-30 21:09:13 ahollosi Exp $');
10 // end essential internal stuff
13 /////////////////////////////////////////////////////////////////////
14 // Constants and settings. Edit the values below for your site.
15 /////////////////////////////////////////////////////////////////////
18 // URL of index.php e.g. http://yoursite.com/phpwiki/index.php
19 // you can leave this empty - it will be calculated automatically
21 // URL of admin.php e.g. http://yoursite.com/phpwiki/admin.php
22 // you can leave this empty - it will be calculated automatically
23 // if you fill in $ScriptUrl you *MUST* fill in $AdminUrl as well!
26 // Select your language - default language "C": English
27 // other languages available: Dutch "nl", Spanish "es", German "de"
30 /////////////////////////////////////////////////////////////////////
32 // set your database here and edit the according section below
33 $WhichDatabase = 'dbm'; // use one of "dbm", "mysql", "pgsql", "msql",
36 // DBM settings (default)
37 if ($WhichDatabase == 'dbm') {
39 $WikiPageStore = "wiki";
40 $ArchivePageStore = "archive";
41 $WikiDB['wiki'] = "$DBMdir/wikipagesdb";
42 $WikiDB['archive'] = "$DBMdir/wikiarchivedb";
43 $WikiDB['wikilinks'] = "$DBMdir/wikilinksdb";
44 $WikiDB['hottopics'] = "$DBMdir/wikihottopicsdb";
45 $WikiDB['hitcount'] = "$DBMdir/wikihitcountdb";
46 // try this many times if the dbm is unavailable
47 define("MAX_DBM_ATTEMPTS", 20);
48 include "lib/dbmlib.php";
50 // MySQL settings -- see INSTALL.mysql for details on using MySQL
51 } elseif ($WhichDatabase == 'mysql') {
52 $WikiPageStore = "wiki";
53 $ArchivePageStore = "archive";
54 $WikiLinksStore = "wikilinks";
55 $WikiScoreStore = "wikiscore";
56 $HitCountStore = "hitcount";
57 $mysql_server = 'localhost';
61 include "lib/mysql.php";
63 // PostgreSQL settings -- see INSTALL.pgsql for more details
64 } elseif ($WhichDatabase == 'pgsql') {
65 $pg_dbhost = "localhost";
67 $WikiDataBase = "wiki"; // name of the database in Postgresql
68 $WikiPageStore = "wiki";
69 $ArchivePageStore = "archive";
70 $WikiLinksPageStore = "wikilinks";
71 $HotTopicsPageStore = "hottopics";
72 $HitCountPageStore = "hitcount";
73 include "lib/pgsql.php";
75 // MiniSQL (mSQL) settings -- see INSTALL.msql for details on using mSQL
76 } elseif ($WhichDatabase == 'msql') {
78 $WikiPageStore = array();
79 $ArchivePageStore = array();
80 $WikiPageStore['table'] = "wiki";
81 $WikiPageStore['page_table'] = "wikipages";
82 $ArchivePageStore['table'] = "archive";
83 $ArchivePageStore['page_table'] = "archivepages";
84 // should be the same as wikipages.line
85 define("MSQL_MAX_LINE_LENGTH", 128);
86 include "lib/msql.php";
88 // Filesystem DB settings
89 } elseif ($WhichDatabase == 'file') {
91 $WikiPageStore = "wiki";
92 $ArchivePageStore = "archive";
93 $WikiDB['wiki'] = "$DBdir/pages";
94 $WikiDB['archive'] = "$DBdir/archive";
95 $WikiDB['wikilinks'] = "$DBdir/links";
96 $WikiDB['hottopics'] = "$DBdir/hottopics";
97 $WikiDB['hitcount'] = "$DBdir/hitcount";
98 include "lib/db_filesystem.php";
100 } else die("Invalid '\$WhichDatabase' in lib/config.php");
103 /////////////////////////////////////////////////////////////////////
106 // logo image (path relative to index.php)
107 $logo = "images/wikibase.png";
108 // signature image which is shown after saving an edited page
109 $SignatureImg = "images/signature.png";
111 // date & time formats used to display modification times, etc.
112 // formats are given as format strings to PHP date() function
113 $datetimeformat = "F j, Y"; // may contain time of day
114 $dateformat = "F j, Y"; // must not contain time
116 // this defines how many page names to list when displaying
117 // the MostPopular pages; the default is to show the 20 most popular pages
118 define("MOST_POPULAR_LIST_LENGTH", 20);
120 // this defines how many page names to list when displaying related pages
121 define("NUM_RELATED_PAGES", 5);
123 // number of user-defined external references, i.e. "[1]"
124 define("NUM_LINKS", 12);
126 // allowed protocols for links - be careful not to allow "javascript:"
127 // within a named link [name|uri] one more protocol is defined: phpwiki
128 $AllowedProtocols = "http|https|mailto|ftp|news|gopher";
130 // URLs ending with the following extension should be inlined as images
131 $InlineImages = "png|jpg|gif";
133 // Perl regexp for WikiNames
134 // (?<!..) & (?!...) used instead of '\b' because \b matches '_' as well
135 $WikiNameRegexp = "(?<![A-Za-z0-9])([A-Z][a-z]+){2,}(?![A-Za-z0-9])";
139 /////////////////////////////////////////////////////////////////////
140 // Original pages and layout
142 // need to define localization function first -- skip this
143 if (!function_exists ('gettext')) {
144 $lcfile = "locale/$LANG/LC_MESSAGES/phpwiki.php";
145 if (file_exists($lcfile)) { include($lcfile); }
146 else { $locale = array(); }
148 function gettext ($text) {
150 if (!empty ($locale[$text]))
151 return $locale[$text];
155 putenv ("LANG=$LANG");
156 bindtextdomain ("phpwiki", "./locale");
157 textdomain ("phpwiki");
159 // end of localization function
161 // Template files (filenames are relative to script position)
163 "BROWSE" => gettext("templates/browse.html"),
164 "EDITPAGE" => gettext("templates/editpage.html"),
165 "EDITLINKS" => gettext("templates/editlinks.html"),
166 "MESSAGE" => gettext("templates/message.html")
169 /* WIKI_PGSRC -- specifies the source for the initial page contents
170 * of the Wiki. The setting of WIKI_PGSRC only has effect when
171 * the wiki is accessed for the first time (or after clearing the
172 * database.) WIKI_PGSRC can either name a directory or a zip file.
173 * In either case WIKI_PGSRC is scanned for files --- one file per page.
175 * If the files appear to be MIME formatted messages, they are
176 * scanned for application/x-phpwiki content-types. Any suitable
177 * content is added to the wiki.
178 * The files can also be plain text files, in which case the page name
179 * is taken from the file name.
182 define('WIKI_PGSRC', gettext("./pgsrc")); // Default (old) behavior.
183 //define('WIKI_PGSRC', './wiki.zip'); // New style.
185 // DEFAULT_WIKI_PGSRC is only used when the language is *not*
186 // the default (English) and when reading from a directory:
187 // in that case some English pages are inserted into the wiki as well
188 // DEFAULT_WIKI_PGSRC defines where the English pages reside
189 define('DEFAULT_WIKI_PGSRC', "./pgsrc");
193 //////////////////////////////////////////////////////////////////////
194 // you shouldn't have to edit anyting below this line
196 if (empty($ScriptUrl)) {
197 $port = ($SERVER_PORT == 80) ? '' : ":$SERVER_PORT";
198 $ScriptUrl = "http://$SERVER_NAME$port$SCRIPT_NAME";
200 if (defined('WIKI_ADMIN') && !empty($AdminUrl))
201 $ScriptUrl = $AdminUrl;
203 $LogoImage = "<img src=\"$logo\" border=0 ALT=\"[PhpWiki!]\">";
204 $LogoImage = "<a href=\"$ScriptUrl\">$LogoImage</a>";
206 $FieldSeparator = "\263";
208 if (isset($PHP_AUTH_USER)) {
209 $remoteuser = $PHP_AUTH_USER;
212 // Apache won't show REMOTE_HOST unless the admin configured it
213 // properly. We'll be nice and see if it's there.
215 getenv('REMOTE_HOST') ? ($remoteuser = getenv('REMOTE_HOST'))
216 : ($remoteuser = getenv('REMOTE_ADDR'));
219 // constants used for HTML output. List tags like UL and
220 // OL have a depth of one, PRE has a depth of 0.
221 define("ZERO_DEPTH", 0);
222 define("SINGLE_DEPTH", 1);
224 // constants for flags in $pagehash
225 define("FLAG_PAGE_LOCKED", 1);