]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - install/index.php
problem with resources and localhost url fix
[github/wallabag/wallabag.git] / install / index.php
index d21371722df3172b9ef435c768a609d111483ef3..b21cec521d0f8b2782acd8c8e977deb90e7bcbd1 100644 (file)
@@ -2,8 +2,8 @@
 $errors = array();
 $successes = array();
 if ($_POST['download']) {
-    if (!file_put_contents("cache/vendor.zip", fopen("http://wllbg.org/vendor", 'r'))) {
-        $errors[] = 'Impossible to download vendor.zip. Please <a href="http://wllbg.org/vendor">download it here manually<∕a> and unzip it in your wallabag folder.';
+    if (!file_put_contents("cache/vendor.zip", fopen("http://static.wallabag.org/files/vendor.zip", 'r'))) {
+        $errors[] = 'Impossible to download vendor.zip. Please <a href="http://wllbg.org/vendor">download it manually<∕a> and unzip it in your wallabag folder.';
     }
     else {
         if (extension_loaded('zip')) {
@@ -129,7 +129,7 @@ else if ($_POST['install']) {
                 $params = array($id_user, 'language', 'en_EN.UTF8');
                 $query = executeQuery($handle, $sql, $params);
 
-                $successes[] = 'wallabag is now installed. Don\'t forget to delete install folder.';
+                $successes[] = 'wallabag is now installed. Don\'t forget to delete install folder. Then, <a href="index.php">reload this page</a>.';
             }
         }
     }
@@ -172,7 +172,7 @@ else if ($_POST['install']) {
                 <li><a href="http://www.wallabag.org/">wallabag.org</a></li>
             </ul> 
             <?php if (!empty($errors)) : ?>
-                <div class='messages error'>
+                <div class='messages error install'>
                     <p>Errors during installation:</p>
                     <p>
                         <ul>
@@ -185,7 +185,7 @@ else if ($_POST['install']) {
                 </div>
             <?php endif; ?>
             <?php if (!empty($successes)) : ?>
-                <div class='messages success'>
+                <div class='messages success install'>
                     <p>
                         <ul>
                         <?php foreach($successes as $success) :?>
@@ -194,6 +194,14 @@ else if ($_POST['install']) {
                         </ul>
                     </p>
                 </div>
+            <?php else : ?>
+                <?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.
+                    </p>
+                </div>
+                <?php endif; ?>    
             <?php endif; ?>
             <p>To install wallabag, you just have to fill the following fields. That's all.</p>
             <p>Don't forget to check your server compatibility <a href="wallabag_compatibility_test.php">here</a>.</p>
@@ -201,7 +209,7 @@ else if ($_POST['install']) {
                 <fieldset>
                     <legend><strong>Technical settings</strong></legend>
                     <?php if (!is_dir('vendor')) : ?>
-                        <div class='messages notice'>wallabag needs twig, a template engine (<a href="http://twig.sensiolabs.org/">?</a>). Two ways to install it: 
+                        <div class='messages notice install'>wallabag needs twig, a template engine (<a href="http://twig.sensiolabs.org/">?</a>). Two ways to install it: 
                         <ul>
                             <li>automatically download and extract vendor.zip into your wallabag folder. 
                             <p><input type="submit" name="download" value="Download vendor.zip" /></p>
@@ -217,7 +225,11 @@ php composer.phar install</code></pre></li>
                     <p>
                         Database engine:
                         <ul>
-                            <li><label for="sqlite">SQLite</label> <input name="db_engine" type="radio" checked="" id="sqlite" value="sqlite" /></li>
+                            <li><label for="sqlite">SQLite</label> <input name="db_engine" type="radio" checked="" id="sqlite" value="sqlite" />
+                            <div id="pdo_sqlite" class='messages error install'>
+                                <p>You have to enable <a href="http://php.net/manual/ref.pdo-sqlite.php">pdo_sqlite extension</a>.</p>
+                            </div>
+                            </li>
                             <li>
                                 <label for="mysql">MySQL</label> <input name="db_engine" type="radio" id="mysql" value="mysql" />
                                 <ul id="mysql_infos">
@@ -255,26 +267,49 @@ php composer.phar install</code></pre></li>
                     </p>
                 </fieldset>
 
-                <input type="submit" value="Install wallabag" name="install" />
+                <input type="submit" id="install_button" value="Install wallabag" name="install" />
             </form>
         </div>
         <script>
             $("#mysql_infos").hide();
             $("#pg_infos").hide();
+
+            <?php
+            if (!extension_loaded('pdo_sqlite')) : ?>
+            $("#install_button").hide();
+            <?php
+            else :
+            ?>
+            $("#pdo_sqlite").hide();
+            <?php
+            endif;
+            ?>
+
             $("input[name=db_engine]").click(function() 
                 {
                     if ( $("#mysql").prop('checked')) {
                         $("#mysql_infos").show();
                         $("#pg_infos").hide();
+                        $("#pdo_sqlite").hide();
+                        $("#install_button").show();
                     }
                     else {
                         if ( $("#postgresql").prop('checked')) {
                             $("#mysql_infos").hide();
                             $("#pg_infos").show();
+                            $("#pdo_sqlite").hide();
+                            $("#install_button").show();
                         }
                         else {
                             $("#mysql_infos").hide();
                             $("#pg_infos").hide();
+                            <?php
+                            if (!extension_loaded('pdo_sqlite')) : ?>
+                            $("#pdo_sqlite").show();
+                            $("#install_button").hide();
+                            <?php
+                            endif;
+                            ?>
                         }
                     }
                 });