<?php
$errors = array();
$successes = array();
-
-/* Function taken from at http://php.net/manual/en/function.rmdir.php#110489
- * Idea : nbari at dalmp dot com
- * Rights unknown
- * Here in case of .gitignore files
- */
-function delTree($dir) {
- $files = array_diff(scandir($dir), array('.','..'));
- foreach ($files as $file) {
- (is_dir("$dir/$file")) ? delTree("$dir/$file") : unlink("$dir/$file");
- }
- return rmdir($dir);
- }
-
-if (isset($_GET['clean'])) {
- if (is_dir('install')){
- delTree('install');
- header('Location: index.php');
- }
-}
-
if (isset($_POST['download'])) {
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 {
$db_path = 'sqlite:' . realpath('') . '/db/poche.sqlite';
$handle = new PDO($db_path);
- $sql_structure = "";
}
}
else {
$content = file_get_contents('inc/poche/config.inc.php');
+ $sql_structure = '';
if ($_POST['db_engine'] == 'mysql') {
$db_path = 'mysql:host=' . $_POST['mysql_server'] . ';dbname=' . $_POST['mysql_database'];
$params = array($id_user, 'language', 'en_EN.UTF8');
$query = executeQuery($handle, $sql, $params);
- $successes[] = 'wallabag is now installed. You can now <a href="index.php?clean=0">access it !</a>';
+ $successes[] = 'wallabag is now installed. Don\'t forget to delete install folder. Then, <a href="index.php">reload this page</a>.';
}
}
}
<?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>.
+ 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?from=install">here</a>.</p>
+ <p>Don't forget to check your server compatibility <a href="wallabag_compatibility_test.php">here</a>.</p>
<form method="post">
<fieldset>
<legend><strong>Technical settings</strong></legend>
<?php if (!is_dir('vendor')) : ?>
- <div class='messages notice install'>wallabag needs twig, a template engine (<a href="http://twig.sensiolabs.org/">?</a>). Two ways to install it:<br />
+ <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>
<p>
Database engine:
<ul>
- <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="sqlite">SQLite</label> <input name="db_engine" type="radio" checked="" id="sqlite" value="sqlite" /></li>
<li>
<label for="mysql">MySQL</label> <input name="db_engine" type="radio" id="mysql" value="mysql" />
<ul id="mysql_infos">
<li><label for="pg_server">Server</label> <input type="text" placeholder="localhost" id="pg_server" name="pg_server" /></li>
<li><label for="pg_database">Database</label> <input type="text" placeholder="wallabag" id="pg_database" name="pg_database" /></li>
<li><label for="pg_user">User</label> <input type="text" placeholder="user" id="pg_user" name="pg_user" /></li>
- <li><label for="pg_password">Password</label> <input type="text" placeholder="p4ssw0rd" id="pg_password" name="pg_password" /></li>
+ id <li><label for="pg_password">Password</label> <input type="text" placeholder="p4ssw0rd" id="pg_password" name="pg_password" /></li>
</ul>
</li>
</ul>
</p>
</fieldset>
- <input type="submit" id="install_button" value="Install wallabag" name="install" />
+ <input type="submit" 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;
- ?>
}
}
});