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

Source for file topic_move.php

Documentation is available at topic_move.php

  1. <?php
  2. /**
  3.  * @package boards
  4.  * @subpackage functions
  5.  */
  6.  
  7. /**
  8.  * required setup
  9.  */
  10. require_once( '../kernel/setup_inc.php' );
  11.  
  12. // Is package installed and enabled
  13. $gBitSystem->verifyPackage( 'boards' );
  14.  
  15. // Look up Topic (lookup_inc is universal, gContent == BitBoardTopic)
  16. require_once( BOARDS_PKG_PATH.'lookup_inc.php' );
  17.  
  18. // Make sure topic exists since we only run through here for existing topics. New topics are created via comment system.
  19. if( !$gContent->isValid() ){
  20.     $gBitSystem->fatalError( 'No topic specified' );
  21. }
  22.  
  23. // Load up the Topic's board - we'll respect its permissions
  24. $board = new BitBoard( $gContent->mInfo['board_id'] );
  25. $board->load();
  26. $board->verifyAdminPermission();
  27.  
  28. if( isset( $_REQUEST["target"] ) ) {
  29.     // Check the user's ticket
  30.     $gBitUser->verifyTicket();
  31.  
  32.     $targetBoard = new BitBoard( null, $_REQUEST["target"] );
  33.     $targetBoard->load();
  34.     if( !$targetBoard->hasAdminPermission() ){
  35.         $gBitSystem->fatalError( 'You do not have permission to move topics to the Board' . $targetBoard->mInfo['title'] );
  36.     }
  37.  
  38.     if( $gContent->moveTo($_REQUEST["target"]) ) {
  39.         bit_redirect( $gContent->getDisplayUrl() );
  40.     } else {
  41.         $gBitSystem->fatalError( "There was an error moving the topic: ".vc( $gContent->mErrors ));
  42.     }
  43. }
  44.  
  45. // get list of boards we can move the topic to
  46. $boards = $board->getBoardSelectList();
  47. $gBitSmarty->assign_by_ref('boards', $boards);
  48.  
  49. $gBitSmarty->assign('fromBoardId', $board->mContentId);
  50.  
  51. $gBitSystem->display( 'bitpackage:boards/topic_move.tpl', tra('Move Topic').':'.$gContent->getTitle(), array( 'display_mode' => 'display' ));
  52. ?>

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