[SPIP] ~v3.0.20-->v3.0.25
[lhc/web/clavette_www.git] / www / plugins-dist / urls_etendues / action / supprimer_url.php
1 <?php
2
3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
5 * *
6 * Copyright (c) 2001-2016 *
7 * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
8 * *
9 * Ce programme est un logiciel libre distribue sous licence GNU/GPL. *
10 * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. *
11 \***************************************************************************/
12
13 if (!defined("_ECRIRE_INC_VERSION")) return;
14
15 function action_supprimer_url_dist($arg=null) {
16
17 if (is_null($arg)){
18 // Rien a faire ici pour le moment
19 $securiser_action = charger_fonction('securiser_action', 'inc');
20 $arg = $securiser_action();
21 }
22 if (strncmp($arg,"-1-",3)==0){
23 $id_parent = -1;
24 $url = substr($arg,3);
25 }
26 else {
27 $arg = explode('-',$arg);
28 $id_parent = array_shift($arg);
29 $url = implode('-',$arg);
30 }
31
32 $where = 'id_parent='.intval($id_parent)." AND url=".sql_quote($url);
33 if($row = sql_fetsel('*','spip_urls',$where)){
34
35 if (autoriser('modifierurl',$row['type'],$row['id_objet'])){
36 sql_delete('spip_urls',$where);
37 }
38 else
39 spip_log('supprimer sans autorisation l\'URL '.$id_parent."://".$url,"urls."._LOG_ERREUR);
40
41 }
42 else
43 spip_log('Impossible de supprimer une URL inconnue '.$id_parent."://".$url,"urls."._LOG_INFO_IMPORTANTE);
44
45
46 }