]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - install/index.php
1.9.0 version
[github/wallabag/wallabag.git] / install / index.php
index 0d3977bb7255af4eeef941ed41ba38a16090f2ca..31c15f89f2850105d2bdcc2d00f7a711eb7ce8ac 100755 (executable)
@@ -17,8 +17,12 @@ 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');      
     }
 }
 
@@ -83,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']);
@@ -126,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);
@@ -393,8 +406,10 @@ border: 1px solid #000;
                 <?php if (file_exists('inc/poche/config.inc.php') && is_dir('vendor')) : ?>
                 <div class='messages success install'>
                     <p>
-                        wallabag seems already installed. If you want to update it, you only have to delete install folder, then <a href="index.php">reload this page</a>.
+                        <a href="index.php?clean=0">Click here to finish update.</a><br>
+                        If it fails, just delete the install directory.
                     </p>
+                    <p>You may have to clear cache (by going into config screen) after update.</p>
                 </div>
                 <?php endif; ?>    
             <?php endif; ?>
@@ -522,8 +537,16 @@ border: 1px solid #000;
                             <tr class="<?php echo ($status['allow_url_fopen']) ? 'enabled' : 'disabled'; ?>">
                                 <td><a href="http://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen">allow_url_fopen</a></td>
                                 <td>Enabled</td>
-                                <?php echo ($status['allow_url_fopen']) ? '<td class="good">Enabled' : '<td class="bad">Disabled'; ?></td>
-                                <td><?php echo ($status['allow_url_fopen']) ? '<strong>allow_url_fopen:</strong> You have allow_url_fopen enabled.' : '<strong>allow_url_fopen:</strong> Your PHP configuration has allow_url_fopen disabled.  <strong>' . $status['app_name'] . ' will not work here.</strong>' ?></td>
+                                <?php if ($status['allow_url_fopen']) { ?>
+                                <td class="good">Enabled</td>
+                                <td><strong>allow_url_fopen:</strong> You have allow_url_fopen enabled.
+                                <?php } elseif ($status['curl']) { ?>
+                                <td class="pass">Disabled</td>
+                                <td><strong>allow_url_fopen</strong> is disabled, but curl is supported, so it should be ok.</td>
+                                <?php } else { ?>
+                                <td class="bad">Disabled</td>
+                                <td><strong>allow_url_fopen:</strong> Your PHP configuration has allow_url_fopen disabled.
+                                <strong><?php echo $status['app_name']; ?>  will not work here.</strong><?php } ?></td>
                             </tr>
                             <tr class="<?php echo ($status['gettext']) ? 'enabled' : 'disabled'; ?>">
                                 <td><a href="http://php.net/manual/en/book.gettext.php">gettext</a></td>
@@ -684,6 +707,7 @@ php composer.phar install</code></pre>
             $(".database_info").hide();
             $(".usersettings").hide();
             <?php endif ?>
+
             /* 
              * Database showing/hiding
              */ 
@@ -713,6 +737,10 @@ php composer.phar install</code></pre>
             endif;
             ?>
 
+            <?php if (file_exists('inc/poche/config.inc.php') && is_dir('vendor')) : ?>
+                $('.technical').hide();
+            <?php endif ?>
+
             $("#mysql_utf8_mb4").click(function() {
                 $("#utf8_mb4_infos").toggle();
             });