]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/config.php
Jeff hacks again: LOT's of changes.
[SourceForge/phpwiki.git] / lib / config.php
1 <?php
2    rcs_id('$Id: config.php,v 1.29 2001-02-10 22:15:08 dairiki Exp $');
3
4    // essential internal stuff -- skip it. Go down to Part One. There
5    // are four parts to this file that interest you, all labeled Part
6    // One, Two, Three and Four.
7
8    set_magic_quotes_runtime(0);
9    error_reporting(E_ALL ^ E_NOTICE);
10
11    /////////////////////////////////////////////////////////////////////
12    // Part One:
13    // Constants and settings. Edit the values below for your site.
14    /////////////////////////////////////////////////////////////////////
15
16
17    // URL of index.php e.g. http://yoursite.com/phpwiki/index.php
18    // you can leave this empty - it will be calculated automatically
19    $ScriptUrl = "";
20
21    // Select your language - default language "C": English
22    // other languages available: Dutch "nl", Spanish "es", German "de",
23    // and Swedish "sv"
24    $LANG="C";
25
26    // Define to 'true' to use PATH_INFO to pass the pagename's.
27    // e.g. http://www.some.where/index.php/FrontPage instead
28    // of http://www.some.where/index.php?pagename=FrontPage
29    define('USE_PATH_INFO', true);
30
31    // Username and password of administrator.
32    // Set these to your preferences. For heaven's sake
33    // pick a good password!
34    define('ADMIN_USER', "");
35    define('ADMIN_PASSWD', "");
36
37    // If true, only the admin user can make zip dumps, else
38    // zip dumps require no authentication.
39    define('ZIPDUMP_AUTH', false);
40
41    // If set, we will perform reverse dns lookups to try to convert the users
42    // IP number to a host name, even if the http server didn't do it for us.
43    define('ENABLE_REVERSE_DNS', true);
44
45    /////////////////////////////////////////////////////////////////////
46    // Part Two:
47    // Database section
48    // set your database here and edit the according section below.
49    // For PHP 4.0.4 and later you must use "dba" if you are using 
50    // DBM files for storage. "dbm" uses the older deprecated interface.
51    // The option 'default' will choose either dbm or dba, depending on
52    // the version of PHP you are running.
53    /////////////////////////////////////////////////////////////////////
54
55    $WhichDatabase = 'default'; // use one of "dbm", "dba", "mysql",
56                            // "pgsql", "msql", or "file"
57
58    // DBM and DBA settings (default)
59    if ($WhichDatabase == 'dbm' or $WhichDatabase == 'dba' or
60        $WhichDatabase == 'default') {
61       $DBMdir = "/tmp";
62       $WikiPageStore = "wiki";
63       $ArchivePageStore = "archive";
64       $WikiDB['wiki']      = "$DBMdir/wikipagesdb";
65       $WikiDB['archive']   = "$DBMdir/wikiarchivedb";
66       $WikiDB['wikilinks'] = "$DBMdir/wikilinksdb";
67       $WikiDB['hottopics'] = "$DBMdir/wikihottopicsdb";
68       $WikiDB['hitcount']  = "$DBMdir/wikihitcountdb";
69       // try this many times if the dbm is unavailable
70       define("MAX_DBM_ATTEMPTS", 20);
71
72       // for PHP3 use dbmlib, else use dbalib for PHP4
73       if ($WhichDatabase == 'default') {
74          if ( floor(phpversion()) == 3) {
75             $WhichDatabase = 'dbm';
76          } else {
77             $WhichDatabase = 'dba';
78          }
79       }
80
81       if ($WhichDatabase == 'dbm') {
82           include "lib/dbmlib.php"; 
83       } else {
84           include "lib/dbalib.php";
85       }
86
87    // MySQL settings -- see INSTALL.mysql for details on using MySQL
88    } elseif ($WhichDatabase == 'mysql') {
89       $WikiPageStore = "wiki";
90       $ArchivePageStore = "archive";
91       $WikiLinksStore = "wikilinks";
92       $WikiScoreStore = "wikiscore";
93       $HitCountStore = "hitcount";
94       $mysql_server = 'localhost';
95       $mysql_user = 'root';
96       $mysql_pwd = '';
97       $mysql_db = 'wiki';
98       include "lib/mysql.php";
99
100    // PostgreSQL settings -- see INSTALL.pgsql for more details
101    } elseif ($WhichDatabase == 'pgsql') {
102       $pg_dbhost    = "localhost";
103       $pg_dbport    = "5432";
104       $WikiDataBase  = "wiki"; // name of the database in Postgresql
105       $WikiPageStore = "wiki";
106       $ArchivePageStore = "archive";
107       $WikiLinksPageStore = "wikilinks";
108       $HotTopicsPageStore = "hottopics";
109       $HitCountPageStore = "hitcount";
110       include "lib/pgsql.php";
111
112    // MiniSQL (mSQL) settings -- see INSTALL.msql for details on using mSQL
113    } elseif ($WhichDatabase == 'msql') {
114       $msql_db = "wiki";
115       $WikiPageStore = array();
116       $ArchivePageStore = array();
117       $WikiPageStore['table']         = "wiki";
118       $WikiPageStore['page_table']    = "wikipages";
119       $ArchivePageStore['table']      = "archive";
120       $ArchivePageStore['page_table'] = "archivepages";
121       // should be the same as wikipages.line
122       define("MSQL_MAX_LINE_LENGTH", 128);
123       include "lib/msql.php";
124
125    // Filesystem DB settings
126    } elseif ($WhichDatabase == 'file') {
127       $DBdir = "/tmp/wiki";
128       $WikiPageStore = "wiki";
129       $ArchivePageStore = "archive";
130       $WikiDB['wiki']      = "$DBdir/pages";
131       $WikiDB['archive']   = "$DBdir/archive";
132       $WikiDB['wikilinks'] = "$DBdir/links";
133       $WikiDB['hottopics'] = "$DBdir/hottopics";
134       $WikiDB['hitcount']  = "$DBdir/hitcount";
135       include "lib/db_filesystem.php";
136
137     } else die("Invalid '\$WhichDatabase' in lib/config.php"); 
138
139
140    /////////////////////////////////////////////////////////////////////
141    // Part Three:
142    // Miscellaneous
143    /////////////////////////////////////////////////////////////////////
144
145    // logo image (path relative to index.php)
146    $logo = "images/wikibase.png";
147
148    // Signature image which is shown after saving an edited page
149    // If this is left blank (or unset), the signature will be omitted.
150    //$SignatureImg = "images/signature.png";
151
152    // date & time formats used to display modification times, etc.
153    // formats are given as format strings to PHP date() function
154    $datetimeformat = "F j, Y";  // may contain time of day
155    $dateformat = "F j, Y";      // must not contain time
156
157    // this defines how many page names to list when displaying
158    // the MostPopular pages; the default is to show the 20 most popular pages
159    define("MOST_POPULAR_LIST_LENGTH", 20);
160
161    // this defines how many page names to list when displaying related pages
162    define("NUM_RELATED_PAGES", 5);
163
164    // allowed protocols for links - be careful not to allow "javascript:"
165    // within a named link [name|uri] one more protocol is defined: phpwiki
166    $AllowedProtocols = "http|https|mailto|ftp|news|gopher";
167
168    // URLs ending with the following extension should be inlined as images
169    $InlineImages = "png|jpg|gif";
170
171    // If the last edit is older than MINOR_EDIT_TIMEOUT seconds, the default
172    // state for the "minor edit" checkbox on the edit page form will be off
173    // (even if the page author hasn't changed.)
174    define("MINOR_EDIT_TIMEOUT", 7 * 24 * 3600);
175
176    // Perl regexp for WikiNames
177    // (?<!..) & (?!...) used instead of '\b' because \b matches '_' as well
178    $WikiNameRegexp = "(?<![A-Za-z0-9])([A-Z][a-z]+){2,}(?![A-Za-z0-9])";
179
180
181    // InterWiki linking -- wiki-style links to other wikis on the web
182    // Set InterWikiLinking to 1 if you would like to enable this feature
183    $InterWikiLinking = 0;
184
185    if ($InterWikiLinking) {
186       // Intermap file for InterWikiLinks -- define other wikis there
187       $interwikimap_file = "lib/interwiki.map";
188
189       include ('lib/interwiki.php');
190       // sets also $InterWikiLinkRegexp
191    }
192
193
194    /////////////////////////////////////////////////////////////////////
195    // Part Four:
196    // Original pages and layout
197    /////////////////////////////////////////////////////////////////////
198
199    // need to define localization function first -- skip this
200    if (!function_exists ('gettext')) {
201       $lcfile = "locale/$LANG/LC_MESSAGES/phpwiki.php";
202       if (file_exists($lcfile)) { include($lcfile); }
203       else { $locale = array(); }
204
205       function gettext ($text) { 
206          global $locale;
207          if (!empty ($locale[$text]))
208            return $locale[$text];
209          return $text;
210       }
211    } else {
212       putenv ("LANG=$LANG");
213       bindtextdomain ("phpwiki", "./locale");
214       textdomain ("phpwiki");
215    }
216    // end of localization function
217
218    // Template files (filenames are relative to script position)
219    $templates = array(
220         "BROWSE" =>    gettext("templates/browse.html"),
221         "EDITPAGE" =>  gettext("templates/editpage.html"),
222         "MESSAGE" =>   gettext("templates/message.html")
223         );
224
225    /* WIKI_PGSRC -- specifies the source for the initial page contents
226     * of the Wiki.  The setting of WIKI_PGSRC only has effect when
227     * the wiki is accessed for the first time (or after clearing the
228     * database.) WIKI_PGSRC can either name a directory or a zip file.
229     * In either case WIKI_PGSRC is scanned for files --- one file per page.
230     *
231     * If the files appear to be MIME formatted messages, they are
232     * scanned for application/x-phpwiki content-types.  Any suitable
233     * content is added to the wiki.
234     * The files can also be plain text files, in which case the page name
235     * is taken from the file name.
236     */
237
238    define('WIKI_PGSRC', gettext("./pgsrc")); // Default (old) behavior.
239    //define('WIKI_PGSRC', './wiki.zip'); // New style.
240
241    // DEFAULT_WIKI_PGSRC is only used when the language is *not*
242    // the default (English) and when reading from a directory:
243    // in that case some English pages are inserted into the wiki as well
244    // DEFAULT_WIKI_PGSRC defines where the English pages reside 
245    define('DEFAULT_WIKI_PGSRC', "./pgsrc");
246
247
248    //////////////////////////////////////////////////////////////////////
249    // you shouldn't have to edit anyting below this line
250
251    if (empty($ScriptUrl)) {
252       $port = ($SERVER_PORT == 80) ? '' : ":$SERVER_PORT";
253       $ScriptUrl = "http://$SERVER_NAME$port$SCRIPT_NAME";
254    }
255    $ScriptName = preg_replace('@^.*/@', '', $ScriptUrl);
256
257    // "\x80"-"\x9f" (and "\x00" - "\x1f") are non-printing control
258    // chars in iso-8859-*
259    // $FieldSeparator = "\263"; //this is a superscript 3 in ISO-8859-1.
260    $FieldSeparator = "\x81";
261
262    // constants used for HTML output. HTML tags may allow nesting
263    // other tags always start at level 0
264    define("ZERO_LEVEL", 0);
265    define("NESTED_LEVEL", 1);
266
267    // constants for flags in $pagehash
268    define("FLAG_PAGE_LOCKED", 1);
269 ?>