type_requete]; $boucle->from[] = $boucle->type_requete . " AS " . ($t ? $t : $boucle->type_requete); return calculer_boucle($id_boucle, $boucles); } // // boucle dite recursive // function boucle_BOUCLE_dist($id_boucle, &$boucles) { return calculer_boucle($id_boucle, $boucles); } // // // function boucle_ARTICLES_dist($id_boucle, &$boucles) { $boucle = &$boucles[$id_boucle]; $id_table = $boucle->id_table; $boucle->from[] = "spip_articles AS $id_table"; // Restreindre aux elements publies if (!isset($boucle->where['statut'])) { if (!$GLOBALS['var_preview']) { $boucle->where['statut'] = "$id_table.statut='publie'"; if (lire_meta("post_dates") == 'non') $boucle->where['statut'] .= " AND $id_table.date < NOW()"; } else $boucle->where['statut'] = "$id_table.statut IN ('publie','prop')"; } return calculer_boucle($id_boucle, $boucles); } // // // function boucle_AUTEURS_dist($id_boucle, &$boucles) { $boucle = &$boucles[$id_boucle]; $id_table = $boucle->id_table; $boucle->from[] = "spip_auteurs AS $id_table"; // Restreindre aux elements publies if (!isset($boucle->where['statut'])) { // Si pas de lien avec un article, selectionner // uniquement les auteurs d'un article publie if (!$GLOBALS['var_preview']) if (!$boucle->lien AND !$boucle->tout) { $boucle->from[] = "spip_auteurs_articles AS lien"; $boucle->from[] = "spip_articles AS articles"; $boucle->where[] = "lien.id_auteur=$id_table.id_auteur"; $boucle->where[] = 'lien.id_article=articles.id_article'; $boucle->where['statut'] = "articles.statut='publie'"; $boucle->group = $boucle->id_table . '.' . $boucle->primary; } // pas d'auteurs poubellises $boucle->where[] = "NOT($id_table.statut='5poubelle')"; } return calculer_boucle($id_boucle, $boucles); } // // // function boucle_BREVES_dist($id_boucle, &$boucles) { $boucle = &$boucles[$id_boucle]; $id_table = $boucle->id_table; $boucle->from[] = "spip_breves AS $id_table"; // Restreindre aux elements publies if (!isset($boucle->where['statut'])) { if (!$GLOBALS['var_preview']) $boucle->where['statut'] = "$id_table.statut='publie'"; else $boucle->where['statut'] = "$id_table.statut IN ('publie','prop')"; } return calculer_boucle($id_boucle, $boucles); } // // // function boucle_FORUMS_dist($id_boucle, &$boucles) { $boucle = &$boucles[$id_boucle]; $id_table = $boucle->id_table; $boucle->from[] = "spip_forum AS $id_table"; // Par defaut, selectionner uniquement les forums sans pere if (!$boucle->tout AND !$boucle->plat) $boucle->where[] = "$id_table.id_parent=0"; // Restreindre aux elements publies if (!isset($boucle->where['statut'])) { $boucle->where['statut'] = "$id_table.statut='publie'"; } return calculer_boucle($id_boucle, $boucles); } // // // function boucle_SIGNATURES_dist($id_boucle, &$boucles) { $boucle = &$boucles[$id_boucle]; $id_table = $boucle->id_table; $boucle->from[] = "spip_signatures AS $id_table"; $boucle->from[] = "spip_petitions AS petitions"; $boucle->from[] = "spip_articles articles"; $boucle->where[] = "petitions.id_article=articles.id_article"; $boucle->where[] = "petitions.id_article=$id_table.id_article"; // Restreindre aux elements publies if (!isset($boucle->where['statut'])) { $boucle->where['statut'] = "$id_table.statut='publie'"; } $boucle->group = $boucle->id_table . '.' . $boucle->primary; return calculer_boucle($id_boucle, $boucles); } // // // function boucle_DOCUMENTS_dist($id_boucle, &$boucles) { $boucle = &$boucles[$id_boucle]; $id_table = $boucle->id_table; $boucle->from[] = "spip_documents AS $id_table"; $boucle->from[] = "spip_types_documents AS types_documents"; $boucle->where[] = "$id_table.id_type=types_documents.id_type"; // on ne veut pas des fichiers de taille nulle, // sauf s'ils sont distants (taille inconnue) $boucle->where[] = "($id_table.taille > 0 OR $id_table.distant='oui')"; return calculer_boucle($id_boucle, $boucles); } // // // function boucle_TYPES_DOCUMENTS_dist($id_boucle, &$boucles) { $boucle = &$boucles[$id_boucle]; $id_table = $boucle->id_table; $boucle->from[] = "spip_types_documents AS $id_table"; return calculer_boucle($id_boucle, $boucles); } // // // function boucle_GROUPES_MOTS_dist($id_boucle, &$boucles) { $boucle = &$boucles[$id_boucle]; $id_table = $boucle->id_table; $boucle->from[] = "spip_groupes_mots AS $id_table"; return calculer_boucle($id_boucle, $boucles); } // // // function boucle_MOTS_dist($id_boucle, &$boucles) { $boucle = &$boucles[$id_boucle]; $id_table = $boucle->id_table; $boucle->from[] = "spip_mots AS $id_table"; return calculer_boucle($id_boucle, $boucles); } // // // function boucle_RUBRIQUES_dist($id_boucle, &$boucles) { $boucle = &$boucles[$id_boucle]; $id_table = $boucle->id_table; $boucle->from[] = "spip_rubriques AS $id_table"; // Restreindre aux elements publies if (!isset($boucle->where['statut'])) { if (!$GLOBALS['var_preview']) if (!$boucle->tout) $boucle->where['statut'] = "$id_table.statut='publie'"; } return calculer_boucle($id_boucle, $boucles); } // // // function boucle_HIERARCHIE_dist($id_boucle, &$boucles) { $boucle = &$boucles[$id_boucle]; $id_table = $boucle->id_table; $boucle->from[] = "spip_rubriques AS $id_table"; // Si la boucle mere est une boucle RUBRIQUES il faut ignorer la feuille // sauf si le critere {tout} est present (cf. inc-html-squel) $exclure_feuille = ($boucle->tout ? 'false' : 'true'); // $hierarchie sera calculee par une fonction de inc-calcul-outils $boucle->where[] = 'id_rubrique IN ($hierarchie)'; $boucle->select[] = 'FIND_IN_SET(id_rubrique, \'$hierarchie\')-1 AS rang'; $boucle->default_order = array('rang'); $boucle->hierarchie = '$hierarchie = calculer_hierarchie(' . calculer_argument_precedent($boucle->id_boucle, 'id_rubrique', $boucles) . ', ' . $exclure_feuille . ');'; return calculer_boucle($id_boucle, $boucles); } // // // function boucle_SYNDICATION_dist($id_boucle, &$boucles) { $boucle = &$boucles[$id_boucle]; $id_table = $boucle->id_table; $boucle->from[] = "spip_syndic AS $id_table"; // Restreindre aux elements publies if (!isset($boucle->where['statut'])) { if (!$GLOBALS['var_preview']) { $boucle->where['statut'] = "$id_table.statut='publie'"; } else $boucle->where['statut'] = "$id_table.statut IN ('publie','prop')"; } return calculer_boucle($id_boucle, $boucles); } // // // function boucle_SYNDIC_ARTICLES_dist($id_boucle, &$boucles) { $boucle = &$boucles[$id_boucle]; $id_table = $boucle->id_table; $boucle->from[] = "spip_syndic_articles AS $id_table"; $boucle->from[] = "spip_syndic AS syndic"; $boucle->where[] = "$id_table.id_syndic=syndic.id_syndic"; // Restreindre aux elements publies if (!isset($boucle->where['statut'])) { if (!$GLOBALS['var_preview']) { $boucle->where['statut'] = "$id_table.statut='publie'"; $boucle->where[] = "syndic.statut='publie'"; } else $boucle->where['statut'] = "$id_table.statut IN ('publie','prop')"; } return calculer_boucle($id_boucle, $boucles); } ?>