Example #1
0
 /**
  * Редактирование комментария:
  */
 public static function EditComment($id, $params, $safeMode = true)
 {
     if (Blog_BlogPostsModel::PostExists($params['post_id'])) {
         $session = Session::getInstance();
         $cache = KVS::getInstance();
         // Обработка:
         $params['text'] = TexyHelper::markup($params['text'], !$session->isAdminSession());
         $record = array('text' => $params['text']);
         if (!$safeMode) {
             $record = array_merge($record, array('special_comment' => @$params['special_comment']));
         }
         $dbh = PDOQuery::getInstance();
         $dbh->update('1chan_comment', $record, 'id = ' . $dbh->q($id));
         EventModel::getInstance()->Broadcast('edit_comment', $record);
         return $id;
     }
     return false;
 }
Example #2
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('>>' . $board_name . '/' . $id);
             return $link;
         }
         return '>>' . $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 {
         '>>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('>>news/' . $id);
     return $link;
 }