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