mirror of
https://github.com/moparisthebest/wallabag
synced 2024-12-23 15:58:55 -05:00
Merge remote branch 'upstream/dev' into dev
Conflicts: themes/default/_head.twig
This commit is contained in:
commit
5e07dc8b51
@ -20,7 +20,7 @@ class Poche
|
||||
public $pagination;
|
||||
|
||||
private $currentTheme = '';
|
||||
private $notInstalledMessage = '';
|
||||
private $notInstalledMessage = array();
|
||||
|
||||
# @todo make this dynamic (actually install themes and save them in the database including author information et cetera)
|
||||
private $installedThemes = array(
|
||||
@ -33,28 +33,21 @@ class Poche
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
if (! $this->configFileIsAvailable()) {
|
||||
return;
|
||||
if ($this->configFileIsAvailable()) {
|
||||
$this->init();
|
||||
}
|
||||
|
||||
$this->init();
|
||||
|
||||
if (! $this->themeIsInstalled()) {
|
||||
return;
|
||||
if ($this->themeIsInstalled()) {
|
||||
$this->initTpl();
|
||||
}
|
||||
|
||||
$this->initTpl();
|
||||
|
||||
if (! $this->systemIsInstalled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->store = new Database();
|
||||
$this->messages = new Messages();
|
||||
|
||||
# installation
|
||||
if (! $this->store->isInstalled()) {
|
||||
$this->install();
|
||||
if ($this->systemIsInstalled()) {
|
||||
$this->store = new Database();
|
||||
$this->messages = new Messages();
|
||||
# installation
|
||||
if (! $this->store->isInstalled()) {
|
||||
$this->install();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,7 +87,7 @@ class Poche
|
||||
|
||||
public function configFileIsAvailable() {
|
||||
if (! self::$configFileAvailable) {
|
||||
$this->notInstalledMessage = 'You have to rename <strong>inc/poche/config.inc.php.new</strong> to <strong>inc/poche/config.inc.php</strong>.';
|
||||
$this->notInstalledMessage[] = 'You have to rename inc/poche/config.inc.php.new to inc/poche/config.inc.php.';
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -103,39 +96,44 @@ class Poche
|
||||
}
|
||||
|
||||
public function themeIsInstalled() {
|
||||
$passTheme = TRUE;
|
||||
# Twig is an absolute requirement for Poche to function. Abort immediately if the Composer installer hasn't been run yet
|
||||
if (! self::$canRenderTemplates) {
|
||||
$this->notInstalledMessage = 'Twig does not seem to be installed. Please initialize the Composer installation to automatically fetch dependencies. Have a look at <a href="http://doc.inthepoche.com/doku.php?id=users:begin:install">the documentation.</a>';
|
||||
|
||||
return false;
|
||||
$this->notInstalledMessage[] = 'Twig does not seem to be installed. Please initialize the Composer installation to automatically fetch dependencies. Have a look at <a href="http://doc.inthepoche.com/doku.php?id=users:begin:install">the documentation.</a>';
|
||||
$passTheme = FALSE;
|
||||
}
|
||||
|
||||
if (! is_writable(CACHE)) {
|
||||
$this->notInstalledMessage = '<h1>error</h1><p>You don\'t have write access on cache directory.</p>';
|
||||
$this->notInstalledMessage[] = 'You don\'t have write access on cache directory.';
|
||||
|
||||
self::$canRenderTemplates = false;
|
||||
|
||||
return false;
|
||||
$passTheme = FALSE;
|
||||
}
|
||||
|
||||
# Check if the selected theme and its requirements are present
|
||||
if (! is_dir(THEME . '/' . $this->getTheme())) {
|
||||
$this->notInstalledMessage = 'The currently selected theme (' . $this->getTheme() . ') does not seem to be properly installed (Missing directory: ' . THEME . '/' . $this->getTheme() . ')';
|
||||
if ($this->getTheme() != '' && ! is_dir(THEME . '/' . $this->getTheme())) {
|
||||
$this->notInstalledMessage[] = 'The currently selected theme (' . $this->getTheme() . ') does not seem to be properly installed (Missing directory: ' . THEME . '/' . $this->getTheme() . ')';
|
||||
|
||||
self::$canRenderTemplates = false;
|
||||
|
||||
return false;
|
||||
$passTheme = FALSE;
|
||||
}
|
||||
|
||||
foreach ($this->installedThemes[$this->getTheme()]['requires'] as $requiredTheme) {
|
||||
if (! is_dir(THEME . '/' . $requiredTheme)) {
|
||||
$this->notInstalledMessage = 'The required "' . $requiredTheme . '" theme is missing for the current theme (' . $this->getTheme() . ')';
|
||||
$this->notInstalledMessage[] = 'The required "' . $requiredTheme . '" theme is missing for the current theme (' . $this->getTheme() . ')';
|
||||
|
||||
self::$canRenderTemplates = false;
|
||||
|
||||
return false;
|
||||
$passTheme = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$passTheme) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -147,25 +145,30 @@ class Poche
|
||||
*/
|
||||
public function systemIsInstalled()
|
||||
{
|
||||
$msg = '';
|
||||
$msg = TRUE;
|
||||
|
||||
$configSalt = defined('SALT') ? constant('SALT') : '';
|
||||
|
||||
if (empty($configSalt)) {
|
||||
$msg = '<h1>error</h1><p>You have not yet filled in the SALT value in the config.inc.php file.</p>';
|
||||
} else if (STORAGE == 'sqlite' && ! file_exists(STORAGE_SQLITE)) {
|
||||
$this->notInstalledMessage[] = 'You have not yet filled in the SALT value in the config.inc.php file.';
|
||||
$msg = FALSE;
|
||||
}
|
||||
if (STORAGE == 'sqlite' && ! file_exists(STORAGE_SQLITE)) {
|
||||
Tools::logm('sqlite file doesn\'t exist');
|
||||
$msg = '<h1>error</h1><p>sqlite file doesn\'t exist, you can find it in install folder. Copy it in /db folder.</p>';
|
||||
} else if (is_dir(ROOT . '/install') && ! DEBUG_POCHE) {
|
||||
$msg = '<h1>install folder</h1><p>you have to delete the /install folder before using poche.</p>';
|
||||
} else if (STORAGE == 'sqlite' && ! is_writable(STORAGE_SQLITE)) {
|
||||
$this->notInstalledMessage[] = 'sqlite file doesn\'t exist, you can find it in install folder. Copy it in /db folder.';
|
||||
$msg = FALSE;
|
||||
}
|
||||
if (is_dir(ROOT . '/install') && ! DEBUG_POCHE) {
|
||||
$this->notInstalledMessage[] = 'you have to delete the /install folder before using poche.';
|
||||
$msg = FALSE;
|
||||
}
|
||||
if (STORAGE == 'sqlite' && ! is_writable(STORAGE_SQLITE)) {
|
||||
Tools::logm('you don\'t have write access on sqlite file');
|
||||
$msg = '<h1>error</h1><p>You don\'t have write access on sqlite file.</p>';
|
||||
$this->notInstalledMessage[] = 'You don\'t have write access on sqlite file.';
|
||||
$msg = FALSE;
|
||||
}
|
||||
|
||||
if (! empty($msg)) {
|
||||
$this->notInstalledMessage = $msg;
|
||||
|
||||
if (! $msg) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -363,8 +366,8 @@ class Poche
|
||||
case 'config':
|
||||
$dev = $this->getPocheVersion('dev');
|
||||
$prod = $this->getPocheVersion('prod');
|
||||
$compare_dev = version_compare(POCHE_VERSION, $dev);
|
||||
$compare_prod = version_compare(POCHE_VERSION, $prod);
|
||||
$compare_dev = version_compare(POCHE, $dev);
|
||||
$compare_prod = version_compare(POCHE, $prod);
|
||||
$themes = $this->getInstalledThemes();
|
||||
$tpl_vars = array(
|
||||
'themes' => $themes,
|
||||
|
@ -52,8 +52,6 @@ define ('CACHE', ROOT . '/cache');
|
||||
|
||||
define ('PAGINATION', '10');
|
||||
|
||||
define ('POCHE_VERSION', '1.0.0');
|
||||
|
||||
define ('POCKET_FILE', '/ril_export.html');
|
||||
define ('READABILITY_FILE', '/readability');
|
||||
define ('INSTAPAPER_FILE', '/instapaper-export.html');
|
||||
|
@ -8,6 +8,7 @@
|
||||
* @license http://www.wtfpl.net/ see COPYING file
|
||||
*/
|
||||
|
||||
define ('POCHE', '1.0.0');
|
||||
require_once 'inc/poche/global.inc.php';
|
||||
|
||||
# Start Poche
|
||||
@ -35,7 +36,12 @@ $tpl_vars = array(
|
||||
if (! empty($notInstalledMessage)) {
|
||||
if (! Poche::$canRenderTemplates || ! Poche::$configFileAvailable) {
|
||||
# We cannot use Twig to display the error message
|
||||
die($notInstalledMessage);
|
||||
echo '<h1>Errors</h1><ol>';
|
||||
foreach ($notInstalledMessage as $message) {
|
||||
echo '<li>' . $message . '</li>';
|
||||
}
|
||||
echo '</ol>';
|
||||
die();
|
||||
} else {
|
||||
# Twig is installed, put the error message in the template
|
||||
$tpl_file = Tools::getTplFile('error');
|
||||
|
@ -1,72 +0,0 @@
|
||||
<?php
|
||||
# import script to upgrade from poche 0.3
|
||||
$db_path = 'sqlite:../db/poche.sqlite';
|
||||
$handle = new PDO($db_path);
|
||||
$handle->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
# Requêtes à exécuter pour mettre à jour poche.sqlite en 1.x
|
||||
|
||||
# ajout d'un champ user_id sur la table entries
|
||||
$sql = 'ALTER TABLE entries RENAME TO tempEntries;';
|
||||
$query = $handle->prepare($sql);
|
||||
$query->execute();
|
||||
|
||||
$sql = 'CREATE TABLE entries (id INTEGER PRIMARY KEY, title TEXT, url TEXT, is_read NUMERIC DEFAULT 0, is_fav NUMERIC DEFAULT 0, content BLOB, user_id NUMERIC);';
|
||||
$query = $handle->prepare($sql);
|
||||
$query->execute();
|
||||
|
||||
$sql = 'INSERT INTO entries (id, title, url, is_read, is_fav, content) SELECT id, title, url, is_read, is_fav, content FROM tempEntries;';
|
||||
$query = $handle->prepare($sql);
|
||||
$query->execute();
|
||||
|
||||
# Update tout pour mettre user_id = 1
|
||||
$sql = 'UPDATE entries SET user_id = 1;';
|
||||
$query = $handle->prepare($sql);
|
||||
$query->execute();
|
||||
|
||||
# Changement des flags pour les lus / favoris
|
||||
$sql = 'UPDATE entries SET is_read = 1 WHERE is_read = -1;';
|
||||
$query = $handle->prepare($sql);
|
||||
$query->execute();
|
||||
|
||||
$sql = 'UPDATE entries SET is_fav = 1 WHERE is_fav = -1;';
|
||||
$query = $handle->prepare($sql);
|
||||
$query->execute();
|
||||
|
||||
# Création de la table users
|
||||
$sql = 'CREATE TABLE users (id INTEGER PRIMARY KEY, username TEXT, password TEXT, name TEXT, email TEXT);';
|
||||
$query = $handle->prepare($sql);
|
||||
$query->execute();
|
||||
|
||||
$sql = 'INSERT INTO users (username) SELECT value FROM config WHERE name = "login";';
|
||||
$query = $handle->prepare($sql);
|
||||
$query->execute();
|
||||
|
||||
$sql = "UPDATE users SET password = (SELECT value FROM config WHERE name = 'password')";
|
||||
$query = $handle->prepare($sql);
|
||||
$query->execute();
|
||||
|
||||
# Création de la table users_config
|
||||
$sql = 'CREATE TABLE users_config (id INTEGER PRIMARY KEY, user_id NUMERIC, name TEXT, value TEXT);';
|
||||
$query = $handle->prepare($sql);
|
||||
$query->execute();
|
||||
|
||||
$sql = 'INSERT INTO users_config (user_id, name, value) VALUES (1, "pager", "10");';
|
||||
$query = $handle->prepare($sql);
|
||||
$query->execute();
|
||||
|
||||
$sql = 'INSERT INTO users_config (user_id, name, value) VALUES (1, "language", "en_EN.UTF8");';
|
||||
$query = $handle->prepare($sql);
|
||||
$query->execute();
|
||||
|
||||
# Suppression de la table temporaire
|
||||
$sql = 'DROP TABLE tempEntries;';
|
||||
$query = $handle->prepare($sql);
|
||||
$query->execute();
|
||||
|
||||
# Vidage de la table de config
|
||||
$sql = 'DELETE FROM config;';
|
||||
$query = $handle->prepare($sql);
|
||||
$query->execute();
|
||||
|
||||
echo 'welcome to poche 1.0 !';
|
@ -1,79 +0,0 @@
|
||||
<?php
|
||||
require_once dirname(__FILE__).'/../inc/poche/Tools.class.php';
|
||||
include dirname(__FILE__).'/../inc/poche/define.inc.php';
|
||||
require_once __DIR__ . '/../inc/poche/Database.class.php';
|
||||
$store = new Database();
|
||||
$old_salt = '464v54gLLw928uz4zUBqkRJeiPY68zCX';
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<!--[if lte IE 6]> <html class="no-js ie6 ie67 ie678" lang="en"> <![endif]-->
|
||||
<!--[if lte IE 7]> <html class="no-js ie7 ie67 ie678" lang="en"> <![endif]-->
|
||||
<!--[if IE 8]> <html class="no-js ie8 ie678" lang="en"> <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>updating poche</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>update poche to 1.0-beta3</h1>
|
||||
|
||||
<h2>Changelog</h2>
|
||||
<p>
|
||||
<ul>
|
||||
<li>this awesome updating step</li>
|
||||
<li>error message when install folder exists</li>
|
||||
<li>more tests before installation (write access, etc.)</li>
|
||||
<li>updated README to make installation easier</li>
|
||||
<li>german language thanks to HLFH</li>
|
||||
<li>spanish language thanks to Nitche</li>
|
||||
<li>new file ./inc/poche/myconfig.inc.php created to store language and salt</li>
|
||||
<li><a href="https://github.com/inthepoche/poche/issues/119">#119</a>: salt is now created when installing poche</li>
|
||||
<li><a href="https://github.com/inthepoche/poche/issues/130">#130</a>: robots.txt added</li>
|
||||
<li><a href="https://github.com/inthepoche/poche/issues/136">#136</a>: error during readability import</li>
|
||||
<li><a href="https://github.com/inthepoche/poche/issues/137">#137</a>: mixed content alert in https</li>
|
||||
<li><a href="https://github.com/inthepoche/poche/issues/138">#138</a>: change pattern to parse url with #</li>
|
||||
</ul>
|
||||
</p>
|
||||
<p>To update your poche, please fill the following fields.</p>
|
||||
<p>
|
||||
<form name="update" method="post">
|
||||
<div><label for="login">login:</label> <input type="text" name="login" id="login" /></div>
|
||||
<div><label for="password">password:</label> <input type="password" name="password" id="password" /></div>
|
||||
<div><input type="hidden" name="go" value="ok" /><input type="submit" value="update" /></div>
|
||||
</form>
|
||||
</p>
|
||||
<?php
|
||||
if (isset($_POST['go'])) {
|
||||
if (!empty($_POST['login']) && !empty($_POST['password'])) {
|
||||
$user = $store->login($_POST['login'], sha1($_POST['password'] . $_POST['login'] . $old_salt));
|
||||
if ($user != array()) {
|
||||
$new_salt = md5(time() . $_SERVER['SCRIPT_FILENAME'] . rand());
|
||||
$myconfig_file = '../inc/poche/myconfig.inc.php';
|
||||
if (!is_writable('../inc/poche/')) {
|
||||
die('You don\'t have write access to create ./inc/poche/myconfig.inc.php.');
|
||||
}
|
||||
|
||||
if (!file_exists($myconfig_file))
|
||||
{
|
||||
$fp = fopen($myconfig_file, 'w');
|
||||
|
||||
fwrite($fp, '<?php'."\r\n");
|
||||
fwrite($fp, "define ('POCHE_VERSION', '1.0-beta3');" . "\r\n");
|
||||
fwrite($fp, "define ('SALT', '" . $new_salt . "');" . "\r\n");
|
||||
fwrite($fp, "define ('LANG', 'en_EN.utf8');" . "\r\n");
|
||||
fclose($fp);
|
||||
}
|
||||
# faire une mise à jour de la table users en prenant en compte le nouveau SALT généré
|
||||
$store->updatePassword($user['id'], sha1($_POST['password'] . $_POST['login'] . $new_salt));
|
||||
?>
|
||||
<p><span style="color: green;">your poche is up to date!</span></p>
|
||||
<p><span style="color: red;">don't forget to delete ./install/ folder after the update.</span></p>
|
||||
<p><a href="../">go back to your poche</a></p>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
</html>
|
@ -1,4 +1,4 @@
|
||||
<footer class="w600p center mt3 mb3 smaller txtright">
|
||||
<p>{% trans "powered by" %} <a href="http://inthepoche.com">poche</a></p>
|
||||
{% if constant('DEBUG_POCHE') == 1 %}<p><strong>{% trans "debug mode is on so cache is off." %} {% trans "your poche version:" %}{{constant('POCHE_VERSION')}}. {% trans "storage:" %} {{constant('STORAGE')}}</strong></p>{% endif %}
|
||||
{% if constant('DEBUG_POCHE') == 1 %}<p><strong>{% trans "debug mode is on so cache is off." %} {% trans "your poche version:" %}{{constant('POCHE')}}. {% trans "storage:" %} {{constant('STORAGE')}}</strong></p>{% endif %}
|
||||
</footer>
|
@ -8,4 +8,4 @@
|
||||
<link rel="stylesheet" href="{{ poche_url }}/themes/{{ constant('DEFAULT_THEME') }}/css/messages.css" media="all">
|
||||
<link rel="stylesheet" href="{{ poche_url }}/themes/{{ constant('DEFAULT_THEME') }}/css/print.css" media="print">
|
||||
<link href='//fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
|
||||
<script src="href="{{ poche_url }}/themes/{{ constant('DEFAULT_THEME') }}/js/jquery-2.0.3.min.js"></script>
|
||||
<script src="{{ poche_url }}/themes/{{ constant('DEFAULT_THEME') }}/js/jquery-2.0.3.min.js"></script>
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
<h2>{% trans "Updating poche" %}</h2>
|
||||
<ul>
|
||||
<li>{% trans "your version" %} : <strong>{{ constant('POCHE_VERSION') }}</strong></li>
|
||||
<li>{% trans "your version" %} : <strong>{{ constant('POCHE') }}</strong></li>
|
||||
<li>{% trans "latest stable version" %} : {{ prod }}. {% if compare_prod == -1 %}<strong><a href="http://inthepoche.com/">{% trans "a more recent stable version is available." %}</a></strong>{% else %}{% trans "you are up to date." %}{% endif %}</li>
|
||||
{% if constant('DEBUG_POCHE') == 1 %}<li>{% trans "latest dev version" %} : {{ dev }}. {% if compare_dev == -1 %}<strong><a href="http://inthepoche.com/">{% trans "a more recent development version is available." %}</a></strong>{% else %}{% trans "you are up to date." %}{% endif %}</li>{% endif %}
|
||||
</ul>
|
||||
@ -77,4 +77,4 @@
|
||||
|
||||
<h2>{% trans "Export your poche datas" %}</h2>
|
||||
<p><a href="?export" target="_blank">{% trans "Click here" %}</a> {% trans "to export your poche datas." %}</p>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
@ -188,7 +188,7 @@ a:visited {
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 50px;
|
||||
min-height: 50px;
|
||||
padding-top: 17px;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
|
@ -1,6 +1,11 @@
|
||||
{% extends "layout.twig" %}
|
||||
{% block title %}{% trans "plop" %}{% endblock %}
|
||||
{% block content %}
|
||||
{{ msg|raw }}
|
||||
<p>Don't forget <a href="http://inthepoche.com/doc">the documentation</a>.</p>
|
||||
<h1>Errors</h1>
|
||||
<ol>
|
||||
{% for message in msg %}
|
||||
<li>{{message}}</li>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
<p>Don't forget <a href="http://inthepoche.com/doc">the documentation</a>.</p>
|
||||
{% endblock %}
|
Loading…
Reference in New Issue
Block a user