<?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_reinitialiser_cibloc_autre($nom = null) {

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

	if (autoriser('configurer')) {
		if (ctype_alnum(str_replace(['_'], '', $nom))) {
			if (in_array($nom, ['divers', 'icones_couleur', 'icones_liste'])) {
				sql_delete('spip_cibloc_config', "nom='" . $nom . "'");
				include_spip('inc/cibloc_commun');
				cibloc_purger_definition_cache();
				cibloc_purger_cache_js();
				cibloc_purger_cache_css();
				include_spip('inc/invalideur');
				suivre_invalideur('1');
			}
		}
	} else {
		spip_log("action_reinitialiser_cibloc_autre $nom interdit", _LOG_INFO_IMPORTANTE);
	}
}
