From 311baf86befde0557faea614ca4d13bb2bd2cc66 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Sun, 7 Dec 2014 23:36:35 +0100 Subject: implemented random button --- inc/poche/Poche.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 27d6f4a6..2a8037cc 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -445,6 +445,7 @@ class Poche $tpl_vars['entries'] = $this->store->getEntriesByView($view, $this->user->getId(), $this->pagination->get_limit(), $id); $tpl_vars['page_links'] = $page_links; $tpl_vars['nb_results'] = $count; + $tpl_vars['random'] = rand(1,$count); } Tools::logm('display ' . $view . ' view'); break; @@ -812,4 +813,4 @@ class Poche } -} \ No newline at end of file +} -- cgit v1.2.3 From 44b95cb81deae35f58e0058910afde2f2ffb9a60 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Sat, 13 Dec 2014 22:56:30 +0100 Subject: added reload function --- inc/poche/Poche.class.php | 11 ++++++++++- inc/poche/config.inc.default.php | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 27d6f4a6..f5262a8e 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -303,6 +303,15 @@ class Poche $this->messages->add('s', _('The tag has been successfully deleted')); Tools::redirect(); break; + case 'reload_article' : + Tools::logm('reload article'); + $id = $_GET['id']; + $entry = $this->store->retrieveOneById($id, $this->user->getId()); + Tools::logm('reload url ' . $entry['url']); + $url = new Url(base64_encode($entry['url'])); + $this->action('add', $url); + break; + default: break; } @@ -812,4 +821,4 @@ class Poche } -} \ No newline at end of file +} diff --git a/inc/poche/config.inc.default.php b/inc/poche/config.inc.default.php index 3eaee3a3..0d249c64 100755 --- a/inc/poche/config.inc.default.php +++ b/inc/poche/config.inc.default.php @@ -56,6 +56,7 @@ @define ('SHOW_PRINTLINK', '1'); // display or not percent of read in article view. Affects only default theme. @define ('SHOW_READPERCENT', '1'); +@define ('RELOAD_ARTICLE', TRUE); @define ('ABS_PATH', 'assets/'); @define ('DEFAULT_THEME', 'baggy'); -- cgit v1.2.3 From e51487f93265521cf04d8752b0554bb1f05dd189 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Mon, 22 Dec 2014 16:19:29 +0100 Subject: implemented ?random url --- inc/poche/Poche.class.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 2a8037cc..3c7a2c5a 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -303,6 +303,14 @@ class Poche $this->messages->add('s', _('The tag has been successfully deleted')); Tools::redirect(); break; + /* For some unknown reason I can't get displayView() to work here (it redirects to home view afterwards). So here's a dirty fix which redirects directly to URL */ + case 'random': + $count = $this->store->getEntriesByViewCount($view, $this->user->getId()); + $id = rand(1,$count); + Tools::logm('get a random article'); + Tools::redirect('?view=view&id=' . $id); + //$this->displayView('view', $id); + break; default: break; } @@ -445,7 +453,6 @@ class Poche $tpl_vars['entries'] = $this->store->getEntriesByView($view, $this->user->getId(), $this->pagination->get_limit(), $id); $tpl_vars['page_links'] = $page_links; $tpl_vars['nb_results'] = $count; - $tpl_vars['random'] = rand(1,$count); } Tools::logm('display ' . $view . ' view'); break; -- cgit v1.2.3 From a3a9e75e625b78de371dad2d319ee3a84b7a75c2 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Sat, 24 Jan 2015 14:35:03 +0100 Subject: correct a bug when email was not sended when creating a new user --- inc/poche/Routing.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/poche/Routing.class.php b/inc/poche/Routing.class.php index be06a433..a8d00b89 100755 --- a/inc/poche/Routing.class.php +++ b/inc/poche/Routing.class.php @@ -116,7 +116,7 @@ class Routing // update password $this->wallabag->updatePassword($_POST['password'], $_POST['password_repeat']); } elseif (isset($_GET['newuser'])) { - $this->wallabag->createNewUser($_POST['newusername'], $_POST['password4newuser']); + $this->wallabag->createNewUser($_POST['newusername'], $_POST['password4newuser'], $_POST['newuseremail']); } elseif (isset($_GET['deluser'])) { $this->wallabag->deleteUser($_POST['password4deletinguser']); } elseif (isset($_GET['epub'])) { -- cgit v1.2.3 From 42ac69337f6538593e4375a38fb410b13c6cb660 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Mon, 26 Jan 2015 00:16:14 +0100 Subject: fix for spaces in .mobi filenames --- inc/poche/WallabagEBooks.class.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'inc') diff --git a/inc/poche/WallabagEBooks.class.php b/inc/poche/WallabagEBooks.class.php index d31939a1..afcf4dbf 100644 --- a/inc/poche/WallabagEBooks.class.php +++ b/inc/poche/WallabagEBooks.class.php @@ -202,6 +202,9 @@ class WallabagMobi extends WallabagEBooks } $mobi->setContentProvider($content); + // we strip spaces because the browser inside Kindle Devices doesn't likes spaces + $this->bookFileName = str_replace(' ', '_', $this->bookFileName); + // we offer file to download $mobi->download($this->bookFileName.'.mobi'); Tools::logm('Mobi file produced'); -- cgit v1.2.3 From 3829c54bc5ceff31cb72e686b3c020ea2ac2a5b2 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Mon, 26 Jan 2015 17:44:52 +0100 Subject: fix for special caracters in .mobi filenames --- inc/poche/WallabagEBooks.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'inc') diff --git a/inc/poche/WallabagEBooks.class.php b/inc/poche/WallabagEBooks.class.php index afcf4dbf..55831571 100644 --- a/inc/poche/WallabagEBooks.class.php +++ b/inc/poche/WallabagEBooks.class.php @@ -202,8 +202,8 @@ class WallabagMobi extends WallabagEBooks } $mobi->setContentProvider($content); - // we strip spaces because the browser inside Kindle Devices doesn't likes spaces - $this->bookFileName = str_replace(' ', '_', $this->bookFileName); + // the browser inside Kindle Devices doesn't likes special caracters either, we limit to A-z/0-9 + $this->bookFileName = preg_replace('/[^A-Za-z0-9\-]/', '', $this->bookFileName); // we offer file to download $mobi->download($this->bookFileName.'.mobi'); -- cgit v1.2.3 From 89637c2a1dcc114b17a8f7eef493b51315e1a6ac Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Sun, 1 Feb 2015 12:22:14 +0100 Subject: added reload icon and fixed a bug where random could redirect to deleted articles --- inc/poche/Poche.class.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'inc') diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index fb74ab9a..f9928145 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -349,8 +349,11 @@ class Poche /* For some unknown reason I can't get displayView() to work here (it redirects to home view afterwards). So here's a dirty fix which redirects directly to URL */ case 'random': - $count = $this->store->getEntriesByViewCount($view, $this->user->getId()); - $id = rand(1,$count); + $id = 0; + while ($this->store->retrieveOneById($id,$this->user->getId()) == null) { + $count = $this->store->getEntriesByViewCount($view, $this->user->getId()); + $id = rand(1,$count); + } Tools::logm('get a random article'); Tools::redirect('?view=view&id=' . $id); //$this->displayView('view', $id); -- cgit v1.2.3