X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2Fphone.php;h=be6f3ad80fbd432795e44739f2ddd42d0fefb454;hb=5f9ad38e8805cd275f2943494b8b692601a39c9c;hp=8356f64f8f4ce8f20052d53aa78ea5af95d2d553;hpb=f7608ea5a67d0a98e926d3bd169fe2c0144c388f;p=platal.git diff --git a/classes/phone.php b/classes/phone.php index 8356f64..be6f3ad 100644 --- a/classes/phone.php +++ b/classes/phone.php @@ -187,10 +187,10 @@ class Phone if ((!isset($format['phoneprf'])) || ($format['phoneprf'] == '')) { $res = XDB::query('SELECT phonePrefix AS phoneprf, phoneFormat AS format FROM geoloc_countries - WHERE phonePrefix = {?} OR phonePrefix = {?} OR phonePrefix = {?} - ORDER BY phonePrefix DESC + WHERE phonePrefix = SUBSTRING({?}, 1, LENGTH(phonePrefix)) + ORDER BY LENGTH(phonePrefix) DESC LIMIT 1', - substr($tel, 0, 1), substr($tel, 0, 2), substr($tel, 0, 3)); + $tel); if ($res->numRows() == 0) { // No country found, does not format more than prepending a '+' sign. $this->error = true;