Subversion Repositories Applications.papyrus

Rev

Rev 2113 | Rev 2119 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2113 Rev 2118
Line 45... Line 45...
45
 
45
 
46
// pour utiliser Sphinx, cela désactive alors l'appel à $moteur->rechercherMotif()
46
// pour utiliser Sphinx, cela désactive alors l'appel à $moteur->rechercherMotif()
47
// et utilise sphinx_search() (moteur_recherche_sphinx.php)
47
// et utilise sphinx_search() (moteur_recherche_sphinx.php)
48
// TODO: un test avec mysql_connect() sur le SPHINX_DSN tel que défini dans moteur_recherche_sphinx.php
48
// TODO: un test avec mysql_connect() sur le SPHINX_DSN tel que défini dans moteur_recherche_sphinx.php
49
// pourrait être un plus.
49
// pourrait être un plus.
Line 50... Line 50...
50
define('USE_SPHINX', FALSE);
50
define('USE_SPHINX', TRUE);
51
 
51
 
52
 
52
 
53
// +------------------------------------------------------------------------------------------------------+
53
// +------------------------------------------------------------------------------------------------------+
54
// |                                            ENTETE du PROGRAMME                                       |
54
// |                                            ENTETE du PROGRAMME                                       |
55
// +------------------------------------------------------------------------------------------------------+
55
// +------------------------------------------------------------------------------------------------------+
56
$GLOBALS['_GEN_commun']['info_applette_nom_fonction'] = 'afficherMoteurRecherche';
56
$GLOBALS['_GEN_commun']['info_applette_nom_fonction'] = 'afficherMoteurRecherche';
57
$GLOBALS['_GEN_commun']['info_applette_balise'] = 	'(?:<!-- '.$GLOBALS['_GEN_commun']['balise_prefixe'].'(MOTEUR_RECHERCHE) -->|'.
57
$GLOBALS['_GEN_commun']['info_applette_balise'] = 	'(?:<!-- '.$GLOBALS['_GEN_commun']['balise_prefixe'].'(MOTEUR_RECHERCHE) -->|'.
58
													'\{\{[[Mm]oteurRecherche'.
58
													'\{\{[[Mm]oteurRecherche'.
59
													'(?:\s*'.
59
													'(?:\s*'.
60
														'(?:'.
60
														'(?:'.
61
															'(url="[^"]*")|'.
61
															'(url="[^"]*")|(sphinx="(?:0|1)")'.
Line 62... Line 62...
62
														')'.
62
														')'.
Line 141... Line 141...
141
    $objet_pear_db =& $_GEN_commun['pear_db'];//objet Pear cr�� par DB contenant la connexion � la base de donn�es.
141
    $objet_pear_db =& $_GEN_commun['pear_db'];//objet Pear cr�� par DB contenant la connexion � la base de donn�es.
142
    $GLOBALS['_MOTEUR_RECHERCHE_']['bd']['papyrus'] =& $_GEN_commun['pear_db'];// Connexion � la BD de Papyrus
142
    $GLOBALS['_MOTEUR_RECHERCHE_']['bd']['papyrus'] =& $_GEN_commun['pear_db'];// Connexion � la BD de Papyrus
143
    $GLOBALS['_MOTEUR_RECHERCHE_']['variables'] = array();
143
    $GLOBALS['_MOTEUR_RECHERCHE_']['variables'] = array();
144
    $code_site = $_GEN_commun['url_site'];// identifiant du site courant.
144
    $code_site = $_GEN_commun['url_site'];// identifiant du site courant.
145
    $url = $_GEN_commun['url'];
145
    $url = $_GEN_commun['url'];
-
 
146
    $sphinx = array_key_exists('sphinx', $options) && $options['sphinx'] ? true : false;
146
    $url_id_type_site = GEN_URL_ID_TYPE_SITE;
147
    $url_id_type_site = GEN_URL_ID_TYPE_SITE;
147
    $indent_origine = 12;// Indentation de d�part en nombre d'espace
148
    $indent_origine = 12;// Indentation de d�part en nombre d'espace
148
    $indent_pas     = 4;// Pas d'indentation en nombre d'espace
149
    $indent_pas     = 4;// Pas d'indentation en nombre d'espace
149
    $retour = '';
150
    $retour = '';
150
    $retour_resultats = '';
151
    $retour_resultats = '';
Line 201... Line 202...
201
        if (!empty($GLOBALS['_MOTEUR_RECHERCHE_']['projet']['url']))	{
202
        if (!empty($GLOBALS['_MOTEUR_RECHERCHE_']['projet']['url']))	{
202
        	$recherche_projet = new More_Recherche_Projet($_SESSION['_MOTEUR_RECHERCHE_']['rechercher']['more_motif']);
203
        	$recherche_projet = new More_Recherche_Projet($_SESSION['_MOTEUR_RECHERCHE_']['rechercher']['more_motif']);
203
        	$moteur->ajouterRecherche($recherche_projet);
204
        	$moteur->ajouterRecherche($recherche_projet);
204
        }
205
        }
Line -... Line 206...
-
 
206
 
205
 
207
		$sphinx_connect = FALSE;
-
 
208
		if(USE_SPHINX && $sphinx) {
-
 
209
			require_once("moteur_recherche_sphinx.php");
-
 
210
			$sphinx_connect = @mysql_connect(SPHINX_DSN, NULL, NULL, TRUE);
-
 
211
			error_log("sphinx: can't connect to " . SPHINX_DSN . ", traditionnal SQL fallback [moteur_recherche.php]");
-
 
212
		}
206
		if(! USE_SPHINX) {
213
		if(!$sphinx_connect) {
207
			// recherche traditionnelle
214
			// recherche traditionnelle
208
			$GLOBALS['_MOTEUR_RECHERCHE_']['resultat']['resultats'] = $moteur->rechercherMotif();
215
			$GLOBALS['_MOTEUR_RECHERCHE_']['resultat']['resultats'] = $moteur->rechercherMotif();
209
		} else {
-
 
210
			require_once("moteur_recherche_sphinx.php");
216
		} else {
211
			// ce fichier/cette fonction peut-être réclamé plusieurs fois
217
			// ce fichier/cette fonction peut-être réclamé plusieurs fois
212
			// car le motif du template '{{MoteurRecherche}}' est inclu récursivement,
218
			// car le motif du template '{{MoteurRecherche}}' est inclu récursivement,
213
			// (la première substitution fait réapparaître '{{MoteurRecherche}}')
219
			// (la première substitution fait réapparaître '{{MoteurRecherche}}')
214
			if(!isset($GLOBALS['_MOTEUR_RECHERCHE_']['resultat']['resultats'])) {
220
			if(!isset($GLOBALS['_MOTEUR_RECHERCHE_']['resultat']['resultats'])) {