From 06fef4318047ed8594ba0533ab228ee5838cd86f Mon Sep 17 00:00:00 2001 From: NumEricR Date: Sat, 5 Oct 2013 10:51:25 +0200 Subject: [PATCH 1/6] Fix #255 : increase article toolbar height if necessary --- themes/default/css/style.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/default/css/style.css b/themes/default/css/style.css index eb04f0c..3ef9c82 100644 --- a/themes/default/css/style.css +++ b/themes/default/css/style.css @@ -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; From 2621569200cfc85f2dd6fb77481c9531942c0642 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Mon, 7 Oct 2013 12:39:11 +0200 Subject: [PATCH 2/6] missing } --- themes/default/_head.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/default/_head.twig b/themes/default/_head.twig index dfebd91..9745459 100644 --- a/themes/default/_head.twig +++ b/themes/default/_head.twig @@ -8,4 +8,4 @@ - + From 5eebe4e50dd5da7e87e98c366205ed3266348603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Mon, 7 Oct 2013 13:06:10 +0200 Subject: [PATCH 3/6] delete href --- themes/default/_head.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/default/_head.twig b/themes/default/_head.twig index 9745459..247b929 100644 --- a/themes/default/_head.twig +++ b/themes/default/_head.twig @@ -8,4 +8,4 @@ - + From 9d3b88b3796496b68e762d50904a7ab609edc9c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Mon, 7 Oct 2013 13:12:28 +0200 Subject: [PATCH 4/6] bug fix #266: make installation steps easier --- inc/poche/Poche.class.php | 85 ++++++++++++++++++++------------------- index.php | 7 +++- themes/default/error.twig | 9 ++++- 3 files changed, 57 insertions(+), 44 deletions(-) diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 1ba8e7c..899d735 100644 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -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 inc/poche/config.inc.php.new to inc/poche/config.inc.php.'; + $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 the documentation.'; - - return false; + $this->notInstalledMessage[] = 'Twig does not seem to be installed. Please initialize the Composer installation to automatically fetch dependencies. Have a look at the documentation.'; + $passTheme = FALSE; } if (! is_writable(CACHE)) { - $this->notInstalledMessage = '

error

You don\'t have write access on cache directory.

'; + $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 = '

error

You have not yet filled in the SALT value in the config.inc.php file.

'; - } 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 = '

error

sqlite file doesn\'t exist, you can find it in install folder. Copy it in /db folder.

'; - } else if (is_dir(ROOT . '/install') && ! DEBUG_POCHE) { - $msg = '

install folder

you have to delete the /install folder before using poche.

'; - } 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 = '

error

You don\'t have write access on sqlite file.

'; + $this->notInstalledMessage[] = 'You don\'t have write access on sqlite file.'; + $msg = FALSE; } - if (! empty($msg)) { - $this->notInstalledMessage = $msg; - + if (! $msg) { return false; } diff --git a/index.php b/index.php index 4aebfe1..f1953c2 100644 --- a/index.php +++ b/index.php @@ -35,7 +35,12 @@ $tpl_vars = array( if (! empty($notInstalledMessage)) { if (! Poche::$canRenderTemplates || ! Poche::$configFileAvailable) { # We cannot use Twig to display the error message - die($notInstalledMessage); + echo '

Errors

    '; + foreach ($notInstalledMessage as $message) { + echo '
  1. ' . $message . '
  2. '; + } + echo '
'; + die(); } else { # Twig is installed, put the error message in the template $tpl_file = Tools::getTplFile('error'); diff --git a/themes/default/error.twig b/themes/default/error.twig index c829d12..99eb1ed 100644 --- a/themes/default/error.twig +++ b/themes/default/error.twig @@ -1,6 +1,11 @@ {% extends "layout.twig" %} {% block title %}{% trans "plop" %}{% endblock %} {% block content %} - {{ msg|raw }} -

Don't forget the documentation.

+

Errors

+
    + {% for message in msg %} +
  1. {{message}}
  2. + {% endfor %} +
+

Don't forget the documentation.

{% endblock %} \ No newline at end of file From 031df528b611a5c6639c0d86636633da098d8aa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Mon, 7 Oct 2013 13:19:34 +0200 Subject: [PATCH 5/6] bug fix #268: move POCHE_VERSION in index.php and change the name to avoid conflicts when updating --- inc/poche/Poche.class.php | 4 +- inc/poche/config.inc.php.new | 2 - index.php | 1 + install/update_sqlite_from_0_to_1.php | 72 ------------------------ install/update_to_1beta3.php | 79 --------------------------- themes/default/_footer.twig | 2 +- themes/default/config.twig | 4 +- 7 files changed, 6 insertions(+), 158 deletions(-) delete mode 100644 install/update_sqlite_from_0_to_1.php delete mode 100644 install/update_to_1beta3.php diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 899d735..245f6a1 100644 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -366,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, diff --git a/inc/poche/config.inc.php.new b/inc/poche/config.inc.php.new index 255b97e..99223c7 100755 --- a/inc/poche/config.inc.php.new +++ b/inc/poche/config.inc.php.new @@ -49,8 +49,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'); diff --git a/index.php b/index.php index f1953c2..22696c6 100644 --- a/index.php +++ b/index.php @@ -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 diff --git a/install/update_sqlite_from_0_to_1.php b/install/update_sqlite_from_0_to_1.php deleted file mode 100644 index 299abf4..0000000 --- a/install/update_sqlite_from_0_to_1.php +++ /dev/null @@ -1,72 +0,0 @@ -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 !'; \ No newline at end of file diff --git a/install/update_to_1beta3.php b/install/update_to_1beta3.php deleted file mode 100644 index e0da159..0000000 --- a/install/update_to_1beta3.php +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - updating poche - - -

update poche to 1.0-beta3

- -

Changelog

-

-

    -
  • this awesome updating step
  • -
  • error message when install folder exists
  • -
  • more tests before installation (write access, etc.)
  • -
  • updated README to make installation easier
  • -
  • german language thanks to HLFH
  • -
  • spanish language thanks to Nitche
  • -
  • new file ./inc/poche/myconfig.inc.php created to store language and salt
  • -
  • #119: salt is now created when installing poche
  • -
  • #130: robots.txt added
  • -
  • #136: error during readability import
  • -
  • #137: mixed content alert in https
  • -
  • #138: change pattern to parse url with #
  • -
-

-

To update your poche, please fill the following fields.

-

-

-
-
-
-
-

-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, 'updatePassword($user['id'], sha1($_POST['password'] . $_POST['login'] . $new_salt)); -?> -

your poche is up to date!

-

don't forget to delete ./install/ folder after the update.

-

go back to your poche

- - - \ No newline at end of file diff --git a/themes/default/_footer.twig b/themes/default/_footer.twig index 2b89585..06148a5 100644 --- a/themes/default/_footer.twig +++ b/themes/default/_footer.twig @@ -1,4 +1,4 @@

{% trans "powered by" %} poche

- {% if constant('DEBUG_POCHE') == 1 %}

{% trans "debug mode is on so cache is off." %} {% trans "your poche version:" %}{{constant('POCHE_VERSION')}}. {% trans "storage:" %} {{constant('STORAGE')}}

{% endif %} + {% if constant('DEBUG_POCHE') == 1 %}

{% trans "debug mode is on so cache is off." %} {% trans "your poche version:" %}{{constant('POCHE')}}. {% trans "storage:" %} {{constant('STORAGE')}}

{% endif %}
\ No newline at end of file diff --git a/themes/default/config.twig b/themes/default/config.twig index 0f1aea8..af8ff8c 100644 --- a/themes/default/config.twig +++ b/themes/default/config.twig @@ -5,7 +5,7 @@ {% include '_menu.twig' %} {% endblock %} {% block content %} -

{% trans "Poching a link" %}

+

{% trans "Poching a link" %}

F

{% trans "You can poche a link by several methods:" %} (?)

  • firefox: {% trans "download the extension" %}
  • @@ -23,7 +23,7 @@

    {% trans "Updating poche" %}

    From 894c36ea32d38d425e27dae43a29dcd9e669040e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Mon, 7 Oct 2013 14:00:45 +0200 Subject: [PATCH 6/6] what this f* F? --- themes/default/config.twig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/default/config.twig b/themes/default/config.twig index af8ff8c..13bdaaf 100644 --- a/themes/default/config.twig +++ b/themes/default/config.twig @@ -5,7 +5,7 @@ {% include '_menu.twig' %} {% endblock %} {% block content %} -

    {% trans "Poching a link" %}

    F +

    {% trans "Poching a link" %}

    {% trans "You can poche a link by several methods:" %} (?)