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