public function vote($arguments) { if (!CheckAcl::can('voteOnArticles')) { return Error::set('You can not vote on articles.'); } if (empty($arguments[0]) || empty($arguments[1])) { return Error::set('Vote or article id not found.'); } $articles = new articles(ConnectionFactory::get('mongo')); $result = $articles->castVote($arguments[0], $arguments[1]); $post = $articles->get($arguments[0], false, true); if (is_string($result)) { return Error::set($result, false, array('Back' => Url::format('/article/view/' . Id::create($post, 'news')))); } Error::set('Vote cast!', true, array('Back' => Url::format('/article/view/' . Id::create($post, 'news')))); }