コード例 #1
0
ファイル: texy.helper.php プロジェクト: postman0/1chan
 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;
 }
コード例 #2
0
ファイル: board.controller.php プロジェクト: postman0/1chan
 /**
  * Удаление поста (ajax):
  */
 public function removeAjaxAction(Application $application)
 {
     $board = new Board_BoardModel($_GET['board']);
     $session = Session::getInstance();
     if ($board->existsPost($_GET['id'])) {
         $post = $board->getPost($_GET['id']);
         if (!empty($post['password']) && $post['password'] == $_GET['password']) {
             if ($board->existsThread($_GET['id'])) {
                 $board->removeThread($_GET['id']);
             } else {
                 $board->removePost($_GET['id']);
             }
             return true;
         }
         if ($session->isAdminSession()) {
             if (@$_GET['delall'] == true) {
                 $board->removePostsByAuthor($_GET['id']);
                 return true;
             } else {
                 if ($board->existsThread($_GET['id'])) {
                     $board->removeThread($_GET['id']);
                 } else {
                     $board->removePost($_GET['id']);
                 }
                 if ($board->getId() != 'alone') {
                     ControlModel::logModEvent(date("d-m-Y H:i:s") . ' ' . $_SESSION['auth']['name'] . '<br /> удалил пост №' . $_GET['id'] . ' в разделе ' . $_GET['board']);
                 }
             }
         }
         return false;
     }
     return true;
 }