verifyPackage( 'boards' ); if( isset( $_REQUEST['bitboard']['board_id'] ) ) { $_REQUEST['b'] = $_REQUEST['bitboard']['board_id']; } require_once(BOARDS_PKG_INCLUDE_PATH.'lookup_inc.php' ); //must be owner or admin to edit an existing board if( $gContent->isValid() ) { $gContent->verifyUpdatePermission(); } else { $gContent->verifyCreatePermission(); } // Handle delete request if( isset( $_REQUEST['remove'] ) ) { // @TODO: Change to verifyExpungePermission when that exists in LibertyContent if ( $gContent->isValid() && $gContent->hasUserPermission( 'p_boards_remove', true, true ) ) { if( empty( $_REQUEST['confirm'] ) ) { $formHash['b'] = $_REQUEST['b']; $formHash['remove'] = true; $gBitSystem->confirmDialog( $formHash, [ 'warning' => KernelTools::tra( 'Are you sure you want to remove the entire message board' ).' "'.$gContent->getTitle().'" ?', 'error' => 'This cannot be undone!' ] ); } elseif( !$gContent->expunge() ) { $gBitSmarty->assign( 'errors', $deleteComment->mErrors ); } else { KernelTools::bit_redirect( BOARDS_PKG_URL.'index.php' ); } } else { $gBitSystem->fatalPermission( 'p_boards_remove' ); } } // If we are in preview mode then preview it! if( isset( $_REQUEST["preview"] ) ) { $gBitSmarty->assign('preview', 'y'); $previewHash = array_merge( $_REQUEST, $_REQUEST['bitboard'] ); $gContent->preparePreview( $previewHash ); $gContent->invokeServices( 'content_preview_function' ); } else { $gContent->invokeServices( 'content_edit_function' ); } // Pro // Check if the page has changed if( !empty( $_REQUEST["save_bitboard"] ) ) { // merge our arrays so our storage hash works with LibertyContent storage of LibertyContent add ons. $storeHash = array_merge( $_REQUEST, $_REQUEST['bitboard'] ); // Check if all Request values are delivered, and if not, set them // to avoid error messages. This can happen if some features are // disabled if( $gContent->store( $storeHash ) ) { $gContent->storePreference( 'board_sync_list_address', (!empty( $_REQUEST['bitboardconfig']['board_sync_list_address'] ) ? $_REQUEST['bitboardconfig']['board_sync_list_address'] : null) ); KernelTools::bit_redirect( $gContent->getDisplayUrl() ); } else { $gBitSmarty->assign( 'errors', $gContent->mErrors ); } } // Display the template $gBitSystem->display( 'bitpackage:boards/board_edit.tpl', KernelTools::tra('Board') , [ 'display_mode' => 'edit' ]); ?>