1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
<?php
/**
* $Header$
* Copyright (c) 2004 bitweaver Messageboards
* All Rights Reserved. See below for details and a complete list of authors.
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details.
* @package boards
* @subpackage functions
*/
/**
* required setup
*/
require_once( '../kernel/setup_inc.php' );
// Is package installed and enabled
$gBitSystem->verifyPackage( 'boards' );
if( isset( $_REQUEST['bitboard']['board_id'] ) ) {
$_REQUEST['b'] = $_REQUEST['bitboard']['board_id'];
}
require_once(BOARDS_PKG_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, array( 'warning' => tra( 'Are you sure you want to remove the entire message board' ).' "'.$gContent->getTitle().'" ?', 'error' => 'This cannot be undone!' ) );
} elseif( !$gContent->expunge() ) {
$gBitSmarty->assignByRef( 'errors', $deleteComment->mErrors );
} else {
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) );
bit_redirect( $gContent->getDisplayUrl() );
} else {
$gBitSmarty->assignByRef( 'errors', $gContent->mErrors );
}
}
// Display the template
$gBitSystem->display( 'bitpackage:boards/board_edit.tpl', tra('Board') , array( 'display_mode' => 'edit' ));
?>
|