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.1 2002-02-22 07:12:09 carstenklapp Exp $ -->
8 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
12 <h1>Configuration tool for PhpWiki 1.3.x</h1>
14 <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>
18 * The Configurator is a php script to aid in the configuration of PhpWiki.
19 * Parts of this file are based on PHPWeather's configurator.php file.
20 * http://sourceforge.net/projects/phpweather/
22 * TO CHANGE THE CONFIGURATION OF YOUR PHPWIKI, DO *NOT* MODIFY THIS FILE!
23 * more instructions go here
25 * An index.php will be generated for you which you can also modify later if you wish.
29 //////////////////////////////
30 // begin configuration options
35 Copyright 1999, 2000, 2001, 2002 $ThePhpWikiProgrammingTeam = array(
36 "Steve Wainstead", "Clifford A. Adams", "Lawrence Akka",
37 "Scott R. Anderson", "Jon Åslund", "Neil Brown", "Jeff Dairiki",
38 "Stéphane Gourichon", "Jan Hidders", "Arno Hollosi", "John Jorgensen",
39 "Antti Kaihola", "Jeremie Kass", "Carsten Klapp", "Marco Milanesi",
40 "Grant Morgan", "Jan Nieuwenhuizen", "Aredridel Niothke",
41 "Pablo Roca Rozas", "Sandino Araico Sánchez", "Joel Uckelman",
42 "Reini Urban", "Tim Voght");
44 This file is part of PhpWiki.
46 PhpWiki is free software; you can redistribute it and/or modify
47 it under the terms of the GNU General Public License as published by
48 the Free Software Foundation; either version 2 of the License, or
49 (at your option) any later version.
51 PhpWiki is distributed in the hope that it will be useful,
52 but WITHOUT ANY WARRANTY; without even the implied warranty of
53 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
54 GNU General Public License for more details.
56 You should have received a copy of the GNU General Public License
57 along with PhpWiki; if not, write to the Free Software
58 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
64 This is the starting file for PhpWiki. All this file does is set
65 configuration options, and at the end of the file it includes() the
66 file lib/main.php, where the real action begins.
68 This file is divided into six parts: Parts Zero, One, Two, Three,
69 Four and Five. Each one has different configuration settings you can
70 change; in all cases the default should work on your system,
71 however, we recommend you tailor things to your particular setting.
76 $properties['part0'] =
77 new part('Part Zero', false, '
78 Part Zero: If PHP needs help in finding where you installed the
79 rest of the PhpWiki code, you can set the include_path here.');
83 $properties['PHP include_path'] =
84 new iniset('include_path', false, "
85 NOTE: phpwiki uses the PEAR library of php code for SQL database
86 access. Your PHP is probably already configured to set
87 include_path so that PHP can find the pear code. If not (or if you
88 change include_path here) make sure you include the path to the
89 PEAR code in include_path. (To find the PEAR code on your system,
90 search for a file named 'PEAR.php'. Some common locations are:
98 The above examples are already included by PhpWiki. You shouldn't
99 have to change this unless you see a WikiFatalError:
101 lib/FileFinder.php:82: Fatal[256]: DB.php: file not found
103 Define the include path for this wiki: pear plus the phpwiki path
105 $include_path = '.:/Apache/php/pear:/prog/php/phpwiki';
107 Windows needs ';' as path delimiter. cygwin, mac and unix ':'
109 if (substr(PHP_OS,0,3) == 'WIN') {
110 $include_path = implode(';',explode(':',$include_path));
111 } elseif (substr(PHP_OS,0,6) == 'CYGWIN') {
112 $include_path = '.:/usr/local/lib/php/pear:/usr/src/php/phpwiki';
119 $properties['partnull'] =
120 new part('Part Null', "
121 define ('PHPWIKI_VERSION', '1.3.2-jeffs-hacks');
122 require \"lib/prepend.php\";
123 rcs_id('$Id: configurator.php,v 1.1 2002-02-22 07:12:09 carstenklapp Exp $');
125 Part Null: Don't touch this!");
128 $properties['partone'] =
129 new part('Part One', "///////////////////////////////////////////////////////////////////
133 Authentication and security settings:
138 $properties['Wiki Name'] =
139 new defines('WIKI_NAME', ''/*'PhpWiki'*/, "
140 The name of your wiki.
141 This is used to generate a keywords meta tag in the HTML templates,
142 in bookmark titles for any bookmarks made to pages in your wiki,
143 and during RSS generation for the title of the RSS channel.");
147 $properties['Reverse DNS'] =
148 new defines_boolean('ENABLE_REVERSE_DNS',
149 array('true' => 'perform additional reverse dns lookups',
150 'false' => 'just record the address as given by the httpd server'), "
151 If set, we will perform reverse dns lookups to try to convert the
152 users IP number to a host name, even if the http server didn't do
157 $properties['Admin Username'] =
158 new defines('ADMIN_USER', "", "
159 Username and password of administrator.
160 Set these to your preferences. For heaven's sake
161 pick a good password!");
162 $properties['Admin Password'] =
163 new defines('ADMIN_PASSWD', "", "");
167 $properties['ZIPdump Authentication'] =
168 new defines_boolean('ZIPDUMP_AUTH',
169 array('false' => 'everyone',
170 'true' => 'only admin'), "
171 If true, only the admin user can make zip dumps, else zip dumps
172 require no authentication.");
176 $properties['Strict Mailable Pagedumps'] =
177 new defines_boolean('STRICT_MAILABLE_PAGEDUMPS',
178 array('false' => 'binary',
179 'true' => 'quoted-printable'), "
180 If you define this to true, (MIME-type) page-dumps (either zip dumps,
181 or \"dumps to directory\" will be encoded using the quoted-printable
182 encoding. If you're actually thinking of mailing the raw page dumps,
183 then this might be useful, since (among other things,) it ensures
184 that all lines in the message body are under 80 characters in length.
186 Also, setting this will cause a few additional mail headers
187 to be generated, so that the resulting dumps are valid
188 RFC 2822 e-mail messages.
190 Probably, you can just leave this set to false, in which case you get
191 raw ('binary' content-encoding) page dumps.");
195 $properties['Maximum Upload Size'] =
196 new defines_numeric('MAX_UPLOAD_SIZE', "16 * 1024 * 1024", "
197 The maximum file upload size.");
201 $properties['Minor Edit Timeout'] =
202 new defines_numeric('MINOR_EDIT_TIMEOUT', "7 * 24 * 3600", "
203 If the last edit is older than MINOR_EDIT_TIMEOUT seconds, the
204 default state for the \"minor edit\" checkbox on the edit page form
216 // MORE CONFIG OPTIONS GO IN HERE
220 $properties['Character Set'] =
221 new defines('CHARSET', 'iso-8859-1', "
222 Select a valid charset name to be inserted into the xml/html pages,
223 and to reference links to the stylesheets (css). For more info see:
224 http://www.iana.org/assignments/character-sets. Note that PhpWiki
225 has been extensively tested only with the latin1 (iso-8859-1)
228 If you change the default from iso-8859-1 PhpWiki may not work
229 properly and it will require code modifications. However, character
230 sets similar to iso-8859-1 may work with little or no modification
231 depending on your setup. The database must also support the same
232 charset, and of course the same is true for the web browser. (Some
233 work is in progress hopefully to allow more flexibility in this
234 area in the future).");
238 $properties['Language'] =
239 new selection('LANG',
240 array('C' => 'English',
241 'nl' => 'Nederlands',
246 'it' => 'Italiano'), "
247 Select your language/locale - default language is \"C\" for English.
248 Other languages available:<pre>
249 English \"C\" (English - HomePage)
250 Dutch \"nl\" (Nederlands - ThuisPagina)
251 Spanish \"es\" (Español - PáginaPrincipal)
252 French \"fr\" (Français - Accueil)
253 German \"de\" (Deutsch - StartSeite)
254 Swedish \"sv\" (Svenska - Framsida)
255 Italian \"it\" (Italiano - PaginaPrincipale)
257 If you set \$LANG to the empty string, your systems default language
258 (as determined by the applicable environment variables) will be
261 Note that on some systems, apprently using these short forms for
262 the locale won't work. On my home system 'LANG=de' won't result in
263 german pages. Somehow the system must recognize the locale as a
264 valid locale before gettext() will work, i.e., use 'de_DE', 'nl_NL'.");
268 // MORE CONFIG OPTIONS GO IN HERE
272 // end of configuration options
273 ///////////////////////////////
274 // begin class definitions
279 * Produces a string in the form "$name = value;"
281 * $InlineImages = "png|jpg|gif";
285 var $config_item_name;
289 function property($config_item_name, $default_value, $description) {
290 $this->config_item_name = $config_item_name;
291 $this->description = $description;
292 $this->default_value = $default_value;
295 function get_config_item_name() {
296 return $this->config_item_name;
299 function get_description() {
300 return $this->description;
303 function get_config_line($posted_value) {
304 return "\n\$" . $this->get_config_item_name() . " = \"" . $posted_value . "\";";
306 function get_config($posted_value) {
307 $d = str_replace("<pre>", "", $this->get_description());
308 $d = str_replace("</pre>", "", $d);
309 $d = str_replace("\n", "\n// ", $d) . $this->get_config_line($posted_value) ."\n";
313 function get_instructions($title) {
314 $i = "<p><b><h3>" . $title . "</h3></b></p>\n <p>" . str_replace("\n\n", "</p><p>", $this->get_description()) . "</p>\n";
315 return "<tr>\n<td>\n" . $i . "</td>\n";
318 function get_html() {
319 return "<input type=\"text\" name=\"" . $this->get_config_item_name() . "\" value=\"" . $this->default_value . "\">";
323 class selection extends property {
324 function get_html() {
325 $output = '<select name="' . $this->get_config_item_name() . "\">\n";
326 /* The first option is the default */
327 while(list($option, $label) = each($this->default_value)) {
328 $output .= " <option value=\"$option\">$label</option>\n";
330 $output .= " </select>\n </td>\n";
336 class defines extends property {
337 function get_config_line($posted_value) {
338 if ($this->description)
340 if ($posted_value == '')
341 return "${n}//define('".$this->get_config_item_name()."', \"\");";
343 return "${n}define('".$this->get_config_item_name()."', '$posted_value');";
347 class defines_numeric extends property {
348 function get_config_line($posted_value) {
349 if ($this->description)
351 if ($posted_value == '')
352 return "${n}//define('".$this->get_config_item_name()."', 0);";
354 return "${n}define('".$this->get_config_item_name()."', $posted_value);";
358 class iniset extends property {
359 function get_config_line($posted_value) {
361 return "\nini_set('".$this->get_config_item_name()."', '$posted_value');";
363 return "\n//ini_set('".$this->get_config_item_name()."', '\$".$this->get_config_item_name()."');";
367 class defines_boolean extends property {
368 function get_config_line($posted_value) {
369 if ($this->description)
371 return "${n}define('".$this->get_config_item_name()."', $posted_value);";
373 function get_html() {
374 $output = '<select name="' . $this->get_config_item_name() . "\">\n";
375 /* The first option is the default */
376 list($option, $label) = each($this->default_value);
377 $output .= " <option value=\"$option\" selected>$label</option>\n";
378 /* There can only be two options */
379 list($option, $label) = each($this->default_value);
380 $output .= " <option value=\"$option\">$label</option>\n";
381 $output .= "</select>\n </td>\n";
386 class part extends property {
387 function get_config($posted_value) {
388 $separator = "\n/////////////////////////////////////////////////////////////////////";
389 return $separator . str_replace("\n", "\n// ", $this->get_description()) ."\n$this->default_value";
391 function get_instructions($title) {
392 $i = "<h2>".$this->get_config_item_name()."</h2>\n$this->description\n";
393 return "<tr>\n<td colspan=\"2\" bgcolor=\"#eee\">\n" .$i ."</td></tr>\n";
395 function get_html() {
400 // end of class definitions
401 /////////////////////////////
402 // begin auto generation code
404 if ($action == 'make_config') {
406 $timestamp = date ('dS of F, Y H:i:s');
409 /* This is a local configuration file for PhpWiki.
410 * It was automatically generated by the configurator script
416 /////////////////////////////////////////////////////////////////////
420 $posted = $GLOBALS['HTTP_POST_VARS'];
422 echo "<hr /><pre>\n";
423 print_r($GLOBALS['HTTP_POST_VARS']);
424 echo "</pre><hr />\n";
430 foreach($properties as $option_name => $a) {
431 $posted_value = $posted[$a->config_item_name];
432 $config .= $properties[$option_name]->get_config($posted_value);
435 $diemsg = "The configurator.php is provided for testing purposes only.\nYou can't use this file with your PhpWiki server yet!!";
436 $config .= "\ndie(\"$diemsg\");";
439 /* We first check if the config-file exists. */
440 if (file_exists('defaults.php')) {
441 /* We make a backup copy of the file */
442 $new_filename = 'defaults.' . time() . '.php';
443 if (@copy('defaults.php', $new_filename)) {
444 $fp = @fopen('defaults.php', 'w');
447 $fp = @fopen('defaults.php', 'w');
453 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";
455 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";
458 echo "<hr />\n<p>Here's the configuration file based on your answers:</p>\n<pre>\n";
459 echo htmlentities($config);
460 echo "</pre>\n<hr />\n";
462 echo "<!--If she can stand it, I can. Play it!-->\n";
463 echo "<p>Would you like to <a href=\"configurator.php\">play again</a>?</p>\n";
466 /* No action has been specified - we make a form. */
469 <form action="configurator.php" method="post">
470 <table border="1" cellpadding="4" cellspacing="0">
471 <input type="hidden" name="action" value="make_config">
474 while(list($property, $obj) = each($properties)) {
475 echo $obj->get_instructions($property);
476 if ($h = $obj->get_html())
477 echo "<td>".$h."</td>\n";
482 <p><input type="submit" value="Make config-file"> <input type="reset" value="Clear"></p>