Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1:/tmp/cvs-serv32441
Modified Files:
serendipity_admin_installer.inc.php
Log Message:
Fixed the bug which caused problems saving settings...
Index: serendipity_admin_installer.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_admin_installer.inc.php,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- serendipity_admin_installer.inc.php 7 Sep 2003 20:53:23 -0000 1.37
+++ serendipity_admin_installer.inc.php 7 Sep 2003 22:03:13 -0000 1.38
@@ -45,7 +45,7 @@
}
}
-function serendipity_parseTemplate($n) {
+function serendipity_parseTemplate($n, $raw=false) {
global $serendipity;
$config = array();
@@ -72,7 +72,7 @@
// Grep out the name, type and default
preg_match('#\{([^|]+\|[^|]+\|([^}]+)?)\}[^/]+/{2}(.+)#msi', $l, $match);
$c = explode('|', $match[1]);
- $config['categories'][$current][] = array(
+ $config['categories'][$current][] = $configRaw[] = array(
'longname' => $c[0],
'name' => $c[1],
'type' => $c[2],
@@ -80,11 +80,15 @@
'distdefault' => $c[3],
'desc' => $match[3]
);
+
break;
}
}
-
- return $config;
+ if ( $raw ) {
+ return $configRaw;
+ } else {
+ return $config;
+ }
}
function serendipity_guessInput($type, $name, $value='', $default='') {
@@ -364,11 +368,10 @@
global $serendipity, $umask;
// Save all basic config variables to the database
- $p = serendipity_parseTemplate("./serendipity_config_local.tpl");
- foreach($p as $key => $value) {
- foreach ($value as $entry) {
- serendipity_set_config_var($entry['name'], $_POST[$entry['name']]);
- }
+ $p = serendipity_parseTemplate("./serendipity_config_local.tpl", true);
+
+ foreach($p as $key => $entry) {
+ serendipity_set_config_var($entry['name'], $_POST[$entry['name']]);
}
// Create a basic configuration file which gives enough information to open
@@ -385,8 +388,6 @@
}
fwrite($configfp, "<?php\n");
- $v = ( (!$serendipity['versionInstalled']) ? $serendipity['version'] : $serendipity['versionInstalled']);
- fwrite($configfp, "\t\$serendipity['versionInstalled'] = '{$v}';\n");
fwrite($configfp, "\t\$serendipity['dbName'] = '{$_POST['dbName']}';\n");
fwrite($configfp, "\t\$serendipity['dbPrefix'] = '{$_POST['dbPrefix']}';\n");
fwrite($configfp, "\t\$serendipity['dbHost'] = '{$_POST['dbHost']}';\n");
@@ -397,7 +398,7 @@
fclose($configfp);
- chmod('./serendipity_config_local.inc.php', $umask);
+ @chmod('./serendipity_config_local.inc.php', $umask);
return true;
}
@@ -422,8 +423,6 @@
$res = serendipity_installDatabase();
if ( $res !== false ) {
echo ' ' . DONE . '<br />';
- /* Insert all the configurated options */
- serendipity_updateConfiguration();
} else {
echo '<span style="color: #FF0000">- ' . DATABASE_ALREADY_INSTALLED . '</span><br />';
}
@@ -468,7 +467,7 @@
/*
If serendipity is already installed and we are only doing a reconfiguration
*/
- } else {
+ }
$res = serendipity_updateConfiguration();
if ( is_array($res) ) {
echo DIAGNOSTIC_ERROR;
@@ -476,7 +475,7 @@
} else {
echo WRITTEN_N_SAVED;
}
- }
+
break;
default:
|