[SPIP] ~2.1.12 -->2.1.25
[velocampus/web/www.git] / www / ecrire / exec / memoriser.php
1 <?php
2
3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
5 * *
6 * Copyright (c) 2001-2014 *
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
16 // Recupere et affiche (en ajax) une fonction memorisee dans inc/presentation
17 // http://doc.spip.org/@exec_memoriser_dist
18 function exec_memoriser_dist()
19 {
20 $hash = _request('hash');
21 $order = _request('order');
22 $by = _request('by');
23 $trad = _request('trad');
24 lire_fichier(_DIR_SESSIONS.'ajax_fonctions.txt', $ajax_fonctions);
25 $ajax_fonctions = @unserialize($ajax_fonctions);
26
27 if ($res = $ajax_fonctions[$hash]) {
28 include_spip('inc/afficher_objets');
29 list(,$t,$r,$f) = $res;
30 if (preg_match('/^[a-z0-9+.,]+$/', $by)
31 AND preg_match('/^\w*$/', $order)) {
32 $r['ORDER BY'] = str_replace(',', " $order, ", $by) . " $order";
33 sauver_requete($t, $r, $f);
34 }
35 $cpt = sql_countsel($r['FROM'], $r['WHERE'], $r['GROUP BY']);
36 include_spip('inc/presentation');
37 $res = afficher_articles_trad($t, $r, $f, $hash, $cpt, $trad);
38 } else spip_log("memoriser $q vide");
39 include_spip('inc/actions');
40 ajax_retour($res);
41 }
42
43 ?>