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