diff --git a/defaults.php b/defaults.php index 4525d92..12c8255 100755 --- a/defaults.php +++ b/defaults.php @@ -40,6 +40,7 @@ // blog configurations files define('CONFIG_DIR', FP_CONTENT . 'config/'); //must be chmodded to 0777 define('CONFIG_FILE', CONFIG_DIR . 'settings.conf.php'); + define('HASHSALT_FILE', CONFIG_DIR . 'hashsalt.conf.php'); define('CONFIG_DEFAULT', FP_DEFAULTS. 'settings-defaults.php'); define('USERS_DIR', FP_CONTENT . 'users/'); diff --git a/fp-includes/core/core.system.php b/fp-includes/core/core.system.php index 4cbafbf..4efcd94 100755 --- a/fp-includes/core/core.system.php +++ b/fp-includes/core/core.system.php @@ -63,6 +63,15 @@ //} else die('Wrong number of parameters!'); } + + function system_hashsalt_save($force=false) { + global $fp_config; + if ($force || !file_exists(HASHSALT_FILE)) + return system_save(HASHSALT_FILE, array('fp_hashsalt'=>$fp_config['general']['blogid'] . ABS_PATH . BLOG_BASEURL .mt_rand())); + return true; + } + + define('SYSTEM_VER', '0.704'); function system_ver() { diff --git a/fp-includes/core/core.wp-pluggable-funcs.php b/fp-includes/core/core.wp-pluggable-funcs.php index 3982194..2b32955 100755 --- a/fp-includes/core/core.wp-pluggable-funcs.php +++ b/fp-includes/core/core.wp-pluggable-funcs.php @@ -340,8 +340,13 @@ if ( !function_exists('wp_salt') ) : function wp_salt() { global $fp_config; static $salt = null; - if (!$salt) - $salt = $fp_config['general']['blogid'] . ABS_PATH . BLOG_BASEURL ; + if (!$salt) { + @include(HASHSALT_FILE); + if (!$fp_hashsalt) + trigger_error('Cannot load hash salt: reinstall FlatPress', E_USER_ERROR); + + $salt = $fp_hashsalt; + } return $salt; } endif; diff --git a/setup/lib/main.lib.php b/setup/lib/main.lib.php index eec2981..3e82b47 100644 --- a/setup/lib/main.lib.php +++ b/setup/lib/main.lib.php @@ -128,7 +128,7 @@ function validate() { $fp_config['general']['author'] = $user['userid'] = $_POST['fpuser']; $user['password'] = $_POST['fppwd']; - $user['www'] = $_POST['www']; + $fp_config['general']['www'] = $user['www'] = $www; $fp_config['general']['email'] = $user['email'] = $_POST['email']; @@ -140,13 +140,15 @@ function validate() { $fp_config['general']['blogid'] = system_generate_id( - BLOG_ROOT. - $user['www']. - $user['email']. - $user['userid'] - ); + BLOG_ROOT. + $user['www']. + $user['email']. + $user['userid'] + ); config_save(); + + system_hashsalt_save(); user_add($user); diff --git a/setup/lib/step2.lib.php b/setup/lib/step2.lib.php index 284a598..3f7c7c6 100644 --- a/setup/lib/step2.lib.php +++ b/setup/lib/step2.lib.php @@ -12,18 +12,23 @@ entry_save(array( 'subject' => $vl['entry']['subject'], 'content' => $vl['entry']['content'] - )); - static_save(array( - 'subject' => $vl['menu']['subject'], - 'content' => $vl['menu']['content'] - ), 'menu'); - static_save(array( - 'subject' => $vl['about']['subject'], - 'content' => $vl['about']['content'] - ), 'about'); + )); + + if (!static_exists('menu')) { + static_save(array( + 'subject' => $vl['menu']['subject'], + 'content' => $vl['menu']['content'] + ), 'menu'); + } + if (!static_exists('about')) { + static_save(array( + 'subject' => $vl['about']['subject'], + 'content' => $vl['about']['content'] + ), 'about'); + } } return $validate; } -?> \ No newline at end of file +?>