- $q = sql_select("id_rubrique, id_parent, titre, statut, lang, langue_choisie", "spip_rubriques", ($type == 'breve' ? ' id_parent=0 ' : ''), '', "0+titre,titre");
+ $where = array();
+ if ($type == 'breve')
+ $where[]= ' id_parent=0 ';
+ if (is_array($restreint) AND $restreint)
+ $where[]= sql_in('id_rubrique', $restreint);
+
+ $q = sql_select("id_rubrique, id_parent, titre, statut, lang, langue_choisie", "spip_rubriques", join(' AND ', $where), '', "0+titre,titre");