1 <?php // $Id: configurator.php,v 1.35 2005-07-24 08:50:18 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 PHPWIKI_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 if (!function_exists('_http_user')) {
71 function _http_user() {
73 $_SERVER = $GLOBALS['HTTP_SERVER_VARS'];
74 if (!empty($_SERVER['PHP_AUTH_USER']))
75 return array($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
76 if (!empty($_SERVER['REMOTE_USER']))
77 return array($_SERVER['REMOTE_USER'], $_SERVER['PHP_AUTH_PW']);
78 if (!empty($GLOBALS['HTTP_ENV_VARS']['REMOTE_USER']))
79 return array($GLOBALS['HTTP_ENV_VARS']['REMOTE_USER'],
80 $GLOBALS['HTTP_ENV_VARS']['PHP_AUTH_PW']);
81 if (!empty($GLOBALS['REMOTE_USER']))
82 return array($GLOBALS['REMOTE_USER'], $GLOBALS['PHP_AUTH_PW']);
85 if (!empty($_SERVER['HTTP_AUTHORIZATION'])) {
86 list($userid, $passwd) = explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));
87 return array($userid, $passwd);
91 function _http_logout() {
93 $_SERVER =& $GLOBALS['HTTP_SERVER_VARS'];
94 // maybe we should random the realm to really force a logout. but the next login will fail.
95 // better_srand(); $realm = microtime().rand();
96 header('WWW-Authenticate: Basic realm="'.WIKI_NAME.'"');
97 if (strstr(php_sapi_name(), 'apache'))
98 header('HTTP/1.0 401 Unauthorized');
100 header("Status: 401 Access Denied"); //IIS and CGI need that
101 unset($GLOBALS['REMOTE_USER']);
102 unset($_SERVER['PHP_AUTH_USER']);
103 unset($_SERVER['PHP_AUTH_PW']);
105 trigger_error("Permission denied. Require ADMIN_USER.", E_USER_ERROR);
110 // If config.ini exists, we require ADMIN_USER access by faking HttpAuth.
111 // So nobody can see or reset the password(s).
112 if (file_exists($fs_config_file)) {
113 // Require admin user
114 if (!defined('ADMIN_USER') or !defined('ADMIN_PASSWD')) {
115 if (!function_exists("IniConfig")) {
116 include_once("lib/prepend.php");
117 include_once("lib/IniConfig.php");
119 IniConfig($fs_config_file);
121 if (!defined('ADMIN_USER') or ADMIN_USER == '') {
122 trigger_error("Configuration problem:\nADMIN_USER not defined in \"$fs_config_file\".\n"
123 . "Cannot continue: You have to fix that manually.", E_USER_ERROR);
127 list($admin_user, $admin_pw) = _http_user();
128 //$required_user = ADMIN_USER;
129 if (empty($admin_user) or $admin_user != ADMIN_USER)
134 if (ENCRYPTED_PASSWORD and function_exists('crypt')) {
135 if (crypt($admin_pw, ADMIN_PASSWD) != ADMIN_PASSWD)
137 } elseif ($admin_pw != ADMIN_PASSWD) {
141 if (!function_exists("IniConfig")) {
142 include_once("lib/prepend.php");
143 include_once("lib/IniConfig.php");
145 $def_file = (substr(PHP_OS,0,3) == 'WIN') ? 'config\\config-default.ini' : 'config/config-default.ini';
146 $fs_def_file = dirname(__FILE__) . (substr(PHP_OS,0,3) == 'WIN' ? '\\' : '/') . $def_file;
147 IniConfig($fs_def_file);
150 echo "<","?xml version=\"1.0\" encoding=\"'iso-8859-1'\"?",">\n";
152 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
153 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
154 <html xmlns="http://www.w3.org/1999/xhtml">
156 <!-- $Id: configurator.php,v 1.35 2005-07-24 08:50:18 rurban Exp $ -->
157 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
158 <title>Configuration tool for PhpWiki <?php echo $config_file ?></title>
159 <style type="text/css" media="screen">
161 /* TABLE { border: thin solid black } */
162 body { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 80%; }
163 pre { font-size: 120%; }
164 td { border: thin solid black }
166 div.hint { border: thin solid red, background-color: #eeeeee; }
167 tr.hidden { border: none; display: none; }
168 td.part { background-color: #eeeeee; color: inherit; }
169 td.instructions { background-color: #ffffee; width: <?php echo $tdwidth ?>px; color: inherit; }
170 td.unchangeable-variable-top { border-bottom: none; background-color: #ffffee; color:inherit; }
171 td.unchangeable-variable-left { border-top: none; background-color: #ffffee; color:inherit; }
174 <script language="JavaScript" type="text/javascript">
176 function update(accepted, error, value, output) {
177 var msg = document.getElementById(output);
179 /* MSIE 5.0 fails here */
180 if (msg && msg.innerHTML) { msg.innerHTML = "<font color=\"green\">Input accepted.</font>"; }
182 while ((index = error.indexOf("%s")) > -1) {
183 error = error.substring(0, index) + value + error.substring(index+2);
185 if (msg) { msg.innerHTML = "<font color=\"red\">" + error + "</font>"; }
187 if (submit = document.getElementById('submit')) submit.disabled = accepted ? false : true;
190 function validate(error, value, output, field) {
191 update(field.value == value, error, field.value, output);
194 function validate_ereg(error, ereg, output, field) {
195 regex = new RegExp(ereg);
196 update(regex.test(field.value), error, field.value, output);
199 function validate_range(error, low, high, empty_ok, output, field) {
200 update((empty_ok == 1 && field.value == "") ||
201 (field.value >= low && field.value <= high),
202 error, field.value, output);
205 function toggle_group(id) {
206 var text = document.getElementById(id + "_text");
208 if (text.innerHTML == "Hide options.") {
210 text.innerHTML = "Show options.";
212 text.innerHTML = "Hide options.";
215 var rows = document.getElementsByTagName('tr');
217 for (i = 0; i < rows.length; i++) {
219 if (tr.className == 'header' && tr.id == id) {
224 for (; i < rows.length; i++) {
226 if (tr.className == 'header')
228 tr.className = do_hide ? 'hidden': 'nonhidden';
233 // Hide all groups. We do this via JavaScript to avoid
234 // hiding the groups if JavaScript is not supported...
235 var rows = document.getElementsByTagName('tr');
236 var show = '<?php echo $_GET["show"] ?>';
237 for (var i = 0; i < rows.length; i++) {
239 if (tr.className == 'header')
240 if (!show || tr.id != show)
244 // Select text in textarea upon focus
245 var area = document.getElementById('config-output');
247 listener = { handleEvent: function (e) { area.select(); } };
248 area.addEventListener('focus', listener, false);
255 <body onload="do_init();">
257 <h1>Configuration for PhpWiki <?php echo $config_file ?></h1>
260 Using this configurator.php is experimental!<br>
261 On any configuration problems, please edit the resulting config.ini manually.
265 //define('DEBUG', 1);
267 * The Configurator is a php script to aid in the configuration of PhpWiki.
268 * Parts of this file were based on PHPWeather's configurator.php file.
269 * http://sourceforge.net/projects/phpweather/
271 * TO CHANGE THE CONFIGURATION OF YOUR PHPWIKI, DO *NOT* MODIFY THIS FILE!
272 * more instructions go here
276 * * eval config.ini to get the actual settings.
279 //////////////////////////////
280 // begin configuration options
283 * Notes for the description parameter of $property:
285 * - Descriptive text will be changed into comments (preceeded by ; )
286 * for the final output to config.ini.
288 * - Only a limited set of html is allowed: pre, dl dt dd; it will be
289 * stripped from the final output.
291 * - Line breaks and spacing will be preserved for the final output.
293 * - Double line breaks are automatically converted to paragraphs
294 * for the html version of the descriptive text.
296 * - Double-quotes and dollar signs in the descriptive text must be
297 * escaped: \" and \$. Instead of escaping double-quotes you can use
298 * single (') quotes for the enclosing quotes.
300 * - Special characters like < and > must use html entities,
301 * they will be converted back to characters for the final output.
304 $SEPARATOR = ";=========================================================================";
307 ; This is the main configuration file for PhpWiki in INI-style format.
308 ; Note that certain characters are used as comment char and therefore
309 ; these entries must be in double-quotes. Such as \":\", \";\", \",\" and \"|\"
310 ; Take special care for DBAUTH_ sql statements. (Part 3a)
312 ; This file is divided into several parts: Each one has different configuration
313 ; settings you can change; in all cases the default should work on your system,
314 ; however, we recommend you tailor things to your particular setting.
317 $properties["Part Zero"] =
318 new part('_part0', $SEPARATOR."\n", "
319 Part Zero: (optional)
320 Latest Development and Tricky Options");
322 if (defined('INCLUDE_PATH'))
323 $include_path = INCLUDE_PATH;
325 if (substr(PHP_OS,0,3) == 'WIN') {
326 $include_path = dirname(__FILE__) . ';' . ini_get('include_path');
327 if (strchr(ini_get('include_path'),'/'))
328 $include_path = strtr($include_path,'\\','/');
330 $include_path = dirname(__FILE__) . ':' . ini_get('include_path');
334 $properties["PHP include_path"] =
335 new _define('INCLUDE_PATH', $include_path, "
336 If PHP needs help in finding where you installed the rest of the PhpWiki
337 code, you can set the include_path here.
339 Override the PHP include path so that it can find some needed additional libraries.
340 You shouldn't need to do this unless your system include_path esp. your
341 system pear libs are broken or oudated. The PHPWIKI_DIR is automatically
342 put to the front and the local lib/pear path is automatically added to the end.
343 But if you define it, be sure to include either the system pear path or
344 the phpwiki/lib/pear path to override your Pear_DB.
345 Note that on Windows-based servers, you should use ; rather than :
346 as the path separator.");
348 // TODO: convert this a checkbox row as in tests/unit/test.pgp
349 $properties["DEBUG"] =
350 new numeric_define_optional('DEBUG', DEBUG, "
351 Set DEBUG to 1 to view the XHTML and CSS validator icons, page
352 processing timer, and possibly other debugging messages at the
353 bottom of each page. 65 for a more verbose level with AUTH hints.
354 See lib/config.php for all supported values.");
356 // TODO: bring the default to the front
357 $properties["ENABLE_USER_NEW"] =
358 new boolean_define_commented_optional
360 array('true' => "Enabled",
361 'false' => "Disabled."), "
362 Enable the new method of handling WikiUser Authetincation and Preferences.
363 It's best to leave it on, and only disable it if you have problems with it.
364 Servers with memory-limit problems might want to turn it off. It costs ~300KB
367 $properties["ENABLE_PAGEPERM"] =
368 new boolean_define_commented_optional
370 array('true' => "Enabled",
371 'false' => "Disabled."), "
372 Use access control lists (as in Solaris and Windows NTFS) per page and group,
373 not per user for the whole wiki.
375 I suspect ACL page permissions to degrade speed by 10%.
376 GROUP_METHOD=WIKIPAGE is slowest. (See Part 3a)
379 $properties["ENABLE_EDIT_TOOLBAR"] =
380 new boolean_define_commented_optional
381 ('ENABLE_EDIT_TOOLBAR',
382 array('true' => "Enabled",
383 'false' => "Disabled."), "
384 Graphical buttons on edit. Default: true.
385 Reportedly broken on MacOSX Safari");
387 $properties["JS_SEARCHREPLACE"] =
388 new boolean_define_commented_optional
390 array('true' => "Enabled",
391 'false' => "Disabled"), "
392 Adds two additional buttons in EDIT_TOOLBAR, Search&Replace and Undo.
393 Undo is experimental.");
395 $properties["ENABLE_DOUBLECLICKEDIT"] =
396 new boolean_define_commented_optional
397 ('ENABLE_DOUBLECLICKEDIT',
398 array('true' => "Enabled",
399 'false' => "Disabled"), "
402 $properties["ENABLE_XHTML_XML"] =
403 new boolean_define_commented_optional
405 array('false' => "Disabled",
406 'true' => "Enabled"), "
407 Needed for inlined SVG and MathM, but may conflict with javascript:document.write().
408 Experimental. Default: false");
410 $properties["USECACHE"] =
411 new boolean_define_commented_optional
413 array('true' => "Enabled",
414 'false' => "Disabled"), "
415 Store DB query results in memory to avoid duplicate queries.
416 Disable only for old php's with low memory or memory_limit=8MB.
419 $properties["ENABLE_SPAMASSASSIN"] =
420 new boolean_define_commented_optional
421 ('ENABLE_SPAMASSASSIN',
422 array('true' => "Enabled",
423 'false' => "Disabled"), "
424 Needs babycart installed. See http://phpwiki.org/SpamAssassinIntegration
425 Optionally define BABYCART_PATH. Default: /usr/local/bin/babycart");
427 $properties["GOOGLE_LINKS_NOFOLLOW"] =
428 new boolean_define_commented_optional
429 ('GOOGLE_LINKS_NOFOLLOW',
430 array('true' => "Enabled",
431 'false' => "Disabled"), "
432 If enabled ref=nofollow is added to all external links to discourage spam.
433 You might want to turn it off, if you want to improve pageranks on external links.");
435 $properties["ENABLE_LIVESEARCH"] =
436 new boolean_define_commented_optional
437 ('ENABLE_LIVESEARCH',
438 array('true' => "Enabled",
439 'false' => "Disabled"), "
440 LiveSearch enables immediate title search results via XMLHttpRequest.
441 Displays the results in a dropdown under the titlesearch inputbox
442 while typing. (experimental, only with certain themes)
443 You'll have to copy livesearch.js from http://blog.bitflux.ch/wiki/LiveSearch
444 to themes/default/ and define ENABLE_LIVESEARCH in config.ini to true.
445 See themes/blog/themeinfo.php.
446 Currently we use the bitflux.ch library, but we will change to
447 the russian acdropdown soon. http://momche.net/publish/article.php?page=acdropdown");
449 $properties["USE_SAFE_DBSESSION"] =
450 new boolean_define_commented_optional
451 ('USE_SAFE_DBSESSION',
452 array('false' => "Disabled",
453 'true' => "Enabled"), "
454 USE_SAFE_DBSESSION should be enabled, if you encounter session problems, with duplicate INSERT
455 sess_id warnings at the bottom of the page. Reason is a unreliable affected_rows implementation()
456 in the sql backend. Default is Disabled, using the fastest DbSession UPDATE method.");
458 $properties["Part One"] =
459 new part('_part1', $SEPARATOR."\n", "
460 Part One: Authentication and security settings. See Part Three for more.");
462 $properties["Admin Username"] =
463 new _define_notempty('ADMIN_USER', ADMIN_USER, "
464 You must set this! Username and password of the administrator.",
465 "onchange=\"validate_ereg('Sorry, ADMIN_USER cannot be empty.', '^.+$', 'ADMIN_USER', this);\"");
467 $properties["Admin Password"] =
468 new _define_password('ADMIN_PASSWD', ADMIN_PASSWD, "
469 For heaven's sake pick a good password.
470 If your version of PHP supports encrypted passwords, your password will be
471 automatically encrypted within the generated config file.
472 Use the \"Create Random Password\" button to create a good (random) password.
474 ADMIN_PASSWD is ignored on HttpAuth",
475 "onchange=\"validate_ereg('Sorry, ADMIN_PASSWD must be at least 4 chars long.', '^....+$', 'ADMIN_PASSWD', this);\"");
477 $properties["Encrypted Passwords"] =
480 array('true' => "true. use crypt for all passwords",
481 'false' => "false. use plaintest passwords (not recommended)"), "
482 It is recommended that you use encrypted passwords to be stored in the
483 config.ini and the users homepages metadata.
484 You might want to use the passencrypt.php utility to encode the
485 admin password, in the event that someone gains ftp or ssh access to the
486 server and directory containing phpwiki.
487 <i>SQL access passwords cannot be encrypted, besides using external DATABASE_DSN aliases within PDO.</i>
489 If true, all user passwords will be stored encrypted.
490 You might have to set it to false, if your PHP doesn't support crypt().
493 $properties["Wiki Name"] =
494 new _define_optional('WIKI_NAME', WIKI_NAME, "
495 The name of your wiki.
497 This is used to generate a keywords meta tag in the HTML templates,
498 in bookmark titles for any bookmarks made to pages in your wiki,
499 and during RSS generation for the title of the RSS channel.
501 It is recommended this be a relatively short WikiWord like the
502 InterWiki monikers found in the InterWikiMap. (For examples, see
506 $properties["Reverse DNS"] =
507 new boolean_define_optional
508 ('ENABLE_REVERSE_DNS',
509 array('true' => "true. perform additional reverse dns lookups",
510 'false' => "false. just record the address as given by the httpd server"),
512 If set, we will perform reverse dns lookups to try to convert the
513 users IP number to a host name, even if the http server didn't do it for us.");
515 $properties["ZIPdump Authentication"] =
516 new boolean_define_optional('ZIPDUMP_AUTH',
517 array('false' => "false. Everyone may download zip dumps",
518 'true' => "true. Only admin may download zip dumps"), "
519 If true, only the admin user can make zip dumps, else zip dumps
520 require no authentication.");
522 $properties["Enable RawHtml Plugin"] =
523 new boolean_define_commented_optional
525 array('true' => "Enabled",
526 'false' => "Disabled"), "
527 The RawHtml plugin allows page authors to embed real, raw HTML into Wiki
528 pages. This is a possible security threat, as much HTML (or, rather,
529 JavaScript) can be very risky. If you are in a controlled environment,
530 however, it could be of use.");
532 $properties["Allow RawHtml Plugin only on locked pages"] =
533 new boolean_define_commented_optional
534 ('ENABLE_RAW_HTML_LOCKEDONLY',
535 array('true' => "Enabled",
536 'false' => "Disabled"), "
537 If this is set, only pages locked by the Administrator may contain the RawHtml plugin.");
539 $properties["Allow RawHtml Plugin if safe HTML code"] =
540 new boolean_define_commented_optional
541 ('ENABLE_RAW_HTML_SAFE',
542 array('true' => "Enabled",
543 'false' => "Disabled"), "
544 If this is set, all unsafe html code is stripped automatically (experimental!)
545 See <a href=\"http://chxo.com/scripts/safe_html-test.php\" target=\"_new\">chxo.com/scripts/safe_html-test.php</a>
548 $properties["Maximum Upload Size"] =
549 new numeric_define_optional('MAX_UPLOAD_SIZE', MAX_UPLOAD_SIZE /*"16 * 1024 * 1024"*/, "
550 The maximum file upload size.");
552 $properties["Minor Edit Timeout"] =
553 new numeric_define_optional('MINOR_EDIT_TIMEOUT', MINOR_EDIT_TIMEOUT /*"7 * 24 * 3600"*/, "
554 If the last edit is older than MINOR_EDIT_TIMEOUT seconds, the
555 default state for the \"minor edit\" checkbox on the edit page form
558 $properties["Disabled Actions"] =
559 new array_define('DISABLED_ACTIONS', DISABLED_ACTIONS /*array()*/, "
560 Actions listed in this array will not be allowed. Actions are:
561 browse, create, diff, dumphtml, dumpserial, edit, loadfile, lock, remove,
562 unlock, upload, viewsource, zip, ziphtml");
564 $properties["Access Log File"] =
565 new _define_commented_optional('ACCESS_LOG', ACCESS_LOG /*"/var/logs/wiki_access.log"*/, "
566 PhpWiki can generate an access_log (in \"NCSA combined log\" format)
567 for you. If you want one, define this to the name of the log file,
568 such as /tmp/wiki_access_log. Preferred is to use SQL access logging as below.
570 Default: empty - no access log file will be generated.");
572 $properties["Access Log SQL"] =
573 new _define_selection(
575 array('0' => 'disable',
577 '2' => 'read + write'), "
578 PhpWiki can read and/or write apache-style mod_log_sql accesslog tables for faster
579 abuse detection and referer lists.
580 See http://www.outoforder.cc/projects/apache/mod_log_sql/docs-2.0/#id2756178
582 If defined (e.g. 1) only read-access is done via SQL.
583 If flag 2 is set, phpwiki also writes. (Default on SQL or ADODB)
584 This must use DATABASE_TYPE = SQL or ADODB.
587 $properties["Compress Output"] =
588 new boolean_define_commented_optional
590 array('' => 'GZIP compress when PhpWiki thinks appropriate.',
591 'false' => 'Never compress output.',
592 'true' => 'Always try to compress output.'),
594 By default PhpWiki will try to have PHP compress it's output
595 before sending it to the browser (if you have a recent enough
596 version of PHP and the action and the browser supports it.)
598 Define COMPRESS_OUTPUT to false to prevent output compression at all.
600 Define COMPRESS_OUTPUT to true to force output compression,
601 even if we think your version of PHP does this in a buggy
604 Leave it undefined to leave the choice up to PhpWiki.");
606 $properties["HTTP Cache Control"] =
607 new _define_selection_optional
609 array('LOOSE' => 'LOOSE',
610 'STRICT' => 'STRICT',
611 'NO_CACHE' => 'NO_CACHE',
612 'ALLOW_STALE' => 'ALLOW_STALE'),
616 This controls how PhpWiki sets the HTTP cache control
617 headers (Expires: and Cache-Control:)
623 <dd>This is roughly the old (pre 1.3.4) behaviour. PhpWiki will
624 instruct proxies and browsers never to cache PhpWiki output.</dd>
627 <dd>Cached pages will be invalidated whenever the database global
628 timestamp changes. This should behave just like NONE (modulo
629 bugs in PhpWiki and your proxies and browsers), except that
630 things will be slightly more efficient.</dd>
633 <dd>Cached pages will be invalidated whenever they are edited,
634 or, if the pages include plugins, when the plugin output could
635 concievably have changed.
637 <p>Behavior should be much like STRICT, except that sometimes
638 wikilinks will show up as undefined (with the question mark)
639 when in fact they refer to (recently) created pages.
640 (Hitting your browsers reload or perhaps shift-reload button
641 should fix the problem.)</p></dd>
644 <dd>Proxies and browsers will be allowed to used stale pages.
645 (The timeout for stale pages is controlled by CACHE_CONTROL_MAX_AGE.)
647 <p>This setting will result in quirky behavior. When you edit a
648 page your changes may not show up until you shift-reload the
651 <p>This setting is generally not advisable, however it may be useful
652 in certain cases (e.g. if your wiki gets lots of page views,
653 and few edits by knowledgable people who won't freak over the quirks.)</p>
656 The default is currently LOOSE.");
658 // FIXME: should be numeric_define_optional
659 $properties["HTTP Cache Control Max Age"] =
660 new numeric_define_optional('CACHE_CONTROL_MAX_AGE', CACHE_CONTROL_MAX_AGE,
662 Maximum page staleness, in seconds.");
664 $properties["Markup Caching"] =
665 new boolean_define_commented_optional
666 ('WIKIDB_NOCACHE_MARKUP',
667 array('false' => 'Enable markup cache',
668 'true' => 'Disable markup cache'),
672 PhpWiki normally caches a preparsed version (i.e. mostly
673 converted to HTML) of the most recent version of each page.
674 (Parsing the wiki-markup takes a fair amount of CPU.)
676 Define WIKIDB_NOCACHE_MARKUP to true to disable the
677 caching of marked-up page content.
679 Note that you can also disable markup caching on a per-page
680 temporary basis by addinging a query arg of '?nocache=1'
681 to the URL to the page. (Use '?nocache=purge' to completely
682 discard the cached version of the page.)
684 You can also purge the cached markup globally by using the
685 \"Purge Markup Cache\" button on the PhpWikiAdministration page.");
687 $properties["Path for PHP Session Support"] =
688 new _define_optional('SESSION_SAVE_PATH', defined('SESSION_SAVE_PATH') ? SESSION_SAVE_PATH : ini_get('session.save_path'), "
689 The login code now uses PHP session support. Usually, the default
690 configuration of PHP is to store the session state information in
691 /tmp. That probably will work fine, but fails e.g. on clustered
692 servers where each server has their own distinct /tmp (this is the
693 case on SourceForge's project web server.) You can specify an
694 alternate directory in which to store state information like so
695 (whatever user your httpd runs as must have read/write permission
698 On USE_DB_SESSION = true you can ignore this.
701 ///////// database selection
703 $properties["Part Two"] =
704 new part('_part2', $SEPARATOR."\n", "
707 Database Configuration
710 $properties["Database Type"] =
711 new _define_selection("DATABASE_TYPE",
712 array('dba' => "dba",
714 'ADODB' => "SQL ADODB",
715 'PDO' => "PDO (php5 only)",
716 'file' => "flatfile",
717 'cvs' => "CVS File handler"), "
718 Select the database backend type:
719 Choose dba (default) to use one of the standard UNIX dba libraries. This is the fastest.
720 Choose ADODB or SQL to use an SQL database with ADODB or PEAR.
721 Choose PDO on php5 to use an SQL database.
722 flatfile is simple and slow.
723 CVS is highly experimental and slow.
724 Recommended is dba or SQL: PEAR or ADODB.");
726 $properties["SQL DSN Setup"] =
727 new unchangeable_variable('_sqldsnstuff', "", "
728 For SQL based backends, specify the database as a DSN
729 The most general form of a DSN looks like:
731 phptype(dbsyntax)://username:password@protocol+hostspec/database?option=value
733 For a MySQL database, the following should work:
735 mysql://user:password@host/databasename
737 To connect over a unix socket, use something like
739 mysql://user:password@unix(/path/to/socket)/databasename
742 DATABASE_DSN = mysql://guest@:/var/lib/mysql/mysql.sock/phpwiki
743 DATABASE_DSN = mysql://guest@localhost/phpwiki
744 DATABASE_DSN = pgsql://localhost/user_phpwiki
747 // Choose ADODB or SQL to use an SQL database with ADODB or PEAR.
748 // Choose dba to use one of the standard UNIX dbm libraries.
750 $properties["SQL Type"] =
751 new _variable_selection('_dsn_sqltype',
752 array('mysql' => "MySQL",
753 'pgsql' => "PostgreSQL",
754 'mssql' => "Microsoft SQL Server",
755 'oci8' => "Oracle 8",
756 'mysqli' => "mysqli (only ADODB)",
757 'mysqlt' => "mysqlt (only ADODB)",
758 'ODBC' => "ODBC (only ADODB or PDO)",
759 'firebird' => "Firebird (only PDO)",
760 'oracle' => "Oracle (only PDO)",
762 SQL DB types. The DSN hosttype.");
764 $properties["SQL User"] =
765 new _variable('_dsn_sqluser', "wikiuser", "
768 $properties["SQL Password"] =
769 new _variable('_dsn_sqlpass', "", "
772 $properties["SQL Database Host"] =
773 new _variable('_dsn_sqlhostorsock', "localhost", "
774 SQL Database Hostname:
776 To connect over a local named socket, use something like
778 unix(/var/lib/mysql/mysql.sock)
781 mysql on Windows via named pipes might need 127.0.0.1");
783 $properties["SQL Database Name"] =
784 new _variable('_dsn_sqldbname', "phpwiki", "
785 SQL Database Name:");
787 $dsn_sqltype = $properties["SQL Type"]->value();
788 $dsn_sqluser = $properties["SQL User"]->value();
789 $dsn_sqlpass = $properties["SQL Password"]->value();
790 $dsn_sqlhostorsock = $properties["SQL Database Host"]->value();
791 $dsn_sqldbname = $properties["SQL Database Name"]->value();
792 $dsn_sqlstring = $dsn_sqltype."://{$dsn_sqluser}:{$dsn_sqlpass}@{$dsn_sqlhostorsock}/{$dsn_sqldbname}";
794 $properties["SQL dsn"] =
795 new unchangeable_define("DATABASE_DSN",
796 "DATABASE_DSN = \"$dsn_sqlstring\"", "
797 Calculated from the settings above:");
799 $properties["Filename / Table name Prefix"] =
800 new _define_commented("DATABASE_PREFIX", DATABASE_PREFIX, "
801 Used by all DB types:
803 Prefix for filenames or table names, e.g. \"phpwiki_\"
805 Currently <b>you MUST EDIT THE SQL file too!</b> (in the schemas/
806 directory because we aren't doing on the fly sql generation
807 during the installation.");
809 $properties["DB Session table"] =
810 new _define_optional("DATABASE_SESSION_TABLE", DATABASE_SESSION_TABLE, "
811 Tablename to store session information. Only supported by SQL backends.
813 A word of warning - any prefix defined above will be prepended to whatever is given here.
817 $temp = !empty($_ENV['TEMP']) ? $_ENV['TEMP'] : "/tmp";
818 $properties["dba directory"] =
819 new _define("DATABASE_DIRECTORY", $temp, "
822 // TODO: list the available methods
823 $properties["dba handler"] =
824 new _define_selection('DATABASE_DBA_HANDLER',
825 array('gdbm' => "Gdbm - GNU database manager (recommended)",
826 'dbm' => "DBM - Redhat default. On sf.net there's dbm and gdbm",
827 'db2' => "DB2 - Sleepycat Software's DB2",
828 'db3' => "DB3 - Sleepycat Software's DB3. Default on Windows but not on every Linux",
829 'db4' => "DB4 - Sleepycat Software's DB4."), "
830 Use 'gdbm', 'dbm', 'db2', 'db3' or 'db4' depending on your DBA handler methods supported: <br > "
831 . (function_exists("dba_handlers") ? join(", ",dba_handlers()) : ""));
833 $properties["dba timeout"] =
834 new numeric_define("DATABASE_TIMEOUT", DATABASE_TIMEOUT, "
835 Recommended values are 10-20 seconds. The more load the server has, the higher the timeout.");
837 $properties["DATABASE_PERSISTENT"] =
838 new boolean_define_commented_optional
839 ('DATABASE_PERSISTENT',
840 array('false' => "Disabled",
841 'true' => "Enabled"), "
842 Use persistent database connections for SQL databases, if the database backend supports it.
843 Not recommended for heavily loaded servers.
848 $properties["Page Revisions"] =
849 new unchangeable_variable('_parttworevisions', "", "
851 Section 2a: Archive Cleanup
852 The next section controls how many old revisions of each page are kept in the database.
854 There are two basic classes of revisions: major and minor. Which
855 class a revision belongs in is determined by whether the author
856 checked the \"this is a minor revision\" checkbox when they saved the
859 There is, additionally, a third class of revisions: author
860 revisions. The most recent non-mergable revision from each distinct
861 author is and author revision.
863 The expiry parameters for each of those three classes of revisions
864 can be adjusted seperately. For each class there are five
865 parameters (usually, only two or three of the five are actually
866 set) which control how long those revisions are kept in the
869 <dt>max_keep:</dt> <dd>If set, this specifies an absolute maximum for the
870 number of archived revisions of that class. This is
871 meant to be used as a safety cap when a non-zero
872 min_age is specified. It should be set relatively high,
873 and it's purpose is to prevent malicious or accidental
874 database overflow due to someone causing an
875 unreasonable number of edits in a short period of time.</dd>
877 <dt>min_age:</dt> <dd>Revisions younger than this (based upon the supplanted
878 date) will be kept unless max_keep is exceeded. The age
879 should be specified in days. It should be a
880 non-negative, real number,</dd>
882 <dt>min_keep:</dt> <dd>At least this many revisions will be kept.</dd>
884 <dt>keep:</dt> <dd>No more than this many revisions will be kept.</dd>
886 <dt>max_age:</dt> <dd>No revision older than this age will be kept.</dd>
888 Supplanted date: Revisions are timestamped at the instant that they
889 cease being the current revision. Revision age is computed using
890 this timestamp, not the edit time of the page.
892 Merging: When a minor revision is deleted, if the preceding
893 revision is by the same author, the minor revision is merged with
894 the preceding revision before it is deleted. Essentially: this
895 replaces the content (and supplanted timestamp) of the previous
896 revision with the content after the merged minor edit, the rest of
897 the page metadata for the preceding version (summary, mtime, ...)
901 // For now the expiration parameters are statically inserted as
902 // an unchangeable property. You'll have to edit the resulting
903 // config file if you really want to change these from the default.
905 $properties["Major Edits: keep minumum days"] =
906 new numeric_define("MAJOR_MIN_KEEP", MAJOR_MIN_KEEP, "
907 Default: Keep at least for unlimited time.
908 Set to 0 to enable archive cleanup");
909 $properties["Minor Edits: keep minumum days"] =
910 new numeric_define("MINOR_MIN_KEEP", MINOR_MIN_KEEP, "
911 Default: Keep at least for unlimited time.
912 Set to 0 to enable archive cleanup");
914 $properties["Major Edits: how many"] =
915 new numeric_define("MAJOR_KEEP", MAJOR_KEEP, "
916 Keep up to 8 major edits");
917 $properties["Major Edits: how many days"] =
918 new numeric_define("MAJOR_MAX_AGE", MAJOR_MAX_AGE, "
919 keep them no longer than a month");
921 $properties["Minor Edits: how many"] =
922 new numeric_define("MINOR_KEEP", MINOR_KEEP, "
923 Keep up to 4 minor edits");
924 $properties["Minor Edits: how many days"] =
925 new numeric_define("MINOR_MAX_AGE", "7", "
926 keep them no longer than a week");
928 $properties["per Author: how many"] =
929 new numeric_define("AUTHOR_KEEP", "8", "
930 Keep the latest contributions of the last 8 authors,");
931 $properties["per Author: how many days"] =
932 new numeric_define("AUTHOR_MAX_AGE", "365", "
934 $properties["per Author: keep minumum days"] =
935 new numeric_define("AUTHOR_MIN_AGE", "7", "
936 Additionally, (in the case of a particularly active page) try to
937 keep the latest contributions of all authors in the last week (even if there are more than eight of them,)");
938 $properties["per Author: max revisions"] =
939 new numeric_define("AUTHOR_MAX_KEEP", "20", "
940 but in no case keep more than twenty unique author revisions.");
942 /////////////////////////////////////////////////////////////////////
944 $properties["Part Three"] =
945 new part('_part3', $SEPARATOR."\n", "
947 Part Three: (optional)
948 Basic User Authentication Setup
951 $properties["Publicly viewable"] =
952 new boolean_define_optional('ALLOW_ANON_USER',
953 array('true' => "true. Permit anonymous view. (Default)",
954 'false' => "false. Force login even on view (strictly private)"), "
955 If ALLOW_ANON_USER is false, you have to login before viewing any page or doing any other action on a page.");
957 $properties["Allow anonymous edit"] =
958 new boolean_define_optional('ALLOW_ANON_EDIT',
959 array('true' => "true. Permit anonymous users to edit. (Default)",
960 'false' => "false. Force login on edit (moderately locked)"), "
961 If ALLOW_ANON_EDIT is false, you have to login before editing or changing any page. See below.");
963 $properties["Allow Bogo Login"] =
964 new boolean_define_optional('ALLOW_BOGO_LOGIN',
965 array('true' => "true. Users may Sign In with any WikiWord, without password. (Default)",
966 'false' => "false. Require stricter authentication."), "
967 If ALLOW_BOGO_LOGIN is false, you may not login with any wikiword username and empty password.
968 If true, users are allowed to create themselves with any WikiWord username. See below.");
970 $properties["Allow User Passwords"] =
971 new boolean_define_optional('ALLOW_USER_PASSWORDS',
972 array('true' => "True user authentication with password checking. (Default)",
973 'false' => "false. Ignore authentication settings below."), "
974 If ALLOW_USER_PASSWORDS is true, the authentication settings below define where and how to
975 check against given username/passwords. For completely security disable BOGO_LOGIN and ANON_EDIT above.");
977 $properties["Allow User Passwords"] =
978 new array_define('USER_AUTH_ORDER', array("PersonalPage", "Db"), "
979 Many different methods can be used to check user's passwords.
980 Try any of these in the given order:
983 <dd>WikiWord username, with no *actual* password checking,
984 although the user will still have to enter one.</dd>
985 <dt>PersonalPage</dt>
986 <dd>Store passwords in the users homepage metadata (simple)</dd>
988 <dd>Use DBAUTH_AUTH_* (see below) with PearDB or ADODB only.</dd>
990 <dd>Authenticate against LDAP_AUTH_HOST with LDAP_BASE_DN.</dd>
992 <dd>Authenticate against IMAP_AUTH_HOST (email account)</dd>
994 <dd>Authenticate against POP3_AUTH_HOST (email account)</dd>
996 <dd>Get username and level from a PHP session variable. (e.g. for gforge)</dd>
998 <dd>Store username:crypted-passwords in .htaccess like files.
999 Use Apache's htpasswd to manage this file.</dd>
1001 <dd>Use the protection by the webserver (.htaccess/.htpasswd) (experimental)
1002 Enforcing HTTP Auth not yet. Note that the ADMIN_USER should exist also.
1003 Using HttpAuth disables all other methods and no userauth sessions are used.</dd>
1006 Several of these methods can be used together, in the manner specified by
1007 USER_AUTH_POLICY, below. To specify multiple authentication methods,
1008 separate the name of each one with colons.
1010 USER_AUTH_ORDER = 'PersonalPage : Db'
1011 USER_AUTH_ORDER = 'BogoLogin : PersonalPage'
1014 $properties["PASSWORD_LENGTH_MINIMUM"] =
1015 new numeric_define("PASSWORD_LENGTH_MINIMUM", "6", "
1016 For 'security' purposes, you can specify that a password be at least a
1017 certain number of characters long. This applies even to the BogoLogin method.
1018 Default: 0 (to allow immediate passwordless BogoLogin)");
1020 $properties["USER_AUTH_POLICY"] =
1021 new _define_selection('USER_AUTH_POLICY',
1022 array('first-only' => "first-only - use only the first method in USER_AUTH_ORDER",
1023 'old' => "old - ignore USER_AUTH_ORDER (legacy)",
1024 'strict' => "strict - check all methods for userid + password (recommended)",
1025 'stacked' => "stacked - check all methods for userid, and if found for password"), "
1026 The following policies are available for user authentication:
1029 <dd>use only the first method in USER_AUTH_ORDER</dd>
1031 <dd>ignore USER_AUTH_ORDER and try to use all available
1032 methods as in the previous PhpWiki releases (slow)</dd>
1034 <dd>check if the user exists for all methods:
1035 on the first existing user, try the password.
1036 dont try the other methods on failure then</dd>
1038 <dd>check the given user - password combination for all
1039 methods and return true on the first success.</dd></dl>");
1043 $properties["Part Three A"] =
1044 new part('_part3a', $SEPARATOR."\n", "
1046 Part Three A: (optional)
1049 $properties["Group membership"] =
1050 new _define_selection("GROUP_METHOD",
1051 array('WIKIPAGE' => "WIKIPAGE - List at \"CategoryGroup\". (Slowest, but easiest to maintain)",
1052 '"NONE"' => "NONE - Disable group membership (Fastest)",
1053 'DB' => "DB - SQL Database, Optionally external. See USERS/GROUPS queries",
1054 'FILE' => "Flatfile. See AUTH_GROUP_FILE below.",
1055 'LDAP' => "LDAP - See \"LDAP authentication options\" above. (Experimental)"), "
1056 Group membership. PhpWiki supports defining permissions for a group as
1057 well as for individual users. This defines how group membership information
1058 is obtained. Supported values are:
1061 <dd>Disable group membership (Fastest). Note the required quoting.</dd>
1063 <dd>Define groups as list at \"CategoryGroup\". (Slowest, but easiest to maintain)</dd>
1065 <dd>Stored in an SQL database. Optionally external. See USERS/GROUPS queries</dd>
1067 <dd>Flatfile. See AUTH_GROUP_FILE below.</dd>
1069 <dd>LDAP groups. See \"LDAP authentication options\" above and
1070 lib/WikiGroup.php. (experimental)</dd></dl>");
1072 $properties["CATEGORY_GROUP_PAGE"] =
1073 new _define_optional('CATEGORY_GROUP_PAGE', _("CategoryGroup"), "
1074 If GROUP_METHOD = WIKIPAGE:
1076 Page where all groups are listed.");
1078 $properties["AUTH_GROUP_FILE"] =
1079 new _define_optional('AUTH_GROUP_FILE', _("/etc/groups"), "
1080 For GROUP_METHOD = FILE, the file given below is referenced to obtain
1081 group membership information. It should be in the same format as the
1082 standard unix /etc/groups(5) file.");
1084 $properties["Part Three B"] =
1085 new part('_part3b', $SEPARATOR."\n", "
1087 Part Three B: (optional)
1088 External database authentication and authorization.
1090 If USER_AUTH_ORDER includes Db, or GROUP_METHOD = DB, the options listed
1091 below define the SQL queries used to obtain the information out of the
1092 database, and (optionally) store the information back to the DB.");
1094 $properties["DBAUTH_AUTH_DSN"] =
1095 new _define_optional('DBAUTH_AUTH_DSN', $dsn_sqlstring, "
1096 A database DSN to connect to. Defaults to the DSN specified for the Wiki as a whole.");
1098 $properties["User Exists Query"] =
1099 new _define('DBAUTH_AUTH_USER_EXISTS', "SELECT userid FROM user WHERE userid='\$userid'", "
1100 USER/PASSWORD queries:
1102 For USER_AUTH_POLICY=strict and the Db method is required");
1104 $properties["Check Query"] =
1105 new _define_optional('DBAUTH_AUTH_CHECK', "SELECT IF(passwd='\$password',1,0) AS ok FROM user WHERE userid='\$userid'", "
1107 Check to see if the supplied username/password pair is OK
1109 Plaintext passwords: (DBAUTH_AUTH_CRYPT_METHOD = plain)<br>
1110 ; DBAUTH_AUTH_CHECK = \"SELECT IF(passwd='\$password',1,0) AS ok FROM user WHERE userid='\$userid'\"
1112 database-hashed passwords (more secure):<br>
1113 ; DBAUTH_AUTH_CHECK = \"SELECT IF(passwd=PASSWORD('\$password'),1,0) AS ok FROM user WHERE userid='\$userid'\"");
1115 $properties["Crypt Method"] =
1116 new _define_selection_optional
1117 ('DBAUTH_AUTH_CRYPT_METHOD',
1118 array('plain' => 'plain',
1119 'crypt' => 'crypt'), "
1120 If you want to use Unix crypt()ed passwords, you can use DBAUTH_AUTH_CHECK
1121 to get the password out of the database with a simple SELECT query, and
1122 specify DBAUTH_AUTH_USER_EXISTS and DBAUTH_AUTH_CRYPT_METHOD:
1124 ; DBAUTH_AUTH_CHECK = \"SELECT passwd FROM user where userid='\$userid'\" <br>
1125 ; DBAUTH_AUTH_CRYPT_METHOD = crypt");
1127 $properties["Update the user's authentication credential"] =
1128 new _define('DBAUTH_AUTH_UPDATE', "UPDATE user SET passwd='\$password' WHERE userid='\$userid'", "
1129 If this is not defined but DBAUTH_AUTH_CHECK is, then the user will be unable to update their
1132 Plaintext passwords:<br>
1133 DBAUTH_AUTH_UPDATE = \"UPDATE user SET passwd='\$password' WHERE userid='\$userid'\"<br>
1134 Database-hashed passwords:<br>
1135 DBAUTH_AUTH_UPDATE = \"UPDATE user SET passwd=PASSWORD('\$password') WHERE userid='\$userid'\"");
1137 $properties["Allow the user to create their own account"] =
1138 new _define_optional('DBAUTH_AUTH_CREATE', "INSERT INTO user SET passwd=PASSWORD('\$password'),userid='\$userid'", "
1139 If this is empty, Db users cannot subscribe by their own.");
1141 $properties["USER/PREFERENCE queries"] =
1142 new _define_optional('DBAUTH_PREF_SELECT', "SELECT prefs FROM user WHERE userid='\$userid'", "
1143 If you choose to store your preferences in an external database, enable
1144 the following queries. Note that if you choose to store user preferences
1145 in the 'user' table, only registered users get their prefs from the database,
1146 self-created users do not. Better to use the special 'pref' table.
1148 The prefs field stores the serialized form of the user's preferences array,
1149 to ease the complication of storage.
1151 DBAUTH_PREF_SELECT = \"SELECT prefs FROM user WHERE userid='\$userid'\"
1152 DBAUTH_PREF_SELECT = \"SELECT prefs FROM pref WHERE userid='\$userid'\"
1155 $properties["Update the user's preferences"] =
1156 new _define_optional('DBAUTH_PREF_UPDATE', "UPDATE user SET prefs='\$pref_blob' WHERE userid='\$userid'", "
1157 Note that REPLACE works only with mysql and destroy all other columns!
1159 Mysql: DBAUTH_PREF_UPDATE = \"REPLACE INTO pref SET prefs='\$pref_blob',userid='\$userid'\"");
1161 $properties["USERS/GROUPS queries"] =
1162 new _define_optional('DBAUTH_IS_MEMBER', "SELECT user FROM user WHERE user='\$userid' AND group='\$groupname'", "
1163 You can define 1:n or n:m user<=>group relations, as you wish.
1165 Sample configurations:
1167 only one group per user (1:n):<br>
1168 DBAUTH_IS_MEMBER = \"SELECT user FROM user WHERE user='\$userid' AND group='\$groupname'\"<br>
1169 DBAUTH_GROUP_MEMBERS = \"SELECT user FROM user WHERE group='\$groupname'\"<br>
1170 DBAUTH_USER_GROUPS = \"SELECT group FROM user WHERE user='\$userid'\"<br>
1171 multiple groups per user (n:m):<br>
1172 DBAUTH_IS_MEMBER = \"SELECT userid FROM member WHERE userid='\$userid' AND groupname='\$groupname'\"<br>
1173 DBAUTH_GROUP_MEMBERS = \"SELECT DISTINCT userid FROM member WHERE groupname='\$groupname'\"<br>
1174 DBAUTH_USER_GROUPS = \"SELECT groupname FROM member WHERE userid='\$userid'\"<br>");
1175 $properties["DBAUTH_GROUP_MEMBERS"] =
1176 new _define_optional('DBAUTH_GROUP_MEMBERS', "SELECT user FROM user WHERE group='\$groupname'", "");
1177 $properties["DBAUTH_USER_GROUPS"] =
1178 new _define_optional('DBAUTH_USER_GROUPS', "SELECT group FROM user WHERE user='\$userid'", "");
1180 if (function_exists('ldap_connect')) {
1182 $properties["LDAP AUTH Host"] =
1183 new _define_optional('LDAP_AUTH_HOST', "ldap://localhost:389", "
1184 If USER_AUTH_ORDER contains Ldap:
1186 The LDAP server to connect to. Can either be a hostname, or a complete
1187 URL to the server (useful if you want to use ldaps or specify a different
1190 $properties["LDAP BASE DN"] =
1191 new _define_optional('LDAP_BASE_DN', "ou=mycompany.com,o=My Company", "
1192 The organizational or domain BASE DN: e.g. \"dc=mydomain,dc=com\".
1194 Note: ou=Users and ou=Groups are used for GroupLdap Membership
1195 Better use LDAP_OU_USERS and LDAP_OU_GROUP with GROUP_METHOD=LDAP.");
1197 $properties["LDAP SET OPTION"] =
1198 new _define_optional('LDAP_SET_OPTION', "LDAP_OPT_PROTOCOL_VERSION=3:LDAP_OPT_REFERRALS=0", "
1199 Some LDAP servers need some more options, such as the Windows Active
1200 Directory Server. Specify the options (as allowed by the PHP LDAP module)
1201 and their values as NAME=value pairs separated by colons.");
1203 $properties["LDAP AUTH USER"] =
1204 new _define_optional('LDAP_AUTH_USER', "CN=ldapuser,ou=Users,o=Development,dc=mycompany.com", "
1205 DN to initially bind to the LDAP server as. This is needed if the server doesn't
1206 allow anonymous queries. (Windows Active Directory Server)");
1208 $properties["LDAP AUTH PASSWORD"] =
1209 new _define_optional('LDAP_AUTH_PASSWORD', "secret", "
1210 Password to use to initially bind to the LDAP server, as the DN
1211 specified in the LDAP_AUTH_USER option (above).");
1213 $properties["LDAP SEARCH FIELD"] =
1214 new _define_optional('LDAP_SEARCH_FIELD', "uid", "
1215 If you want to match usernames against an attribute other than uid,
1216 specify it here. Default: uid
1218 e.g.: LDAP_SEARCH_FIELD = sAMAccountName");
1220 $properties["LDAP OU USERS"] =
1221 new _define_optional('LDAP_OU_USERS', "ou=Users", "
1222 If you have an organizational unit for all users, define it here.
1223 This narrows the search, and is needed for LDAP group membership (if GROUP_METHOD=LDAP)
1224 Default: ou=Users");
1226 $properties["LDAP OU GROUP"] =
1227 new _define_optional('LDAP_OU_GROUP', "ou=Groups", "
1228 If you have an organizational unit for all groups, define it here.
1229 This narrows the search, and is needed for LDAP group membership (if GROUP_METHOD=LDAP)
1230 The entries in this ou must have a gidNumber and cn attribute.
1231 Default: ou=Groups");
1233 } else { // function_exists('ldap_connect')
1235 $properties["LDAP Authentication"] =
1236 new unchangeable_define('LDAP Authentication', "
1237 ; If USER_AUTH_ORDER contains Ldap:
1239 ; The LDAP server to connect to. Can either be a hostname, or a complete
1240 ; URL to the server (useful if you want to use ldaps or specify a different
1242 ;LDAP_AUTH_HOST = \"ldap://localhost:389\"
1244 ; The organizational or domain BASE DN: e.g. \"dc=mydomain,dc=com\".
1246 ; Note: ou=Users and ou=Groups are used for GroupLdap Membership
1247 ; Better use LDAP_OU_USERS and LDAP_OU_GROUP with GROUP_METHOD=LDAP.
1248 ;LDAP_BASE_DN = \"ou=Users,o=Development,dc=mycompany.com\"
1250 ; Some LDAP servers need some more options, such as the Windows Active
1251 ; Directory Server. Specify the options (as allowed by the PHP LDAP module)
1252 ; and their values as NAME=value pairs separated by colons.
1253 ; LDAP_SET_OPTION = \"LDAP_OPT_PROTOCOL_VERSION=3:LDAP_OPT_REFERRALS=0\"
1255 ; DN to initially bind to the LDAP server as. This is needed if the server doesn't
1256 ; allow anonymous queries. (Windows Active Directory Server)
1257 ; LDAP_AUTH_USER = \"CN=ldapuser,ou=Users,o=Development,dc=mycompany.com\"
1259 ; Password to use to initially bind to the LDAP server, as the DN
1260 ; specified in the LDAP_AUTH_USER option (above).
1261 ; LDAP_AUTH_PASSWORD = secret
1263 ; If you want to match usernames against an attribute other than uid,
1264 ; specify it here. Default: uid
1265 ; LDAP_SEARCH_FIELD = sAMAccountName
1267 ; If you have an organizational unit for all users, define it here.
1268 ; This narrows the search, and is needed for LDAP group membership (if GROUP_METHOD=LDAP)
1270 ; LDAP_OU_USERS = ou=Users
1272 ; If you have an organizational unit for all groups, define it here.
1273 ; This narrows the search, and is needed for LDAP group membership (if GROUP_METHOD=LDAP)
1274 ; The entries in this ou must have a gidNumber and cn attribute.
1275 ; Default: ou=Groups
1276 ; LDAP_OU_GROUP = ou=Groups", "
1277 ; Ignored. No LDAP support in this php. configure --with-ldap");
1280 if (function_exists('imap_open')) {
1282 $properties["IMAP Auth Host"] =
1283 new _define_optional('IMAP_AUTH_HOST', 'localhost:143/imap/notls', "
1284 If USER_AUTH_ORDER contains IMAP:
1286 The IMAP server to check usernames from. Defaults to localhost.
1288 Some IMAP_AUTH_HOST samples:
1289 localhost, localhost:143/imap/notls,
1290 localhost:993/imap/ssl/novalidate-cert (SuSE refuses non-SSL conections)");
1292 } else { // function_exists('imap_open')
1294 $properties["IMAP Authentication"] =
1295 new unchangeable_define('IMAP_AUTH_HOST',"
1296 ; If USER_AUTH_ORDER contains IMAP:
1297 ; The IMAP server to check usernames from. Defaults to localhost.
1299 ; Some IMAP_AUTH_HOST samples:
1300 ; localhost, localhost:143/imap/notls,
1301 ; localhost:993/imap/ssl/novalidate-cert (SuSE refuses non-SSL conections)
1302 ;IMAP_AUTH_HOST = localhost:143/imap/notls", "
1303 Ignored. No IMAP support in this php. configure --with-imap");
1307 $properties["POP3 Authentication"] =
1308 new _define_optional('POP3_AUTH_HOST', 'localhost:110', "
1309 If USER_AUTH_ORDER contains POP3:
1311 The POP3 mail server to check usernames and passwords against.");
1312 $properties["File Authentication"] =
1313 new _define_optional('AUTH_USER_FILE', '/etc/shadow', "
1314 If USER_AUTH_ORDER contains File:
1316 File to read for authentication information.
1317 Popular choices are /etc/shadow and /etc/httpd/.htpasswd");
1319 $properties["File Storable?"] =
1320 new boolean_define_commented_optional
1321 ('AUTH_USER_FILE_STORABLE',
1322 array('false' => "Disabled",
1323 'true' => "Enabled"), "
1324 Defines whether the user is able to change their own password via PhpWiki.
1325 Note that this means that the webserver user must be able to write to the
1326 file specified in AUTH_USER_FILE.");
1328 $properties["Session Auth USER"] =
1329 new _define_optional('AUTH_SESS_USER', 'userid', "
1330 If USER_AUTH_ORDER contains Session:
1332 Name of the session variable which holds the already authenticated username.
1333 Sample: 'userid', 'user[username]', 'user->username'");
1335 $properties["Session Auth LEVEL"] =
1336 new numeric_define('AUTH_SESS_LEVEL', '2', "
1337 Which level will the user be? 1 = Bogo or 2 = Pass");
1339 /////////////////////////////////////////////////////////////////////
1341 $properties["Part Four"] =
1342 new part('_part4', $SEPARATOR."\n", "
1345 Page appearance and layout");
1347 $properties["Theme"] =
1348 new _define_selection_optional('THEME',
1349 array('default' => "default",
1350 'MacOSX' => "MacOSX",
1351 'smaller' => 'smaller',
1352 'Wordpress'=> 'Wordpress',
1353 'Portland' => "Portland",
1354 'Sidebar' => "Sidebar",
1356 'wikilens' => 'wikilens (Ratings)',
1357 'shamino_com' => 'shamino_com',
1358 'SpaceWiki' => "SpaceWiki",
1359 'Hawaiian' => "Hawaiian",
1360 'MonoBook' => 'MonoBook [experimental]',
1361 'blog' => 'blog [experimental]',
1365 Most of the page appearance is controlled by files in the theme
1368 There are a number of pre-defined themes shipped with PhpWiki.
1369 Or you may create your own (e.g. by copying and then modifying one of
1379 THEME = wikilens (Ratings)
1387 THEME = MonoBook (WikiPedia) [experimental. MSIE problems]
1388 THEME = blog (Kubrick) [experimental. Several links missing]
1391 $properties["Character Set"] =
1392 new _define_optional('CHARSET', 'iso-8859-1', "
1393 Select a valid charset name to be inserted into the xml/html pages,
1394 and to reference links to the stylesheets (css). For more info see:
1395 http://www.iana.org/assignments/character-sets. Note that PhpWiki
1396 has been extensively tested only with the latin1 (iso-8859-1)
1399 If you change the default from iso-8859-1 PhpWiki may not work
1400 properly and it will require code modifications. However, character
1401 sets similar to iso-8859-1 may work with little or no modification
1402 depending on your setup. The database must also support the same
1403 charset, and of course the same is true for the web browser. (Some
1404 work is in progress hopefully to allow more flexibility in this
1405 area in the future).");
1407 $properties["Language"] =
1408 new _define_selection_optional('DEFAULT_LANGUAGE',
1409 array('en' => "English",
1410 '' => "<empty> (user-specific)",
1413 'nl' => "Nederlands",
1418 'zh' => "Chinese"), "
1419 Select your language/locale - default language is \"en\" for English.
1420 Other languages available:<pre>
1421 English \"en\" (English - HomePage)
1422 German \"de\" (Deutsch - StartSeite)
1423 French \"fr\" (Fran~is - Accueil)
1424 Dutch \"nl\" (Nederlands - ThuisPagina)
1425 Spanish \"es\" (Espa~l - P~inaPrincipal)
1426 Swedish \"sv\" (Svenska - Framsida)
1427 Italian \"it\" (Italiano - PaginaPrincipale)
1428 Japanese \"ja\" (Japanese - ~~~~~~)
1429 Chinese \"zh\" (Chinese)
1431 If you set DEFAULT_LANGUAGE to the empty string, your systems default language
1432 (as determined by the applicable environment variables) will be
1435 $properties["Wiki Page Source"] =
1436 new _define_optional('WIKI_PGSRC', 'pgsrc', "
1437 WIKI_PGSRC -- specifies the source for the initial page contents of
1438 the Wiki. The setting of WIKI_PGSRC only has effect when the wiki is
1439 accessed for the first time (or after clearing the database.)
1440 WIKI_PGSRC can either name a directory or a zip file. In either case
1441 WIKI_PGSRC is scanned for files -- one file per page.
1443 // Default (old) behavior:
1444 define('WIKI_PGSRC', 'pgsrc');
1446 define('WIKI_PGSRC', 'wiki.zip');
1447 define('WIKI_PGSRC',
1448 '../Logs/Hamwiki/hamwiki-20010830.zip');
1452 $properties["Default Wiki Page Source"] =
1453 new _define('DEFAULT_WIKI_PGSRC', 'pgsrc', "
1454 DEFAULT_WIKI_PGSRC is only used when the language is *not* the
1455 default (English) and when reading from a directory: in that case
1456 some English pages are inserted into the wiki as well.
1457 DEFAULT_WIKI_PGSRC defines where the English pages reside.
1459 FIXME: is this really needed?
1462 $properties["Generic Pages"] =
1463 new array_variable('GenericPages', array('ReleaseNotes', 'SteveWainstead', 'TestPage'), "
1464 These are the pages which will get loaded from DEFAULT_WIKI_PGSRC.
1466 FIXME: is this really needed? Cannot we just copy these pages into
1467 the localized pgsrc?
1473 $properties["Part Five"] =
1474 new part('_part5', $SEPARATOR."\n", "
1479 $properties["Allowed Protocols"] =
1480 new list_define('ALLOWED_PROTOCOLS', 'http|https|mailto|ftp|news|nntp|ssh|gopher', "
1481 Allowed protocols for links - be careful not to allow \"javascript:\"
1482 URL of these types will be automatically linked.
1483 within a named link [name|uri] one more protocol is defined: phpwiki");
1485 $properties["Inline Images"] =
1486 new list_define('INLINE_IMAGES', 'png|jpg|gif', "
1487 URLs ending with the following extension should be inlined as images.
1488 Scripts shoud not be allowed!");
1490 $properties["WikiName Regexp"] =
1491 new _define('WIKI_NAME_REGEXP', "(?<![[:alnum:]])(?:[[:upper:]][[:lower:]]+){2,}(?![[:alnum:]])", "
1492 Perl regexp for WikiNames (\"bumpy words\")
1493 (?<!..) & (?!...) used instead of '\b' because \b matches '_' as well");
1495 $properties["Subpage Separator"] =
1496 new _define_optional('SUBPAGE_SEPARATOR', '"/"', "
1497 One character which seperates pages from subpages. Defaults to '/', but '.' or ':' were also used.",
1498 "onchange=\"validate_ereg('Sorry, \'%s\' must be a single character. Currently only :, / or .', '^[/:.]$', 'SUBPAGE_SEPARATOR', this);\""
1501 $properties["InterWiki Map File"] =
1502 new _define('INTERWIKI_MAP_FILE', 'lib/interwiki.map', "
1503 InterWiki linking -- wiki-style links to other wikis on the web
1505 The map will be taken from a page name InterWikiMap.
1506 If that page is not found (or is not locked), or map
1507 data can not be found in it, then the file specified
1508 by INTERWIKI_MAP_FILE (if any) will be used.");
1510 $properties["WARN_NONPUBLIC_INTERWIKIMAP"] =
1511 new boolean_define('WARN_NONPUBLIC_INTERWIKIMAP',
1512 array('true' => "true",
1513 'false' => "false"), "
1514 Display a warning if the internal lib/interwiki.map is used, and
1515 not the public InterWikiMap page. This map is not readable from outside.");
1518 $properties["Keyword Link Regexp"] =
1519 new _define_optional('KEYWORDS', '\"Category* OR Topic*\"', "
1520 Search term used for automatic page classification by keyword extraction.
1522 Any links on a page to pages whose names match this search
1523 will be used keywords in the keywords html meta tag. This is an aid to
1524 classification by search engines. The value of the match is
1525 used as the keyword.
1527 The default behavior is to match Category* or Topic* links.");
1529 $properties["Author and Copyright Site Navigation Links"] =
1530 new _define_commented_optional('COPYRIGHTPAGE_TITLE', "GNU General Public License", "
1532 These will be inserted as <link rel> tags in the html header of
1533 every page, for search engines and for browsers like Mozilla which
1534 take advantage of link rel site navigation.
1536 If you have your own copyright and contact information pages change
1537 these as appropriate.");
1539 $properties["COPYRIGHTPAGE URL"] =
1540 new _define_commented_optional('COPYRIGHTPAGE_URL', "http://www.gnu.org/copyleft/gpl.html#SEC1", "
1542 Other useful alternatives to consider:
1544 COPYRIGHTPAGE_TITLE = \"GNU Free Documentation License\"
1545 COPYRIGHTPAGE_URL = \"http://www.gnu.org/copyleft/fdl.html\"
1546 COPYRIGHTPAGE_TITLE = \"Creative Commons License 2.0\"
1547 COPYRIGHTPAGE_URL = \"http://creativecommons.org/licenses/by/2.0/\"</pre>
1548 See http://creativecommons.org/learn/licenses/ for variations");
1550 $properties["AUTHORPAGE_TITLE"] =
1551 new _define_commented_optional('AUTHORPAGE_TITLE', "The PhpWiki Programming Team", "
1552 Default Author Names");
1553 $properties["AUTHORPAGE_URL"] =
1554 new _define_commented_optional('AUTHORPAGE_URL', "http://phpwiki.org/ThePhpWikiProgrammingTeam", "
1555 Default Author URL");
1557 new boolean_define_optional
1559 array('true' => "Enabled",
1560 'false' => "Disabled"), "
1561 Allow full markup in headers to be parsed by the CreateToc plugin.
1563 If false you may not use WikiWords or [] links or any other markup in
1564 headers in pages with the CreateToc plugin. But if false the parsing is
1565 faster and more stable.");
1569 $properties["Part Six"] =
1570 new part('_part6', $SEPARATOR."\n", "
1572 Part Six (optional):
1573 URL options -- you can probably skip this section.
1575 For a pretty wiki (no index.php in the url) set a seperate DATA_PATH.");
1577 global $HTTP_SERVER_VARS;
1578 $properties["Server Name"] =
1579 new _define_commented_optional('SERVER_NAME', $HTTP_SERVER_VARS['SERVER_NAME'], "
1580 Canonical name of the server on which this PhpWiki resides.");
1582 $properties["Server Port"] =
1583 new numeric_define_commented('SERVER_PORT', $HTTP_SERVER_VARS['SERVER_PORT'], "
1584 Canonical httpd port of the server on which this PhpWiki resides.",
1585 "onchange=\"validate_ereg('Sorry, \'%s\' is no valid port number.', '^[0-9]+$', 'SERVER_PORT', this);\"");
1587 $properties["Script Name"] =
1588 new _define_commented_optional('SCRIPT_NAME', $scriptname, "
1589 Relative URL (from the server root) of the PhpWiki script.");
1591 $properties["Data Path"] =
1592 new _define_commented_optional('DATA_PATH', dirname($scriptname), "
1593 URL of the PhpWiki install directory. (You only need to set this
1594 if you've moved index.php out of the install directory.) This can
1595 be either a relative URL (from the directory where the top-level
1596 PhpWiki script is) or an absolute one.");
1599 $properties["PhpWiki Install Directory"] =
1600 new _define_commented_optional('PHPWIKI_DIR', dirname(__FILE__), "
1601 Path to the PhpWiki install directory. This is the local
1602 filesystem counterpart to DATA_PATH. (If you have to set
1603 DATA_PATH, your probably have to set this as well.) This can be
1604 either an absolute path, or a relative path interpreted from the
1605 directory where the top-level PhpWiki script (normally index.php)
1608 $properties["Use PATH_INFO"] =
1609 new _define_selection_optional_commented('USE_PATH_INFO',
1610 array('' => 'automatic',
1611 'true' => 'use PATH_INFO',
1612 'false' => 'do not use PATH_INFO'), "
1613 PhpWiki will try to use short urls to pages, eg
1614 http://www.example.com/index.php/HomePage
1615 If you want to use urls like
1616 http://www.example.com/index.php?pagename=HomePage
1617 then define 'USE_PATH_INFO' as false by uncommenting the line below.
1618 NB: If you are using Apache >= 2.0.30, then you may need to to use
1619 the directive \"AcceptPathInfo On\" in your Apache configuration file
1620 (or in an appropriate <.htaccess> file) for the short urls to work:
1621 See http://httpd.apache.org/docs-2.0/mod/core.html#acceptpathinfo
1623 See also http://phpwiki.sourceforge.net/phpwiki/PrettyWiki for more ideas
1624 on prettifying your urls.
1626 Default: PhpWiki will try to divine whether use of PATH_INFO
1627 is supported in by your webserver/PHP configuration, and will
1628 use PATH_INFO if it thinks that is possible.");
1630 $properties["Virtual Path"] =
1631 new _define_commented_optional('VIRTUAL_PATH', '/SomeWiki', "
1632 VIRTUAL_PATH is the canonical URL path under which your your wiki
1633 appears. Normally this is the same as dirname(SCRIPT_NAME), however
1634 using e.g. seperate starter scripts, apaches mod_actions (or mod_rewrite),
1635 you can make it something different.
1637 If you do this, you should set VIRTUAL_PATH here or in the starter scripts.
1639 E.g. your phpwiki might be installed at at /scripts/phpwiki/index.php,
1640 but you've made it accessible through eg. /wiki/HomePage.
1642 One way to do this is to create a directory named 'wiki' in your
1643 server root. The directory contains only one file: an .htaccess
1644 file which reads something like:
1646 Action x-phpwiki-page /scripts/phpwiki/index.php
1647 SetHandler x-phpwiki-page
1648 DirectoryIndex /scripts/phpwiki/index.php
1650 In that case you should set VIRTUAL_PATH to '/wiki'.
1652 (VIRTUAL_PATH is only used if USE_PATH_INFO is true.)
1657 $properties["Part Seven"] =
1658 new part('_part7', $SEPARATOR."\n", "
1662 Miscellaneous settings
1665 $properties["Strict Mailable Pagedumps"] =
1666 new boolean_define_optional
1667 ('STRICT_MAILABLE_PAGEDUMPS',
1668 array('false' => "binary",
1669 'true' => "quoted-printable"),
1671 If you define this to true, (MIME-type) page-dumps (either zip dumps,
1672 or \"dumps to directory\" will be encoded using the quoted-printable
1673 encoding. If you're actually thinking of mailing the raw page dumps,
1674 then this might be useful, since (among other things,) it ensures
1675 that all lines in the message body are under 80 characters in length.
1677 Also, setting this will cause a few additional mail headers
1678 to be generated, so that the resulting dumps are valid
1679 RFC 2822 e-mail messages.
1681 Probably, you can just leave this set to false, in which case you get
1682 raw ('binary' content-encoding) page dumps.");
1684 $properties["HTML Dump Filename Suffix"] =
1685 new _define_optional('HTML_DUMP_SUFFIX', ".html", "
1686 Here you can change the filename suffix used for XHTML page dumps.
1687 If you don't want any suffix just comment this out.");
1689 $properties["Default local Dump Directory"] =
1690 new _define_optional('DEFAULT_DUMP_DIR', "/tmp/wikidump", "
1691 Specify the default directory for local backups.");
1693 $properties["Default local HTML Dump Directory"] =
1694 new _define_optional('HTML_DUMP_DIR', "/tmp/wikidumphtml", "
1695 Specify the default directory for local XHTML dumps.");
1697 $properties["Pagename of Recent Changes"] =
1698 new _define_optional('RECENT_CHANGES', 'RecentChanges', "
1699 Page name of RecentChanges page. Used for RSS Auto-discovery.");
1701 $properties["Disable HTTP Redirects"] =
1702 new boolean_define_commented_optional
1703 ('DISABLE_HTTP_REDIRECT',
1704 array('false' => 'Enable HTTP Redirects',
1705 'true' => 'Disable HTTP Redirects'),
1707 (You probably don't need to touch this.)
1709 PhpWiki uses HTTP redirects for some of it's functionality.
1710 (e.g. after saving changes, PhpWiki redirects your browser to
1711 view the page you just saved.)
1713 Some web service providers (notably free European Lycos) don't seem to
1714 allow these redirects. (On Lycos the result in an \"Internal Server Error\"
1715 report.) In that case you can set DISABLE_HTTP_REDIRECT to true.
1716 (In which case, PhpWiki will revert to sneakier tricks to try to
1717 redirect the browser...)");
1719 $properties["Disable GETIMAGESIZE"] =
1720 new boolean_define_commented_optional
1721 ('DISABLE_GETIMAGESIZE',
1722 array('false' => 'Enable',
1723 'true' => 'Disable'), "
1724 Set GETIMAGESIZE to disabled, if your php fails to calculate the size on
1725 inlined images, or you don't want to disable too small images to be inlined.
1727 Per default too small ploaded or external images are not displayed,
1728 to prevent from external 1 pixel spam.");
1730 $properties["EDITING_POLICY"] =
1731 new _define_optional('EDITING_POLICY', "EditingPolicy", "
1732 An interim page which gets displayed on every edit attempt, if it exists.");
1734 $properties["ENABLE_MODERATEDPAGE_ALL"] =
1735 new boolean_define_commented_optional
1736 ('ENABLE_MODERATEDPAGE_ALL',
1737 array('false' => 'Disable',
1738 'true' => 'Enable'), "
1741 $properties["FORTUNE_DIR"] =
1742 new _define_commented_optional('FORTUNE_DIR', "/usr/share/fortune", "
1744 $properties["DBADMIN_USER"] =
1745 new _define_commented_optional('DBADMIN_USER', "", "
1747 $properties["DBADMIN_PASSWD"] =
1748 new _define_commented_optional('DBADMIN_PASSWD', "", "
1750 $properties["USE_EXTERNAL_HTML2PDF"] =
1751 new _define_commented_optional('USE_EXTERNAL_HTML2PDF', "htmldoc --quiet --format pdf14 --no-toc --no-title %s", "
1753 $properties["BABYCART_PATH"] =
1754 new _define_commented_optional('BABYCART_PATH', "/usr/local/bin/babycart", "
1757 $properties["Part Seven A"] =
1758 new part('_part7a', $SEPARATOR."\n", "
1762 Cached Plugin Settings. (pear Cache)
1765 $properties["pear Cache USECACHE"] =
1766 new boolean_define_optional('PLUGIN_CACHED_USECACHE',
1767 array('true' => 'Enabled',
1768 'false' => 'Disabled'), "
1769 Enable or disable pear caching of plugins.");
1770 $properties["pear Cache Database Container"] =
1771 new _define_selection_optional('PLUGIN_CACHED_DATABASE',
1772 array('file' => 'file'), "
1773 Curently only file is supported.
1774 db, trifile and imgfile might be supported, but you must hack that by yourself.");
1776 $properties["pear Cache cache directory"] =
1777 new _define_commented_optional('PLUGIN_CACHED_CACHE_DIR', "/tmp/cache", "
1778 Should be writable to the webserver.");
1779 $properties["pear Cache Filename Prefix"] =
1780 new _define_optional('PLUGIN_CACHED_FILENAME_PREFIX', "phpwiki", "");
1781 $properties["pear Cache HIGHWATER"] =
1782 new numeric_define_optional('PLUGIN_CACHED_HIGHWATER', "4194304", "
1783 Garbage collection parameter.");
1784 $properties["pear Cache LOWWATER"] =
1785 new numeric_define_optional('PLUGIN_CACHED_LOWWATER', "3145728", "
1786 Garbage collection parameter.");
1787 $properties["pear Cache MAXLIFETIME"] =
1788 new numeric_define_optional('PLUGIN_CACHED_MAXLIFETIME', "2592000", "
1789 Garbage collection parameter.");
1790 $properties["pear Cache MAXARGLEN"] =
1791 new numeric_define_optional('PLUGIN_CACHED_MAXARGLEN', "1000", "
1792 max. generated url length.");
1793 $properties["pear Cache FORCE_SYNCMAP"] =
1794 new boolean_define_optional('PLUGIN_CACHED_FORCE_SYNCMAP',
1795 array('true' => 'Enabled',
1796 'false' => 'Disabled'), "");
1797 $properties["pear Cache IMGTYPES"] =
1798 new list_define('PLUGIN_CACHED_IMGTYPES', "png|gif|gd|gd2|jpeg|wbmp|xbm|xpm", "
1799 Handle those image types via GD handles. Check your GD supported image types.");
1801 $end = "\n".$SEPARATOR."\n";
1803 // end of configuration options
1804 ///////////////////////////////
1805 // begin class definitions
1808 * A basic config-dist.ini configuration line in the form of a variable.
1809 * (not needed anymore, we have only defines)
1811 * Produces a string in the form "$name = value;"
1813 * $WikiNameRegexp = "value";
1817 var $config_item_name;
1823 function _variable($config_item_name, $default_value, $description, $jscheck = '') {
1824 $this->config_item_name = $config_item_name;
1825 $this->description = $description;
1826 if (defined($config_item_name)
1827 and !preg_match("/(selection|boolean)/", get_class($this))
1828 and !preg_match("/(SCRIPT_NAME|VIRTUAL_PATH)/", $config_item_name))
1829 $this->default_value = constant($config_item_name); // ignore given default value
1830 elseif ($config_item_name == $default_value)
1831 $this->default_value = '';
1833 $this->default_value = $default_value;
1834 $this->jscheck = $jscheck;
1835 if (preg_match("/variable/i",get_class($this)))
1836 $this->prefix = "\$";
1837 elseif (preg_match("/ini_set/i",get_class($this)))
1838 $this->prefix = "ini_get: ";
1844 global $HTTP_POST_VARS;
1845 if (isset($HTTP_POST_VARS[$this->config_item_name]))
1846 return $HTTP_POST_VARS[$this->config_item_name];
1848 return $this->default_value;
1851 function _config_format($value) {
1853 $v = $this->get_config_item_name();
1854 // handle arrays: a|b --> a['b']
1855 if (strpos($v, '|')) {
1856 list($a, $b) = explode('|', $v);
1857 $v = sprintf("%s['%s']", $a, $b);
1859 if (preg_match("/[\"']/", $value))
1860 $value = '"' . $value . '"';
1861 return sprintf("%s = \"%s\"", $v, $value);
1864 function get_config_item_name() {
1865 return $this->config_item_name;
1868 function get_config_item_id() {
1869 return str_replace('|', '-', $this->config_item_name);
1872 function get_config_item_header() {
1873 if (strchr($this->config_item_name,'|')) {
1874 list($var,$param) = explode('|',$this->config_item_name);
1875 return "<b>" . $this->prefix . $var . "['" . $param . "']</b><br />";
1877 elseif ($this->config_item_name[0] != '_')
1878 return "<b>" . $this->prefix . $this->config_item_name . "</b><br />";
1883 function _get_description() {
1884 return $this->description;
1887 function _get_config_line($posted_value) {
1888 return "\n" . $this->_config_format($posted_value);
1891 function get_config($posted_value) {
1892 $d = stripHtml($this->_get_description());
1893 $d = str_replace("\n", "\n; ", $d) . $this->_get_config_line($posted_value) ."\n";
1897 function get_instructions($title) {
1899 $i = "<h3>" . $title . "</h3>\n " . nl2p($this->_get_description()) . "\n";
1900 return "<tr>\n<td width=\"$tdwidth\" class=\"instructions\">\n" . $i . "</td>\n";
1903 function get_html() {
1904 $size = strlen($this->default_value) > 45 ? 90 : 50;
1905 return $this->get_config_item_header() .
1906 "<input type=\"text\" size=\"$50\" name=\"" . $this->get_config_item_name() . "\" value=\"" . htmlspecialchars($this->default_value) . "\" " .
1907 $this->jscheck . " />" . "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: green\">Input accepted.</p>";
1911 class unchangeable_variable
1913 function _config_format($value) {
1916 // function get_html() { return false; }
1917 function get_html() {
1918 return $this->get_config_item_header() .
1919 "<em>Not editable.</em>" .
1920 "<pre>" . $this->default_value."</pre>";
1922 function _get_config_line($posted_value) {
1923 if ($this->description)
1925 return "${n}".$this->default_value;
1927 function get_instructions($title) {
1929 $i = "<h3>" . $title . "</h3>\n " . nl2p($this->_get_description()) . "\n";
1930 // $i .= "<em>Not editable.</em><br />\n<pre>" . $this->default_value."</pre>";
1931 return '<tr><td width="100%" class="unchangeable-variable-top" colspan="2">'."\n".$i."</td></tr>\n"
1932 . '<tr style="border-top: none;"><td class="unchangeable-variable-left" width="'.$tdwidth.'"> </td>';
1936 class unchangeable_define
1937 extends unchangeable_variable {
1938 function _config_format($value) {
1942 class unchangeable_ini_set
1943 extends unchangeable_variable {
1944 function _config_format($value) {
1949 class _variable_selection
1952 global $HTTP_POST_VARS;
1953 if (!empty($HTTP_POST_VARS[$this->config_item_name]))
1954 return $HTTP_POST_VARS[$this->config_item_name];
1956 list($option, $label) = each($this->default_value);
1960 function get_html() {
1961 $output = $this->get_config_item_header();
1962 $output .= '<select name="' . $this->get_config_item_name() . "\">\n";
1963 /* The first option is the default */
1964 $values = $this->default_value;
1965 if (defined($this->get_config_item_name()))
1966 $this->default_value = constant($this->get_config_item_name());
1968 $this->default_value = null;
1969 while(list($option, $label) = each($values)) {
1970 if (!is_null($this->default_value) and $this->default_value === $option)
1971 $output .= " <option value=\"$option\" selected=\"selected\">$label</option>\n";
1973 $output .= " <option value=\"$option\">$label</option>\n";
1975 $output .= "</select>\n";
1983 function _config_format($value) {
1984 return sprintf("%s = \"%s\"", $this->get_config_item_name(), $value);
1986 function _get_config_line($posted_value) {
1987 if ($this->description)
1989 if ($posted_value == '')
1990 return "${n};" . $this->_config_format("");
1992 return "${n}" . $this->_config_format($posted_value);
1994 function get_html() {
1995 $size = strlen($this->default_value) > 45 ? 90 : 50;
1996 return $this->get_config_item_header()
1997 . "<input type=\"text\" size=\"$size\" name=\"" . htmlentities($this->get_config_item_name())
1998 . "\" value=\"" . htmlentities($this->default_value) . "\" {$this->jscheck} />"
1999 . "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: green\">Input accepted.</p>";
2003 class _define_commented
2005 function _get_config_line($posted_value) {
2006 if ($this->description)
2008 if ($posted_value == $this->default_value)
2009 return "${n};" . $this->_config_format($posted_value);
2010 elseif ($posted_value == '')
2011 return "${n};" . $this->_config_format("");
2013 return "${n}" . $this->_config_format($posted_value);
2018 * We don't use _optional anymore, because INI-style config's don't need that.
2019 * IniConfig.php does the optional logic now.
2020 * But we use _optional for config-default.ini options
2022 class _define_commented_optional
2023 extends _define_commented { }
2025 class _define_optional
2028 class _define_notempty
2030 function get_html() {
2031 $s = $this->get_config_item_header()
2032 . "<input type=\"text\" size=\"50\" name=\"" . $this->get_config_item_name()
2033 . "\" value=\"" . $this->default_value . "\" {$this->jscheck} />";
2034 if (empty($this->default_value))
2035 return $s . "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: red\">Cannot be empty.</p>";
2037 return $s . "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: green\">Input accepted.</p>";
2041 class _variable_commented
2043 function _get_config_line($posted_value) {
2044 if ($this->description)
2046 if ($posted_value == $this->default_value)
2047 return "${n};" . $this->_config_format($posted_value);
2048 elseif ($posted_value == '')
2049 return "${n};" . $this->_config_format("");
2051 return "${n}" . $this->_config_format($posted_value);
2055 class numeric_define
2058 function numeric_define($config_item_name, $default_value, $description, $jscheck = '') {
2059 $this->_define($config_item_name, $default_value, $description, $jscheck);
2061 $this->jscheck = "onchange=\"validate_ereg('Sorry, \'%s\' is not an integer.', '^[-+]?[0-9]+$', '" . $this->get_config_item_name() . "', this);\"";
2063 function _config_format($value) {
2064 //return sprintf("define('%s', %s);", $this->get_config_item_name(), $value);
2065 return sprintf("%s = %s", $this->get_config_item_name(), $value);
2067 function _get_config_line($posted_value) {
2068 if ($this->description)
2070 if ($posted_value == '')
2071 return "${n};" . $this->_config_format('0');
2073 return "${n}" . $this->_config_format($posted_value);
2077 class numeric_define_optional
2078 extends numeric_define {}
2080 class numeric_define_commented
2081 extends numeric_define {
2082 function _get_config_line($posted_value) {
2083 if ($this->description)
2085 if ($posted_value == $this->default_value)
2086 return "${n};" . $this->_config_format($posted_value);
2087 elseif ($posted_value == '')
2088 return "${n};" . $this->_config_format('0');
2090 return "${n}" . $this->_config_format($posted_value);
2094 class _define_selection
2095 extends _variable_selection {
2096 function _config_format($value) {
2097 return sprintf("%s = %s", $this->get_config_item_name(), $value);
2099 function _get_config_line($posted_value) {
2100 return _define::_get_config_line($posted_value);
2102 function get_html() {
2103 return _variable_selection::get_html();
2107 class _define_selection_optional
2108 extends _define_selection { }
2110 class _variable_selection_optional
2111 extends _variable_selection { }
2113 class _define_selection_optional_commented
2114 extends _define_selection_optional {
2115 function _get_config_line($posted_value) {
2116 if ($this->description)
2118 if ($posted_value == $this->default_value)
2119 return "${n};" . $this->_config_format($posted_value);
2120 elseif ($posted_value == '')
2121 return "${n};" . $this->_config_format("");
2123 return "${n}" . $this->_config_format($posted_value);
2127 class _define_password
2130 function _define_password($config_item_name, $default_value, $description, $jscheck = '') {
2131 if ($config_item_name == $default_value) $default_value = '';
2132 $this->_define($config_item_name, $default_value, $description, $jscheck);
2134 $this->jscheck = "onchange=\"validate_ereg('Sorry, \'%s\' cannot be empty.', '^.+$', '"
2135 . $this->get_config_item_name() . "', this);\"";
2137 function _get_config_line($posted_value) {
2138 if ($this->description)
2140 if ($posted_value == '') {
2141 $p = "${n};" . $this->_config_format("");
2142 $p .= "\n; If you used the passencrypt.php utility to encode the password";
2143 $p .= "\n; then uncomment this line:";
2144 $p .= "\n;ENCRYPTED_PASSWD = true";
2147 if (function_exists('crypt')) {
2148 $salt_length = max(CRYPT_SALT_LENGTH,
2152 16 * CRYPT_BLOWFISH);
2153 // generate an encrypted password
2154 $crypt_pass = crypt($posted_value, rand_ascii($salt_length));
2155 $p = "${n}" . $this->_config_format($crypt_pass);
2156 return $p . "\nENCRYPTED_PASSWD = true";
2158 $p = "${n}" . $this->_config_format($posted_value);
2159 $p .= "\n; Encrypted passwords cannot be used:";
2160 $p .= "\n; 'function crypt()' not available in this version of php";
2161 $p .= "\nENCRYPTED_PASSWD = false";
2166 function get_html() {
2167 return _variable_password::get_html();
2171 class _define_password_optional
2172 extends _define_password { }
2174 class _variable_password
2176 function _variable_password($config_item_name, $default_value, $description, $jscheck = '') {
2177 if ($config_item_name == $default_value) $default_value = '';
2178 $this->_define($config_item_name, $default_value, $description, $jscheck);
2180 $this->jscheck = "onchange=\"validate_ereg('Sorry, \'%s\' cannot be empty.', '^.+$', '" . $this->get_config_item_name() . "', this);\"";
2182 function get_html() {
2183 global $HTTP_POST_VARS, $HTTP_GET_VARS;
2184 $s = $this->get_config_item_header();
2185 if (isset($HTTP_POST_VARS['create']) or isset($HTTP_GET_VARS['create'])) {
2186 $new_password = random_good_password();
2187 $this->default_value = $new_password;
2188 $s .= "Created password: <strong>$new_password</strong><br /> <br />";
2190 // dont re-encrypt already encrypted passwords
2191 $value = $this->value();
2192 $encrypted = !empty($GLOBALS['properties']["Encrypted Passwords"]) and
2193 $GLOBALS['properties']["Encrypted Passwords"]->value();
2196 $s .= "<input type=\"". ($encrypted ? "text" : "password") . "\" name=\"" . $this->get_config_item_name()
2197 . "\" value=\"" . $value . "\" {$this->jscheck} />"
2198 . " <input type=\"submit\" name=\"create\" value=\"Create Random Password\" />";
2200 $s .= "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: red\">Cannot be empty.</p>";
2201 elseif (strlen($this->default_value) < 4)
2202 $s .= "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: red\">Must be longer than 4 chars.</p>";
2204 $s .= "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: green\">Input accepted.</p>";
2211 function _get_config_line($posted_value) {
2212 // split the phrase by any number of commas or space characters,
2213 // which include " ", \r, \t, \n and \f
2214 $list_values = preg_split("/[\s,]+/", $posted_value, -1, PREG_SPLIT_NO_EMPTY);
2215 $list_values = join("|", $list_values);
2216 return _variable::_get_config_line($list_values);
2218 function get_html() {
2219 $list_values = explode("|", $this->default_value);
2220 $rows = max(3, count($list_values) +1);
2221 $list_values = join("\n", $list_values);
2222 $ta = $this->get_config_item_header();
2223 $ta .= "<textarea cols=\"18\" rows=\"". $rows ."\" name=\"".$this->get_config_item_name()."\" {$this->jscheck}>";
2224 $ta .= $list_values . "</textarea>";
2225 $ta .= "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: green\">Input accepted.</p>";
2232 function _get_config_line($posted_value) {
2233 $list_values = preg_split("/[\s,]+/", $posted_value, -1, PREG_SPLIT_NO_EMPTY);
2234 $list_values = join("|", $list_values);
2235 return _variable::_get_config_line($list_values);
2237 function get_html() {
2238 $list_values = explode("|", $this->default_value);
2239 $rows = max(3, count($list_values) +1);
2240 $list_values = join("\n", $list_values);
2241 $ta = $this->get_config_item_header();
2242 $ta .= "<textarea cols=\"18\" rows=\"". $rows ."\" name=\"".$this->get_config_item_name()."\" {$this->jscheck}>";
2243 $ta .= $list_values . "</textarea>";
2244 $ta .= "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: green\">Input accepted.</p>";
2249 class array_variable
2251 function _config_format($value) {
2252 return sprintf("%s = \"%s\"", $this->get_config_item_name(),
2253 is_array($value) ? join(':', $value) : $value);
2255 function _get_config_line($posted_value) {
2256 // split the phrase by any number of commas or space characters,
2257 // which include " ", \r, \t, \n and \f
2258 $list_values = preg_split("/[\s,]+/", $posted_value, -1, PREG_SPLIT_NO_EMPTY);
2259 if (!empty($list_values)) {
2260 $list_values = "'".join("', '", $list_values)."'";
2261 return "\n" . $this->_config_format($list_values);
2263 return "\n;" . $this->_config_format('');
2265 function get_html() {
2266 $list_values = join("\n", $this->default_value);
2267 $rows = max(3, count($this->default_value) +1);
2268 $ta = $this->get_config_item_header();
2269 $ta .= "<textarea cols=\"18\" rows=\"". $rows ."\" name=\"".$this->get_config_item_name()."\" {$this->jscheck}>";
2270 $ta .= $list_values . "</textarea>";
2271 $ta .= "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: green\">Input accepted.</p>";
2278 function _config_format($value) {
2279 return sprintf("%s = \"%s\"", $this->get_config_item_name(),
2280 is_array($value) ? join(' : ', $value) : $value);
2282 function _get_config_line($posted_value) {
2283 // split the phrase by any number of commas or space characters,
2284 // which include " ", \r, \t, \n and \f
2285 $list_values = preg_split("/[\s,:]+/", $posted_value, -1, PREG_SPLIT_NO_EMPTY);
2286 if (!empty($list_values)) {
2287 $list_values = "'".join("' : '", $list_values)."'";
2288 return "\n" . $this->_config_format($list_values);
2290 return "\n;" . $this->_config_format('');
2292 function get_html() {
2293 $list_values = join("\n", $this->default_value);
2294 $rows = max(3, count($this->default_value) +1);
2295 $ta = $this->get_config_item_header();
2296 $ta .= "<textarea cols=\"18\" rows=\"". $rows ."\" name=\"".$this->get_config_item_name()."\" {$this->jscheck}>";
2297 $ta .= $list_values . "</textarea>";
2298 $ta .= "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: green\">Input accepted.</p>";
2307 global $HTTP_POST_VARS;
2308 if ($v = $HTTP_POST_VARS[$this->config_item_name])
2311 return ini_get($this->get_config_item_name);
2314 function _config_format($value) {
2315 return sprintf("ini_set('%s', '%s');", $this->get_config_item_name(), $value);
2317 function _get_config_line($posted_value) {
2318 if ($posted_value && ! $posted_value == $this->default_value)
2319 return "\n" . $this->_config_format($posted_value);
2321 return "\n;" . $this->_config_format($this->default_value);
2326 class boolean_define
2328 function _get_config_line($posted_value) {
2329 if ($this->description)
2331 return "${n}" . $this->_config_format($posted_value);
2333 function _config_format($value) {
2334 if (strtolower(trim($value)) == 'false')
2336 return sprintf("%s = %s", $this->get_config_item_name(),
2337 (bool)$value ? 'true' : 'false');
2339 function get_html() {
2340 $output = $this->get_config_item_header();
2341 $output .= '<select name="' . $this->get_config_item_name() . "\" {$this->jscheck}>\n";
2342 $values = $this->default_value;
2343 if (defined($this->get_config_item_name()))
2344 $this->default_value = constant($this->get_config_item_name());
2346 $this->default_value = null;
2347 list($option, $label) = each($values);
2348 $output .= " <option value=\"$option\" selected=\"selected\">$label</option>\n";
2350 /* There can usually, only be two options, there can be
2351 * three options in the case of a boolean_define_commented_optional */
2352 while (list($option, $label) = each($values)) {
2353 if (!is_null($this->default_value) and $this->default_value === $option)
2354 $output .= " <option value=\"$option\" selected=\"selected\">$label</option>\n";
2356 $output .= " <option value=\"$option\">$label</option>\n";
2358 $output .= "</select>\n";
2363 class boolean_define_optional
2364 extends boolean_define {}
2366 class boolean_define_commented
2367 extends boolean_define {
2368 function _get_config_line($posted_value) {
2369 if ($this->description)
2371 list($default_value, $label) = each($this->default_value);
2372 if ($posted_value == $default_value)
2373 return "${n};" . $this->_config_format($posted_value);
2374 elseif ($posted_value == '')
2375 return "${n};" . $this->_config_format('false');
2377 return "${n}" . $this->_config_format($posted_value);
2381 class boolean_define_commented_optional
2382 extends boolean_define_commented {}
2386 function value () { return; }
2387 function get_config($posted_value) {
2388 $d = stripHtml($this->_get_description());
2390 return "\n".$SEPARATOR . str_replace("\n", "\n; ", $d) ."\n".$this->default_value;
2392 function get_instructions($title) {
2393 $id = preg_replace("/\W/","",$this->config_item_name);
2394 $group_name = preg_replace("/\W/","",$title);
2395 $i = "<tr class=\"header\" id=\"$id\">\n<td class=\"part\" width=\"100%\" colspan=\"2\" bgcolor=\"#eeeeee\">\n";
2396 $i .= "<h2>" . $title . "</h2>\n " . nl2p($this->_get_description()) ."\n";
2397 $i .= "<p><a href=\"javascript:toggle_group('$id')\" id=\"{$id}_text\">Hide options.</a></p>";
2398 return $i ."</td>\n";
2400 function get_html() {
2405 // html utility functions
2406 function nl2p($text) {
2407 preg_match_all("@\s*(<pre>.*?</pre>|<dl>.*?</dl>|.*?(?=\n\n|<pre>|<dl>|$))@s",
2408 $text, $m, PREG_PATTERN_ORDER);
2411 foreach ($m[1] as $par) {
2412 if (!($par = trim($par)))
2414 if (!preg_match('/^<(pre|dl)>/', $par))
2415 $par = "<p>$par</p>";
2421 function stripHtml($text) {
2422 $d = str_replace("<pre>", "", $text);
2423 $d = str_replace("</pre>", "", $d);
2424 $d = str_replace("<dl>", "", $d);
2425 $d = str_replace("</dl>", "", $d);
2426 $d = str_replace("<dt>", "", $d);
2427 $d = str_replace("</dt>", "", $d);
2428 $d = str_replace("<dd>", "", $d);
2429 $d = str_replace("</dd>", "", $d);
2430 $d = str_replace("<p>", "", $d);
2431 $d = str_replace("</p>", "", $d);
2432 //restore html entities into characters
2433 // http://www.php.net/manual/en/function.htmlentities.php
2434 $trans = get_html_translation_table (HTML_ENTITIES);
2435 $trans = array_flip ($trans);
2436 $d = strtr($d, $trans);
2440 include_once(dirname(__FILE__)."/lib/stdlib.php");
2443 // Function to create better user passwords (much larger keyspace),
2444 // suitable for user passwords.
2445 // Sequence of random ASCII numbers, letters and some special chars.
2446 // Note: There exist other algorithms for easy-to-remember passwords.
2447 function random_good_password ($minlength = 5, $maxlength = 8) {
2449 // assume ASCII ordering (not valid on EBCDIC systems!)
2450 $valid_chars = "!#%&+-.0123456789=@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz";
2451 $start = ord($valid_chars);
2452 $end = ord(substr($valid_chars,-1));
2454 if (function_exists('mt_rand')) // mersenne twister
2455 $length = mt_rand($minlength, $maxlength);
2456 else // the usually bad glibc rand()
2457 $length = rand($minlength, $maxlength);
2458 while ($length > 0) {
2459 if (function_exists('mt_rand'))
2460 $newchar = mt_rand($start, $end);
2462 $newchar = rand($start, $end);
2463 if (! strrpos($valid_chars,$newchar) ) continue; // skip holes
2464 $newpass .= sprintf("%c", $newchar);
2471 function printArray($a) {
2472 echo "<hr />\n<pre>\n";
2474 echo "\n</pre>\n<hr />\n";
2477 // end of class definitions
2478 /////////////////////////////
2479 // begin auto generation code
2481 if (!function_exists('is_a')) {
2482 function is_a($object, $class) {
2483 $class = strtolower($class);
2484 return (get_class($object) == $class) or is_subclass_of($object, $class);
2489 if (!empty($HTTP_POST_VARS['action'])
2490 and $HTTP_POST_VARS['action'] == 'make_config'
2491 and !empty($HTTP_POST_VARS['ADMIN_USER'])
2492 and !empty($HTTP_POST_VARS['ADMIN_PASSWD'])
2496 $timestamp = date ('dS of F, Y H:i:s');
2499 ; This is a local configuration file for PhpWiki.
2500 ; It was automatically generated by the configurator script
2501 ; on the $timestamp.
2506 $posted = $GLOBALS['HTTP_POST_VARS'];
2507 /*if (defined('DEBUG'))
2508 printArray($GLOBALS['HTTP_POST_VARS']);*/
2510 foreach ($properties as $option_name => $a) {
2511 $posted_value = stripslashes($posted[$a->config_item_name]);
2512 $config .= $properties[$option_name]->get_config($posted_value);
2517 if (is_writable($fs_config_file)) {
2518 // We first check if the config-file exists.
2519 if (file_exists($fs_config_file)) {
2520 // We make a backup copy of the file
2521 $new_filename = preg_replace('/\.ini$/', '-' . time() . '.ini', $fs_config_file);
2522 if (@copy($fs_config_file, $new_filename)) {
2523 $fp = @fopen($fs_config_file, 'w');
2526 $fp = @fopen($fs_config_file, 'w');
2534 fputs($fp, $config);
2536 echo "<p>The configuration was written to <code><b>$config_file</b></code>.</p>\n";
2537 if ($new_filename) {
2538 echo "<p>A backup was made to <code><b>$new_filename</b></code>.</p>\n";
2540 ; //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";
2543 echo "<p>The configuration file could <b>not</b> be written.<br />\n",
2544 " You should copy the above configuration to a file, ",
2545 "and manually save it as <code><b>config/config.ini</b></code>.</p>\n";
2548 echo "<hr />\n<p>Here's the configuration file based on your answers:</p>\n";
2549 echo "<form method=\"get\" action=\"", $configurator, "\">\n";
2550 echo "<textarea id='config-output' readonly='readonly' style='width:100%;' rows='30' cols='100'>\n";
2551 echo htmlentities($config);
2552 echo "</textarea></form>\n";
2555 echo "<p>To make any corrections, <a href=\"configurator.php\">edit the settings again</a>.</p>\n";
2557 } else { // first time or create password
2558 $posted = $GLOBALS['HTTP_POST_VARS'];
2559 // No action has been specified - we make a form.
2562 <form action="',$configurator,'" method="post">
2563 <input type="hidden" name="action" value="make_config" />
2564 <table cellpadding="4" cellspacing="0">
2567 while (list($property, $obj) = each($properties)) {
2568 echo $obj->get_instructions($property);
2569 if ($h = $obj->get_html()) {
2570 if (defined('DEBUG') and DEBUG) $h = get_class($obj) . "<br />\n" . $h;
2571 echo "<td>".$h."</td>\n";
2578 <p><input type="submit" id="submit" value="Save ',$config_file,'" /> <input type="reset" value="Clear" /></p>