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("
", $tags),
'warning' => KernelTools::tra( 'These tags will be dropped from this content.
This cannot be undone!' ),
];
$gBitSystem->confirmDialog( $formHash,$msgHash );