Пример #1
0
 /**
  * Действие удаление комментария:
  */
 public function removePostCommentAjaxAction(Application $application)
 {
     if (!Session::getInstance()->isAdminSession()) {
         return false;
     }
     $comment = Blog_BlogCommentsModel::GetComment($_GET['id']);
     $post = Blog_BlogPostsModel::GetPost(@$comment['post_id']);
     if ($comment && $post && ControlModel::checkModrights($post['category'])) {
         Blog_BlogCommentsModel::RemoveComment($_GET['id']);
         ControlModel::logModEvent(date("d-m-Y H:i:s") . ' ' . $_SESSION['auth']['name'] . '<br /> удалил комментарий ' . $comment['id'] . ' в посте <a href="http://' . TemplateHelper::getSiteUrl() . '/news/res/' . $post['id'] . '/" class="js-cross-link">&gt;&gt;' . $post['id'] . '</a>' . '<br /><em>' . strip_tags($comment['text'], 'a') . '</em>');
         JabberBot::send('-=$ /me (модлог) ' . $_SESSION['auth']['name'] . ' удалил комментарий ' . $comment['id'] . ' в посте http://' . TemplateHelper::getSiteUrl() . '/news/res/' . $post['id'] . '/');
         return true;
     }
     return false;
 }
Пример #2
0
 /**
  * Получение коммента:
  */
 public function getPostCommentAjaxAction()
 {
     $cache = KVS::getInstance();
     $comment = Blog_BlogCommentsModel::GetComment($_GET['id']);
     $session = Session::getInstance();
     $session->activeSet('last_visit_post_' . $comment['post_id'], time());
     if ($comment) {
         if ($_GET['title']) {
             $post = Blog_BlogPostsModel::GetPost($comment['post_id']);
             $comment['post_title'] = $post['title'];
         }
         $comment['created_at'] = TemplateHelper::date('d M Y @ H:i', $comment['created_at']);
         $comment['author'] = array($comment['author'], HomeBoardHelper::getBoard($comment['author']));
         unset($comment['ip']);
         return $comment;
     }
     return false;
 }
Пример #3
0
 static function boardpostlink2($parser, $matches, $name)
 {
     list(, $board_name, $id) = $matches;
     $parser->again = false;
     if ($board_name != 'news') {
         $board = new Board_BoardModel($board_name);
         if ($board->existsPost($id)) {
             $post = $board->getPost($id);
             $href = 'http://1chan.ru/' . $board_name . '/res/';
             if ($post['parent_id'] == null) {
                 $href .= $id . '/#top';
             } else {
                 $href .= $post['parent_id'] . '/#' . $id;
             }
             $link = TexyHtml::el('a');
             $link->href($href);
             $link->attrs['class'] = 'js-cross-link';
             $link->attrs['name'] = $board_name . '/' . $id;
             $link->setText('&gt;&gt;' . $board_name . '/' . $id);
             return $link;
         }
         return '&gt;&gt;' . $board_name . '/' . $id;
     }
     if (Blog_BlogCommentsModel::CommentExists($id)) {
         $comment = Blog_BlogCommentsModel::GetComment($id);
         $post_id = $comment['post_id'];
     } elseif (Blog_BlogPostsModel::PostExists($id)) {
         $post_id = $id;
     } else {
         '&gt;&gt;news/' . $id;
     }
     $link = TexyHtml::el('a');
     $link->href('http://1chan.ru/news/res/' . $post_id . '/#' . $id);
     $link->attrs['class'] = 'js-cross-link';
     $link->attrs['name'] = 'news/' . $id;
     $link->setText('&gt;&gt;news/' . $id);
     return $link;
 }
Пример #4
0
 /**
  * Редактирование комментария:
  */
 public function postCommentEditAction(Application $application, Template $template)
 {
     $template->setParameter('menu', 'posts');
     $template->setParameter('submenu', 'post_comments');
     if ($_SERVER['REQUEST_METHOD'] == 'GET') {
         $this['post'] = Blog_BlogCommentsModel::GetComment($_GET['id']);
         return true;
     } else {
         Blog_BlogCommentsModel::EditComment($_POST['id'], $_POST, false);
         $template->headerSeeOther('http://' . TemplateHelper::getSiteUrl() . '/admin/postCommentEdit?id=' . $_POST['id']);
         exit;
     }
     return true;
 }