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