Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 3777 Rev 3792
Line 1... Line 1...
1
<?php
1
<?php
2
// declare(encoding='UTF-8');
2
// declare(encoding='UTF-8');
3
/**
3
/**
4
 * Service fournissant des informations concernant les images du CEL au format RSS1, RSS2 ou ATOM.
4
 * Service fournissant des informations concernant les images du CEL au format RSS1, RSS2 ou ATOM.
5
 
5
 
6
 *
6
 *
7
 * @internal   Mininum PHP version : 5.2
7
 * @internal   Mininum PHP version : 5.2
8
 * @category   CEL
8
 * @category   CEL
9
 * @package    Services
9
 * @package    Services
10
 * @subpackage Syndication
10
 * @subpackage Syndication
Line 15... Line 15...
15
 * @license    GPL v3 <http://www.gnu.org/licenses/gpl.txt>
15
 * @license    GPL v3 <http://www.gnu.org/licenses/gpl.txt>
16
 * @license    CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
16
 * @license    CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
17
 * @copyright  1999-2014 Tela Botanica <accueil@tela-botanica.org>
17
 * @copyright  1999-2014 Tela Botanica <accueil@tela-botanica.org>
18
 */
18
 */
19
class CelSyndicationImage extends Cel {
19
class CelSyndicationImage extends Cel {
Line 404... Line 404...
404
    
404
    
405
    private function getServiceMultiCriteres() {
405
    private function getServiceMultiCriteres() {
406
        $contenu = '';
406
        $contenu = '';
407
        if (isset($_GET['debut'])) $this->start = Cel::db()->proteger($_GET['debut']);
407
        if (isset($_GET['debut'])) $this->start = Cel::db()->proteger($_GET['debut']);
Line 408... Line 408...
408
        if (isset($_GET['limite'])) $this->limit = Cel::db()->proteger($_GET['limite']);
408
        if (isset($_GET['limite'])) $this->limit = Cel::db()->proteger($_GET['limite']);
Line 409... Line 409...
409
        
409
        
410
        $this->limit = ($this->limit < 1000) ? $this->limit : 1000;// Pour éviter les abus !
410
        $this->limit = ($this->limit < 1000) ? $this->limit : 1000;// Pour éviter les abus !
411
        
411
        
412
		if ($this->parametresSontDemandes()) {
412
        if ($this->parametresSontDemandes()) {
413
			$requete = $this->creerRequeteAvecParametres();
413
            $requete = $this->creerRequeteAvecParametres();
414
		} else {
414
        } else {
415
			$requete = $this->creerRequeteSansParametres();
415
            $requete = $this->creerRequeteSansParametres();
416
		}
416
        }
417
		$elements = $this->executerRequete($requete);
417
        $elements = $this->executerRequete($requete);
418
 
418
        
419
		// Création du contenu
419
        // Création du contenu
420
		if ($elements != false && count($elements) > 0) {
420
        if ($elements != false && count($elements) > 0) {
421
			$contenu = $this->executerService($elements);
421
            $contenu = $this->executerService($elements);
422
		} else {
422
        } else {
423
			// ne pas faire ça, car ça déclenche une erreur 500 à tort !
423
            // ne pas faire ça, car ça déclenche une erreur 500 à tort !
424
			//$this->messages[] = "Aucune image disponible.";
424
            //$this->messages[] = "Aucune image disponible.";
Line 571... Line 571...
571
		$requete = "b.nom_referentiel LIKE '$referentiel%'";
571
        $requete = "b.nom_referentiel LIKE '$referentiel%'";
572
		return $requete;
572
        return $requete;
573
	}
573
    }
574
    
574
    
575
    private function creerSousRequeteRechercheGenerale($chaine_requete) {
575
    private function creerSousRequeteRechercheGenerale($chaine_requete) {
576
        $requete = '';
576
        $requete = '';
577
        $chaine_requete = Cel::deb()->proteger($chaine_requete);
577
        $chaine_requete = Cel::deb()->proteger($chaine_requete.'%');
578
        if (trim($chaine_requete) != '') {
578
        if (trim($chaine_requete) != '') {
579
            $chaine_requete = strtolower($chaine_requete);
579
            $chaine_requete = strtolower($chaine_requete);
580
            $chaine_requete = str_replace(' ', '_', $chaine_requete);
580
            $chaine_requete = str_replace(' ', '_', $chaine_requete);
581
			$requete = ' ('.
581
            $requete = ' ('.
582
				'b.nom_ret LIKE "'.$chaine_requete.'%"'.
582
                'b.nom_ret LIKE '.$chaine_requete.
583
				' OR '.
583
                ' OR '.
584
				'b.nom_sel LIKE "'.$chaine_requete.'%"'.
584
                'b.nom_sel LIKE '.$chaine_requete.
585
				' OR '.
585
                ' OR '.
586
				'b.zone_geo LIKE "'.$chaine_requete.'%" '.
586
                'b.zone_geo LIKE '.$chaine_requete.
587
				' OR '.
587
                ' OR '.
588
				'b.ce_zone_geo LIKE "INSEE-C:'.$chaine_requete.'%" '.
588
                'b.ce_zone_geo LIKE INSEE-C:'.$chaine_requete.
589
				' OR '.
589
                ' OR '.
590
				'b.ce_zone_geo LIKE "'.$chaine_requete.'%" '.
590
                'b.ce_zone_geo LIKE '.$chaine_requete.
591
				' OR '.
591
                ' OR '.
592
				'b.ce_utilisateur LIKE "'.$chaine_requete.'%" '.
592
                'b.ce_utilisateur LIKE '.$chaine_requete.
593
				' OR '.
593
                ' OR '.
594
				'b.courriel_utilisateur LIKE "'.$chaine_requete.'%" '.
594
                'b.courriel_utilisateur LIKE '.$chaine_requete.
595
				' OR '.
595
                ' OR '.
596
				'b.mots_cles_texte LIKE "'.$chaine_requete.'%" '.
596
                'b.mots_cles_texte LIKE '.$chaine_requete.
597
				') ';
597
                ') ';
598
		}
598
        }
599
		return $requete;
599
        return $requete;
600
	}
600
    }
601
 
601
    
602
	private function estUneRechercheGenerale() {
602
    private function estUneRechercheGenerale() {
603
		return isset($_GET['recherche']);
603
        return isset($_GET['recherche']);
Line 604... Line 604...
604
	}
604
    }
605
 
605
    
606
	private function traiterCriteresMultiples($tableau_criteres) {
606
    private function traiterCriteresMultiples($tableau_criteres) {
607
		$tableau_criteres_pour_bdd = array();
607
        $tableau_criteres_pour_bdd = array();
608
        
608
        
609
        foreach($tableau_criteres as $nom_critere => $valeur_critere) {
609
        foreach($tableau_criteres as $nom_critere => $valeur_critere) {
726
	private function getIntituleAuteur($courriel) {
726
    private function getIntituleAuteur($courriel) {