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