3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
6 * Copyright (c) 2001-2014 *
7 * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
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 \***************************************************************************/
13 if (!defined('_ECRIRE_INC_VERSION')) return;
15 // http://doc.spip.org/@exec_dater_dist
16 function exec_dater_dist()
18 exec_dater_args(intval(_request('id')), _request('type'), _request('script'));
21 // http://doc.spip.org/@exec_dater_args
22 function exec_dater_args($id, $type, $script)
24 if (!$id OR !autoriser('voir',$type,$id)) {
25 include_spip('inc/minipres');
28 $table = table_objet_sql($type);
29 if (!id_table_objet($table)) {
30 spip_log("dater: $type table inconnue");
32 $table = table_objet_sql($type);
34 if (!preg_match('/^[_\w]+$/', $script)) $script = 'articles';
35 if (!function_exists($f = "dater_retour_$script")) $f = "dater_retour_articles";
36 include_spip('inc/actions');
37 ajax_retour($f($id, $type, $table));
41 function dater_retour_articles($id, $type, $table)
43 $r = sql_fetsel("date, date_redac,statut", $table, "id_$type=$id");
44 $date_redac = $r["date_redac"];
45 $dater = charger_fonction('dater', 'inc');
46 return $dater($id, 'ajax', $r['statut'], $type, 'articles', $r['date'], $date_redac);
49 function dater_retour_breves_voir($id, $type, $table)
51 $r = sql_fetsel("statut, date_heure", $table, "id_$type=$id");
52 $dater = charger_fonction('dater', 'inc');
53 return $dater($id, 'ajax', $r['statut'], $type, 'breves_voir', $r['date_heure']);
56 function dater_retour_sites($id, $type, $table)
58 $r = sql_fetsel("statut, date", $table, "id_$type=$id");
59 $dater = charger_fonction('dater', 'inc');
60 return $dater($id, 'ajax', $r['statut'], $type, 'sites', $r['date']);