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

Source for file edit.php

Documentation is available at edit.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( isset( $_REQUEST['bitboard']['board_id'] ) ) {
  20.     $_REQUEST['b'] = $_REQUEST['bitboard']['board_id'];
  21. }
  22.  
  23. require_once(BOARDS_PKG_PATH.'lookup_inc.php' );
  24.  
  25. //must be owner or admin to edit an existing board
  26. if( $gContent->isValid() ) {
  27.     $gContent->verifyUpdatePermission();
  28. } else {
  29.     $gContent->verifyCreatePermission();
  30. }
  31.  
  32. // Handle delete request
  33. if( isset( $_REQUEST['remove'] ) ) {
  34.     // @TODO: Change to verifyExpungePermission when that exists in LibertyContent
  35.     if ( $gContent->isValid() && $gContent->hasUserPermission( 'p_boards_remove', TRUE, TRUE ) ) {
  36.         if( empty( $_REQUEST['confirm'] ) ) {
  37.             $formHash['b'] = $_REQUEST['b'];
  38.             $formHash['remove'] = TRUE;
  39.             $gBitSystem->confirmDialog( $formHash, array( 'warning' => tra( 'Are you sure you want to remove the entire message board' ).' "'.$gContent->getTitle().'" ?', 'error' => 'This cannot be undone!' ) );
  40.         } elseif( !$gContent->expunge() ) {
  41.             $gBitSmarty->assign_by_ref( 'errors', $deleteComment->mErrors );
  42.         } else {
  43.             bit_redirect( BOARDS_PKG_URL.'index.php' );
  44.         }
  45.     } else {
  46.         $gBitSystem->fatalPermission( 'p_boards_remove' );
  47.     }
  48. }
  49.  
  50. // If we are in preview mode then preview it!
  51. if( isset( $_REQUEST["preview"] ) ) {
  52.     $gBitSmarty->assign('preview', 'y');
  53.     $previewHash = array_merge( $_REQUEST, $_REQUEST['bitboard'] );
  54.     $gContent->preparePreview( $previewHash );
  55.     $gContent->invokeServices( 'content_preview_function' );
  56. } else {
  57.     $gContent->invokeServices( 'content_edit_function' );
  58. }
  59.  
  60. // Pro
  61. // Check if the page has changed
  62. if( !empty( $_REQUEST["save_bitboard"] ) ) {
  63.     // merge our arrays so our storage hash works with LibertyContent storage of LibertyContent add ons.
  64.     $storeHash = array_merge( $_REQUEST, $_REQUEST['bitboard'] );
  65.     // Check if all Request values are delivered, and if not, set them
  66.     // to avoid error messages. This can happen if some features are
  67.     // disabled
  68.     if( $gContent->store( $storeHash ) ) {
  69.         $gContent->storePreference( 'board_sync_list_address', (!empty( $_REQUEST['bitboardconfig']['board_sync_list_address'] ) ?  $_REQUEST['bitboardconfig']['board_sync_list_address'] : NULL) );
  70.         bit_redirect( $gContent->getDisplayUrl() );
  71.     } else {
  72.         $gBitSmarty->assign_by_ref( 'errors', $gContent->mErrors );
  73.     }
  74. }
  75.  
  76. // Display the template
  77. $gBitSystem->display( 'bitpackage:boards/board_edit.tpl', tra('Board') , array( 'display_mode' => 'edit' ));
  78. ?>

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