function dispatch() { $this->page->setTitle(__('page.news')); $user = new User(); if (!$user->isLogged()) { $pd = new \Modl\PostnDAO(); $p = $pd->get($this->fetchGet('s'), $this->fetchGet('n'), $this->fetchGet('i')); if ($p) { if ($p->isMicroblog()) { $this->redirect('blog', [$p->origin, $p->nodeid]); } else { $this->redirect('node', [$p->origin, $p->node, $p->nodeid]); } } else { $this->redirect('login'); } } }
public function getReply() { if (!$this->reply) { return; } $reply = unserialize($this->reply); $pd = new \Modl\PostnDAO(); return $pd->get($reply['origin'], $reply['node'], $reply['nodeid']); }
function ajaxGetPost($origin, $node, $id) { $pd = new \Modl\PostnDAO(); $p = $pd->get($origin, $node, $id); if ($p) { $html = $this->preparePost($p); RPC::call('MovimUtils.pushState', $this->route('news', [$p->origin, $p->node, $p->nodeid])); RPC::call('MovimTpl.fill', '#post_widget', $html); RPC::call('MovimUtils.enableVideos'); // If the post is a reply but we don't have the original if ($p->isReply() && !$p->getReply()) { $reply = unserialize($p->reply); $gi = new GetItem(); $gi->setTo($reply['origin'])->setNode($reply['node'])->setId($reply['nodeid'])->setAskReply(['origin' => $p->origin, 'node' => $p->node, 'nodeid' => $p->nodeid])->request(); } $gi = new GetItem(); $gi->setTo($p->origin)->setNode($p->node)->setId($p->nodeid)->request(); } }