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
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);
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);
25 preg_match(',&arg=([\w_]+)\|[\w_]+,', $redirect, $regs)
26 ||
preg_match(',&outil=([\w_]+),', $redirect, $regs)
27 ||
preg_match(',&cmd=([\w_]+),', $redirect, $regs)
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=');
37 case 'fichiers_distants':
38 // mettre a jour les fichiers distants d'un 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 !");