From 11b9b8a195c99cd7748629ac5e4a2a963e56b64e Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Wed, 20 Jan 2010 09:21:47 +0000 Subject: [PATCH] =?UTF-8?q?fixed=20issue=20#0000128=20:=20modification=20d?= =?UTF-8?q?es=20m=C3=A9thodes=20mappy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- includes/mappy/mappy.php | 49 +++++++++++++++++++++++++++++++++++++++- www/pages/identite.php | 16 ++++++++----- www/pages/rsynthese.php | 18 +++++++++------ 3 files changed, 69 insertions(+), 14 deletions(-) diff --git a/includes/mappy/mappy.php b/includes/mappy/mappy.php index 6d6729b7d..4c9e47614 100644 --- a/includes/mappy/mappy.php +++ b/includes/mappy/mappy.php @@ -3,9 +3,56 @@ define('MAPPY_URL', 'http://pro.mappy.com/BtoB/scoresdecisions/'); function contentSrc($town, $way, $num, $postal_code){ - $return = MAPPY_URL.'photo?photo.town='.$town.';photo.way='.$way.';photo.num='.$num.';photo.postal_code='.$postal_code; + return MAPPY_URL. + 'photo?photo.town='.urlencode($town). + ';photo.way='.urlencode($way). + ';photo.num='.$num. + ';photo.postal_code='.$postal_code; } +function formatVille($nomVille) +{ + //Suppression des accents, ponctuation + $nomVille = str_replace( + array('é', 'è', '-'), + array('e', 'e', ' '), + $nomVille + ); + return strtoupper($nomVille); +} + +$tabVilleMappy = array( + 'Bordeaux', + 'Caen' , + 'Cannes', + 'Grenoble', + 'La Baule', + 'Lille', + 'Lyon', + 'Marseille', + 'Montpellier', + 'Nancy', + 'Nantes', + 'Nice', + 'Rennes', + 'Strasbourg', + 'Toulouse', + 'Asnières-sur-Seine', + 'Boulogne-Billancourt', + 'Courbevoie', + 'Issy-les-Moulineaux', + 'Levallois-Perret', + 'Montrouge', + 'Nanterre', + 'Neuilly-sur-Seine', + 'Rueil-Malmaison', + 'Sèvres', + 'Versailles', + 'Paris', +); + +$tabVilleMappy = array_map('formatVille', $tabVilleMappy); + diff --git a/www/pages/identite.php b/www/pages/identite.php index 29508277a..a909ff550 100644 --- a/www/pages/identite.php +++ b/www/pages/identite.php @@ -196,18 +196,22 @@ if($element!==false){ echo dRow($element['lib'], $element['data'], $element['tit '', ' ER '=>''))); - -if (preg_match('/\bMAPPY\b/i', $_SESSION['tabInfo']['pref']) && - preg_match('/(LILLE|CAEN|RENNES|BAULE|NANTES|NANCY|STRASBOURG|LYON|BORDEAUX|GRENOBLE|MONTPELLIER|TOULOUSE|MARSEILLE|CANNES|NICE|PARIS|NEUILLY|LEVALLOIS|ASNIERES|COURBEVOIE|NANTERRE|REUIL|BOULOGNE|SEVRES|VERSAILLES|MONTROUGE|MOULINEAUX)/', $ville)) +require_once 'mappy/mappy.php'; +$ville = ' '.trim(preg_replace('/([0-9]|ARRONDISSEMENT|_)/i',' ',$etab['Ville'])).' '; +$ville = trim(strtr($ville, array(' EME '=>'', ' ER '=>''))); +$firephp->log($ville, 'ville'); +if ( hasPref('mappy') && in_array(strtoupper($ville), $tabVilleMappy) ) { + $rue = trim( strtr( + normaliseVoie($etab['AdresseVoie']).' '.$etab['AdresseRue'], + array(' ST '=>' SAINT ',' STE '=>' SAINTE ', ) + )); ?>
- + Information géographique :
0) { ?> diff --git a/www/pages/rsynthese.php b/www/pages/rsynthese.php index 18a47a69f..2b2b9423b 100644 --- a/www/pages/rsynthese.php +++ b/www/pages/rsynthese.php @@ -212,18 +212,22 @@ if($element!==false){ echo dRow($element['lib'], $element['data'], $element['tit '', ' ER '=>''))); - -if (preg_match('/\bMAPPY\b/i', $_SESSION['tabInfo']['pref']) && - preg_match('/(LILLE|CAEN|RENNES|BAULE|NANTES|NANCY|STRASBOURG|LYON|BORDEAUX|GRENOBLE|MONTPELLIER|TOULOUSE|MARSEILLE|CANNES|NICE|PARIS|NEUILLY|LEVALLOIS|ASNIERES|COURBEVOIE|NANTERRE|REUIL|BOULOGNE|SEVRES|VERSAILLES|MONTROUGE|MOULINEAUX)/', $ville)) +require_once 'mappy/mappy.php'; +$ville = ' '.trim(preg_replace('/([0-9]|ARRONDISSEMENT|_)/i',' ',$etab['Ville'])).' '; +$ville = trim(strtr($ville, array(' EME '=>'', ' ER '=>''))); +$firephp->log($ville, 'ville'); +if ( hasPref('mappy') && in_array(strtoupper($ville), $tabVilleMappy) ) { + $rue = trim( strtr( + normaliseVoie($etab['AdresseVoie']).' '.$etab['AdresseRue'], + array(' ST '=>' SAINT ',' STE '=>' SAINTE ', ) + )); ?>
-
- + + Information géographique :
0) { ?>