diff options
Diffstat (limited to 'install/index.php')
-rwxr-xr-x | install/index.php | 124 |
1 files changed, 73 insertions, 51 deletions
diff --git a/install/index.php b/install/index.php index 30bc2f6b..bd9e502d 100755 --- a/install/index.php +++ b/install/index.php | |||
@@ -49,6 +49,7 @@ else if (isset($_POST['install'])) { | |||
49 | $errors[] = 'You must install twig before.'; | 49 | $errors[] = 'You must install twig before.'; |
50 | } else { | 50 | } else { |
51 | $continue = true; | 51 | $continue = true; |
52 | $final = false; | ||
52 | $salt = generate_salt(); | 53 | $salt = generate_salt(); |
53 | $content = file_get_contents('inc/poche/config.inc.default.php'); | 54 | $content = file_get_contents('inc/poche/config.inc.default.php'); |
54 | 55 | ||
@@ -142,7 +143,7 @@ else if (isset($_POST['install'])) { | |||
142 | foreach ($moreQueries as $query) { | 143 | foreach ($moreQueries as $query) { |
143 | executeQuery($handle, $query, array()); | 144 | executeQuery($handle, $query, array()); |
144 | } | 145 | } |
145 | $successes[] = 'wallabag is now installed. You can now <a href="index.php?clean=0">access it !</a>'; | 146 | |
146 | 147 | ||
147 | if (!copy('inc/poche/config.inc.default.php', 'inc/poche/config.inc.php')) { | 148 | if (!copy('inc/poche/config.inc.default.php', 'inc/poche/config.inc.php')) { |
148 | $errors[] = 'Installation aborted, impossible to create inc/poche/config.inc.php file. Maybe you don\'t have write access to create it.'; | 149 | $errors[] = 'Installation aborted, impossible to create inc/poche/config.inc.php file. Maybe you don\'t have write access to create it.'; |
@@ -153,6 +154,7 @@ else if (isset($_POST['install'])) { | |||
153 | } | 154 | } |
154 | $content = str_replace("define ('SALT', '');", "define ('SALT', '".$salt."');", $content); | 155 | $content = str_replace("define ('SALT', '');", "define ('SALT', '".$salt."');", $content); |
155 | file_put_contents('inc/poche/config.inc.php', $content); | 156 | file_put_contents('inc/poche/config.inc.php', $content); |
157 | $final = true; | ||
156 | } | 158 | } |
157 | } | 159 | } |
158 | } | 160 | } |
@@ -296,12 +298,12 @@ cursor: pointer; | |||
296 | } | 298 | } |
297 | .compatibity_result { | 299 | .compatibity_result { |
298 | margin: auto; | 300 | margin: auto; |
299 | max-width: 300px; | 301 | max-width: 350px; |
300 | min-height: 50px; | 302 | min-height: 50px; |
301 | line-height: 50px; | 303 | line-height: 50px; |
302 | text-align: center; | 304 | text-align: center; |
303 | margin-bottom: 30px; | 305 | margin-bottom: 30px; |
304 | border-radius: 3px; | 306 | border-radius: 3px; |
305 | } | 307 | } |
306 | 308 | ||
307 | h2, legend { | 309 | h2, legend { |
@@ -329,6 +331,21 @@ border: 1px solid #000; | |||
329 | background-color: #FFF; | 331 | background-color: #FFF; |
330 | color: #000; | 332 | color: #000; |
331 | } | 333 | } |
334 | .final { | ||
335 | margin-top: 10%; | ||
336 | margin-left: 30%; | ||
337 | max-width: 400px; | ||
338 | text-align: center; | ||
339 | border-radius: 6px; | ||
340 | } | ||
341 | .final h1 { | ||
342 | line-height: 50px; | ||
343 | } | ||
344 | |||
345 | .final em { | ||
346 | margin-top: 40px; | ||
347 | font-size: 12px; | ||
348 | } | ||
332 | 349 | ||
333 | </style> | 350 | </style> |
334 | 351 | ||
@@ -346,7 +363,8 @@ border: 1px solid #000; | |||
346 | <li><a href="http://doc.wallabag.org/" target="_blank">Online doc</a></li> | 363 | <li><a href="http://doc.wallabag.org/" target="_blank">Online doc</a></li> |
347 | <li><a href="http://support.wallabag.org/" target="_blank">help</a></li> | 364 | <li><a href="http://support.wallabag.org/" target="_blank">help</a></li> |
348 | <li><a href="http://www.wallabag.org/" target="_blank">wallabag.org</a></li> | 365 | <li><a href="http://www.wallabag.org/" target="_blank">wallabag.org</a></li> |
349 | </ul> | 366 | </ul> |
367 | <?php if (!$final) : ?> | ||
350 | <?php if (!empty($errors)) : ?> | 368 | <?php if (!empty($errors)) : ?> |
351 | <div class='messages error install'> | 369 | <div class='messages error install'> |
352 | <p>Errors during installation:</p> | 370 | <p>Errors during installation:</p> |
@@ -386,10 +404,10 @@ border: 1px solid #000; | |||
386 | <?php if (isOkay()) { ?> | 404 | <?php if (isOkay()) { ?> |
387 | <div class="compatibity_result detail good">All good</div> | 405 | <div class="compatibity_result detail good">All good</div> |
388 | <?php } elseif (isPassing()) { ?> | 406 | <?php } elseif (isPassing()) { ?> |
389 | <div class="compatibity_result detail pass">Some problems, but it's OK !</div> | 407 | <div class="compatibity_result detail pass">Some warnings, but the minimum is here !</div> |
390 | <?php } else { ?> | 408 | <?php } else { ?> |
391 | <div class="compatibity_result detail bad">Bad news : you can't run wallabag</div> | 409 | <div class="compatibity_result detail bad">Bad news : you can't run wallabag</div> |
392 | <?php } $status = status(); ?> | 410 | <?php } $status = status(); $pdo_drivers = pdoDrivers(); ?> |
393 | </div> | 411 | </div> |
394 | 412 | ||
395 | <div class="details"> | 413 | <div class="details"> |
@@ -569,38 +587,54 @@ php composer.phar install</code></pre> | |||
569 | <p> | 587 | <p> |
570 | Database engine: | 588 | Database engine: |
571 | <ul> | 589 | <ul> |
572 | <li><label for="sqlite">SQLite</label> <input name="db_engine" type="radio" checked="" id="sqlite" value="sqlite" /> | 590 | <li> |
573 | <div id="pdo_sqlite" class='messages error install'> | 591 | <?php if ($pdo_drivers['sqlite']) { ?> |
574 | <p>You have to enable <a href="http://php.net/manual/ref.pdo-sqlite.php">pdo_sqlite extension</a>.</p> | 592 | <label for="sqlite">SQLite</label> <input name="db_engine" type="radio" checked="" id="sqlite" value="sqlite" /> |
575 | </div> | 593 | <?php } else { ?> |
576 | </li> | 594 | <div class="messages notice"> |
577 | <li> | 595 | <p>You have to enable <a href="http://php.net/manual/ref.pdo-sqlite.php">pdo_sqlite extension</a> to use SQLite.</p> |
578 | <label for="mysql">MySQL</label> <input name="db_engine" type="radio" id="mysql" value="mysql" /> | 596 | </div> |
579 | <div id="pdo_mysql" class='messages notice install'> | 597 | <?php } ?> |
580 | <p>All fields have to be filled.</p> | 598 | </li> |
581 | </div> | 599 | <li> |
582 | <ul id="mysql_infos"> | 600 | <?php if ($pdo_drivers['mysql']) { ?> |
583 | <li><label for="mysql_server">Server</label> <input type="text" placeholder="localhost" id="mysql_server" name="mysql_server" /></li> | 601 | <label for="mysql">MySQL</label> <input name="db_engine" type="radio" id="mysql" value="mysql" /> |
584 | <li><label for="mysql_database">Database</label> <input type="text" placeholder="wallabag" id="mysql_database" name="mysql_database" /></li> | 602 | <div id="pdo_mysql" class='messages notice install'> |
585 | <li><label for="mysql_user">User</label> <input type="text" placeholder="user" id="mysql_user" name="mysql_user" /></li> | 603 | <p>All fields have to be filled.</p> |
586 | <li><label for="mysql_password">Password</label> <input type="password" placeholder="p4ssw0rd" id="mysql_password" name="mysql_password" /></li> | 604 | </div> |
587 | <li><label for="mysql_utf8_mb4">Use UTF-8 MB4</label> <input id="mysql_utf8_mb4" type="checkbox" name="mysql_utf8_mb4"> | 605 | <ul id="mysql_infos"> |
588 | <div id="utf8_mb4_infos"><em>Warning :</em> UTF-8 MB4 is used to fully support unicode characters. It is available only with MySQL starting with version 5.5.3. | 606 | <li><label for="mysql_server">Server</label> <input type="text" placeholder="localhost" id="mysql_server" name="mysql_server" /></li> |
607 | <li><label for="mysql_database">Database</label> <input type="text" placeholder="wallabag" id="mysql_database" name="mysql_database" /></li> | ||
608 | <li><label for="mysql_user">User</label> <input type="text" placeholder="user" id="mysql_user" name="mysql_user" /></li> | ||
609 | <li><label for="mysql_password">Password</label> <input type="password" placeholder="p4ssw0rd" id="mysql_password" name="mysql_password" /></li> | ||
610 | <li><label for="mysql_utf8_mb4">Use UTF-8 MB4</label> <input id="mysql_utf8_mb4" type="checkbox" name="mysql_utf8_mb4"> | ||
611 | <div id="utf8_mb4_infos"><em>Warning :</em> UTF-8 MB4 is used to fully support unicode characters. It is available only with MySQL starting with version 5.5.3. | ||
589 | Install will failed if you check this while using an older MySQL server.</div></li> | 612 | Install will failed if you check this while using an older MySQL server.</div></li> |
590 | </ul> | 613 | </ul> |
591 | </li> | 614 | <?php } else { ?> |
592 | <li> | 615 | <div class="messages notice"> |
593 | <label for="postgres">PostgreSQL</label> <input name="db_engine" type="radio" id="postgres" value="postgres" /> | 616 | <p>You have to enable <a href="http://php.net/manual/ref.pdo-mysql.php">pdo_mysql extension</a> to use MySQL.</p> |
594 | <div id="pdo_postgres" class='messages notice install'> | 617 | </div> |
618 | <?php } ?> | ||
619 | </li> | ||
620 | <li> | ||
621 | <?php if ($pdo_drivers['postgres']) { ?> | ||
622 | <label for="postgres">PostgreSQL</label> <input name="db_engine" type="radio" id="postgres" value="postgres" /> | ||
623 | <div id="pdo_postgres" class='messages notice install'> | ||
595 | <p>All fields have to be filled.</p> | 624 | <p>All fields have to be filled.</p> |
596 | </div> | 625 | </div> |
597 | <ul id="pg_infos"> | 626 | <ul id="pg_infos"> |
598 | <li><label for="pg_server">Server</label> <input type="text" placeholder="localhost" id="pg_server" name="pg_server" /></li> | 627 | <li><label for="pg_server">Server</label> <input type="text" placeholder="localhost" id="pg_server" name="pg_server" /></li> |
599 | <li><label for="pg_database">Database</label> <input type="text" placeholder="wallabag" id="pg_database" name="pg_database" /></li> | 628 | <li><label for="pg_database">Database</label> <input type="text" placeholder="wallabag" id="pg_database" name="pg_database" /></li> |
600 | <li><label for="pg_user">User</label> <input type="text" placeholder="user" id="pg_user" name="pg_user" /></li> | 629 | <li><label for="pg_user">User</label> <input type="text" placeholder="user" id="pg_user" name="pg_user" /></li> |
601 | <li><label for="pg_password">Password</label> <input type="password" placeholder="p4ssw0rd" id="pg_password" name="pg_password" /></li> | 630 | <li><label for="pg_password">Password</label> <input type="password" placeholder="p4ssw0rd" id="pg_password" name="pg_password" /></li> |
602 | </ul> | 631 | </ul> |
603 | </li> | 632 | <?php } else { ?> |
633 | <div class="messages notice"> | ||
634 | <p>You have to enable <a href="https://php.net/manual/ref.pdo-pgsql.php">pdo_pgsql extension</a> to use PostgreSQL.</p> | ||
635 | </div> | ||
636 | <?php } ?> | ||
637 | </li> | ||
604 | </ul> | 638 | </ul> |
605 | </p> | 639 | </p> |
606 | </fieldset> | 640 | </fieldset> |
@@ -638,6 +672,12 @@ php composer.phar install</code></pre> | |||
638 | </div> | 672 | </div> |
639 | </form> | 673 | </form> |
640 | </div> | 674 | </div> |
675 | <?php else : ?> | ||
676 | <div class="final good"> | ||
677 | <h1>wallabag is now installed ! :-) </h1> | ||
678 | <a href="index.php?clean=0">Click here to access the login form</a><br /> | ||
679 | <em>The installation will now try to delete the install directory. If this fails, delete it manually.</em></div> | ||
680 | <?php endif; ?> | ||
641 | <script> | 681 | <script> |
642 | <?php if (!is_dir('vendor')) : ?> | 682 | <?php if (!is_dir('vendor')) : ?> |
643 | $(".database_info").hide(); | 683 | $(".database_info").hide(); |
@@ -672,17 +712,6 @@ php composer.phar install</code></pre> | |||
672 | endif; | 712 | endif; |
673 | ?> | 713 | ?> |
674 | 714 | ||
675 | <?php | ||
676 | if (!extension_loaded('pdo_sqlite')) : ?> | ||
677 | $("#install_button").hide(); | ||
678 | <?php | ||
679 | else : | ||
680 | ?> | ||
681 | $("#pdo_sqlite").hide(); | ||
682 | <?php | ||
683 | endif; | ||
684 | ?> | ||
685 | |||
686 | $("#mysql_utf8_mb4").click(function() { | 715 | $("#mysql_utf8_mb4").click(function() { |
687 | $("#utf8_mb4_infos").toggle(); | 716 | $("#utf8_mb4_infos").toggle(); |
688 | }); | 717 | }); |
@@ -720,13 +749,6 @@ php composer.phar install</code></pre> | |||
720 | $("#sqlite_description").show(); | 749 | $("#sqlite_description").show(); |
721 | $("#mysql_description").hide(); | 750 | $("#mysql_description").hide(); |
722 | $("#postgres_description").hide(); | 751 | $("#postgres_description").hide(); |
723 | <?php | ||
724 | if (!extension_loaded('pdo_sqlite')) : ?> | ||
725 | $("#pdo_sqlite").show(); | ||
726 | $("#install_button").hide(); | ||
727 | <?php | ||
728 | endif; | ||
729 | ?> | ||
730 | } | 752 | } |
731 | } | 753 | } |
732 | }); | 754 | }); |