1 <?php // $Id: configurator.php,v 1.33 2005-03-27 20:36:16 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 and use this as default_values
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 parse_ini_file("config-default.ini") for the commented vars
40 * o check automatically for commented and optional vars
41 * o mixin class for commented
42 * o fix SQL quotes, AUTH_ORDER quotes and file forward slashes
43 * o posted values validation, extend js validation for sane DB values
44 * o read config-dist.ini into sections, comments, and optional/required settings
46 * A file config/config.ini will be automatically generated, if writable.
48 * NOTE: If you have a starterscript outside PHOWIKI_DIR but no
49 * config/config.ini yet (very unlikely!), you must define DATA_PATH in the
50 * starterscript, otherwise the webpath to configurator is unknown, and
51 * subsequent requests will fail. (POST to save the INI)
54 global $HTTP_SERVER_VARS, $HTTP_POST_VARS, $tdwidth;
55 if (empty($_GET)) $_GET =& $GLOBALS['HTTP_GET_VARS'];
56 if (empty($_ENV)) $_ENV =& $GLOBALS['HTTP_ENV_VARS'];
58 if (empty($configurator))
59 $configurator = "configurator.php";
60 if (!strstr($HTTP_SERVER_VARS["SCRIPT_NAME"], $configurator) and defined('DATA_PATH'))
61 $configurator = DATA_PATH . "/" . $configurator;
62 $scriptname = str_replace('configurator.php', 'index.php', $HTTP_SERVER_VARS["SCRIPT_NAME"]);
65 $config_file = (substr(PHP_OS,0,3) == 'WIN') ? 'config\\config.ini' : 'config/config.ini';
66 $fs_config_file = dirname(__FILE__) . (substr(PHP_OS,0,3) == 'WIN' ? '\\' : '/') . $config_file;
67 if (isset($HTTP_POST_VARS['create'])) header('Location: '.$configurator.'?show=_part1&create=1#create');
69 // helpers from lib/WikiUser/HttpAuth.php
70 function _http_user() {
72 $_SERVER = $GLOBALS['HTTP_SERVER_VARS'];
73 if (!empty($_SERVER['PHP_AUTH_USER']))
74 return array($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
75 if (!empty($_SERVER['REMOTE_USER']))
76 return array($_SERVER['REMOTE_USER'], $_SERVER['PHP_AUTH_PW']);
77 if (!empty($GLOBALS['HTTP_ENV_VARS']['REMOTE_USER']))
78 return array($GLOBALS['HTTP_ENV_VARS']['REMOTE_USER'],
79 $GLOBALS['HTTP_ENV_VARS']['PHP_AUTH_PW']);
80 if (!empty($GLOBALS['REMOTE_USER']))
81 return array($GLOBALS['REMOTE_USER'], $GLOBALS['PHP_AUTH_PW']);
84 if (!empty($_SERVER['HTTP_AUTHORIZATION'])) {
85 list($userid, $passwd) = explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));
86 return array($userid, $passwd);
90 function _http_logout() {
92 $_SERVER =& $GLOBALS['HTTP_SERVER_VARS'];
93 // maybe we should random the realm to really force a logout. but the next login will fail.
94 // better_srand(); $realm = microtime().rand();
95 header('WWW-Authenticate: Basic realm="'.WIKI_NAME.'"');
96 if (strstr(php_sapi_name(), 'apache'))
97 header('HTTP/1.0 401 Unauthorized');
99 header("Status: 401 Access Denied"); //IIS and CGI need that
100 unset($GLOBALS['REMOTE_USER']);
101 unset($_SERVER['PHP_AUTH_USER']);
102 unset($_SERVER['PHP_AUTH_PW']);
104 trigger_error("Permission denied. Require ADMIN_USER.", E_USER_ERROR);
109 // If config.ini exists, we require ADMIN_USER access by faking HttpAuth.
110 // So nobody can see or reset the password(s).
111 if (file_exists($fs_config_file)) {
112 // Require admin user
113 if (!defined('ADMIN_USER') or !defined('ADMIN_PASSWD')) {
114 if (!function_exists("IniConfig")) {
115 include_once("lib/prepend.php");
116 include_once("lib/IniConfig.php");
118 IniConfig($fs_config_file);
120 if (!defined('ADMIN_USER') or ADMIN_USER == '') {
121 trigger_error("Configuration problem:\nADMIN_USER not defined in \"$fs_config_file\".\n"
122 . "Cannot continue: You have to fix that manually.", E_USER_ERROR);
126 list($admin_user, $admin_pw) = _http_user();
127 //$required_user = ADMIN_USER;
128 if (empty($admin_user) or $admin_user != ADMIN_USER)
133 if (ENCRYPTED_PASSWORD and function_exists('crypt')) {
134 if (crypt($admin_pw, ADMIN_PASSWD) != ADMIN_PASSWD)
136 } elseif ($admin_pw != ADMIN_PASSWD) {
140 if (!function_exists("IniConfig")) {
141 include_once("lib/prepend.php");
142 include_once("lib/IniConfig.php");
144 $def_file = (substr(PHP_OS,0,3) == 'WIN') ? 'config\\config-default.ini' : 'config/config-default.ini';
145 $fs_def_file = dirname(__FILE__) . (substr(PHP_OS,0,3) == 'WIN' ? '\\' : '/') . $def_file;
146 IniConfig($fs_def_file);
149 echo "<","?xml version=\"1.0\" encoding=\"'iso-8859-1'\"?",">\n";
151 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
152 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
153 <html xmlns="http://www.w3.org/1999/xhtml">
155 <!-- $Id: configurator.php,v 1.33 2005-03-27 20:36:16 rurban Exp $ -->
156 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
157 <title>Configuration tool for PhpWiki <?php echo $config_file ?></title>
158 <style type="text/css" media="screen">
160 /* TABLE { border: thin solid black } */
161 body { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 80%; }
162 pre { font-size: 120%; }
163 td { border: thin solid black }
165 div.hint { border: thin solid red, background-color: #eeeeee; }
166 tr.hidden { border: none; display: none; }
167 td.part { background-color: #eeeeee; color: inherit; }
168 td.instructions { background-color: #ffffee; width: <?php echo $tdwidth ?>px; color: inherit; }
169 td.unchangeable-variable-top { border-bottom: none; background-color: #ffffee; color:inherit; }
170 td.unchangeable-variable-left { border-top: none; background-color: #ffffee; color:inherit; }
173 <script language="JavaScript" type="text/javascript">
175 function update(accepted, error, value, output) {
176 var msg = document.getElementById(output);
178 /* MSIE 5.0 fails here */
179 if (msg && msg.innerHTML) { msg.innerHTML = "<font color=\"green\">Input accepted.</font>"; }
181 while ((index = error.indexOf("%s")) > -1) {
182 error = error.substring(0, index) + value + error.substring(index+2);
184 if (msg) { msg.innerHTML = "<font color=\"red\">" + error + "</font>"; }
186 if (submit = document.getElementById('submit')) submit.disabled = accepted ? false : true;
189 function validate(error, value, output, field) {
190 update(field.value == value, error, field.value, output);
193 function validate_ereg(error, ereg, output, field) {
194 regex = new RegExp(ereg);
195 update(regex.test(field.value), error, field.value, output);
198 function validate_range(error, low, high, empty_ok, output, field) {
199 update((empty_ok == 1 && field.value == "") ||
200 (field.value >= low && field.value <= high),
201 error, field.value, output);
204 function toggle_group(id) {
205 var text = document.getElementById(id + "_text");
207 if (text.innerHTML == "Hide options.") {
209 text.innerHTML = "Show options.";
211 text.innerHTML = "Hide options.";
214 var rows = document.getElementsByTagName('tr');
216 for (i = 0; i < rows.length; i++) {
218 if (tr.className == 'header' && tr.id == id) {
223 for (; i < rows.length; i++) {
225 if (tr.className == 'header')
227 tr.className = do_hide ? 'hidden': 'nonhidden';
232 // Hide all groups. We do this via JavaScript to avoid
233 // hiding the groups if JavaScript is not supported...
234 var rows = document.getElementsByTagName('tr');
235 var show = '<?php echo $_GET["show"] ?>';
236 for (var i = 0; i < rows.length; i++) {
238 if (tr.className == 'header')
239 if (!show || tr.id != show)
243 // Select text in textarea upon focus
244 var area = document.getElementById('config-output');
246 listener = { handleEvent: function (e) { area.select(); } };
247 area.addEventListener('focus', listener, false);
254 <body onload="do_init();">
256 <h1>Configuration for PhpWiki <?php echo $config_file ?></h1>
259 Using this configurator.php is experimental!<br>
260 On any configuration problems, please edit the resulting config.ini manually.
264 //define('DEBUG', 1);
266 * The Configurator is a php script to aid in the configuration of PhpWiki.
267 * Parts of this file were based on PHPWeather's configurator.php file.
268 * http://sourceforge.net/projects/phpweather/
270 * TO CHANGE THE CONFIGURATION OF YOUR PHPWIKI, DO *NOT* MODIFY THIS FILE!
271 * more instructions go here
275 * * eval config.ini to get the actual settings.
278 //////////////////////////////
279 // begin configuration options
282 * Notes for the description parameter of $property:
284 * - Descriptive text will be changed into comments (preceeded by ; )
285 * for the final output to config.ini.
287 * - Only a limited set of html is allowed: pre, dl dt dd; it will be
288 * stripped from the final output.
290 * - Line breaks and spacing will be preserved for the final output.
292 * - Double line breaks are automatically converted to paragraphs
293 * for the html version of the descriptive text.
295 * - Double-quotes and dollar signs in the descriptive text must be
296 * escaped: \" and \$. Instead of escaping double-quotes you can use
297 * single (') quotes for the enclosing quotes.
299 * - Special characters like < and > must use html entities,
300 * they will be converted back to characters for the final output.
303 $SEPARATOR = ";=========================================================================";
306 ; This is the main configuration file for PhpWiki in INI-style format.
307 ; Note that certain characters are used as comment char and therefore
308 ; these entries must be in double-quotes. Such as \":\", \";\", \",\" and \"|\"
309 ; Take special care for DBAUTH_ sql statements. (Part 3a)
311 ; This file is divided into several parts: Each one has different configuration
312 ; settings you can change; in all cases the default should work on your system,
313 ; however, we recommend you tailor things to your particular setting.
316 $properties["Part Zero"] =
317 new part('_part0', $SEPARATOR."\n", "
318 Part Zero: (optional)
319 Latest Development and Tricky Options");
321 if (defined('INCLUDE_PATH'))
322 $include_path = INCLUDE_PATH;
324 if (substr(PHP_OS,0,3) == 'WIN') {
325 $include_path = dirname(__FILE__) . ';' . ini_get('include_path');
326 if (strchr(ini_get('include_path'),'/'))
327 $include_path = strtr($include_path,'\\','/');
329 $include_path = dirname(__FILE__) . ':' . ini_get('include_path');
333 $properties["PHP include_path"] =
334 new _define('INCLUDE_PATH', $include_path, "
335 If PHP needs help in finding where you installed the rest of the PhpWiki
336 code, you can set the include_path here.
338 Override the PHP include path so that it can find some needed additional libraries.
339 You shouldn't need to do this unless your system include_path esp. your
340 system pear libs are broken or oudated. The PHPWIKI_DIR is automatically
341 put to the front and the local lib/pear path is automatically added to the end.
342 But if you define it, be sure to include either the system pear path or
343 the phpwiki/lib/pear path to override your Pear_DB.
344 Note that on Windows-based servers, you should use ; rather than :
345 as the path separator.");
347 // TODO: convert this a checkbox row as in tests/unit/test.pgp
348 $properties["DEBUG"] =
349 new numeric_define_optional('DEBUG', DEBUG, "
350 Set DEBUG to 1 to view the XHTML and CSS validator icons, page
351 processing timer, and possibly other debugging messages at the
352 bottom of each page. 65 for a more verbose level with AUTH hints.
353 See lib/config.php for all supported values.");
355 // TODO: bring the default to the front
356 $properties["ENABLE_USER_NEW"] =
357 new boolean_define_commented_optional
359 array('true' => "Enabled",
360 'false' => "Disabled."), "
361 Enable the new method of handling WikiUser Authetincation and Preferences.
362 It's best to leave it on, and only disable it if you have problems with it.
363 Servers with memory-limit problems might want to turn it off. It costs ~300KB
366 $properties["ENABLE_PAGEPERM"] =
367 new boolean_define_commented_optional
369 array('true' => "Enabled",
370 'false' => "Disabled."), "
371 Use access control lists (as in Solaris and Windows NTFS) per page and group,
372 not per user for the whole wiki.
374 I suspect ACL page permissions to degrade speed by 10%.
375 GROUP_METHOD=WIKIPAGE is slowest. (See Part 3a)
378 $properties["ENABLE_EDIT_TOOLBAR"] =
379 new boolean_define_commented_optional
380 ('ENABLE_EDIT_TOOLBAR',
381 array('true' => "Enabled",
382 'false' => "Disabled."), "
383 Graphical buttons on edit. Default: true.
384 Reportedly broken on MacOSX Safari");
386 $properties["JS_SEARCHREPLACE"] =
387 new boolean_define_commented_optional
389 array('true' => "Enabled",
390 'false' => "Disabled"), "
391 Adds two additional buttons in EDIT_TOOLBAR, Search&Replace and Undo.
392 Undo is experimental.");
394 $properties["ENABLE_DOUBLECLICKEDIT"] =
395 new boolean_define_commented_optional
396 ('ENABLE_DOUBLECLICKEDIT',
397 array('true' => "Enabled",
398 'false' => "Disabled"), "
401 $properties["ENABLE_XHTML_XML"] =
402 new boolean_define_commented_optional
404 array('false' => "Disabled",
405 'true' => "Enabled"), "
406 Needed for inlined SVG and MathM, but may conflict with javascript:document.write().
407 Experimental. Default: false");
409 $properties["USECACHE"] =
410 new boolean_define_commented_optional
412 array('true' => "Enabled",
413 'false' => "Disabled"), "
414 Store DB query results in memory to avoid duplicate queries.
415 Disable only for old php's with low memory or memory_limit=8MB.
418 $properties["ENABLE_SPAMASSASSIN"] =
419 new boolean_define_commented_optional
420 ('ENABLE_SPAMASSASSIN',
421 array('true' => "Enabled",
422 'false' => "Disabled"), "
423 Needs babycart installed. See http://phpwiki.org/SpamAssassinIntegration
424 Optionally define BABYCART_PATH. Default: /usr/local/bin/babycart");
426 $properties["GOOGLE_LINKS_NOFOLLOW"] =
427 new boolean_define_commented_optional
428 ('GOOGLE_LINKS_NOFOLLOW',
429 array('true' => "Enabled",
430 'false' => "Disabled"), "
431 If enabled ref=nofollow is added to all external links to discourage spam.
432 You might want to turn it off, if you want to improve pageranks on external links.");
434 $properties["ENABLE_LIVESEARCH"] =
435 new boolean_define_commented_optional
436 ('ENABLE_LIVESEARCH',
437 array('true' => "Enabled",
438 'false' => "Disabled"), "
439 LiveSearch enables immediate title search results via XMLHttpRequest.
440 Displays the results in a dropdown under the titlesearch inputbox
441 while typing. (experimental, only with certain themes)
442 You'll have to copy livesearch.js from http://blog.bitflux.ch/wiki/LiveSearch
443 to themes/default/ and define ENABLE_LIVESEARCH in config.ini to true.
444 See themes/blog/themeinfo.php.
445 Currently we use the bitflux.ch library, but we will change to
446 the russian acdropdown soon. http://momche.net/publish/article.php?page=acdropdown");
448 $properties["USE_SAFE_DBSESSION"] =
449 new boolean_define_commented_optional
450 ('USE_SAFE_DBSESSION',
451 array('false' => "Disabled",
452 'true' => "Enabled"), "
453 USE_SAFE_DBSESSION should be enabled, if you encounter session problems, with duplicate INSERT
454 sess_id warnings at the bottom of the page. Reason is a unreliable affected_rows implementation()
455 in the sql backend. Default is Disabled, using the fastest DbSession UPDATE method.");
457 $properties["Part One"] =
458 new part('_part1', $SEPARATOR."\n", "
459 Part One: Authentication and security settings. See Part Three for more.");
461 $properties["Admin Username"] =
462 new _define_notempty('ADMIN_USER', ADMIN_USER, "
463 You must set this! Username and password of the administrator.",
464 "onchange=\"validate_ereg('Sorry, ADMIN_USER cannot be empty.', '^.+$', 'ADMIN_USER', this);\"");
466 $properties["Admin Password"] =
467 new _define_password('ADMIN_PASSWD', ADMIN_PASSWD, "
468 For heaven's sake pick a good password.
469 If your version of PHP supports encrypted passwords, your password will be
470 automatically encrypted within the generated config file.
471 Use the \"Create Random Password\" button to create a good (random) password.
473 ADMIN_PASSWD is ignored on HttpAuth",
474 "onchange=\"validate_ereg('Sorry, ADMIN_PASSWD must be at least 4 chars long.', '^....+$', 'ADMIN_PASSWD', this);\"");
476 $properties["Encrypted Passwords"] =
479 array('true' => "true. use crypt for all passwords",
480 'false' => "false. use plaintest passwords (not recommended)"), "
481 It is recommended that you use encrypted passwords to be stored in the
482 config.ini and the users homepages metadata.
483 You might want to use the passencrypt.php utility to encode the
484 admin password, in the event that someone gains ftp or ssh access to the
485 server and directory containing phpwiki.
486 <i>SQL access passwords cannot be encrypted, besides using external DATABASE_DSN aliases within PDO.</i>
488 If true, all user passwords will be stored encrypted.
489 You might have to set it to false, if your PHP doesn't support crypt().
492 $properties["Wiki Name"] =
493 new _define_optional('WIKI_NAME', WIKI_NAME, "
494 The name of your wiki.
496 This is used to generate a keywords meta tag in the HTML templates,
497 in bookmark titles for any bookmarks made to pages in your wiki,
498 and during RSS generation for the title of the RSS channel.
500 It is recommended this be a relatively short WikiWord like the
501 InterWiki monikers found in the InterWikiMap. (For examples, see
505 $properties["Reverse DNS"] =
506 new boolean_define_optional
507 ('ENABLE_REVERSE_DNS',
508 array('true' => "true. perform additional reverse dns lookups",
509 'false' => "false. just record the address as given by the httpd server"),
511 If set, we will perform reverse dns lookups to try to convert the
512 users IP number to a host name, even if the http server didn't do it for us.");
514 $properties["ZIPdump Authentication"] =
515 new boolean_define_optional('ZIPDUMP_AUTH',
516 array('false' => "false. Everyone may download zip dumps",
517 'true' => "true. Only admin may download zip dumps"), "
518 If true, only the admin user can make zip dumps, else zip dumps
519 require no authentication.");
521 $properties["Enable RawHtml Plugin"] =
522 new boolean_define_commented_optional
524 array('true' => "Enabled",
525 'false' => "Disabled"), "
526 The RawHtml plugin allows page authors to embed real, raw HTML into Wiki
527 pages. This is a possible security threat, as much HTML (or, rather,
528 JavaScript) can be very risky. If you are in a controlled environment,
529 however, it could be of use.");
531 $properties["Allow RawHtml Plugin only on locked pages"] =
532 new boolean_define_commented_optional
533 ('ENABLE_RAW_HTML_LOCKEDONLY',
534 array('true' => "Enabled",
535 'false' => "Disabled"), "
536 If this is set, only pages locked by the Administrator may contain the RawHtml plugin.");
538 $properties["Allow RawHtml Plugin if safe HTML code"] =
539 new boolean_define_commented_optional
540 ('ENABLE_RAW_HTML_SAFE',
541 array('true' => "Enabled",
542 'false' => "Disabled"), "
543 If this is set, all unsafe html code is stripped automatically (experimental!)
544 See <a href=\"http://chxo.com/scripts/safe_html-test.php\" target=\"_new\">chxo.com/scripts/safe_html-test.php</a>
547 $properties["Maximum Upload Size"] =
548 new numeric_define_optional('MAX_UPLOAD_SIZE', MAX_UPLOAD_SIZE /*"16 * 1024 * 1024"*/, "
549 The maximum file upload size.");
551 $properties["Minor Edit Timeout"] =
552 new numeric_define_optional('MINOR_EDIT_TIMEOUT', MINOR_EDIT_TIMEOUT /*"7 * 24 * 3600"*/, "
553 If the last edit is older than MINOR_EDIT_TIMEOUT seconds, the
554 default state for the \"minor edit\" checkbox on the edit page form
557 $properties["Disabled Actions"] =
558 new array_define('DISABLED_ACTIONS', DISABLED_ACTIONS /*array()*/, "
559 Actions listed in this array will not be allowed. Actions are:
560 browse, create, diff, dumphtml, dumpserial, edit, loadfile, lock, remove,
561 unlock, upload, viewsource, zip, ziphtml");
563 $properties["Access Log File"] =
564 new _define_commented_optional('ACCESS_LOG', ACCESS_LOG /*"/var/logs/wiki_access.log"*/, "
565 PhpWiki can generate an access_log (in \"NCSA combined log\" format)
566 for you. If you want one, define this to the name of the log file,
567 such as /tmp/wiki_access_log. Preferred is to use SQL access logging as below.
569 Default: empty - no access log file will be generated.");
571 $properties["Access Log SQL"] =
572 new _define_selection(
574 array('0' => 'disable',
576 '2' => 'read + write'), "
577 PhpWiki can read and/or write apache-style mod_log_sql accesslog tables for faster
578 abuse detection and referer lists.
579 See http://www.outoforder.cc/projects/apache/mod_log_sql/docs-2.0/#id2756178
581 If defined (e.g. 1) only read-access is done via SQL.
582 If flag 2 is set, phpwiki also writes. (Default on SQL or ADODB)
583 This must use DATABASE_TYPE = SQL or ADODB.
586 $properties["Compress Output"] =
587 new boolean_define_commented_optional
589 array('' => 'GZIP compress when PhpWiki thinks appropriate.',
590 'false' => 'Never compress output.',
591 'true' => 'Always try to compress output.'),
593 By default PhpWiki will try to have PHP compress it's output
594 before sending it to the browser (if you have a recent enough
595 version of PHP and the action and the browser supports it.)
597 Define COMPRESS_OUTPUT to false to prevent output compression at all.
599 Define COMPRESS_OUTPUT to true to force output compression,
600 even if we think your version of PHP does this in a buggy
603 Leave it undefined to leave the choice up to PhpWiki.");
605 $properties["HTTP Cache Control"] =
606 new _define_selection_optional
608 array('LOOSE' => 'LOOSE',
609 'STRICT' => 'STRICT',
610 'NO_CACHE' => 'NO_CACHE',
611 'ALLOW_STALE' => 'ALLOW_STALE'),
615 This controls how PhpWiki sets the HTTP cache control
616 headers (Expires: and Cache-Control:)
622 <dd>This is roughly the old (pre 1.3.4) behaviour. PhpWiki will
623 instruct proxies and browsers never to cache PhpWiki output.</dd>
626 <dd>Cached pages will be invalidated whenever the database global
627 timestamp changes. This should behave just like NONE (modulo
628 bugs in PhpWiki and your proxies and browsers), except that
629 things will be slightly more efficient.</dd>
632 <dd>Cached pages will be invalidated whenever they are edited,
633 or, if the pages include plugins, when the plugin output could
634 concievably have changed.
636 <p>Behavior should be much like STRICT, except that sometimes
637 wikilinks will show up as undefined (with the question mark)
638 when in fact they refer to (recently) created pages.
639 (Hitting your browsers reload or perhaps shift-reload button
640 should fix the problem.)</p></dd>
643 <dd>Proxies and browsers will be allowed to used stale pages.
644 (The timeout for stale pages is controlled by CACHE_CONTROL_MAX_AGE.)
646 <p>This setting will result in quirky behavior. When you edit a
647 page your changes may not show up until you shift-reload the
650 <p>This setting is generally not advisable, however it may be useful
651 in certain cases (e.g. if your wiki gets lots of page views,
652 and few edits by knowledgable people who won't freak over the quirks.)</p>
655 The default is currently LOOSE.");
657 // FIXME: should be numeric_define_optional
658 $properties["HTTP Cache Control Max Age"] =
659 new numeric_define_optional('CACHE_CONTROL_MAX_AGE', CACHE_CONTROL_MAX_AGE,
661 Maximum page staleness, in seconds.");
663 $properties["Markup Caching"] =
664 new boolean_define_commented_optional
665 ('WIKIDB_NOCACHE_MARKUP',
666 array('false' => 'Enable markup cache',
667 'true' => 'Disable markup cache'),
671 PhpWiki normally caches a preparsed version (i.e. mostly
672 converted to HTML) of the most recent version of each page.
673 (Parsing the wiki-markup takes a fair amount of CPU.)
675 Define WIKIDB_NOCACHE_MARKUP to true to disable the
676 caching of marked-up page content.
678 Note that you can also disable markup caching on a per-page
679 temporary basis by addinging a query arg of '?nocache=1'
680 to the URL to the page. (Use '?nocache=purge' to completely
681 discard the cached version of the page.)
683 You can also purge the cached markup globally by using the
684 \"Purge Markup Cache\" button on the PhpWikiAdministration page.");
686 $properties["Path for PHP Session Support"] =
687 new _define_optional('SESSION_SAVE_PATH', defined('SESSION_SAVE_PATH') ? SESSION_SAVE_PATH : ini_get('session.save_path'), "
688 The login code now uses PHP session support. Usually, the default
689 configuration of PHP is to store the session state information in
690 /tmp. That probably will work fine, but fails e.g. on clustered
691 servers where each server has their own distinct /tmp (this is the
692 case on SourceForge's project web server.) You can specify an
693 alternate directory in which to store state information like so
694 (whatever user your httpd runs as must have read/write permission
697 On USE_DB_SESSION = true you can ignore this.
700 ///////// database selection
702 $properties["Part Two"] =
703 new part('_part2', $SEPARATOR."\n", "
706 Database Configuration
709 $properties["Database Type"] =
710 new _define_selection("DATABASE_TYPE",
711 array('dba' => "dba",
713 'ADODB' => "SQL ADODB",
714 'PDO' => "PDO (php5 only)",
715 'file' => "flatfile",
716 'cvs' => "CVS File handler"), "
717 Select the database backend type:
718 Choose dba (default) to use one of the standard UNIX dba libraries. This is the fastest.
719 Choose ADODB or SQL to use an SQL database with ADODB or PEAR.
720 Choose PDO on php5 to use an SQL database.
721 flatfile is simple and slow.
722 CVS is highly experimental and slow.
723 Recommended is dba or SQL: PEAR or ADODB.");
725 $properties["SQL DSN Setup"] =
726 new unchangeable_variable('_sqldsnstuff', "", "
727 For SQL based backends, specify the database as a DSN
728 The most general form of a DSN looks like:
730 phptype(dbsyntax)://username:password@protocol+hostspec/database?option=value
732 For a MySQL database, the following should work:
734 mysql://user:password@host/databasename
736 To connect over a unix socket, use something like
738 mysql://user:password@unix(/path/to/socket)/databasename
741 DATABASE_DSN = mysql://guest@:/var/lib/mysql/mysql.sock/phpwiki
742 DATABASE_DSN = mysql://guest@localhost/phpwiki
743 DATABASE_DSN = pgsql://localhost/user_phpwiki
746 // Choose ADODB or SQL to use an SQL database with ADODB or PEAR.
747 // Choose dba to use one of the standard UNIX dbm libraries.
749 $properties["SQL Type"] =
750 new _variable_selection('_dsn_sqltype',
751 array('mysql' => "MySQL",
752 'pgsql' => "PostgreSQL",
753 'mssql' => "Microsoft SQL Server",
754 'oci8' => "Oracle 8",
755 'mysqli' => "mysqli (only ADODB)",
756 'mysqlt' => "mysqlt (only ADODB)",
757 'ODBC' => "ODBC (only ADODB or PDO)",
758 'firebird' => "Firebird (only PDO)",
759 'oracle' => "Oracle (only PDO)",
761 SQL DB types. The DSN hosttype.");
763 $properties["SQL User"] =
764 new _variable('_dsn_sqluser', "wikiuser", "
767 $properties["SQL Password"] =
768 new _variable('_dsn_sqlpass', "", "
771 $properties["SQL Database Host"] =
772 new _variable('_dsn_sqlhostorsock', "localhost", "
773 SQL Database Hostname:
775 To connect over a local named socket, use something like
777 unix(/var/lib/mysql/mysql.sock)
780 mysql on Windows via named pipes might need 127.0.0.1");
782 $properties["SQL Database Name"] =
783 new _variable('_dsn_sqldbname', "phpwiki", "
784 SQL Database Name:");
786 $dsn_sqltype = $properties["SQL Type"]->value();
787 $dsn_sqluser = $properties["SQL User"]->value();
788 $dsn_sqlpass = $properties["SQL Password"]->value();
789 $dsn_sqlhostorsock = $properties["SQL Database Host"]->value();
790 $dsn_sqldbname = $properties["SQL Database Name"]->value();
791 $dsn_sqlstring = $dsn_sqltype."://{$dsn_sqluser}:{$dsn_sqlpass}@{$dsn_sqlhostorsock}/{$dsn_sqldbname}";
793 $properties["SQL dsn"] =
794 new unchangeable_define("DATABASE_DSN",
795 "DATABASE_DSN = \"$dsn_sqlstring\"", "
796 Calculated from the settings above:");
798 $properties["Filename / Table name Prefix"] =
799 new _define_commented("DATABASE_PREFIX", DATABASE_PREFIX, "
800 Used by all DB types:
802 Prefix for filenames or table names, e.g. \"phpwiki_\"
804 Currently <b>you MUST EDIT THE SQL file too!</b> (in the schemas/
805 directory because we aren't doing on the fly sql generation
806 during the installation.");
808 $properties["DB Session table"] =
809 new _define_optional("DATABASE_SESSION_TABLE", DATABASE_SESSION_TABLE, "
810 Tablename to store session information. Only supported by SQL backends.
812 A word of warning - any prefix defined above will be prepended to whatever is given here.
816 $temp = !empty($_ENV['TEMP']) ? $_ENV['TEMP'] : "/tmp";
817 $properties["dba directory"] =
818 new _define("DATABASE_DIRECTORY", $temp, "
821 // TODO: list the available methods
822 $properties["dba handler"] =
823 new _define_selection('DATABASE_DBA_HANDLER',
824 array('gdbm' => "Gdbm - GNU database manager (recommended)",
825 'dbm' => "DBM - Redhat default. On sf.net there's dbm and gdbm",
826 'db2' => "DB2 - Sleepycat Software's DB2",
827 'db3' => "DB3 - Sleepycat Software's DB3. Default on Windows but not on every Linux",
828 'db4' => "DB4 - Sleepycat Software's DB4."), "
829 Use 'gdbm', 'dbm', 'db2', 'db3' or 'db4' depending on your DBA handler methods supported: <br > "
830 . (function_exists("dba_handlers") ? join(", ",dba_handlers()) : ""));
832 $properties["dba timeout"] =
833 new numeric_define("DATABASE_TIMEOUT", DATABASE_TIMEOUT, "
834 Recommended values are 10-20 seconds. The more load the server has, the higher the timeout.");
836 $properties["DATABASE_PERSISTENT"] =
837 new boolean_define_commented_optional
838 ('DATABASE_PERSISTENT',
839 array('false' => "Disabled",
840 'true' => "Enabled"), "
841 Use persistent database connections for SQL databases, if the database backend supports it.
842 Not recommended for heavily loaded servers.
847 $properties["Page Revisions"] =
848 new unchangeable_variable('_parttworevisions', "", "
850 Section 2a: Archive Cleanup
851 The next section controls how many old revisions of each page are kept in the database.
853 There are two basic classes of revisions: major and minor. Which
854 class a revision belongs in is determined by whether the author
855 checked the \"this is a minor revision\" checkbox when they saved the
858 There is, additionally, a third class of revisions: author
859 revisions. The most recent non-mergable revision from each distinct
860 author is and author revision.
862 The expiry parameters for each of those three classes of revisions
863 can be adjusted seperately. For each class there are five
864 parameters (usually, only two or three of the five are actually
865 set) which control how long those revisions are kept in the
868 <dt>max_keep:</dt> <dd>If set, this specifies an absolute maximum for the
869 number of archived revisions of that class. This is
870 meant to be used as a safety cap when a non-zero
871 min_age is specified. It should be set relatively high,
872 and it's purpose is to prevent malicious or accidental
873 database overflow due to someone causing an
874 unreasonable number of edits in a short period of time.</dd>
876 <dt>min_age:</dt> <dd>Revisions younger than this (based upon the supplanted
877 date) will be kept unless max_keep is exceeded. The age
878 should be specified in days. It should be a
879 non-negative, real number,</dd>
881 <dt>min_keep:</dt> <dd>At least this many revisions will be kept.</dd>
883 <dt>keep:</dt> <dd>No more than this many revisions will be kept.</dd>
885 <dt>max_age:</dt> <dd>No revision older than this age will be kept.</dd>
887 Supplanted date: Revisions are timestamped at the instant that they
888 cease being the current revision. Revision age is computed using
889 this timestamp, not the edit time of the page.
891 Merging: When a minor revision is deleted, if the preceding
892 revision is by the same author, the minor revision is merged with
893 the preceding revision before it is deleted. Essentially: this
894 replaces the content (and supplanted timestamp) of the previous
895 revision with the content after the merged minor edit, the rest of
896 the page metadata for the preceding version (summary, mtime, ...)
900 // For now the expiration parameters are statically inserted as
901 // an unchangeable property. You'll have to edit the resulting
902 // config file if you really want to change these from the default.
904 $properties["Major Edits: keep minumum days"] =
905 new numeric_define("MAJOR_MIN_KEEP", MAJOR_MIN_KEEP, "
906 Default: Keep at least for unlimited time.
907 Set to 0 to enable archive cleanup");
908 $properties["Minor Edits: keep minumum days"] =
909 new numeric_define("MINOR_MIN_KEEP", MINOR_MIN_KEEP, "
910 Default: Keep at least for unlimited time.
911 Set to 0 to enable archive cleanup");
913 $properties["Major Edits: how many"] =
914 new numeric_define("MAJOR_KEEP", MAJOR_KEEP, "
915 Keep up to 8 major edits");
916 $properties["Major Edits: how many days"] =
917 new numeric_define("MAJOR_MAX_AGE", MAJOR_MAX_AGE, "
918 keep them no longer than a month");
920 $properties["Minor Edits: how many"] =
921 new numeric_define("MINOR_KEEP", MINOR_KEEP, "
922 Keep up to 4 minor edits");
923 $properties["Minor Edits: how many days"] =
924 new numeric_define("MINOR_MAX_AGE", "7", "
925 keep them no longer than a week");
927 $properties["per Author: how many"] =
928 new numeric_define("AUTHOR_KEEP", "8", "
929 Keep the latest contributions of the last 8 authors,");
930 $properties["per Author: how many days"] =
931 new numeric_define("AUTHOR_MAX_AGE", "365", "
933 $properties["per Author: keep minumum days"] =
934 new numeric_define("AUTHOR_MIN_AGE", "7", "
935 Additionally, (in the case of a particularly active page) try to
936 keep the latest contributions of all authors in the last week (even if there are more than eight of them,)");
937 $properties["per Author: max revisions"] =
938 new numeric_define("AUTHOR_MAX_KEEP", "20", "
939 but in no case keep more than twenty unique author revisions.");
941 /////////////////////////////////////////////////////////////////////
943 $properties["Part Three"] =
944 new part('_part3', $SEPARATOR."\n", "
946 Part Three: (optional)
947 Basic User Authentication Setup
950 $properties["Publicly viewable"] =
951 new boolean_define_optional('ALLOW_ANON_USER',
952 array('true' => "true. Permit anonymous view. (Default)",
953 'false' => "false. Force login even on view (strictly private)"), "
954 If ALLOW_ANON_USER is false, you have to login before viewing any page or doing any other action on a page.");
956 $properties["Allow anonymous edit"] =
957 new boolean_define_optional('ALLOW_ANON_EDIT',
958 array('true' => "true. Permit anonymous users to edit. (Default)",
959 'false' => "false. Force login on edit (moderately locked)"), "
960 If ALLOW_ANON_EDIT is false, you have to login before editing or changing any page. See below.");
962 $properties["Allow Bogo Login"] =
963 new boolean_define_optional('ALLOW_BOGO_LOGIN',
964 array('true' => "true. Users may Sign In with any WikiWord, without password. (Default)",
965 'false' => "false. Require stricter authentication."), "
966 If ALLOW_BOGO_LOGIN is false, you may not login with any wikiword username and empty password.
967 If true, users are allowed to create themselves with any WikiWord username. See below.");
969 $properties["Allow User Passwords"] =
970 new boolean_define_optional('ALLOW_USER_PASSWORDS',
971 array('true' => "True user authentication with password checking. (Default)",
972 'false' => "false. Ignore authentication settings below."), "
973 If ALLOW_USER_PASSWORDS is true, the authentication settings below define where and how to
974 check against given username/passwords. For completely security disable BOGO_LOGIN and ANON_EDIT above.");
976 $properties["Allow User Passwords"] =
977 new array_define('USER_AUTH_ORDER', array("PersonalPage", "Db"), "
978 Many different methods can be used to check user's passwords.
979 Try any of these in the given order:
982 <dd>WikiWord username, with no *actual* password checking,
983 although the user will still have to enter one.</dd>
984 <dt>PersonalPage</dt>
985 <dd>Store passwords in the users homepage metadata (simple)</dd>
987 <dd>Use DBAUTH_AUTH_* (see below) with PearDB or ADODB only.</dd>
989 <dd>Authenticate against LDAP_AUTH_HOST with LDAP_BASE_DN</dd>
991 <dd>Authenticate against IMAP_AUTH_HOST (email account)</dd>
993 <dd>Authenticate against POP3_AUTH_HOST (email account)</dd>
995 <dd>Get username and level from a PHP session variable. (e.g. for gforge)</dd>
997 <dd>Store username:crypted-passwords in .htaccess like files.
998 Use Apache's htpasswd to manage this file.</dd>
1000 <dd>Use the protection by the webserver (.htaccess/.htpasswd) (experimental)
1001 Enforcing HTTP Auth not yet. Note that the ADMIN_USER should exist also.
1002 Using HttpAuth disables all other methods and no userauth sessions are used.</dd>
1005 Several of these methods can be used together, in the manner specified by
1006 USER_AUTH_POLICY, below. To specify multiple authentication methods,
1007 separate the name of each one with colons.
1009 USER_AUTH_ORDER = 'PersonalPage : Db'
1010 USER_AUTH_ORDER = 'BogoLogin : PersonalPage'</pre>");
1012 $properties["PASSWORD_LENGTH_MINIMUM"] =
1013 new numeric_define("PASSWORD_LENGTH_MINIMUM", "6", "
1014 For 'security' purposes, you can specify that a password be at least a
1015 certain number of characters long. This applies even to the BogoLogin method.
1016 Default: 0 (to allow immediate passwordless BogoLogin)");
1018 $properties["USER_AUTH_POLICY"] =
1019 new _define_selection('USER_AUTH_POLICY',
1020 array('first-only' => "first-only - use only the first method in USER_AUTH_ORDER",
1021 'old' => "old - ignore USER_AUTH_ORDER (legacy)",
1022 'strict' => "strict - check all methods for userid + password (recommended)",
1023 'stacked' => "stacked - check all methods for userid, and if found for password"), "
1024 The following policies are available for user authentication:
1027 <dd>use only the first method in USER_AUTH_ORDER</dd>
1029 <dd>ignore USER_AUTH_ORDER and try to use all available
1030 methods as in the previous PhpWiki releases (slow)</dd>
1032 <dd>check if the user exists for all methods:
1033 on the first existing user, try the password.
1034 dont try the other methods on failure then</dd>
1036 <dd>check the given user - password combination for all
1037 methods and return true on the first success.</dd></dl>");
1041 $properties["Part Three A"] =
1042 new part('_part3a', $SEPARATOR."\n", "
1044 Part Three A: (optional)
1047 $properties["Group membership"] =
1048 new _define_selection("GROUP_METHOD",
1049 array('WIKIPAGE' => "WIKIPAGE - List at \"CategoryGroup\". (Slowest, but easiest to maintain)",
1050 '"NONE"' => "NONE - Disable group membership (Fastest)",
1051 'DB' => "DB - SQL Database, Optionally external. See USERS/GROUPS queries",
1052 'FILE' => "Flatfile. See AUTH_GROUP_FILE below.",
1053 'LDAP' => "LDAP - See \"LDAP authentication options\" above. (Experimental)"), "
1054 Group membership. PhpWiki supports defining permissions for a group as
1055 well as for individual users. This defines how group membership information
1056 is obtained. Supported values are:
1059 <dd>Disable group membership (Fastest). Note the required quoting.</dd>
1061 <dd>Define groups as list at \"CategoryGroup\". (Slowest, but easiest to maintain)</dd>
1063 <dd>Stored in an SQL database. Optionally external. See USERS/GROUPS queries</dd>
1065 <dd>Flatfile. See AUTH_GROUP_FILE below.</dd>
1067 <dd>LDAP groups. See \"LDAP authentication options\" above and
1068 lib/WikiGroup.php. (experimental)</dd></dl>");
1070 $properties["CATEGORY_GROUP_PAGE"] =
1071 new _define_optional('CATEGORY_GROUP_PAGE', _("CategoryGroup"), "
1072 If GROUP_METHOD = WIKIPAGE:
1074 Page where all groups are listed.");
1076 $properties["AUTH_GROUP_FILE"] =
1077 new _define_optional('AUTH_GROUP_FILE', _("/etc/groups"), "
1078 For GROUP_METHOD = FILE, the file given below is referenced to obtain
1079 group membership information. It should be in the same format as the
1080 standard unix /etc/groups(5) file.");
1082 $properties["Part Three B"] =
1083 new part('_part3b', $SEPARATOR."\n", "
1085 Part Three B: (optional)
1086 External database authentication and authorization.
1088 If USER_AUTH_ORDER includes Db, or GROUP_METHOD = DB, the options listed
1089 below define the SQL queries used to obtain the information out of the
1090 database, and (optionally) store the information back to the DB.");
1092 $properties["DBAUTH_AUTH_DSN"] =
1093 new _define_optional('DBAUTH_AUTH_DSN', $dsn_sqlstring, "
1094 A database DSN to connect to. Defaults to the DSN specified for the Wiki as a whole.");
1096 $properties["User Exists Query"] =
1097 new _define('DBAUTH_AUTH_USER_EXISTS', "SELECT userid FROM user WHERE userid='\$userid'", "
1098 USER/PASSWORD queries:
1100 For USER_AUTH_POLICY=strict and the Db method is required");
1102 $properties["Check Query"] =
1103 new _define_optional('DBAUTH_AUTH_CHECK', "SELECT IF(passwd='\$password',1,0) AS ok FROM user WHERE userid='\$userid'", "
1105 Check to see if the supplied username/password pair is OK
1107 Plaintext passwords: (DBAUTH_AUTH_CRYPT_METHOD = plain)<br>
1108 ; DBAUTH_AUTH_CHECK = \"SELECT IF(passwd='\$password',1,0) AS ok FROM user WHERE userid='\$userid'\"
1110 database-hashed passwords (more secure):<br>
1111 ; DBAUTH_AUTH_CHECK = \"SELECT IF(passwd=PASSWORD('\$password'),1,0) AS ok FROM user WHERE userid='\$userid'\"");
1113 $properties["Crypt Method"] =
1114 new _define_selection_optional
1115 ('DBAUTH_AUTH_CRYPT_METHOD',
1116 array('plain' => 'plain',
1117 'crypt' => 'crypt'), "
1118 If you want to use Unix crypt()ed passwords, you can use DBAUTH_AUTH_CHECK
1119 to get the password out of the database with a simple SELECT query, and
1120 specify DBAUTH_AUTH_USER_EXISTS and DBAUTH_AUTH_CRYPT_METHOD:
1122 ; DBAUTH_AUTH_CHECK = \"SELECT passwd FROM user where userid='\$userid'\" <br>
1123 ; DBAUTH_AUTH_CRYPT_METHOD = crypt");
1125 $properties["Update the user's authentication credential"] =
1126 new _define('DBAUTH_AUTH_UPDATE', "UPDATE user SET passwd='\$password' WHERE userid='\$userid'", "
1127 If this is not defined but DBAUTH_AUTH_CHECK is, then the user will be unable to update their
1130 Plaintext passwords:<br>
1131 DBAUTH_AUTH_UPDATE = \"UPDATE user SET passwd='\$password' WHERE userid='\$userid'\"<br>
1132 Database-hashed passwords:<br>
1133 DBAUTH_AUTH_UPDATE = \"UPDATE user SET passwd=PASSWORD('\$password') WHERE userid='\$userid'\"");
1135 $properties["Allow the user to create their own account"] =
1136 new _define_optional('DBAUTH_AUTH_CREATE', "INSERT INTO user SET passwd=PASSWORD('\$password'),userid='\$userid'", "
1137 If this is empty, Db users cannot subscribe by their own.");
1139 $properties["USER/PREFERENCE queries"] =
1140 new _define_optional('DBAUTH_PREF_SELECT', "SELECT prefs FROM user WHERE userid='\$userid'", "
1141 If you choose to store your preferences in an external database, enable
1142 the following queries. Note that if you choose to store user preferences
1143 in the 'user' table, only registered users get their prefs from the database,
1144 self-created users do not. Better to use the special 'pref' table.
1146 The prefs field stores the serialized form of the user's preferences array,
1147 to ease the complication of storage.
1149 DBAUTH_PREF_SELECT = \"SELECT prefs FROM user WHERE userid='\$userid'\"
1150 DBAUTH_PREF_SELECT = \"SELECT prefs FROM pref WHERE userid='\$userid'\"
1153 $properties["Update the user's preferences"] =
1154 new _define_optional('DBAUTH_PREF_UPDATE', "UPDATE user SET prefs='\$pref_blob' WHERE userid='\$userid'", "
1155 Note that REPLACE works only with mysql and destroy all other columns!
1157 Mysql: DBAUTH_PREF_UPDATE = \"REPLACE INTO pref SET prefs='\$pref_blob',userid='\$userid'\"");
1159 $properties["USERS/GROUPS queries"] =
1160 new _define_optional('DBAUTH_IS_MEMBER', "SELECT user FROM user WHERE user='\$userid' AND group='\$groupname'", "
1161 You can define 1:n or n:m user<=>group relations, as you wish.
1163 Sample configurations:
1165 only one group per user (1:n):<br>
1166 DBAUTH_IS_MEMBER = \"SELECT user FROM user WHERE user='\$userid' AND group='\$groupname'\"<br>
1167 DBAUTH_GROUP_MEMBERS = \"SELECT user FROM user WHERE group='\$groupname'\"<br>
1168 DBAUTH_USER_GROUPS = \"SELECT group FROM user WHERE user='\$userid'\"<br>
1169 multiple groups per user (n:m):<br>
1170 DBAUTH_IS_MEMBER = \"SELECT userid FROM member WHERE userid='\$userid' AND groupname='\$groupname'\"<br>
1171 DBAUTH_GROUP_MEMBERS = \"SELECT DISTINCT userid FROM member WHERE groupname='\$groupname'\"<br>
1172 DBAUTH_USER_GROUPS = \"SELECT groupname FROM member WHERE userid='\$userid'\"<br>");
1173 $properties["DBAUTH_GROUP_MEMBERS"] =
1174 new _define_optional('DBAUTH_GROUP_MEMBERS', "SELECT user FROM user WHERE group='\$groupname'", "");
1175 $properties["DBAUTH_USER_GROUPS"] =
1176 new _define_optional('DBAUTH_USER_GROUPS', "SELECT group FROM user WHERE user='\$userid'", "");
1178 if (function_exists('ldap_connect')) {
1180 $properties["LDAP AUTH Host"] =
1181 new _define_optional('LDAP_AUTH_HOST', "ldap://localhost:389", "
1182 If USER_AUTH_ORDER contains Ldap:
1184 The LDAP server to connect to. Can either be a hostname, or a complete
1185 URL to the server (useful if you want to use ldaps or specify a different
1188 $properties["LDAP BASE DN"] =
1189 new _define_optional('LDAP_BASE_DN', "ou=mycompany.com,o=My Company", "
1190 The organizational or domain BASE DN: e.g. \"dc=mydomain,dc=com\".
1192 Note: ou=Users and ou=Groups are used for GroupLdap Membership
1193 Better use LDAP_OU_USERS and LDAP_OU_GROUP with GROUP_METHOD=LDAP.");
1195 $properties["LDAP SET OPTION"] =
1196 new _define_optional('LDAP_SET_OPTION', "LDAP_OPT_PROTOCOL_VERSION=3:LDAP_OPT_REFERRALS=0", "
1197 Some LDAP servers need some more options, such as the Windows Active
1198 Directory Server. Specify the options (as allowed by the PHP LDAP module)
1199 and their values as NAME=value pairs separated by colons.");
1201 $properties["LDAP AUTH USER"] =
1202 new _define_optional('LDAP_AUTH_USER', "CN=ldapuser,ou=Users,o=Development,dc=mycompany.com", "
1203 DN to initially bind to the LDAP server as. This is needed if the server doesn't
1204 allow anonymous queries. (Windows Active Directory Server)");
1206 $properties["LDAP AUTH PASSWORD"] =
1207 new _define_optional('LDAP_AUTH_PASSWORD', "secret", "
1208 Password to use to initially bind to the LDAP server, as the DN
1209 specified in the LDAP_AUTH_USER option (above).");
1211 $properties["LDAP SEARCH FIELD"] =
1212 new _define_optional('LDAP_SEARCH_FIELD', "uid", "
1213 If you want to match usernames against an attribute other than uid,
1214 specify it here. Default: uid
1216 e.g.: LDAP_SEARCH_FIELD = sAMAccountName");
1218 $properties["LDAP OU USERS"] =
1219 new _define_optional('LDAP_OU_USERS', "ou=Users", "
1220 If you have an organizational unit for all users, define it here.
1221 This narrows the search, and is needed for LDAP group membership (if GROUP_METHOD=LDAP)
1222 Default: ou=Users");
1224 $properties["LDAP OU GROUP"] =
1225 new _define_optional('LDAP_OU_GROUP', "ou=Groups", "
1226 If you have an organizational unit for all groups, define it here.
1227 This narrows the search, and is needed for LDAP group membership (if GROUP_METHOD=LDAP)
1228 The entries in this ou must have a gidNumber and cn attribute.
1229 Default: ou=Groups");
1231 } else { // function_exists('ldap_connect')
1233 $properties["LDAP Authentication"] =
1234 new unchangeable_define('LDAP Authentication', "
1235 If USER_AUTH_ORDER contains Ldap:
1237 The LDAP server to connect to. Can either be a hostname, or a complete
1238 URL to the server (useful if you want to use ldaps or specify a different
1240 ;LDAP_AUTH_HOST = \"ldap://localhost:389\"
1242 ; The organizational or domain BASE DN: e.g. \"dc=mydomain,dc=com\".
1244 ; Note: ou=Users and ou=Groups are used for GroupLdap Membership
1245 ; Better use LDAP_OU_USERS and LDAP_OU_GROUP with GROUP_METHOD=LDAP.
1246 ;LDAP_BASE_DN = \"ou=Users,o=Development,dc=mycompany.com\"
1248 ; Some LDAP servers need some more options, such as the Windows Active
1249 ; Directory Server. Specify the options (as allowed by the PHP LDAP module)
1250 ; and their values as NAME=value pairs separated by colons.
1251 ; LDAP_SET_OPTION = \"LDAP_OPT_PROTOCOL_VERSION=3:LDAP_OPT_REFERRALS=0\"
1253 ; DN to initially bind to the LDAP server as. This is needed if the server doesn't
1254 ; allow anonymous queries. (Windows Active Directory Server)
1255 ; LDAP_AUTH_USER = \"CN=ldapuser,ou=Users,o=Development,dc=mycompany.com\"
1257 ; Password to use to initially bind to the LDAP server, as the DN
1258 ; specified in the LDAP_AUTH_USER option (above).
1259 ; LDAP_AUTH_PASSWORD = secret
1261 ; If you want to match usernames against an attribute other than uid,
1262 ; specify it here. Default: uid
1263 ; LDAP_SEARCH_FIELD = sAMAccountName
1265 ; If you have an organizational unit for all users, define it here.
1266 ; This narrows the search, and is needed for LDAP group membership (if GROUP_METHOD=LDAP)
1268 ; LDAP_OU_USERS = ou=Users
1270 ; If you have an organizational unit for all groups, define it here.
1271 ; This narrows the search, and is needed for LDAP group membership (if GROUP_METHOD=LDAP)
1272 ; The entries in this ou must have a gidNumber and cn attribute.
1273 ; Default: ou=Groups
1274 ; LDAP_OU_GROUP = ou=Groups", "
1275 ; Ignored. No LDAP support in this php. configure --with-ldap");
1278 if (function_exists('imap_open')) {
1280 $properties["IMAP Auth Host"] =
1281 new _define_optional('IMAP_AUTH_HOST', 'localhost:143/imap/notls', "
1282 If USER_AUTH_ORDER contains IMAP:
1284 The IMAP server to check usernames from. Defaults to localhost.
1286 Some IMAP_AUTH_HOST samples:
1287 localhost, localhost:143/imap/notls,
1288 localhost:993/imap/ssl/novalidate-cert (SuSE refuses non-SSL conections)");
1290 } else { // function_exists('imap_open')
1292 $properties["IMAP Authentication"] =
1293 new unchangeable_define('IMAP_AUTH_HOST',"
1294 ; If USER_AUTH_ORDER contains IMAP:
1295 ; The IMAP server to check usernames from. Defaults to localhost.
1297 ; Some IMAP_AUTH_HOST samples:
1298 ; localhost, localhost:143/imap/notls,
1299 ; localhost:993/imap/ssl/novalidate-cert (SuSE refuses non-SSL conections)
1300 ;IMAP_AUTH_HOST = localhost:143/imap/notls", "
1301 Ignored. No IMAP support in this php. configure --with-imap");
1305 $properties["POP3 Authentication"] =
1306 new _define_optional('POP3_AUTH_HOST', 'localhost:110', "
1307 If USER_AUTH_ORDER contains POP3:
1309 The POP3 mail server to check usernames and passwords against.");
1310 $properties["File Authentication"] =
1311 new _define_optional('AUTH_USER_FILE', '/etc/shadow', "
1312 If USER_AUTH_ORDER contains File:
1314 File to read for authentication information.
1315 Popular choices are /etc/shadow and /etc/httpd/.htpasswd");
1317 $properties["File Storable?"] =
1318 new boolean_define_commented_optional
1319 ('AUTH_USER_FILE_STORABLE',
1320 array('false' => "Disabled",
1321 'true' => "Enabled"), "
1322 Defines whether the user is able to change their own password via PhpWiki.
1323 Note that this means that the webserver user must be able to write to the
1324 file specified in AUTH_USER_FILE.");
1326 $properties["Session Auth USER"] =
1327 new _define_optional('AUTH_SESS_USER', 'userid', "
1328 If USER_AUTH_ORDER contains Session:
1330 Name of the session variable which holds the already authenticated username.
1331 Sample: 'userid', 'user[username]', 'user->username'");
1333 $properties["Session Auth LEVEL"] =
1334 new numeric_define('AUTH_SESS_LEVEL', '2', "
1335 Which level will the user be? 1 = Bogo or 2 = Pass");
1337 /////////////////////////////////////////////////////////////////////
1339 $properties["Part Four"] =
1340 new part('_part4', $SEPARATOR."\n", "
1343 Page appearance and layout");
1345 $properties["Theme"] =
1346 new _define_selection_optional('THEME',
1347 array('default' => "default",
1348 'MacOSX' => "MacOSX",
1349 'smaller' => 'smaller',
1350 'Wordpress'=> 'Wordpress',
1351 'Portland' => "Portland",
1352 'Hawaiian' => "Hawaiian",
1353 'Sidebar' => "Sidebar",
1355 'wikilens' => 'wikilens (Ratings)',
1356 'SpaceWiki' => "SpaceWiki",
1357 'shamino_com' => 'shamino_com',
1358 'MonoBook' => 'MonoBook [experimental]',
1359 'blog' => 'blog [experimental]',
1363 Most of the page appearance is controlled by files in the theme
1366 There are a number of pre-defined themes shipped with PhpWiki.
1367 Or you may create your own (e.g. by copying and then modifying one of
1372 THEME = MonoBook (WikiPedia) [experimental. MSIE problems]
1373 THEME = blog (Kubrick) [experimental. Several links missing]
1376 $properties["Character Set"] =
1377 new _define_optional('CHARSET', 'iso-8859-1', "
1378 Select a valid charset name to be inserted into the xml/html pages,
1379 and to reference links to the stylesheets (css). For more info see:
1380 http://www.iana.org/assignments/character-sets. Note that PhpWiki
1381 has been extensively tested only with the latin1 (iso-8859-1)
1384 If you change the default from iso-8859-1 PhpWiki may not work
1385 properly and it will require code modifications. However, character
1386 sets similar to iso-8859-1 may work with little or no modification
1387 depending on your setup. The database must also support the same
1388 charset, and of course the same is true for the web browser. (Some
1389 work is in progress hopefully to allow more flexibility in this
1390 area in the future).");
1392 $properties["Language"] =
1393 new _define_selection_optional('DEFAULT_LANGUAGE',
1394 array('en' => "English",
1395 '' => "<empty> (user-specific)",
1396 'fr' => "Français",
1398 'nl' => "Nederlands",
1403 'zh' => "Chinese"), "
1404 Select your language/locale - default language is \"en\" for English.
1405 Other languages available:<pre>
1406 English \"en\" (English - HomePage)
1407 German \"de\" (Deutsch - StartSeite)
1408 French \"fr\" (Français - Accueil)
1409 Dutch \"nl\" (Nederlands - ThuisPagina)
1410 Spanish \"es\" (Español - PáginaPrincipal)
1411 Swedish \"sv\" (Svenska - Framsida)
1412 Italian \"it\" (Italiano - PaginaPrincipale)
1413 Japanese \"ja\" (Japanese - ¥Û¡¼¥à ¥Ú¡¼¥¸)
1414 Chinese \"zh\" (Chinese)
1416 If you set DEFAULT_LANGUAGE to the empty string, your systems default language
1417 (as determined by the applicable environment variables) will be
1420 $properties["Wiki Page Source"] =
1421 new _define_optional('WIKI_PGSRC', 'pgsrc', "
1422 WIKI_PGSRC -- specifies the source for the initial page contents of
1423 the Wiki. The setting of WIKI_PGSRC only has effect when the wiki is
1424 accessed for the first time (or after clearing the database.)
1425 WIKI_PGSRC can either name a directory or a zip file. In either case
1426 WIKI_PGSRC is scanned for files -- one file per page.
1428 // Default (old) behavior:
1429 define('WIKI_PGSRC', 'pgsrc');
1431 define('WIKI_PGSRC', 'wiki.zip');
1432 define('WIKI_PGSRC',
1433 '../Logs/Hamwiki/hamwiki-20010830.zip');
1437 $properties["Default Wiki Page Source"] =
1438 new _define('DEFAULT_WIKI_PGSRC', 'pgsrc', "
1439 DEFAULT_WIKI_PGSRC is only used when the language is *not* the
1440 default (English) and when reading from a directory: in that case
1441 some English pages are inserted into the wiki as well.
1442 DEFAULT_WIKI_PGSRC defines where the English pages reside.
1444 FIXME: is this really needed?
1447 $properties["Generic Pages"] =
1448 new array_variable('GenericPages', array('ReleaseNotes', 'SteveWainstead', 'TestPage'), "
1449 These are the pages which will get loaded from DEFAULT_WIKI_PGSRC.
1451 FIXME: is this really needed? Cannot we just copy these pages into
1452 the localized pgsrc?
1458 $properties["Part Five"] =
1459 new part('_part5', $SEPARATOR."\n", "
1464 $properties["Allowed Protocols"] =
1465 new list_define('ALLOWED_PROTOCOLS', 'http|https|mailto|ftp|news|nntp|ssh|gopher', "
1466 Allowed protocols for links - be careful not to allow \"javascript:\"
1467 URL of these types will be automatically linked.
1468 within a named link [name|uri] one more protocol is defined: phpwiki");
1470 $properties["Inline Images"] =
1471 new list_define('INLINE_IMAGES', 'png|jpg|gif', "
1472 URLs ending with the following extension should be inlined as images.
1473 Scripts shoud not be allowed!");
1475 $properties["WikiName Regexp"] =
1476 new _define('WIKI_NAME_REGEXP', "(?<![[:alnum:]])(?:[[:upper:]][[:lower:]]+){2,}(?![[:alnum:]])", "
1477 Perl regexp for WikiNames (\"bumpy words\")
1478 (?<!..) & (?!...) used instead of '\b' because \b matches '_' as well");
1480 $properties["Subpage Separator"] =
1481 new _define_optional('SUBPAGE_SEPARATOR', '"/"', "
1482 One character which seperates pages from subpages. Defaults to '/', but '.' or ':' were also used.",
1483 "onchange=\"validate_ereg('Sorry, \'%s\' must be a single character. Currently only :, / or .', '^[/:.]$', 'SUBPAGE_SEPARATOR', this);\""
1486 $properties["InterWiki Map File"] =
1487 new _define('INTERWIKI_MAP_FILE', 'lib/interwiki.map', "
1488 InterWiki linking -- wiki-style links to other wikis on the web
1490 The map will be taken from a page name InterWikiMap.
1491 If that page is not found (or is not locked), or map
1492 data can not be found in it, then the file specified
1493 by INTERWIKI_MAP_FILE (if any) will be used.");
1495 $properties["WARN_NONPUBLIC_INTERWIKIMAP"] =
1496 new boolean_define('WARN_NONPUBLIC_INTERWIKIMAP',
1497 array('true' => "true",
1498 'false' => "false"), "
1499 Display a warning if the internal lib/interwiki.map is used, and
1500 not the public InterWikiMap page. This map is not readable from outside.");
1503 $properties["Keyword Link Regexp"] =
1504 new _define_optional('KEYWORDS', '\"Category* OR Topic*\"', "
1505 Search term used for automatic page classification by keyword extraction.
1507 Any links on a page to pages whose names match this search
1508 will be used keywords in the keywords html meta tag. This is an aid to
1509 classification by search engines. The value of the match is
1510 used as the keyword.
1512 The default behavior is to match Category* or Topic* links.");
1514 $properties["Author and Copyright Site Navigation Links"] =
1515 new _define_commented_optional('COPYRIGHTPAGE_TITLE', "GNU General Public License", "
1517 These will be inserted as <link rel> tags in the html header of
1518 every page, for search engines and for browsers like Mozilla which
1519 take advantage of link rel site navigation.
1521 If you have your own copyright and contact information pages change
1522 these as appropriate.");
1524 $properties["COPYRIGHTPAGE URL"] =
1525 new _define_commented_optional('COPYRIGHTPAGE_URL', "http://www.gnu.org/copyleft/gpl.html#SEC1", "
1527 Other useful alternatives to consider:
1529 COPYRIGHTPAGE_TITLE = \"GNU Free Documentation License\"
1530 COPYRIGHTPAGE_URL = \"http://www.gnu.org/copyleft/fdl.html\"
1531 COPYRIGHTPAGE_TITLE = \"Creative Commons License 2.0\"
1532 COPYRIGHTPAGE_URL = \"http://creativecommons.org/licenses/by/2.0/\"</pre>
1533 See http://creativecommons.org/learn/licenses/ for variations");
1535 $properties["AUTHORPAGE_TITLE"] =
1536 new _define_commented_optional('AUTHORPAGE_TITLE', "The PhpWiki Programming Team", "
1537 Default Author Names");
1538 $properties["AUTHORPAGE_URL"] =
1539 new _define_commented_optional('AUTHORPAGE_URL', "http://phpwiki.org/ThePhpWikiProgrammingTeam", "
1540 Default Author URL");
1542 new boolean_define_optional
1544 array('true' => "Enabled",
1545 'false' => "Disabled"), "
1546 Allow full markup in headers to be parsed by the CreateToc plugin.
1548 If false you may not use WikiWords or [] links or any other markup in
1549 headers in pages with the CreateToc plugin. But if false the parsing is
1550 faster and more stable.");
1554 $properties["Part Six"] =
1555 new part('_part6', $SEPARATOR."\n", "
1557 Part Six (optional):
1558 URL options -- you can probably skip this section.
1560 For a pretty wiki (no index.php in the url) set a seperate DATA_PATH.");
1562 global $HTTP_SERVER_VARS;
1563 $properties["Server Name"] =
1564 new _define_commented_optional('SERVER_NAME', $HTTP_SERVER_VARS['SERVER_NAME'], "
1565 Canonical name of the server on which this PhpWiki resides.");
1567 $properties["Server Port"] =
1568 new numeric_define_commented('SERVER_PORT', $HTTP_SERVER_VARS['SERVER_PORT'], "
1569 Canonical httpd port of the server on which this PhpWiki resides.",
1570 "onchange=\"validate_ereg('Sorry, \'%s\' is no valid port number.', '^[0-9]+$', 'SERVER_PORT', this);\"");
1572 $properties["Script Name"] =
1573 new _define_commented_optional('SCRIPT_NAME', $scriptname, "
1574 Relative URL (from the server root) of the PhpWiki script.");
1576 $properties["Data Path"] =
1577 new _define_commented_optional('DATA_PATH', dirname($scriptname), "
1578 URL of the PhpWiki install directory. (You only need to set this
1579 if you've moved index.php out of the install directory.) This can
1580 be either a relative URL (from the directory where the top-level
1581 PhpWiki script is) or an absolute one.");
1584 $properties["PhpWiki Install Directory"] =
1585 new _define_commented_optional('PHPWIKI_DIR', dirname(__FILE__), "
1586 Path to the PhpWiki install directory. This is the local
1587 filesystem counterpart to DATA_PATH. (If you have to set
1588 DATA_PATH, your probably have to set this as well.) This can be
1589 either an absolute path, or a relative path interpreted from the
1590 directory where the top-level PhpWiki script (normally index.php)
1593 $properties["Use PATH_INFO"] =
1594 new _define_selection_optional_commented('USE_PATH_INFO',
1595 array('' => 'automatic',
1596 'true' => 'use PATH_INFO',
1597 'false' => 'do not use PATH_INFO'), "
1598 PhpWiki will try to use short urls to pages, eg
1599 http://www.example.com/index.php/HomePage
1600 If you want to use urls like
1601 http://www.example.com/index.php?pagename=HomePage
1602 then define 'USE_PATH_INFO' as false by uncommenting the line below.
1603 NB: If you are using Apache >= 2.0.30, then you may need to to use
1604 the directive \"AcceptPathInfo On\" in your Apache configuration file
1605 (or in an appropriate <.htaccess> file) for the short urls to work:
1606 See http://httpd.apache.org/docs-2.0/mod/core.html#acceptpathinfo
1608 See also http://phpwiki.sourceforge.net/phpwiki/PrettyWiki for more ideas
1609 on prettifying your urls.
1611 Default: PhpWiki will try to divine whether use of PATH_INFO
1612 is supported in by your webserver/PHP configuration, and will
1613 use PATH_INFO if it thinks that is possible.");
1615 $properties["Virtual Path"] =
1616 new _define_commented_optional('VIRTUAL_PATH', '/SomeWiki', "
1617 VIRTUAL_PATH is the canonical URL path under which your your wiki
1618 appears. Normally this is the same as dirname(SCRIPT_NAME), however
1619 using e.g. seperate starter scripts, apaches mod_actions (or mod_rewrite),
1620 you can make it something different.
1622 If you do this, you should set VIRTUAL_PATH here or in the starter scripts.
1624 E.g. your phpwiki might be installed at at /scripts/phpwiki/index.php,
1625 but you've made it accessible through eg. /wiki/HomePage.
1627 One way to do this is to create a directory named 'wiki' in your
1628 server root. The directory contains only one file: an .htaccess
1629 file which reads something like:
1631 Action x-phpwiki-page /scripts/phpwiki/index.php
1632 SetHandler x-phpwiki-page
1633 DirectoryIndex /scripts/phpwiki/index.php
1635 In that case you should set VIRTUAL_PATH to '/wiki'.
1637 (VIRTUAL_PATH is only used if USE_PATH_INFO is true.)
1642 $properties["Part Seven"] =
1643 new part('_part7', $SEPARATOR."\n", "
1647 Miscellaneous settings
1650 $properties["Strict Mailable Pagedumps"] =
1651 new boolean_define_optional
1652 ('STRICT_MAILABLE_PAGEDUMPS',
1653 array('false' => "binary",
1654 'true' => "quoted-printable"),
1656 If you define this to true, (MIME-type) page-dumps (either zip dumps,
1657 or \"dumps to directory\" will be encoded using the quoted-printable
1658 encoding. If you're actually thinking of mailing the raw page dumps,
1659 then this might be useful, since (among other things,) it ensures
1660 that all lines in the message body are under 80 characters in length.
1662 Also, setting this will cause a few additional mail headers
1663 to be generated, so that the resulting dumps are valid
1664 RFC 2822 e-mail messages.
1666 Probably, you can just leave this set to false, in which case you get
1667 raw ('binary' content-encoding) page dumps.");
1669 $properties["HTML Dump Filename Suffix"] =
1670 new _define_optional('HTML_DUMP_SUFFIX', ".html", "
1671 Here you can change the filename suffix used for XHTML page dumps.
1672 If you don't want any suffix just comment this out.");
1674 $properties["Default local Dump Directory"] =
1675 new _define_optional('DEFAULT_DUMP_DIR', "/tmp/wikidump", "
1676 Specify the default directory for local backups.");
1678 $properties["Default local HTML Dump Directory"] =
1679 new _define_optional('HTML_DUMP_DIR', "/tmp/wikidumphtml", "
1680 Specify the default directory for local XHTML dumps.");
1682 $properties["Pagename of Recent Changes"] =
1683 new _define_optional('RECENT_CHANGES', 'RecentChanges', "
1684 Page name of RecentChanges page. Used for RSS Auto-discovery.");
1686 $properties["Disable HTTP Redirects"] =
1687 new boolean_define_commented_optional
1688 ('DISABLE_HTTP_REDIRECT',
1689 array('false' => 'Enable HTTP Redirects',
1690 'true' => 'Disable HTTP Redirects'),
1692 (You probably don't need to touch this.)
1694 PhpWiki uses HTTP redirects for some of it's functionality.
1695 (e.g. after saving changes, PhpWiki redirects your browser to
1696 view the page you just saved.)
1698 Some web service providers (notably free European Lycos) don't seem to
1699 allow these redirects. (On Lycos the result in an \"Internal Server Error\"
1700 report.) In that case you can set DISABLE_HTTP_REDIRECT to true.
1701 (In which case, PhpWiki will revert to sneakier tricks to try to
1702 redirect the browser...)");
1704 $properties["Disable GETIMAGESIZE"] =
1705 new boolean_define_commented_optional
1706 ('DISABLE_GETIMAGESIZE',
1707 array('false' => 'Enable',
1708 'true' => 'Disable'), "
1709 Set GETIMAGESIZE to disabled, if your php fails to calculate the size on
1710 inlined images, or you don't want to disable too small images to be inlined.
1712 Per default too small ploaded or external images are not displayed,
1713 to prevent from external 1 pixel spam.");
1715 $properties["EDITING_POLICY"] =
1716 new _define_optional('EDITING_POLICY', "EditingPolicy", "
1717 An interim page which gets displayed on every edit attempt, if it exists.");
1719 $properties["ENABLE_MODERATEDPAGE_ALL"] =
1720 new boolean_define_commented_optional
1721 ('ENABLE_MODERATEDPAGE_ALL',
1722 array('false' => 'Disable',
1723 'true' => 'Enable'), "
1726 $properties["FORTUNE_DIR"] =
1727 new _define_commented_optional('FORTUNE_DIR', "/usr/share/fortune", "
1729 $properties["DBADMIN_USER"] =
1730 new _define_commented_optional('DBADMIN_USER', "", "
1732 $properties["DBADMIN_PASSWD"] =
1733 new _define_commented_optional('DBADMIN_PASSWD', "", "
1735 $properties["USE_EXTERNAL_HTML2PDF"] =
1736 new _define_commented_optional('USE_EXTERNAL_HTML2PDF', "htmldoc --quiet --format pdf14 --no-toc --no-title %s", "
1738 $properties["BABYCART_PATH"] =
1739 new _define_commented_optional('BABYCART_PATH', "/usr/local/bin/babycart", "
1742 $properties["Part Seven A"] =
1743 new part('_part7a', $SEPARATOR."\n", "
1747 Cached Plugin Settings. (pear Cache)
1750 $properties["pear Cache USECACHE"] =
1751 new boolean_define_optional('PLUGIN_CACHED_USECACHE',
1752 array('true' => 'Enabled',
1753 'false' => 'Disabled'), "
1754 Enable or disable pear caching of plugins.");
1755 $properties["pear Cache Database Container"] =
1756 new _define_selection_optional('PLUGIN_CACHED_DATABASE',
1757 array('file' => 'file'), "
1758 Curently only file is supported.
1759 db, trifile and imgfile might be supported, but you must hack that by yourself.");
1761 $properties["pear Cache cache directory"] =
1762 new _define_commented_optional('PLUGIN_CACHED_CACHE_DIR', "/tmp/cache", "
1763 Should be writable to the webserver.");
1764 $properties["pear Cache Filename Prefix"] =
1765 new _define_optional('PLUGIN_CACHED_FILENAME_PREFIX', "phpwiki", "");
1766 $properties["pear Cache HIGHWATER"] =
1767 new numeric_define_optional('PLUGIN_CACHED_HIGHWATER', "4194304", "
1768 Garbage collection parameter.");
1769 $properties["pear Cache LOWWATER"] =
1770 new numeric_define_optional('PLUGIN_CACHED_LOWWATER', "3145728", "
1771 Garbage collection parameter.");
1772 $properties["pear Cache MAXLIFETIME"] =
1773 new numeric_define_optional('PLUGIN_CACHED_MAXLIFETIME', "2592000", "
1774 Garbage collection parameter.");
1775 $properties["pear Cache MAXARGLEN"] =
1776 new numeric_define_optional('PLUGIN_CACHED_MAXARGLEN', "1000", "
1777 max. generated url length.");
1778 $properties["pear Cache FORCE_SYNCMAP"] =
1779 new boolean_define_optional('PLUGIN_CACHED_FORCE_SYNCMAP',
1780 array('true' => 'Enabled',
1781 'false' => 'Disabled'), "");
1782 $properties["pear Cache IMGTYPES"] =
1783 new list_define('PLUGIN_CACHED_IMGTYPES', "png|gif|gd|gd2|jpeg|wbmp|xbm|xpm", "
1784 Handle those image types via GD handles. Check your GD supported image types.");
1786 $end = "\n".$SEPARATOR."\n";
1788 // end of configuration options
1789 ///////////////////////////////
1790 // begin class definitions
1793 * A basic config-dist.ini configuration line in the form of a variable.
1794 * (not needed anymore, we have only defines)
1796 * Produces a string in the form "$name = value;"
1798 * $WikiNameRegexp = "value";
1802 var $config_item_name;
1808 function _variable($config_item_name, $default_value, $description, $jscheck = '') {
1809 $this->config_item_name = $config_item_name;
1810 $this->description = $description;
1811 if (defined($config_item_name)
1812 and !preg_match("/(selection|boolean)/", get_class($this))
1813 and !preg_match("/(SCRIPT_NAME|VIRTUAL_PATH)/", $config_item_name))
1814 $this->default_value = constant($config_item_name); // ignore given default value
1816 $this->default_value = $default_value;
1817 $this->jscheck = $jscheck;
1818 if (preg_match("/variable/i",get_class($this)))
1819 $this->prefix = "\$";
1820 elseif (preg_match("/ini_set/i",get_class($this)))
1821 $this->prefix = "ini_get: ";
1827 global $HTTP_POST_VARS;
1828 if (isset($HTTP_POST_VARS[$this->config_item_name]))
1829 return $HTTP_POST_VARS[$this->config_item_name];
1831 return $this->default_value;
1834 function _config_format($value) {
1836 $v = $this->get_config_item_name();
1837 // handle arrays: a|b --> a['b']
1838 if (strpos($v, '|')) {
1839 list($a, $b) = explode('|', $v);
1840 $v = sprintf("%s['%s']", $a, $b);
1842 if (preg_match("/[\"']/", $value))
1843 $value = '"' . $value . '"';
1844 return sprintf("%s = \"%s\"", $v, $value);
1847 function get_config_item_name() {
1848 return $this->config_item_name;
1851 function get_config_item_id() {
1852 return str_replace('|', '-', $this->config_item_name);
1855 function get_config_item_header() {
1856 if (strchr($this->config_item_name,'|')) {
1857 list($var,$param) = explode('|',$this->config_item_name);
1858 return "<b>" . $this->prefix . $var . "['" . $param . "']</b><br />";
1860 elseif ($this->config_item_name[0] != '_')
1861 return "<b>" . $this->prefix . $this->config_item_name . "</b><br />";
1866 function _get_description() {
1867 return $this->description;
1870 function _get_config_line($posted_value) {
1871 return "\n" . $this->_config_format($posted_value);
1874 function get_config($posted_value) {
1875 $d = stripHtml($this->_get_description());
1876 $d = str_replace("\n", "\n; ", $d) . $this->_get_config_line($posted_value) ."\n";
1880 function get_instructions($title) {
1882 $i = "<h3>" . $title . "</h3>\n " . nl2p($this->_get_description()) . "\n";
1883 return "<tr>\n<td width=\"$tdwidth\" class=\"instructions\">\n" . $i . "</td>\n";
1886 function get_html() {
1887 $size = strlen($this->default_value) > 45 ? 90 : 50;
1888 return $this->get_config_item_header() .
1889 "<input type=\"text\" size=\"$50\" name=\"" . $this->get_config_item_name() . "\" value=\"" . htmlspecialchars($this->default_value) . "\" " .
1890 $this->jscheck . " />" . "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: green\">Input accepted.</p>";
1894 class unchangeable_variable
1896 function _config_format($value) {
1899 // function get_html() { return false; }
1900 function get_html() {
1901 return $this->get_config_item_header() .
1902 "<em>Not editable.</em>" .
1903 "<pre>" . $this->default_value."</pre>";
1905 function _get_config_line($posted_value) {
1906 if ($this->description)
1908 return "${n}".$this->default_value;
1910 function get_instructions($title) {
1912 $i = "<h3>" . $title . "</h3>\n " . nl2p($this->_get_description()) . "\n";
1913 // $i .= "<em>Not editable.</em><br />\n<pre>" . $this->default_value."</pre>";
1914 return '<tr><td width="100%" class="unchangeable-variable-top" colspan="2">'."\n".$i."</td></tr>\n"
1915 . '<tr style="border-top: none;"><td class="unchangeable-variable-left" width="'.$tdwidth.'"> </td>';
1919 class unchangeable_define
1920 extends unchangeable_variable {
1921 function _config_format($value) {
1925 class unchangeable_ini_set
1926 extends unchangeable_variable {
1927 function _config_format($value) {
1932 class _variable_selection
1935 global $HTTP_POST_VARS;
1936 if (!empty($HTTP_POST_VARS[$this->config_item_name]))
1937 return $HTTP_POST_VARS[$this->config_item_name];
1939 list($option, $label) = each($this->default_value);
1943 function get_html() {
1944 $output = $this->get_config_item_header();
1945 $output .= '<select name="' . $this->get_config_item_name() . "\">\n";
1946 /* The first option is the default */
1947 $values = $this->default_value;
1948 if (defined($this->get_config_item_name()))
1949 $this->default_value = constant($this->get_config_item_name());
1951 $this->default_value = null;
1952 while(list($option, $label) = each($values)) {
1953 if (!is_null($this->default_value) and $this->default_value === $option)
1954 $output .= " <option value=\"$option\" selected=\"selected\">$label</option>\n";
1956 $output .= " <option value=\"$option\">$label</option>\n";
1958 $output .= "</select>\n";
1966 function _config_format($value) {
1967 return sprintf("%s = \"%s\"", $this->get_config_item_name(), $value);
1969 function _get_config_line($posted_value) {
1970 if ($this->description)
1972 if ($posted_value == '')
1973 return "${n};" . $this->_config_format("");
1975 return "${n}" . $this->_config_format($posted_value);
1977 function get_html() {
1978 $size = strlen($this->default_value) > 45 ? 90 : 50;
1979 return $this->get_config_item_header()
1980 . "<input type=\"text\" size=\"$size\" name=\"" . htmlentities($this->get_config_item_name())
1981 . "\" value=\"" . htmlentities($this->default_value) . "\" {$this->jscheck} />"
1982 . "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: green\">Input accepted.</p>";
1986 class _define_commented
1988 function _get_config_line($posted_value) {
1989 if ($this->description)
1991 if ($posted_value == $this->default_value)
1992 return "${n};" . $this->_config_format($posted_value);
1993 elseif ($posted_value == '')
1994 return "${n};" . $this->_config_format("");
1996 return "${n}" . $this->_config_format($posted_value);
2001 * We don't use _optional anymore, because INI-style config's don't need that.
2002 * IniConfig.php does the optional logic now.
2003 * But we use _optional for config-default.ini options
2005 class _define_commented_optional
2006 extends _define_commented { }
2008 class _define_optional
2011 class _define_notempty
2013 function get_html() {
2014 $s = $this->get_config_item_header()
2015 . "<input type=\"text\" size=\"50\" name=\"" . $this->get_config_item_name()
2016 . "\" value=\"" . $this->default_value . "\" {$this->jscheck} />";
2017 if (empty($this->default_value))
2018 return $s . "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: red\">Cannot be empty.</p>";
2020 return $s . "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: green\">Input accepted.</p>";
2024 class _variable_commented
2026 function _get_config_line($posted_value) {
2027 if ($this->description)
2029 if ($posted_value == $this->default_value)
2030 return "${n};" . $this->_config_format($posted_value);
2031 elseif ($posted_value == '')
2032 return "${n};" . $this->_config_format("");
2034 return "${n}" . $this->_config_format($posted_value);
2038 class numeric_define
2041 function numeric_define($config_item_name, $default_value, $description, $jscheck = '') {
2042 $this->_define($config_item_name, $default_value, $description, $jscheck);
2044 $this->jscheck = "onchange=\"validate_ereg('Sorry, \'%s\' is not an integer.', '^[-+]?[0-9]+$', '" . $this->get_config_item_name() . "', this);\"";
2046 function _config_format($value) {
2047 //return sprintf("define('%s', %s);", $this->get_config_item_name(), $value);
2048 return sprintf("%s = %s", $this->get_config_item_name(), $value);
2050 function _get_config_line($posted_value) {
2051 if ($this->description)
2053 if ($posted_value == '')
2054 return "${n};" . $this->_config_format('0');
2056 return "${n}" . $this->_config_format($posted_value);
2060 class numeric_define_optional
2061 extends numeric_define {}
2063 class numeric_define_commented
2064 extends numeric_define {
2065 function _get_config_line($posted_value) {
2066 if ($this->description)
2068 if ($posted_value == $this->default_value)
2069 return "${n};" . $this->_config_format($posted_value);
2070 elseif ($posted_value == '')
2071 return "${n};" . $this->_config_format('0');
2073 return "${n}" . $this->_config_format($posted_value);
2077 class _define_selection
2078 extends _variable_selection {
2079 function _config_format($value) {
2080 return sprintf("%s = %s", $this->get_config_item_name(), $value);
2082 function _get_config_line($posted_value) {
2083 return _define::_get_config_line($posted_value);
2085 function get_html() {
2086 return _variable_selection::get_html();
2090 class _define_selection_optional
2091 extends _define_selection { }
2093 class _variable_selection_optional
2094 extends _variable_selection { }
2096 class _define_selection_optional_commented
2097 extends _define_selection_optional {
2098 function _get_config_line($posted_value) {
2099 if ($this->description)
2101 if ($posted_value == $this->default_value)
2102 return "${n};" . $this->_config_format($posted_value);
2103 elseif ($posted_value == '')
2104 return "${n};" . $this->_config_format("");
2106 return "${n}" . $this->_config_format($posted_value);
2110 class _define_password
2113 function _define_password($config_item_name, $default_value, $description, $jscheck = '') {
2114 $this->_define($config_item_name, $default_value, $description, $jscheck);
2116 $this->jscheck = "onchange=\"validate_ereg('Sorry, \'%s\' cannot be empty.', '^.+$', '"
2117 . $this->get_config_item_name() . "', this);\"";
2119 function _get_config_line($posted_value) {
2120 if ($this->description)
2122 if ($posted_value == '') {
2123 $p = "${n};" . $this->_config_format("");
2124 $p .= "\n; If you used the passencrypt.php utility to encode the password";
2125 $p .= "\n; then uncomment this line:";
2126 $p .= "\n;ENCRYPTED_PASSWD = true";
2129 if (function_exists('crypt')) {
2130 $salt_length = max(CRYPT_SALT_LENGTH,
2134 16 * CRYPT_BLOWFISH);
2135 // generate an encrypted password
2136 $crypt_pass = crypt($posted_value, rand_ascii($salt_length));
2137 $p = "${n}" . $this->_config_format($crypt_pass);
2138 return $p . "\nENCRYPTED_PASSWD = true";
2140 $p = "${n}" . $this->_config_format($posted_value);
2141 $p .= "\n; Encrypted passwords cannot be used:";
2142 $p .= "\n; 'function crypt()' not available in this version of php";
2143 $p .= "\nENCRYPTED_PASSWD = false";
2148 function get_html() {
2149 return _variable_password::get_html();
2153 class _define_password_optional
2154 extends _define_password { }
2156 class _variable_password
2158 function _variable_password($config_item_name, $default_value, $description, $jscheck = '') {
2159 $this->_define($config_item_name, $default_value, $description, $jscheck);
2161 $this->jscheck = "onchange=\"validate_ereg('Sorry, \'%s\' cannot be empty.', '^.+$', '" . $this->get_config_item_name() . "', this);\"";
2163 function get_html() {
2164 global $HTTP_POST_VARS, $HTTP_GET_VARS;
2165 $s = $this->get_config_item_header();
2166 if (isset($HTTP_POST_VARS['create']) or isset($HTTP_GET_VARS['create'])) {
2167 $new_password = random_good_password();
2168 $this->default_value = $new_password;
2169 $s .= "Created password: <strong>$new_password</strong><br /> <br />";
2171 $s .= "<input type=\"password\" name=\"" . $this->get_config_item_name()
2172 . "\" value=\"" . $this->default_value
2173 . "\" {$this->jscheck} />"
2174 . " <input type=\"submit\" name=\"create\" value=\"Create Random Password\" />";
2175 if (empty($this->default_value))
2176 $s .= "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: red\">Cannot be empty.</p>";
2177 elseif (strlen($this->default_value) < 4)
2178 $s .= "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: red\">Must be longer than 4 chars.</p>";
2180 $s .= "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: green\">Input accepted.</p>";
2187 function _get_config_line($posted_value) {
2188 // split the phrase by any number of commas or space characters,
2189 // which include " ", \r, \t, \n and \f
2190 $list_values = preg_split("/[\s,]+/", $posted_value, -1, PREG_SPLIT_NO_EMPTY);
2191 $list_values = join("|", $list_values);
2192 return _variable::_get_config_line($list_values);
2194 function get_html() {
2195 $list_values = explode("|", $this->default_value);
2196 $rows = max(3, count($list_values) +1);
2197 $list_values = join("\n", $list_values);
2198 $ta = $this->get_config_item_header();
2199 $ta .= "<textarea cols=\"18\" rows=\"". $rows ."\" name=\"".$this->get_config_item_name()."\" {$this->jscheck}>";
2200 $ta .= $list_values . "</textarea>";
2201 $ta .= "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: green\">Input accepted.</p>";
2208 function _get_config_line($posted_value) {
2209 $list_values = preg_split("/[\s,]+/", $posted_value, -1, PREG_SPLIT_NO_EMPTY);
2210 $list_values = join("|", $list_values);
2211 return _variable::_get_config_line($list_values);
2213 function get_html() {
2214 $list_values = explode("|", $this->default_value);
2215 $rows = max(3, count($list_values) +1);
2216 $list_values = join("\n", $list_values);
2217 $ta = $this->get_config_item_header();
2218 $ta .= "<textarea cols=\"18\" rows=\"". $rows ."\" name=\"".$this->get_config_item_name()."\" {$this->jscheck}>";
2219 $ta .= $list_values . "</textarea>";
2220 $ta .= "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: green\">Input accepted.</p>";
2225 class array_variable
2227 function _config_format($value) {
2228 return sprintf("%s = \"%s\"", $this->get_config_item_name(),
2229 is_array($value) ? join(':', $value) : $value);
2231 function _get_config_line($posted_value) {
2232 // split the phrase by any number of commas or space characters,
2233 // which include " ", \r, \t, \n and \f
2234 $list_values = preg_split("/[\s,]+/", $posted_value, -1, PREG_SPLIT_NO_EMPTY);
2235 if (!empty($list_values)) {
2236 $list_values = "'".join("', '", $list_values)."'";
2237 return "\n" . $this->_config_format($list_values);
2239 return "\n;" . $this->_config_format('');
2241 function get_html() {
2242 $list_values = join("\n", $this->default_value);
2243 $rows = max(3, count($this->default_value) +1);
2244 $ta = $this->get_config_item_header();
2245 $ta .= "<textarea cols=\"18\" rows=\"". $rows ."\" name=\"".$this->get_config_item_name()."\" {$this->jscheck}>";
2246 $ta .= $list_values . "</textarea>";
2247 $ta .= "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: green\">Input accepted.</p>";
2254 function _config_format($value) {
2255 return sprintf("%s = \"%s\"", $this->get_config_item_name(),
2256 is_array($value) ? join(' : ', $value) : $value);
2258 function _get_config_line($posted_value) {
2259 // split the phrase by any number of commas or space characters,
2260 // which include " ", \r, \t, \n and \f
2261 $list_values = preg_split("/[\s,:]+/", $posted_value, -1, PREG_SPLIT_NO_EMPTY);
2262 if (!empty($list_values)) {
2263 $list_values = "'".join("' : '", $list_values)."'";
2264 return "\n" . $this->_config_format($list_values);
2266 return "\n;" . $this->_config_format('');
2268 function get_html() {
2269 $list_values = join("\n", $this->default_value);
2270 $rows = max(3, count($this->default_value) +1);
2271 $ta = $this->get_config_item_header();
2272 $ta .= "<textarea cols=\"18\" rows=\"". $rows ."\" name=\"".$this->get_config_item_name()."\" {$this->jscheck}>";
2273 $ta .= $list_values . "</textarea>";
2274 $ta .= "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: green\">Input accepted.</p>";
2283 global $HTTP_POST_VARS;
2284 if ($v = $HTTP_POST_VARS[$this->config_item_name])
2287 return ini_get($this->get_config_item_name);
2290 function _config_format($value) {
2291 return sprintf("ini_set('%s', '%s');", $this->get_config_item_name(), $value);
2293 function _get_config_line($posted_value) {
2294 if ($posted_value && ! $posted_value == $this->default_value)
2295 return "\n" . $this->_config_format($posted_value);
2297 return "\n;" . $this->_config_format($this->default_value);
2302 class boolean_define
2304 function _get_config_line($posted_value) {
2305 if ($this->description)
2307 return "${n}" . $this->_config_format($posted_value);
2309 function _config_format($value) {
2310 if (strtolower(trim($value)) == 'false')
2312 return sprintf("%s = %s", $this->get_config_item_name(),
2313 (bool)$value ? 'true' : 'false');
2315 function get_html() {
2316 $output = $this->get_config_item_header();
2317 $output .= '<select name="' . $this->get_config_item_name() . "\" {$this->jscheck}>\n";
2318 $values = $this->default_value;
2319 if (defined($this->get_config_item_name()))
2320 $this->default_value = constant($this->get_config_item_name());
2322 $this->default_value = null;
2323 list($option, $label) = each($values);
2324 $output .= " <option value=\"$option\" selected=\"selected\">$label</option>\n";
2326 /* There can usually, only be two options, there can be
2327 * three options in the case of a boolean_define_commented_optional */
2328 while (list($option, $label) = each($values)) {
2329 if (!is_null($this->default_value) and $this->default_value === $option)
2330 $output .= " <option value=\"$option\" selected=\"selected\">$label</option>\n";
2332 $output .= " <option value=\"$option\">$label</option>\n";
2334 $output .= "</select>\n";
2339 class boolean_define_optional
2340 extends boolean_define {}
2342 class boolean_define_commented
2343 extends boolean_define {
2344 function _get_config_line($posted_value) {
2345 if ($this->description)
2347 list($default_value, $label) = each($this->default_value);
2348 if ($posted_value == $default_value)
2349 return "${n};" . $this->_config_format($posted_value);
2350 elseif ($posted_value == '')
2351 return "${n};" . $this->_config_format('false');
2353 return "${n}" . $this->_config_format($posted_value);
2357 class boolean_define_commented_optional
2358 extends boolean_define_commented {}
2362 function value () { return; }
2363 function get_config($posted_value) {
2364 $d = stripHtml($this->_get_description());
2366 return "\n".$SEPARATOR . str_replace("\n", "\n; ", $d) ."\n".$this->default_value;
2368 function get_instructions($title) {
2369 $id = preg_replace("/\W/","",$this->config_item_name);
2370 $group_name = preg_replace("/\W/","",$title);
2371 $i = "<tr class=\"header\" id=\"$id\">\n<td class=\"part\" width=\"100%\" colspan=\"2\" bgcolor=\"#eeeeee\">\n";
2372 $i .= "<h2>" . $title . "</h2>\n " . nl2p($this->_get_description()) ."\n";
2373 $i .= "<p><a href=\"javascript:toggle_group('$id')\" id=\"{$id}_text\">Hide options.</a></p>";
2374 return $i ."</td>\n";
2376 function get_html() {
2381 // html utility functions
2382 function nl2p($text) {
2383 preg_match_all("@\s*(<pre>.*?</pre>|<dl>.*?</dl>|.*?(?=\n\n|<pre>|<dl>|$))@s",
2384 $text, $m, PREG_PATTERN_ORDER);
2387 foreach ($m[1] as $par) {
2388 if (!($par = trim($par)))
2390 if (!preg_match('/^<(pre|dl)>/', $par))
2391 $par = "<p>$par</p>";
2397 function stripHtml($text) {
2398 $d = str_replace("<pre>", "", $text);
2399 $d = str_replace("</pre>", "", $d);
2400 $d = str_replace("<dl>", "", $d);
2401 $d = str_replace("</dl>", "", $d);
2402 $d = str_replace("<dt>", "", $d);
2403 $d = str_replace("</dt>", "", $d);
2404 $d = str_replace("<dd>", "", $d);
2405 $d = str_replace("</dd>", "", $d);
2406 $d = str_replace("<p>", "", $d);
2407 $d = str_replace("</p>", "", $d);
2408 //restore html entities into characters
2409 // http://www.php.net/manual/en/function.htmlentities.php
2410 $trans = get_html_translation_table (HTML_ENTITIES);
2411 $trans = array_flip ($trans);
2412 $d = strtr($d, $trans);
2416 include_once(dirname(__FILE__)."/lib/stdlib.php");
2419 // Function to create better user passwords (much larger keyspace),
2420 // suitable for user passwords.
2421 // Sequence of random ASCII numbers, letters and some special chars.
2422 // Note: There exist other algorithms for easy-to-remember passwords.
2423 function random_good_password ($minlength = 5, $maxlength = 8) {
2425 // assume ASCII ordering (not valid on EBCDIC systems!)
2426 $valid_chars = "!#%&+-.0123456789=@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz";
2427 $start = ord($valid_chars);
2428 $end = ord(substr($valid_chars,-1));
2430 if (function_exists('mt_rand')) // mersenne twister
2431 $length = mt_rand($minlength, $maxlength);
2432 else // the usually bad glibc rand()
2433 $length = rand($minlength, $maxlength);
2434 while ($length > 0) {
2435 if (function_exists('mt_rand'))
2436 $newchar = mt_rand($start, $end);
2438 $newchar = rand($start, $end);
2439 if (! strrpos($valid_chars,$newchar) ) continue; // skip holes
2440 $newpass .= sprintf("%c", $newchar);
2447 function printArray($a) {
2448 echo "<hr />\n<pre>\n";
2450 echo "\n</pre>\n<hr />\n";
2453 // end of class definitions
2454 /////////////////////////////
2455 // begin auto generation code
2457 if (!function_exists('is_a')) {
2458 function is_a($object, $class) {
2459 $class = strtolower($class);
2460 return (get_class($object) == $class) or is_subclass_of($object, $class);
2465 if (!empty($HTTP_POST_VARS['action'])
2466 and $HTTP_POST_VARS['action'] == 'make_config'
2467 and !empty($HTTP_POST_VARS['ADMIN_USER'])
2468 and !empty($HTTP_POST_VARS['ADMIN_PASSWD'])
2472 $timestamp = date ('dS of F, Y H:i:s');
2475 ; This is a local configuration file for PhpWiki.
2476 ; It was automatically generated by the configurator script
2477 ; on the $timestamp.
2482 $posted = $GLOBALS['HTTP_POST_VARS'];
2483 /*if (defined('DEBUG'))
2484 printArray($GLOBALS['HTTP_POST_VARS']);*/
2486 foreach ($properties as $option_name => $a) {
2487 $posted_value = stripslashes($posted[$a->config_item_name]);
2488 $config .= $properties[$option_name]->get_config($posted_value);
2493 if (is_writable($fs_config_file)) {
2494 // We first check if the config-file exists.
2495 if (file_exists($fs_config_file)) {
2496 // We make a backup copy of the file
2497 $new_filename = preg_replace('/\.ini$/', '-' . time() . '.ini', $fs_config_file);
2498 if (@copy($fs_config_file, $new_filename)) {
2499 $fp = @fopen($fs_config_file, 'w');
2502 $fp = @fopen($fs_config_file, 'w');
2510 fputs($fp, $config);
2512 echo "<p>The configuration was written to <code><b>$config_file</b></code>.</p>\n";
2513 if ($new_filename) {
2514 echo "<p>A backup was made to <code><b>$new_filename</b></code>.</p>\n";
2516 ; //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";
2519 echo "<p>The configuration file could <b>not</b> be written.<br />\n",
2520 " You should copy the above configuration to a file, ",
2521 "and manually save it as <code><b>config/config.ini</b></code>.</p>\n";
2524 echo "<hr />\n<p>Here's the configuration file based on your answers:</p>\n";
2525 echo "<form method=\"get\" action=\"", $configurator, "\">\n";
2526 echo "<textarea id='config-output' readonly='readonly' style='width:100%;' rows='30' cols='100'>\n";
2527 echo htmlentities($config);
2528 echo "</textarea></form>\n";
2531 echo "<p>To make any corrections, <a href=\"configurator.php\">edit the settings again</a>.</p>\n";
2533 } else { // first time or create password
2534 $posted = $GLOBALS['HTTP_POST_VARS'];
2535 // No action has been specified - we make a form.
2538 <form action="',$configurator,'" method="post">
2539 <input type="hidden" name="action" value="make_config" />
2540 <table cellpadding="4" cellspacing="0">
2543 while (list($property, $obj) = each($properties)) {
2544 echo $obj->get_instructions($property);
2545 if ($h = $obj->get_html()) {
2546 if (defined('DEBUG') and DEBUG) $h = get_class($obj) . "<br />\n" . $h;
2547 echo "<td>".$h."</td>\n";
2554 <p><input type="submit" id="submit" value="Save ',$config_file,'" /> <input type="reset" value="Clear" /></p>