[SPIP] ~v3.0.20-->v3.0.25
[lhc/web/clavette_www.git] / www / ecrire / exec / puce_statut.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 include_spip('inc/presentation');
16
17 // http://doc.spip.org/@exec_puce_statut_dist
18 function exec_puce_statut_dist()
19 {
20 exec_puce_statut_args(_request('id'), _request('type'));
21 }
22
23 // http://doc.spip.org/@exec_puce_statut_args
24 function exec_puce_statut_args($id, $type)
25 {
26 if ($table_objet_sql = table_objet_sql($type)
27 AND $d = lister_tables_objets_sql($table_objet_sql)
28 AND isset($d['statut_textes_instituer'])
29 AND $d['statut_textes_instituer']) {
30 $prim = id_table_objet($type);
31 $id = intval($id);
32 if (isset($d['field']['id_rubrique']))
33 $select = "id_rubrique,statut";
34 else
35 $select = "0 as id_rubrique,statut";
36 $r = sql_fetsel($select, $table_objet_sql, "$prim=$id");
37 $statut = $r['statut'];
38 $id_rubrique = $r['id_rubrique'];
39 }
40 else {
41 $id_rubrique = intval($id);
42 $statut = 'prop'; // arbitraire
43 }
44 $puce_statut = charger_fonction('puce_statut', 'inc');
45 ajax_retour($puce_statut($id,$statut,$id_rubrique,$type, true));
46 }
47 ?>