} $req_doc .= "ORDER BY date DESC"; //remise en service (plus tri sur le tableau des objets) $listdoc->req_doc = $req_doc; $listdoc->borneinf = $s; $listdoc->bornesup = $nbdocsparpage; $nb_doc_rech = $listdoc->afficherListeParas(); $total = $nb_doc_rech; } else { if ($rechauteur) { //fin else if ($rech) : recherche par auteur (suggestion de contenu) $listdoc = new ListeParagraphes(); $listdoc->doc = 1; $listdoc->docvcourte = 1; $aut_majuscule = Majuscules($rechauteur); $aut_lettre = Majuscules(substr($rechauteur, 0, 1)) . substr($rechauteur, 1); $req_doc = " WHERE (auteur LIKE '%{$rechauteur}%' OR auteur LIKE '%{$aut_majuscule}%' \r\n\t\t\t\t\tOR auteur LIKE '%{$aut_lettre}%') "; if ($spec == "extranet-pro") { $req_doc .= " AND acces_res='o'"; } $req_doc .= "ORDER BY date DESC"; //remise en service (plus tri sur le tableau des objets) $listdoc->req_doc = $req_doc; $listdoc->borneinf = $s; $listdoc->bornesup = $nbdocsparpage; $nb_doc_rech = $listdoc->afficherListeParas(); $total = $nb_doc_rech; } else { if ($touteladoc) { //fin else if ($rech) $listdoc = new ListeParagraphes();
} if ($textMess) { $leContact = new Contact(); if ($numcontact) { $leContact->numcontact = $numcontact; } else { $leContact->numcontact = "15"; } //15 = siege social ifip $leContact->infosContact(); $prenom = Majuscules(strip_tags($textPrenom)); $nom = Majuscules(strip_tags($textNom)); $societe = Majuscules(strip_tags($textSociete)); $ville = Majuscules(strip_tags($textVille)); $pays = utf8_encode(SelectSimple("pays", "if_pays", "numpays", $selectPays)); $objet = Majuscules(strip_tags($textObjet)); $corps .= "Bonjour " . $leContact->prenom . " " . $leContact->nom . ",<br />"; $corps .= "Voici un message en provenance de ifip.asso.fr<br /><br />"; $corps .= "-------------------------------------------------------------<br />"; $corps .= "DEMANDEUR : " . $prenom . " " . $nom . "<br />"; if ($societe) { $corps .= "SOCIETE / ORGANISME : " . $societe . "<br />"; } if ($textAdr1) { $corps .= "ADRESSE : <br />" . $textAdr1 . "<br />"; } if ($textAdr2) { $corps .= $textAdr1 . "<br />"; } $corps .= $textCp . " " . $ville . "<br />" . $pays . "<br />"; if ($textTel) {
if ($rechauteur) { echo "Auteur : "; } } } ?> </td> <td width="380"><strong><?php if ($dom) { echo $menus_doc->nomMenu; } else { if ($rech) { echo $rech; } else { if ($rechauteur) { echo Majuscules($rechauteur); } } } ?> </strong></td> </tr> <tr> <td colspan="2"> <br /> <strong>Aucune documentation ne correspond à vos critères de recherche</strong> <?php $pageSpecNewRecherche = new Page(); if ($spec == "extranet-pro") { $pageSpecNewRecherche->pageSpecifique("extranet-pro"); } else {
/** * Moteur de recherche */ function rechercherPara() { /***** Les titres des pages *******************/ //$this->recherche=utf8_encode($this->recherche); $result = mysql_query("SELECT numpage,titre,alias FROM if_page WHERE titre LIKE '%" . $this->recherche . "%' AND publiee='o' AND lg='{$this->lg}'"); //echo "SELECT numpage,titre,alias FROM if_page WHERE titre LIKE '%".utf8_encode($this->recherche)."%' AND publiee='o'"; while ($row = mysql_fetch_row($result)) { $point1 = ""; $point2 = ""; //on ne stocke que le mot entier trouvé - on ne stocke pas si c'est le morceau d'un mot $pos = stripos($row[1], $this->recherche); //stripos est insensible a la casse if ($pos !== false) { if ($pos === 0) { $afficher = "oui"; } else { $lettreavant = testerLettre(substr($row[1], $pos - 1, 1)); if (count($lettreavant) > 0) { $afficher = "non"; } else { $afficher = "oui"; } } if ($afficher == "oui") { if ($pos === 0) { $chaine = Majuscules(substr($this->recherche, 0, 1)) . substr($this->recherche, 1, strlen($this->recherche)); $titre = str_replace($chaine, "<strong>" . $chaine . "</strong>", $row[1]); } else { $titre = str_replace($this->recherche, "<strong>" . $this->recherche . "</strong>", $row[1]); } $resultat[$row[0]] = array("type" => "page", "titre" => $titre, "lien" => $row[2], "texte" => ""); } } } /*********** Les titres des paragraphes *******************/ $result = mysql_query("SELECT if_page.numpage,if_page.titre,alias,if_paragraphe.contenu,if_paragraphe.titre \r\n\t\tFROM if_page,if_paragraphe,if_page_para WHERE if_paragraphe.numpara=if_page_para.numpara AND if_page_para.numpage=if_page.numpage AND if_paragraphe.titre LIKE '%" . $this->recherche . "%' AND if_page.publiee='o' AND if_page.lg='{$this->lg}'"); while ($row = mysql_fetch_row($result)) { if (!is_array($resultat) || !in_array($row[0], $resultat)) { $point1 = ""; $point2 = ""; //on ne stocke que le mot entier trouvé - on ne stocke pas si c'est le morceau d'un mot $pos = stripos($row[4], $this->recherche); //stripos est insensible a la casse if ($pos !== false) { if ($pos === 0) { $afficher = "oui"; } else { $lettreavant = testerLettre(substr($row[4], $pos - 1, 1)); if (count($lettreavant) > 0) { $afficher = "non"; } else { $afficher = "oui"; } } if ($afficher == "oui") { if ($pos < 200) { $deb = 0; $int = $pos; } else { $deb = $pos - 200; $int = 200; $point1 = "..."; } if (strlen($row[4]) - $pos > 200) { $point2 = "..."; } $extrait = substr($row[4], $deb, $pos - $deb + 200 + strlen($this->recherche)); $extrait = str_replace($this->recherche, "<strong>" . stripslashes($this->recherche) . "</strong>", $extrait); $resultat[$row[0]] = array("type" => "page", "titre" => $row[1], "lien" => $row[2], "texte" => $point1 . $extrait . $point2); } } } } /*********** Les contenus des paragraphes *******************/ $result = mysql_query("SELECT if_page.numpage,if_page.titre,alias,if_paragraphe.contenu FROM if_page,if_paragraphe,if_page_para WHERE if_paragraphe.numpara=if_page_para.numpara AND if_page_para.numpage=if_page.numpage AND if_paragraphe.contenu LIKE '%" . $this->recherche . "%' AND if_page.publiee='o' AND if_page.lg='{$this->lg}'"); //echo "SELECT if_page.numpage,if_page.titre,alias,if_paragraphe.contenu FROM if_page,if_paragraphe,if_page_para WHERE if_paragraphe.numpara=if_page_para.numpara AND if_page_para.numpage=if_page.numpage AND if_paragraphe.contenu LIKE '%".utf8_encode($this->recherche)."%' AND if_page.publiee='o'"; while ($row = mysql_fetch_row($result)) { if ((!is_array($resultat) || !in_array($row[0], $resultat)) && !ereg("<iframe", $row[3])) { //on ne prend pas les pages contenant un paragraphe contenant iframe $point1 = ""; $point2 = ""; //on ne stocke que le mot entier trouvé - on ne stocke pas si c'est le morceau d'un mot $pos = stripos($row[3], $this->recherche); //stripos est insensible a la casse if ($pos !== false) { if ($pos === 0) { $afficher = "oui"; } else { $lettreavant = testerLettre(substr($row[3], $pos - 1, 1)); if (count($lettreavant) > 0) { $afficher = "non"; } else { $afficher = "oui"; } } if ($afficher == "oui") { if ($pos < 200) { $deb = 0; $int = $pos; } else { $deb = $pos - 200; $int = 200; $point1 = "..."; } if (strlen($row[1]) - $pos > 200) { $point2 = "..."; } $extrait = substr($row[3], $deb, $pos - $deb + 200 + strlen($this->recherche)); $extrait = str_replace($this->recherche, "<strong>" . stripslashes($this->recherche) . "</strong>", $extrait); $resultat[$row[0]] = array("type" => "page", "titre" => $row[1], "lien" => $row[2], "texte" => $point1 . $extrait . $point2); } } } } /*********** Les titres des docs *******************/ if ($this->lg == "fr") { $result = mysql_query("SELECT numpara, titre, contenu,tarif,acces_res,keyw,auteur FROM if_v_doc WHERE titre LIKE '%" . $this->recherche . "%' AND publiee='o'"); } else { if ($this->lg == "en") { $result = mysql_query("SELECT numpara, titre_en, contenu_en,tarif,acces_res,keyw,auteur FROM if_v_doc WHERE titre_en LIKE '%" . $this->recherche . "%' AND publiee='o'"); } } while ($row = mysql_fetch_row($result)) { if (!is_array($resultat) || !in_array("doc-" . $row[0], $resultat)) { $point1 = ""; $point2 = ""; $pos = 0; $pos = stripos($row[1], $this->recherche); if ($pos !== false) { if ($pos === 0) { $afficher = "oui"; } else { $lettreavant = testerLettre(substr($row[1], $pos - 1, 1)); if (count($lettreavant) > 0) { $afficher = "non"; } else { $afficher = "oui"; } } if ($afficher == "oui") { $titre = str_replace($this->recherche, "<strong>" . $this->recherche . "</strong>", $row[1]); if (strlen($row[2]) > 200) { $extrait = substr($row[2], 0, 200) . "..."; } else { $extrait = $row[2]; } $nom_fiche = ""; $fiche = new ListeFichiers(); $fiche->numpara = $row[0]; $fiche->afficherListeFichiers(); foreach ($fiche as $fichiers) { $nom_fiche = "ouverturepdf.php?file=" . $fichiers->nomFichier; $poids_fiche = $fichiers->poidsFichier; break; } $resultat["doc-" . $row[0]] = array("type" => "doc", "titre" => $titre, "lien" => $nom_fiche, "texte" => $extrait, "tarif" => $row[3], "acces_res" => $row[4], "numpara" => $row[0], "keyw" => $row[5], "auteurs" => $row[6], "poids_fiche" => $poids_fiche); } } } } /*********** Les contenus des docs *******************/ if ($this->lg == "fr") { $result = mysql_query("SELECT numpara, titre, contenu,tarif,acces_res,keyw,auteur FROM if_v_doc WHERE contenu LIKE '%" . $this->recherche . "%' AND publiee='o'"); } else { if ($this->lg == "en") { $result = mysql_query("SELECT numpara, titre_en, contenu_en,tarif,acces_res,keyw,auteur FROM if_v_doc WHERE contenu_en LIKE '%" . $this->recherche . "%' AND publiee='o'"); } } while ($row = mysql_fetch_row($result)) { if (!is_array($resultat) || !in_array("doc-" . $row[0], $resultat)) { $point1 = ""; $point2 = ""; $pos = 0; $pos = stripos($row[2], $this->recherche); $lettreavant = testerLettre(substr($row[2], $pos - 1, 1)); if (count($lettreavant) > 0) { $afficher = "non"; } else { $afficher = "oui"; } if ($afficher == "oui") { if ($pos < 200) { $deb = 0; $int = $pos; } else { $deb = $pos - 200; $int = 200; $point1 = "..."; } if (strlen($row[2]) - $pos > 200) { $point2 = "..."; } $extrait = substr($row[2], $deb, $pos - $deb + 200 + strlen($this->recherche)); $extrait = str_replace($this->recherche, "<strong>" . $this->recherche . "</strong>", $extrait); $extrait = $point1 . $extrait . $point2; $nom_fiche = ""; $fiche = new ListeFichiers(); $fiche->numpara = $row[0]; $fiche->afficherListeFichiers(); foreach ($fiche as $fichiers) { $nom_fiche = "ouverturepdf.php?file=" . $fichiers->nomFichier; $poids_fiche = $fichiers->poidsFichier; break; } $resultat["doc-" . $row[0]] = array("type" => "doc", "titre" => $row[1], "lien" => $nom_fiche, "texte" => $extrait, "tarif" => $row[3], "acces_res" => $row[4], "numpara" => $row[0], "keyw" => $row[5], "auteurs" => $row[6], "poids_fiche" => $poids_fiche); } } } /*********** Les mots-cles des docs *******************/ if ($this->lg == "fr") { $result = mysql_query("SELECT numpara, titre, contenu,tarif,acces_res,keyw,auteur FROM if_v_doc WHERE keyw LIKE '%" . $this->recherche . "%' AND publiee='o'"); } else { if ($this->lg == "en") { $result = mysql_query("SELECT numpara, titre_en, contenu_en,tarif,acces_res,keyw,auteur FROM if_v_doc WHERE keyw LIKE '%" . $this->recherche . "%' AND publiee='o'"); } } while ($row = mysql_fetch_row($result)) { if (!is_array($resultat) || !in_array("doc-" . $row[0], $resultat)) { $point1 = ""; $point2 = ""; $pos = 0; $pos = stripos($row[5], $this->recherche); $lettreavant = testerLettre(substr($row[5], $pos - 1, 1)); if (count($lettreavant) > 0) { $afficher = "non"; } else { $afficher = "oui"; } if ($afficher == "oui") { if (strlen($row[2]) > 200) { $extrait = substr($row[2], 0, 200) . "..."; } else { $extrait = $row[2]; } $keyw = str_replace($this->recherche, "<strong>" . $this->recherche . "</strong>", $row[5]); $nom_fiche = ""; $fiche = new ListeFichiers(); $fiche->numpara = $row[0]; $fiche->afficherListeFichiers(); foreach ($fiche as $fichiers) { $nom_fiche = "ouverturepdf.php?file=" . $fichiers->nomFichier; $poids_fiche = $fichiers->poidsFichier; break; } $resultat["doc-" . $row[0]] = array("type" => "doc", "titre" => $row[1], "lien" => $nom_fiche, "texte" => $extrait, "tarif" => $row[3], "acces_res" => $row[4], "numpara" => $row[0], "keyw" => $keyw, "auteurs" => $row[6], "poids_fiche" => $poids_fiche); } } } /*********** Les auteurs des docs *******************/ if ($this->lg == "fr") { $result = mysql_query("SELECT numpara, titre, contenu,tarif,acces_res,keyw,auteur FROM if_v_doc WHERE auteur LIKE '%" . $this->recherche . "%' AND publiee='o'"); } else { if ($this->lg == "en") { $result = mysql_query("SELECT numpara, titre_en, contenu_en,tarif,acces_res,keyw,auteur FROM if_v_doc WHERE auteur LIKE '%" . $this->recherche . "%' AND publiee='o'"); } } while ($row = mysql_fetch_row($result)) { if (!is_array($resultat) || !in_array("doc-" . $row[0], $resultat)) { $point1 = ""; $point2 = ""; $pos = 0; $pos = stripos($row[6], $this->recherche); $lettreavant = testerLettre(substr($row[6], $pos - 1, 1)); if (count($lettreavant) > 0) { $afficher = "non"; } else { $afficher = "oui"; } if ($afficher == "oui") { if (strlen($row[2]) > 200) { $extrait = substr($row[2], 0, 200) . "..."; } else { $extrait = $row[2]; } $auteurs = str_replace($this->recherche, "<strong>" . $this->recherche . "</strong>", $row[6]); $nom_fiche = ""; $fiche = new ListeFichiers(); $fiche->numpara = $row[0]; $fiche->afficherListeFichiers(); foreach ($fiche as $fichiers) { $nom_fiche = "ouverturepdf.php?file=" . $fichiers->nomFichier; $poids_fiche = $fichiers->poidsFichier; break; } $resultat["doc-" . $row[0]] = array("type" => "doc", "titre" => $row[1], "lien" => $nom_fiche, "texte" => $extrait, "tarif" => $row[3], "acces_res" => $row[4], "numpara" => $row[0], "keyw" => $row[5], "auteurs" => $auteurs, "poids_fiche" => $poids_fiche); } } } return $resultat; }