1 <?php // $Id: configurator.php,v 1.39 2005-09-15 19:37:55 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-dist.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_PASSWD 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.39 2005-09-15 19:37:55 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.
315 ; Here undefined definitions get defined by config-default.ini settings.
318 $properties["Part Zero"] =
319 new part('_part0', $SEPARATOR."\n", "
320 Part Zero: (optional)
321 Latest Development and Tricky Options");
323 if (defined('INCLUDE_PATH'))
324 $include_path = INCLUDE_PATH;
326 if (substr(PHP_OS,0,3) == 'WIN') {
327 $include_path = dirname(__FILE__) . ';' . ini_get('include_path');
328 if (strchr(ini_get('include_path'),'/'))
329 $include_path = strtr($include_path,'\\','/');
331 $include_path = dirname(__FILE__) . ':' . ini_get('include_path');
335 $properties["PHP include_path"] =
336 new _define('INCLUDE_PATH', $include_path);
338 // TODO: convert this a checkbox row as in tests/unit/test.pgp
339 $properties["DEBUG"] =
340 new numeric_define_optional('DEBUG', DEBUG);
342 // TODO: bring the default to the front
343 $properties["ENABLE_USER_NEW"] =
344 new boolean_define_commented_optional
346 array('true' => "Enabled",
347 'false' => "Disabled."));
349 $properties["ENABLE_PAGEPERM"] =
350 new boolean_define_commented_optional
352 array('true' => "Enabled",
353 'false' => "Disabled."));
355 $properties["ENABLE_EDIT_TOOLBAR"] =
356 new boolean_define_commented_optional
357 ('ENABLE_EDIT_TOOLBAR',
358 array('true' => "Enabled",
359 'false' => "Disabled."));
361 $properties["JS_SEARCHREPLACE"] =
362 new boolean_define_commented_optional
364 array('true' => "Enabled",
365 'false' => "Disabled"));
367 $properties["ENABLE_DOUBLECLICKEDIT"] =
368 new boolean_define_commented_optional
369 ('ENABLE_DOUBLECLICKEDIT',
370 array('true' => "Enabled",
371 'false' => "Disabled"));
373 $properties["ENABLE_XHTML_XML"] =
374 new boolean_define_commented_optional
376 array('false' => "Disabled",
377 'true' => "Enabled"));
379 $properties["USECACHE"] =
380 new boolean_define_commented_optional
382 array('true' => "Enabled",
383 'false' => "Disabled"));
385 $properties["ENABLE_SPAMASSASSIN"] =
386 new boolean_define_commented_optional
387 ('ENABLE_SPAMASSASSIN',
388 array('true' => "Enabled",
389 'false' => "Disabled"));
391 $properties["GOOGLE_LINKS_NOFOLLOW"] =
392 new boolean_define_commented_optional
393 ('GOOGLE_LINKS_NOFOLLOW',
394 array('true' => "Enabled",
395 'false' => "Disabled"));
397 $properties["ENABLE_LIVESEARCH"] =
398 new boolean_define_commented_optional
399 ('ENABLE_LIVESEARCH',
400 array('true' => "Enabled",
401 'false' => "Disabled"));
403 $properties["ENABLE_ACDROPDOWN"] =
404 new boolean_define_commented_optional
405 ('ENABLE_ACDROPDOWN',
406 array('true' => "Enabled",
407 'false' => "Disabled"));
409 $properties["ENABLE_DISCUSSION_LINK"] =
410 new boolean_define_commented_optional
411 ('ENABLE_DISCUSSION_LINK',
412 array('true' => "Enabled",
413 'false' => "Disabled"));
415 $properties["ENABLE_CAPTCHA"] =
416 new boolean_define_commented_optional
418 array('true' => "Enabled",
419 'false' => "Disabled"));
421 $properties["USE_SAFE_DBSESSION"] =
422 new boolean_define_commented_optional
423 ('USE_SAFE_DBSESSION',
424 array('false' => "Disabled",
425 'true' => "Enabled"));
427 $properties["Part One"] =
428 new part('_part1', $SEPARATOR."\n", "
429 Part One: Authentication and security settings. See Part Three for more.");
431 $properties["Wiki Name"] =
432 new _define_optional('WIKI_NAME', WIKI_NAME);
434 $properties["Admin Username"] =
435 new _define_notempty('ADMIN_USER', ADMIN_USER, "
436 You must set this! Username and password of the administrator.",
437 "onchange=\"validate_ereg('Sorry, ADMIN_USER cannot be empty.', '^.+$', 'ADMIN_USER', this);\"");
439 $properties["Admin Password"] =
440 new _define_password('ADMIN_PASSWD', ADMIN_PASSWD, "
442 For heaven's sake pick a good password.
444 If your version of PHP supports encrypted passwords, your password will be
445 automatically encrypted within the generated config file.
446 Use the \"Create Random Password\" button to create a good (random) password.
448 ADMIN_PASSWD is ignored on HttpAuth",
449 "onchange=\"validate_ereg('Sorry, ADMIN_PASSWD must be at least 4 chars long.', '^....+$', 'ADMIN_PASSWD', this);\"");
451 $properties["Encrypted Passwords"] =
454 array('true' => "true. use crypt for all passwords",
455 'false' => "false. use plaintest passwords (not recommended)"));
457 $properties["Reverse DNS"] =
458 new boolean_define_optional
459 ('ENABLE_REVERSE_DNS',
460 array('true' => "true. perform additional reverse dns lookups",
461 'false' => "false. just record the address as given by the httpd server"));
463 $properties["ZIPdump Authentication"] =
464 new boolean_define_optional('ZIPDUMP_AUTH',
465 array('false' => "false. Everyone may download zip dumps",
466 'true' => "true. Only admin may download zip dumps"));
468 $properties["Enable RawHtml Plugin"] =
469 new boolean_define_commented_optional
471 array('true' => "Enabled",
472 'false' => "Disabled"));
474 $properties["Allow RawHtml Plugin only on locked pages"] =
475 new boolean_define_commented_optional
476 ('ENABLE_RAW_HTML_LOCKEDONLY',
477 array('true' => "Enabled",
478 'false' => "Disabled"));
480 $properties["Allow RawHtml Plugin if safe HTML code"] =
481 new boolean_define_commented_optional
482 ('ENABLE_RAW_HTML_SAFE',
483 array('true' => "Enabled",
484 'false' => "Disabled"), "
485 If this is set, all unsafe html code is stripped automatically (experimental!)
486 See <a href=\"http://chxo.com/scripts/safe_html-test.php\" target=\"_new\">chxo.com/scripts/safe_html-test.php</a>
489 $properties["Maximum Upload Size"] =
490 new numeric_define_optional('MAX_UPLOAD_SIZE', MAX_UPLOAD_SIZE);
492 $properties["Minor Edit Timeout"] =
493 new numeric_define_optional('MINOR_EDIT_TIMEOUT', MINOR_EDIT_TIMEOUT);
495 $properties["Disabled Actions"] =
496 new array_define('DISABLED_ACTIONS', DISABLED_ACTIONS /*array()*/);
498 $properties["Moderate all Pagechanges"] =
499 new boolean_define_commented_optional
500 ('ENABLE_MODERATEDPAGE_ALL',
501 array('false' => "Disabled",
502 'true' => "Enabled"));
504 $properties["Access Log File"] =
505 new _define_commented_optional('ACCESS_LOG', ACCESS_LOG);
507 $properties["Access Log SQL"] =
508 new _define_selection(
510 array('0' => 'disabled',
512 '2' => 'read + write'));
514 $properties["Compress Output"] =
515 new boolean_define_commented_optional
517 array('' => 'undefined - GZIP compress when appropriate.',
518 'false' => 'Never compress output.',
519 'true' => 'Always try to compress output.'));
521 $properties["HTTP Cache Control"] =
522 new _define_selection_optional
524 array('LOOSE' => 'LOOSE',
525 'STRICT' => 'STRICT',
526 'NO_CACHE' => 'NO_CACHE',
527 'ALLOW_STALE' => 'ALLOW_STALE'),
531 This controls how PhpWiki sets the HTTP cache control
532 headers (Expires: and Cache-Control:)
538 <dd>This is roughly the old (pre 1.3.4) behaviour. PhpWiki will
539 instruct proxies and browsers never to cache PhpWiki output.</dd>
542 <dd>Cached pages will be invalidated whenever the database global
543 timestamp changes. This should behave just like NONE (modulo
544 bugs in PhpWiki and your proxies and browsers), except that
545 things will be slightly more efficient.</dd>
548 <dd>Cached pages will be invalidated whenever they are edited,
549 or, if the pages include plugins, when the plugin output could
550 concievably have changed.
552 <p>Behavior should be much like STRICT, except that sometimes
553 wikilinks will show up as undefined (with the question mark)
554 when in fact they refer to (recently) created pages.
555 (Hitting your browsers reload or perhaps shift-reload button
556 should fix the problem.)</p></dd>
559 <dd>Proxies and browsers will be allowed to used stale pages.
560 (The timeout for stale pages is controlled by CACHE_CONTROL_MAX_AGE.)
562 <p>This setting will result in quirky behavior. When you edit a
563 page your changes may not show up until you shift-reload the
566 <p>This setting is generally not advisable, however it may be useful
567 in certain cases (e.g. if your wiki gets lots of page views,
568 and few edits by knowledgable people who won't freak over the quirks.)</p>
571 The default is currently LOOSE.");
573 $properties["HTTP Cache Control Max Age"] =
574 new numeric_define_optional('CACHE_CONTROL_MAX_AGE', CACHE_CONTROL_MAX_AGE);
576 $properties["Markup Caching"] =
577 new boolean_define_commented_optional
578 ('WIKIDB_NOCACHE_MARKUP',
579 array('false' => 'Enable markup cache',
580 'true' => 'Disable markup cache'));
582 $properties["COOKIE_EXPIRATION_DAYS"] =
583 new numeric_define_optional('COOKIE_EXPIRATION_DAYS', COOKIE_EXPIRATION_DAYS);
585 $properties["COOKIE_DOMAIN"] =
586 new _define_commented_optional('COOKIE_DOMAIN', COOKIE_DOMAIN);
588 $properties["Path for PHP Session Support"] =
589 new _define_optional('SESSION_SAVE_PATH', defined('SESSION_SAVE_PATH') ? SESSION_SAVE_PATH : ini_get('session.save_path'));
591 $properties["Force PHP Database Sessions"] =
592 new boolean_define_commented_optional
594 array('false' => 'Disable database sessions, use files',
595 'true' => 'Enable database sessions'));
597 ///////// database selection
599 $properties["Part Two"] =
600 new part('_part2', $SEPARATOR."\n", "
603 Database Configuration
606 $properties["Database Type"] =
607 new _define_selection("DATABASE_TYPE",
608 array('dba' => "dba",
610 'ADODB' => "SQL ADODB",
611 'PDO' => "PDO (php5 only)",
612 'file' => "flatfile",
613 'cvs' => "CVS File handler")/*, "
614 Select the database backend type:
615 Choose dba (default) to use one of the standard UNIX dba libraries. This is the fastest.
616 Choose ADODB or SQL to use an SQL database with ADODB or PEAR.
617 Choose PDO on php5 to use an SQL database. (experimental, no paging yet)
618 flatfile is simple and slow.
619 CVS is highly experimental and slow.
620 Recommended is dba or SQL: PEAR or ADODB."*/);
622 $properties["SQL DSN Setup"] =
623 new unchangeable_variable('_sqldsnstuff', "", "
624 For SQL based backends, specify the database as a DSN
625 The most general form of a DSN looks like:
627 phptype(dbsyntax)://username:password@protocol+hostspec/database?option=value
629 For a MySQL database, the following should work:
631 mysql://user:password@host/databasename
633 To connect over a unix socket, use something like
635 mysql://user:password@unix(/path/to/socket)/databasename
638 DATABASE_DSN = mysql://guest@:/var/lib/mysql/mysql.sock/phpwiki
639 DATABASE_DSN = mysql://guest@localhost/phpwiki
640 DATABASE_DSN = pgsql://localhost/user_phpwiki
643 // Choose ADODB or SQL to use an SQL database with ADODB or PEAR.
644 // Choose dba to use one of the standard UNIX dbm libraries.
646 $properties["SQL Type"] =
647 new _variable_selection('_dsn_sqltype',
648 array('mysql' => "MySQL",
649 'pgsql' => "PostgreSQL",
650 'mssql' => "Microsoft SQL Server",
651 'oci8' => "Oracle 8",
652 'mysqli' => "mysqli (only ADODB)",
653 'mysqlt' => "mysqlt (only ADODB)",
654 'ODBC' => "ODBC (only ADODB or PDO)",
655 'firebird' => "Firebird (only PDO)",
656 'oracle' => "Oracle (only PDO)",
658 SQL DB types. The DSN hosttype.");
660 $properties["SQL User"] =
661 new _variable('_dsn_sqluser', "wikiuser", "
664 $properties["SQL Password"] =
665 new _variable('_dsn_sqlpass', "", "
668 $properties["SQL Database Host"] =
669 new _variable('_dsn_sqlhostorsock', "localhost", "
670 SQL Database Hostname:
672 To connect over a local named socket, use something like
674 unix(/var/lib/mysql/mysql.sock)
677 mysql on Windows via named pipes might need 127.0.0.1");
679 $properties["SQL Database Name"] =
680 new _variable('_dsn_sqldbname', "phpwiki", "
681 SQL Database Name:");
683 $dsn_sqltype = $properties["SQL Type"]->value();
684 $dsn_sqluser = $properties["SQL User"]->value();
685 $dsn_sqlpass = $properties["SQL Password"]->value();
686 $dsn_sqlhostorsock = $properties["SQL Database Host"]->value();
687 $dsn_sqldbname = $properties["SQL Database Name"]->value();
688 $dsn_sqlstring = $dsn_sqltype."://{$dsn_sqluser}:{$dsn_sqlpass}@{$dsn_sqlhostorsock}/{$dsn_sqldbname}";
690 $properties["SQL dsn"] =
691 new unchangeable_define("DATABASE_DSN",
692 "DATABASE_DSN = \"$dsn_sqlstring\"", "
693 Calculated from the settings above:");
695 $properties["Filename / Table name Prefix"] =
696 new _define_commented("DATABASE_PREFIX", DATABASE_PREFIX, "
697 Used by all DB types:
699 Prefix for filenames or table names, e.g. \"phpwiki_\"
701 Currently <b>you MUST EDIT THE SQL file too!</b> (in the schemas/
702 directory because we aren't doing on the fly sql generation
703 during the installation.");
705 $properties["DATABASE_PERSISTENT"] =
706 new boolean_define_commented_optional
707 ('DATABASE_PERSISTENT',
708 array('false' => "Disabled",
709 'true' => "Enabled"));
711 $properties["DB Session table"] =
712 new _define_optional("DATABASE_SESSION_TABLE", DATABASE_SESSION_TABLE, "
713 Tablename to store session information. Only supported by SQL backends.
715 A word of warning - any prefix defined above will be prepended to whatever is given here.
719 $temp = !empty($_ENV['TEMP']) ? $_ENV['TEMP'] : "/tmp";
720 $properties["dba directory"] =
721 new _define("DATABASE_DIRECTORY", $temp);
723 // TODO: list the available methods
724 $properties["dba handler"] =
725 new _define_selection('DATABASE_DBA_HANDLER',
726 array('gdbm' => "gdbm - GNU database manager (not recommended anymore)",
727 'dbm' => "DBM - Redhat default. On sf.net there's dbm and not gdbm anymore",
728 'db2' => "DB2 - BerkeleyDB (Sleepycat) DB2",
729 'db3' => "DB3 - BerkeleyDB (Sleepycat) DB3. Default on Windows but not on every Linux",
730 'db4' => "DB4 - BerkeleyDB (Sleepycat) DB4."), "
731 Use 'gdbm', 'dbm', 'db2', 'db3' or 'db4' depending on your DBA handler methods supported: <br > "
732 . (function_exists("dba_handlers") ? join(", ",dba_handlers()) : "")
733 . "\n\nBetter not use other hacks such as inifile, flatfile or cdb");
735 $properties["dba timeout"] =
736 new numeric_define("DATABASE_TIMEOUT", DATABASE_TIMEOUT, "
737 Recommended values are 10-20 seconds. The more load the server has, the higher the timeout.");
739 $properties["DBADMIN_USER"] =
740 new _define_commented_optional('DBADMIN_USER', DBADMIN_USER. "
741 If action=upgrade detects mysql problems, but has no ALTER permissions,
742 give here a database username which has the necessary ALTER or CREATE permissions.
743 Of course you can fix your database manually. See lib/upgrade.php for known issues.");
745 $properties["DBADMIN_PASSWD"] =
746 new _define_password_commented_optional('DBADMIN_PASSWD', DBADMIN_PASSWD);
750 $properties["Page Revisions"] =
751 new unchangeable_variable('_parttworevisions', "", "
753 Section 2a: Archive Cleanup
754 The next section controls how many old revisions of each page are kept in the database.
756 There are two basic classes of revisions: major and minor. Which
757 class a revision belongs in is determined by whether the author
758 checked the \"this is a minor revision\" checkbox when they saved the
761 There is, additionally, a third class of revisions: author
762 revisions. The most recent non-mergable revision from each distinct
763 author is and author revision.
765 The expiry parameters for each of those three classes of revisions
766 can be adjusted seperately. For each class there are five
767 parameters (usually, only two or three of the five are actually
768 set) which control how long those revisions are kept in the
771 <dt>max_keep:</dt> <dd>If set, this specifies an absolute maximum for the
772 number of archived revisions of that class. This is
773 meant to be used as a safety cap when a non-zero
774 min_age is specified. It should be set relatively high,
775 and it's purpose is to prevent malicious or accidental
776 database overflow due to someone causing an
777 unreasonable number of edits in a short period of time.</dd>
779 <dt>min_age:</dt> <dd>Revisions younger than this (based upon the supplanted
780 date) will be kept unless max_keep is exceeded. The age
781 should be specified in days. It should be a
782 non-negative, real number,</dd>
784 <dt>min_keep:</dt> <dd>At least this many revisions will be kept.</dd>
786 <dt>keep:</dt> <dd>No more than this many revisions will be kept.</dd>
788 <dt>max_age:</dt> <dd>No revision older than this age will be kept.</dd>
790 Supplanted date: Revisions are timestamped at the instant that they
791 cease being the current revision. Revision age is computed using
792 this timestamp, not the edit time of the page.
794 Merging: When a minor revision is deleted, if the preceding
795 revision is by the same author, the minor revision is merged with
796 the preceding revision before it is deleted. Essentially: this
797 replaces the content (and supplanted timestamp) of the previous
798 revision with the content after the merged minor edit, the rest of
799 the page metadata for the preceding version (summary, mtime, ...)
803 // For now the expiration parameters are statically inserted as
804 // an unchangeable property. You'll have to edit the resulting
805 // config file if you really want to change these from the default.
807 $properties["Major Edits: keep minimum days"] =
808 new numeric_define("MAJOR_MIN_KEEP", MAJOR_MIN_KEEP, "
809 Default: Keep for unlimited time.
810 Set to 0 to enable archive cleanup");
811 $properties["Minor Edits: keep minumum days"] =
812 new numeric_define("MINOR_MIN_KEEP", MINOR_MIN_KEEP, "
813 Default: Keep for unlimited time.
814 Set to 0 to enable archive cleanup");
816 $properties["Major Edits: how many"] =
817 new numeric_define("MAJOR_KEEP", MAJOR_KEEP, "
818 Keep up to 8 major edits");
819 $properties["Major Edits: how many days"] =
820 new numeric_define("MAJOR_MAX_AGE", MAJOR_MAX_AGE, "
821 keep them no longer than a month");
823 $properties["Minor Edits: how many"] =
824 new numeric_define("MINOR_KEEP", MINOR_KEEP, "
825 Keep up to 4 minor edits");
826 $properties["Minor Edits: how many days"] =
827 new numeric_define("MINOR_MAX_AGE", "7", "
828 keep them no longer than a week");
830 $properties["per Author: how many"] =
831 new numeric_define("AUTHOR_KEEP", "8", "
832 Keep the latest contributions of the last 8 authors,");
833 $properties["per Author: how many days"] =
834 new numeric_define("AUTHOR_MAX_AGE", "365", "
836 $properties["per Author: keep minumum days"] =
837 new numeric_define("AUTHOR_MIN_AGE", "7", "
838 Additionally, (in the case of a particularly active page) try to
839 keep the latest contributions of all authors in the last week (even if there are more than eight of them,)");
840 $properties["per Author: max revisions"] =
841 new numeric_define("AUTHOR_MAX_KEEP", "20", "
842 but in no case keep more than twenty unique author revisions.");
844 /////////////////////////////////////////////////////////////////////
846 $properties["Part Three"] =
847 new part('_part3', $SEPARATOR."\n", "
849 Part Three: (optional)
850 Basic User Authentication Setup
853 $properties["Publicly viewable"] =
854 new boolean_define_optional('ALLOW_ANON_USER',
855 array('true' => "true. Permit anonymous view. (Default)",
856 'false' => "false. Force login even on view (strictly private)"), "
857 If ALLOW_ANON_USER is false, you have to login before viewing any page or doing any other action on a page.");
859 $properties["Allow anonymous edit"] =
860 new boolean_define_optional('ALLOW_ANON_EDIT',
861 array('true' => "true. Permit anonymous users to edit. (Default)",
862 'false' => "false. Force login on edit (moderately locked)"), "
863 If ALLOW_ANON_EDIT is false, you have to login before editing or changing any page. See below.");
865 $properties["Allow Bogo Login"] =
866 new boolean_define_optional('ALLOW_BOGO_LOGIN',
867 array('true' => "true. Users may Sign In with any WikiWord, without password. (Default)",
868 'false' => "false. Require stricter authentication."), "
869 If ALLOW_BOGO_LOGIN is false, you may not login with any wikiword username and empty password.
870 If true, users are allowed to create themselves with any WikiWord username. See below.");
872 $properties["Allow User Passwords"] =
873 new boolean_define_optional('ALLOW_USER_PASSWORDS',
874 array('true' => "True user authentication with password checking. (Default)",
875 'false' => "false. Ignore authentication settings below."), "
876 If ALLOW_USER_PASSWORDS is true, the authentication settings below define where and how to
877 check against given username/passwords. For completely security disable BOGO_LOGIN and ANON_EDIT above.");
879 $properties["Allow User Passwords"] =
880 new array_define('USER_AUTH_ORDER', array("PersonalPage", "Db"), "
881 Many different methods can be used to check user's passwords.
882 Try any of these in the given order:
885 <dd>WikiWord username, with no *actual* password checking,
886 although the user will still have to enter one.</dd>
887 <dt>PersonalPage</dt>
888 <dd>Store passwords in the users homepage metadata (simple)</dd>
890 <dd>Use DBAUTH_AUTH_* (see below) with PearDB or ADODB only.</dd>
892 <dd>Authenticate against LDAP_AUTH_HOST with LDAP_BASE_DN.</dd>
894 <dd>Authenticate against IMAP_AUTH_HOST (email account)</dd>
896 <dd>Authenticate against POP3_AUTH_HOST (email account)</dd>
898 <dd>Get username and level from a PHP session variable. (e.g. for gforge)</dd>
900 <dd>Store username:crypted-passwords in .htaccess like files.
901 Use Apache's htpasswd to manage this file.</dd>
903 <dd>Use the protection by the webserver (.htaccess/.htpasswd) (experimental)
904 Enforcing HTTP Auth not yet. Note that the ADMIN_USER should exist also.
905 Using HttpAuth disables all other methods and no userauth sessions are used.</dd>
908 Several of these methods can be used together, in the manner specified by
909 USER_AUTH_POLICY, below. To specify multiple authentication methods,
910 separate the name of each one with colons.
912 USER_AUTH_ORDER = 'PersonalPage : Db'
913 USER_AUTH_ORDER = 'BogoLogin : PersonalPage'
916 $properties["PASSWORD_LENGTH_MINIMUM"] =
917 new numeric_define("PASSWORD_LENGTH_MINIMUM", "6", "
918 For 'security' purposes, you can specify that a password be at least a
919 certain number of characters long. This applies even to the BogoLogin method.
920 Default: 0 (to allow immediate passwordless BogoLogin)");
922 $properties["USER_AUTH_POLICY"] =
923 new _define_selection('USER_AUTH_POLICY',
924 array('first-only' => "first-only - use only the first method in USER_AUTH_ORDER",
925 'old' => "old - ignore USER_AUTH_ORDER (legacy)",
926 'strict' => "strict - check all methods for userid + password (recommended)",
927 'stacked' => "stacked - check all methods for userid, and if found for password"), "
928 The following policies are available for user authentication:
931 <dd>use only the first method in USER_AUTH_ORDER</dd>
933 <dd>ignore USER_AUTH_ORDER and try to use all available
934 methods as in the previous PhpWiki releases (slow)</dd>
936 <dd>check if the user exists for all methods:
937 on the first existing user, try the password.
938 dont try the other methods on failure then</dd>
940 <dd>check the given user - password combination for all
941 methods and return true on the first success.</dd></dl>");
945 $properties["Part Three A"] =
946 new part('_part3a', $SEPARATOR."\n", "
948 Part Three A: (optional)
951 $properties["Group membership"] =
952 new _define_selection("GROUP_METHOD",
953 array('WIKIPAGE' => "WIKIPAGE - List at \"CategoryGroup\". (Slowest, but easiest to maintain)",
954 '"NONE"' => "NONE - Disable group membership (Fastest)",
955 'DB' => "DB - SQL Database, Optionally external. See USERS/GROUPS queries",
956 'FILE' => "Flatfile. See AUTH_GROUP_FILE below.",
957 'LDAP' => "LDAP - See \"LDAP authentication options\" above. (Experimental)"), "
958 Group membership. PhpWiki supports defining permissions for a group as
959 well as for individual users. This defines how group membership information
960 is obtained. Supported values are:
963 <dd>Disable group membership (Fastest). Note the required quoting.</dd>
965 <dd>Define groups as list at \"CategoryGroup\". (Slowest, but easiest to maintain)</dd>
967 <dd>Stored in an SQL database. Optionally external. See USERS/GROUPS queries</dd>
969 <dd>Flatfile. See AUTH_GROUP_FILE below.</dd>
971 <dd>LDAP groups. See \"LDAP authentication options\" above and
972 lib/WikiGroup.php. (experimental)</dd></dl>");
974 $properties["CATEGORY_GROUP_PAGE"] =
975 new _define_optional('CATEGORY_GROUP_PAGE', _("CategoryGroup"), "
976 If GROUP_METHOD = WIKIPAGE:
978 Page where all groups are listed.");
980 $properties["AUTH_GROUP_FILE"] =
981 new _define_optional('AUTH_GROUP_FILE', _("/etc/groups"), "
982 For GROUP_METHOD = FILE, the file given below is referenced to obtain
983 group membership information. It should be in the same format as the
984 standard unix /etc/groups(5) file.");
986 $properties["Part Three B"] =
987 new part('_part3b', $SEPARATOR."\n", "
989 Part Three B: (optional)
990 External database authentication and authorization.
992 If USER_AUTH_ORDER includes Db, or GROUP_METHOD = DB, the options listed
993 below define the SQL queries used to obtain the information out of the
994 database, and (optionally) store the information back to the DB.");
996 $properties["DBAUTH_AUTH_DSN"] =
997 new _define_optional('DBAUTH_AUTH_DSN', $dsn_sqlstring, "
998 A database DSN to connect to. Defaults to the DSN specified for the Wiki as a whole.");
1000 $properties["User Exists Query"] =
1001 new _define('DBAUTH_AUTH_USER_EXISTS', "SELECT userid FROM user WHERE userid='\$userid'", "
1002 USER/PASSWORD queries:
1004 For USER_AUTH_POLICY=strict and the Db method is required");
1006 $properties["Check Query"] =
1007 new _define_optional('DBAUTH_AUTH_CHECK', "SELECT IF(passwd='\$password',1,0) AS ok FROM user WHERE userid='\$userid'", "
1009 Check to see if the supplied username/password pair is OK
1011 Plaintext passwords: (DBAUTH_AUTH_CRYPT_METHOD = plain)<br>
1012 ; DBAUTH_AUTH_CHECK = \"SELECT IF(passwd='\$password',1,0) AS ok FROM user WHERE userid='\$userid'\"
1014 database-hashed passwords (more secure):<br>
1015 ; DBAUTH_AUTH_CHECK = \"SELECT IF(passwd=PASSWORD('\$password'),1,0) AS ok FROM user WHERE userid='\$userid'\"");
1017 $properties["Crypt Method"] =
1018 new _define_selection_optional
1019 ('DBAUTH_AUTH_CRYPT_METHOD',
1020 array('plain' => 'plain',
1021 'crypt' => 'crypt'), "
1022 If you want to use Unix crypt()ed passwords, you can use DBAUTH_AUTH_CHECK
1023 to get the password out of the database with a simple SELECT query, and
1024 specify DBAUTH_AUTH_USER_EXISTS and DBAUTH_AUTH_CRYPT_METHOD:
1026 ; DBAUTH_AUTH_CHECK = \"SELECT passwd FROM user where userid='\$userid'\" <br>
1027 ; DBAUTH_AUTH_CRYPT_METHOD = crypt");
1029 $properties["Update the user's authentication credential"] =
1030 new _define('DBAUTH_AUTH_UPDATE', "UPDATE user SET passwd='\$password' WHERE userid='\$userid'", "
1031 If this is not defined but DBAUTH_AUTH_CHECK is, then the user will be unable to update their
1034 Plaintext passwords:<br>
1035 DBAUTH_AUTH_UPDATE = \"UPDATE user SET passwd='\$password' WHERE userid='\$userid'\"<br>
1036 Database-hashed passwords:<br>
1037 DBAUTH_AUTH_UPDATE = \"UPDATE user SET passwd=PASSWORD('\$password') WHERE userid='\$userid'\"");
1039 $properties["Allow the user to create their own account"] =
1040 new _define_optional('DBAUTH_AUTH_CREATE', "INSERT INTO user SET passwd=PASSWORD('\$password'),userid='\$userid'", "
1041 If this is empty, Db users cannot subscribe by their own.");
1043 $properties["USER/PREFERENCE queries"] =
1044 new _define_optional('DBAUTH_PREF_SELECT', "SELECT prefs FROM user WHERE userid='\$userid'", "
1045 If you choose to store your preferences in an external database, enable
1046 the following queries. Note that if you choose to store user preferences
1047 in the 'user' table, only registered users get their prefs from the database,
1048 self-created users do not. Better to use the special 'pref' table.
1050 The prefs field stores the serialized form of the user's preferences array,
1051 to ease the complication of storage.
1053 DBAUTH_PREF_SELECT = \"SELECT prefs FROM user WHERE userid='\$userid'\"
1054 DBAUTH_PREF_SELECT = \"SELECT prefs FROM pref WHERE userid='\$userid'\"
1057 $properties["Update the user's preferences"] =
1058 new _define_optional('DBAUTH_PREF_UPDATE', "UPDATE user SET prefs='\$pref_blob' WHERE userid='\$userid'", "
1059 Note that REPLACE works only with mysql and destroy all other columns!
1061 Mysql: DBAUTH_PREF_UPDATE = \"REPLACE INTO pref SET prefs='\$pref_blob',userid='\$userid'\"");
1063 $properties["USERS/GROUPS queries"] =
1064 new _define_optional('DBAUTH_IS_MEMBER', "SELECT user FROM user WHERE user='\$userid' AND group='\$groupname'", "
1065 You can define 1:n or n:m user<=>group relations, as you wish.
1067 Sample configurations:
1069 only one group per user (1:n):<br>
1070 DBAUTH_IS_MEMBER = \"SELECT user FROM user WHERE user='\$userid' AND group='\$groupname'\"<br>
1071 DBAUTH_GROUP_MEMBERS = \"SELECT user FROM user WHERE group='\$groupname'\"<br>
1072 DBAUTH_USER_GROUPS = \"SELECT group FROM user WHERE user='\$userid'\"<br>
1073 multiple groups per user (n:m):<br>
1074 DBAUTH_IS_MEMBER = \"SELECT userid FROM member WHERE userid='\$userid' AND groupname='\$groupname'\"<br>
1075 DBAUTH_GROUP_MEMBERS = \"SELECT DISTINCT userid FROM member WHERE groupname='\$groupname'\"<br>
1076 DBAUTH_USER_GROUPS = \"SELECT groupname FROM member WHERE userid='\$userid'\"<br>");
1077 $properties["DBAUTH_GROUP_MEMBERS"] =
1078 new _define_optional('DBAUTH_GROUP_MEMBERS', "SELECT user FROM user WHERE group='\$groupname'", "");
1079 $properties["DBAUTH_USER_GROUPS"] =
1080 new _define_optional('DBAUTH_USER_GROUPS', "SELECT group FROM user WHERE user='\$userid'", "");
1082 if (function_exists('ldap_connect')) {
1084 $properties["LDAP AUTH Host"] =
1085 new _define_optional('LDAP_AUTH_HOST', "ldap://localhost:389", "
1086 If USER_AUTH_ORDER contains Ldap:
1088 The LDAP server to connect to. Can either be a hostname, or a complete
1089 URL to the server (useful if you want to use ldaps or specify a different
1092 $properties["LDAP BASE DN"] =
1093 new _define_optional('LDAP_BASE_DN', "ou=mycompany.com,o=My Company", "
1094 The organizational or domain BASE DN: e.g. \"dc=mydomain,dc=com\".
1096 Note: ou=Users and ou=Groups are used for GroupLdap Membership
1097 Better use LDAP_OU_USERS and LDAP_OU_GROUP with GROUP_METHOD=LDAP.");
1099 $properties["LDAP SET OPTION"] =
1100 new _define_optional('LDAP_SET_OPTION', "LDAP_OPT_PROTOCOL_VERSION=3:LDAP_OPT_REFERRALS=0", "
1101 Some LDAP servers need some more options, such as the Windows Active
1102 Directory Server. Specify the options (as allowed by the PHP LDAP module)
1103 and their values as NAME=value pairs separated by colons.");
1105 $properties["LDAP AUTH USER"] =
1106 new _define_optional('LDAP_AUTH_USER', "CN=ldapuser,ou=Users,o=Development,dc=mycompany.com", "
1107 DN to initially bind to the LDAP server as. This is needed if the server doesn't
1108 allow anonymous queries. (Windows Active Directory Server)");
1110 $properties["LDAP AUTH PASSWORD"] =
1111 new _define_optional('LDAP_AUTH_PASSWORD', "secret", "
1112 Password to use to initially bind to the LDAP server, as the DN
1113 specified in the LDAP_AUTH_USER option (above).");
1115 $properties["LDAP SEARCH FIELD"] =
1116 new _define_optional('LDAP_SEARCH_FIELD', "uid", "
1117 If you want to match usernames against an attribute other than uid,
1118 specify it here. Default: uid
1120 e.g.: LDAP_SEARCH_FIELD = sAMAccountName");
1122 $properties["LDAP OU USERS"] =
1123 new _define_optional('LDAP_OU_USERS', "ou=Users", "
1124 If you have an organizational unit for all users, define it here.
1125 This narrows the search, and is needed for LDAP group membership (if GROUP_METHOD=LDAP)
1126 Default: ou=Users");
1128 $properties["LDAP OU GROUP"] =
1129 new _define_optional('LDAP_OU_GROUP', "ou=Groups", "
1130 If you have an organizational unit for all groups, define it here.
1131 This narrows the search, and is needed for LDAP group membership (if GROUP_METHOD=LDAP)
1132 The entries in this ou must have a gidNumber and cn attribute.
1133 Default: ou=Groups");
1135 } else { // function_exists('ldap_connect')
1137 $properties["LDAP Authentication"] =
1138 new unchangeable_define('LDAP Authentication', "
1139 ; If USER_AUTH_ORDER contains Ldap:
1141 ; The LDAP server to connect to. Can either be a hostname, or a complete
1142 ; URL to the server (useful if you want to use ldaps or specify a different
1144 ;LDAP_AUTH_HOST = \"ldap://localhost:389\"
1146 ; The organizational or domain BASE DN: e.g. \"dc=mydomain,dc=com\".
1148 ; Note: ou=Users and ou=Groups are used for GroupLdap Membership
1149 ; Better use LDAP_OU_USERS and LDAP_OU_GROUP with GROUP_METHOD=LDAP.
1150 ;LDAP_BASE_DN = \"ou=Users,o=Development,dc=mycompany.com\"
1152 ; Some LDAP servers need some more options, such as the Windows Active
1153 ; Directory Server. Specify the options (as allowed by the PHP LDAP module)
1154 ; and their values as NAME=value pairs separated by colons.
1155 ; LDAP_SET_OPTION = \"LDAP_OPT_PROTOCOL_VERSION=3:LDAP_OPT_REFERRALS=0\"
1157 ; DN to initially bind to the LDAP server as. This is needed if the server doesn't
1158 ; allow anonymous queries. (Windows Active Directory Server)
1159 ; LDAP_AUTH_USER = \"CN=ldapuser,ou=Users,o=Development,dc=mycompany.com\"
1161 ; Password to use to initially bind to the LDAP server, as the DN
1162 ; specified in the LDAP_AUTH_USER option (above).
1163 ; LDAP_AUTH_PASSWORD = secret
1165 ; If you want to match usernames against an attribute other than uid,
1166 ; specify it here. Default: uid
1167 ; LDAP_SEARCH_FIELD = sAMAccountName
1169 ; If you have an organizational unit for all users, define it here.
1170 ; This narrows the search, and is needed for LDAP group membership (if GROUP_METHOD=LDAP)
1172 ; LDAP_OU_USERS = ou=Users
1174 ; If you have an organizational unit for all groups, define it here.
1175 ; This narrows the search, and is needed for LDAP group membership (if GROUP_METHOD=LDAP)
1176 ; The entries in this ou must have a gidNumber and cn attribute.
1177 ; Default: ou=Groups
1178 ; LDAP_OU_GROUP = ou=Groups", "
1179 ; Ignored. No LDAP support in this php. configure --with-ldap");
1182 if (function_exists('imap_open')) {
1184 $properties["IMAP Auth Host"] =
1185 new _define_optional('IMAP_AUTH_HOST', 'localhost:143/imap/notls', "
1186 If USER_AUTH_ORDER contains IMAP:
1188 The IMAP server to check usernames from. Defaults to localhost.
1190 Some IMAP_AUTH_HOST samples:
1191 localhost, localhost:143/imap/notls,
1192 localhost:993/imap/ssl/novalidate-cert (SuSE refuses non-SSL conections)");
1194 } else { // function_exists('imap_open')
1196 $properties["IMAP Authentication"] =
1197 new unchangeable_define('IMAP_AUTH_HOST',"
1198 ; If USER_AUTH_ORDER contains IMAP:
1199 ; The IMAP server to check usernames from. Defaults to localhost.
1201 ; Some IMAP_AUTH_HOST samples:
1202 ; localhost, localhost:143/imap/notls,
1203 ; localhost:993/imap/ssl/novalidate-cert (SuSE refuses non-SSL conections)
1204 ;IMAP_AUTH_HOST = localhost:143/imap/notls", "
1205 Ignored. No IMAP support in this php. configure --with-imap");
1209 $properties["POP3 Authentication"] =
1210 new _define_optional('POP3_AUTH_HOST', 'localhost:110', "
1211 If USER_AUTH_ORDER contains POP3:
1213 The POP3 mail server to check usernames and passwords against.");
1214 $properties["File Authentication"] =
1215 new _define_optional('AUTH_USER_FILE', '/etc/shadow', "
1216 If USER_AUTH_ORDER contains File:
1218 File to read for authentication information.
1219 Popular choices are /etc/shadow and /etc/httpd/.htpasswd");
1221 $properties["File Storable?"] =
1222 new boolean_define_commented_optional
1223 ('AUTH_USER_FILE_STORABLE',
1224 array('false' => "Disabled",
1225 'true' => "Enabled"), "
1226 Defines whether the user is able to change their own password via PhpWiki.
1227 Note that this means that the webserver user must be able to write to the
1228 file specified in AUTH_USER_FILE.");
1230 $properties["Session Auth USER"] =
1231 new _define_optional('AUTH_SESS_USER', 'userid', "
1232 If USER_AUTH_ORDER contains Session:
1234 Name of the session variable which holds the already authenticated username.
1235 Sample: 'userid', 'user[username]', 'user->username'");
1237 $properties["Session Auth LEVEL"] =
1238 new numeric_define('AUTH_SESS_LEVEL', '2', "
1239 Which level will the user be? 1 = Bogo or 2 = Pass");
1241 /////////////////////////////////////////////////////////////////////
1243 $properties["Part Four"] =
1244 new part('_part4', $SEPARATOR."\n", "
1247 Page appearance and layout");
1249 $properties["Theme"] =
1250 new _define_selection_optional('THEME',
1251 array('default' => "default",
1252 'MacOSX' => "MacOSX",
1253 'smaller' => 'smaller',
1254 'Wordpress'=> 'Wordpress',
1255 'Portland' => "Portland",
1256 'Sidebar' => "Sidebar",
1258 'wikilens' => 'wikilens (Ratings)',
1259 'shamino_com' => 'shamino_com',
1260 'SpaceWiki' => "SpaceWiki",
1261 'Hawaiian' => "Hawaiian",
1262 'MonoBook' => 'MonoBook [experimental]',
1263 'blog' => 'blog [experimental]',
1267 Most of the page appearance is controlled by files in the theme
1270 There are a number of pre-defined themes shipped with PhpWiki.
1271 Or you may create your own (e.g. by copying and then modifying one of
1281 THEME = wikilens (Ratings)
1289 THEME = MonoBook (WikiPedia) [experimental. MSIE problems]
1290 THEME = blog (Kubrick) [experimental. Several links missing]
1293 $properties["Character Set"] =
1294 new _define_optional('CHARSET', 'iso-8859-1', "
1295 Select a valid charset name to be inserted into the xml/html pages,
1296 and to reference links to the stylesheets (css). For more info see:
1297 http://www.iana.org/assignments/character-sets. Note that PhpWiki
1298 has been extensively tested only with the latin1 (iso-8859-1)
1301 If you change the default from iso-8859-1 PhpWiki may not work
1302 properly and it will require code modifications. However, character
1303 sets similar to iso-8859-1 may work with little or no modification
1304 depending on your setup. The database must also support the same
1305 charset, and of course the same is true for the web browser. (Some
1306 work is in progress hopefully to allow more flexibility in this
1307 area in the future).");
1309 $properties["Language"] =
1310 new _define_selection_optional('DEFAULT_LANGUAGE',
1311 array('en' => "English",
1312 '' => "<empty> (user-specific)",
1315 'nl' => "Nederlands",
1320 'zh' => "Chinese"), "
1321 Select your language/locale - default language is \"en\" for English.
1322 Other languages available:<pre>
1323 English \"en\" (English - HomePage)
1324 German \"de\" (Deutsch - StartSeite)
1325 French \"fr\" (Fran~is - Accueil)
1326 Dutch \"nl\" (Nederlands - ThuisPagina)
1327 Spanish \"es\" (Espa~l - P~inaPrincipal)
1328 Swedish \"sv\" (Svenska - Framsida)
1329 Italian \"it\" (Italiano - PaginaPrincipale)
1330 Japanese \"ja\" (Japanese - ~~~~~~)
1331 Chinese \"zh\" (Chinese)
1333 If you set DEFAULT_LANGUAGE to the empty string, your systems default language
1334 (as determined by the applicable environment variables) will be
1337 $properties["Wiki Page Source"] =
1338 new _define_optional('WIKI_PGSRC', 'pgsrc', "
1339 WIKI_PGSRC -- specifies the source for the initial page contents of
1340 the Wiki. The setting of WIKI_PGSRC only has effect when the wiki is
1341 accessed for the first time (or after clearing the database.)
1342 WIKI_PGSRC can either name a directory or a zip file. In either case
1343 WIKI_PGSRC is scanned for files -- one file per page.
1345 // Default (old) behavior:
1346 define('WIKI_PGSRC', 'pgsrc');
1348 define('WIKI_PGSRC', 'wiki.zip');
1349 define('WIKI_PGSRC',
1350 '../Logs/Hamwiki/hamwiki-20010830.zip');
1354 $properties["Default Wiki Page Source"] =
1355 new _define('DEFAULT_WIKI_PGSRC', 'pgsrc', "
1356 DEFAULT_WIKI_PGSRC is only used when the language is *not* the
1357 default (English) and when reading from a directory: in that case
1358 some English pages are inserted into the wiki as well.
1359 DEFAULT_WIKI_PGSRC defines where the English pages reside.
1361 FIXME: is this really needed?
1364 $properties["Generic Pages"] =
1365 new array_variable('GenericPages', array('ReleaseNotes', 'SteveWainstead', 'TestPage'), "
1366 These are the pages which will get loaded from DEFAULT_WIKI_PGSRC.
1368 FIXME: is this really needed? Cannot we just copy these pages into
1369 the localized pgsrc?
1375 $properties["Part Five"] =
1376 new part('_part5', $SEPARATOR."\n", "
1381 $properties["Allowed Protocols"] =
1382 new list_define('ALLOWED_PROTOCOLS', 'http|https|mailto|ftp|news|nntp|ssh|gopher', "
1383 Allowed protocols for links - be careful not to allow \"javascript:\"
1384 URL of these types will be automatically linked.
1385 within a named link [name|uri] one more protocol is defined: phpwiki");
1387 $properties["Inline Images"] =
1388 new list_define('INLINE_IMAGES', 'png|jpg|gif', "
1389 URLs ending with the following extension should be inlined as images.
1390 Scripts shoud not be allowed!");
1392 $properties["WikiName Regexp"] =
1393 new _define('WIKI_NAME_REGEXP', "(?<![[:alnum:]])(?:[[:upper:]][[:lower:]]+){2,}(?![[:alnum:]])", "
1394 Perl regexp for WikiNames (\"bumpy words\")
1395 (?<!..) & (?!...) used instead of '\b' because \b matches '_' as well");
1397 $properties["Subpage Separator"] =
1398 new _define_optional('SUBPAGE_SEPARATOR', '"/"', "
1399 One character which seperates pages from subpages. Defaults to '/', but '.' or ':' were also used.",
1400 "onchange=\"validate_ereg('Sorry, \'%s\' must be a single character. Currently only :, / or .', '^[/:.]$', 'SUBPAGE_SEPARATOR', this);\""
1403 $properties["InterWiki Map File"] =
1404 new _define('INTERWIKI_MAP_FILE', 'lib/interwiki.map', "
1405 InterWiki linking -- wiki-style links to other wikis on the web
1407 The map will be taken from a page name InterWikiMap.
1408 If that page is not found (or is not locked), or map
1409 data can not be found in it, then the file specified
1410 by INTERWIKI_MAP_FILE (if any) will be used.");
1412 $properties["WARN_NONPUBLIC_INTERWIKIMAP"] =
1413 new boolean_define('WARN_NONPUBLIC_INTERWIKIMAP',
1414 array('true' => "true",
1415 'false' => "false"), "
1416 Display a warning if the internal lib/interwiki.map is used, and
1417 not the public InterWikiMap page. This map is not readable from outside.");
1420 $properties["Keyword Link Regexp"] =
1421 new _define_optional('KEYWORDS', '\"Category* OR Topic*\"', "
1422 Search term used for automatic page classification by keyword extraction.
1424 Any links on a page to pages whose names match this search
1425 will be used keywords in the keywords html meta tag. This is an aid to
1426 classification by search engines. The value of the match is
1427 used as the keyword.
1429 The default behavior is to match Category* or Topic* links.");
1431 $properties["Author and Copyright Site Navigation Links"] =
1432 new _define_commented_optional('COPYRIGHTPAGE_TITLE', "GNU General Public License", "
1434 These will be inserted as <link rel> tags in the html header of
1435 every page, for search engines and for browsers like Mozilla which
1436 take advantage of link rel site navigation.
1438 If you have your own copyright and contact information pages change
1439 these as appropriate.");
1441 $properties["COPYRIGHTPAGE URL"] =
1442 new _define_commented_optional('COPYRIGHTPAGE_URL', "http://www.gnu.org/copyleft/gpl.html#SEC1", "
1444 Other useful alternatives to consider:
1446 COPYRIGHTPAGE_TITLE = \"GNU Free Documentation License\"
1447 COPYRIGHTPAGE_URL = \"http://www.gnu.org/copyleft/fdl.html\"
1448 COPYRIGHTPAGE_TITLE = \"Creative Commons License 2.0\"
1449 COPYRIGHTPAGE_URL = \"http://creativecommons.org/licenses/by/2.0/\"</pre>
1450 See http://creativecommons.org/learn/licenses/ for variations");
1452 $properties["AUTHORPAGE_TITLE"] =
1453 new _define_commented_optional('AUTHORPAGE_TITLE', "The PhpWiki Programming Team", "
1454 Default Author Names");
1455 $properties["AUTHORPAGE_URL"] =
1456 new _define_commented_optional('AUTHORPAGE_URL', "http://phpwiki.org/ThePhpWikiProgrammingTeam", "
1457 Default Author URL");
1459 $properties["TOC_FULL_SYNTAX"] =
1460 new boolean_define_optional
1462 array('true' => "Enabled",
1463 'false' => "Disabled"), "
1464 Allow full markup in headers to be parsed by the CreateToc plugin.
1466 If false you may not use WikiWords or [] links or any other markup in
1467 headers in pages with the CreateToc plugin. But if false the parsing is
1468 faster and more stable.");
1470 $properties["ENABLE_MARKUP_COLOR"] =
1471 new boolean_define_optional
1472 ('ENABLE_MARKUP_COLOR',
1473 array('true' => "Enabled",
1474 'false' => "Disabled"), "
1475 If disabled the %color=... %% syntax will be disabled. Since 1.3.11
1478 $properties["ENABLE_MARKUP_TEMPLATE"] =
1479 new boolean_define_optional
1480 ('ENABLE_MARKUP_TEMPLATE',
1481 array('true' => "Enabled",
1482 'false' => "Disabled"), "
1483 Enable mediawiki-style {{TemplatePage|vars=value|...}} syntax. Since 1.3.11
1484 Default: undefined. Enabled automatically on the MonoBook theme if undefined.");
1488 $properties["Part Six"] =
1489 new part('_part6', $SEPARATOR."\n", "
1491 Part Six (optional):
1492 URL options -- you can probably skip this section.
1494 For a pretty wiki (no index.php in the url) set a seperate DATA_PATH.");
1496 global $HTTP_SERVER_VARS;
1497 $properties["Server Name"] =
1498 new _define_commented_optional('SERVER_NAME', $HTTP_SERVER_VARS['SERVER_NAME'], "
1499 Canonical name of the server on which this PhpWiki resides.");
1501 $properties["Server Port"] =
1502 new numeric_define_commented('SERVER_PORT', $HTTP_SERVER_VARS['SERVER_PORT'], "
1503 Canonical httpd port of the server on which this PhpWiki resides.",
1504 "onchange=\"validate_ereg('Sorry, \'%s\' is no valid port number.', '^[0-9]+$', 'SERVER_PORT', this);\"");
1506 $properties["Script Name"] =
1507 new _define_commented_optional('SCRIPT_NAME', $scriptname, "
1508 Relative URL (from the server root) of the PhpWiki script.");
1510 $properties["Data Path"] =
1511 new _define_commented_optional('DATA_PATH', dirname($scriptname), "
1512 URL of the PhpWiki install directory. (You only need to set this
1513 if you've moved index.php out of the install directory.) This can
1514 be either a relative URL (from the directory where the top-level
1515 PhpWiki script is) or an absolute one.");
1518 $properties["PhpWiki Install Directory"] =
1519 new _define_commented_optional('PHPWIKI_DIR', dirname(__FILE__), "
1520 Path to the PhpWiki install directory. This is the local
1521 filesystem counterpart to DATA_PATH. (If you have to set
1522 DATA_PATH, your probably have to set this as well.) This can be
1523 either an absolute path, or a relative path interpreted from the
1524 directory where the top-level PhpWiki script (normally index.php)
1527 $properties["Use PATH_INFO"] =
1528 new _define_selection_optional_commented('USE_PATH_INFO',
1529 array('' => 'automatic',
1530 'true' => 'use PATH_INFO',
1531 'false' => 'do not use PATH_INFO'), "
1532 PhpWiki will try to use short urls to pages, eg
1533 http://www.example.com/index.php/HomePage
1534 If you want to use urls like
1535 http://www.example.com/index.php?pagename=HomePage
1536 then define 'USE_PATH_INFO' as false by uncommenting the line below.
1537 NB: If you are using Apache >= 2.0.30, then you may need to to use
1538 the directive \"AcceptPathInfo On\" in your Apache configuration file
1539 (or in an appropriate <.htaccess> file) for the short urls to work:
1540 See http://httpd.apache.org/docs-2.0/mod/core.html#acceptpathinfo
1542 See also http://phpwiki.sourceforge.net/phpwiki/PrettyWiki for more ideas
1543 on prettifying your urls.
1545 Default: PhpWiki will try to divine whether use of PATH_INFO
1546 is supported in by your webserver/PHP configuration, and will
1547 use PATH_INFO if it thinks that is possible.");
1549 $properties["Virtual Path"] =
1550 new _define_commented_optional('VIRTUAL_PATH', '/SomeWiki', "
1551 VIRTUAL_PATH is the canonical URL path under which your your wiki
1552 appears. Normally this is the same as dirname(SCRIPT_NAME), however
1553 using e.g. seperate starter scripts, apaches mod_actions (or mod_rewrite),
1554 you can make it something different.
1556 If you do this, you should set VIRTUAL_PATH here or in the starter scripts.
1558 E.g. your phpwiki might be installed at at /scripts/phpwiki/index.php,
1559 but you've made it accessible through eg. /wiki/HomePage.
1561 One way to do this is to create a directory named 'wiki' in your
1562 server root. The directory contains only one file: an .htaccess
1563 file which reads something like:
1565 Action x-phpwiki-page /scripts/phpwiki/index.php
1566 SetHandler x-phpwiki-page
1567 DirectoryIndex /scripts/phpwiki/index.php
1569 In that case you should set VIRTUAL_PATH to '/wiki'.
1571 (VIRTUAL_PATH is only used if USE_PATH_INFO is true.)
1576 $properties["Part Seven"] =
1577 new part('_part7', $SEPARATOR."\n", "
1581 Miscellaneous settings
1584 $properties["Strict Mailable Pagedumps"] =
1585 new boolean_define_optional
1586 ('STRICT_MAILABLE_PAGEDUMPS',
1587 array('false' => "binary",
1588 'true' => "quoted-printable"),
1590 If you define this to true, (MIME-type) page-dumps (either zip dumps,
1591 or \"dumps to directory\" will be encoded using the quoted-printable
1592 encoding. If you're actually thinking of mailing the raw page dumps,
1593 then this might be useful, since (among other things,) it ensures
1594 that all lines in the message body are under 80 characters in length.
1596 Also, setting this will cause a few additional mail headers
1597 to be generated, so that the resulting dumps are valid
1598 RFC 2822 e-mail messages.
1600 Probably, you can just leave this set to false, in which case you get
1601 raw ('binary' content-encoding) page dumps.");
1603 $properties["HTML Dump Filename Suffix"] =
1604 new _define_optional('HTML_DUMP_SUFFIX', ".html", "
1605 Here you can change the filename suffix used for XHTML page dumps.
1606 If you don't want any suffix just comment this out.");
1608 $properties["Default local Dump Directory"] =
1609 new _define_optional('DEFAULT_DUMP_DIR', "/tmp/wikidump", "
1610 Specify the default directory for local backups.");
1612 $properties["Default local HTML Dump Directory"] =
1613 new _define_optional('HTML_DUMP_DIR', "/tmp/wikidumphtml", "
1614 Specify the default directory for local XHTML dumps.");
1616 $properties["Pagename of Recent Changes"] =
1617 new _define_optional('RECENT_CHANGES', 'RecentChanges', "
1618 Page name of RecentChanges page. Used for RSS Auto-discovery.");
1620 $properties["Disable HTTP Redirects"] =
1621 new boolean_define_commented_optional
1622 ('DISABLE_HTTP_REDIRECT',
1623 array('false' => 'Enable HTTP Redirects',
1624 'true' => 'Disable HTTP Redirects'),
1626 (You probably don't need to touch this.)
1628 PhpWiki uses HTTP redirects for some of it's functionality.
1629 (e.g. after saving changes, PhpWiki redirects your browser to
1630 view the page you just saved.)
1632 Some web service providers (notably free European Lycos) don't seem to
1633 allow these redirects. (On Lycos the result in an \"Internal Server Error\"
1634 report.) In that case you can set DISABLE_HTTP_REDIRECT to true.
1635 (In which case, PhpWiki will revert to sneakier tricks to try to
1636 redirect the browser...)");
1638 $properties["Disable GETIMAGESIZE"] =
1639 new boolean_define_commented_optional
1640 ('DISABLE_GETIMAGESIZE',
1641 array('false' => 'Enable',
1642 'true' => 'Disable'), "
1643 Set GETIMAGESIZE to disabled, if your php fails to calculate the size on
1644 inlined images, or you don't want to disable too small images to be inlined.
1646 Per default too small ploaded or external images are not displayed,
1647 to prevent from external 1 pixel spam.");
1649 $properties["EDITING_POLICY"] =
1650 new _define_optional('EDITING_POLICY', "EditingPolicy", "
1651 An interim page which gets displayed on every edit attempt, if it exists.");
1653 $properties["ENABLE_MODERATEDPAGE_ALL"] =
1654 new boolean_define_commented_optional
1655 ('ENABLE_MODERATEDPAGE_ALL',
1656 array('false' => 'Disable',
1657 'true' => 'Enable'), "
1660 $properties["FORTUNE_DIR"] =
1661 new _define_commented_optional('FORTUNE_DIR', "/usr/share/fortune", "
1663 $properties["DBADMIN_USER"] =
1664 new _define_commented_optional('DBADMIN_USER', "", "
1666 $properties["DBADMIN_PASSWD"] =
1667 new _define_commented_optional('DBADMIN_PASSWD', "", "
1669 $properties["USE_EXTERNAL_HTML2PDF"] =
1670 new _define_commented_optional('USE_EXTERNAL_HTML2PDF', "htmldoc --quiet --format pdf14 --no-toc --no-title %s", "
1672 $properties["BABYCART_PATH"] =
1673 new _define_commented_optional('BABYCART_PATH', "/usr/local/bin/babycart", "
1676 $properties["Part Seven A"] =
1677 new part('_part7a', $SEPARATOR."\n", "
1681 Cached Plugin Settings. (pear Cache)
1684 $properties["pear Cache USECACHE"] =
1685 new boolean_define_optional('PLUGIN_CACHED_USECACHE',
1686 array('true' => 'Enabled',
1687 'false' => 'Disabled'), "
1688 Enable or disable pear caching of plugins.");
1689 $properties["pear Cache Database Container"] =
1690 new _define_selection_optional('PLUGIN_CACHED_DATABASE',
1691 array('file' => 'file'), "
1692 Curently only file is supported.
1693 db, trifile and imgfile might be supported, but you must hack that by yourself.");
1695 $properties["pear Cache cache directory"] =
1696 new _define_commented_optional('PLUGIN_CACHED_CACHE_DIR', "/tmp/cache", "
1697 Should be writable to the webserver.");
1698 $properties["pear Cache Filename Prefix"] =
1699 new _define_optional('PLUGIN_CACHED_FILENAME_PREFIX', "phpwiki", "");
1700 $properties["pear Cache HIGHWATER"] =
1701 new numeric_define_optional('PLUGIN_CACHED_HIGHWATER', "4194304", "
1702 Garbage collection parameter.");
1703 $properties["pear Cache LOWWATER"] =
1704 new numeric_define_optional('PLUGIN_CACHED_LOWWATER', "3145728", "
1705 Garbage collection parameter.");
1706 $properties["pear Cache MAXLIFETIME"] =
1707 new numeric_define_optional('PLUGIN_CACHED_MAXLIFETIME', "2592000", "
1708 Garbage collection parameter.");
1709 $properties["pear Cache MAXARGLEN"] =
1710 new numeric_define_optional('PLUGIN_CACHED_MAXARGLEN', "1000", "
1711 max. generated url length.");
1712 $properties["pear Cache FORCE_SYNCMAP"] =
1713 new boolean_define_optional('PLUGIN_CACHED_FORCE_SYNCMAP',
1714 array('true' => 'Enabled',
1715 'false' => 'Disabled'), "");
1716 $properties["pear Cache IMGTYPES"] =
1717 new list_define('PLUGIN_CACHED_IMGTYPES', "png|gif|gd|gd2|jpeg|wbmp|xbm|xpm", "
1718 Handle those image types via GD handles. Check your GD supported image types.");
1720 $end = "\n".$SEPARATOR."\n";
1723 text_from_dist("_MAGIC_CLOSE_FILE");
1725 // end of configuration options
1726 ///////////////////////////////
1727 // begin class definitions
1730 * A basic config-dist.ini configuration line in the form of a variable.
1731 * (not needed anymore, we have only defines)
1733 * Produces a string in the form "$name = value;"
1735 * $WikiNameRegexp = "value";
1739 var $config_item_name;
1745 function _variable($config_item_name, $default_value, $description = '', $jscheck = '') {
1746 $this->config_item_name = $config_item_name;
1748 $description = text_from_dist($config_item_name);
1749 $this->description = $description;
1750 // TODO: get boolean default value from config-default.ini
1751 if (defined($config_item_name)
1752 and !preg_match("/(selection|boolean)/", get_class($this))
1753 and !preg_match("/(SCRIPT_NAME|VIRTUAL_PATH)/", $config_item_name))
1754 $this->default_value = constant($config_item_name); // ignore given default value
1755 elseif ($config_item_name == $default_value)
1756 $this->default_value = '';
1758 $this->default_value = $default_value;
1759 $this->jscheck = $jscheck;
1760 if (preg_match("/variable/i", get_class($this)))
1761 $this->prefix = "\$";
1762 elseif (preg_match("/ini_set/i", get_class($this)))
1763 $this->prefix = "ini_get: ";
1769 global $HTTP_POST_VARS;
1770 if (isset($HTTP_POST_VARS[$this->config_item_name]))
1771 return $HTTP_POST_VARS[$this->config_item_name];
1773 return $this->default_value;
1776 function _config_format($value) {
1778 $v = $this->get_config_item_name();
1779 // handle arrays: a|b --> a['b']
1780 if (strpos($v, '|')) {
1781 list($a, $b) = explode('|', $v);
1782 $v = sprintf("%s['%s']", $a, $b);
1784 if (preg_match("/[\"']/", $value))
1785 $value = '"' . $value . '"';
1786 return sprintf("%s = \"%s\"", $v, $value);
1789 function get_config_item_name() {
1790 return $this->config_item_name;
1793 function get_config_item_id() {
1794 return str_replace('|', '-', $this->config_item_name);
1797 function get_config_item_header() {
1798 if (strchr($this->config_item_name,'|')) {
1799 list($var,$param) = explode('|',$this->config_item_name);
1800 return "<b>" . $this->prefix . $var . "['" . $param . "']</b><br />";
1802 elseif ($this->config_item_name[0] != '_')
1803 return "<b>" . $this->prefix . $this->config_item_name . "</b><br />";
1808 function _get_description() {
1809 return $this->description;
1812 function _get_config_line($posted_value) {
1813 return "\n" . $this->_config_format($posted_value);
1816 function get_config($posted_value) {
1817 $d = stripHtml($this->_get_description());
1818 $d = str_replace("\n", "\n; ", $d) . $this->_get_config_line($posted_value) ."\n";
1822 function get_instructions($title) {
1824 $i = "<h3>" . $title . "</h3>\n " . nl2p($this->_get_description()) . "\n";
1825 return "<tr>\n<td width=\"$tdwidth\" class=\"instructions\">\n" . $i . "</td>\n";
1828 function get_html() {
1829 $size = strlen($this->default_value) > 45 ? 90 : 50;
1830 return $this->get_config_item_header() .
1831 "<input type=\"text\" size=\"$50\" name=\"" . $this->get_config_item_name() . "\" value=\"" . htmlspecialchars($this->default_value) . "\" " .
1832 $this->jscheck . " />" . "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: green\">Input accepted.</p>";
1836 class unchangeable_variable
1838 function _config_format($value) {
1841 // function get_html() { return false; }
1842 function get_html() {
1843 return $this->get_config_item_header() .
1844 "<em>Not editable.</em>" .
1845 "<pre>" . $this->default_value."</pre>";
1847 function _get_config_line($posted_value) {
1848 if ($this->description)
1850 return "${n}".$this->default_value;
1852 function get_instructions($title) {
1854 $i = "<h3>" . $title . "</h3>\n " . nl2p($this->_get_description()) . "\n";
1855 // $i .= "<em>Not editable.</em><br />\n<pre>" . $this->default_value."</pre>";
1856 return '<tr><td width="100%" class="unchangeable-variable-top" colspan="2">'."\n".$i."</td></tr>\n"
1857 . '<tr style="border-top: none;"><td class="unchangeable-variable-left" width="'.$tdwidth.'"> </td>';
1861 class unchangeable_define
1862 extends unchangeable_variable {
1863 function _config_format($value) {
1867 class unchangeable_ini_set
1868 extends unchangeable_variable {
1869 function _config_format($value) {
1874 class _variable_selection
1877 global $HTTP_POST_VARS;
1878 if (!empty($HTTP_POST_VARS[$this->config_item_name]))
1879 return $HTTP_POST_VARS[$this->config_item_name];
1881 list($option, $label) = each($this->default_value);
1885 function get_html() {
1886 $output = $this->get_config_item_header();
1887 $output .= '<select name="' . $this->get_config_item_name() . "\">\n";
1888 /* The first option is the default */
1889 $values = $this->default_value;
1890 if (defined($this->get_config_item_name()))
1891 $this->default_value = constant($this->get_config_item_name());
1893 $this->default_value = null;
1894 while(list($option, $label) = each($values)) {
1895 if (!is_null($this->default_value) and $this->default_value === $option)
1896 $output .= " <option value=\"$option\" selected=\"selected\">$label</option>\n";
1898 $output .= " <option value=\"$option\">$label</option>\n";
1900 $output .= "</select>\n";
1908 function _config_format($value) {
1909 return sprintf("%s = \"%s\"", $this->get_config_item_name(), $value);
1911 function _get_config_line($posted_value) {
1912 if ($this->description)
1914 if ($posted_value == '')
1915 return "${n};" . $this->_config_format("");
1917 return "${n}" . $this->_config_format($posted_value);
1919 function get_html() {
1920 $size = strlen($this->default_value) > 45 ? 90 : 50;
1921 return $this->get_config_item_header()
1922 . "<input type=\"text\" size=\"$size\" name=\"" . htmlentities($this->get_config_item_name())
1923 . "\" value=\"" . htmlentities($this->default_value) . "\" {$this->jscheck} />"
1924 . "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: green\">Input accepted.</p>";
1928 class _define_commented
1930 function _get_config_line($posted_value) {
1931 if ($this->description)
1933 if ($posted_value == $this->default_value)
1934 return "${n};" . $this->_config_format($posted_value);
1935 elseif ($posted_value == '')
1936 return "${n};" . $this->_config_format("");
1938 return "${n}" . $this->_config_format($posted_value);
1943 * We don't use _optional anymore, because INI-style config's don't need that.
1944 * IniConfig.php does the optional logic now.
1945 * But we use _optional for config-default.ini options
1947 class _define_commented_optional
1948 extends _define_commented { }
1950 class _define_optional
1953 class _define_notempty
1955 function get_html() {
1956 $s = $this->get_config_item_header()
1957 . "<input type=\"text\" size=\"50\" name=\"" . $this->get_config_item_name()
1958 . "\" value=\"" . $this->default_value . "\" {$this->jscheck} />";
1959 if (empty($this->default_value))
1960 return $s . "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: red\">Cannot be empty.</p>";
1962 return $s . "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: green\">Input accepted.</p>";
1966 class _variable_commented
1968 function _get_config_line($posted_value) {
1969 if ($this->description)
1971 if ($posted_value == $this->default_value)
1972 return "${n};" . $this->_config_format($posted_value);
1973 elseif ($posted_value == '')
1974 return "${n};" . $this->_config_format("");
1976 return "${n}" . $this->_config_format($posted_value);
1980 class numeric_define
1983 function numeric_define($config_item_name, $default_value, $description = '', $jscheck = '') {
1984 $this->_define($config_item_name, $default_value, $description, $jscheck);
1986 $this->jscheck = "onchange=\"validate_ereg('Sorry, \'%s\' is not an integer.', '^[-+]?[0-9]+$', '" . $this->get_config_item_name() . "', this);\"";
1988 function _config_format($value) {
1989 //return sprintf("define('%s', %s);", $this->get_config_item_name(), $value);
1990 return sprintf("%s = %s", $this->get_config_item_name(), $value);
1992 function _get_config_line($posted_value) {
1993 if ($this->description)
1995 if ($posted_value == '')
1996 return "${n};" . $this->_config_format('0');
1998 return "${n}" . $this->_config_format($posted_value);
2002 class numeric_define_optional
2003 extends numeric_define {}
2005 class numeric_define_commented
2006 extends numeric_define {
2007 function _get_config_line($posted_value) {
2008 if ($this->description)
2010 if ($posted_value == $this->default_value)
2011 return "${n};" . $this->_config_format($posted_value);
2012 elseif ($posted_value == '')
2013 return "${n};" . $this->_config_format('0');
2015 return "${n}" . $this->_config_format($posted_value);
2019 class _define_selection
2020 extends _variable_selection {
2021 function _config_format($value) {
2022 return sprintf("%s = %s", $this->get_config_item_name(), $value);
2024 function _get_config_line($posted_value) {
2025 return _define::_get_config_line($posted_value);
2027 function get_html() {
2028 return _variable_selection::get_html();
2032 class _define_selection_optional
2033 extends _define_selection { }
2035 class _variable_selection_optional
2036 extends _variable_selection { }
2038 class _define_selection_optional_commented
2039 extends _define_selection_optional {
2040 function _get_config_line($posted_value) {
2041 if ($this->description)
2043 if ($posted_value == $this->default_value)
2044 return "${n};" . $this->_config_format($posted_value);
2045 elseif ($posted_value == '')
2046 return "${n};" . $this->_config_format("");
2048 return "${n}" . $this->_config_format($posted_value);
2052 class _define_password
2055 function _define_password($config_item_name, $default_value, $description = '', $jscheck = '') {
2056 if ($config_item_name == $default_value) $default_value = '';
2057 $this->_define($config_item_name, $default_value, $description, $jscheck);
2059 $this->jscheck = "onchange=\"validate_ereg('Sorry, \'%s\' cannot be empty.', '^.+$', '"
2060 . $this->get_config_item_name() . "', this);\"";
2062 function _get_config_line($posted_value) {
2063 if ($this->description)
2065 if ($posted_value == '') {
2066 $p = "${n};" . $this->_config_format("");
2067 $p .= "\n; If you used the passencrypt.php utility to encode the password";
2068 $p .= "\n; then uncomment this line:";
2069 $p .= "\n;ENCRYPTED_PASSWD = true";
2072 if (function_exists('crypt')) {
2073 $salt_length = max(CRYPT_SALT_LENGTH,
2077 16 * CRYPT_BLOWFISH);
2078 // generate an encrypted password
2079 $crypt_pass = crypt($posted_value, rand_ascii($salt_length));
2080 $p = "${n}" . $this->_config_format($crypt_pass);
2081 return $p . "\nENCRYPTED_PASSWD = true";
2083 $p = "${n}" . $this->_config_format($posted_value);
2084 $p .= "\n; Encrypted passwords cannot be used:";
2085 $p .= "\n; 'function crypt()' not available in this version of php";
2086 $p .= "\nENCRYPTED_PASSWD = false";
2091 function get_html() {
2092 return _variable_password::get_html();
2096 class _define_password_optional
2097 extends _define_password {
2099 function _define_password_optional($config_item_name, $default_value, $description = '', $jscheck = '') {
2100 if ($config_item_name == $default_value) $default_value = '';
2101 $this->_define($config_item_name, $default_value, $description, $jscheck);
2104 function _get_config_line($posted_value) {
2105 if ($this->description)
2107 if ($posted_value == '') {
2108 return "${n};" . $this->_config_format("");
2110 return "${n}" . $this->_config_format($posted_value);
2116 class _define_password_commented_optional
2117 extends _define_password_optional { }
2119 class _variable_password
2121 function _variable_password($config_item_name, $default_value, $description = '', $jscheck = '') {
2122 if ($config_item_name == $default_value) $default_value = '';
2123 $this->_define($config_item_name, $default_value, $description, $jscheck);
2125 $this->jscheck = "onchange=\"validate_ereg('Sorry, \'%s\' cannot be empty.', '^.+$', '" . $this->get_config_item_name() . "', this);\"";
2127 function get_html() {
2128 global $HTTP_POST_VARS, $HTTP_GET_VARS;
2129 $s = $this->get_config_item_header();
2130 if (isset($HTTP_POST_VARS['create']) or isset($HTTP_GET_VARS['create'])) {
2131 $new_password = random_good_password();
2132 $this->default_value = $new_password;
2133 $s .= "Created password: <strong>$new_password</strong><br /> <br />";
2135 // dont re-encrypt already encrypted passwords
2136 $value = $this->value();
2137 $encrypted = !empty($GLOBALS['properties']["Encrypted Passwords"]) and
2138 $GLOBALS['properties']["Encrypted Passwords"]->value();
2141 $s .= "<input type=\"". ($encrypted ? "text" : "password") . "\" name=\"" . $this->get_config_item_name()
2142 . "\" value=\"" . $value . "\" {$this->jscheck} />"
2143 . " <input type=\"submit\" name=\"create\" value=\"Create Random Password\" />";
2145 $s .= "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: red\">Cannot be empty.</p>";
2146 elseif (strlen($this->default_value) < 4)
2147 $s .= "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: red\">Must be longer than 4 chars.</p>";
2149 $s .= "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: green\">Input accepted.</p>";
2156 function _get_config_line($posted_value) {
2157 // split the phrase by any number of commas or space characters,
2158 // which include " ", \r, \t, \n and \f
2159 $list_values = preg_split("/[\s,]+/", $posted_value, -1, PREG_SPLIT_NO_EMPTY);
2160 $list_values = join("|", $list_values);
2161 return _variable::_get_config_line($list_values);
2163 function get_html() {
2164 $list_values = explode("|", $this->default_value);
2165 $rows = max(3, count($list_values) +1);
2166 $list_values = join("\n", $list_values);
2167 $ta = $this->get_config_item_header();
2168 $ta .= "<textarea cols=\"18\" rows=\"". $rows ."\" name=\"".$this->get_config_item_name()."\" {$this->jscheck}>";
2169 $ta .= $list_values . "</textarea>";
2170 $ta .= "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: green\">Input accepted.</p>";
2177 function _get_config_line($posted_value) {
2178 $list_values = preg_split("/[\s,]+/", $posted_value, -1, PREG_SPLIT_NO_EMPTY);
2179 $list_values = join("|", $list_values);
2180 return _variable::_get_config_line($list_values);
2182 function get_html() {
2183 $list_values = explode("|", $this->default_value);
2184 $rows = max(3, count($list_values) +1);
2185 $list_values = join("\n", $list_values);
2186 $ta = $this->get_config_item_header();
2187 $ta .= "<textarea cols=\"18\" rows=\"". $rows ."\" name=\"".$this->get_config_item_name()."\" {$this->jscheck}>";
2188 $ta .= $list_values . "</textarea>";
2189 $ta .= "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: green\">Input accepted.</p>";
2194 class array_variable
2196 function _config_format($value) {
2197 return sprintf("%s = \"%s\"", $this->get_config_item_name(),
2198 is_array($value) ? join(':', $value) : $value);
2200 function _get_config_line($posted_value) {
2201 // split the phrase by any number of commas or space characters,
2202 // which include " ", \r, \t, \n and \f
2203 $list_values = preg_split("/[\s,]+/", $posted_value, -1, PREG_SPLIT_NO_EMPTY);
2204 if (!empty($list_values)) {
2205 $list_values = "'".join("', '", $list_values)."'";
2206 return "\n" . $this->_config_format($list_values);
2208 return "\n;" . $this->_config_format('');
2210 function get_html() {
2211 $list_values = join("\n", $this->default_value);
2212 $rows = max(3, count($this->default_value) +1);
2213 $ta = $this->get_config_item_header();
2214 $ta .= "<textarea cols=\"18\" rows=\"". $rows ."\" name=\"".$this->get_config_item_name()."\" {$this->jscheck}>";
2215 $ta .= $list_values . "</textarea>";
2216 $ta .= "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: green\">Input accepted.</p>";
2223 function _config_format($value) {
2224 return sprintf("%s = \"%s\"", $this->get_config_item_name(),
2225 is_array($value) ? join(' : ', $value) : $value);
2227 function _get_config_line($posted_value) {
2228 // split the phrase by any number of commas or space characters,
2229 // which include " ", \r, \t, \n and \f
2230 $list_values = preg_split("/[\s,:]+/", $posted_value, -1, PREG_SPLIT_NO_EMPTY);
2231 if (!empty($list_values)) {
2232 $list_values = "'".join("' : '", $list_values)."'";
2233 return "\n" . $this->_config_format($list_values);
2235 return "\n;" . $this->_config_format('');
2237 function get_html() {
2238 if (!$this->default_value)
2239 $this->default_value = array();
2240 elseif (is_string($this->default_value))
2241 $this->default_value = preg_split("/[\s,:]+/", $this->default_value, -1, PREG_SPLIT_NO_EMPTY);
2242 $list_values = join(" : \n", $this->default_value);
2243 $rows = max(3, count($this->default_value) + 1);
2244 $ta = $this->get_config_item_header();
2245 $ta .= "<textarea cols=\"18\" rows=\"". $rows ."\" name=\"".$this->get_config_item_name()."\" {$this->jscheck}>";
2246 $ta .= $list_values . "</textarea>";
2247 $ta .= "<p id=\"" . $this->get_config_item_id() . "\" style=\"color: green\">Input accepted.</p>";
2256 global $HTTP_POST_VARS;
2257 if ($v = $HTTP_POST_VARS[$this->config_item_name])
2260 return ini_get($this->get_config_item_name);
2263 function _config_format($value) {
2264 return sprintf("ini_set('%s', '%s');", $this->get_config_item_name(), $value);
2266 function _get_config_line($posted_value) {
2267 if ($posted_value && ! $posted_value == $this->default_value)
2268 return "\n" . $this->_config_format($posted_value);
2270 return "\n;" . $this->_config_format($this->default_value);
2275 class boolean_define
2277 function _get_config_line($posted_value) {
2278 if ($this->description)
2280 return "${n}" . $this->_config_format($posted_value);
2282 function _config_format($value) {
2283 if (strtolower(trim($value)) == 'false')
2285 return sprintf("%s = %s", $this->get_config_item_name(),
2286 (bool)$value ? 'true' : 'false');
2288 function get_html() {
2289 $output = $this->get_config_item_header();
2290 $name = $this->get_config_item_name();
2291 $output .= '<select name="' . $name . "\" {$this->jscheck}>\n";
2292 $values = $this->default_value;
2294 $this->default_value = constant($name);
2296 $this->default_value = null;
2297 list($option, $label) = each($values);
2298 $output .= " <option value=\"$option\" selected=\"selected\">$label</option>\n";
2300 /* There can usually, only be two options, there can be
2301 * three options in the case of a boolean_define_commented_optional */
2302 while (list($option, $label) = each($values)) {
2303 if (!is_null($this->default_value) and $this->default_value === $option)
2304 $output .= " <option value=\"$option\" selected=\"selected\">$label</option>\n";
2306 $output .= " <option value=\"$option\">$label</option>\n";
2308 $output .= "</select>\n";
2313 class boolean_define_optional
2314 extends boolean_define {}
2316 class boolean_define_commented
2317 extends boolean_define {
2318 function _get_config_line($posted_value) {
2319 if ($this->description)
2321 list($default_value, $label) = each($this->default_value);
2322 if ($posted_value == $default_value)
2323 return "${n};" . $this->_config_format($posted_value);
2324 elseif ($posted_value == '')
2325 return "${n};" . $this->_config_format('false');
2327 return "${n}" . $this->_config_format($posted_value);
2331 class boolean_define_commented_optional
2332 extends boolean_define_commented {}
2336 function value () { return; }
2337 function get_config($posted_value) {
2338 $d = stripHtml($this->_get_description());
2340 return "\n".$SEPARATOR . str_replace("\n", "\n; ", $d) ."\n".$this->default_value;
2342 function get_instructions($title) {
2343 $id = preg_replace("/\W/","",$this->config_item_name);
2344 $group_name = preg_replace("/\W/","",$title);
2345 $i = "<tr class=\"header\" id=\"$id\">\n<td class=\"part\" width=\"100%\" colspan=\"2\" bgcolor=\"#eeeeee\">\n";
2346 $i .= "<h2>" . $title . "</h2>\n " . nl2p($this->_get_description()) ."\n";
2347 $i .= "<p><a href=\"javascript:toggle_group('$id')\" id=\"{$id}_text\">Hide options.</a></p>";
2348 return $i ."</td>\n";
2350 function get_html() {
2355 // html utility functions
2356 function nl2p($text) {
2357 preg_match_all("@\s*(<pre>.*?</pre>|<dl>.*?</dl>|.*?(?=\n\n|<pre>|<dl>|$))@s",
2358 $text, $m, PREG_PATTERN_ORDER);
2361 foreach ($m[1] as $par) {
2362 if (!($par = trim($par)))
2364 if (!preg_match('/^<(pre|dl)>/', $par))
2365 $par = "<p>$par</p>";
2371 function text_from_dist($var) {
2372 static $distfile = 0;
2376 $sep = (substr(PHP_OS,0,3) == 'WIN' ? '\\' : '/');
2377 $distfile = dirname(__FILE__) . $sep . "config" . $sep . "config-dist.ini";
2378 $f = fopen($distfile, "r");
2380 if ($var == '_MAGIC_CLOSE_FILE') {
2384 // if all vars would be in natural order as in the config-dist this would not be needed.
2389 if (preg_match("/^; \w/", $s)) {
2390 $par .= (substr($s,2) . " ");
2391 } elseif (preg_match("/^;\s*$/", $s)) {
2394 if (preg_match("/^;?".preg_quote($var)."\s*=/", $s))
2396 if (preg_match("/^\s*$/", $s)) // new paragraph
2402 function stripHtml($text) {
2403 $d = str_replace("<pre>", "", $text);
2404 $d = str_replace("</pre>", "", $d);
2405 $d = str_replace("<dl>", "", $d);
2406 $d = str_replace("</dl>", "", $d);
2407 $d = str_replace("<dt>", "", $d);
2408 $d = str_replace("</dt>", "", $d);
2409 $d = str_replace("<dd>", "", $d);
2410 $d = str_replace("</dd>", "", $d);
2411 $d = str_replace("<p>", "", $d);
2412 $d = str_replace("</p>", "", $d);
2413 //restore html entities into characters
2414 // http://www.php.net/manual/en/function.htmlentities.php
2415 $trans = get_html_translation_table (HTML_ENTITIES);
2416 $trans = array_flip ($trans);
2417 $d = strtr($d, $trans);
2421 include_once(dirname(__FILE__)."/lib/stdlib.php");
2424 // Function to create better user passwords (much larger keyspace),
2425 // suitable for user passwords.
2426 // Sequence of random ASCII numbers, letters and some special chars.
2427 // Note: There exist other algorithms for easy-to-remember passwords.
2428 function random_good_password ($minlength = 5, $maxlength = 8) {
2430 // assume ASCII ordering (not valid on EBCDIC systems!)
2431 $valid_chars = "!#%&+-.0123456789=@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz";
2432 $start = ord($valid_chars);
2433 $end = ord(substr($valid_chars,-1));
2435 if (function_exists('mt_rand')) // mersenne twister
2436 $length = mt_rand($minlength, $maxlength);
2437 else // the usually bad glibc rand()
2438 $length = rand($minlength, $maxlength);
2439 while ($length > 0) {
2440 if (function_exists('mt_rand'))
2441 $newchar = mt_rand($start, $end);
2443 $newchar = rand($start, $end);
2444 if (! strrpos($valid_chars,$newchar) ) continue; // skip holes
2445 $newpass .= sprintf("%c", $newchar);
2452 function printArray($a) {
2453 echo "<hr />\n<pre>\n";
2455 echo "\n</pre>\n<hr />\n";
2458 // end of class definitions
2459 /////////////////////////////
2460 // begin auto generation code
2462 if (!function_exists('is_a')) {
2463 function is_a($object, $class) {
2464 $class = strtolower($class);
2465 return (get_class($object) == $class) or is_subclass_of($object, $class);
2470 if (!empty($HTTP_POST_VARS['action'])
2471 and $HTTP_POST_VARS['action'] == 'make_config'
2472 and !empty($HTTP_POST_VARS['ADMIN_USER'])
2473 and !empty($HTTP_POST_VARS['ADMIN_PASSWD'])
2477 $timestamp = date ('dS of F, Y H:i:s');
2480 ; This is a local configuration file for PhpWiki.
2481 ; It was automatically generated by the configurator script
2482 ; on the $timestamp.
2487 $posted = $GLOBALS['HTTP_POST_VARS'];
2488 /*if (defined('DEBUG'))
2489 printArray($GLOBALS['HTTP_POST_VARS']);*/
2491 foreach ($properties as $option_name => $a) {
2492 $posted_value = stripslashes($posted[$a->config_item_name]);
2493 $config .= $properties[$option_name]->get_config($posted_value);
2498 if (is_writable($fs_config_file)) {
2499 // We first check if the config-file exists.
2500 if (file_exists($fs_config_file)) {
2501 // We make a backup copy of the file
2502 $new_filename = preg_replace('/\.ini$/', '-' . time() . '.ini', $fs_config_file);
2503 if (@copy($fs_config_file, $new_filename)) {
2504 $fp = @fopen($fs_config_file, 'w');
2507 $fp = @fopen($fs_config_file, 'w');
2515 fputs($fp, $config);
2517 echo "<p>The configuration was written to <code><b>$config_file</b></code>.</p>\n";
2518 if ($new_filename) {
2519 echo "<p>A backup was made to <code><b>$new_filename</b></code>.</p>\n";
2521 ; //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";
2524 echo "<p>The configuration file could <b>not</b> be written.<br />\n",
2525 " You should copy the above configuration to a file, ",
2526 "and manually save it as <code><b>config/config.ini</b></code>.</p>\n";
2529 echo "<hr />\n<p>Here's the configuration file based on your answers:</p>\n";
2530 echo "<form method=\"get\" action=\"", $configurator, "\">\n";
2531 echo "<textarea id='config-output' readonly='readonly' style='width:100%;' rows='30' cols='100'>\n";
2532 echo htmlentities($config);
2533 echo "</textarea></form>\n";
2536 echo "<p>To make any corrections, <a href=\"configurator.php\">edit the settings again</a>.</p>\n";
2538 } else { // first time or create password
2539 $posted = $GLOBALS['HTTP_POST_VARS'];
2540 // No action has been specified - we make a form.
2543 <form action="',$configurator,'" method="post">
2544 <input type="hidden" name="action" value="make_config" />
2545 <table cellpadding="4" cellspacing="0">
2548 while (list($property, $obj) = each($properties)) {
2549 echo $obj->get_instructions($property);
2550 if ($h = $obj->get_html()) {
2551 if (defined('DEBUG') and DEBUG) $h = get_class($obj) . "<br />\n" . $h;
2552 echo "<td>".$h."</td>\n";
2559 <p><input type="submit" id="submit" value="Save ',$config_file,'" /> <input type="reset" value="Clear" /></p>