X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=install%2Findex.php;h=31c15f89f2850105d2bdcc2d00f7a711eb7ce8ac;hb=0a749cff880e40d25f0988fedb65217e40145245;hp=bd9e502d95b8fcb1b412615f496eb90d6b44159c;hpb=11ef4de52d387ef2a93bd9bbaf00b745f2bbf3e4;p=github%2Fwallabag%2Fwallabag.git diff --git a/install/index.php b/install/index.php index bd9e502d..31c15f89 100755 --- a/install/index.php +++ b/install/index.php @@ -11,12 +11,18 @@ $errors = array(); $successes = array(); +$final = false; + require_once('install_functions.php'); if (isset($_GET['clean'])) { if (is_dir('install')){ - delTree('install'); - header('Location: index.php'); + delTree('install'); + header('Location: index.php'); + } + if (is_dir('cache')) { + delTree('cache', false); + header('Location: index.php'); } } @@ -49,7 +55,6 @@ else if (isset($_POST['install'])) { $errors[] = 'You must install twig before.'; } else { $continue = true; - $final = false; $salt = generate_salt(); $content = file_get_contents('inc/poche/config.inc.default.php'); @@ -82,6 +87,7 @@ else if (isset($_POST['install'])) { $handle = new PDO($db_path, $_POST['mysql_user'], $_POST['mysql_password'], array( PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4', )); + $content = str_replace("define ('MYSQL_USE_UTF8MB4', FALSE);", "define ('MYSQL_USE_UTF8MB4', TRUE);", $content); } else { // regular UTF8 $db_path = 'mysql:host=' . $_POST['mysql_server'] . ';dbname=' . $_POST['mysql_database']; $handle = new PDO($db_path, $_POST['mysql_user'], $_POST['mysql_password']); @@ -125,6 +131,14 @@ else if (isset($_POST['install'])) { } } } + + $usertest = executeQuery($handle,"SELECT * from users WHERE username = ?", array($username)); + if (!empty($usertest)) { + $continue = false; + $errors[] = "An user already exists with this username in database."; + } + + if ($continue) { $sql = "INSERT INTO users (username, password, name, email) VALUES (?, ?, ?, '')"; $params = array($username, $salted_password, $username); @@ -392,8 +406,10 @@ border: 1px solid #000;
@@ -521,8 +537,16 @@ border: 1px solid #000;