summaryrefslogtreecommitdiff
path: root/drop_tags.php
blob: 560631e8bfe7c450c3e0e9c76d77765804edbc76 (plain)
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
<?php
/**
 * @version $Header$
 * @package tags
 * @subpackage functions
 * 
 * @copyright Copyright (c) 2004-2006, bitweaver.org
 * 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.
 */

/**
 * required setup
 */
require_once "../kernel/includes/setup_inc.php";
use Bitweaver\Tags\LibertyTag;
use Bitweaver\KernelTools;

$gBitSystem->verifyPackage( 'tags' );

require_once LIBERTY_PKG_INCLUDE_PATH.'lookup_content_inc.php';

if (!$gContent || !$gContent->isValid()) {
	$gBitSystem->fatalError( 'The content is not valid.' );
}

if (!($gBitUser->hasPermission('p_tags_admin') || $gContent->isOwner())) {
	$gBitSystem->fatalError( 'You do not have permission to remove tags.' );
}

if (empty($_REQUEST['tag_id'])) {
	$gBitSystem->fatalError('You must select some tags.');
}

if( isset( $_REQUEST["confirm"] ) ) {
	$tag = new LibertyTag();
	$tag->expungeTags($_REQUEST['content_id'], explode(",", $_REQUEST['tag_id']));
	header("location: ".$gContent->getDisplayUrl());
}

$gBitSystem->setBrowserTitle( KernelTools::tra( 'Confirm drop of tags from: ' ).$gContent->getTitle() );
$formHash['tag_id'] = implode(",", $_REQUEST['tag_id']);
$formHash['content_id'] = $_REQUEST['content_id'];
foreach($_REQUEST['tag_id'] as $id) {
	$tags[] = $_REQUEST['tag_'.$id];
}
$msgHash = [
	'label' => KernelTools::tra( 'Drop Tags' ),
	'confirm_item' => implode("<br>", $tags),
	'warning' => KernelTools::tra( 'These tags will be dropped from this content.<br />This cannot be undone!' ),
	];
$gBitSystem->confirmDialog( $formHash,$msgHash );