From 6e67e41c154818b7bfa2275ad9d0fc6eae8bc0b1 Mon Sep 17 00:00:00 2001 From: "Committo,Ergo:sum" <esj@rezo.net> Date: Fri, 14 Nov 2008 16:18:26 +0000 Subject: [PATCH] =?UTF-8?q?Il=20n'y=20avait=20pas=20qu'un=20pb=20de=20divi?= =?UTF-8?q?sion=20par=20z=C3=A9ro:=20il=20faut=20vraiment=20pr=C3=A9parer?= =?UTF-8?q?=20toute=20la=20requ=C3=AAte=20pour=20bien=20tomber=20sur=20la?= =?UTF-8?q?=20tranche=20dat=C3=A9e.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ecrire/exec/controle_petition.php | 43 +++++++++++++++---------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/ecrire/exec/controle_petition.php b/ecrire/exec/controle_petition.php index 157abf29f9..c83ad87f85 100644 --- a/ecrire/exec/controle_petition.php +++ b/ecrire/exec/controle_petition.php @@ -28,7 +28,6 @@ function exec_controle_petition_dist() // http://doc.spip.org/@exec_controle_petition_args function exec_controle_petition_args($id_article, $type, $date, $debut, $id_signature, $pas=NULL) { - if (!$pas) $pas = 10; if ($id_signature) { $id_article = sql_getfetsel("id_article", "spip_signatures", "id_signature=$id_signature"); $where = '(id_signature=' . sql_quote($id_signature) . ') AND '; @@ -45,36 +44,36 @@ function exec_controle_petition_args($id_article, $type, $date, $debut, $id_sign )) { include_spip('inc/minipres'); echo minipres();} - else { - if ($date) { - include_spip('inc/forum'); - $query = array('SELECT' => 'UNIX_TIMESTAMP(date_time) AS d', - 'FROM' => 'spip_signatures', - 'WHERE' => $where, - 'ORDER BY' => $order); - $debut = navigation_trouve_date($date, 'd', $pas, $query); - } - if (!preg_match('/^\w+$/',$type)) $type = 'public'; - if ($id_article) $where .= "id_article=$id_article AND "; - $res = controle_petition_args($id_article, $type, $debut, $titre, $where, $pas); - if (_AJAX) { - ajax_retour($res); - } else { - $ong = controle_petition_onglet($id_article, $debut, $type); - controle_petition_page($id_article, $titre, $ong, $res); - } - } + else controle_petition_args($id_article, $type, $date, $debut, $titre, $where, $pas); } -function controle_petition_args($id_article, $type, $debut, $titre, $where, $pas=10) +function controle_petition_args($id_article, $type, $date, $debut, $titre, $where, $pas) { + if (!preg_match('/^\w+$/',$type)) $type = 'public'; + if ($id_article) $where .= "id_article=$id_article AND "; $extrait = "(statut='publie' OR statut='poubelle')"; if ($type == 'interne') $extrait = "NOT($extrait)"; $where .= $extrait; $order = "date_time DESC"; + if (!$pas) $pas = 10; + if ($date) { + include_spip('inc/forum'); + $query = array('SELECT' => 'UNIX_TIMESTAMP(date_time) AS d', + 'FROM' => 'spip_signatures', + 'WHERE' => $where, + 'ORDER BY' => $order); + $debut = navigation_trouve_date($date, 'd', $pas, $query); + } $signatures = charger_fonction('signatures', 'inc'); - return $signatures('controle_petition', $id_article, $debut, $pas, $where, $order, $type); + $res = $signatures('controle_petition', $id_article, $debut, $pas, $where, $order, $type); + + if (_AJAX) { + ajax_retour($res); + } else { + $ong = controle_petition_onglet($id_article, $debut, $type); + controle_petition_page($id_article, $titre, $ong, $res); + } } // http://doc.spip.org/@controle_petition_page -- GitLab