]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - index.php
New file.
[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.24 2001-09-19 19:12:16 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 // Note that on some systems, apprently using these short forms for
209 // the locale won't work.  On my home system 'LANG=de' won't result
210 // in german pages.  Somehow the system must recognize the locale
211 // as a valid locale before gettext() will work, i.e., use 'de_DE',
212 // 'nl_NL'.
213 $LANG='C';
214 //$LANG='nl_NL';
215
216 // Setting the LANG environment variable (accomplished above) may or
217 // may not be sufficient to cause PhpWiki to produce dates in your
218 // native language.  (It depends on the configuration of the operating
219 // system on your http server.)  The problem is that, e.g. 'de' is
220 // often not a valid locale.
221 //
222 // A standard locale name is typically of  the  form
223 // language[_territory][.codeset][@modifier],  where  language is
224 // an ISO 639 language code, territory is an ISO 3166 country code,
225 // and codeset  is  a  character  set or encoding identifier like
226 // ISO-8859-1 or UTF-8.
227 //
228 // You can tailor the locale used for time and date formatting by setting
229 // the LC_TIME environment variable.  You'll have to experiment to find
230 // the correct setting:
231 //putenv('LC_TIME=de_DE');
232
233 // If you specify a relative URL for the CSS and images,
234 // the are interpreted relative to DATA_PATH (see below).
235 // (The default value of DATA_PATH is the directory in which
236 // index.php (this file) resides.)
237
238 // CSS location
239 //
240 // Note that if you use the stock phpwiki style sheet, 'phpwiki.css',
241 // you should make sure that it's companion 'phpwiki-heavy.css'
242 // is installed in the same directory that the base style file is.
243 define("CSS_URL", "phpwiki.css");
244
245 // logo image (path relative to index.php)
246 $logo = "images/wikibase.png";
247
248 // Signature image which is shown after saving an edited page
249 // If this is left blank (or unset), the signature will be omitted.
250 //$SignatureImg = "images/signature.png";
251
252 // Date & time formats used to display modification times, etc.
253 // Formats are given as format strings to PHP strftime() function
254 // See http://www.php.net/manual/en/function.strftime.php for details.
255 $datetimeformat = "%B %e, %Y";  // may contain time of day
256 $dateformat = "%B %e, %Y";      // must not contain time
257
258 // FIXME: delete
259 // this defines how many page names to list when displaying
260 // the MostPopular pages; the default is to show the 20 most popular pages
261 define("MOST_POPULAR_LIST_LENGTH", 20);
262
263 // this defines how many page names to list when displaying related pages
264 define("NUM_RELATED_PAGES", 5);
265
266 // Template files (filenames are relative to script position)
267 // However, if a LANG is set, they we be searched for in a locale
268 // specific location first.
269 $templates = array("BROWSE" =>    "templates/browse.html",
270                    "EDITPAGE" =>  "templates/editpage.html",
271                    "MESSAGE" =>   "templates/message.html");
272
273 /* WIKI_PGSRC -- specifies the source for the initial page contents
274  * of the Wiki.  The setting of WIKI_PGSRC only has effect when
275  * the wiki is accessed for the first time (or after clearing the
276  * database.) WIKI_PGSRC can either name a directory or a zip file.
277  * In either case WIKI_PGSRC is scanned for files --- one file per page.
278  */
279 define('WIKI_PGSRC', "pgsrc"); // Default (old) behavior.
280 //define('WIKI_PGSRC', 'wiki.zip'); // New style.
281 //define('WIKI_PGSRC', '../../../Logs/Hamwiki/hamwiki-20010830.zip'); // New style.
282
283 // DEFAULT_WIKI_PGSRC is only used when the language is *not*
284 // the default (English) and when reading from a directory:
285 // in that case some English pages are inserted into the wiki as well
286 // DEFAULT_WIKI_PGSRC defines where the English pages reside 
287 // FIXME: is this really needed?  Can't we just copy
288 //  these pages into the localized pgsrc?
289 define('DEFAULT_WIKI_PGSRC', "pgsrc");
290 // These are the pages which will get loaded from DEFAULT_WIKI_PGSRC.   
291 $GenericPages = array("ReleaseNotes", "SteveWainstead", "TestPage");
292
293 /////////////////////////////////////////////////////////////////////
294 //
295 // Part four:
296 // Mark-up options.
297 // 
298 /////////////////////////////////////////////////////////////////////
299
300 // allowed protocols for links - be careful not to allow "javascript:"
301 // URL of these types will be automatically linked.
302 // within a named link [name|uri] one more protocol is defined: phpwiki
303 $AllowedProtocols = "http|https|mailto|ftp|news|gopher";
304
305 // URLs ending with the following extension should be inlined as images
306 $InlineImages = "png|jpg|gif";
307
308 // Perl regexp for WikiNames ("bumpy words")
309 // (?<!..) & (?!...) used instead of '\b' because \b matches '_' as well
310 $WikiNameRegexp = "(?<![[:alnum:]])([[:upper:]][[:lower:]]+){2,}(?![[:alnum:]])";
311
312 // InterWiki linking -- wiki-style links to other wikis on the web
313 //
314 // Intermap file for InterWikiLinks -- define other wikis there
315 // Leave this undefined to disable InterWiki linking.
316 define('INTERWIKI_MAP_FILE', "lib/interwiki.map");
317
318 /////////////////////////////////////////////////////////////////////
319 //
320 // Part five:
321 // URL options -- you can probably skip this section.
322 //
323 /////////////////////////////////////////////////////////////////////
324 /******************************************************************
325  *
326  * The following section contains settings which you can use to tailor
327  * the URLs which PhpWiki generates. 
328  *
329  * Any of these parameters which are left undefined will be
330  * deduced automatically.  You need only set them explicitly
331  * if the auto-detected values prove to be incorrect.
332  *
333  * In most cases the auto-detected values should work fine,
334  * so hopefully you don't need to mess with this section.
335  *
336  ******************************************************************/
337
338 /*
339  * Canonical name and httpd port of the server on which this
340  * PhpWiki resides.
341  */
342 //define('SERVER_NAME', 'some.host.com');
343 //define('SERVER_PORT', 80);
344
345 /*
346  * Absolute URL (from the server root) of the PhpWiki
347  * script.
348  */
349 //define('SCRIPT_NAME', '/some/where/index.php');
350
351 /*
352  * Absolute URL (from the server root) of the directory
353  * in which relative URL's for images and other support files
354  * are interpreted.
355  */
356 //define('DATA_PATH', '/some/where');
357
358 /*
359  * Define to 'true' to use PATH_INFO to pass the pagename's.
360  * e.g. http://www.some.where/index.php/HomePage instead
361  * of http://www.some.where/index.php?pagename=HomePage
362  * FIXME: more docs (maybe in README).
363  */
364 //define('USE_PATH_INFO', false);
365
366 /*
367  * VIRTUAL_PATH is the canonical URL path under which your
368  * your wiki appears.  Normally this is the same as
369  * dirname(SCRIPT_NAME), however using, e.g. apaches mod_actions
370  * (or mod_rewrite), you can make it something different.
371  *
372  * If you do this, you should set VIRTUAL_PATH here.
373  *
374  * E.g. your phpwiki might be installed at at /scripts/phpwiki/index.php,
375  * but  * you've made it accessible through eg. /wiki/HomePage.
376  *
377  * One way to do this is to create a directory named 'wiki' in your
378  * server root.  The directory contains only one file: an .htaccess
379  * file which reads something like:
380  *
381  *    Action x-phpwiki-page /scripts/phpwiki/index.php
382  *    SetHandler x-phpwiki-page
383  *    DirectoryIndex /scripts/phpwiki/index.php
384  *
385  * In that case you should set VIRTUAL_PATH to '/wiki'.
386  *
387  * (VIRTUAL_PATH is only used if USE_PATH_INFO is true.)
388  */
389 //define('VIRTUAL_PATH', '/SomeWiki');
390
391
392 ////////////////////////////////////////////////////////////////
393 // Okay... fire up the code:
394 ////////////////////////////////////////////////////////////////
395
396 include "lib/main.php";
397
398 // (c-file-style: "gnu")
399 // Local Variables:
400 // mode: php
401 // tab-width: 8
402 // c-basic-offset: 4
403 // c-hanging-comment-ender-p: nil
404 // indent-tabs-mode: nil
405 // End:   
406 ?>