1 <?php printf("<?xml version=\"1.0\" encoding=\"%s\"?>\n", 'iso-8859-1'); ?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4 <html xmlns="http://www.w3.org/1999/xhtml">
6 <!-- $Id: configurator.php,v 1.3 2002-02-26 01:05:10 carstenklapp Exp $ -->
8 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
9 <title>Configuration tool for PhpWiki 1.3.x</title>
13 <h1>Configuration tool for PhpWiki 1.3.x</h1>
15 <p>This tool is provided for testing purposes only. It's not finished so don't try to use it to configure your server yet.</p>
19 * The Configurator is a php script to aid in the configuration of PhpWiki.
20 * Parts of this file are based on PHPWeather's configurator.php file.
21 * http://sourceforge.net/projects/phpweather/
24 * TO CHANGE THE CONFIGURATION OF YOUR PHPWIKI, DO *NOT* MODIFY THIS FILE!
25 * more instructions go here
28 * An index.php will be generated for you which you can also modify later if you wish.
32 //////////////////////////////
33 // begin configuration options
37 * Notes for the description parameter of $property:
39 * - Descriptive text will be changed into comments (preceeded by //)
40 * for the final output to index.php.
42 * - Only a limited set of html is allowed: pre, dl dt dd; it will be
43 * stripped from the final output.
45 * - Line breaks and spacing will be preserved for the final output.
47 * - Double line breaks are automatically converted to paragraphs
48 * for the html version of the descriptive text.
50 * - Double-quotes and dollar signs in the descriptive text must be
51 * escaped: \" and \$. Instead of escaping double-quotes you can use
52 * single (') quotes for the enclosing quotes.
54 * - Special characters like < and > must use html entities,
55 * they will be converted back to characters for the final output.
58 $SEPARATOR = "///////////////////////////////////////////////////////////////////";
61 Copyright 1999, 2000, 2001, 2002 $ThePhpWikiProgrammingTeam = array(
62 "Steve Wainstead", "Clifford A. Adams", "Lawrence Akka",
63 "Scott R. Anderson", "Jon Åslund", "Neil Brown", "Jeff Dairiki",
64 "Stéphane Gourichon", "Jan Hidders", "Arno Hollosi", "John Jorgensen",
65 "Antti Kaihola", "Jeremie Kass", "Carsten Klapp", "Marco Milanesi",
66 "Grant Morgan", "Jan Nieuwenhuizen", "Aredridel Niothke",
67 "Pablo Roca Rozas", "Sandino Araico Sánchez", "Joel Uckelman",
68 "Reini Urban", "Tim Voght");
70 This file is part of PhpWiki.
72 PhpWiki is free software; you can redistribute it and/or modify
73 it under the terms of the GNU General Public License as published by
74 the Free Software Foundation; either version 2 of the License, or
75 (at your option) any later version.
77 PhpWiki is distributed in the hope that it will be useful,
78 but WITHOUT ANY WARRANTY; without even the implied warranty of
79 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
80 GNU General Public License for more details.
82 You should have received a copy of the GNU General Public License
83 along with PhpWiki; if not, write to the Free Software
84 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
90 This is the starting file for PhpWiki. All this file does is set
91 configuration options, and at the end of the file it includes() the
92 file lib/main.php, where the real action begins.
94 This file is divided into six parts: Parts Zero, One, Two, Three,
95 Four and Five. Each one has different configuration settings you can
96 change; in all cases the default should work on your system,
97 however, we recommend you tailor things to your particular setting.
102 $properties['Part Zero'] =
103 new part('part0', false, "
104 Part Zero: If PHP needs help in finding where you installed the
105 rest of the PhpWiki code, you can set the include_path here.");
109 $properties['PHP include_path'] =
110 new _ini_set('include_path', "\$include_path", "
111 NOTE: phpwiki uses the PEAR library of php code for SQL database
112 access. Your PHP is probably already configured to set
113 include_path so that PHP can find the pear code. If not (or if you
114 change include_path here) make sure you include the path to the
115 PEAR code in include_path. (To find the PEAR code on your system,
116 search for a file named 'PEAR.php'. Some common locations are:
124 The above examples are already included by PhpWiki. You shouldn't
125 have to change this unless you see a WikiFatalError:
127 lib/FileFinder.php:82: Fatal[256]: DB.php: file not found
129 Define the include path for this wiki: pear plus the phpwiki path
131 $include_path = '.:/Apache/php/pear:/prog/php/phpwiki';
133 Windows needs ';' as path delimiter. cygwin, mac and unix ':'
135 if (substr(PHP_OS,0,3) == 'WIN') {
136 $include_path = implode(';',explode(':',$include_path));
137 } elseif (substr(PHP_OS,0,6) == 'CYGWIN') {
138 $include_path = '.:/usr/local/lib/php/pear:/usr/src/php/phpwiki';
145 $properties['Part Null'] =
146 new part('partnullheader', "", "
147 Part Null: Don't touch this!");
151 $properties['Part Null Settings'] =
152 new unchangeable_variable('partnullsettings', "
153 define ('PHPWIKI_VERSION', '1.3.3-jeffs-hacks');
154 require \"lib/prepend.php\";
155 rcs_id('\$Id: configurator.php,v 1.3 2002-02-26 01:05:10 carstenklapp Exp $');", "");
159 $properties['Part One'] =
160 new part('partone', $SEPARATOR."\n", "
163 Authentication and security settings:
168 $properties['Wiki Name'] =
169 new _define('WIKI_NAME', ''/*'PhpWiki'*/, "
170 The name of your wiki.
171 This is used to generate a keywords meta tag in the HTML templates,
172 in bookmark titles for any bookmarks made to pages in your wiki,
173 and during RSS generation for the title of the RSS channel.");
177 $properties['Reverse DNS'] =
178 new boolean_define('ENABLE_REVERSE_DNS',
179 array('true' => 'perform additional reverse dns lookups',
180 'false' => 'just record the address as given by the httpd server'), "
181 If set, we will perform reverse dns lookups to try to convert the
182 users IP number to a host name, even if the http server didn't do
187 $properties['Admin Username'] =
188 new _define('ADMIN_USER', "", "
189 Username and password of administrator.
190 Set these to your preferences. For heaven's sake
191 pick a good password!");
192 $properties['Admin Password'] =
193 new _define_password('ADMIN_PASSWD', "", "");
197 $properties['ZIPdump Authentication'] =
198 new boolean_define('ZIPDUMP_AUTH',
199 array('false' => 'everyone may download zip dumps',
200 'true' => 'only admin may download zip dumps'), "
201 If true, only the admin user can make zip dumps, else zip dumps
202 require no authentication.");
206 $properties['Strict Mailable Pagedumps'] =
207 new boolean_define('STRICT_MAILABLE_PAGEDUMPS',
208 array('false' => 'binary',
209 'true' => 'quoted-printable'), "
210 If you define this to true, (MIME-type) page-dumps (either zip dumps,
211 or \"dumps to directory\" will be encoded using the quoted-printable
212 encoding. If you're actually thinking of mailing the raw page dumps,
213 then this might be useful, since (among other things,) it ensures
214 that all lines in the message body are under 80 characters in length.
216 Also, setting this will cause a few additional mail headers
217 to be generated, so that the resulting dumps are valid
218 RFC 2822 e-mail messages.
220 Probably, you can just leave this set to false, in which case you get
221 raw ('binary' content-encoding) page dumps.");
225 $properties['Maximum Upload Size'] =
226 new numeric_define('MAX_UPLOAD_SIZE', "16 * 1024 * 1024", "
227 The maximum file upload size.");
231 $properties['Minor Edit Timeout'] =
232 new numeric_define('MINOR_EDIT_TIMEOUT', "7 * 24 * 3600", "
233 If the last edit is older than MINOR_EDIT_TIMEOUT seconds, the
234 default state for the \"minor edit\" checkbox on the edit page form
239 $properties['Disabled Actions'] =
240 new array_variable('DisabledActions', array(), "
241 Actions listed in this array will not be allowed. Actions are:
242 browse, diff, dumphtml, dumpserial, edit, loadfile, lock, remove,
243 unlock, upload, viewsource, zip, ziphtml");
247 $properties['Access Log'] =
248 new _define('ACCESS_LOG', "", "
249 PhpWiki can generate an access_log (in \"NCSA combined log\" format)
250 for you. If you want one, define this to the name of the log file,
251 such as /tmp/wiki_access_log.");
255 $properties['Strict Login'] =
256 new boolean_define('ALLOW_BOGO_LOGIN',
257 array('true' => 'Users may Sign In with any WikiWord',
258 'false' => 'Only admin may Sign In'), "
259 If ALLOW_BOGO_LOGIN is true, users are allowed to login (with
260 any/no password) using any userid which: 1) is not the ADMIN_USER,
261 2) is a valid WikiWord (matches \$WikiNameRegexp.)");
265 $properties['Require Sign In Before Editing'] =
266 new boolean_define('REQUIRE_SIGNIN_BEFORE_EDIT',
267 array('false' => 'Do not require Sign In',
268 'true' => 'Require Sign In'), "
269 If set, then if an anonymous user attempts to edit a page he will
270 be required to sign in. (If ALLOW_BOGO_LOGIN is true, of course,
271 no password is required, but the user must still sign in under
272 some sort of BogoUserId.)");
276 $properties['Path for PHP Session Support'] =
277 new _ini_set('session.save_path', 'some_other_directory', "
278 The login code now uses PHP's session support. Usually, the default
279 configuration of PHP is to store the session state information in
280 /tmp. That probably will work fine, but fails e.g. on clustered
281 servers where each server has their own distinct /tmp (this is the
282 case on SourceForge's project web server.) You can specify an
283 alternate directory in which to store state information like so
284 (whatever user your httpd runs as must have read/write permission
285 in this directory):");
289 $properties['Disable PHP Transparent Session ID'] =
290 new unchangeable_variable('session.use_trans_sid', "@ini_set('session.use_trans_sid', 0);", "
291 If your php was compiled with --enable-trans-sid it tries to
292 add a PHPSESSID query argument to all URL strings when cookie
293 support isn't detected in the client browser. For reasons
294 which aren't entirely clear (PHP bug) this screws up the URLs
295 generated by PhpWiki. Therefore, transparent session ids
296 should be disabled. This next line does that.
298 (At the present time, you will not be able to log-in to PhpWiki,
299 or set any user preferences, unless your browser supports cookies.)");
303 $properties['Part Two'] =
304 new part('parttwo', $SEPARATOR."\n", "
312 // MORE CONFIG OPTIONS GO IN HERE
316 $properties['Page Revisions'] =
317 new part('parttworevisions', "
320 The next section controls how many old revisions of each page are
321 kept in the database.
323 There are two basic classes of revisions: major and minor. Which
324 class a revision belongs in is determined by whether the author
325 checked the \"this is a minor revision\" checkbox when they saved the
328 There is, additionally, a third class of revisions: author
329 revisions. The most recent non-mergable revision from each distinct
330 author is and author revision.
332 The expiry parameters for each of those three classes of revisions
333 can be adjusted seperately. For each class there are five
334 parameters (usually, only two or three of the five are actually
335 set) which control how long those revisions are kept in the
338 <dt>max_keep:</dt> <dd>If set, this specifies an absolute maximum for the
339 number of archived revisions of that class. This is
340 meant to be used as a safety cap when a non-zero
341 min_age is specified. It should be set relatively high,
342 and it's purpose is to prevent malicious or accidental
343 database overflow due to someone causing an
344 unreasonable number of edits in a short period of time.</dd>
346 <dt>min_age:</dt> <dd>Revisions younger than this (based upon the supplanted
347 date) will be kept unless max_keep is exceeded. The age
348 should be specified in days. It should be a
349 non-negative, real number,</dd>
351 <dt>min_keep:</dt> <dd>At least this many revisions will be kept.</dd>
353 <dt>keep:</dt> <dd>No more than this many revisions will be kept.</dd>
355 <dt>max_age:</dt> <dd>No revision older than this age will be kept.</dd>
357 Supplanted date: Revisions are timestamped at the instant that they
358 cease being the current revision. Revision age is computed using
359 this timestamp, not the edit time of the page.
361 Merging: When a minor revision is deleted, if the preceding
362 revision is by the same author, the minor revision is merged with
363 the preceding revision before it is deleted. Essentially: this
364 replaces the content (and supplanted timestamp) of the previous
365 revision with the content after the merged minor edit, the rest of
366 the page metadata for the preceding version (summary, mtime, ...)
372 // MORE CONFIG OPTIONS GO IN HERE
376 $properties['Part Three'] =
377 new part('partthree', $SEPARATOR."\n", "
380 Page appearance and layout
385 $properties['Theme'] =
386 new _define_selection('THEME',
387 array('default' => 'default',
388 'Hawaiian' => 'Hawaiian',
389 'MacOSX' => 'MacOSX',
390 'Portland' => 'Portland',
391 'Sidebar' => 'Sidebar',
392 'SpaceWiki' => 'SpaceWiki'), "
395 Most of the page appearance is controlled by files in the theme
398 There are a number of pre-defined themes shipped with PhpWiki.
399 Or you may create your own (e.g. by copying and then modifying one of
404 define('THEME', 'default');
405 define('THEME', 'Hawaiian');
406 define('THEME', 'MacOSX');
407 define('THEME', 'Portland');
408 define('THEME', 'Sidebar');
409 define('THEME', 'SpaceWiki');</pre>");
414 $properties['Character Set'] =
415 new _define('CHARSET', 'iso-8859-1', "
416 Select a valid charset name to be inserted into the xml/html pages,
417 and to reference links to the stylesheets (css). For more info see:
418 http://www.iana.org/assignments/character-sets. Note that PhpWiki
419 has been extensively tested only with the latin1 (iso-8859-1)
422 If you change the default from iso-8859-1 PhpWiki may not work
423 properly and it will require code modifications. However, character
424 sets similar to iso-8859-1 may work with little or no modification
425 depending on your setup. The database must also support the same
426 charset, and of course the same is true for the web browser. (Some
427 work is in progress hopefully to allow more flexibility in this
428 area in the future).");
432 $properties['Language'] =
433 new _variable_selection('LANG',
434 array('C' => 'English',
435 'nl' => 'Nederlands',
442 Select your language/locale - default language is \"C\" for English.
443 Other languages available:<pre>
444 English \"C\" (English - HomePage)
445 Dutch \"nl\" (Nederlands - ThuisPagina)
446 Spanish \"es\" (Español - PáginaPrincipal)
447 French \"fr\" (Français - Accueil)
448 German \"de\" (Deutsch - StartSeite)
449 Swedish \"sv\" (Svenska - Framsida)
450 Italian \"it\" (Italiano - PaginaPrincipale)
452 If you set \$LANG to the empty string, your systems default language
453 (as determined by the applicable environment variables) will be
456 Note that on some systems, apprently using these short forms for
457 the locale won't work. On my home system 'LANG=de' won't result in
458 german pages. Somehow the system must recognize the locale as a
459 valid locale before gettext() will work, i.e., use 'de_DE', 'nl_NL'.");
463 // MORE CONFIG OPTIONS GO IN HERE
467 $properties['Part Four'] =
468 new part('partfour', $SEPARATOR."\n", "
476 $properties['Allowed Protocols'] =
477 new list_variable('AllowedProtocols', "http|https|mailto|ftp|news|nntp|ssh|gopher", "
478 allowed protocols for links - be careful not to allow \"javascript:\"
479 URL of these types will be automatically linked.
480 within a named link [name|uri] one more protocol is defined: phpwiki");
484 $properties['Inline Images'] =
485 new list_variable('InlineImages', "png|jpg|gif", "
486 URLs ending with the following extension should be inlined as images");
490 $properties['WikiName Regexp'] =
491 new _variable('WikiNameRegexp', "(?<![[:alnum:]])(?:[[:upper:]][[:lower:]]+){2,}(?![[:alnum:]])", "
492 Perl regexp for WikiNames (\"bumpy words\")
493 (?<!..) & (?!...) used instead of '\b' because \b matches '_' as well");
497 $properties['InterWiki Map File'] =
498 new _define('INTERWIKI_MAP_FILE', "lib/interwiki.map", "
499 InterWiki linking -- wiki-style links to other wikis on the web
501 The map will be taken from a page name InterWikiMap.
502 If that page is not found (or is not locked), or map
503 data can not be found in it, then the file specified
504 by INTERWIKI_MAP_FILE (if any) will be used.");
508 $properties['Part Five'] =
509 new part('partfive', $SEPARATOR."\n", "
512 URL options -- you can probably skip this section.
517 // MORE CONFIG OPTIONS GO IN HERE
524 // Okay... fire up the code:
527 include \"lib/main.php\";
529 // (c-file-style: \"gnu\")
534 // c-hanging-comment-ender-p: nil
535 // indent-tabs-mode: nil
542 // end of configuration options
543 ///////////////////////////////
544 // begin class definitions
547 * A basic index.php configuration line in the form of a variable.
549 * Produces a string in the form "$name = value;"
551 * $WikiNameRegexp = "value";
555 var $config_item_name;
559 function _variable($config_item_name, $default_value, $description) {
560 $this->config_item_name = $config_item_name;
561 $this->description = $description;
562 $this->default_value = $default_value;
565 function get_config_item_name() {
566 return $this->config_item_name;
569 function get_description() {
570 return $this->description;
573 function get_config_line($posted_value) {
574 return "\n\$" . $this->get_config_item_name() . " = \"" . $posted_value . "\";";
576 function get_config($posted_value) {
577 $d = stripHtml($this->get_description());
578 $d = str_replace("\n", "\n// ", $d) . $this->get_config_line($posted_value) ."\n";
582 function get_instructions($title) {
583 $i = "<p><b><h3>" . $title . "</h3></b></p>\n " . nl2p($this->get_description()) . "\n";
584 return "<tr>\n<td>\n" . $i . "</td>\n";
587 function get_html() {
588 return get_class($this)."<br />\n"."<input type=\"text\" name=\"" . $this->get_config_item_name() . "\" value=\"" . $this->default_value . "\">";
592 class unchangeable_variable extends _variable {
593 function get_html() {
596 function get_config_line($posted_value) {
597 if ($this->description)
599 return "${n}".$this->default_value;
601 function get_instructions($title) {
602 $i = "<p><b><h3>" . $title . "</h3></b></p>\n " . nl2p($this->get_description()) . "\n";
603 $i = $i ."<em>Not editable.</em><br />\n<pre>" . $this->default_value."</pre>";
604 return "<tr>\n<td colspan=\"2\">\n" .$i ."</td></tr>\n";
609 class _variable_selection extends _variable {
610 function get_html() {
611 $output = '<select name="' . $this->get_config_item_name() . "\">\n";
612 /* The first option is the default */
613 while(list($option, $label) = each($this->default_value)) {
614 $output .= " <option value=\"$option\">$label</option>\n";
616 $output .= " </select>\n </td>\n";
617 return get_class($this)."<br />\n".$output;
622 class _define extends _variable {
623 function get_config_line($posted_value) {
624 if ($this->description)
626 if ($posted_value == '')
627 return "${n}//define('".$this->get_config_item_name()."', \"\");";
629 return "${n}define('".$this->get_config_item_name()."', '$posted_value');";
633 class _define_selection extends _variable_selection {
634 function get_config_line($posted_value) {
635 return _define::get_config_line($posted_value);
637 function get_html() {
638 return get_class($this)."<br />\n"._variable_selection::get_html();
642 class _define_password extends _define {
643 function get_config_line($posted_value) {
644 if ($this->description)
646 if ($posted_value == '') {
647 $p = "${n}//define('".$this->get_config_item_name()."', \"\");";
648 $p = $p . "\n// If you used the passencrypt.php utility to encode the password";
649 $p = $p . "\n// then uncomment this line:";
650 $p = $p . "\n//define('ENCRYPTED_PASSWD', true);";
653 if (function_exists('crypt')) {
654 $salt_length = max(CRYPT_SALT_LENGTH,
658 16 * CRYPT_BLOWFISH);
659 // generate an encrypted password
660 $crypt_pass = crypt($posted_value, rand_ascii($salt_length));
661 $p = "${n}define('".$this->get_config_item_name()."', '$crypt_pass');";
662 $p = $p . "\n// If you used the passencrypt.php utility to encode the password";
663 $p = $p . "\n// then uncomment this line:";
664 return $p . "\ndefine('ENCRYPTED_PASSWD', true);";
666 $p = "${n}define('".$this->get_config_item_name()."', '$posted_value');";
667 $p = $p . "\n// If you used the passencrypt.php utility to encode the password";
668 $p = $p . "\n// then uncomment this line:";
669 $p = $p . "\n//define('ENCRYPTED_PASSWD', true);";
670 $p = $p . "\n// Encrypted passwords cannot be used:";
671 $p = $p . "\n// 'function crypt()' not available in this version of php";
676 function get_html() {
677 return get_class($this)."<br />\n"."<input type=\"password\" name=\"" . $this->get_config_item_name() . "\" value=\"" . $this->default_value . "\">";
682 class numeric_define extends _define {
683 function get_config_line($posted_value) {
684 if ($this->description)
686 if ($posted_value == '')
687 return "${n}//define('".$this->get_config_item_name()."', 0);";
689 return "${n}define('".$this->get_config_item_name()."', $posted_value);";
693 class list_variable extends _variable {
694 function get_config_line($posted_value) {
695 // split the phrase by any number of commas or space characters,
696 // which include " ", \r, \t, \n and \f
697 $list_values = preg_split("/[\s,]+/", $posted_value, -1, PREG_SPLIT_NO_EMPTY);
698 $list_values = join("|", $list_values);
699 return _variable::get_config_line($list_values);
701 function get_html() {
702 $list_values = explode("|", $this->default_value);
703 $cols = max(3, count($this->default_value) +1);
704 $list_values = join("\n", $list_values);
705 $ta = "<textarea cols=\"10\" rows=\"". $cols ."\" name=\"".$this->get_config_item_name()."\">";
706 $ta .= $list_values . "</textarea>";
707 return get_class($this)."<br />\n".$ta;
711 class array_variable extends _variable {
712 function get_config_line($posted_value) {
713 // split the phrase by any number of commas or space characters,
714 // which include " ", \r, \t, \n and \f
715 $list_values = preg_split("/[\s,]+/", $posted_value, -1, PREG_SPLIT_NO_EMPTY);
716 if (!empty($list_values)) {
717 $list_values = "'".join("', '", $list_values)."'";
718 $list_values = "array(".$list_values.")";
719 return "\n\$" . $this->get_config_item_name() . " = " . $list_values . ";";
721 return "\n//\$" . $this->get_config_item_name() . " = array();";
723 function get_html() {
724 $list_values = join("\n", $this->default_value);
725 $cols = max(3, count($this->default_value) +1);
726 $ta = "<textarea cols=\"10\" rows=\"". $cols ."\" name=\"".$this->get_config_item_name()."\">";
727 $ta .= $list_values . "</textarea>";
728 return get_class($this)."<br />\n".$ta;
733 class _ini_set extends _variable {
734 function get_config_line($posted_value) {
735 if ($posted_value && ! $posted_value == $this->default_value)
736 return "\nini_set('".$this->get_config_item_name()."', '$posted_value');";
738 return "\n//ini_set('".$this->get_config_item_name()."', '".$this->default_value."');";
742 class boolean_define extends _define {
743 function get_config_line($posted_value) {
744 if ($this->description)
746 return "${n}define('".$this->get_config_item_name()."', $posted_value);";
748 function get_html() {
749 $output = '<select name="' . $this->get_config_item_name() . "\">\n";
750 /* The first option is the default */
751 list($option, $label) = each($this->default_value);
752 $output .= " <option value=\"$option\" selected>$label</option>\n";
753 /* There can only be two options */
754 list($option, $label) = each($this->default_value);
755 $output .= " <option value=\"$option\">$label</option>\n";
756 $output .= "</select>\n </td>\n";
757 return get_class($this)."<br />\n".$output;
761 class part extends _variable {
762 function get_config($posted_value) {
763 $d = stripHtml($this->get_description());
765 return "\n".$SEPARATOR . str_replace("\n", "\n// ", $d) ."\n$this->default_value";
767 function get_instructions($title) {
768 $i = "<p><b><h2>" . $title . "</h2></b></p>\n " . nl2p($this->get_description()) ."\n";
769 return "<tr>\n<td colspan=\"2\" bgcolor=\"#eee\">\n" .$i ."</td></tr>\n";
771 function get_html() {
775 function nl2p($text) {
776 return "<p>" . str_replace("\n\n", "</p>\n<p>", $text) . "</p>";
779 function stripHtml($text) {
780 $d = str_replace("<pre>", "", $text);
781 $d = str_replace("</pre>", "", $d);
782 $d = str_replace("<dl>", "", $d);
783 $d = str_replace("</dl>", "", $d);
784 $d = str_replace("<dt>", "", $d);
785 $d = str_replace("</dt>", "", $d);
786 $d = str_replace("<dd>", "", $d);
787 $d = str_replace("</dd>", "", $d);
788 //restore html entities into characters
789 // http://www.php.net/manual/en/function.htmlentities.php
790 $trans = get_html_translation_table (HTML_ENTITIES);
791 $trans = array_flip ($trans);
792 $d = strtr($d, $trans);
797 * Seed the random number generator.
799 * better_srand() ensures the randomizer is seeded only once.
801 * How random do you want it? See:
802 * http://www.php.net/manual/en/function.srand.php
803 * http://www.php.net/manual/en/function.mt-srand.php
805 function better_srand($seed = '') {
806 static $wascalled = FALSE;
808 $seed = $seed === '' ? (double) microtime() * 1000000 : $seed;
811 //trigger_error("new random seed", E_USER_NOTICE); //debugging
815 function rand_ascii($length = 1) {
817 //srand((double) microtime() * 1000000);
819 for ($i = 1; $i <= $length; $i++) {
820 $s .= chr(rand(40, 126)); // return only typeable 7 bit ascii
825 function printArray($a) {
826 echo "<hr />\n<pre>\n";
828 echo "\n</pre>\n<hr />\n";
831 // end of class definitions
832 /////////////////////////////
833 // begin auto generation code
835 if ($action == 'make_config') {
837 $timestamp = date ('dS of F, Y H:i:s');
840 /* This is a local configuration file for PhpWiki.
841 * It was automatically generated by the configurator script
847 /////////////////////////////////////////////////////////////////////
851 $posted = $GLOBALS['HTTP_POST_VARS'];
853 printArray($GLOBALS['HTTP_POST_VARS']);
858 foreach($properties as $option_name => $a) {
859 $posted_value = $posted[$a->config_item_name];
860 $config .= $properties[$option_name]->get_config($posted_value);
863 $diemsg = "The configurator.php is provided for testing purposes only.\nYou can't use this file with your PhpWiki server yet!!";
864 $config .= "\ndie(\"$diemsg\");\n";
867 /* We first check if the config-file exists. */
868 if (file_exists('defaults.php')) {
869 /* We make a backup copy of the file */
870 $new_filename = 'defaults.' . time() . '.php';
871 if (@copy('defaults.php', $new_filename)) {
872 $fp = @fopen('defaults.php', 'w');
875 $fp = @fopen('defaults.php', 'w');
881 echo "<p>The configuration was written to <code><b>defaults.php</b></code>. A backup was made to <code><b>$new_filename</b></code>.</p>\n";
883 echo "<p>A configuration file could <b>not</b> be written. You should copy the above configuration to a file, and manually save it as <code><b>defaults.php</b></code>.</p>\n";
886 echo "<hr />\n<p>Here's the configuration file based on your answers:</p>\n<pre>\n";
887 echo htmlentities($config);
888 echo "</pre>\n<hr />\n";
890 echo "<!--If she can stand it, I can. Play it!-->\n";
891 echo "<p>Would you like to <a href=\"configurator.php\">play again</a>?</p>\n";
894 /* No action has been specified - we make a form. */
897 <form action="configurator.php" method="post">
898 <table border="1" cellpadding="4" cellspacing="0">
899 <input type="hidden" name="action" value="make_config">
902 while(list($property, $obj) = each($properties)) {
903 echo $obj->get_instructions($property);
904 if ($h = $obj->get_html())
905 echo "<td>".$h."</td>\n";
910 <p><input type="submit" value="Make config-file"> <input type="reset" value="Clear"></p>