Current Path : /var/www/www-root/data/www/monolith-realty.ru/bitrix/modules/main/classes/general/ |
Current File : /var/www/www-root/data/www/monolith-realty.ru/bitrix/modules/main/classes/general/langdbresult.php |
<?php class _CLangDBResult extends CDBResult { public function __construct($res) { parent::__construct($res); } function Fetch() { if($res = parent::Fetch()) { global $DB, $CACHE_MANAGER; static $arCache; if(!is_array($arCache)) $arCache = array(); if(is_set($arCache, $res["LID"])) $res["DOMAINS"] = $arCache[$res["LID"]]; else { if(CACHED_b_lang_domain===false) { $res["DOMAINS"] = ""; $db_res = $DB->Query("SELECT * FROM b_lang_domain WHERE LID='".$res["LID"]."'"); while($ar_res = $db_res->Fetch()) { $domain = $ar_res["DOMAIN"]; $arErrorsTmp = array(); if ($domainTmp = CBXPunycode::ToUnicode($ar_res["DOMAIN"], $arErrorsTmp)) $domain = $domainTmp; $res["DOMAINS"] .= $domain."\r\n"; } } else { if($CACHE_MANAGER->Read(CACHED_b_lang_domain, "b_lang_domain", "b_lang_domain")) { $arLangDomain = $CACHE_MANAGER->Get("b_lang_domain"); } else { $arLangDomain = array("DOMAIN"=>array(), "LID"=>array()); $rs = $DB->Query("SELECT * FROM b_lang_domain ORDER BY ".$DB->Length("DOMAIN")); while($ar = $rs->Fetch()) { $arLangDomain["DOMAIN"][]=$ar; $arLangDomain["LID"][$ar["LID"]][]=$ar; } $CACHE_MANAGER->Set("b_lang_domain", $arLangDomain); } $res["DOMAINS"] = ""; if(isset($arLangDomain["LID"][$res["LID"]]) && is_array($arLangDomain["LID"][$res["LID"]])) { foreach($arLangDomain["LID"][$res["LID"]] as $ar_res) { $domain = $ar_res["DOMAIN"]; $arErrorsTmp = array(); if ($domainTmp = CBXPunycode::ToUnicode($ar_res["DOMAIN"], $arErrorsTmp)) $domain = $domainTmp; $res["DOMAINS"] .= $domain."\r\n"; } } } $res["DOMAINS"] = trim($res["DOMAINS"]); $arCache[$res["LID"]] = $res["DOMAINS"]; } if(empty($res["DOC_ROOT"]) || trim($res["DOC_ROOT"]) === "") $res["ABS_DOC_ROOT"] = $_SERVER["DOCUMENT_ROOT"]; else $res["ABS_DOC_ROOT"] = Rel2Abs($_SERVER["DOCUMENT_ROOT"], $res["DOC_ROOT"]); if($res["ABS_DOC_ROOT"]!==$_SERVER["DOCUMENT_ROOT"]) $res["SITE_URL"] = (CMain::IsHTTPS() ? "https://" : "http://").$res["SERVER_NAME"]; } return $res; } }