<country id="{$smarty.request.mapid}">\r
<countries>\r
{foreach from=$countries item="country"}\r
- <country id="{$country.id}" name="{$country.name|utf8_encode}">\r
+ <country id="{$country.id}" name="{$country.name}">\r
<file swf="{$country.swf}" scale="{$country.scale}" xclip="{$country.xclip}" yclip="{$country.yclip}">\r
<color value="{$country.color}"/>\r
</file>\r
{if $country.nbPop > 0 or $country.id eq 0}\r
<map x="{$country.x}" y="{$country.y}" height="{$country.height}" width="{$country.width}" ratio="{$country.rat}"/>\r
- <icon x="{$country.xPop}" y="{$country.yPop}" nb="{$country.nbPop}" size="{$country.rad}" name="{$country.name|utf8_encode}" green="{if $country.nbPop}{$country.yellow/$country.nbPop}{else}0{/if}" blue="0" alpha="0.7"/>\r
+ <icon x="{$country.xPop}" y="{$country.yPop}" nb="{$country.nbPop}" size="{$country.rad}" name="{$country.name}" green="{if $country.nbPop}{$country.yellow/$country.nbPop}{else}0{/if}" blue="0" alpha="0.7"/>\r
<moreinfos url="country?{$searchvars}mapid={$country.id}"/>\r
{/if}\r
</country>\r
-{**************************************************************************}\r
-{* *}\r
-{* Copyright (C) 2003-2007 Polytechnique.org *}\r
-{* http://opensource.polytechnique.org/ *}\r
-{* *}\r
-{* This program is free software; you can redistribute it and/or modify *}\r
-{* it under the terms of the GNU General Public License as published by *}\r
-{* the Free Software Foundation; either version 2 of the License, or *}\r
-{* (at your option) any later version. *}\r
-{* *}\r
-{* This program is distributed in the hope that it will be useful, *}\r
-{* but WITHOUT ANY WARRANTY; without even the implied warranty of *}\r
-{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *}\r
-{* GNU General Public License for more details. *}\r
-{* *}\r
-{* You should have received a copy of the GNU General Public License *}\r
-{* along with this program; if not, write to the Free Software *}\r
-{* Foundation, Inc., *}\r
-{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *}\r
-{* *}\r
-{**************************************************************************}\r
-<config\r
-grandOncleVisibility="-1"\r
-tooltipSize="0"\r
-tooltipDX="0"\r
-tooltipDY="20"\r
-panelSize="28"\r
-citySize="6"\r
-radius100="1.6"\r
-radius0="3"\r
-select="aim"\r
-aimTween="5"\r
-transition="2"\r
-textLookInCity="Rechercher les x dans cette ville"\r
-textZoomIn="Zoom"\r
-textGoTo="Va Ã\83Â "\r
-textZoomBackTo="Revient Ã\83Â "\r
-textLoading="Chargement"\r
-textYouAreIn="Tu es dans "\r
-textSeeMapOfCity="Voir la carte de "\r
-textYouHaveSelected="Tu as sÃ\83©lectionnÃ\83© "\r
-{if $background}\r
-background="{$background}"\r
-zoomBarBackgroundColor="{$background}"\r
-{/if} \r
-textCopyright="Les rÃ\83Å¡gles de l'annuaire s'appliquent aussi Ã\83Â cette application"\r
-autofolder="true"\r
-iconSwf="icon.swf"\r
-scriptInfosArea="country?{$querystring}"/>\r
+{**************************************************************************}
+{* *}
+{* Copyright (C) 2003-2007 Polytechnique.org *}
+{* http://opensource.polytechnique.org/ *}
+{* *}
+{* This program is free software; you can redistribute it and/or modify *}
+{* it under the terms of the GNU General Public License as published by *}
+{* the Free Software Foundation; either version 2 of the License, or *}
+{* (at your option) any later version. *}
+{* *}
+{* This program is distributed in the hope that it will be useful, *}
+{* but WITHOUT ANY WARRANTY; without even the implied warranty of *}
+{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *}
+{* GNU General Public License for more details. *}
+{* *}
+{* You should have received a copy of the GNU General Public License *}
+{* along with this program; if not, write to the Free Software *}
+{* Foundation, Inc., *}
+{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *}
+{* *}
+{**************************************************************************}
+<config
+grandOncleVisibility="-1"
+tooltipSize="0"
+tooltipDX="0"
+tooltipDY="20"
+panelSize="28"
+citySize="6"
+radius100="1.6"
+radius0="3"
+select="aim"
+aimTween="5"
+transition="2"
+textLookInCity="Rechercher les x dans cette ville"
+textZoomIn="Zoom"
+textGoTo="Va à "
+textZoomBackTo="Revient à "
+textLoading="Chargement"
+textYouAreIn="Tu es dans "
+textSeeMapOfCity="Voir la carte de "
+textYouHaveSelected="Tu as sélectionné "
+{if $background}
+background="{$background}"
+zoomBarBackgroundColor="{$background}"
+{/if}
+textCopyright="Les règles de l'annuaire s'appliquent aussi à cette application"
+autofolder="true"
+iconSwf="icon.swf"
+scriptInfosArea="country?{$querystring}"/>
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
require_once 'connect.db.inc.php';
$globals->dbcharset = 'latin1';
-function is_utf8($s)
-{
- return @iconv('utf-8', 'utf-8', $s) == $s;
-}
-
-$tables = array ('city', 'city_in_maps', 'maps', 'pays', 'region');
-foreach ($tables as $table) {
+$tables = array ('city' => array('id', 'alias'),
+ 'city_in_maps' => array('city_id', 'map_id', 'infos'),
+ 'maps' => array('map_id'),
+ 'pays' => array('a2'),
+ 'region' => array('a2', 'region'));
+foreach ($tables as $table => $keys) {
$res = XDB::query("SELECT * FROM geoloc_$table");
if (!$res) {
echo "$table\n";
$from = array();
$to = array();
foreach ($array as $key=>$value) {
- $from[] = $key . '="' . XDB::escape($value) . '"';
+ if (in_array($key, $keys)) {
+ $from[] = $key . '=' . XDB::escape($value);
+ }
$valued = utf8_decode($value);
if (is_utf8($value) && $valued != $value) {
- $to[] = $key . '="' . XDB::escape($valued) .'"';
+ $to[] = $key . '=' . XDB::escape($valued);
}
}
if (!empty($to)) {
$sql = "UPDATE geoloc_$table SET $to WHERE $from";
if (!XDB::execute($sql)) {
echo "Echec : $sql\n";
+ } elseif (XDB::affectedRows() == 0) {
+ echo "$sql\n";
}
}
}