function getStreetByNameAndRegion() { $s = $_POST['s']; $sc = $_POST['sc']; $id_city = max(0, (int) $_POST['city_id']); $id_country = max(0, (int) $_POST['country_id']); $id_region = max(0, (int) $_POST['region_id']); if (!$id_region && $sc) { $id_region = GeoLibrary::getStreets($id_region, $sc); $id_region = array_pop($id_region); $id_region = $id_region['id']; } $this->data['streets'] = GeoLibrary::getStreets($id_region, $s); $this->data['country_id'] = $id_country; $this->data['city_id'] = $id_city; $this->data['region_id'] = $id_region; }
private static function loadCountries() { self::$countries = Database::sql2array('SELECT * FROM `lib_country`'); }