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.15 2000-11-08 15:40:00 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"
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 $mysql_server = 'localhost';
57 include "lib/mysql.php";
59 // PostgreSQL settings -- see INSTALL.pgsql for more details
60 } elseif ($WhichDatabase == 'pgsql') {
61 $pg_dbhost = "localhost";
63 $WikiDataBase = "wiki"; // name of the database in Postgresql
64 $WikiPageStore = "wiki";
65 $ArchivePageStore = "archive";
66 $WikiLinksPageStore = "wikilinks";
67 $HotTopicsPageStore = "hottopics";
68 $HitCountPageStore = "hitcount";
69 include "lib/pgsql.php";
71 // MiniSQL (mSQL) settings -- see INSTALL.msql for details on using mSQL
72 } elseif ($WhichDatabase == 'msql') {
74 $WikiPageStore = array();
75 $ArchivePageStore = array();
76 $WikiPageStore['table'] = "wiki";
77 $WikiPageStore['page_table'] = "wikipages";
78 $ArchivePageStore['table'] = "archive";
79 $ArchivePageStore['page_table'] = "archivepages";
80 // should be the same as wikipages.line
81 define("MSQL_MAX_LINE_LENGTH", 128);
82 include "lib/msql.php";
84 // Filesystem DB settings
85 } elseif ($WhichDatabase == 'file') {
87 $WikiPageStore = "wiki";
88 $ArchivePageStore = "archive";
89 $WikiDB['wiki'] = "$DBdir/pages";
90 $WikiDB['archive'] = "$DBdir/archive";
91 $WikiDB['wikilinks'] = "$DBdir/links";
92 $WikiDB['hottopics'] = "$DBdir/hottopics";
93 $WikiDB['hitcount'] = "$DBdir/hitcount";
94 include "lib/db_filesystem.php";
96 } else die("Invalid '\$WhichDatabase' in lib/config.php");
99 /////////////////////////////////////////////////////////////////////
102 // logo image (path relative to index.php)
103 $logo = "images/wikibase.png";
104 // signature image which is shown after saving an edited page
105 $SignatureImg = "images/signature.png";
107 // date & time formats used to display modification times, etc.
108 // formats are given as format strings to PHP date() function
109 $datetimeformat = "F j, Y"; // may contain time of day
110 $dateformat = "F j, Y"; // must not contain time
112 // this defines how many page names to list when displaying
113 // the MostPopular pages; the default is to show the 20 most popular pages
114 define("MOST_POPULAR_LIST_LENGTH", 20);
116 // this defines how many page names to list when displaying related pages
117 define("NUM_RELATED_PAGES", 5);
119 // number of user-defined external references, i.e. "[1]"
120 define("NUM_LINKS", 12);
122 // allowed protocols for links - be careful not to allow "javascript:"
123 // within a named link [name|uri] one more protocol is defined: phpwiki
124 $AllowedProtocols = "http|https|mailto|ftp|news|gopher";
126 // URLs ending with the following extension should be inlined as images
127 $InlineImages = "png|jpg|gif";
129 // Perl regexp for WikiNames
130 // (?<!..) & (?!...) used instead of '\b' because \b matches '_' as well
131 $WikiNameRegexp = "(?<![A-Za-z0-9])([A-Z][a-z]+){2,}(?![A-Za-z0-9])";
135 /////////////////////////////////////////////////////////////////////
136 // Original pages and layout
138 // need to define localization function first -- skip this
139 if (!function_exists ('gettext')) {
140 $lcfile = "locale/$LANG/LC_MESSAGES/phpwiki.php";
141 if (file_exists($lcfile)) { include($lcfile); }
142 else { $locale = array(); }
144 function gettext ($text) {
146 if (!empty ($locale[$text]))
147 return $locale[$text];
151 putenv ("LANG=$LANG");
152 bindtextdomain ("phpwiki", "./locale");
153 textdomain ("phpwiki");
155 // end of localization function
157 // Template files (filenames are relative to script position)
159 "BROWSE" => gettext("templates/browse.html"),
160 "EDITPAGE" => gettext("templates/editpage.html"),
161 "EDITLINKS" => gettext("templates/editlinks.html"),
162 "MESSAGE" => gettext("templates/message.html")
165 /* WIKI_PGSRC -- specifies the source for the initial page contents
166 * of the Wiki. The setting of WIKI_PGSRC only has effect when
167 * the wiki is accessed for the first time (or after clearing the
168 * database.) WIKI_PGSRC can either name a directory or a zip file.
169 * In either case WIKI_PGSRC is scanned for files --- one file per page.
171 * If the files appear to be MIME formatted messages, they are
172 * scanned for application/x-phpwiki content-types. Any suitable
173 * content is added to the wiki.
174 * The files can also be plain text files, in which case the page name
175 * is taken from the file name.
178 define('WIKI_PGSRC', gettext("./pgsrc")); // Default (old) behavior.
179 //define('WIKI_PGSRC', './wiki.zip'); // New style.
181 // DEFAULT_WIKI_PGSRC is only used when the language is *not*
182 // the default (English) and when reading from a directory:
183 // in that case some English pages are inserted into the wiki as well
184 // DEFAULT_WIKI_PGSRC defines where the English pages reside
185 define('DEFAULT_WIKI_PGSRC', "./pgsrc");
189 //////////////////////////////////////////////////////////////////////
190 // you shouldn't have to edit anyting below this line
192 if (empty($ScriptUrl)) {
193 $port = ($SERVER_PORT == 80) ? '' : ":$SERVER_PORT";
194 $ScriptUrl = "http://$SERVER_NAME$port$SCRIPT_NAME";
196 if (defined('WIKI_ADMIN') && !empty($AdminUrl))
197 $ScriptUrl = $AdminUrl;
199 $LogoImage = "<img src=\"$logo\" border=0 ALT=\"[PhpWiki!]\">";
200 $LogoImage = "<a href=\"$ScriptUrl\">$LogoImage</a>";
202 $FieldSeparator = "\263";
204 // Apache won't show REMOTE_HOST unless the admin configured it
205 // properly. We'll be nice and see if it's there.
206 getenv('REMOTE_HOST') ? ($remoteuser = getenv('REMOTE_HOST'))
207 : ($remoteuser = getenv('REMOTE_ADDR'));
209 // constants used for HTML output. List tags like UL and
210 // OL have a depth of one, PRE has a depth of 0.
211 define("ZERO_DEPTH", 0);
212 define("SINGLE_DEPTH", 1);
214 // constants for flags in $pagehash
215 define("FLAG_PAGE_LOCKED", 1);