summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/helpers/access.php6
-rw-r--r--installer/cli.php2
-rw-r--r--installer/installer.php8
-rw-r--r--installer/web.php2
4 files changed, 13 insertions, 5 deletions
diff --git a/core/helpers/access.php b/core/helpers/access.php
index 9bf9da6c..6540e3b8 100644
--- a/core/helpers/access.php
+++ b/core/helpers/access.php
@@ -590,10 +590,6 @@ class access_Core {
}
static function private_key() {
- if (!($key = module::get_var('core', 'private_key'))) {
- $key = md5(uniqid(mt_rand(), true)) . md5(uniqid(mt_rand(), true));
- module::set_var('core', 'private_key', $key);
- }
- return $key;
+ return module::get_var("core", "private_key");
}
}
diff --git a/installer/cli.php b/installer/cli.php
index fb497635..ee2d6880 100644
--- a/installer/cli.php
+++ b/installer/cli.php
@@ -53,6 +53,8 @@ if (!installer::connect($config)) {
print " username: $user\n";
print " password: $password\n";
print "\n";
+
+ installer::create_private_key();
exit(0);
} catch (Exception $e) {
oops($e->getMessage());
diff --git a/installer/installer.php b/installer/installer.php
index 62523308..32511541 100644
--- a/installer/installer.php
+++ b/installer/installer.php
@@ -94,4 +94,12 @@ class installer {
return array("admin", $password);
}
+
+ static function create_private_key() {
+ $key = md5(uniqid(mt_rand(), true)) . md5(uniqid(mt_rand(), true));
+ if (mysql_query("INSERT INTO `vars` VALUES(NULL, 'core', 'private_key', '$key')")) {
+ } else {
+ throw new Exception(mysql_error());
+ }
+ }
} \ No newline at end of file
diff --git a/installer/web.php b/installer/web.php
index cfae7a33..47d60a34 100644
--- a/installer/web.php
+++ b/installer/web.php
@@ -55,6 +55,8 @@ if (installer::already_installed()) {
try {
list ($user, $password) = installer::create_admin($config);
$content = render("success.html.php", array("user" => $user, "password" => $password));
+
+ installer::create_private_key();
} catch (Exception $e) {
$content = oops($e->getMessage());
}