/trunk/papyrus/applettes/moteur_recherche/moteur_recherche.php |
---|
21,7 → 21,7 |
// | along with Foobar; if not, write to the Free Software | |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
// +------------------------------------------------------------------------------------------------------+ |
// CVS : $Id: moteur_recherche.php,v 1.18 2006-12-12 13:53:54 jp_milcent Exp $ |
// CVS : $Id: moteur_recherche.php,v 1.19 2007-01-02 18:49:22 jp_milcent Exp $ |
/** |
* Applette : moteur de recherche |
* |
38,7 → 38,7 |
//Autres auteurs : |
*@author Aucun |
*@copyright Tela-Botanica 2000-2004 |
*@version $Revision: 1.18 $ $Date: 2006-12-12 13:53:54 $ |
*@version $Revision: 1.19 $ $Date: 2007-01-02 18:49:22 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
133,7 → 133,8 |
// Titre de la page |
$GLOBALS['_PAPYRUS_']['rendu']['TITRE_PAGE'] = MORE_LG_TITRE.htmlentities(stripslashes($_POST['more_motif'])); |
$_SESSION['_MOTEUR_RECHERCHE_']['rechercher']['more_motif'] = $_POST['more_motif']; |
$GLOBALS['_MOTEUR_RECHERCHE_']['formulaire']['more_motif'] = $_POST['more_motif']; |
$GLOBALS['_MOTEUR_RECHERCHE_']['formulaire']['more_motif'] = htmlentities(stripslashes($_POST['more_motif'])); |
/** Inclusion de la classe Recherche.*/ |
require_once MORE_CHEMIN_BIBLIO.'more_recherche.class.php'; |
/** Inclusion de la classe Recherche_Papyrus_Menu.*/ |
208,6 → 209,9 |
/* +--Fin du code ----------------------------------------------------------------------------------------+ |
* |
* $Log: not supported by cvs2svn $ |
* Revision 1.18 2006/12/12 13:53:54 jp_milcent |
* Mise en place du nouveau format des balises d'applette. |
* |
* Revision 1.17 2006/12/01 16:33:40 florian |
* Amélioration de la gestion des applettes et compatibilité avec le nouveau mode de gestion de l'inclusion des applettes. |
* |
/trunk/papyrus/applettes/moteur_recherche/bibliotheque/more_recherche_spip_article.class.php |
---|
95,9 → 95,8 |
if ($aso_resultat['poids'] > 0) { |
// Création de l'url |
$var_recherche = str_replace(' ', '+', trim($motif)); |
$aso_resultat['url_simple'] = $url_base.'article'.$article_id.'.html'; |
$aso_resultat['url'] = $aso_resultat['url_simple'].'?var_recherche='.$var_recherche; |
$aso_resultat['url'] = $aso_resultat['url_simple'].'?var_recherche='.$this->traiterMotif($motif, 'url'); |
// Récupération du titre de la page |
if (trim($Article->titre) != '') { |
248,6 → 247,9 |
/* +--Fin du code ----------------------------------------------------------------------------------------+ |
* |
* $Log$ |
* Revision 1.5 2006/11/20 09:36:59 jp_milcent |
* Correction bogue zéro résultat et ajout d'url simple pour indiquer la page de l'article. |
* |
* Revision 1.4 2006/11/14 16:08:40 jp_milcent |
* Paramétrage de la découpe de la description et du symbole "etc" |
* |
/trunk/papyrus/applettes/moteur_recherche/bibliotheque/more_recherche.class.php |
---|
21,7 → 21,7 |
// | along with Foobar; if not, write to the Free Software | |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
// +------------------------------------------------------------------------------------------------------+ |
// CVS : $Id: more_recherche.class.php,v 1.10 2006-12-12 13:54:41 jp_milcent Exp $ |
// CVS : $Id: more_recherche.class.php,v 1.11 2007-01-02 18:49:22 jp_milcent Exp $ |
/** |
* Classe permettant d'effectuer des recherches sur les métas informations des menus. |
* |
34,7 → 34,7 |
//Autres auteurs : |
*@author aucun |
*@copyright Tela-Botanica 2000-2004 |
*@version $Revision: 1.10 $ $Date: 2006-12-12 13:54:41 $ |
*@version $Revision: 1.11 $ $Date: 2007-01-02 18:49:22 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
129,18 → 129,31 |
{ |
$nbre_correspondance = 0; |
$nbre_correspondance_total = 0; |
if ($mode == 1) { |
$motif = $this->traiterMotif($motif, 'simple'); |
// Si demande de recherche d'expression complète |
if (preg_match('/^".+"$/', $motif)) { |
$mode = 2; |
} |
$motif = $this->traiterMotif($motif, 'recherche'); |
switch ($mode) { |
case '1' : |
// Découpage en mot |
$tab_motif = explode(' ', trim($motif)); |
} else { |
$tab_motif = explode(' ', $motif); |
break; |
case '2' : |
// La chaine saisie par l'utilisateur est recherchée tel quel |
$tab_motif[] = trim($motif); |
$tab_motif[] = $motif; |
break; |
default: |
$e = 'Mode pour le moteur de recherche inconnu : '.$mode. |
trigger_error($e, E_USER_ERROR); |
} |
// Nous recherchons chaque mot |
$compteur_mot = 0; |
foreach ($tab_motif as $mot) { |
//$nbre_correspondance += preg_match_all('/'.$mot.'/i', $texte, $tab_morceaux); |
$nbre_correspondance = substr_count(strtolower($texte), strtolower(stripslashes($mot))); |
$nbre_correspondance = substr_count(strtolower($texte), strtolower($mot)); |
if ($nbre_correspondance > 0) { |
$compteur_mot++; |
} |
154,6 → 167,30 |
} |
} |
function traiterMotif($motif, $type = 0) |
{ |
switch ($type) { |
case 'simple' : |
return trim(stripslashes($motif)); |
break; |
case 'recherche' : |
if (preg_match('/^"(.+)"$/', $motif, $match)) { |
$motif = $match[1]; |
} |
return $motif; |
break; |
case 'url' : |
$motif = trim(stripslashes($motif)); |
if (preg_match('/^"(.+)"$/', $motif, $match)) { |
$motif = $match[1]; |
} |
return urlencode($motif); |
break; |
default: |
return $motif; |
} |
} |
function traduireMois($mois_numerique) |
{ |
switch ($mois_numerique) { |
190,6 → 227,9 |
/* +--Fin du code ----------------------------------------------------------------------------------------+ |
* |
* $Log: not supported by cvs2svn $ |
* Revision 1.10 2006/12/12 13:54:41 jp_milcent |
* Correction bogue : variable non initialisée. |
* |
* Revision 1.9 2006/10/17 09:21:40 jp_milcent |
* Mise en commun des spécifications de la recherche. |
* |
/trunk/papyrus/applettes/moteur_recherche/bibliotheque/more_recherche_papyrus_menu.class.php |
---|
21,7 → 21,7 |
// | along with Foobar; if not, write to the Free Software | |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
// +------------------------------------------------------------------------------------------------------+ |
// CVS : $Id: more_recherche_papyrus_menu.class.php,v 1.11 2006-11-21 18:52:20 jp_milcent Exp $ |
// CVS : $Id: more_recherche_papyrus_menu.class.php,v 1.12 2007-01-02 18:49:22 jp_milcent Exp $ |
/** |
* Classe permettant d'effectuer des recherches sur les informations des menus de Papyrus. |
* |
38,7 → 38,7 |
//Autres auteurs : |
*@author aucun |
*@copyright Tela-Botanica 2000-2004 |
*@version $Revision: 1.11 $ $Date: 2006-11-21 18:52:20 $ |
*@version $Revision: 1.12 $ $Date: 2007-01-02 18:49:22 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
105,7 → 105,7 |
$une_url =& new Pap_URL(PAP_URL); |
$une_url->setId($menu_id); |
$aso_resultat['url_simple'] = $une_url->getURL(); |
$une_url->addQueryString('var_recherche', $motif); |
$une_url->addQueryString('var_recherche', $this->traiterMotif($motif, 'url'), true); |
$aso_resultat['url'] = $une_url->getURL(); |
$une_url->removeQueryString('var_recherche'); |
148,6 → 148,9 |
/* +--Fin du code ----------------------------------------------------------------------------------------+ |
* |
* $Log: not supported by cvs2svn $ |
* Revision 1.11 2006/11/21 18:52:20 jp_milcent |
* Ajout de la possibilité de surligner des mots. |
* |
* Revision 1.10 2006/11/20 09:36:59 jp_milcent |
* Correction bogue zéro résultat et ajout d'url simple pour indiquer la page de l'article. |
* |