]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - index.php
InterWiki link-icon added.
[SourceForge/phpwiki.git] / index.php
1 <?php
2
3 /*
4   This is the starting file for PhpWiki. All this file does
5    is set configuration options, and at the end of the file 
6    it includes() the file lib/main.php, where the real action begins.
7
8    This file is divided into six parts: Parts Zero, One, Two, Three,
9    Four and Five. Each one has different configuration settings you 
10    can change; in all cases the default should work on your system, 
11    however, we recommend you tailor things to your particular setting.
12 */
13
14 /////////////////////////////////////////////////////////////////////
15 // Part Zero: If PHP needs help in finding where you installed the
16 //   rest of the PhpWiki code, you can set the include_path here.
17
18 // NOTE: phpwiki uses the PEAR library of php code for SQL database
19 // access.  Your PHP is probably already configured to set include_path
20 // so that PHP can find the pear code.  If not (or if you change
21 // include_path here) make sure you include the path to the PEAR
22 // code in include_path.  (To find the PEAR code on your system, search
23 // for a file named 'PEAR.php'.   Some common locations are:
24 //
25 //   Unixish systems:
26 //     /usr/share/php
27 //     /usr/local/share/php
28 //   Mac OS X:
29 //     /System/Library/PHP
30 //
31 //ini_set('include_path', '.:/where/you/installed/phpwiki');
32
33 /////////////////////////////////////////////////////////////////////
34 // Part Null: Don't touch this!
35
36 define ('PHPWIKI_VERSION', '1.3.0-jeffs-hacks');
37 require "lib/prepend.php";
38 rcs_id('$Id: index.php,v 1.38 2001-12-07 05:37:13 carstenklapp Exp $');
39
40 /////////////////////////////////////////////////////////////////////
41 //
42 // Part One:
43 // Authentication and security settings:
44 // 
45 /////////////////////////////////////////////////////////////////////
46
47 // If set, we will perform reverse dns lookups to try to convert the users
48 // IP number to a host name, even if the http server didn't do it for us.
49 define('ENABLE_REVERSE_DNS', true);
50
51 // Username and password of administrator.
52 // Set these to your preferences. For heaven's sake
53 // pick a good password!
54 define('ADMIN_USER', "");
55 define('ADMIN_PASSWD', "");
56
57 // If true, only the admin user can make zip dumps, else
58 // zip dumps require no authentication.
59 define('ZIPDUMP_AUTH', false);
60
61 // The maximum file upload size.
62 define('MAX_UPLOAD_SIZE', 16 * 1024 * 1024);
63
64 // If the last edit is older than MINOR_EDIT_TIMEOUT seconds, the default
65 // state for the "minor edit" checkbox on the edit page form will be off.
66 define("MINOR_EDIT_TIMEOUT", 7 * 24 * 3600);
67
68 // Actions listed in this array will not be allowed.
69 //$DisabledActions = array('dumpserial', 'loadfile');
70
71 // PhpWiki can generate an access_log (in "NCSA combined log" format)
72 // for you.  If you want one, define this to the name of the log file.
73 define('ACCESS_LOG', '/tmp/wiki_access_log');
74
75
76 // If ALLOW_BOGO_LOGIN is true, users are allowed to login
77 // (with any/no password) using any userid which: 1) is not
78 // the ADMIN_USER, 2) is a valid WikiWord (matches $WikiNameRegexp.)
79 define('ALLOW_BOGO_LOGIN', true);
80
81 // The login code now uses PHP's session support.  Usually, the default
82 // configuration of PHP is to store the session state information in
83 // /tmp.  That probably will work fine, but fails e.g. on clustered
84 // servers where each server has their own distinct /tmp (this
85 // is the case on SourceForge's project web server.)  You can specify
86 // an alternate directory in which to store state information like so
87 // (whatever user your httpd runs as must have read/write permission
88 // in this directory):
89
90 // ini_set('session.save_path', 'some_other_directory');
91
92
93 /////////////////////////////////////////////////////////////////////
94 //
95 // Part Two:
96 // Database Selection
97 //
98 /////////////////////////////////////////////////////////////////////
99
100 //
101 // This array holds the parameters which select the database to use.
102 //
103 // Not all of these parameters are used by any particular DB backend.
104 //
105 $DBParams = array(
106    // Select the database type:
107    //'dbtype' => 'SQL',
108    'dbtype' => 'dba',
109    
110    // For SQL based backends, specify the database as a DSN
111    // The most general form of a DSN looks like:
112    //
113    //   phptype(dbsyntax)://username:password@protocol+hostspec/database
114    //
115    // For a MySQL database, the following should work:
116    //
117    //   mysql://user:password@host/databasename
118    //
119    // FIXME: My version Pear::DB seems to be broken enough that there is
120    //    no way to connect to a mysql server over a socket right now.
121    //'dsn' => 'mysql://guest@:/var/lib/mysql/mysql.sock/test',
122    //'dsn' => 'mysql://guest@localhost/test',
123    'dsn' => 'pgsql://localhost/test',
124    
125    // Used by all DB types:
126
127    // prefix for filenames or table names
128    /* 
129     * currently you MUST EDIT THE SQL file too (in the schemas/ directory
130     * because we aren't doing on the fly sql generation during the
131     * installation.
132    */
133    //'prefix' => 'phpwiki_',
134    
135    // Used by 'dba'
136    'directory' => "/tmp",
137    'dba_handler' => 'gdbm',   // Either of 'gdbm' or 'db2' work great for me.
138    //'dba_handler' => 'db2',
139    //'dba_handler' => 'db3',    // doesn't work at all for me....
140    'timeout' => 20,
141    //'timeout' => 5
142 );
143
144 /////////////////////////////////////////////////////////////////////
145 //
146 // The next section controls how many old revisions of each page
147 // are kept in the database.
148 //
149 // There are two basic classes of revisions: major and minor.
150 // Which class a revision belongs in is determined by whether the
151 // author checked the "this is a minor revision" checkbox when they
152 // saved the page.
153 // 
154 // There is, additionally, a third class of revisions: author revisions.
155 // The most recent non-mergable revision from each distinct author is
156 // and author revision.
157 //
158 // The expiry parameters for each of those three classes of revisions
159 // can be adjusted seperately.   For each class there are five
160 // parameters (usually, only two or three of the five are actually set)
161 // which control how long those revisions are kept in the database.
162 //
163 //   max_keep: If set, this specifies an absolute maximum for the number
164 //             of archived revisions of that class.  This is meant to be
165 //             used as a safety cap when a non-zero min_age is specified.
166 //             It should be set relatively high, and it's purpose is to
167 //             prevent malicious or accidental database overflow due
168 //             to someone causing an unreasonable number of edits in a short
169 //             period of time.
170 //
171 //   min_age:  Revisions younger than this (based upon the supplanted date)
172 //             will be kept unless max_keep is exceeded.  The age should
173 //             be specified in days.  It should be a non-negative,
174 //             real number,
175 //
176 //   min_keep: At least this many revisions will be kept.
177 //
178 //   keep:     No more than this many revisions will be kept.
179 //
180 //   max_age:  No revision older than this age will be kept.
181 //
182 // Supplanted date:  Revisions are timestamped at the instant that they cease
183 // being the current revision.  Revision age is computed using this timestamp,
184 // not the edit time of the page.
185 //
186 // Merging: When a minor revision is deleted, if the preceding revision is by
187 // the same author, the minor revision is merged with the preceding revision
188 // before it is deleted.  Essentially: this replaces the content (and supplanted
189 // timestamp) of the previous revision with the content after the merged minor
190 // edit, the rest of the page metadata for the preceding version (summary, mtime, ...)
191 // is not changed.
192 //
193 // Keep up to 8 major edits, but keep them no longer than a month.
194 $ExpireParams['major'] = array('max_age' => 32,
195                                'keep'      => 8);
196 // Keep up to 4 minor edits, but keep them no longer than a week.
197 $ExpireParams['minor'] = array('max_age' => 7,
198                                'keep'    => 4);
199 // Keep the latest contributions of the last 8 authors up to a year.
200 // Additionally, (in the case of a particularly active page) try to keep the
201 // latest contributions of all authors in the last week (even if there are
202 // more than eight of them,) but in no case keep more than twenty unique
203 // author revisions.
204 $ExpireParams['author'] = array('max_age'  => 365,
205                                 'keep'     => 8,
206                                 'min_age'  => 7,
207                                 'max_keep' => 20);
208
209 /////////////////////////////////////////////////////////////////////
210 // 
211 // Part Three:
212 // Page appearance and layout
213 //
214 /////////////////////////////////////////////////////////////////////
215
216 // Select your language/locale - default language "C": English
217 // other languages available: Dutch "nl", Spanish "es", German "de",
218 // Swedish "sv", and Italian, "it".
219 //
220 // If you set $LANG to the empty string, your systems default
221 // language (as determined by the applicable environment variables)
222 // will be used.
223 //
224 // Note that on some systems, apprently using these short forms for
225 // the locale won't work.  On my home system 'LANG=de' won't result
226 // in german pages.  Somehow the system must recognize the locale
227 // as a valid locale before gettext() will work, i.e., use 'de_DE',
228 // 'nl_NL'.
229 $LANG='C';
230 //$LANG='nl_NL';
231
232 // Setting the LANG environment variable (accomplished above) may or
233 // may not be sufficient to cause PhpWiki to produce dates in your
234 // native language.  (It depends on the configuration of the operating
235 // system on your http server.)  The problem is that, e.g. 'de' is
236 // often not a valid locale.
237 //
238 // A standard locale name is typically of  the  form
239 // language[_territory][.codeset][@modifier],  where  language is
240 // an ISO 639 language code, territory is an ISO 3166 country code,
241 // and codeset  is  a  character  set or encoding identifier like
242 // ISO-8859-1 or UTF-8.
243 //
244 // You can tailor the locale used for time and date formatting by setting
245 // the LC_TIME environment variable.  You'll have to experiment to find
246 // the correct setting:
247 //putenv('LC_TIME=de_DE');
248
249 // If you specify a relative URL for the CSS and images,
250 // the are interpreted relative to DATA_PATH (see below).
251 // (The default value of DATA_PATH is the directory in which
252 // index.php (this file) resides.)
253
254 // CSS location
255 //
256 // Note that if you use the stock phpwiki style sheet, 'phpwiki.css',
257 // you should make sure that it's companion 'phpwiki-heavy.css'
258 // is installed in the same directory that the base style file is.
259 define("CSS_URL", "phpwiki.css");
260
261 // logo image (path relative to index.php)
262 $logo = "images/wikibase.png";
263
264 // Signature image which is shown after saving an edited page
265 // If this is left blank (or unset), the signature will be omitted.
266 //$SignatureImg = "images/signature.png";
267
268 // this turns on url indicator icons, inserted before embedded links
269 // '*' icon is shown when the link type has no icon listed here,
270 // but ONLY for the AllowedProtocols specified in in part four!
271 // 'interwiki' icon indicates a Wiki listed in lib/interwiki.map
272 // If you want icons just to differentiate between urls and Wikis then
273 // turn on only 'interwiki' and '*', comment out the other four.
274 /*
275 $URL_LINK_ICONS = array(
276                     'http'      => 'images/http.png',
277                     'https'     => 'images/https.png',
278                     'ftp'       => 'images/ftp.png',
279                     'mailto'    => 'images/mailto.png',
280                     'interwiki' => 'images/interwiki.png',
281                     '*'         => 'images/zapg.png'
282                     );
283 */                    
284
285 // Date & time formats used to display modification times, etc.
286 // Formats are given as format strings to PHP strftime() function
287 // See http://www.php.net/manual/en/function.strftime.php for details.
288 $datetimeformat = "%B %e, %Y";  // may contain time of day
289 $dateformat = "%B %e, %Y";      // must not contain time
290
291 // FIXME: delete
292 // this defines how many page names to list when displaying
293 // the MostPopular pages; the default is to show the 20 most popular pages
294 define("MOST_POPULAR_LIST_LENGTH", 20);
295
296 // this defines how many page names to list when displaying related pages
297 define("NUM_RELATED_PAGES", 5);
298
299 // Template files (filenames are relative to script position)
300 // However, if a LANG is set, they we be searched for in a locale
301 // specific location first.
302 $templates = array("BROWSE" =>    "templates/browse.html",
303                    "EDITPAGE" =>  "templates/editpage.html",
304                    "MESSAGE" =>   "templates/message.html");
305
306 // The themeinfo file can be used to override default settings above this line
307 // (i.e. templates, logo, signature etc.)
308 $theme="";
309 if ( !$theme == "" ) {
310     if ( file_exists( "themes/$theme/themeinfo.php" ) ) {
311         include "themes/$theme/themeinfo.php";
312     }
313 }
314
315 /* WIKI_PGSRC -- specifies the source for the initial page contents
316  * of the Wiki.  The setting of WIKI_PGSRC only has effect when
317  * the wiki is accessed for the first time (or after clearing the
318  * database.) WIKI_PGSRC can either name a directory or a zip file.
319  * In either case WIKI_PGSRC is scanned for files --- one file per page.
320  */
321 define('WIKI_PGSRC', "pgsrc"); // Default (old) behavior.
322 //define('WIKI_PGSRC', 'wiki.zip'); // New style.
323 //define('WIKI_PGSRC', '../../../Logs/Hamwiki/hamwiki-20010830.zip'); // New style.
324
325 // DEFAULT_WIKI_PGSRC is only used when the language is *not*
326 // the default (English) and when reading from a directory:
327 // in that case some English pages are inserted into the wiki as well
328 // DEFAULT_WIKI_PGSRC defines where the English pages reside 
329 // FIXME: is this really needed?  Can't we just copy
330 //  these pages into the localized pgsrc?
331 define('DEFAULT_WIKI_PGSRC', "pgsrc");
332 // These are the pages which will get loaded from DEFAULT_WIKI_PGSRC.   
333 $GenericPages = array("ReleaseNotes", "SteveWainstead", "TestPage");
334
335 /////////////////////////////////////////////////////////////////////
336 //
337 // Part four:
338 // Mark-up options.
339 // 
340 /////////////////////////////////////////////////////////////////////
341
342 // allowed protocols for links - be careful not to allow "javascript:"
343 // URL of these types will be automatically linked.
344 // within a named link [name|uri] one more protocol is defined: phpwiki
345 $AllowedProtocols = "http|https|mailto|ftp|news|gopher";
346
347 // URLs ending with the following extension should be inlined as images
348 $InlineImages = "png|jpg|gif";
349
350 // Uncomment this to automatically split WikiWords by inserting spaces.
351 // The default is to leave WordsSmashedTogetherLikeSo in the body text.
352 //define("autosplit_wikiwords", 1);
353
354 // Perl regexp for WikiNames ("bumpy words")
355 // (?<!..) & (?!...) used instead of '\b' because \b matches '_' as well
356 $WikiNameRegexp = "(?<![[:alnum:]])([[:upper:]][[:lower:]]+){2,}(?![[:alnum:]])";
357
358 // InterWiki linking -- wiki-style links to other wikis on the web
359 //
360 // Intermap file for InterWikiLinks -- define other wikis there
361 // Leave this undefined to disable InterWiki linking.
362 define('INTERWIKI_MAP_FILE', "lib/interwiki.map");
363
364 /////////////////////////////////////////////////////////////////////
365 //
366 // Part five:
367 // URL options -- you can probably skip this section.
368 //
369 /////////////////////////////////////////////////////////////////////
370 /******************************************************************
371  *
372  * The following section contains settings which you can use to tailor
373  * the URLs which PhpWiki generates. 
374  *
375  * Any of these parameters which are left undefined will be
376  * deduced automatically.  You need only set them explicitly
377  * if the auto-detected values prove to be incorrect.
378  *
379  * In most cases the auto-detected values should work fine,
380  * so hopefully you don't need to mess with this section.
381  *
382  ******************************************************************/
383
384 /*
385  * Canonical name and httpd port of the server on which this
386  * PhpWiki resides.
387  */
388 //define('SERVER_NAME', 'some.host.com');
389 //define('SERVER_PORT', 80);
390
391 /*
392  * Relative URL (from the server root) of the PhpWiki
393  * script.
394  */
395 //define('SCRIPT_NAME', '/some/where/index.php');
396
397 /*
398  * Relative URL (from the server root) of the directory
399  * in which relative URL's for images and other support files
400  * are interpreted.
401  */
402 //define('DATA_PATH', '/some/where');
403
404 /*
405  * Define to 'true' to use PATH_INFO to pass the pagename's.
406  * e.g. http://www.some.where/index.php/HomePage instead
407  * of http://www.some.where/index.php?pagename=HomePage
408  * FIXME: more docs (maybe in README).
409  */
410 //define('USE_PATH_INFO', false);
411
412 /*
413  * VIRTUAL_PATH is the canonical URL path under which your
414  * your wiki appears.  Normally this is the same as
415  * dirname(SCRIPT_NAME), however using, e.g. apaches mod_actions
416  * (or mod_rewrite), you can make it something different.
417  *
418  * If you do this, you should set VIRTUAL_PATH here.
419  *
420  * E.g. your phpwiki might be installed at at /scripts/phpwiki/index.php,
421  * but  * you've made it accessible through eg. /wiki/HomePage.
422  *
423  * One way to do this is to create a directory named 'wiki' in your
424  * server root.  The directory contains only one file: an .htaccess
425  * file which reads something like:
426  *
427  *    Action x-phpwiki-page /scripts/phpwiki/index.php
428  *    SetHandler x-phpwiki-page
429  *    DirectoryIndex /scripts/phpwiki/index.php
430  *
431  * In that case you should set VIRTUAL_PATH to '/wiki'.
432  *
433  * (VIRTUAL_PATH is only used if USE_PATH_INFO is true.)
434  */
435 //define('VIRTUAL_PATH', '/SomeWiki');
436
437
438 ////////////////////////////////////////////////////////////////
439 // Okay... fire up the code:
440 ////////////////////////////////////////////////////////////////
441
442 include "lib/main.php";
443
444 // (c-file-style: "gnu")
445 // Local Variables:
446 // mode: php
447 // tab-width: 8
448 // c-basic-offset: 4
449 // c-hanging-comment-ender-p: nil
450 // indent-tabs-mode: nil
451 // End:   
452 ?>