Пример #1
0
 /**
  * Display user geo location block
  */
 function _show_user_geo_block($params = [])
 {
     if (!main()->USE_GEO_IP) {
         return false;
     }
     $geo_data = main()->_USER_GEO_DATA;
     if (empty($geo_data)) {
         return false;
     }
     $replace = ['country_name' => _prepare_html($geo_data['country_name']), 'country_code_lower' => strtolower($geo_data['country_code']), 'region_code' => _prepare_html($geo_data['region_code']), 'region_name' => _prepare_html(_region_name($geo_data['region_code'], $geo_data['country_code'])), 'city_name' => _prepare_html($geo_data['city_name']), 'change_link' => './?object=geo_content&action=change_location'];
     return tpl()->parse('user_geo_block', $replace);
 }
Пример #2
0
 function change_location_result()
 {
     if (!main()->USE_GEO_IP) {
         return false;
     }
     // Current system selected
     $sel_data = main()->_USER_GEO_DATA;
     if (empty($sel_data)) {
         return _e(t("Internal error #036. Please contact site admin."));
     }
     // Check if something has changed
     if (main()->USER_ID && !empty($sel_data)) {
         if ($sel_data["country_code"] && $sel_data["country_code"] != $this->_user_info["country"] || $sel_data["region_code"] && $sel_data["region_code"] != $this->_user_info["state"] || $sel_data["city_name"] && strtolower($sel_data["city_name"]) != strtolower($this->_user_info["city"]) || $sel_data["zip_code"] && $sel_data["zip_code"] != $this->_user_info["zip_code"]) {
             $something_changed = 1;
         }
     }
     // Prepare template
     $replace2 = ["form_action" => "./?object=" . 'geo_content' . "&action=change_location", "show_update_form" => main()->USER_ID && $something_changed ? 1 : 0, "city" => _prepare_html($sel_data["city_name"]), "region" => _prepare_html(_region_name($sel_data["region_code"], $sel_data["country_code"])), "country" => _prepare_html(_country_name($sel_data["country_code"])), "zip" => _prepare_html($sel_data["zip_code"])];
     return tpl()->parse('geo_content' . "/change_location_success", $replace2);
 }