1 <?php // $Id: configurator.php,v 1.31 2005-02-28 20:02:26 rurban Exp $
3 * Copyright 2002,2003,2005 $ThePhpWikiProgrammingTeam
4 * Copyright 2002 Martin Geisler <gimpster@gimpster.com>
6 * This file is part of PhpWiki.
7 * Parts of this file were based on PHPWeather's configurator.php file.
8 * http://sourceforge.net/projects/phpweather/
10 * PhpWiki is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * PhpWiki is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with PhpWiki; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 * Starts automatically the first time by IniConfig("config/config.ini")
27 * if it doesn't exist.
30 * o Initial expand ?show=_part1 (the part id)
31 * o read config-default.ini
32 * o commented / optional: non-default values should not be commented!
33 * default values if optional can be omitted.
34 * o validate input (fix javascript, add POST checks)
35 * o start this automatically the first time
38 * 1.3.11 TODO: (or 1.3.12?)
39 * o fix SQL quotes, AUTH_ORDER quotes and file forward slashes
40 * o posted values validation, extend js validation for sane DB values
41 * o read config-dist.ini into sections, comments, and optional/required settings
43 * A file config/config.ini will be automatically generated, if writable.
45 * NOTE: If you have a starterscript outside PHOWIKI_DIR but no
46 * config/config.ini yet (very unlikely!), you must define DATA_PATH in the
47 * starterscript, otherwise the webpath to configurator is unknown, and
48 * subsequent requests will fail. (POST to save the INI)
51 global $HTTP_SERVER_VARS, $HTTP_POST_VARS, $tdwidth;
52 if (empty($_GET)) $_GET =& $GLOBALS['HTTP_GET_VARS'];
53 if (empty($_ENV)) $_ENV =& $GLOBALS['HTTP_ENV_VARS'];
55 if (empty($configurator))
56 $configurator = "configurator.php";
57 if (!strstr($HTTP_SERVER_VARS["SCRIPT_NAME"], $configurator) and defined('DATA_PATH'))
58 $configurator = DATA_PATH . "/" . $configurator;
59 $scriptname = str_replace('configurator.php', 'index.php', $HTTP_SERVER_VARS["SCRIPT_NAME"]);
62 $config_file = (substr(PHP_OS,0,3) == 'WIN') ? 'config\\config.ini' : 'config/config.ini';
63 $fs_config_file = dirname(__FILE__) . (substr(PHP_OS,0,3) == 'WIN' ? '\\' : '/') . $config_file;
64 if (isset($HTTP_POST_VARS['create'])) header('Location: '.$configurator.'?create=1#create');
66 // helpers from lib/WikiUser/HttpAuth.php
67 function _http_user() {
69 $_SERVER = $GLOBALS['HTTP_SERVER_VARS'];
70 if (!empty($_SERVER['PHP_AUTH_USER']))
71 return array($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
72 if (!empty($_SERVER['REMOTE_USER']))
73 return array($_SERVER['REMOTE_USER'], $_SERVER['PHP_AUTH_PW']);
74 if (!empty($GLOBALS['HTTP_ENV_VARS']['REMOTE_USER']))
75 return array($GLOBALS['HTTP_ENV_VARS']['REMOTE_USER'],
76 $GLOBALS['HTTP_ENV_VARS']['PHP_AUTH_PW']);
77 if (!empty($GLOBALS['REMOTE_USER']))
78 return array($GLOBALS['REMOTE_USER'], $GLOBALS['PHP_AUTH_PW']);
81 if (!empty($_SERVER['HTTP_AUTHORIZATION'])) {
82 list($userid, $passwd) = explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));
83 return array($userid, $passwd);
87 function _http_logout() {
89 $_SERVER =& $GLOBALS['HTTP_SERVER_VARS'];
90 // maybe we should random the realm to really force a logout. but the next login will fail.
91 // better_srand(); $realm = microtime().rand();
92 header('WWW-Authenticate: Basic realm="'.WIKI_NAME.'"');
93 if (strstr(php_sapi_name(), 'apache'))
94 header('HTTP/1.0 401 Unauthorized');
96 header("Status: 401 Access Denied"); //IIS and CGI need that
97 unset($GLOBALS['REMOTE_USER']);
98 unset($_SERVER['PHP_AUTH_USER']);
99 unset($_SERVER['PHP_AUTH_PW']);
101 trigger_error("Permission denied. Require ADMIN_USER.", E_USER_ERROR);
106 // If config.ini exists, we require ADMIN_USER access by faking HttpAuth.
107 // So nobody can see or reset the password(s).
108 if (file_exists($fs_config_file)) {
109 // Require admin user
110 if (!defined('ADMIN_USER') or !defined('ADMIN_PASSWD')) {
111 if (!function_exists("IniConfig")) {
112 include_once("lib/prepend.php");
113 include_once("lib/IniConfig.php");
115 IniConfig($fs_config_file);
117 if (!defined('ADMIN_USER') or ADMIN_USER == '') {
118 trigger_error("Configuration problem:\nADMIN_USER not defined in \"$fs_config_file\".\n"
119 . "Cannot continue: You have to fix that manually.", E_USER_ERROR);
123 list($admin_user, $admin_pw) = _http_user();
124 //$required_user = ADMIN_USER;
125 if (empty($admin_user) or $admin_user != ADMIN_USER)
130 if (ENCRYPTED_PASSWORD and function_exists('crypt')) {
131 if (crypt($admin_pw, ADMIN_PASSWD) != ADMIN_PASSWD)
133 } elseif ($admin_pw != ADMIN_PASSWD) {
137 if (!function_exists("IniConfig")) {
138 include_once("lib/prepend.php");
139 include_once("lib/IniConfig.php");
141 $def_file = (substr(PHP_OS,0,3) == 'WIN') ? 'config\\config-default.ini' : 'config/config-default.ini';
142 $fs_def_file = dirname(__FILE__) . (substr(PHP_OS,0,3) == 'WIN' ? '\\' : '/') . $def_file;
143 IniConfig($fs_def_file);
146 echo "<","?xml version=\"1.0\" encoding=\"'iso-8859-1'\"?",">\n";
148 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
149 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
150 <html xmlns="http://www.w3.org/1999/xhtml">
152 <!-- $Id: configurator.php,v 1.31 2005-02-28 20:02:26 rurban Exp $ -->
153 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
154 <title>Configuration tool for PhpWiki <?php echo $config_file ?></title>
155 <style type="text/css" media="screen">
157 /* TABLE { border: thin solid black } */
158 body { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 80%; }
159 pre { font-size: 120%; }
160 td { border: thin solid black }
162 tr.hidden { border: none; display: none; }
163 td.part { background-color: #eeeeee; color: inherit; }
164 td.instructions { background-color: #ffffee; width: <?php echo $tdwidth ?>px; color: inherit; }
165 td.unchangeable-variable-top { border-bottom: none; background-color: #ffffee; color:inherit; }
166 td.unchangeable-variable-left { border-top: none; background-color: #ffffee; color:inherit; }
169 <script language="JavaScript" type="text/javascript">
171 function update(accepted, error, value, output) {
172 var msg = document.getElementById(output);
174 /* MSIE 5.0 fails here */
175 if (msg && msg.innerHTML) { msg.innerHTML = "<font color=\"green\">Input accepted.</font>"; }
177 while ((index = error.indexOf("%s")) > -1) {
178 error = error.substring(0, index) + value + error.substring(index+2);
180 if (msg) { msg.innerHTML = "<font color=\"red\">" + error + "</font>"; }
182 if (submit = document.getElementById('submit')) submit.disabled = accepted ? false : true;
185 function validate(error, value, output, field) {
186 update(field.value == value, error, field.value, output);
189 function validate_ereg(error, ereg, output, field) {
190 regex = new RegExp(ereg);
191 update(regex.test(field.value), error, field.value, output);
194 function validate_range(error, low, high, empty_ok, output, field) {
195 update((empty_ok == 1 && field.value == "") ||
196 (field.value >= low && field.value <= high),
197 error, field.value, output);
200 function toggle_group(id) {
201 var text = document.getElementById(id + "_text");
203 if (text.innerHTML == "Hide options.") {
205 text.innerHTML = "Show options.";
207 text.innerHTML = "Hide options.";
210 var rows = document.getElementsByTagName('tr');
212 for (i = 0; i < rows.length; i++) {
214 if (tr.className == 'header' && tr.id == id) {
219 for (; i < rows.length; i++) {
221 if (tr.className == 'header')
223 tr.className = do_hide ? 'hidden': 'nonhidden';
228 // Hide all groups. We do this via JavaScript to avoid
229 // hiding the groups if JavaScript is not supported...
230 var rows = document.getElementsByTagName('tr');
231 var show = '<?php echo $_GET["show"] ?>';
232 for (var i = 0; i < rows.length; i++) {
234 if (tr.className == 'header')
235 if (!show || tr.id != show)
239 // Select text in textarea upon focus
240 var area = document.getElementById('config-output');
242 listener = { handleEvent: function (e) { area.select(); } };
243 area.addEventListener('focus', listener, false);
250 <body onload="do_init();">
252 <h1>Configuration for PhpWiki <?php echo $config_file ?></h1>
255 //define('DEBUG', 1);
257 * The Configurator is a php script to aid in the configuration of PhpWiki.
258 * Parts of this file were based on PHPWeather's configurator.php file.
259 * http://sourceforge.net/projects/phpweather/
261 * TO CHANGE THE CONFIGURATION OF YOUR PHPWIKI, DO *NOT* MODIFY THIS FILE!
262 * more instructions go here
266 * * eval config.ini to get the actual settings.
269 //////////////////////////////
270 // begin configuration options
273 * Notes for the description parameter of $property:
275 * - Descriptive text will be changed into comments (preceeded by ; )
276 * for the final output to config.ini.
278 * - Only a limited set of html is allowed: pre, dl dt dd; it will be
279 * stripped from the final output.
281 * - Line breaks and spacing will be preserved for the final output.
283 * - Double line breaks are automatically converted to paragraphs
284 * for the html version of the descriptive text.
286 * - Double-quotes and dollar signs in the descriptive text must be
287 * escaped: \" and \$. Instead of escaping double-quotes you can use
288 * single (') quotes for the enclosing quotes.
290 * - Special characters like < and > must use html entities,
291 * they will be converted back to characters for the final output.
294 $SEPARATOR = ";=========================================================================";
297 ; This is the main configuration file for PhpWiki in INI-style format.
298 ; Note that certain characters are used as comment char and therefore
299 ; these entries must be in double-quotes. Such as \":\", \";\", \",\" and \"|\"
300 ; Take special care for DBAUTH_ sql statements. (Part 3a)
302 ; This file is divided into several parts: Each one has different configuration
303 ; settings you can change; in all cases the default should work on your system,
304 ; however, we recommend you tailor things to your particular setting.
307 $properties["Part Zero"] =
308 new part('_part0', $SEPARATOR."\n", "
309 Part Zero: (optional)
310 Latest Development and Tricky Options");
312 if (defined('INCLUDE_PATH'))
313 $include_path = INCLUDE_PATH;
315 if (substr(PHP_OS,0,3) == 'WIN') {
316 $include_path = dirname(__FILE__) . ';' . ini_get('include_path');
317 if (strchr(ini_get('include_path'),'/'))
318 $include_path = strtr($include_path,'\\','/');
320 $include_path = dirname(__FILE__) . ':' . ini_get('include_path');
324 $properties["PHP include_path"] =
325 new _define('INCLUDE_PATH', $include_path, "
326 If PHP needs help in finding where you installed the rest of the PhpWiki
327 code, you can set the include_path here.
329 Override the PHP include path so that it can find some needed additional libraries.
330 You shouldn't need to do this unless your system include_path esp. your
331 system pear libs are broken or oudated. The PHPWIKI_DIR is automatically
332 put to the front and the local lib/pear path is automatically added to the end.
333 But if you define it, be sure to include either the system pear path or
334 the phpwiki/lib/pear path to override your Pear_DB.
335 Note that on Windows-based servers, you should use ; rather than :
336 as the path separator.");
338 // TODO: convert this a checkbox row as in tests/unit/test.pgp
339 $properties["DEBUG"] =
340 new numeric_define_optional('DEBUG', DEBUG, "
341 Set DEBUG to 1 to view the XHTML and CSS validator icons, page
342 processing timer, and possibly other debugging messages at the
343 bottom of each page. 65 for a more verbose level with AUTH hints.
344 See lib/config.php for all supported values.");
346 // TODO: bring the default to the front
347 $properties["ENABLE_USER_NEW"] =
348 new boolean_define_commented_optional
350 array('true' => "Enabled",
351 'false' => "Disabled."), "
352 Enable the new method of handling WikiUser Authetincation and Preferences.
353 It's best to leave it on, and only disable it if you have problems with it.
354 Servers with memory-limit problems might want to turn it off. It costs ~300KB
357 $properties["ENABLE_PAGEPERM"] =
358 new boolean_define_commented_optional
360 array('true' => "Enabled",
361 'false' => "Disabled."), "
362 Use access control lists (as in Solaris and Windows NTFS) per page and group,
363 not per user for the whole wiki.
365 I suspect ACL page permissions to degrade speed by 10%.
366 GROUP_METHOD=WIKIPAGE is slowest. (See Part 3a)
369 $properties["ENABLE_EDIT_TOOLBAR"] =
370 new boolean_define_commented_optional
371 ('ENABLE_EDIT_TOOLBAR',
372 array('true' => "Enabled",
373 'false' => "Disabled."), "
374 Graphical buttons on edit. Default: true.
375 Reportedly broken on MacOSX Safari");
377 $properties["JS_SEARCHREPLACE"] =
378 new boolean_define_commented_optional
380 array('true' => "Enabled",
381 'false' => "Disabled"), "
382 Adds two additional buttons in EDIT_TOOLBAR, Search&Replace and Undo.
383 Undo is experimental.");
385 $properties["ENABLE_DOUBLECLICKEDIT"] =
386 new boolean_define_commented_optional
387 ('ENABLE_DOUBLECLICKEDIT',
388 array('true' => "Enabled",
389 'false' => "Disabled"), "
392 $properties["ENABLE_XHTML_XML"] =
393 new boolean_define_commented_optional
395 array('false' => "Disabled",
396 'true' => "Enabled"), "
397 Needed for inlined SVG and MathM, but may conflict with javascript:document.write().
398 Experimental. Default: false");
400 $properties["USECACHE"] =
401 new boolean_define_commented_optional
403 array('true' => "Enabled",
404 'false' => "Disabled"), "
405 Store DB query results in memory to avoid duplicate queries.
406 Disable only for old php's with low memory or memory_limit=8MB.
409 $properties["ENABLE_SPAMASSASSIN"] =
410 new boolean_define_commented_optional
411 ('ENABLE_SPAMASSASSIN',
412 array('true' => "Enabled",
413 'false' => "Disabled"), "
414 Needs babycart installed. See http://phpwiki.org/SpamAssassinIntegration
415 Optionally define BABYCART_PATH. Default: /usr/local/bin/babycart");
417 $properties["GOOGLE_LINKS_NOFOLLOW"] =
418 new boolean_define_commented_optional
419 ('GOOGLE_LINKS_NOFOLLOW',
420 array('true' => "Enabled",
421 'false' => "Disabled"), "
422 If enabled ref=nofollow is added to all external links to discourage spam.
423 You might want to turn it off, if you want to improve pageranks on external links.");
425 $properties["ENABLE_LIVESEARCH"] =
426 new boolean_define_commented_optional
427 ('ENABLE_LIVESEARCH',
428 array('true' => "Enabled",
429 'false' => "Disabled"), "
430 LiveSearch enables immediate title search results via XMLHttpRequest.
431 Displays the results in a dropdown under the titlesearch inputbox
432 while typing. (experimental, only with certain themes)
433 You'll have to copy livesearch.js from http://blog.bitflux.ch/wiki/LiveSearch
434 to themes/default/ and define ENABLE_LIVESEARCH in config.ini to true.
435 See themes/blog/themeinfo.php.
436 Currently we use the bitflux.ch library, but we will change to
437 the russian acdropdown soon. http://momche.net/publish/article.php?page=acdropdown");
439 $properties["USE_SAFE_DBSESSION"] =
440 new boolean_define_commented_optional
441 ('USE_SAFE_DBSESSION',
442 array('false' => "Disabled",
443 'true' => "Enabled"), "
444 USE_SAFE_DBSESSION should be enabled, if you encounter session problems, with duplicate INSERT
445 sess_id warnings at the bottom of the page. Reason is a unreliable affected_rows implementation()
446 in the sql backend. Default is Disabled, using the fastest DbSession UPDATE method.");
448 $properties["Part One"] =
449 new part('_part1', $SEPARATOR."\n", "
450 Part One: Authentication and security settings. See Part Three for more.");
452 $properties["Admin Username"] =
453 new _define_notempty('ADMIN_USER', ADMIN_USER, "
454 You must set this! Username and password of the administrator.",
455 "onchange=\"validate_ereg('Sorry, ADMIN_USER cannot be empty.', '^.+$', 'ADMIN_USER', this);\"");
457 $properties["Admin Password"] =
458 new _define_password('ADMIN_PASSWD', ADMIN_PASSWD, "
459 For heaven's sake pick a good password.
460 If your version of PHP supports encrypted passwords, your password will be
461 automatically encrypted within the generated config file.
462 Use the \"Create Random Password\" button to create a good (random) password.
464 ADMIN_PASSWD is ignored on HttpAuth",
465 "onchange=\"validate_ereg('Sorry, ADMIN_PASSWD must be at least 4 chars long.', '^....+$', 'ADMIN_PASSWD', this);\"");
467 $properties["Encrypted Passwords"] =
470 array('true' => "true. use crypt for all passwords",
471 'false' => "false. use plaintest passwords (not recommended)"), "
472 It is recommended that you use encrypted passwords to be stored in the
473 config.ini and the users homepages metadata.
474 You might want to use the passencrypt.php utility to encode the
475 admin password, in the event that someone gains ftp or ssh access to the
476 server and directory containing phpwiki.
477 <i>SQL access passwords cannot be encrypted, besides using external DATABASE_DSN aliases within PDO.</i>
479 If true, all user passwords will be stored encrypted.
480 You might have to set it to false, if your PHP doesn't support crypt().
483 $properties["Wiki Name"] =
484 new _define_optional('WIKI_NAME', WIKI_NAME, "
485 The name of your wiki.
487 This is used to generate a keywords meta tag in the HTML templates,
488 in bookmark titles for any bookmarks made to pages in your wiki,
489 and during RSS generation for the title of the RSS channel.
491 It is recommended this be a relatively short WikiWord like the
492 InterWiki monikers found in the InterWikiMap. (For examples, see
496 $properties["Reverse DNS"] =
497 new boolean_define_optional
498 ('ENABLE_REVERSE_DNS',
499 array('true' => "true. perform additional reverse dns lookups",
500 'false' => "false. just record the address as given by the httpd server"),
502 If set, we will perform reverse dns lookups to try to convert the
503 users IP number to a host name, even if the http server didn't do it for us.");
505 $properties["ZIPdump Authentication"] =
506 new boolean_define_optional('ZIPDUMP_AUTH',
507 array('false' => "false. Everyone may download zip dumps",
508 'true' => "true. Only admin may download zip dumps"), "
509 If true, only the admin user can make zip dumps, else zip dumps
510 require no authentication.");
512 $properties["Enable RawHtml Plugin"] =
513 new boolean_define_commented_optional
515 array('true' => "Enabled",
516 'false' => "Disabled"), "
517 The RawHtml plugin allows page authors to embed real, raw HTML into Wiki
518 pages. This is a possible security threat, as much HTML (or, rather,
519 JavaScript) can be very risky. If you are in a controlled environment,
520 however, it could be of use.");
522 $properties["Allow RawHtml Plugin only on locked pages"] =
523 new boolean_define_commented_optional
524 ('ENABLE_RAW_HTML_LOCKEDONLY',
525 array('true' => "Enabled",
526 'false' => "Disabled"), "
527 If this is set, only pages locked by the Administrator may contain the RawHtml plugin.");
529 $properties["Allow RawHtml Plugin if safe HTML code"] =
530 new boolean_define_commented_optional
531 ('ENABLE_RAW_HTML_SAFE',
532 array('true' => "Enabled",
533 'false' => "Disabled"), "
534 If this is set, all unsafe html code is stripped automatically (experimental!)
535 See <a href=\"http://chxo.com/scripts/safe_html-test.php\" target=\"_new\">chxo.com/scripts/safe_html-test.php</a>
538 $properties["Maximum Upload Size"] =
539 new numeric_define_optional('MAX_UPLOAD_SIZE', MAX_UPLOAD_SIZE /*"16 * 1024 * 1024"*/, "
540 The maximum file upload size.");
542 $properties["Minor Edit Timeout"] =
543 new numeric_define_optional('MINOR_EDIT_TIMEOUT', MINOR_EDIT_TIMEOUT /*"7 * 24 * 3600"*/, "
544 If the last edit is older than MINOR_EDIT_TIMEOUT seconds, the
545 default state for the \"minor edit\" checkbox on the edit page form
548 $properties["Disabled Actions"] =
549 new array_define('DISABLED_ACTIONS', DISABLED_ACTIONS /*array()*/, "
550 Actions listed in this array will not be allowed. Actions are:
551 browse, create, diff, dumphtml, dumpserial, edit, loadfile, lock, remove,
552 unlock, upload, viewsource, zip, ziphtml");
554 $properties["Access Log File"] =
555 new _define_commented_optional('ACCESS_LOG', ACCESS_LOG /*"/var/logs/wiki_access.log"*/, "
556 PhpWiki can generate an access_log (in \"NCSA combined log\" format)
557 for you. If you want one, define this to the name of the log file,
558 such as /tmp/wiki_access_log. Preferred is to use SQL access logging as below.
560 Default: empty - no access log file will be generated.");
562 $properties["Access Log SQL"] =
563 new _define_selection(
565 array('0' => 'disable',
567 '2' => 'read + write'), "
568 PhpWiki can read and/or write apache-style mod_log_sql accesslog tables for faster
569 abuse detection and referer lists.
570 See http://www.outoforder.cc/projects/apache/mod_log_sql/docs-2.0/#id2756178
572 If defined (e.g. 1) only read-access is done via SQL.
573 If flag 2 is set, phpwiki also writes. (Default on SQL or ADODB)
574 This must use DATABASE_TYPE = SQL or ADODB.
577 $properties["Compress Output"] =
578 new boolean_define_commented_optional
580 array('' => 'GZIP compress when PhpWiki thinks appropriate.',
581 'false' => 'Never compress output.',
582 'true' => 'Always try to compress output.'),
584 By default PhpWiki will try to have PHP compress it's output
585 before sending it to the browser (if you have a recent enough
586 version of PHP and the action and the browser supports it.)
588 Define COMPRESS_OUTPUT to false to prevent output compression at all.
590 Define COMPRESS_OUTPUT to true to force output compression,
591 even if we think your version of PHP does this in a buggy
594 Leave it undefined to leave the choice up to PhpWiki.");
596 $properties["HTTP Cache Control"] =
597 new _define_selection_optional
599 array('LOOSE' => 'LOOSE',
600 'STRICT' => 'STRICT',
601 'NO_CACHE' => 'NO_CACHE',
602 'ALLOW_STALE' => 'ALLOW_STALE'),
606 This controls how PhpWiki sets the HTTP cache control
607 headers (Expires: and Cache-Control:)
613 <dd>This is roughly the old (pre 1.3.4) behaviour. PhpWiki will
614 instruct proxies and browsers never to cache PhpWiki output.</dd>
617 <dd>Cached pages will be invalidated whenever the database global
618 timestamp changes. This should behave just like NONE (modulo
619 bugs in PhpWiki and your proxies and browsers), except that
620 things will be slightly more efficient.</dd>
623 <dd>Cached pages will be invalidated whenever they are edited,
624 or, if the pages include plugins, when the plugin output could
625 concievably have changed.
627 <p>Behavior should be much like STRICT, except that sometimes
628 wikilinks will show up as undefined (with the question mark)
629 when in fact they refer to (recently) created pages.
630 (Hitting your browsers reload or perhaps shift-reload button
631 should fix the problem.)</p></dd>
634 <dd>Proxies and browsers will be allowed to used stale pages.
635 (The timeout for stale pages is controlled by CACHE_CONTROL_MAX_AGE.)
637 <p>This setting will result in quirky behavior. When you edit a
638 page your changes may not show up until you shift-reload the
641 <p>This setting is generally not advisable, however it may be useful
642 in certain cases (e.g. if your wiki gets lots of page views,
643 and few edits by knowledgable people who won't freak over the quirks.)</p>
646 The default is currently LOOSE.");
648 // FIXME: should be numeric_define_optional
649 $properties["HTTP Cache Control Max Age"] =
650 new numeric_define_optional('CACHE_CONTROL_MAX_AGE', CACHE_CONTROL_MAX_AGE,
652 Maximum page staleness, in seconds.");
654 $properties["Markup Caching"] =
655 new boolean_define_commented_optional
656 ('WIKIDB_NOCACHE_MARKUP',
657 array('false' => 'Enable markup cache',
658 'true' => 'Disable markup cache'),
662 PhpWiki normally caches a preparsed version (i.e. mostly
663 converted to HTML) of the most recent version of each page.
664 (Parsing the wiki-markup takes a fair amount of CPU.)
666 Define WIKIDB_NOCACHE_MARKUP to true to disable the
667 caching of marked-up page content.
669 Note that you can also disable markup caching on a per-page
670 temporary basis by addinging a query arg of '?nocache=1'
671 to the URL to the page. (Use '?nocache=purge' to completely
672 discard the cached version of the page.)
674 You can also purge the cached markup globally by using the
675 \"Purge Markup Cache\" button on the PhpWikiAdministration page.");
677 $properties["Path for PHP Session Support"] =
678 new _define_optional('SESSION_SAVE_PATH', defined('SESSION_SAVE_PATH') ? SESSION_SAVE_PATH : ini_get('session.save_path'), "
679 The login code now uses PHP session support. Usually, the default
680 configuration of PHP is to store the session state information in
681 /tmp. That probably will work fine, but fails e.g. on clustered
682 servers where each server has their own distinct /tmp (this is the
683 case on SourceForge's project web server.) You can specify an
684 alternate directory in which to store state information like so
685 (whatever user your httpd runs as must have read/write permission
688 On USE_DB_SESSION = true you can ignore this.
691 ///////// database selection
693 $properties["Part Two"] =
694 new part('_part2', $SEPARATOR."\n", "
697 Database Configuration
700 $properties["Database Type"] =
701 new _define_selection("DATABASE_TYPE",
702 array('dba' => "dba",
704 'ADODB' => "SQL ADODB",
705 'PDO' => "PDO (php5 only)",
706 'file' => "flatfile",
707 'cvs' => "CVS File handler"), "
708 Select the database backend type:
709 Choose dba (default) to use one of the standard UNIX dba libraries. This is the fastest.
710 Choose ADODB or SQL to use an SQL database with ADODB or PEAR.
711 Choose PDO on php5 to use an SQL database.
712 flatfile is simple and slow.
713 CVS is highly experimental and slow.
714 Recommended is dba or SQL: PEAR or ADODB.");
716 $properties["SQL DSN Setup"] =
717 new unchangeable_variable('_sqldsnstuff', "", "
718 For SQL based backends, specify the database as a DSN
719 The most general form of a DSN looks like:
721 phptype(dbsyntax)://username:password@protocol+hostspec/database?option=value
723 For a MySQL database, the following should work:
725 mysql://user:password@host/databasename
727 To connect over a unix socket, use something like
729 mysql://user:password@unix(/path/to/socket)/databasename
732 DATABASE_DSN = mysql://guest@:/var/lib/mysql/mysql.sock/phpwiki
733 DATABASE_DSN = mysql://guest@localhost/phpwiki
734 DATABASE_DSN = pgsql://localhost/user_phpwiki
737 // Choose ADODB or SQL to use an SQL database with ADODB or PEAR.
738 // Choose dba to use one of the standard UNIX dbm libraries.
740 $properties["SQL Type"] =
741 new _variable_selection('_dsn_sqltype',
742 array('mysql' => "MySQL",
743 'pgsql' => "PostgreSQL",
744 'mssql' => "Microsoft SQL Server",
745 'oci8' => "Oracle 8",
746 'mysqli' => "mysqli (only ADODB)",
747 'mysqlt' => "mysqlt (only ADODB)",
748 'ODBC' => "ODBC (only ADODB or PDO)",
749 'firebird' => "Firebird (only PDO)",
750 'oracle' => "Oracle (only PDO)",
752 SQL DB types. The DSN hosttype.");
754 $properties["SQL User"] =
755 new _variable('_dsn_sqluser', "wikiuser", "
758 $properties["SQL Password"] =
759 new _variable('_dsn_sqlpass', "", "
762 $properties["SQL Database Host"] =
763 new _variable('_dsn_sqlhostorsock', "localhost", "
764 SQL Database Hostname:
766 To connect over a local named socket, use something like
768 unix(/var/lib/mysql/mysql.sock)
771 mysql on Windows via named pipes might need 127.0.0.1");
773 $properties["SQL Database Name"] =
774 new _variable('_dsn_sqldbname', "phpwiki", "
775 SQL Database Name:");
777 $dsn_sqltype = $properties["SQL Type"]->value();
778 $dsn_sqluser = $properties["SQL User"]->value();
779 $dsn_sqlpass = $properties["SQL Password"]->value();
780 $dsn_sqlhostorsock = $properties["SQL Database Host"]->value();
781 $dsn_sqldbname = $properties["SQL Database Name"]->value();
782 $dsn_sqlstring = $dsn_sqltype."://{$dsn_sqluser}:{$dsn_sqlpass}@{$dsn_sqlhostorsock}/{$dsn_sqldbname}";
784 $properties["SQL dsn"] =
785 new unchangeable_define("DATABASE_DSN",
786 "DATABASE_DSN = \"$dsn_sqlstring\"", "
787 Calculated from the settings above:");
789 $properties["Filename / Table name Prefix"] =
790 new _define_commented("DATABASE_PREFIX", DATABASE_PREFIX, "
791 Used by all DB types:
793 Prefix for filenames or table names, e.g. \"phpwiki_\"
795 Currently <b>you MUST EDIT THE SQL file too!</b> (in the schemas/
796 directory because we aren't doing on the fly sql generation
797 during the installation.");
799 $properties["DB Session table"] =
800 new _define_optional("DATABASE_SESSION_TABLE", DATABASE_SESSION_TABLE, "
801 Tablename to store session information. Only supported by SQL backends.
803 A word of warning - any prefix defined above will be prepended to whatever is given here.
807 $temp = !empty($_ENV['TEMP']) ? $_ENV['TEMP'] : "/tmp";
808 $properties["dba directory"] =
809 new _define("DATABASE_DIRECTORY", $temp, "
812 // TODO: list the available methods
813 $properties["dba handler"] =
814 new _define_selection('DATABASE_DBA_HANDLER',
815 array('gdbm' => "Gdbm - GNU database manager (recommended)",
816 'dbm' => "DBM - Redhat default. On sf.net there's dbm and gdbm",
817 'db2' => "DB2 - Sleepycat Software's DB2",
818 'db3' => "DB3 - Sleepycat Software's DB3. Default on Windows but not on every Linux",
819 'db4' => "DB4 - Sleepycat Software's DB4."), "
820 Use 'gdbm', 'dbm', 'db2', 'db3' or 'db4' depending on your DBA handler methods supported: <br > "
821 . (function_exists("dba_handlers") ? join(", ",dba_handlers()) : ""));
823 $properties["dba timeout"] =
824 new numeric_define("DATABASE_TIMEOUT", DATABASE_TIMEOUT, "
825 Recommended values are 10-20 seconds. The more load the server has, the higher the timeout.");
827 $properties["DATABASE_PERSISTENT"] =
828 new boolean_define_commented_optional
829 ('DATABASE_PERSISTENT',
830 array('false' => "Disabled",
831 'true' => "Enabled"), "
832 Use persistent database connections for SQL databases, if the database backend supports it.
833 Not recommended for heavily loaded servers.
838 $properties["Page Revisions"] =
839 new unchangeable_variable('_parttworevisions', "", "
841 Section 2a: Archive Cleanup
842 The next section controls how many old revisions of each page are kept in the database.
844 There are two basic classes of revisions: major and minor. Which
845 class a revision belongs in is determined by whether the author
846 checked the \"this is a minor revision\" checkbox when they saved the
849 There is, additionally, a third class of revisions: author
850 revisions. The most recent non-mergable revision from each distinct
851 author is and author revision.
853 The expiry parameters for each of those three classes of revisions
854 can be adjusted seperately. For each class there are five
855 parameters (usually, only two or three of the five are actually
856 set) which control how long those revisions are kept in the
859 <dt>max_keep:</dt> <dd>If set, this specifies an absolute maximum for the
860 number of archived revisions of that class. This is
861 meant to be used as a safety cap when a non-zero
862 min_age is specified. It should be set relatively high,
863 and it's purpose is to prevent malicious or accidental
864 database overflow due to someone causing an
865 unreasonable number of edits in a short period of time.</dd>
867 <dt>min_age:</dt> <dd>Revisions younger than this (based upon the supplanted
868 date) will be kept unless max_keep is exceeded. The age
869 should be specified in days. It should be a
870 non-negative, real number,</dd>
872 <dt>min_keep:</dt> <dd>At least this many revisions will be kept.</dd>
874 <dt>keep:</dt> <dd>No more than this many revisions will be kept.</dd>
876 <dt>max_age:</dt> <dd>No revision older than this age will be kept.</dd>
878 Supplanted date: Revisions are timestamped at the instant that they
879 cease being the current revision. Revision age is computed using
880 this timestamp, not the edit time of the page.
882 Merging: When a minor revision is deleted, if the preceding
883 revision is by the same author, the minor revision is merged with
884 the preceding revision before it is deleted. Essentially: this
885 replaces the content (and supplanted timestamp) of the previous
886 revision with the content after the merged minor edit, the rest of
887 the page metadata for the preceding version (summary, mtime, ...)
891 // For now the expiration parameters are statically inserted as
892 // an unchangeable property. You'll have to edit the resulting
893 // config file if you really want to change these from the default.
895 $properties["Major Edits: keep minumum days"] =
896 new numeric_define("MAJOR_MIN_KEEP", MAJOR_MIN_KEEP, "
897 Default: Keep at least for unlimited time.
898 Set to 0 to enable archive cleanup");
899 $properties["Minor Edits: keep minumum days"] =
900 new numeric_define("MINOR_MIN_KEEP", MINOR_MIN_KEEP, "
901 Default: Keep at least for unlimited time.
902 Set to 0 to enable archive cleanup");
904 $properties["Major Edits: how many"] =
905 new numeric_define("MAJOR_KEEP", MAJOR_KEEP, "
906 Keep up to 8 major edits");
907 $properties["Major Edits: how many days"] =
908 new numeric_define("MAJOR_MAX_AGE", MAJOR_MAX_AGE, "
909 keep them no longer than a month");
911 $properties["Minor Edits: how many"] =
912 new numeric_define("MINOR_KEEP", MINOR_KEEP, "
913 Keep up to 4 minor edits");
914 $properties["Minor Edits: how many days"] =
915 new numeric_define("MINOR_MAX_AGE", "7", "
916 keep them no longer than a week");
918 $properties["per Author: how many"] =
919 new numeric_define("AUTHOR_KEEP", "8", "
920 Keep the latest contributions of the last 8 authors,");
921 $properties["per Author: how many days"] =
922 new numeric_define("AUTHOR_MAX_AGE", "365", "
924 $properties["per Author: keep minumum days"] =
925 new numeric_define("AUTHOR_MIN_AGE", "7", "
926 Additionally, (in the case of a particularly active page) try to
927 keep the latest contributions of all authors in the last week (even if there are more than eight of them,)");
928 $properties["per Author: max revisions"] =
929 new numeric_define("AUTHOR_MAX_KEEP", "20", "
930 but in no case keep more than twenty unique author revisions.");
932 /////////////////////////////////////////////////////////////////////
934 $properties["Part Three"] =
935 new part('_part3', $SEPARATOR."\n", "
937 Part Three: (optional)
938 Basic User Authentication Setup
941 $properties["Publicly viewable"] =
942 new boolean_define_optional('ALLOW_ANON_USER',
943 array('true' => "true. Permit anonymous view. (Default)",
944 'false' => "false. Force login even on view (strictly private)"), "
945 If ALLOW_ANON_USER is false, you have to login before viewing any page or doing any other action on a page.");
947 $properties["Allow anonymous edit"] =
948 new boolean_define_optional('ALLOW_ANON_EDIT',
949 array('true' => "true. Permit anonymous users to edit. (Default)",
950 'false' => "false. Force login on edit (moderately locked)"), "
951 If ALLOW_ANON_EDIT is false, you have to login before editing or changing any page. See below.");
953 $properties["Allow Bogo Login"] =
954 new boolean_define_optional('ALLOW_BOGO_LOGIN',
955 array('true' => "true. Users may Sign In with any WikiWord, without password. (Default)",
956 'false' => "false. Require stricter authentication."), "
957 If ALLOW_BOGO_LOGIN is false, you may not login with any wikiword username and empty password.
958 If true, users are allowed to create themselves with any WikiWord username. See below.");
960 $properties["Allow User Passwords"] =
961 new boolean_define_optional('ALLOW_USER_PASSWORDS',
962 array('true' => "True user authentication with password checking. (Default)",
963 'false' => "false. Ignore authentication settings below."), "
964 If ALLOW_USER_PASSWORDS is true, the authentication settings below define where and how to
965 check against given username/passwords. For completely security disable BOGO_LOGIN and ANON_EDIT above.");
967 $properties["Allow User Passwords"] =
968 new array_define('USER_AUTH_ORDER', array("PersonalPage", "Db"), "
969 Many different methods can be used to check user's passwords.
970 Try any of these in the given order:
973 <dd>WikiWord username, with no *actual* password checking,
974 although the user will still have to enter one.</dd>
975 <dt>PersonalPage</dt>
976 <dd>Store passwords in the users homepage metadata (simple)</dd>
978 <dd>Use DBAUTH_AUTH_* (see below) with PearDB or ADODB only.</dd>
980 <dd>Authenticate against LDAP_AUTH_HOST with LDAP_BASE_DN</dd>
982 <dd>Authenticate against IMAP_AUTH_HOST (email account)</dd>
984 <dd>Authenticate against POP3_AUTH_HOST (email account)</dd>
986 <dd>Get username and level from a PHP session variable. (e.g. for gforge)</dd>
988 <dd>Store username:crypted-passwords in .htaccess like files.
989 Use Apache's htpasswd to manage this file.</dd>
991 <dd>Use the protection by the webserver (.htaccess/.htpasswd) (experimental)
992 Enforcing HTTP Auth not yet. Note that the ADMIN_USER should exist also.
993 Using HttpAuth disables all other methods and no userauth sessions are used.</dd>
996 Several of these methods can be used together, in the manner specified by
997 USER_AUTH_POLICY, below. To specify multiple authentication methods,
998 separate the name of each one with colons.
1000 USER_AUTH_ORDER = 'PersonalPage : Db'
1001 USER_AUTH_ORDER = 'BogoLogin : PersonalPage'</pre>");
1003 $properties["PASSWORD_LENGTH_MINIMUM"] =
1004 new numeric_define("PASSWORD_LENGTH_MINIMUM", "6", "
1005 For 'security' purposes, you can specify that a password be at least a
1006 certain number of characters long. This applies even to the BogoLogin method.
1007 Default: 0 (to allow immediate passwordless BogoLogin)");
1009 $properties["USER_AUTH_POLICY"] =
1010 new _define_selection('USER_AUTH_POLICY',
1011 array('first-only' => "first-only - use only the first method in USER_AUTH_ORDER",
1012 'old' => "old - ignore USER_AUTH_ORDER (legacy)",
1013 'strict' => "strict - check all methods for userid + password (recommended)",
1014 'stacked' => "stacked - check all methods for userid, and if found for password"), "
1015 The following policies are available for user authentication:
1018 <dd>use only the first method in USER_AUTH_ORDER</dd>
1020 <dd>ignore USER_AUTH_ORDER and try to use all available
1021 methods as in the previous PhpWiki releases (slow)</dd>
1023 <dd>check if the user exists for all methods:
1024 on the first existing user, try the password.
1025 dont try the other methods on failure then</dd>
1027 <dd>check the given user - password combination for all
1028 methods and return true on the first success.</dd></dl>");
1032 $properties["Part Three A"] =
1033 new part('_part3a', $SEPARATOR."\n", "
1035 Part Three A: (optional)
1038 $properties["Group membership"] =
1039 new _define_selection("GROUP_METHOD",
1040 array('WIKIPAGE' => "WIKIPAGE - List at \"CategoryGroup\". (Slowest, but easiest to maintain)",
1041 '"NONE"' => "NONE - Disable group membership (Fastest)",
1042 'DB' => "DB - SQL Database, Optionally external. See USERS/GROUPS queries",
1043 'FILE' => "Flatfile. See AUTH_GROUP_FILE below.",
1044 'LDAP' => "LDAP - See \"LDAP authentication options\" above. (Experimental)"), "
1045 Group membership. PhpWiki supports defining permissions for a group as
1046 well as for individual users. This defines how group membership information
1047 is obtained. Supported values are:
1050 <dd>Disable group membership (Fastest). Note the required quoting.</dd>
1052 <dd>Define groups as list at \"CategoryGroup\". (Slowest, but easiest to maintain)</dd>
1054 <dd>Stored in an SQL database. Optionally external. See USERS/GROUPS queries</dd>
1056 <dd>Flatfile. See AUTH_GROUP_FILE below.</dd>
1058 <dd>LDAP groups. See \"LDAP authentication options\" above and
1059 lib/WikiGroup.php. (experimental)</dd></dl>");
1061 $properties["CATEGORY_GROUP_PAGE"] =
1062 new _define_optional('CATEGORY_GROUP_PAGE', _("CategoryGroup"), "
1063 If GROUP_METHOD = WIKIPAGE:
1065 Page where all groups are listed.");
1067 $properties["AUTH_GROUP_FILE"] =
1068 new _define_optional('AUTH_GROUP_FILE', _("/etc/groups"), "
1069 For GROUP_METHOD = FILE, the file given below is referenced to obtain
1070 group membership information. It should be in the same format as the
1071 standard unix /etc/groups(5) file.");
1073 $properties["Part Three B"] =
1074 new part('_part3b', $SEPARATOR."\n", "
1076 Part Three B: (optional)
1077 External database authentication and authorization.
1079 If USER_AUTH_ORDER includes Db, or GROUP_METHOD = DB, the options listed
1080 below define the SQL queries used to obtain the information out of the
1081 database, and (optionally) store the information back to the DB.");
1083 $properties["DBAUTH_AUTH_DSN"] =
1084 new _define_optional('DBAUTH_AUTH_DSN', $dsn_sqlstring, "
1085 A database DSN to connect to. Defaults to the DSN specified for the Wiki as a whole.");
1087 $properties["User Exists Query"] =
1088 new _define('DBAUTH_AUTH_USER_EXISTS', "SELECT userid FROM user WHERE userid='\$userid'", "
1089 USER/PASSWORD queries:
1091 For USER_AUTH_POLICY=strict and the Db method is required");
1093 $properties["Check Query"] =
1094 new _define_optional('DBAUTH_AUTH_CHECK', "SELECT IF(passwd='\$password',1,0) AS ok FROM user WHERE userid='\$userid'", "
1096 Check to see if the supplied username/password pair is OK
1098 Plaintext passwords: (DBAUTH_AUTH_CRYPT_METHOD = plain)<br>
1099 ; DBAUTH_AUTH_CHECK = \"SELECT IF(passwd='\$password',1,0) AS ok FROM user WHERE userid='\$userid'\"
1101 database-hashed passwords (more secure):<br>
1102 ; DBAUTH_AUTH_CHECK = \"SELECT IF(passwd=PASSWORD('\$password'),1,0) AS ok FROM user WHERE userid='\$userid'\"");
1104 $properties["Crypt Method"] =
1105 new _define_selection_optional
1106 ('DBAUTH_AUTH_CRYPT_METHOD',
1107 array('plain' => 'plain',
1108 'crypt' => 'crypt'), "
1109 If you want to use Unix crypt()ed passwords, you can use DBAUTH_AUTH_CHECK
1110 to get the password out of the database with a simple SELECT query, and
1111 specify DBAUTH_AUTH_USER_EXISTS and DBAUTH_AUTH_CRYPT_METHOD:
1113 ; DBAUTH_AUTH_CHECK = \"SELECT passwd FROM user where userid='\$userid'\" <br>
1114 ; DBAUTH_AUTH_CRYPT_METHOD = crypt");
1116 $properties["Update the user's authentication credential"] =
1117 new _define('DBAUTH_AUTH_UPDATE', "UPDATE user SET passwd='\$password' WHERE userid='\$userid'", "
1118 If this is not defined but DBAUTH_AUTH_CHECK is, then the user will be unable to update their
1121 Plaintext passwords:<br>
1122 DBAUTH_AUTH_UPDATE = \"UPDATE user SET passwd='\$password' WHERE userid='\$userid'\"<br>
1123 Database-hashed passwords:<br>
1124 DBAUTH_AUTH_UPDATE = \"UPDATE user SET passwd=PASSWORD('\$password') WHERE userid='\$userid'\"");
1126 $properties["Allow the user to create their own account"] =
1127 new _define_optional('DBAUTH_AUTH_CREATE', "INSERT INTO user SET passwd=PASSWORD('\$password'),userid='\$userid'", "
1128 If this is empty, Db users cannot subscribe by their own.");
1130 $properties["USER/PREFERENCE queries"] =
1131 new _define_optional('DBAUTH_PREF_SELECT', "SELECT prefs FROM user WHERE userid='\$userid'", "
1132 If you choose to store your preferences in an external database, enable
1133 the following queries. Note that if you choose to store user preferences
1134 in the 'user' table, only registered users get their prefs from the database,
1135 self-created users do not. Better to use the special 'pref' table.
1137 The prefs field stores the serialized form of the user's preferences array,
1138 to ease the complication of storage.
1140 DBAUTH_PREF_SELECT = \"SELECT prefs FROM user WHERE userid='\$userid'\"
1141 DBAUTH_PREF_SELECT = \"SELECT prefs FROM pref WHERE userid='\$userid'\"
1144 $properties["Update the user's preferences"] =
1145 new _define_optional('DBAUTH_PREF_UPDATE', "UPDATE user SET prefs='\$pref_blob' WHERE userid='\$userid'", "
1146 Note that REPLACE works only with mysql and destroy all other columns!
1148 Mysql: DBAUTH_PREF_UPDATE = \"REPLACE INTO pref SET prefs='\$pref_blob',userid='\$userid'\"");
1150 $properties["USERS/GROUPS queries"] =
1151 new _define_optional('DBAUTH_IS_MEMBER', "SELECT user FROM user WHERE user='\$userid' AND group='\$groupname'", "
1152 You can define 1:n or n:m user<=>group relations, as you wish.
1154 Sample configurations:
1156 only one group per user (1:n):<br>
1157 DBAUTH_IS_MEMBER = \"SELECT user FROM user WHERE user='\$userid' AND group='\$groupname'\"<br>
1158 DBAUTH_GROUP_MEMBERS = \"SELECT user FROM user WHERE group='\$groupname'\"<br>
1159 DBAUTH_USER_GROUPS = \"SELECT group FROM user WHERE user='\$userid'\"<br>
1160 multiple groups per user (n:m):<br>
1161 DBAUTH_IS_MEMBER = \"SELECT userid FROM member WHERE userid='\$userid' AND groupname='\$groupname'\"<br>
1162 DBAUTH_GROUP_MEMBERS = \"SELECT DISTINCT userid FROM member WHERE groupname='\$groupname'\"<br>
1163 DBAUTH_USER_GROUPS = \"SELECT groupname FROM member WHERE userid='\$userid'\"<br>");
1164 $properties["DBAUTH_GROUP_MEMBERS"] =
1165 new _define_optional('DBAUTH_GROUP_MEMBERS', "SELECT user FROM user WHERE group='\$groupname'", "");
1166 $properties["DBAUTH_USER_GROUPS"] =
1167 new _define_optional('DBAUTH_USER_GROUPS', "SELECT group FROM user WHERE user='\$userid'", "");
1169 if (function_exists('ldap_connect')) {
1171 $properties["LDAP AUTH Host"] =
1172 new _define_optional('LDAP_AUTH_HOST', "ldap://localhost:389", "
1173 If USER_AUTH_ORDER contains Ldap:
1175 The LDAP server to connect to. Can either be a hostname, or a complete
1176 URL to the server (useful if you want to use ldaps or specify a different
1179 $properties["LDAP BASE DN"] =
1180 new _define_optional('LDAP_BASE_DN', "ou=mycompany.com,o=My Company", "
1181 The organizational or domain BASE DN: e.g. \"dc=mydomain,dc=com\".
1183 Note: ou=Users and ou=Groups are used for GroupLdap Membership
1184 Better use LDAP_OU_USERS and LDAP_OU_GROUP with GROUP_METHOD=LDAP.");
1186 $properties["LDAP SET OPTION"] =
1187 new _define_optional('LDAP_SET_OPTION', "LDAP_OPT_PROTOCOL_VERSION=3:LDAP_OPT_REFERRALS=0", "
1188 Some LDAP servers need some more options, such as the Windows Active
1189 Directory Server. Specify the options (as allowed by the PHP LDAP module)
1190 and their values as NAME=value pairs separated by colons.");
1192 $properties["LDAP AUTH USER"] =
1193 new _define_optional('LDAP_AUTH_USER', "CN=ldapuser,ou=Users,o=Development,dc=mycompany.com", "
1194 DN to initially bind to the LDAP server as. This is needed if the server doesn't
1195 allow anonymous queries. (Windows Active Directory Server)");
1197 $properties["LDAP AUTH PASSWORD"] =
1198 new _define_optional('LDAP_AUTH_PASSWORD', "secret", "
1199 Password to use to initially bind to the LDAP server, as the DN
1200 specified in the LDAP_AUTH_USER option (above).");
1202 $properties["LDAP SEARCH FIELD"] =
1203 new _define_optional('LDAP_SEARCH_FIELD', "uid", "
1204 If you want to match usernames against an attribute other than uid,
1205 specify it here. Default: uid
1207 e.g.: LDAP_SEARCH_FIELD = sAMAccountName");
1209 $properties["LDAP OU USERS"] =
1210 new _define_optional('LDAP_OU_USERS', "ou=Users", "
1211 If you have an organizational unit for all users, define it here.
1212 This narrows the search, and is needed for LDAP group membership (if GROUP_METHOD=LDAP)
1213 Default: ou=Users");
1215 $properties["LDAP OU GROUP"] =
1216 new _define_optional('LDAP_OU_GROUP', "ou=Groups", "
1217 If you have an organizational unit for all groups, define it here.
1218 This narrows the search, and is needed for LDAP group membership (if GROUP_METHOD=LDAP)
1219 The entries in this ou must have a gidNumber and cn attribute.
1220 Default: ou=Groups");
1222 } else { // function_exists('ldap_connect')
1224 $properties["LDAP Authentication"] =
1225 new unchangeable_define('LDAP Authentication', "
1226 If USER_AUTH_ORDER contains Ldap:
1228 The LDAP server to connect to. Can either be a hostname, or a complete
1229 URL to the server (useful if you want to use ldaps or specify a different
1231 ;LDAP_AUTH_HOST = \"ldap://localhost:389\"
1233 ; The organizational or domain BASE DN: e.g. \"dc=mydomain,dc=com\".
1235 ; Note: ou=Users and ou=Groups are used for GroupLdap Membership
1236 ; Better use LDAP_OU_USERS and LDAP_OU_GROUP with GROUP_METHOD=LDAP.
1237 ;LDAP_BASE_DN = \"ou=Users,o=Development,dc=mycompany.com\"
1239 ; Some LDAP servers need some more options, such as the Windows Active
1240 ; Directory Server. Specify the options (as allowed by the PHP LDAP module)
1241 ; and their values as NAME=value pairs separated by colons.
1242 ; LDAP_SET_OPTION = \"LDAP_OPT_PROTOCOL_VERSION=3:LDAP_OPT_REFERRALS=0\"
1244 ; DN to initially bind to the LDAP server as. This is needed if the server doesn't
1245 ; allow anonymous queries. (Windows Active Directory Server)
1246 ; LDAP_AUTH_USER = \"CN=ldapuser,ou=Users,o=Development,dc=mycompany.com\"
1248 ; Password to use to initially bind to the LDAP server, as the DN
1249 ; specified in the LDAP_AUTH_USER option (above).
1250 ; LDAP_AUTH_PASSWORD = secret
1252 ; If you want to match usernames against an attribute other than uid,
1253 ; specify it here. Default: uid
1254 ; LDAP_SEARCH_FIELD = sAMAccountName
1256 ; If you have an organizational unit for all users, define it here.
1257 ; This narrows the search, and is needed for LDAP group membership (if GROUP_METHOD=LDAP)
1259 ; LDAP_OU_USERS = ou=Users
1261 ; If you have an organizational unit for all groups, define it here.
1262 ; This narrows the search, and is needed for LDAP group membership (if GROUP_METHOD=LDAP)
1263 ; The entries in this ou must have a gidNumber and cn attribute.
1264 ; Default: ou=Groups
1265 ; LDAP_OU_GROUP = ou=Groups", "
1266 ; Ignored. No LDAP support in this php. configure --with-ldap");
1269 if (function_exists('imap_open')) {
1271 $properties["IMAP Auth Host"] =
1272 new _define_optional('IMAP_AUTH_HOST', 'localhost:143/imap/notls', "
1273 If USER_AUTH_ORDER contains IMAP:
1275 The IMAP server to check usernames from. Defaults to localhost.
1277 Some IMAP_AUTH_HOST samples:
1278 localhost, localhost:143/imap/notls,
1279 localhost:993/imap/ssl/novalidate-cert (SuSE refuses non-SSL conections)");
1281 } else { // function_exists('imap_open')
1283 $properties["IMAP Authentication"] =
1284 new unchangeable_define('IMAP_AUTH_HOST',"
1285 ; If USER_AUTH_ORDER contains IMAP:
1286 ; The IMAP server to check usernames from. Defaults to localhost.
1288 ; Some IMAP_AUTH_HOST samples:
1289 ; localhost, localhost:143/imap/notls,
1290 ; localhost:993/imap/ssl/novalidate-cert (SuSE refuses non-SSL conections)
1291 ;IMAP_AUTH_HOST = localhost:143/imap/notls", "
1292 Ignored. No IMAP support in this php. configure --with-imap");
1296 $properties["POP3 Authentication"] =
1297 new _define_optional('POP3_AUTH_HOST', 'localhost:110', "
1298 If USER_AUTH_ORDER contains POP3:
1300 The POP3 mail server to check usernames and passwords against.");
1301 $properties["File Authentication"] =
1302 new _define_optional('AUTH_USER_FILE', '/etc/shadow', "
1303 If USER_AUTH_ORDER contains File:
1305 File to read for authentication information.
1306 Popular choices are /etc/shadow and /etc/httpd/.htpasswd");
1308 $properties["File Storable?"] =
1309 new boolean_define_commented_optional
1310 ('AUTH_USER_FILE_STORABLE',
1311 array('false' => "Disabled",
1312 'true' => "Enabled"), "
1313 Defines whether the user is able to change their own password via PhpWiki.
1314 Note that this means that the webserver user must be able to write to the
1315 file specified in AUTH_USER_FILE.");
1317 $properties["Session Auth USER"] =
1318 new _define_optional('AUTH_SESS_USER', 'userid', "
1319 If USER_AUTH_ORDER contains Session:
1321 Name of the session variable which holds the already authenticated username.
1322 Sample: 'userid', 'user[username]', 'user->username'");
1324 $properties["Session Auth LEVEL"] =
1325 new numeric_define('AUTH_SESS_LEVEL', '2', "
1326 Which level will the user be? 1 = Bogo or 2 = Pass");
1328 /////////////////////////////////////////////////////////////////////
1330 $properties["Part Four"] =
1331 new part('_part4', $SEPARATOR."\n", "
1334 Page appearance and layout");
1336 $properties["Theme"] =
1337 new _define_selection_optional('THEME',
1338 array('default' => "default",
1339 'MacOSX' => "MacOSX",
1340 'smaller' => 'smaller',
1341 'Wordpress'=> 'Wordpress',
1342 'Portland' => "Portland",
1343 'Hawaiian' => "Hawaiian",
1344 'Sidebar' => "Sidebar",
1346 'wikilens' => 'wikilens (Ratings)',
1347 'SpaceWiki' => "SpaceWiki",
1348 'shamino_com' => 'shamino_com',
1349 'MonoBook' => 'MonoBook [experimental]',
1350 'blog' => 'blog [experimental]',
1354 Most of the page appearance is controlled by files in the theme
1357 There are a number of pre-defined themes shipped with PhpWiki.
1358 Or you may create your own (e.g. by copying and then modifying one of
1363 THEME = MonoBook (WikiPedia) [experimental. MSIE problems]
1364 THEME = blog (Kubrick) [experimental. Several links missing]
1367 $properties["Character Set"] =
1368 new _define_optional('CHARSET', 'iso-8859-1', "
1369 Select a valid charset name to be inserted into the xml/html pages,
1370 and to reference links to the stylesheets (css). For more info see:
1371 http://www.iana.org/assignments/character-sets. Note that PhpWiki
1372 has been extensively tested only with the latin1 (iso-8859-1)
1375 If you change the default from iso-8859-1 PhpWiki may not work
1376 properly and it will require code modifications. However, character
1377 sets similar to iso-8859-1 may work with little or no modification
1378 depending on your setup. The database must also support the same
1379 charset, and of course the same is true for the web browser. (Some
1380 work is in progress hopefully to allow more flexibility in this
1381 area in the future).");
1383 $properties["Language"] =
1384 new _define_selection_optional('DEFAULT_LANGUAGE',
1385 array('en' => "English",
1386 '' => "<empty> (user-specific)",
1387 'fr' => "Français",
1389 'nl' => "Nederlands",
1394 'zh' => "Chinese"), "
1395 Select your language/locale - default language is \"en\" for English.
1396 Other languages available:<pre>
1397 English \"en\" (English - HomePage)
1398 German \"de\" (Deutsch - StartSeite)
1399 French \"fr\" (Français - Accueil)
1400 Dutch \"nl\" (Nederlands - ThuisPagina)
1401 Spanish \"es\" (Español - PáginaPrincipal)
1402 Swedish \"sv\" (Svenska - Framsida)
1403 Italian \"it\" (Italiano - PaginaPrincipale)
1404 Japanese \"ja\" (Japanese - ¥Û¡¼¥à ¥Ú¡¼¥¸)
1405 Chinese \"zh\" (Chinese)
1407 If you set DEFAULT_LANGUAGE to the empty string, your systems default language
1408 (as determined by the applicable environment variables) will be
1411 $properties["Wiki Page Source"] =
1412 new _define_optional('WIKI_PGSRC', 'pgsrc', "
1413 WIKI_PGSRC -- specifies the source for the initial page contents of
1414 the Wiki. The setting of WIKI_PGSRC only has effect when the wiki is
1415 accessed for the first time (or after clearing the database.)
1416 WIKI_PGSRC can either name a directory or a zip file. In either case
1417 WIKI_PGSRC is scanned for files -- one file per page.
1419 // Default (old) behavior:
1420 define('WIKI_PGSRC', 'pgsrc');
1422 define('WIKI_PGSRC', 'wiki.zip');
1423 define('WIKI_PGSRC',
1424 '../Logs/Hamwiki/hamwiki-20010830.zip');
1428 $properties["Default Wiki Page Source"] =
1429 new _define('DEFAULT_WIKI_PGSRC', 'pgsrc', "
1430 DEFAULT_WIKI_PGSRC is only used when the language is *not* the
1431 default (English) and when reading from a directory: in that case
1432 some English pages are inserted into the wiki as well.
1433 DEFAULT_WIKI_PGSRC defines where the English pages reside.
1435 FIXME: is this really needed?
1438 $properties["Generic Pages"] =
1439 new array_variable('GenericPages', array('ReleaseNotes', 'SteveWainstead', 'TestPage'), "
1440 These are the pages which will get loaded from DEFAULT_WIKI_PGSRC.
1442 FIXME: is this really needed? Cannot we just copy these pages into
1443 the localized pgsrc?
1449 $properties["Part Five"] =
1450 new part('_part5', $SEPARATOR."\n", "
1455 $properties["Allowed Protocols"] =
1456 new list_define('ALLOWED_PROTOCOLS', 'http|https|mailto|ftp|news|nntp|ssh|gopher', "
1457 Allowed protocols for links - be careful not to allow \"javascript:\"
1458 URL of these types will be automatically linked.
1459 within a named link [name|uri] one more protocol is defined: phpwiki");
1461 $properties["Inline Images"] =
1462 new list_define('INLINE_IMAGES', 'png|jpg|gif', "
1463 URLs ending with the following extension should be inlined as images.
1464 Scripts shoud not be allowed!");
1466 $properties["WikiName Regexp"] =
1467 new _define('WIKI_NAME_REGEXP', "(?<![[:alnum:]])(?:[[:upper:]][[:lower:]]+){2,}(?![[:alnum:]])", "
1468 Perl regexp for WikiNames (\"bumpy words\")
1469 (?<!..) & (?!...) used instead of '\b' because \b matches '_' as well");
1471 $properties["Subpage Separator"] =
1472 new _define_optional('SUBPAGE_SEPARATOR', '"/"', "
1473 One character which seperates pages from subpages. Defaults to '/', but '.' or ':' were also used.",
1474 "onchange=\"validate_ereg('Sorry, \'%s\' must be a single character. Currently only :, / or .', '^[/:.]$', 'SUBPAGE_SEPARATOR', this);\""
1477 $properties["InterWiki Map File"] =
1478 new _define('INTERWIKI_MAP_FILE', 'lib/interwiki.map', "
1479 InterWiki linking -- wiki-style links to other wikis on the web
1481 The map will be taken from a page name InterWikiMap.
1482 If that page is not found (or is not locked), or map
1483 data can not be found in it, then the file specified
1484 by INTERWIKI_MAP_FILE (if any) will be used.");
1486 $properties["WARN_NONPUBLIC_INTERWIKIMAP"] =
1487 new boolean_define('WARN_NONPUBLIC_INTERWIKIMAP',
1488 array('true' => "true",
1489 'false' => "false"), "
1490 Display a warning if the internal lib/interwiki.map is used, and
1491 not the public InterWikiMap page. This map is not readable from outside.");
1494 $properties["Keyword Link Regexp"] =
1495 new _define_optional('KEYWORDS', '\"Category* OR Topic*\"', "
1496 Search term used for automatic page classification by keyword extraction.
1498 Any links on a page to pages whose names match this search
1499 will be used keywords in the keywords html meta tag. This is an aid to
1500 classification by search engines. The value of the match is
1501 used as the keyword.
1503 The default behavior is to match Category* or Topic* links.");
1505 $properties["Author and Copyright Site Navigation Links"] =
1506 new _define_commented_optional('COPYRIGHTPAGE_TITLE', "GNU General Public License", "
1508 These will be inserted as <link rel> tags in the html header of
1509 every page, for search engines and for browsers like Mozilla which
1510 take advantage of link rel site navigation.
1512 If you have your own copyright and contact information pages change
1513 these as appropriate.");
1515 $properties["COPYRIGHTPAGE URL"] =
1516 new _define_commented_optional('COPYRIGHTPAGE_URL', "http://www.gnu.org/copyleft/gpl.html#SEC1", "
1518 Other useful alternatives to consider:
1520 COPYRIGHTPAGE_TITLE = \"GNU Free Documentation License\"
1521 COPYRIGHTPAGE_URL = \"http://www.gnu.org/copyleft/fdl.html\"
1522 COPYRIGHTPAGE_TITLE = \"Creative Commons License 2.0\"
1523 COPYRIGHTPAGE_URL = \"http://creativecommons.org/licenses/by/2.0/\"</pre>
1524 See http://creativecommons.org/learn/licenses/ for variations");
1526 $properties["AUTHORPAGE_TITLE"] =
1527 new _define_commented_optional('AUTHORPAGE_TITLE', "The PhpWiki Programming Team", "
1528 Default Author Names");
1529 $properties["AUTHORPAGE_URL"] =
1530 new _define_commented_optional('AUTHORPAGE_URL', "http://phpwiki.org/ThePhpWikiProgrammingTeam", "
1531 Default Author URL");
1533 new boolean_define_optional
1535 array('true' => "Enabled",
1536 'false' => "Disabled"), "
1537 Allow full markup in headers to be parsed by the CreateToc plugin.
1539 If false you may not use WikiWords or [] links or any other markup in
1540 headers in pages with the CreateToc plugin. But if false the parsing is
1541 faster and more stable.");
1545 $properties["Part Six"] =
1546 new part('_part6', $SEPARATOR."\n", "
1548 Part Six (optional):
1549 URL options -- you can probably skip this section.
1551 For a pretty wiki (no index.php in the url) set a seperate DATA_PATH.");
1553 global $HTTP_SERVER_VARS;
1554 $properties["Server Name"] =
1555 new _define_commented_optional('SERVER_NAME', $HTTP_SERVER_VARS['SERVER_NAME'], "
1556 Canonical name of the server on which this PhpWiki resides.");
1558 $properties["Server Port"] =
1559 new numeric_define_commented('SERVER_PORT', $HTTP_SERVER_VARS['SERVER_PORT'], "
1560 Canonical httpd port of the server on which this PhpWiki resides.",
1561 "onchange=\"validate_ereg('Sorry, \'%s\' is no valid port number.', '^[0-9]+$', 'SERVER_PORT', this);\"");
1563 $properties["Script Name"] =
1564 new _define_commented_optional('SCRIPT_NAME', $scriptname, "
1565 Relative URL (from the server root) of the PhpWiki script.");
1567 $properties["Data Path"] =
1568 new _define_commented_optional('DATA_PATH', dirname($scriptname), "
1569 URL of the PhpWiki install directory. (You only need to set this
1570 if you've moved index.php out of the install directory.) This can
1571 be either a relative URL (from the directory where the top-level
1572 PhpWiki script is) or an absolute one.");
1575 $properties["PhpWiki Install Directory"] =
1576 new _define_commented_optional('PHPWIKI_DIR', dirname(__FILE__), "
1577 Path to the PhpWiki install directory. This is the local
1578 filesystem counterpart to DATA_PATH. (If you have to set
1579 DATA_PATH, your probably have to set this as well.) This can be
1580 either an absolute path, or a relative path interpreted from the
1581 directory where the top-level PhpWiki script (normally index.php)
1584 $properties["Use PATH_INFO"] =
1585 new boolean_define_commented_optional('USE_PATH_INFO',
1586 array('true' => 'use PATH_INFO',
1587 'false' => 'do not use PATH_INFO'), "
1588 PhpWiki will try to use short urls to pages, eg
1589 http://www.example.com/index.php/HomePage
1590 If you want to use urls like
1591 http://www.example.com/index.php?pagename=HomePage
1592 then define 'USE_PATH_INFO' as false by uncommenting the line below.
1593 NB: If you are using Apache >= 2.0.30, then you may need to to use
1594 the directive \"AcceptPathInfo On\" in your Apache configuration file
1595 (or in an appropriate <.htaccess> file) for the short urls to work:
1596 See http://httpd.apache.org/docs-2.0/mod/core.html#acceptpathinfo
1598 See also http://phpwiki.sourceforge.net/phpwiki/PrettyWiki for more ideas
1599 on prettifying your urls.
1601 Default: PhpWiki will try to divine whether use of PATH_INFO
1602 is supported in by your webserver/PHP configuration, and will
1603 use PATH_INFO if it thinks that is possible.");
1605 $properties["Virtual Path"] =
1606 new _define_commented_optional('VIRTUAL_PATH', '/SomeWiki', "
1607 VIRTUAL_PATH is the canonical URL path under which your your wiki
1608 appears. Normally this is the same as dirname(SCRIPT_NAME), however
1609 using e.g. seperate starter scripts, apaches mod_actions (or mod_rewrite),
1610 you can make it something different.
1612 If you do this, you should set VIRTUAL_PATH here or in the starter scripts.
1614 E.g. your phpwiki might be installed at at /scripts/phpwiki/index.php,
1615 but you've made it accessible through eg. /wiki/HomePage.
1617 One way to do this is to create a directory named 'wiki' in your
1618 server root. The directory contains only one file: an .htaccess
1619 file which reads something like:
1621 Action x-phpwiki-page /scripts/phpwiki/index.php
1622 SetHandler x-phpwiki-page
1623 DirectoryIndex /scripts/phpwiki/index.php
1625 In that case you should set VIRTUAL_PATH to '/wiki'.
1627 (VIRTUAL_PATH is only used if USE_PATH_INFO is true.)
1632 $properties["Part Seven"] =
1633 new part('_part7', $SEPARATOR."\n", "
1637 Miscellaneous settings
1640 $properties["Strict Mailable Pagedumps"] =
1641 new boolean_define_optional
1642 ('STRICT_MAILABLE_PAGEDUMPS',
1643 array('false' => "binary",
1644 'true' => "quoted-printable"),
1646 If you define this to true, (MIME-type) page-dumps (either zip dumps,
1647 or \"dumps to directory\" will be encoded using the quoted-printable
1648 encoding. If you're actually thinking of mailing the raw page dumps,
1649 then this might be useful, since (among other things,) it ensures
1650 that all lines in the message body are under 80 characters in length.
1652 Also, setting this will cause a few additional mail headers
1653 to be generated, so that the resulting dumps are valid
1654 RFC 2822 e-mail messages.
1656 Probably, you can just leave this set to false, in which case you get
1657 raw ('binary' content-encoding) page dumps.");
1659 $properties["HTML Dump Filename Suffix"] =
1660 new _define_optional('HTML_DUMP_SUFFIX', ".html", "
1661 Here you can change the filename suffix used for XHTML page dumps.
1662 If you don't want any suffix just comment this out.");
1664 $properties["Default local Dump Directory"] =
1665 new _define_optional('DEFAULT_DUMP_DIR', "/tmp/wikidump", "
1666 Specify the default directory for local backups.");
1668 $properties["Default local HTML Dump Directory"] =
1669 new _define_optional('HTML_DUMP_DIR', "/tmp/wikidumphtml", "
1670 Specify the default directory for local XHTML dumps.");
1672 $properties["Pagename of Recent Changes"] =
1673 new _define_optional('RECENT_CHANGES', 'RecentChanges', "
1674 Page name of RecentChanges page. Used for RSS Auto-discovery.");
1676 $properties["Disable HTTP Redirects"] =
1677 new boolean_define_commented_optional
1678 ('DISABLE_HTTP_REDIRECT',
1679 array('false' => 'Enable HTTP Redirects',
1680 'true' => 'Disable HTTP Redirects'),
1682 (You probably don't need to touch this.)
1684 PhpWiki uses HTTP redirects for some of it's functionality.
1685 (e.g. after saving changes, PhpWiki redirects your browser to
1686 view the page you just saved.)
1688 Some web service providers (notably free European Lycos) don't seem to
1689 allow these redirects. (On Lycos the result in an \"Internal Server Error\"
1690 report.) In that case you can set DISABLE_HTTP_REDIRECT to true.
1691 (In which case, PhpWiki will revert to sneakier tricks to try to
1692 redirect the browser...)");
1694 $properties["Disable GETIMAGESIZE"] =
1695 new boolean_define_commented_optional
1696 ('DISABLE_GETIMAGESIZE',
1697 array('false' => 'Enable',
1698 'true' => 'Disable'), "
1699 Set GETIMAGESIZE to disabled, if your php fails to calculate the size on
1700 inlined images, or you don't want to disable too small images to be inlined.
1702 Per default too small ploaded or external images are not displayed,
1703 to prevent from external 1 pixel spam.");
1705 $properties["EDITING_POLICY"] =
1706 new _define_optional('EDITING_POLICY', "EditingPolicy", "
1707 An interim page which gets displayed on every edit attempt, if it exists.");
1709 $properties["ENABLE_MODERATEDPAGE_ALL"] =
1710 new boolean_define_commented_optional
1711 ('ENABLE_MODERATEDPAGE_ALL',
1712 array('false' => 'Disable',
1713 'true' => 'Enable'), "
1716 $properties["FORTUNE_DIR"] =
1717 new _define_commented_optional('FORTUNE_DIR', "/usr/share/fortune", "
1719 $properties["DBADMIN_USER"] =
1720 new _define_commented_optional('DBADMIN_USER', "", "
1722 $properties["DBADMIN_PASSWD"] =
1723 new _define_commented_optional('DBADMIN_PASSWD', "", "
1725 $properties["USE_EXTERNAL_HTML2PDF"] =
1726 new _define_commented_optional('USE_EXTERNAL_HTML2PDF', "htmldoc --quiet --format pdf14 --no-toc --no-title %s", "
1728 $properties["BABYCART_PATH"] =
1729 new _define_commented_optional('BABYCART_PATH', "/usr/local/bin/babycart", "
1732 $properties["Part Seven A"] =
1733 new part('_part7a', $SEPARATOR."\n", "
1737 Cached Plugin Settings. (pear Cache)
1740 $properties["pear Cache USECACHE"] =
1741 new boolean_define_optional('PLUGIN_CACHED_USECACHE',
1742 array('true' => 'Enabled',
1743 'false' => 'Disabled'), "
1744 Enable or disable pear caching of plugins.");
1745 $properties["pear Cache Database Container"] =
1746 new _define_selection_optional('PLUGIN_CACHED_DATABASE',
1747 array('file' => 'file'), "
1748 Curently only file is supported.
1749 db, trifile and imgfile might be supported, but you must hack that by yourself.");
1751 $properties["pear Cache cache directory"] =
1752 new _define_commented_optional('PLUGIN_CACHED_CACHE_DIR', "/tmp/cache", "
1753 Should be writable to the webserver.");
1754 $properties["pear Cache Filename Prefix"] =
1755 new _define_optional('PLUGIN_CACHED_FILENAME_PREFIX', "phpwiki", "");
1756 $properties["pear Cache HIGHWATER"] =
1757 new numeric_define_optional('PLUGIN_CACHED_HIGHWATER', "4194304", "
1758 Garbage collection parameter.");
1759 $properties["pear Cache LOWWATER"] =
1760 new numeric_define_optional('PLUGIN_CACHED_LOWWATER', "3145728", "
1761 Garbage collection parameter.");
1762 $properties["pear Cache MAXLIFETIME"] =
1763 new numeric_define_optional('PLUGIN_CACHED_MAXLIFETIME', "2592000", "
1764 Garbage collection parameter.");
1765 $properties["pear Cache MAXARGLEN"] =
1766 new numeric_define_optional('PLUGIN_CACHED_MAXARGLEN', "1000", "
1767 max. generated url length.");
1768 $properties["pear Cache FORCE_SYNCMAP"] =
1769 new boolean_define_optional('PLUGIN_CACHED_FORCE_SYNCMAP',
1770 array('true' => 'Enabled',
1771 'false' => 'Disabled'), "");
1772 $properties["pear Cache IMGTYPES"] =
1773 new list_define('PLUGIN_CACHED_IMGTYPES', "png|gif|gd|gd2|jpeg|wbmp|xbm|xpm", "
1774 Handle those image types via GD handles. Check your GD supported image types.");
1776 $end = "\n".$SEPARATOR."\n";
1778 // end of configuration options
1779 ///////////////////////////////
1780 // begin class definitions
1783 * A basic config-dist.ini configuration line in the form of a variable.
1784 * (not needed anymore, we have only defines)
1786 * Produces a string in the form "$name = value;"
1788 * $WikiNameRegexp = "value";
1792 var $config_item_name;
1798 function _variable($config_item_name, $default_value, $description, $jscheck = '') {
1799 $this->config_item_name = $config_item_name;
1800 $this->description = $description;
1801 if (defined($config_item_name)
1802 and !preg_match("/(selection|boolean)/", get_class($this))
1803 and !preg_match("/(SCRIPT_NAME|VIRTUAL_PATH)/", $config_item_name))
1804 $this->default_value = constant($config_item_name); // ignore given default value
1806 $this->default_value = $default_value;
1807 $this->jscheck = $jscheck;
1808 if (preg_match("/variable/i",get_class($this)))
1809 $this->prefix = "\$";
1810 elseif (preg_match("/ini_set/i",get_class($this)))
1811 $this->prefix = "ini_get: ";
1817 global $HTTP_POST_VARS;
1818 if (isset($HTTP_POST_VARS[$this->config_item_name]))
1819 return $HTTP_POST_VARS[$this->config_item_name];
1821 return $this->default_value;
1824 function _config_format($value) {
1825 $v = $this->get_config_item_name();
1826 // handle arrays: a|b --> a['b']
1827 if (strpos($v, '|')) {
1828 list($a, $b) = explode('|', $v);
1829 $v = sprintf("%s['%s']", $a, $b);
1831 if (preg_match("/[\"']/", $value))
1832 $value = '"' . $value . '"';
1833 return sprintf("%s = \"%s\"", $v, $value);
1836 function get_config_item_name() {
1837 return $this->config_item_name;
1840 function get_config_item_id() {
1841 return str_replace('|', '-', $this->config_item_name);
1844 function get_config_item_header() {
1845 if (strchr($this->config_item_name,'|')) {
1846 list($var,$param) = explode('|',$this->config_item_name);
1847 return "<b>" . $this->prefix . $var . "['" . $param . "']</b><br />";
1849 elseif ($this->config_item_name[0] != '_')
1850 return "<b>" . $this->prefix . $this->config_item_name . "</b><br />";
1855 function _get_description() {
1856 return $this->description;
1859 function _get_config_line($posted_value) {
1860 return "\n" . $this->_config_format($posted_value);
1863 function get_config($posted_value) {
1864 $d = stripHtml($this->_get_description());
1865 $d = str_replace("\n", "\n; ", $d) . $this->_get_config_line($posted_value) ."\n";
1869 function get_instructions($title) {
1871 $i = "<h3>" . $title . "</h3>\n " . nl2p($this->_get_description()) . "\n";
1872 return "<tr>\n<td width=\"$tdwidth\" class=\"instructions\">\n" . $i . "</td>\n";
1875 function get_html() {
1876 $size = strlen($this->default_value) > 45 ? 90 : 50;
1877 return $this->get_config_item_header() .
1878 "<input type=\"text\" size=\"$50\" name=\"" . $this->get_config_item_name() . "\" value=\"" . htmlspecialchars($this->default_value) . "\" " .
1879 $this->jscheck . " />" . "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: green\">Input accepted.</p>";
1883 class unchangeable_variable
1885 function _config_format($value) {
1888 // function get_html() { return false; }
1889 function get_html() {
1890 return $this->get_config_item_header() .
1891 "<em>Not editable.</em>" .
1892 "<pre>" . $this->default_value."</pre>";
1894 function _get_config_line($posted_value) {
1895 if ($this->description)
1897 return "${n}".$this->default_value;
1899 function get_instructions($title) {
1901 $i = "<h3>" . $title . "</h3>\n " . nl2p($this->_get_description()) . "\n";
1902 // $i .= "<em>Not editable.</em><br />\n<pre>" . $this->default_value."</pre>";
1903 return '<tr><td width="100%" class="unchangeable-variable-top" colspan="2">'."\n".$i."</td></tr>\n"
1904 . '<tr style="border-top: none;"><td class="unchangeable-variable-left" width="'.$tdwidth.'"> </td>';
1908 class unchangeable_define
1909 extends unchangeable_variable {
1910 function _config_format($value) {
1914 class unchangeable_ini_set
1915 extends unchangeable_variable {
1916 function _config_format($value) {
1921 class _variable_selection
1924 global $HTTP_POST_VARS;
1925 if (!empty($HTTP_POST_VARS[$this->config_item_name]))
1926 return $HTTP_POST_VARS[$this->config_item_name];
1928 list($option, $label) = each($this->default_value);
1932 function get_html() {
1933 $output = $this->get_config_item_header();
1934 $output .= '<select name="' . $this->get_config_item_name() . "\">\n";
1935 /* The first option is the default */
1936 $values = $this->default_value;
1937 if (defined($this->get_config_item_name()))
1938 $this->default_value = constant($this->get_config_item_name());
1940 $this->default_value = null;
1941 while(list($option, $label) = each($values)) {
1942 if (!is_null($this->default_value) and $this->default_value === $option)
1943 $output .= " <option value=\"$option\" selected=\"selected\">$label</option>\n";
1945 $output .= " <option value=\"$option\">$label</option>\n";
1947 $output .= "</select>\n";
1955 function _config_format($value) {
1956 return sprintf("%s = \"%s\"", $this->get_config_item_name(), $value);
1958 function _get_config_line($posted_value) {
1959 if ($this->description)
1961 if ($posted_value == '')
1962 return "${n};" . $this->_config_format("");
1964 return "${n}" . $this->_config_format($posted_value);
1966 function get_html() {
1967 $size = strlen($this->default_value) > 45 ? 90 : 50;
1968 return $this->get_config_item_header()
1969 . "<input type=\"text\" size=\"$size\" name=\"" . htmlentities($this->get_config_item_name())
1970 . "\" value=\"" . htmlentities($this->default_value) . "\" {$this->jscheck} />"
1971 . "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: green\">Input accepted.</p>";
1975 class _define_commented
1977 function _get_config_line($posted_value) {
1978 if ($this->description)
1980 if ($posted_value == $this->default_value)
1981 return "${n};" . $this->_config_format($posted_value);
1982 elseif ($posted_value == '')
1983 return "${n};" . $this->_config_format("");
1985 return "${n}" . $this->_config_format($posted_value);
1990 * We don't use _optional anymore, because INI-style config's don't need that.
1991 * IniConfig.php does the optional logic now.
1992 * But we use _optional for config-default.ini options
1994 class _define_commented_optional
1995 extends _define_commented { }
1997 class _define_optional
2000 class _define_notempty
2002 function get_html() {
2003 $s = $this->get_config_item_header()
2004 . "<input type=\"text\" size=\"50\" name=\"" . $this->get_config_item_name()
2005 . "\" value=\"" . $this->default_value . "\" {$this->jscheck} />";
2006 if (empty($this->default_value))
2007 return $s . "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: red\">Cannot be empty.</p>";
2009 return $s . "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: green\">Input accepted.</p>";
2013 class _variable_commented
2015 function _get_config_line($posted_value) {
2016 if ($this->description)
2018 if ($posted_value == $this->default_value)
2019 return "${n};" . $this->_config_format($posted_value);
2020 elseif ($posted_value == '')
2021 return "${n};" . $this->_config_format("");
2023 return "${n}" . $this->_config_format($posted_value);
2027 class numeric_define
2030 function numeric_define($config_item_name, $default_value, $description, $jscheck = '') {
2031 $this->_define($config_item_name, $default_value, $description, $jscheck);
2033 $this->jscheck = "onchange=\"validate_ereg('Sorry, \'%s\' is not an integer.', '^[-+]?[0-9]+$', '" . $this->get_config_item_name() . "', this);\"";
2035 function _config_format($value) {
2036 //return sprintf("define('%s', %s);", $this->get_config_item_name(), $value);
2037 return sprintf("%s = %s", $this->get_config_item_name(), $value);
2039 function _get_config_line($posted_value) {
2040 if ($this->description)
2042 if ($posted_value == '')
2043 return "${n};" . $this->_config_format('0');
2045 return "${n}" . $this->_config_format($posted_value);
2049 class numeric_define_optional
2050 extends numeric_define {}
2052 class numeric_define_commented
2053 extends numeric_define {
2054 function _get_config_line($posted_value) {
2055 if ($this->description)
2057 if ($posted_value == $this->default_value)
2058 return "${n};" . $this->_config_format($posted_value);
2059 elseif ($posted_value == '')
2060 return "${n};" . $this->_config_format('0');
2062 return "${n}" . $this->_config_format($posted_value);
2066 class _define_selection
2067 extends _variable_selection {
2068 function _config_format($value) {
2069 return sprintf("%s = %s", $this->get_config_item_name(), $value);
2071 function _get_config_line($posted_value) {
2072 return _define::_get_config_line($posted_value);
2074 function get_html() {
2075 return _variable_selection::get_html();
2079 class _define_selection_optional
2080 extends _define_selection { }
2082 class _variable_selection_optional
2083 extends _variable_selection { }
2085 class _define_password
2088 function _define_password($config_item_name, $default_value, $description, $jscheck = '') {
2089 $this->_define($config_item_name, $default_value, $description, $jscheck);
2091 $this->jscheck = "onchange=\"validate_ereg('Sorry, \'%s\' cannot be empty.', '^.+$', '" . $this->get_config_item_name() . "', this);\"";
2093 function _get_config_line($posted_value) {
2094 if ($this->description)
2096 if ($posted_value == '') {
2097 $p = "${n};" . $this->_config_format("");
2098 $p .= "\n; If you used the passencrypt.php utility to encode the password";
2099 $p .= "\n; then uncomment this line:";
2100 $p .= "\n;ENCRYPTED_PASSWD = true";
2103 if (function_exists('crypt')) {
2104 $salt_length = max(CRYPT_SALT_LENGTH,
2108 16 * CRYPT_BLOWFISH);
2109 // generate an encrypted password
2110 $crypt_pass = crypt($posted_value, rand_ascii($salt_length));
2111 $p = "${n}" . $this->_config_format($crypt_pass);
2112 return $p . "\nENCRYPTED_PASSWD = true";
2114 $p = "${n}" . $this->_config_format($posted_value);
2115 $p .= "\n; Encrypted passwords cannot be used:";
2116 $p .= "\n; 'function crypt()' not available in this version of php";
2117 $p .= "\nENCRYPTED_PASSWD = false";
2122 function get_html() {
2123 return _variable_password::get_html();
2127 class _define_password_optional
2128 extends _define_password { }
2130 class _variable_password
2132 function _variable_password($config_item_name, $default_value, $description, $jscheck = '') {
2133 $this->_define($config_item_name, $default_value, $description, $jscheck);
2135 $this->jscheck = "onchange=\"validate_ereg('Sorry, \'%s\' cannot be empty.', '^.+$', '" . $this->get_config_item_name() . "', this);\"";
2137 function get_html() {
2138 global $HTTP_POST_VARS, $HTTP_GET_VARS;
2139 $s = $this->get_config_item_header();
2140 if (isset($HTTP_POST_VARS['create']) or isset($HTTP_GET_VARS['create'])) {
2141 $new_password = random_good_password();
2142 $this->default_value = $new_password;
2143 $s .= "Created password: <strong>$new_password</strong><br /> <br />";
2145 $s .= "<input type=\"password\" name=\"" . $this->get_config_item_name()
2146 . "\" value=\"" . $this->default_value
2147 . "\" {$this->jscheck} />"
2148 . " <input type=\"submit\" name=\"create\" value=\"Create Random Password\" />";
2149 if (empty($this->default_value))
2150 $s .= "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: red\">Cannot be empty.</p>";
2151 elseif (strlen($this->default_value) < 4)
2152 $s .= "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: red\">Must be longer than 4 chars.</p>";
2154 $s .= "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: green\">Input accepted.</p>";
2161 function _get_config_line($posted_value) {
2162 // split the phrase by any number of commas or space characters,
2163 // which include " ", \r, \t, \n and \f
2164 $list_values = preg_split("/[\s,]+/", $posted_value, -1, PREG_SPLIT_NO_EMPTY);
2165 $list_values = join("|", $list_values);
2166 return _variable::_get_config_line($list_values);
2168 function get_html() {
2169 $list_values = explode("|", $this->default_value);
2170 $rows = max(3, count($list_values) +1);
2171 $list_values = join("\n", $list_values);
2172 $ta = $this->get_config_item_header();
2173 $ta .= "<textarea cols=\"18\" rows=\"". $rows ."\" name=\"".$this->get_config_item_name()."\" {$this->jscheck}>";
2174 $ta .= $list_values . "</textarea>";
2175 $ta .= "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: green\">Input accepted.</p>";
2182 function _get_config_line($posted_value) {
2183 $list_values = preg_split("/[\s,]+/", $posted_value, -1, PREG_SPLIT_NO_EMPTY);
2184 $list_values = join("|", $list_values);
2185 return _variable::_get_config_line($list_values);
2187 function get_html() {
2188 $list_values = explode("|", $this->default_value);
2189 $rows = max(3, count($list_values) +1);
2190 $list_values = join("\n", $list_values);
2191 $ta = $this->get_config_item_header();
2192 $ta .= "<textarea cols=\"18\" rows=\"". $rows ."\" name=\"".$this->get_config_item_name()."\" {$this->jscheck}>";
2193 $ta .= $list_values . "</textarea>";
2194 $ta .= "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: green\">Input accepted.</p>";
2199 class array_variable
2201 function _config_format($value) {
2202 return sprintf("%s = \"%s\"", $this->get_config_item_name(),
2203 is_array($value) ? join(':', $value) : $value);
2205 function _get_config_line($posted_value) {
2206 // split the phrase by any number of commas or space characters,
2207 // which include " ", \r, \t, \n and \f
2208 $list_values = preg_split("/[\s,]+/", $posted_value, -1, PREG_SPLIT_NO_EMPTY);
2209 if (!empty($list_values)) {
2210 $list_values = "'".join("', '", $list_values)."'";
2211 return "\n" . $this->_config_format($list_values);
2213 return "\n;" . $this->_config_format('');
2215 function get_html() {
2216 $list_values = join("\n", $this->default_value);
2217 $rows = max(3, count($this->default_value) +1);
2218 $ta = $this->get_config_item_header();
2219 $ta .= "<textarea cols=\"18\" rows=\"". $rows ."\" name=\"".$this->get_config_item_name()."\" {$this->jscheck}>";
2220 $ta .= $list_values . "</textarea>";
2221 $ta .= "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: green\">Input accepted.</p>";
2228 function _config_format($value) {
2229 return sprintf("%s = \"%s\"", $this->get_config_item_name(),
2230 is_array($value) ? join(' : ', $value) : $value);
2232 function _get_config_line($posted_value) {
2233 // split the phrase by any number of commas or space characters,
2234 // which include " ", \r, \t, \n and \f
2235 $list_values = preg_split("/[\s,:]+/", $posted_value, -1, PREG_SPLIT_NO_EMPTY);
2236 if (!empty($list_values)) {
2237 $list_values = "'".join("' : '", $list_values)."'";
2238 return "\n" . $this->_config_format($list_values);
2240 return "\n;" . $this->_config_format('');
2242 function get_html() {
2243 $list_values = join("\n", $this->default_value);
2244 $rows = max(3, count($this->default_value) +1);
2245 $ta = $this->get_config_item_header();
2246 $ta .= "<textarea cols=\"18\" rows=\"". $rows ."\" name=\"".$this->get_config_item_name()."\" {$this->jscheck}>";
2247 $ta .= $list_values . "</textarea>";
2248 $ta .= "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: green\">Input accepted.</p>";
2257 global $HTTP_POST_VARS;
2258 if ($v = $HTTP_POST_VARS[$this->config_item_name])
2261 return ini_get($this->get_config_item_name);
2264 function _config_format($value) {
2265 return sprintf("ini_set('%s', '%s');", $this->get_config_item_name(), $value);
2267 function _get_config_line($posted_value) {
2268 if ($posted_value && ! $posted_value == $this->default_value)
2269 return "\n" . $this->_config_format($posted_value);
2271 return "\n;" . $this->_config_format($this->default_value);
2276 class boolean_define
2278 function _get_config_line($posted_value) {
2279 if ($this->description)
2281 return "${n}" . $this->_config_format($posted_value);
2283 function _config_format($value) {
2284 if (strtolower(trim($value)) == 'false')
2286 return sprintf("%s = %s", $this->get_config_item_name(),
2287 (bool)$value ? 'true' : 'false');
2289 function get_html() {
2290 $output = $this->get_config_item_header();
2291 $output .= '<select name="' . $this->get_config_item_name() . "\" {$this->jscheck}>\n";
2292 $values = $this->default_value;
2293 if (defined($this->get_config_item_name()))
2294 $this->default_value = constant($this->get_config_item_name());
2296 $this->default_value = null;
2297 list($option, $label) = each($values);
2298 $output .= " <option value=\"$option\" selected=\"selected\">$label</option>\n";
2300 /* There can usually, only be two options, there can be
2301 * three options in the case of a boolean_define_commented_optional */
2302 while (list($option, $label) = each($values)) {
2303 if (!is_null($this->default_value) and $this->default_value === $option)
2304 $output .= " <option value=\"$option\" selected=\"selected\">$label</option>\n";
2306 $output .= " <option value=\"$option\">$label</option>\n";
2308 $output .= "</select>\n";
2313 class boolean_define_optional
2314 extends boolean_define {}
2316 class boolean_define_commented
2317 extends boolean_define {
2318 function _get_config_line($posted_value) {
2319 if ($this->description)
2321 list($default_value, $label) = each($this->default_value);
2322 if ($posted_value == $default_value)
2323 return "${n};" . $this->_config_format($posted_value);
2324 elseif ($posted_value == '')
2325 return "${n};" . $this->_config_format('false');
2327 return "${n}" . $this->_config_format($posted_value);
2331 class boolean_define_commented_optional
2332 extends boolean_define_commented {}
2336 function value () { return; }
2337 function get_config($posted_value) {
2338 $d = stripHtml($this->_get_description());
2340 return "\n".$SEPARATOR . str_replace("\n", "\n; ", $d) ."\n".$this->default_value;
2342 function get_instructions($title) {
2343 $id = preg_replace("/\W/","",$this->config_item_name);
2344 $group_name = preg_replace("/\W/","",$title);
2345 $i = "<tr class=\"header\" id=\"$id\">\n<td class=\"part\" width=\"100%\" colspan=\"2\" bgcolor=\"#eeeeee\">\n";
2346 $i .= "<h2>" . $title . "</h2>\n " . nl2p($this->_get_description()) ."\n";
2347 $i .= "<p><a href=\"javascript:toggle_group('$id')\" id=\"{$id}_text\">Hide options.</a></p>";
2348 return $i ."</td>\n";
2350 function get_html() {
2355 // html utility functions
2356 function nl2p($text) {
2357 preg_match_all("@\s*(<pre>.*?</pre>|<dl>.*?</dl>|.*?(?=\n\n|<pre>|<dl>|$))@s",
2358 $text, $m, PREG_PATTERN_ORDER);
2361 foreach ($m[1] as $par) {
2362 if (!($par = trim($par)))
2364 if (!preg_match('/^<(pre|dl)>/', $par))
2365 $par = "<p>$par</p>";
2371 function stripHtml($text) {
2372 $d = str_replace("<pre>", "", $text);
2373 $d = str_replace("</pre>", "", $d);
2374 $d = str_replace("<dl>", "", $d);
2375 $d = str_replace("</dl>", "", $d);
2376 $d = str_replace("<dt>", "", $d);
2377 $d = str_replace("</dt>", "", $d);
2378 $d = str_replace("<dd>", "", $d);
2379 $d = str_replace("</dd>", "", $d);
2380 $d = str_replace("<p>", "", $d);
2381 $d = str_replace("</p>", "", $d);
2382 //restore html entities into characters
2383 // http://www.php.net/manual/en/function.htmlentities.php
2384 $trans = get_html_translation_table (HTML_ENTITIES);
2385 $trans = array_flip ($trans);
2386 $d = strtr($d, $trans);
2390 include_once(dirname(__FILE__)."/lib/stdlib.php");
2393 // Function to create better user passwords (much larger keyspace),
2394 // suitable for user passwords.
2395 // Sequence of random ASCII numbers, letters and some special chars.
2396 // Note: There exist other algorithms for easy-to-remember passwords.
2397 function random_good_password ($minlength = 5, $maxlength = 8) {
2399 // assume ASCII ordering (not valid on EBCDIC systems!)
2400 $valid_chars = "!#%&+-.0123456789=@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz";
2401 $start = ord($valid_chars);
2402 $end = ord(substr($valid_chars,-1));
2404 if (function_exists('mt_rand')) // mersenne twister
2405 $length = mt_rand($minlength, $maxlength);
2406 else // the usually bad glibc rand()
2407 $length = rand($minlength, $maxlength);
2408 while ($length > 0) {
2409 if (function_exists('mt_rand'))
2410 $newchar = mt_rand($start, $end);
2412 $newchar = rand($start, $end);
2413 if (! strrpos($valid_chars,$newchar) ) continue; // skip holes
2414 $newpass .= sprintf("%c", $newchar);
2421 function printArray($a) {
2422 echo "<hr />\n<pre>\n";
2424 echo "\n</pre>\n<hr />\n";
2427 // end of class definitions
2428 /////////////////////////////
2429 // begin auto generation code
2431 if (!function_exists('is_a')) {
2432 function is_a($object, $class) {
2433 $class = strtolower($class);
2434 return (get_class($object) == $class) or is_subclass_of($object, $class);
2439 if (!empty($HTTP_POST_VARS['action'])
2440 and $HTTP_POST_VARS['action'] == 'make_config'
2441 and !empty($HTTP_POST_VARS['ADMIN_USER'])
2442 and !empty($HTTP_POST_VARS['ADMIN_PASSWD'])
2446 $timestamp = date ('dS of F, Y H:i:s');
2449 ; This is a local configuration file for PhpWiki.
2450 ; It was automatically generated by the configurator script
2451 ; on the $timestamp.
2456 $posted = $GLOBALS['HTTP_POST_VARS'];
2457 /*if (defined('DEBUG'))
2458 printArray($GLOBALS['HTTP_POST_VARS']);*/
2460 foreach ($properties as $option_name => $a) {
2461 $posted_value = stripslashes($posted[$a->config_item_name]);
2462 $config .= $properties[$option_name]->get_config($posted_value);
2467 if (is_writable($fs_config_file)) {
2468 // We first check if the config-file exists.
2469 if (file_exists($fs_config_file)) {
2470 // We make a backup copy of the file
2471 $new_filename = preg_replace('/\.ini$/', '-' . time() . '.ini', $fs_config_file);
2472 if (@copy($fs_config_file, $new_filename)) {
2473 $fp = @fopen($fs_config_file, 'w');
2476 $fp = @fopen($fs_config_file, 'w');
2484 fputs($fp, $config);
2486 echo "<p>The configuration was written to <code><b>$config_file</b></code>.</p>\n";
2487 if ($new_filename) {
2488 echo "<p>A backup was made to <code><b>$new_filename</b></code>.</p>\n";
2490 ; //echo "<p><strong>You must rename or copy this</strong> <code><b>$config_file</b></code> <strong>file to</strong> <code><b>config/config.ini</b></code>.</p>\n";
2493 echo "<p>The configuration file could <b>not</b> be written.<br />\n",
2494 " You should copy the above configuration to a file, ",
2495 "and manually save it as <code><b>config/config.ini</b></code>.</p>\n";
2498 echo "<hr />\n<p>Here's the configuration file based on your answers:</p>\n";
2499 echo "<form method=\"get\" action=\"", $configurator, "\">\n";
2500 echo "<textarea id='config-output' readonly='readonly' style='width:100%;' rows='30' cols='100'>\n";
2501 echo htmlentities($config);
2502 echo "</textarea></form>\n";
2505 echo "<p>To make any corrections, <a href=\"configurator.php\">edit the settings again</a>.</p>\n";
2507 } else { // first time or create password
2508 $posted = $GLOBALS['HTTP_POST_VARS'];
2509 // No action has been specified - we make a form.
2512 <form action="',$configurator,'" method="post">
2513 <input type="hidden" name="action" value="make_config" />
2514 <table cellpadding="4" cellspacing="0">
2517 while (list($property, $obj) = each($properties)) {
2518 echo $obj->get_instructions($property);
2519 if ($h = $obj->get_html()) {
2520 if (defined('DEBUG') and DEBUG) $h = get_class($obj) . "<br />\n" . $h;
2521 echo "<td>".$h."</td>\n";
2528 <p><input type="submit" id="submit" value="Save ',$config_file,'" /> <input type="reset" value="Clear" /></p>