mirror of https://github.com/movim/movim
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
37 lines
946 B
<?php
|
|
|
|
namespace App\Controllers;
|
|
|
|
use Movim\Controller\Base;
|
|
|
|
class PostController extends Base
|
|
{
|
|
public function load()
|
|
{
|
|
$this->session_only = true;
|
|
}
|
|
|
|
public function dispatch()
|
|
{
|
|
$this->page->setTitle(__('page.post'));
|
|
|
|
if (!$this->user) {
|
|
$post = \App\Post::where([
|
|
'server' => $this->fetchGet('s'),
|
|
'node' => $this->fetchGet('n'),
|
|
'nodeid' => $this->fetchGet('i'),
|
|
'open' => true
|
|
])->first();
|
|
|
|
if ($post) {
|
|
if ($post->isMicroblog()) {
|
|
$this->redirect('blog', [$this->fetchGet('s'), $this->fetchGet('i')]);
|
|
} else {
|
|
$this->redirect('node', [$this->fetchGet('s'),$this->fetchGet('n'), $this->fetchGet('i')]);
|
|
}
|
|
} else {
|
|
$this->redirect('notfound');
|
|
}
|
|
}
|
|
}
|
|
}
|