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