<?php
/***************************************************************************
- * Copyright (C) 2003-2008 Polytechnique.org *
+ * Copyright (C) 2003-2009 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
if (empty($infos['country'])) {
$infos['country'] = '00';
}
- if (isset($infos['sql']) && $infos['sql'])
- XDB::execute("REPLACE INTO geoloc_city
- VALUES ".$infos['sql']);
+ if (isset($infos['sql']) && $infos['sql']) {
+ $sql = explode(', ', trim($infos['sql'], '()'));
+ if (count($sql) == 16) {
+ for ($i = 0 ; $i < 16 ; ++$i) {
+ $sql[$i] = stripslashes(trim($sql[$i], ' \''));
+ }
+ XDB::execute("REPLACE INTO geoloc_city
+ VALUES ({?}, {?}, {?}, {?}, {?}, {?},
+ {?}, {?}, {?}, {?}, {?}, {?},
+ {?}, {?}, {?}, {?})",
+ $sql[0], $sql[1], $sql[2], $sql[3], $sql[4], $sql[5],
+ $sql[6], $sql[7], $sql[8], $sql[9], $sql[10], $sql[11],
+ $sql[12], $sql[13], $sql[14], $sql[15]);
+ }
+ }
if (isset($infos['display']) && $infos['display'])
XDB::execute("UPDATE geoloc_pays
SET display = {?}
if (isset($adr['city']) && $adr['city']) $l .= $adr['city'];
}
if ($l) $t .= "\n".trim($l);
- if ($adr['country'] != '00' && (!$adr['countrytxt'] || $adr['countrytxt'] == strtoupper($adr['countrytxt']))) {
+ if ($adr['country'] != '00' && (!$adr['countrytxt'] || $adr['countrytxt'] == mb_strtoupper($adr['countrytxt']))) {
$res = XDB::query("SELECT pays FROM geoloc_pays WHERE a2 = {?}", $adr['country']);
$adr['countrytxt'] = $res->fetchOneCell();
}
*/
function compare_addresses_text($a, $b)
{
- $ta = strtoupper(preg_replace(array("/[0-9,\"'#~:;_\- ]/", "/\r\n/"), array("", "\n"), $a));
- $tb = strtoupper(preg_replace(array("/[0-9,\"'#~:;_\- ]/", "/\r\n/"), array("", "\n"), $b));
+ $ta = mb_strtoupper(preg_replace(array("/[0-9,\"'#~:;_\- ]/", "/\r\n/"), array("", "\n"), $a));
+ $tb = mb_strtoupper(preg_replace(array("/[0-9,\"'#~:;_\- ]/", "/\r\n/"), array("", "\n"), $b));
$la = explode("\n", $ta);
$lb = explode("\n", $tb);