/** * Get city by Geo * * @return array */ public static function getGeoCity() { global $currentGeo; //unset($_SESSION["USER_GEO"]); //unset($_COOKIE["city_select_data"]); $arFilter = array("=UF_ACTIVE" => 1); if (!$_SESSION["USER_GEO"] || empty($_SESSION["USER_GEO"])) { if ($_COOKIE["city_select_data"]) { $arFilter["=UF_TITLE"] = $_COOKIE["city_select_data"]; $_SESSION["USER_GEO"] = self::getByFilterSelect($arFilter); if (empty($_SESSION["USER_GEO"])) { unset($arFilter["=UF_TITLE"]); $arFilter["=UF_DEFAULT"] = 1; $_SESSION["USER_GEO"] = self::getByFilterSelect($arFilter); } } else { $arGeo = GeoCity::getInstance()->getRecord(); if (!empty($arGeo)) { $arFilter["=UF_REGION"] = $arGeo["region"]; $_SESSION["USER_GEO"] = self::getByFilterSelect($arFilter); if (empty($_SESSION["USER_GEO"])) { unset($arFilter["=UF_REGION"]); $arFilter["=UF_DEFAULT"] = 1; $_SESSION["USER_GEO"] = self::getByFilterSelect($arFilter); } } else { unset($arFilter["=UF_REGION"]); $arFilter["=UF_DEFAULT"] = 1; $_SESSION["USER_GEO"] = self::getByFilterSelect($arFilter); } } } //\CDev::pre($arFilter); if (empty($_SESSION["USER_GEO"]["COUNTRY_ISO"])) { $_SESSION["USER_GEO"]["COUNTRY_ISO"] = "RU"; } $currentGeo = $_SESSION["USER_GEO"]; return $_SESSION["USER_GEO"]; }