boards
[ class tree: boards ] [ index: boards ] [ all elements ]

Source for file view_board_inc.php

Documentation is available at view_board_inc.php

  1. <?php
  2. /**
  3.  * $Header$
  4.  * Copyright (c) 2004 bitweaver Messageboards
  5.  * All Rights Reserved. See below for details and a complete list of authors.
  6.  * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details.
  7.  * @package boards
  8.  * @subpackage functions
  9.  */
  10.  
  11. /**
  12.  * required setup
  13.  */
  14. require_once( '../kernel/setup_inc.php' );
  15.  
  16. // Is package installed and enabled
  17. $gBitSystem->verifyPackage( 'boards' );
  18.  
  19. // if we're getting a migrate id then lets move on right away
  20. if ( @BitBase::verifyId( $_REQUEST['migrate_board_id'] ) ) {
  21.     require_once( BOARDS_PKG_PATH.'BitBoard.php' );
  22.  
  23.     if( $_REQUEST['b'] = BitBoard::lookupByMigrateBoard( $_REQUEST['migrate_board_id'] ) ) {
  24.         bit_redirect( BOARDS_PKG_URL.'index.php?b='. $_REQUEST['b'] );
  25.     }
  26. }
  27.  
  28. // Load up the board
  29. require_once( BOARDS_PKG_PATH.'lookup_inc.php' );
  30.  
  31. if( !$gContent->isValid() ) {
  32.     $gBitSystem->fatalError( "The board you requested could not be found. <a href='".BOARDS_PKG_URL."'>View all boards</a>", NULL, NULL, HttpStatusCodes::HTTP_GONE );
  33. }
  34.  
  35. // approve or reject ananymous comments
  36. if (!empty($_REQUEST['action'])) {
  37.     // Check edit perms on the group
  38.     $gContent->verifyUpdatePermission();
  39.     
  40.     // Check the ticket
  41.     $gBitUser->verifyTicket();
  42.  
  43.     // Load up the comment as a board post
  44.     require_once( BOARDS_PKG_PATH.'BitBoardPost.php' );
  45.     $comment = new BitBoardPost($_REQUEST['comment_id']);
  46.     $comment->loadComment();
  47.  
  48.     if (!$comment->isValid()) {
  49.         $gBitSystem->fatalError("Invalid Comment Id");
  50.     }
  51.     
  52.     // Take action
  53.     switch ($_REQUEST['action']) {
  54.         case 1:
  55.             // Aprove
  56.             $comment->modApprove();
  57.             break;
  58.         case 2:
  59.             // Reject
  60.             $comment->modReject();
  61.             break;
  62.         default:
  63.             break;
  64.     }
  65. }else{
  66.     // we're just here to view (in most cases) so make sure we can
  67.     $gContent->verifyViewPermission();
  68. }
  69.  
  70. /* One more thing before we get into displaying
  71.  * A mass remove topics request might be made, handle it, perms are checked in the include, it does not require board edit perms necessarily.
  72.  * Code is moved to edit_topic_inc to try to make this all a little more sane.
  73.  *
  74.  * @TODO perhaps move this into the action process above
  75.  */
  76. require_once( BOARDS_PKG_PATH.'edit_topic_inc.php' );
  77.  
  78.  
  79. // Ok finally we can get on with viewing our board
  80.  
  81. // liberty display services
  82. $displayHash = array( 'perm_name' => 'p_boards_read' );
  83. $gContent->invokeServices( 'content_display_function', $displayHash );
  84.  
  85. // set some comment values since topics are comments
  86. $commentsParentId=$gContent->mContentId;
  87. $comments_return_url=  BOARDS_PKG_URL."index.php?b=".urlencode($gContent->mBitBoardId);
  88.  
  89. // @TODO not clear why we load up comments and topics after this when its likely to get both. If someone figures it out please clarify.
  90. require_once( BOARDS_PKG_PATH.'boards_comments_inc.php' );
  91.  
  92. // get the topics for this board
  93. require_once( BOARDS_PKG_PATH.'BitBoardTopic.php' );
  94.  
  95. $threads = new BitBoardTopic( $gContent->mContentId );
  96.  
  97. // lets pass in a ref to the root obj so we can fully mimic comments
  98. $threads->mRootObj = $gContent; 
  99. $threadsListHash = $_REQUEST;
  100. $threadList = $threads->getList( $threadsListHash );
  101.  
  102. $gBitSmarty->assign_by_ref( 'threadList', $threadList );
  103.  
  104. // getList() has now placed all the pagination information in $_REQUEST['listInfo']
  105. $gBitSmarty->assign_by_ref( 'listInfo', $threadsListHash['listInfo'] );
  106.  
  107. $gBitSmarty->assign_by_ref( 'board', $gContent );
  108. $gBitSmarty->assign( 'cat_url', BOARDS_PKG_URL."index.php"); //?ct=".urlencode($gContent->mInfo['content_type_guid']));
  109.  
  110. $gBitThemes->loadAjax( 'mochikit' );
  111.  
  112. // Display the template
  113. $gBitSystem->display( 'bitpackage:boards/list_topics.tpl', tra( 'Message Board Threads: ' . $gContent->getField('title') ) , array( 'display_mode' => 'display' ));
  114. ?>

Documentation generated on Wed, 29 Jul 2015 13:57:32 +0000 by phpDocumentor 1.5.0-lsces