diff options
Diffstat (limited to 'inc/poche/Poche.class.php')
-rwxr-xr-x | inc/poche/Poche.class.php | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 4b85d52f..481382ec 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php | |||
@@ -393,13 +393,12 @@ class Poche | |||
393 | 393 | ||
394 | /* 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 */ | 394 | /* 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 */ |
395 | case 'random': | 395 | case 'random': |
396 | $count = $this->store->getEntriesByViewCount($view, $this->user->getId()); | ||
397 | $id_query = $this->store->getRandomId(rand(1,$count)-1, $this->user->getId()); | ||
398 | $id = $id_query[0]; | ||
399 | Tools::logm('get a random article'); | 396 | Tools::logm('get a random article'); |
400 | Tools::redirect('?view=view&id=' . $id[0]); | 397 | if ($this->store->getRandomId($this->user->getId())) { |
401 | 398 | $id = $this->store->getRandomId($this->user->getId())[0]; | |
402 | //$this->displayView('view', $id); | 399 | Tools::redirect('?view=view&id=' . $id[0]); |
400 | Tools::logm('got the article with id ' . $id[0]); | ||
401 | } | ||
403 | break; | 402 | break; |
404 | default: | 403 | default: |
405 | break; | 404 | break; |