]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/config.php
//define("USE_LINK_ICONS", 1); this turns on url indicator icons, inserted before...
[SourceForge/phpwiki.git] / lib / config.php
1 <?php
2
3    // essential internal stuff -- skip it. Go down to Part One. There
4    // are four parts to this file that interest you, all labeled Part
5    // One, Two, Three and Four.
6
7    set_magic_quotes_runtime(0);
8    error_reporting(E_ALL ^ E_NOTICE);
9
10    if (!function_exists('rcs_id')) {
11       function rcs_id($id) { echo "<!-- $id -->\n"; };
12    }
13    rcs_id('$Id: config.php,v 1.24.2.9 2001-12-02 07:39:03 carstenklapp Exp $'); 
14    // end essential internal stuff
15
16
17    /////////////////////////////////////////////////////////////////////
18    // Part One:
19    // Constants and settings. Edit the values below for your site.
20    /////////////////////////////////////////////////////////////////////
21
22
23    // URL of index.php e.g. http://yoursite.com/phpwiki/index.php
24    // you can leave this empty - it will be calculated automatically
25    $ScriptUrl = "";
26    // URL of admin.php e.g. http://yoursite.com/phpwiki/admin.php
27    // you can leave this empty - it will be calculated automatically
28    // if you fill in $ScriptUrl you *MUST* fill in $AdminUrl as well!
29    $AdminUrl = "";
30
31    // Select your language - default language "C": English
32    // other languages available: Dutch "nl", Spanish "es", German "de",
33    // and Swedish "sv"
34    $LANG="C";
35
36    /////////////////////////////////////////////////////////////////////
37    // Part Two:
38    // Database section
39    // set your database here and edit the according section below.
40    // For PHP 4.0.4 and later you must use "dba" if you are using 
41    // DBM files for storage. "dbm" uses the older deprecated interface.
42    // The option 'default' will choose either dbm or dba, depending on
43    // the version of PHP you are running.
44    /////////////////////////////////////////////////////////////////////
45
46    $WhichDatabase = 'default'; // use one of "dbm", "dba", "mysql",
47                            // "pgsql", "msql", "mssql", or "file"
48
49    // DBM and DBA settings (default)
50    if ($WhichDatabase == 'dbm' or $WhichDatabase == 'dba' or
51        $WhichDatabase == 'default') {
52       $DBMdir = "/tmp";
53       $WikiPageStore = "wiki";
54       $ArchivePageStore = "archive";
55       $WikiDB['wiki']      = "$DBMdir/wikipagesdb";
56       $WikiDB['archive']   = "$DBMdir/wikiarchivedb";
57       $WikiDB['wikilinks'] = "$DBMdir/wikilinksdb";
58       $WikiDB['hottopics'] = "$DBMdir/wikihottopicsdb";
59       $WikiDB['hitcount']  = "$DBMdir/wikihitcountdb";
60
61       // this is the type of DBM file on your system. For most Linuxen
62       // 'gdbm' is fine; 'db2' is another common type. 'ndbm' appears
63       // on Solaris but won't work because it won't store pages larger
64       // than 1000 bytes.
65       define("DBM_FILE_TYPE", 'gdbm');
66
67       // try this many times if the dbm is unavailable
68       define("MAX_DBM_ATTEMPTS", 20);
69
70       // for PHP3 use dbmlib, else use dbalib for PHP4
71       if ($WhichDatabase == 'default') {
72          if ( floor(phpversion()) == 3) {
73             $WhichDatabase = 'dbm';
74          } else {
75             $WhichDatabase = 'dba';
76          }
77       }
78
79       if ($WhichDatabase == 'dbm') {
80           include "lib/dbmlib.php"; 
81       } else {
82           include "lib/dbalib.php";
83       }
84
85    // MySQL settings -- see INSTALL.mysql for details on using MySQL
86    } elseif ($WhichDatabase == 'mysql') {
87       // MySQL server host:
88       $mysql_server = 'localhost';
89
90       // username as used in step 2 of INSTALL.mysql:
91       $mysql_user = 'wikiuser';
92
93       // password of above user (or leave blank if none):
94       $mysql_pwd = '';
95
96       // name of the mysql database
97       //  (this used to default to 'wiki' prior to phpwiki-1.2.2)
98       $mysql_db = 'phpwiki';
99
100       // Names of the tables.
101       // You probably don't need to change these.  If you do change
102       // them you will also have to make corresponding changes in
103       // schemas/schema.mysql before you initialize the database.
104       $WikiPageStore = "wiki";
105       $ArchivePageStore = "archive";
106       $WikiLinksStore = "wikilinks";
107       $WikiScoreStore = "wikiscore";
108       $HitCountStore = "hitcount";
109
110       include "lib/mysql.php";
111
112    // PostgreSQL settings -- see INSTALL.pgsql for more details
113    } elseif ($WhichDatabase == 'pgsql') {
114       $pg_dbhost    = "localhost";
115       $pg_dbport    = "5432";
116       $WikiDataBase  = "wiki"; // name of the database in Postgresql
117       $WikiPageStore = "wiki";
118       $ArchivePageStore = "archive";
119       $WikiLinksPageStore = "wikilinks";
120       $HotTopicsPageStore = "hottopics";
121       $HitCountPageStore = "hitcount";
122       include "lib/pgsql.php";
123
124    // MiniSQL (mSQL) settings -- see INSTALL.msql for details on using mSQL
125    } elseif ($WhichDatabase == 'msql') {
126       $msql_db = "wiki";
127       $WikiPageStore = array();
128       $ArchivePageStore = array();
129       $WikiPageStore['table']         = "wiki";
130       $WikiPageStore['page_table']    = "wikipages";
131       $ArchivePageStore['table']      = "archive";
132       $ArchivePageStore['page_table'] = "archivepages";
133       // should be the same as wikipages.line
134       define("MSQL_MAX_LINE_LENGTH", 128);
135       include "lib/msql.php";
136
137    // Filesystem DB settings
138    } elseif ($WhichDatabase == 'file') {
139       $DBdir = "/tmp/wiki";
140       $WikiPageStore = "wiki";
141       $ArchivePageStore = "archive";
142       $WikiDB['wiki']      = "$DBdir/pages";
143       $WikiDB['archive']   = "$DBdir/archive";
144       $WikiDB['wikilinks'] = "$DBdir/links";
145       $WikiDB['hottopics'] = "$DBdir/hottopics";
146       $WikiDB['hitcount']  = "$DBdir/hitcount";
147       include "lib/db_filesystem.php";
148
149    // MS SQLServer settings
150    } elseif ($WhichDatabase == 'mssql') {
151       $WikiPageStore = "wiki";
152       $ArchivePageStore = "archive";
153       $WikiLinksStore = "wikilinks";
154       $WikiScoreStore = "wikiscore";
155       $HitCountStore = "hitcount";
156       $mssql_server = 'servername';
157       $mssql_user = '';
158       $mssql_pwd = '';
159       $mssql_db = '';
160       include "lib/mssql.php";
161
162    } else die("Invalid '\$WhichDatabase' in lib/config.php"); 
163
164
165    /////////////////////////////////////////////////////////////////////
166    // Part Three:
167    // Miscellaneous
168    /////////////////////////////////////////////////////////////////////
169
170    // logo image (path relative to index.php)
171    $logo = "images/wikibase.png";
172
173    // Signature image which is shown after saving an edited page
174    // If this is left blank (or unset), the signature will be omitted.
175    $SignatureImg = "images/signature.png";
176
177    // this turns on url indicator icons, inserted before embedded links
178    //define("USE_LINK_ICONS", 1);
179
180    // date & time formats used to display modification times, etc.
181    // formats are given as format strings to PHP date() function
182    $datetimeformat = "F j, Y";  // may contain time of day
183    $dateformat = "F j, Y";      // must not contain time
184
185    // this defines how many page names to list when displaying
186    // the MostPopular pages; the default is to show the 20 most popular pages
187    define("MOST_POPULAR_LIST_LENGTH", 20);
188
189    // this defines how many page names to list when displaying related pages
190    define("NUM_RELATED_PAGES", 5);
191
192    // number of user-defined external references, i.e. "[1]"
193    define("NUM_LINKS", 12);
194
195    // allowed protocols for links - be careful not to allow "javascript:"
196    // within a named link [name|uri] one more protocol is defined: phpwiki
197    $AllowedProtocols = "http|https|mailto|ftp|news|gopher";
198
199    // URLs ending with the following extension should be inlined as images
200    $InlineImages = "png|jpg|gif";
201
202    // Uncomment this to automatically split WikiWords by inserting spaces.
203    // The default is to leave WordsSmashedTogetherLikeSo in the body text.
204    //define("autosplit_wikiwords", 1);
205
206    // Perl regexp for WikiNames
207    // (?<!..) & (?!...) used instead of '\b' because \b matches '_' as well
208    $WikiNameRegexp = "(?<![A-Za-z0-9])([A-Z][a-z]+){2,}(?![A-Za-z0-9])";
209
210
211
212    /////////////////////////////////////////////////////////////////////
213    // Part Four:
214    // Original pages and layout
215    /////////////////////////////////////////////////////////////////////
216
217    // need to define localization function first -- skip this
218    if (!function_exists ('gettext')) {
219       $lcfile = "locale/$LANG/LC_MESSAGES/phpwiki.php";
220       if (file_exists($lcfile)) { include($lcfile); }
221       else { $locale = array(); }
222
223       function gettext ($text) { 
224          global $locale;
225          if (!empty ($locale[$text]))
226            return $locale[$text];
227          return $text;
228       }
229    } else {
230       // This putenv() fails when safe_mode is on.
231       // I think it is unnecessary. 
232       //putenv ("LANG=$LANG");
233       bindtextdomain ("phpwiki", "./locale");
234       textdomain ("phpwiki");
235       if (!defined("LC_ALL")) {
236          // Backwards compatibility (for PHP < 4.0.5)
237          define("LC_ALL", "LC_ALL");
238       }   
239       setlocale(LC_ALL, "$LANG");
240    }
241    // end of localization function
242
243    // Template files (filenames are relative to script position)
244    $templates = array(
245         "BROWSE" =>    gettext("templates/browse.html"),
246         "EDITPAGE" =>  gettext("templates/editpage.html"),
247         "EDITLINKS" => gettext("templates/editlinks.html"),
248         "MESSAGE" =>   gettext("templates/message.html")
249         );
250
251    /* WIKI_PGSRC -- specifies the source for the initial page contents
252     * of the Wiki.  The setting of WIKI_PGSRC only has effect when
253     * the wiki is accessed for the first time (or after clearing the
254     * database.) WIKI_PGSRC can either name a directory or a zip file.
255     * In either case WIKI_PGSRC is scanned for files --- one file per page.
256     *
257     * If the files appear to be MIME formatted messages, they are
258     * scanned for application/x-phpwiki content-types.  Any suitable
259     * content is added to the wiki.
260     * The files can also be plain text files, in which case the page name
261     * is taken from the file name.
262     */
263
264    define('WIKI_PGSRC', gettext("./pgsrc")); // Default (old) behavior.
265    //define('WIKI_PGSRC', './wiki.zip'); // New style.
266
267    // DEFAULT_WIKI_PGSRC is only used when the language is *not*
268    // the default (English) and when reading from a directory:
269    // in that case some English pages are inserted into the wiki as well
270    // DEFAULT_WIKI_PGSRC defines where the English pages reside 
271    define('DEFAULT_WIKI_PGSRC', "./pgsrc");
272
273
274
275    //////////////////////////////////////////////////////////////////////
276    // you shouldn't have to edit anyting below this line
277    function compute_default_scripturl() {
278       global $SERVER_PORT, $SERVER_NAME, $SCRIPT_NAME, $HTTPS;
279       if (!empty($HTTPS) && $HTTPS != 'off') {
280          $proto = 'https';
281          $dflt_port = 443;
282       }
283       else {
284          $proto = 'http';
285          $dflt_port = 80;
286       }
287       $port = ($SERVER_PORT == $dflt_port) ? '' : ":$SERVER_PORT";
288       return $proto . '://' . $SERVER_NAME . $port . $SCRIPT_NAME;
289    }
290
291    if (empty($ScriptUrl)) {
292       $ScriptUrl = compute_default_scripturl();
293    }
294    if (defined('WIKI_ADMIN') && !empty($AdminUrl))
295       $ScriptUrl = $AdminUrl;
296
297    $FieldSeparator = "\263";
298
299    if (isset($PHP_AUTH_USER)) {
300         $remoteuser = $PHP_AUTH_USER;
301    } else {
302
303       // Apache won't show REMOTE_HOST unless the admin configured it
304       // properly. We'll be nice and see if it's there.
305
306       getenv('REMOTE_HOST') ? ($remoteuser = getenv('REMOTE_HOST'))
307                             : ($remoteuser = getenv('REMOTE_ADDR'));
308    }
309
310    // constants used for HTML output. HTML tags may allow nesting
311    // other tags always start at level 0
312    define("ZERO_LEVEL", 0);
313    define("NESTED_LEVEL", 1);
314
315    // constants for flags in $pagehash
316    define("FLAG_PAGE_LOCKED", 1);
317 ?>