<?php
if (!defined('_ECRIRE_INC_VERSION')) return;

function action_supprimer_photo_dist(){
	$securiser_action = charger_fonction('securiser_action', 'inc');
	$arg = $securiser_action();
	$Targs = explode('-', $arg);
	$id_document = intval($Targs[0]);
	$id_article = intval($Targs[1]);


	include_spip('inc/autoriser');
	if (! autoriser("modifier","article", $id_article)) {
		return false;
	}
	if ($id_document AND $id_article) {
		$where = ['id_document='.$id_document, 'id_objet='.$id_article, 'objet="article"'];
		sql_delete('spip_documents_liens', $where);
		include_spip('inc/invalideur');
		suivre_invalideur("id='id_article/$id_article'");
	}
}

