コード例 #1
0
ファイル: favorites.model.php プロジェクト: postman0/1chan
 /**
  * Переключение избранного поста:
  */
 public static function ToggleFavoritePost($board, $id)
 {
     $board_obj = new Board_BoardModel($board);
     if ($board_obj->existsPost($id)) {
         $session = Session::getInstance();
         $favorites = $session->persistenceGet('board_favorites', array());
         if (($key = array_search(array($board, $id), $favorites)) !== false) {
             unset($favorites[$key]);
         } else {
             array_unshift($favorites, array($board, $id));
         }
         $session->persistenceSet('board_favorites', $favorites);
         return array_search(array($board, $id), $favorites) !== false;
     }
     return false;
 }
コード例 #2
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;
 }
コード例 #3
0
ファイル: board.controller.php プロジェクト: postman0/1chan
 /**
  * Отписка от раздела:
  */
 public function unsubscribeBoardAjaxAction(Application $application, Template $template)
 {
     $key = Session::getInstance()->getKey();
     return Board_BoardModel::unsubscribeBoard($key, $_GET['board']);
 }