aboutsummaryrefslogtreecommitdiff
path: root/public/install.php
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-08-21 16:11:01 +0200
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-08-21 16:11:01 +0200
commitd89b9056cd97f2d114d891a284ea56e6540ff3dc (patch)
tree7517c7e1ab3ac01f7941e1660afe15f86046f78d /public/install.php
parent54541608ac979dfc6044c89cb30493704dcc94c8 (diff)
Màj install.php pour prise en compte token
Le token est généré automatiquement à l'installation si on précise une adresse mail de connexion
Diffstat (limited to 'public/install.php')
-rw-r--r--public/install.php18
1 files changed, 17 insertions, 1 deletions
diff --git a/public/install.php b/public/install.php
index f5801acc6..31c96fb39 100644
--- a/public/install.php
+++ b/public/install.php
@@ -65,6 +65,15 @@ function writeArray ($f, $array) {
}
}
+function small_hash ($txt) {
+ $t = rtrim (base64_encode (hash ('crc32', $txt, true)), '=');
+ $t = str_replace ('+', '-', $t); // Get rid of characters which need encoding in URLs.
+ $t = str_replace ('/', '_', $t);
+ $t = str_replace ('=', '@', $t);
+
+ return $t;
+}
+
// gestion internationalisation
$translates = array ();
$actual = 'en';
@@ -143,6 +152,12 @@ function saveStep2 () {
}
$_SESSION['mail_login'] = addslashes ($_POST['mail_login']);
+ $token = '';
+ if ($_SESSION['mail_login']) {
+ $token = small_hash (time () . $_SESSION['sel'])
+ . small_hash ($_SESSION['base_url'] . $_SESSION['sel']);
+ }
+
$file_data = PUBLIC_PATH . '/data/Configuration.array.php';
$f = fopen ($file_data, 'w');
@@ -151,7 +166,8 @@ function saveStep2 () {
writeArray ($f, array (
'language' => $_SESSION['language'],
'old_entries' => $_SESSION['old_entries'],
- 'mail_login' => $_SESSION['mail_login']
+ 'mail_login' => $_SESSION['mail_login'],
+ 'token' => $token
));
writeLine ($f, ');');
fclose ($f);