<?php

/**
 * Plugin CIBLOC
 * @copyright 2018 MTECT
 * @author Christophe IMBERTI (cf. CPI art L121-1)
 * @license GNU/GPLv3
 */

if (!defined(
	'_ECRIRE_INC_VERSION'
)) {
	return;
}

include_spip('inc/filtres');

function action_supprimer_cibloc_ensemble($id = null) {

	if ($id === null) {
		$securiser_action = charger_fonction('securiser_action', 'inc');
		$id = $securiser_action();
	}

	if (autoriser('configurer')) {
		if (ctype_alnum($id)) {
			sql_delete('spip_cibloc_objets', "type='ensemble' AND id='" . $id . "' AND source='creation'");

			include_spip('inc/cibloc_commun');
			cibloc_purger_definition_cache();
			cibloc_purger_cache_js();
		}
	} else {
		spip_log("action_supprimer_cibloc_ensemble $id interdit", _LOG_INFO_IMPORTANTE);
	}
}
