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
|
<?php
/**
* $Header: /cvsroot/bitweaver/_bit_boards/edit_topic_inc.php,v 1.3 2008/06/18 09:17:59 lsces Exp $
* $Id: edit_topic_inc.php,v 1.3 2008/06/18 09:17:59 lsces Exp $
*
* @package boards
* @subpackage functions
*/
/* mass-remove:
the checkboxes are sent as the array $_REQUEST["checked[]"], values are the wiki-PageNames,
e.g. $_REQUEST["checked"][3]="HomePage"
$_REQUEST["submit_mult"] holds the value of the "with selected do..."-option list
we look if any page's checkbox is on and if remove_boards is selected.
then we check permission to delete boards.
if so, we call histlib's method remove_all_versions for all the checked boards.
*/
if( isset( $_REQUEST["submit_mult"] ) && isset( $_REQUEST["checked"] ) && $_REQUEST["submit_mult"] == "remove_boards" ) {
// Now check permissions to remove the selected bitboard
$gContent->verifyPermission( 'p_boards_remove' );
$gBitUser->verifyTicket();
if( !empty( $_REQUEST['cancel'] ) ) {
// user cancelled - just continue on, doing nothing
} elseif( empty( $_REQUEST['confirm'] ) ) {
$formHash['b'] = $_REQUEST['b'];
$formHash['delete'] = TRUE;
$formHash['submit_mult'] = 'remove_boards';
foreach( $_REQUEST["checked"] as $del ) {
$formHash['input'][] = '<input type="hidden" name="checked[]" value="'.$del.'"/>';
}
$gBitSystem->confirmDialog( $formHash, array( 'warning' => 'Are you sure you want to delete '.count( $_REQUEST["checked"] ).' Topics?', 'error' => 'This cannot be undone!' ) );
} else {
foreach( $_REQUEST["checked"] as $deleteId ) {
$deleteComment = new LibertyComment( $deleteId );
if( $deleteComment->isValid() && $gBitUser->hasPermission('p_liberty_admin_comments') ) {
if( !$deleteComment->expunge() ) {
$gBitSmarty->assign_by_ref( 'errors', $deleteComment->mErrors );
}
}
}
if( !empty( $errors ) ) {
$gBitSmarty->assign_by_ref( 'errors', $errors );
}
}
} elseif( isset( $_REQUEST['remove'] ) && BitBase::verifyId( $_REQUEST['thread_id'] ) ) {
$gBitUser->verifyTicket();
$tmpTopic = new BitBoardTopic( $_REQUEST['thread_id'] );
$tmpTopic->load();
if( !empty( $_REQUEST['cancel'] ) ) {
// user cancelled - just continue on, doing nothing
} elseif( empty( $_REQUEST['confirm'] ) ) {
$formHash['b'] = $_REQUEST['b'];
$formHash['remove'] = TRUE;
$formHash['thread_id'] = $_REQUEST['thread_id'];
$gBitSystem->confirmDialog( $formHash, array( 'warning' => tra( 'Are you sure you want to delete the topic' ).' "'.$tmpTopic->getTitle().'" ?', 'error' => 'This cannot be undone!' ) );
} else {
$deleteComment = new LibertyComment($_REQUEST['thread_id']);
if( $deleteComment->isValid() && $gBitUser->hasPermission('p_liberty_admin_comments') ) {
if( !$deleteComment->expunge() ) {
$gBitSmarty->assign_by_ref( 'errors', $deleteComment->mErrors );
}
}
}
}
?>
|