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