From 5bd04300a34cd7b2f0d6bc90d70dfea266c37774 Mon Sep 17 00:00:00 2001 From: rurban Date: Sun, 15 Sep 2002 16:17:37 +0000 Subject: [PATCH] fixed some minor bugs. preliminary new javascript code from Martin Geisler to validate input and to fold/unfold parts. But before we have to get rid of the tables. git-svn-id: svn://svn.code.sf.net/p/phpwiki/code/trunk@2349 96ab9672-09ca-45d6-a79d-3d69d39ca109 --- configurator.php | 113 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 86 insertions(+), 27 deletions(-) diff --git a/configurator.php b/configurator.php index 271953a5b..3d74bbac2 100644 --- a/configurator.php +++ b/configurator.php @@ -1,5 +1,7 @@ \n", 'iso-8859-1'); ?> @@ -7,14 +9,16 @@ printf("\n", 'iso-8859-1'); "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> - + Configuration tool for PhpWiki 1.3.x - + @@ -181,7 +229,7 @@ $properties["Part Null Settings"] = new unchangeable_variable('_partnullsettings', " define ('PHPWIKI_VERSION', '1.3.4pre'); require \"lib/prepend.php\"; -rcs_id('\$Id: configurator.php,v 1.6 2002-09-08 21:22:11 rurban Exp $');", ""); +rcs_id('\$Id: configurator.php,v 1.7 2002-09-15 16:17:37 rurban Exp $');", ""); $properties["Part One"] = @@ -412,7 +460,7 @@ $dsn_sqldbname = $properties["SQL Database Name"]->value(); $properties["SQL dsn"] = new unchangeable_variable("DBParams['dsn']", - "\$DBParams['dsn'] = \"\$dsn_sqltype://$dsn_sqluser:$dsn_sqlpass@$dsn_sqlhostorsock/$dsn_sqldbname\";", ""); + "\$DBParams['dsn'] = \"\$_dsn_sqltype://{$dsn_sqluser}:{$dsn_sqlpass}@{$dsn_sqlhostorsock}/{$dsn_sqldbname}\";", ""); $properties["dba directory"] = new _variable("DBParams|directory", "/tmp", " @@ -987,10 +1035,10 @@ class _variable { function get_config_item_header() { if (strchr($this->config_item_name,'|')) { list($var,$param) = explode('|',$this->config_item_name); - return "" . $this->prefix . $var . "['" . $param . "']
"; + return "" . $this->prefix . $var . "['" . $param . "']
"; } elseif ($this->config_item_name[0] != '_') - return "" . $this->prefix . $this->config_item_name . "
"; + return "" . $this->prefix . $this->config_item_name . "
"; else return ''; } @@ -1010,13 +1058,14 @@ class _variable { } function get_instructions($title) { + global $tdwidth; $i = "

" . $title . "

\n " . nl2p($this->_get_description()) . "\n"; return "\n\n" . $i . "\n"; } function get_html() { return $this->get_config_item_header() . - "get_config_item_name() . "\" value=\"" . $this->default_value . "\">"; + "get_config_item_name() . "\" value=\"" . $this->default_value . "\" />"; } } @@ -1098,7 +1147,7 @@ extends _variable { } function get_html() { return $this->get_config_item_header() . - "get_config_item_name() . "\" value=\"" . $this->default_value . "\">"; + "get_config_item_name() . "\" value=\"" . $this->default_value . "\" />"; } } @@ -1148,8 +1197,8 @@ extends _variable { class numeric_define_commented extends _define { - function _config_format($value) { - return sprintf("define('%s', %s);", $this->get_config_item_name(), $value); + function get_html() { + return numeric_define::get_html(); } function _get_config_line($posted_value) { if ($this->description) @@ -1249,8 +1298,8 @@ extends _variable { function get_html() { global $HTTP_POST_VARS, $HTTP_GET_VARS; $s = $this->get_config_item_header(); - $s .= "get_config_item_name() . "\" value=\"" . $this->default_value . "\">" . -"  "; + $s .= "get_config_item_name() . "\" value=\"" . $this->default_value . "\" />" . +"  "; if ($HTTP_POST_VARS['create'] or $HTTP_GET_VARS['create']) { $new_password = random_good_password(); $this->default_value = $new_password; @@ -1265,6 +1314,10 @@ extends _define { function _config_format($value) { return sprintf("define('%s', %s);", $this->get_config_item_name(), $value); } + function get_html() { + $ori = _define::get_html(); + return substr($ori,0,-2) . " onchange=\"validate_ereg('Sorry, \'%s\' is not an integer.', '^[-+]?[0-9]+$', '" . $this->get_config_item_name() . "', this);" . '" />'; + } function _get_config_line($posted_value) { if ($this->description) $n = "\n"; @@ -1403,8 +1456,13 @@ extends _variable { return "\n".$SEPARATOR . str_replace("\n", "\n// ", $d) ."\n$this->default_value"; } function get_instructions($title) { - $i = "

" . $title . "

\n " . nl2p($this->_get_description()) ."\n"; - return "\n\n" .$i ."\n"; + $group_name = preg_replace("/\W/","",$title); + $i = "\n\n"; + if ($group_name == 'PartZero') $i = "" . $i; + $i .= "

" . $title . "

\n " . nl2p($this->_get_description()) ."\n"; + $i .= ""; + $i .= "

Show options.

"; + return $i ."\n" . "
"; } function get_html() { return ""; @@ -1514,7 +1572,7 @@ function printArray($a) { ///////////////////////////// // begin auto generation code -if ($action == 'make_config') { +if ($HTTP_POST_VARS['action'] == 'make_config') { $timestamp = date ('dS of F, Y H:i:s'); @@ -1548,24 +1606,25 @@ You can't use this file with your PhpWiki server yet!!"; $config .= $end; /* We first check if the config-file exists. */ - if (file_exists('settings.php')) { + if (file_exists($fs_config_file)) { /* We make a backup copy of the file */ - $new_filename = 'settings.' . time() . '.php'; - if (@copy('settings.php', $new_filename)) { - $fp = @fopen('settings.php', 'w'); + // $config_file = 'index-user.php'; + $new_filename = preg_replace('/\.php$/', time() . '.php', $fs_config_file); + if (@copy($fs_config_file, $new_filename)) { + $fp = @fopen($fs_config_file, 'w'); } } else { - $fp = @fopen('settings.php', 'w'); + $fp = @fopen($fs_config_file, 'w'); } if ($fp) { fputs($fp, $config); fclose($fp); - echo "

The configuration was written to settings.php.

\n"; + echo "

The configuration was written to $config_file.

\n"; if ($new_filename) { echo "

A backup was made to $new_filename.

\n"; } - echo "

You must rename or copy this settings.php file to index.php.

\n"; + echo "

You must rename or copy this $config_file file to index.php.

\n"; } else { echo "

A configuration file could not be written. You should copy the above configuration to a file, and manually save it as index.php.

\n"; } @@ -1581,7 +1640,7 @@ You can't use this file with your PhpWiki server yet!!"; /* No action has been specified - we make a form. */ echo ' -
+ '; @@ -1596,8 +1655,8 @@ You can't use this file with your PhpWiki server yet!!"; } echo ' -
-

+
+

'; } -- 2.45.0