www.tispip.etab.ac-caen.fr] * -2008-08: [Stéphanie De Nadaï->www.webdesigneuse.net] * - [Paul Sanchez->www.Netdeveloppeur.com] (contrib initiale) * * @copyright * Ce programme est un logiciel libre distribue sous licence GNU/GPL. *********************************************************************/ $url = parse_url($_SERVER['QUERY_STRING']); $param = $url['path']; $pos = 0; $indice = 255; if (_request('idmot')) { // Récupération du nombre de jours // pour periodicité de la rechercher $nbjour = intval(_request('nbjour')); // Récupération du nombre de jours // pour periodicité de la rechercher if (_request('onlyrub')) { $idonlyrub = intval(_request('rubnum')); } else $idonlyrub = 0; // 1 = Tous les mots doivent être associés aux articles trouvés $allword = intval(_request('allword')); $sql_in_mot = implode(',', _request('idmot') ); $nbmot = count(_request('idmot')); $result = sql_select('id_mot, titre', 'spip_mots', 'id_mot IN ('.$sql_in_mot.')', '', 'id_mot,titre"'); $tabmot = ""; $nbcol = 0; $nbcolmax = 4; if ($result) { $compt = 0; while ($row = sql_fetch($result)) { extract($row); $titre = supprimer_numero($titre); if ($nbcol == $nbcolmax) { $nbcol = 0; } $tabmot .= "$titre"; $nbcol += 1; } sql_free($result); } $sql_where[] = "spip_mots_liens.objet='article'" $sql_where[] = "spip_mots_liens.id_mot IN (".$sql_in_mot.") "; if ($nbjour) { $datedeb = date("Y-m-d", mktime(0, 0, 0, date("m"), (date("d") - $nbjour), date("Y"))); $sql_where[] = "spip_articles.date >= '$datedeb' "; } if ($idonlyrub) { $sql_where[] = "spip_rubriques.id_rubrique = $idonlyrub "; } $sql_where[] = "spip_articles.statut = 'publie' GROUP BY spip_articles.id_article"; if ($order) { $sql_order = "spip_rubriques.id_rubrique, num DESC, spip_mots_liens.id_mot, spip_articles.date DESC"; } else { $sql_order = "num DESC, spip_mots_liens.id_mot, spip_rubriques.id_rubrique, spip_articles.date DESC"; } $result = sql_select('COUNT(*) AS num, spip_articles.id_article, spip_rubriques.id_rubrique, spip_rubriques.titre AS titrerub', 'spip_articles INNER JOIN spip_rubriques ON spip_rubriques.id_rubrique = spip_articles.id_rubrique INNER JOIN spip_mots_liens ON spip_mots_liens.id_objet = spip_articles.id_article', $sql_where, '', $sql_order); $nbart = 0; $resultataffiche = ""; if ($result) { $titrerub = supprimer_numero($titrerub); $idrub = 0; $listidmot2 = ""; $listidmotprec = ""; while ($row = sql_fetch($result)) { extract($row); if (($num != $nbmot) && ($allword)) { break; } if ($idrub != $id_rubrique) { if (($pospoint = strrpos($titrerub, ". ")) === FALSE) { $titrerub2=$titrerub; } else { if (is_numeric(substr($titrerub, 0, $pospoint)) == false) $titrerub2 = $titrerub; else $titrerub2 = substr($titrerub, $pospoint + 2); } if ($order) { $resultataffiche.= '

$titrerub2 :

"; } } $result2 = sql_select('spip_articles.id_article AS artid,spip_articles.id_secteur AS id_secteur, spip_articles.titre AS titreart, spip_articles.date, spip_mots.id_mot, spip_mots.titre AS titremot', 'spip_articles INNER JOIN spip_mots_liens ON spip_mots_liens.id_objet = spip_articles.id_article INNER JOIN spip_mots ON spip_mots.id_mot = spip_mots_liens.id_mot ', "spip_articles.id_article = $id_article AND spip_mots_liens.id_mot IN (".$sql_in_mot.") AND statut = 'publie' AND spip_mots_liens.objet = 'article' ", '', 'spip_mots.id_mot'); if ($result2) { $listmot = "

"; $titrearticle = ""; $dataffich = ""; $idart = 0; while ($row2 = sql_fetch($result2)) { extract($row2); $listidmot2 .= "$id_mot,"; if ($idart == 0) { $titrearticle = supprimer_numero($titreart); if (!(($pospoint = strpos($titrearticle, '.')) === FALSE)) { if (is_numeric(substr($titrearticle, 0, $pospoint)) == true) $titrearticle = substr($titrearticle, $pospoint + 2); } if (!(($pospoint = strpos($titremot, '.')) === FALSE)) { if (is_numeric(substr($titremot, 0, $pospoint)) == true) $titremot = substr($titremot, $pospoint + 2); } $dataffich = date("d/m/Y", strtotime($date)); if ($order) { $nbart += 1; $resultataffiche .= '
  • $titrearticle $dataffich "; $resultataffiche .= "$titremot"; } $listmot .= "$titremot"; $idart = 1; } else { $listmot .= "$titremot"; if ($order) { $resultataffiche .= "$titremot"; } } } if ($order) { $resultataffiche .= "
  • "; } sql_free($result2); if (!$order) { if ($listidmot2 != $listmodidprec) { $resultataffiche .= " $listmot

    "; } $nbart += 1; switch ($id_secteur) { case 1: $variable = 63; $secteur = "Ma classe"; break; case 3: $variable = 66; $secteur = "Applications"; break; case 4: $variable = 65; $secteur = "Tutoriels"; break; case 5: $variable = 64; $secteur = "Liens"; break; } $resultataffiche .= '
  • $titrearticlepublié le : $dataffich , dans la rubrique $secteur
  • "; $listmodidprec = $listidmot2; $listidmot2 = ""; } } $idrub = $id_rubrique; } sql_free($result); if($nbart == 0 || $nbart == 1) $nbart_txt = "<:rmc:article_trouve:>"; else $nbart_txt = "<:rmc:articles_trouves:>"; echo "
    "; echo "

    Mots séléctionnés :
    ".substr($tabmot, 0)."

    "; if($nbart == 0 ) $nbart_txt = "Aucun article ne correspond à votre recherche"; else if($nbart == 1 ) $nbart_txt = " article correspond à votre recherche"; else $nbart_txt = "articles correspondent à votre recherche"; if($nbart == 0 ) echo "

    $nbart_txt
    Nouvelle recherche

    "; else echo "

    $nbart $nbart_txt
    Nouvelle recherche

    "; echo '
    '.$resultataffiche."
    "; if($nbart) echo "

    Nouvelle recherche

    "; } else { echo "

    Aucun article ne correspond à votre recherche

    "; } } else { echo "
    <:rmc:selectionner_mot:>
    "; // inutile si form recherche inclus // echo "
    Retour

    "; } ?>