diff options
author | Thomas Citharel <tcit@tcit.fr> | 2014-12-22 16:19:29 +0100 |
---|---|---|
committer | Thomas Citharel <tcit@tcit.fr> | 2014-12-22 16:19:29 +0100 |
commit | e51487f93265521cf04d8752b0554bb1f05dd189 (patch) | |
tree | fdd4e5a6890ee09c12ac6ffffee6f53289f97965 /inc | |
parent | f3917b1ee4bba812e82da57dd181f50d62926db4 (diff) | |
download | wallabag-e51487f93265521cf04d8752b0554bb1f05dd189.tar.gz wallabag-e51487f93265521cf04d8752b0554bb1f05dd189.tar.zst wallabag-e51487f93265521cf04d8752b0554bb1f05dd189.zip |
implemented ?random url
Diffstat (limited to 'inc')
-rwxr-xr-x | inc/poche/Poche.class.php | 9 |
1 files changed, 8 insertions, 1 deletions
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 | |||
303 | $this->messages->add('s', _('The tag has been successfully deleted')); | 303 | $this->messages->add('s', _('The tag has been successfully deleted')); |
304 | Tools::redirect(); | 304 | Tools::redirect(); |
305 | break; | 305 | break; |
306 | /* 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 */ | ||
307 | case 'random': | ||
308 | $count = $this->store->getEntriesByViewCount($view, $this->user->getId()); | ||
309 | $id = rand(1,$count); | ||
310 | Tools::logm('get a random article'); | ||
311 | Tools::redirect('?view=view&id=' . $id); | ||
312 | //$this->displayView('view', $id); | ||
313 | break; | ||
306 | default: | 314 | default: |
307 | break; | 315 | break; |
308 | } | 316 | } |
@@ -445,7 +453,6 @@ class Poche | |||
445 | $tpl_vars['entries'] = $this->store->getEntriesByView($view, $this->user->getId(), $this->pagination->get_limit(), $id); | 453 | $tpl_vars['entries'] = $this->store->getEntriesByView($view, $this->user->getId(), $this->pagination->get_limit(), $id); |
446 | $tpl_vars['page_links'] = $page_links; | 454 | $tpl_vars['page_links'] = $page_links; |
447 | $tpl_vars['nb_results'] = $count; | 455 | $tpl_vars['nb_results'] = $count; |
448 | $tpl_vars['random'] = rand(1,$count); | ||
449 | } | 456 | } |
450 | Tools::logm('display ' . $view . ' view'); | 457 | Tools::logm('display ' . $view . ' view'); |
451 | break; | 458 | break; |