You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
946 B

  1. <?php
  2. namespace App\Controllers;
  3. use Movim\Controller\Base;
  4. class PostController extends Base
  5. {
  6. public function load()
  7. {
  8. $this->session_only = true;
  9. }
  10. public function dispatch()
  11. {
  12. $this->page->setTitle(__('page.post'));
  13. if (!$this->user) {
  14. $post = \App\Post::where([
  15. 'server' => $this->fetchGet('s'),
  16. 'node' => $this->fetchGet('n'),
  17. 'nodeid' => $this->fetchGet('i'),
  18. 'open' => true
  19. ])->first();
  20. if ($post) {
  21. if ($post->isMicroblog()) {
  22. $this->redirect('blog', [$this->fetchGet('s'), $this->fetchGet('i')]);
  23. } else {
  24. $this->redirect('node', [$this->fetchGet('s'),$this->fetchGet('n'), $this->fetchGet('i')]);
  25. }
  26. } else {
  27. $this->redirect('notfound');
  28. }
  29. }
  30. }
  31. }