diff options
Diffstat (limited to 'inc/poche')
-rwxr-xr-x | inc/poche/Poche.class.php | 7 |
1 files changed, 5 insertions, 2 deletions
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 | |||
349 | 349 | ||
350 | /* 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 */ | 350 | /* 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 */ |
351 | case 'random': | 351 | case 'random': |
352 | $count = $this->store->getEntriesByViewCount($view, $this->user->getId()); | 352 | $id = 0; |
353 | $id = rand(1,$count); | 353 | while ($this->store->retrieveOneById($id,$this->user->getId()) == null) { |
354 | $count = $this->store->getEntriesByViewCount($view, $this->user->getId()); | ||
355 | $id = rand(1,$count); | ||
356 | } | ||
354 | Tools::logm('get a random article'); | 357 | Tools::logm('get a random article'); |
355 | Tools::redirect('?view=view&id=' . $id); | 358 | Tools::redirect('?view=view&id=' . $id); |
356 | //$this->displayView('view', $id); | 359 | //$this->displayView('view', $id); |