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