[SPIP] +2.1.12
[velocampus/web/www.git] / www / plugins / auto / couteau_suisse / couteau_suisse / action / action_rapide.php
1 <?php
2
3 #-----------------------------------------------------#
4 # Plugin : Couteau Suisse - Licence : GPL #
5 # Auteur : Patrice Vanneufville, 2008 #
6 # Contact : patrice¡.!vanneufville¡@!laposte¡.!net #
7 # Infos : http://www.spip-contrib.net/?article2166 #
8 #-----------------------------------------------------#
9 if (!defined("_ECRIRE_INC_VERSION")) return; // securiser
10
11 function redirige_vers_exec($params=array()) {
12 $url = urldecode(_request('redirect'));
13 foreach($params as $p=>$v) $url = parametre_url($url, $p, $v, '&');
14 redirige_par_entete($url);
15 }
16
17 function action_action_rapide_dist() {
18 $arg = _request('arg');
19 cs_log("INIT : action_action_rapide_dist() - Une action rapide '$arg' a ete demandee !");
20 $securiser_action = charger_fonction('securiser_action', 'inc');
21 $arg = $securiser_action();
22 $redirect = _request('redirect');
23 if(!defined('_SPIP19300')) $redirect = urldecode($redirect);
24 $outil = (
25 preg_match(',&arg=([\w_]+)\|[\w_]+,', $redirect, $regs)
26 || preg_match(',&outil=([\w_]+),', $redirect, $regs)
27 || preg_match(',&cmd=([\w_]+),', $redirect, $regs)
28 )?$regs[1]:false;
29
30 // au cas ou, pour redirige_par_entete()
31 include_spip('inc/headers');
32 spip_log("action 'action_rapide' du Couteau suisse : $outil|$arg");
33 //cs_log($_POST, 'action POST='); cs_log($_GET, 'action GET=');
34
35 switch($arg) {
36
37 case 'fichiers_distants':
38 // mettre a jour les fichiers distants d'un outil...
39 // rien a faire :-)
40 break;
41
42 default: if($outil) {
43 // fonction mon_outil_argument_action() suite a l'appel de ?action=action_rapide&arg=mon_outil|argument
44 $fct = $outil.'_'.$arg.'_action';
45 cs_log("FIN : action_action_rapide_dist() - Appel de $fct()");
46 include_spip('outils/'.$outil.'_action_rapide');
47 if(function_exists($fct)) $fct();
48 else cs_log(" -- Erreur : fonction $fct() introuvable !");
49 } else cs_log(" -- Erreur : outil non renseigne !");
50 break;
51 }
52
53 }
54
55 ?>