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.
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.
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.
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:
27 // /usr/local/share/php
29 // /System/Library/PHP
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
35 #ini_set('include_path', '.:/where/you/installed/phpwiki');
37 /////////////////////////////////////////////////////////////////////
38 // Part Null: Don't touch this!
40 define ('PHPWIKI_VERSION', '1.3.2-jeffs-hacks');
41 require "lib/prepend.php";
42 rcs_id('$Id: index.php,v 1.49 2002-01-03 05:10:33 carstenklapp Exp $');
44 /////////////////////////////////////////////////////////////////////
47 // Authentication and security settings:
49 /////////////////////////////////////////////////////////////////////
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');
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);
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', "");
66 // If true, only the admin user can make zip dumps, else
67 // zip dumps require no authentication.
68 define('ZIPDUMP_AUTH', false);
70 // The maximum file upload size.
71 define('MAX_UPLOAD_SIZE', 16 * 1024 * 1024);
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);
77 // Actions listed in this array will not be allowed.
78 //$DisabledActions = array('dumpserial', 'loadfile');
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');
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);
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):
99 #ini_set('session.save_path', 'some_other_directory');
102 /////////////////////////////////////////////////////////////////////
105 // Database Selection
107 /////////////////////////////////////////////////////////////////////
110 // This array holds the parameters which select the database to use.
112 // Not all of these parameters are used by any particular DB backend.
115 // Select the database type:
119 // For SQL based backends, specify the database as a DSN
120 // The most general form of a DSN looks like:
122 // phptype(dbsyntax)://username:password@protocol+hostspec/database
124 // For a MySQL database, the following should work:
126 // mysql://user:password@host/databasename
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',
134 // Used by all DB types:
136 // prefix for filenames or table names
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
142 #'prefix' => 'phpwiki_',
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....
153 /////////////////////////////////////////////////////////////////////
155 // The next section controls how many old revisions of each page
156 // are kept in the database.
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
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.
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.
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
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,
185 // min_keep: At least this many revisions will be kept.
187 // keep: No more than this many revisions will be kept.
189 // max_age: No revision older than this age will be kept.
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.
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, ...)
202 // Keep up to 8 major edits, but keep them no longer than a month.
203 $ExpireParams['major'] = array('max_age' => 32,
205 // Keep up to 4 minor edits, but keep them no longer than a week.
206 $ExpireParams['minor'] = array('max_age' => 7,
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
213 $ExpireParams['author'] = array('max_age' => 365,
218 /////////////////////////////////////////////////////////////////////
221 // Page appearance and layout
223 /////////////////////////////////////////////////////////////////////
225 // Select a valid charset name to be inserted into the xml/html pages.
226 // For more info see: <http://www.iana.org/assignments/character-sets>.
227 // Note that PhpWiki has been extensively tested only with the latin1
228 // (iso-8859-1) character set.
229 // If you change the default from iso-8859-1 PhpWiki may not work
230 // properly and it will require code modifications. However, character
231 // sets similar to iso-8859-1 may work with little or no modification
232 // depending on your setup. The database must also support the same
233 // charset, and of course the same is true for the web browser.
234 // (Some work is in progress hopefully to allow more flexibility in
235 // this area in the future).
236 define("CHARSET", "iso-8859-1");
238 // Select your language/locale - default language is "C" for English.
239 // Other languages available:
240 // English "C" (English - HomePage)
241 // Dutch "nl" (Nederlands - ThuisPagina)
242 // Spanish "es" (Español - PáginaPrincipal)
243 // German "de" (Deutsch - StartSeite)
244 // Swedish "sv" (Svenska - Framsida)
245 // Italian "it" (Italiano - PaginaPrincipale)
247 // If you set $LANG to the empty string, your systems default
248 // language (as determined by the applicable environment variables)
251 // Note that on some systems, apprently using these short forms for
252 // the locale won't work. On my home system 'LANG=de' won't result
253 // in german pages. Somehow the system must recognize the locale
254 // as a valid locale before gettext() will work, i.e., use 'de_DE',
259 // Setting the LANG environment variable (accomplished above) may or
260 // may not be sufficient to cause PhpWiki to produce dates in your
261 // native language. (It depends on the configuration of the operating
262 // system on your http server.) The problem is that, e.g. 'de' is
263 // often not a valid locale.
265 // A standard locale name is typically of the form
266 // language[_territory][.codeset][@modifier], where language is
267 // an ISO 639 language code, territory is an ISO 3166 country code,
268 // and codeset is a character set or encoding identifier like
269 // ISO-8859-1 or UTF-8.
271 // You can tailor the locale used for time and date formatting by setting
272 // the LC_TIME environment variable. You'll have to experiment to find
273 // the correct setting:
274 //putenv('LC_TIME=de_DE');
276 // If you specify a relative URL for the CSS and images,
277 // the are interpreted relative to DATA_PATH (see below).
278 // (The default value of DATA_PATH is the directory in which
279 // index.php (this file) resides.)
283 // Note that if you use the stock phpwiki style sheet, 'phpwiki.css',
284 // you should make sure that it's companion 'phpwiki-heavy.css'
285 // is installed in the same directory that the base style file is.
286 // FIXME: These default CSS key names could use localization, but
287 // gettext() is not available at this point yet
289 'PhpWiki' => "phpwiki.css",
290 'Printer' => "phpwiki-printer.css",
291 'Modern' => "phpwiki-modern.css"
294 $CSS_DEFAULT = "PhpWiki";
296 // logo image (path relative to index.php)
297 $logo = "images/wikibase.png";
299 // Signature image which is shown after saving an edited page
300 // If this is left blank (or unset), the signature will be omitted.
301 #$SignatureImg = "images/signature.png";
303 // this turns on url indicator icons, inserted before embedded links
304 // '*' icon is shown when the link type has no icon listed here,
305 // but ONLY for the AllowedProtocols specified in in part four!
306 // 'interwiki' icon indicates a Wiki listed in lib/interwiki.map
307 // If you want icons just to differentiate between urls and Wikis then
308 // turn on only 'interwiki' and '*', comment out the other four.
310 $URL_LINK_ICONS = array(
311 'http' => 'images/http.png',
312 'https' => 'images/https.png',
313 'ftp' => 'images/ftp.png',
314 'mailto' => 'images/mailto.png',
315 'interwiki' => 'images/interwiki.png',
316 '*' => 'images/zapg.png'
320 // Date & time formats used to display modification times, etc.
321 // Formats are given as format strings to PHP strftime() function
322 // See http://www.php.net/manual/en/function.strftime.php for details.
323 $datetimeformat = "%B %e, %Y"; // may contain time of day
324 $dateformat = "%B %e, %Y"; // must not contain time
327 // this defines how many page names to list when displaying
328 // the MostPopular pages; the default is to show the 20 most popular pages
329 define("MOST_POPULAR_LIST_LENGTH", 20);
331 // this defines how many page names to list when displaying related pages
332 define("NUM_RELATED_PAGES", 5);
334 // Template files (filenames are relative to script position)
335 // However, if a LANG is set, they we be searched for in a locale
336 // specific location first.
337 $templates = array("BROWSE" => "templates/browse.html",
338 "EDITPAGE" => "templates/editpage.html",
339 "MESSAGE" => "templates/message.html");
341 // The themeinfo file can be used to override default settings above this line
342 // (i.e. templates, logo, signature etc.)
343 // comment out the $theme= lines to revert to the standard interface
344 // which defaults to /templates and /images
349 if (!empty($theme)) {
350 if (file_exists("themes/$theme/themeinfo.php")) {
351 include "themes/$theme/themeinfo.php";
353 //FIXME: gettext doesn't work in index.php or themeinfo.php
354 trigger_error(sprintf(("Unable to open file '%s' for reading"),
355 "themes/$theme/themeinfo.php"), E_USER_NOTICE);
359 /* WIKI_PGSRC -- specifies the source for the initial page contents
360 * of the Wiki. The setting of WIKI_PGSRC only has effect when
361 * the wiki is accessed for the first time (or after clearing the
362 * database.) WIKI_PGSRC can either name a directory or a zip file.
363 * In either case WIKI_PGSRC is scanned for files --- one file per page.
365 define('WIKI_PGSRC', "pgsrc"); // Default (old) behavior.
366 //define('WIKI_PGSRC', 'wiki.zip'); // New style.
367 //define('WIKI_PGSRC', '../../../Logs/Hamwiki/hamwiki-20010830.zip'); // New style.
369 // DEFAULT_WIKI_PGSRC is only used when the language is *not*
370 // the default (English) and when reading from a directory:
371 // in that case some English pages are inserted into the wiki as well
372 // DEFAULT_WIKI_PGSRC defines where the English pages reside
373 // FIXME: is this really needed? Can't we just copy
374 // these pages into the localized pgsrc?
375 define('DEFAULT_WIKI_PGSRC', "pgsrc");
376 // These are the pages which will get loaded from DEFAULT_WIKI_PGSRC.
377 $GenericPages = array("ReleaseNotes", "SteveWainstead", "TestPage");
379 /////////////////////////////////////////////////////////////////////
384 /////////////////////////////////////////////////////////////////////
386 // allowed protocols for links - be careful not to allow "javascript:"
387 // URL of these types will be automatically linked.
388 // within a named link [name|uri] one more protocol is defined: phpwiki
389 $AllowedProtocols = "http|https|mailto|ftp|news|nntp|ssh|gopher";
391 // URLs ending with the following extension should be inlined as images
392 $InlineImages = "png|jpg|gif|tiff|tif";
394 // Uncomment this to automatically split WikiWords by inserting spaces.
395 // The default is to leave WordsSmashedTogetherLikeSo in the body text.
396 #define("autosplit_wikiwords", 1);
398 // Perl regexp for WikiNames ("bumpy words")
399 // (?<!..) & (?!...) used instead of '\b' because \b matches '_' as well
400 $WikiNameRegexp = "(?<![[:alnum:]])([[:upper:]][[:lower:]]+){2,}(?![[:alnum:]])";
402 // InterWiki linking -- wiki-style links to other wikis on the web
404 // Intermap file for InterWikiLinks -- define other wikis there
405 // Leave this undefined to disable InterWiki linking.
406 define('INTERWIKI_MAP_FILE', "lib/interwiki.map");
408 /////////////////////////////////////////////////////////////////////
411 // URL options -- you can probably skip this section.
413 /////////////////////////////////////////////////////////////////////
414 /******************************************************************
416 * The following section contains settings which you can use to tailor
417 * the URLs which PhpWiki generates.
419 * Any of these parameters which are left undefined will be
420 * deduced automatically. You need only set them explicitly
421 * if the auto-detected values prove to be incorrect.
423 * In most cases the auto-detected values should work fine,
424 * so hopefully you don't need to mess with this section.
426 ******************************************************************/
429 * Canonical name and httpd port of the server on which this
432 #define('SERVER_NAME', 'some.host.com');
433 #define('SERVER_PORT', 80);
436 * Relative URL (from the server root) of the PhpWiki
439 // Is this still required? Wiki seems to work fine without it,
440 // both with the server configured using alias directives
441 // or using SetHandler + virtual & data paths.
442 //define('SCRIPT_NAME', '/some/where/index.php');
445 * Relative URL (from the server root) of the directory
446 * in which relative URL's for images and other support files
449 #define('DATA_PATH', '/some/where');
452 * Define to 'true' to use PATH_INFO to pass the pagename's.
453 * e.g. http://www.some.where/index.php/HomePage instead
454 * of http://www.some.where/index.php?pagename=HomePage
455 * FIXME: more docs (maybe in README).
457 #define('USE_PATH_INFO', false);
460 * VIRTUAL_PATH is the canonical URL path under which your
461 * your wiki appears. Normally this is the same as
462 * dirname(SCRIPT_NAME), however using, e.g. apaches mod_actions
463 * (or mod_rewrite), you can make it something different.
465 * If you do this, you should set VIRTUAL_PATH here.
467 * E.g. your phpwiki might be installed at at /scripts/phpwiki/index.php,
468 * but * you've made it accessible through eg. /wiki/HomePage.
470 * One way to do this is to create a directory named 'wiki' in your
471 * server root. The directory contains only one file: an .htaccess
472 * file which reads something like:
474 * Action x-phpwiki-page /scripts/phpwiki/index.php
475 * SetHandler x-phpwiki-page
476 * DirectoryIndex /scripts/phpwiki/index.php
478 * In that case you should set VIRTUAL_PATH to '/wiki'.
480 * (VIRTUAL_PATH is only used if USE_PATH_INFO is true.)
482 #define('VIRTUAL_PATH', '/SomeWiki');
485 ////////////////////////////////////////////////////////////////
486 // Okay... fire up the code:
487 ////////////////////////////////////////////////////////////////
489 include "lib/main.php";
491 // (c-file-style: "gnu")
496 // c-hanging-comment-ender-p: nil
497 // indent-tabs-mode: nil