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.17 2000-11-17 03:01:26 wainstead 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"
29 /////////////////////////////////////////////////////////////////////
31 // set your database here and edit the according section below
32 $WhichDatabase = 'dbm'; // use one of "dbm", "mysql", "pgsql", "msql",
35 // DBM settings (default)
36 if ($WhichDatabase == 'dbm') {
38 $WikiPageStore = "wiki";
39 $ArchivePageStore = "archive";
40 $WikiDB['wiki'] = "$DBMdir/wikipagesdb";
41 $WikiDB['archive'] = "$DBMdir/wikiarchivedb";
42 $WikiDB['wikilinks'] = "$DBMdir/wikilinksdb";
43 $WikiDB['hottopics'] = "$DBMdir/wikihottopicsdb";
44 $WikiDB['hitcount'] = "$DBMdir/wikihitcountdb";
45 // try this many times if the dbm is unavailable
46 define("MAX_DBM_ATTEMPTS", 20);
47 include "lib/dbmlib.php";
49 // MySQL settings -- see INSTALL.mysql for details on using MySQL
50 } elseif ($WhichDatabase == 'mysql') {
51 $WikiPageStore = "wiki";
52 $ArchivePageStore = "archive";
53 $WikiLinksStore = "wikilinks";
54 $WikiScoreStore = "wikiscore";
55 $HitCountStore = "hitcount";
56 $mysql_server = 'localhost';
60 include "lib/mysql.php";
62 // PostgreSQL settings -- see INSTALL.pgsql for more details
63 } elseif ($WhichDatabase == 'pgsql') {
64 $pg_dbhost = "localhost";
66 $WikiDataBase = "wiki"; // name of the database in Postgresql
67 $WikiPageStore = "wiki";
68 $ArchivePageStore = "archive";
69 $WikiLinksPageStore = "wikilinks";
70 $HotTopicsPageStore = "hottopics";
71 $HitCountPageStore = "hitcount";
72 include "lib/pgsql.php";
74 // MiniSQL (mSQL) settings -- see INSTALL.msql for details on using mSQL
75 } elseif ($WhichDatabase == 'msql') {
77 $WikiPageStore = array();
78 $ArchivePageStore = array();
79 $WikiPageStore['table'] = "wiki";
80 $WikiPageStore['page_table'] = "wikipages";
81 $ArchivePageStore['table'] = "archive";
82 $ArchivePageStore['page_table'] = "archivepages";
83 // should be the same as wikipages.line
84 define("MSQL_MAX_LINE_LENGTH", 128);
85 include "lib/msql.php";
87 // Filesystem DB settings
88 } elseif ($WhichDatabase == 'file') {
90 $WikiPageStore = "wiki";
91 $ArchivePageStore = "archive";
92 $WikiDB['wiki'] = "$DBdir/pages";
93 $WikiDB['archive'] = "$DBdir/archive";
94 $WikiDB['wikilinks'] = "$DBdir/links";
95 $WikiDB['hottopics'] = "$DBdir/hottopics";
96 $WikiDB['hitcount'] = "$DBdir/hitcount";
97 include "lib/db_filesystem.php";
99 } else die("Invalid '\$WhichDatabase' in lib/config.php");
102 /////////////////////////////////////////////////////////////////////
105 // logo image (path relative to index.php)
106 $logo = "images/wikibase.png";
107 // signature image which is shown after saving an edited page
108 $SignatureImg = "images/signature.png";
110 // date & time formats used to display modification times, etc.
111 // formats are given as format strings to PHP date() function
112 $datetimeformat = "F j, Y"; // may contain time of day
113 $dateformat = "F j, Y"; // must not contain time
115 // this defines how many page names to list when displaying
116 // the MostPopular pages; the default is to show the 20 most popular pages
117 define("MOST_POPULAR_LIST_LENGTH", 20);
119 // this defines how many page names to list when displaying related pages
120 define("NUM_RELATED_PAGES", 5);
122 // number of user-defined external references, i.e. "[1]"
123 define("NUM_LINKS", 12);
125 // allowed protocols for links - be careful not to allow "javascript:"
126 // within a named link [name|uri] one more protocol is defined: phpwiki
127 $AllowedProtocols = "http|https|mailto|ftp|news|gopher";
129 // URLs ending with the following extension should be inlined as images
130 $InlineImages = "png|jpg|gif";
132 // Perl regexp for WikiNames
133 // (?<!..) & (?!...) used instead of '\b' because \b matches '_' as well
134 $WikiNameRegexp = "(?<![A-Za-z0-9])([A-Z][a-z]+){2,}(?![A-Za-z0-9])";
138 /////////////////////////////////////////////////////////////////////
139 // Original pages and layout
141 // need to define localization function first -- skip this
142 if (!function_exists ('gettext')) {
143 $lcfile = "locale/$LANG/LC_MESSAGES/phpwiki.php";
144 if (file_exists($lcfile)) { include($lcfile); }
145 else { $locale = array(); }
147 function gettext ($text) {
149 if (!empty ($locale[$text]))
150 return $locale[$text];
154 putenv ("LANG=$LANG");
155 bindtextdomain ("phpwiki", "./locale");
156 textdomain ("phpwiki");
158 // end of localization function
160 // Template files (filenames are relative to script position)
162 "BROWSE" => gettext("templates/browse.html"),
163 "EDITPAGE" => gettext("templates/editpage.html"),
164 "EDITLINKS" => gettext("templates/editlinks.html"),
165 "MESSAGE" => gettext("templates/message.html")
168 /* WIKI_PGSRC -- specifies the source for the initial page contents
169 * of the Wiki. The setting of WIKI_PGSRC only has effect when
170 * the wiki is accessed for the first time (or after clearing the
171 * database.) WIKI_PGSRC can either name a directory or a zip file.
172 * In either case WIKI_PGSRC is scanned for files --- one file per page.
174 * If the files appear to be MIME formatted messages, they are
175 * scanned for application/x-phpwiki content-types. Any suitable
176 * content is added to the wiki.
177 * The files can also be plain text files, in which case the page name
178 * is taken from the file name.
181 define('WIKI_PGSRC', gettext("./pgsrc")); // Default (old) behavior.
182 //define('WIKI_PGSRC', './wiki.zip'); // New style.
184 // DEFAULT_WIKI_PGSRC is only used when the language is *not*
185 // the default (English) and when reading from a directory:
186 // in that case some English pages are inserted into the wiki as well
187 // DEFAULT_WIKI_PGSRC defines where the English pages reside
188 define('DEFAULT_WIKI_PGSRC', "./pgsrc");
192 //////////////////////////////////////////////////////////////////////
193 // you shouldn't have to edit anyting below this line
195 if (empty($ScriptUrl)) {
196 $port = ($SERVER_PORT == 80) ? '' : ":$SERVER_PORT";
197 $ScriptUrl = "http://$SERVER_NAME$port$SCRIPT_NAME";
199 if (defined('WIKI_ADMIN') && !empty($AdminUrl))
200 $ScriptUrl = $AdminUrl;
202 $LogoImage = "<img src=\"$logo\" border=0 ALT=\"[PhpWiki!]\">";
203 $LogoImage = "<a href=\"$ScriptUrl\">$LogoImage</a>";
205 $FieldSeparator = "\263";
207 if (isset($PHP_AUTH_USER)) {
208 $remoteuser = $PHP_AUTH_USER;
211 // Apache won't show REMOTE_HOST unless the admin configured it
212 // properly. We'll be nice and see if it's there.
214 getenv('REMOTE_HOST') ? ($remoteuser = getenv('REMOTE_HOST'))
215 : ($remoteuser = getenv('REMOTE_ADDR'));
219 // Apache won't show REMOTE_HOST unless the admin configured it
220 // properly. We'll be nice and see if it's there.
221 getenv('REMOTE_HOST') ? ($remoteuser = getenv('REMOTE_HOST'))
222 : ($remoteuser = getenv('REMOTE_ADDR'));
224 // constants used for HTML output. List tags like UL and
225 // OL have a depth of one, PRE has a depth of 0.
226 define("ZERO_DEPTH", 0);
227 define("SINGLE_DEPTH", 1);
229 // constants for flags in $pagehash
230 define("FLAG_PAGE_LOCKED", 1);