[ Index ] |
|
Code source de SPIP Agora 1.4 |
1 <?php 2 /***************************************************** 3 * This file is part of Agora, web based content management system. 4 * 5 * Agora is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; version 2 of the License. 8 * 9 * Agora is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details (file "COPYING"). 13 * 14 * Copyright © Arnaud Martin, Antoine Pitrou et Philippe Rivière. 15 * List of authors detailed in "copyright_fr.html" file. 16 * E-mail : agora@sig.premier-ministre.gouv.fr 17 * Web site : http://www.agora.gouv.fr 18 *****************************************************/ 19 /* Ajout Clever Age / Antoine Angénieux / Couche métier */ 20 require_once (dirname(__FILE__). "/include/bd/inc_article_list_factory.php"); 21 22 require_once (dirname(__FILE__). "/include/bd/inc_auteur_list_factory.php"); 23 require_once (dirname(__FILE__). "/include/bd/inc_breve_list_factory.php"); 24 require_once (dirname(__FILE__). "/include/bd/inc_rubrique_list_factory.php"); 25 require_once (dirname(__FILE__). "/include/bd/inc_syndic_list_factory.php"); 26 /* fin zone de modification Clever Age */ 27 28 include ("inc.php"); 29 include_ecrire ("inc_mots.php"); 30 include_ecrire ("inc_sites.php"); 31 32 debut_page (_T('titre_page_recherche', array('recherche' => $recherche))); 33 34 debut_gauche(); 35 36 debut_droite(); 37 38 echo "<FONT FACE='Verdana,Arial,Helvetica,sans-serif'><B>" . _T('info_resultat_recherche'). "</B><BR>"; 39 echo "<FONT SIZE=5 COLOR='$couleur_foncee'><B>" . typo($recherche). "</B></FONT><p>"; 40 41 /************* Modification elebescond@clever-age.com **********************/ 42 $params_articles = array(); 43 $params_articles_int = array(); 44 $params_breves = array(); 45 $params_breves_int = array(); 46 $params_rubriques = array(); 47 $params_rubriques_int = array(); 48 $params_sites = array(); 49 $params_sites_int = array(); 50 51 /* 52 $recherche = addslashes($recherche); 53 54 $query_articles = "WHERE"; 55 $query_breves = "SELECT * FROM spip_breves WHERE "; 56 $query_rubriques = "SELECT * FROM spip_rubriques WHERE "; 57 $query_sites = "SELECT * FROM spip_syndic WHERE "; 58 */ 59 60 /************* Fin modification elebescond@clever-age.com **********************/ 61 62 //Recherche à partir de l'ID d'un objet 63 if (ereg("^[0-9]+$", $recherche)) { 64 /************* Modification elebescond@clever-age.com **********************/ 65 $params_articles['id_article'] = $recherche; 66 $params_breves['id_breve'] = $recherche; 67 $params_rubriques['id_rubrique'] = $recherche; 68 $params_sites['id_syndic'] = $recherche; 69 /* 70 $query_articles .= " (id_article = $recherche) OR "; 71 $query_breves .= " (id_breve = $recherche) OR "; 72 $query_rubriques .= " (id_rubrique = $recherche) OR "; 73 $query_sites .= " (id_syndic = $recherche) OR "; 74 */ 75 /************* Fin modification elebescond@clever-age.com **********************/ 76 77 } 78 79 // Eviter les symboles '%', caracteres SQL speciaux 80 $recherche = str_replace("%", "\%", $recherche); 81 82 /************* Modification elebescond@clever-age.com **********************/ 83 $recherche = str_replace("'", '', $recherche); 84 $recherche = str_replace("\"", '', $recherche); 85 $params_articles['titre'] = split("[[:space:]]+", addslashes($recherche)); 86 $params_breves['titre'] = split("[[:space:]]+", addslashes($recherche)); 87 $params_rubriques['titre'] = split("[[:space:]]+", addslashes($recherche)); 88 $params_sites['nom_site'] = split("[[:space:]]+", addslashes($recherche)); 89 //var_dump($params_articles['titre']); 90 /* 91 $rech2 = split("[[:space:]]+", $recherche); 92 if ($rech2) 93 $where = " (titre LIKE '%".join("%' AND titre LIKE '%", $rech2)."%') "; 94 else 95 $where = " 1=2"; 96 97 $query_articles .= " $where ORDER BY date_modif DESC"; 98 $query_breves .= " $where ORDER BY maj DESC LIMIT 0,10"; 99 $query_rubriques .= " $where ORDER BY maj DESC LIMIT 0,10"; 100 101 $query_sites .= " $where ORDER BY maj DESC LIMIT 0,10"; 102 $query_sites = ereg_replace("titre LIKE", "nom_site LIKE", $query_sites); 103 */ 104 /************* Fin modification elebescond@clever-age.com **********************/ 105 106 $activer_moteur = (lire_meta('activer_moteur') == 'oui'); 107 108 if ($activer_moteur) { // texte integral 109 include_ecrire ('inc_index.php'); 110 $hash_recherche = requete_hash($recherche); 111 112 /************* Modification elebescond@clever-age.com **********************/ 113 $params_articles_int[] = $hash_recherche; 114 $params_breves_int[] = $hash_recherche; 115 $params_rubriques_int[] = $hash_recherche; 116 $params_sites_int[] = $hash_recherche; 117 $params_auteurs_int[] = $hash_recherche; 118 /* 119 $query_articles_int = requete_txt_integral('article', $hash_recherche); 120 $query_breves_int = requete_txt_integral('breve', $hash_recherche); 121 $query_rubriques_int = requete_txt_integral('rubrique', $hash_recherche); 122 $query_sites_int = requete_txt_integral('syndic', $hash_recherche); 123 $query_auteurs_int = requete_txt_integral('auteur', $hash_recherche); 124 */ 125 /************* Fin modification elebescond@clever-age.com **********************/ 126 } 127 128 /************* Modification elebescond@clever-age.com **********************/ 129 if (sizeOf($params_articles) > 0) { 130 $articleList = &recuperer_instance_list_articles(); 131 $nba = $articleList->displayHTMLList(_T('info_articles_trouves'), ARTICLES_RECHERCHE, $params_articles, false, true, 132 true, false); 133 } 134 135 if ($activer_moteur) { 136 if ($nba) { 137 $doublons = join($nba, ","); 138 $params_articles_int[] = $doublons; 139 } 140 else { 141 $params_articles_int[] = "-1"; 142 } 143 144 $articleList = &recuperer_instance_list_articles(); 145 $nba1 = $articleList->displayHTMLList(_T('info_articles_trouves_dans_texte'), ARTICLES_RECHERCHE_INT, 146 $params_articles_int, false, 147 true, true, 148 false, 0, 149 10); 150 /* 151 if ($query_articles) 152 $nba = afficher_articles (_T('info_articles_trouves'), $query_articles); 153 if ($activer_moteur) { 154 if ($nba) { 155 $doublons = join($nba, ","); 156 $query_articles_int = ereg_replace ("WHERE", "WHERE objet.id_article NOT IN ($doublons) AND", $query_articles_int); 157 } 158 $nba1 = afficher_articles (_T('info_articles_trouves_dans_texte'), $query_articles_int); 159 } 160 */ 161 /************* Fin modification elebescond@clever-age.com **********************/ 162 163 /************* Modification elebescond@clever-age.com **********************/ 164 if (sizeOf($params_breves) > 0) { 165 $breveList = &recuperer_instance_list_breves(); 166 $nbb = $breveList->displayHTMLList(_T('info_breves_touvees'), BREVES_RECHERCHE, $params_breves); 167 } 168 169 if ($activer_moteur) { 170 if ($nbb) { 171 $doublons = join($nbb, ","); 172 $params_breves_int[] = $doublons; 173 } 174 else { 175 $params_breves_int[] = "-1"; 176 } 177 178 $breveList = &recuperer_instance_list_breves(); 179 $nbb1 = $breveList->displayHTMLList(_T('info_breves_touvees_dans_texte'), BREVES_RECHERCHE_INT, 180 $params_breves_int, false, 181 0, 10); 182 } 183 /* 184 if ($query_breves) 185 $nbb = afficher_breves (_T('info_breves_touvees'), $query_breves); 186 if ($activer_moteur) { 187 if ($nbb) { 188 $doublons = join($nbb, ","); 189 $query_breves_int = ereg_replace ("WHERE", "WHERE objet.id_breve NOT IN ($doublons) AND", $query_breves_int); 190 } 191 $nbb1 = afficher_breves (_T('info_breves_touvees_dans_texte'), $query_breves_int); 192 } 193 */ 194 /************* Fin modification elebescond@clever-age.com **********************/ 195 196 /************* Modification elebescond@clever-age.com **********************/ 197 if (sizeOf($params_rubriques) > 0) { 198 $rubriqueList = &recuperer_instance_list_rubriques(); 199 $nbr = $rubriqueList->displayHTMLList(_T('info_rubriques_trouvees'), RUBRIQUES_RECHERCHE, $params_rubriques); 200 } 201 202 if ($activer_moteur) { 203 if ($nbr) { 204 $doublons = join($nbr, ","); 205 $params_rubriques_int[] = $doublons; 206 } 207 else { 208 $params_rubriques_int[] = "-1"; 209 } 210 211 $rubriqueList = &recuperer_instance_list_rubriques(); 212 $nbr1 = $rubriqueList->displayHTMLList(_T('info_rubriques_trouvees_dans_texte'), RUBRIQUES_RECHERCHE_INT, 213 $params_rubriques_int, 0, 214 10); 215 } 216 /* 217 if ($query_rubriques) 218 $nbr = afficher_rubriques (_T('info_rubriques_trouvees'), $query_rubriques); 219 if ($activer_moteur) { 220 if ($nbr) { 221 $doublons = join($nbr, ","); 222 $query_rubriques_int = ereg_replace ("WHERE", "WHERE objet.id_rubrique NOT IN ($doublons) AND", $query_rubriques_int); 223 } 224 $nbr1 = afficher_rubriques (_T('info_rubriques_trouvees_dans_texte'), $query_rubriques_int); 225 } 226 */ 227 /************* Fin modification elebescond@clever-age.com **********************/ 228 229 /************* Modification elebescond@clever-age.com **********************/ 230 if ($activer_moteur) 231 $auteursList = &recuperer_instance_list_auteurs(); 232 $nbt = $auteursList->displayHTMLList(_T('info_sites_trouves_dans_texte'), AUTEURS_RECHERCHE_INT, 233 $params_auteurs_int, 0, 234 10); 235 } 236 237 /* 238 if ($activer_moteur) 239 $nbt = afficher_auteurs (_T('info_auteurs_trouves'), $query_auteurs_int); 240 */ 241 /************* Fin modification elebescond@clever-age.com **********************/ 242 243 /************* Modification elebescond@clever-age.com **********************/ 244 if (sizeOf($params_sites) > 0) { 245 $syndicList = &recuperer_instance_list_syndics(); 246 $nbs = $syndicList->displayHTMLList(_T('info_sites_trouves'), SYNDICS_RECHERCHE, $params_sites); 247 } 248 249 if ($activer_moteur) { 250 if ($nbs) { 251 $doublons = join($nbs, ","); 252 //$query_sites_int = ereg_replace ("WHERE", "WHERE objet.id_syndic NOT IN ($doublons) AND", $query_sites_int); 253 $params_sites_int[] = $doublons; 254 } 255 else { 256 $params_sites_int[] = "-1"; 257 } 258 259 $syndicList = &recuperer_instance_list_syndics(); 260 $nbs1 = $syndicList->displayHTMLList(_T('info_sites_trouves_dans_texte'), SYNDICS_RECHERCHE_INT, $params_sites_int, 261 0, 10); 262 } 263 /* 264 if ($query_sites) 265 $nbs = afficher_sites (_T('info_sites_trouves'), $query_sites); 266 if ($activer_moteur) { 267 if ($nbs) { 268 $doublons = join($nbs, ","); 269 $query_sites_int = ereg_replace ("WHERE", "WHERE objet.id_syndic NOT IN ($doublons) AND", $query_sites_int); 270 } 271 $nbs1 = afficher_sites (_T('info_sites_trouves_dans_texte'), $query_sites_int); 272 } 273 */ 274 /************* Fin modification elebescond@clever-age.com **********************/ 275 276 if (!$nba AND !$nba1 AND !$nbb AND !$nbb1 AND !$nbr AND !$nbr1 AND !$nbt AND !$nbs AND !$nbs1) { 277 echo "<FONT FACE='Verdana,Arial,Helvetica,sans-serif'>" . _T('avis_aucun_resultat'). "</FONT><P>"; 278 } 279 280 echo "<p>"; 281 282 fin_page(); 283 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Feb 24 14:40:03 2007 | par Balluche grâce à PHPXref 0.7 |