From 5f9bff0f71b415dd6e9753b7b7f1ad75db8aa481 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Thu, 8 Aug 2013 21:13:37 +0200 Subject: some urls weren't well parsed --- inc/poche/Tools.class.php | 1 + 1 file changed, 1 insertion(+) (limited to 'inc/poche') diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php index d0e43166..4a72bae3 100644 --- a/inc/poche/Tools.class.php +++ b/inc/poche/Tools.class.php @@ -170,6 +170,7 @@ class Tools preg_match('#charset="?(.*)"#si', $meta[0], $encoding); # if charset is found set it otherwise, set it to utf-8 $html_charset = (!empty($encoding[1])) ? strtolower($encoding[1]) : 'utf-8'; + if (empty($encoding[1])) $encoding[1] = 'utf-8'; } else { $html_charset = 'utf-8'; $encoding[1] = ''; -- cgit v1.2.3 From 3d8bded89e880aa28a1b17422c5bb3d9def28026 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Thu, 8 Aug 2013 21:28:37 +0200 Subject: debug false --- inc/poche/config.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/poche') diff --git a/inc/poche/config.inc.php b/inc/poche/config.inc.php index 0958600f..321784d7 100644 --- a/inc/poche/config.inc.php +++ b/inc/poche/config.inc.php @@ -18,7 +18,7 @@ define ('STORAGE_PASSWORD', 'postgres'); # leave blank for sqlite define ('POCHE_VERSION', '1.0-beta1'); define ('MODE_DEMO', FALSE); -define ('DEBUG_POCHE', TRUE); +define ('DEBUG_POCHE', FALSE); define ('CONVERT_LINKS_FOOTNOTES', FALSE); define ('REVERT_FORCED_PARAGRAPH_ELEMENTS', FALSE); define ('DOWNLOAD_PICTURES', FALSE); -- cgit v1.2.3 From d91787589bfd7541a99032cc23243165dc1572c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 9 Aug 2013 08:25:16 +0200 Subject: fix #113 - reading time --- inc/poche/Poche.class.php | 4 ++++ inc/poche/Tools.class.php | 9 +++++++++ 2 files changed, 13 insertions(+) (limited to 'inc/poche') diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 56910bc0..78747e32 100644 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -69,6 +69,10 @@ class Poche $filter = new Twig_SimpleFilter('getDomain', 'Tools::getDomain'); $this->tpl->addFilter($filter); + # filter for reading time + $filter = new Twig_SimpleFilter('getReadingTime', 'Tools::getReadingTime'); + $this->tpl->addFilter($filter); + # Pagination $this->pagination = new Paginator($this->user->getConfigValue('pager'), 'p'); } diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php index 4a72bae3..0eb0d9ea 100644 --- a/inc/poche/Tools.class.php +++ b/inc/poche/Tools.class.php @@ -224,4 +224,13 @@ class Tools return FALSE; } + + public static function getReadingTime($text) { + $word = str_word_count(strip_tags($text)); + $minutes = floor($word / 200); + $seconds = floor($word % 200 / (200 / 60)); + $time = array('minutes' => $minutes, 'seconds' => $seconds); + + return $minutes; + } } \ No newline at end of file -- cgit v1.2.3 From 6c15854448d0977d54d9e8698b6ee7e4af8ec476 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 9 Aug 2013 11:47:37 +0200 Subject: Closed #111 : test of install folder moved before --- inc/poche/Poche.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'inc/poche') diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 78747e32..dc8dbbbb 100644 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -18,6 +18,11 @@ class Poche function __construct() { + if (file_exists('./install') && !DEBUG_POCHE) { + Tools::logm('folder /install exists'); + die('To install your poche with sqlite, copy /install/poche.sqlite in /db and delete the folder /install. you have to delete the /install folder before using poche.'); + } + $this->store = new Database(); $this->init(); $this->messages = new Messages(); @@ -31,11 +36,6 @@ class Poche private function init() { - if (file_exists('./install') && !DEBUG_POCHE) { - Tools::logm('folder /install exists'); - die('the folder /install exists, you have to delete it before using poche.'); - } - Tools::initPhp(); Session::init(); -- cgit v1.2.3 From d8d1542e52e78b481305893a873f613dc60293e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 9 Aug 2013 22:15:40 +0200 Subject: typo --- inc/poche/Poche.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/poche') diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index dc8dbbbb..90bea1fe 100644 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -217,7 +217,7 @@ class Poche ); } else { - Tools::logm('error in view call : entry is NULL'); + Tools::logm('error in view call : entry is null'); } break; default: # home view -- cgit v1.2.3 From b58e261db9f3ea8b9c4c51ef9f0e393942915e21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 9 Aug 2013 23:30:20 +0200 Subject: bug in downloading pictures : article content wasn't updated anymore --- inc/poche/Database.class.php | 7 +++++++ inc/poche/Poche.class.php | 2 ++ 2 files changed, 9 insertions(+) (limited to 'inc/poche') diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php index cd5a9a31..84916b83 100644 --- a/inc/poche/Database.class.php +++ b/inc/poche/Database.class.php @@ -184,6 +184,13 @@ class Database { return $entries; } + public function updateContent($id, $content, $user_id) { + $sql_action = 'UPDATE entries SET content = ? WHERE id=? AND user_id=?'; + $params_action = array($content, $id, $user_id); + $query = $this->executeQuery($sql_action, $params_action); + return $query; + } + public function add($url, $title, $content, $user_id) { $sql_action = 'INSERT INTO entries ( url, title, content, user_id ) VALUES (?, ?, ?, ?)'; $params_action = array($url, $title, $content, $user_id); diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 90bea1fe..2af49acd 100644 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -126,6 +126,8 @@ class Poche $last_id = $this->store->getLastId($sequence); if (DOWNLOAD_PICTURES) { $content = filtre_picture($parametres_url['content'], $url->getUrl(), $last_id); + Tools::logm('updating content article'); + $this->store->updateContent($last_id, $content, $this->user->getId()); } if (!$import) { $this->messages->add('s', _('the link has been added successfully')); -- cgit v1.2.3