本文整理汇总了PHP中CMain::err_mess方法的典型用法代码示例。如果您正苦于以下问题:PHP CMain::err_mess方法的具体用法?PHP CMain::err_mess怎么用?PHP CMain::err_mess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMain
的用法示例。
在下文中一共展示了CMain::err_mess方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetLang
function GetLang($cur_dir = false, $cur_host = false)
{
$err_mess = CMain::err_mess() . "<br>Function: GetLang<br>Line: ";
global $DB, $lang, $DOCUMENT_ROOT, $MAIN_LANGS_CACHE, $MAIN_LANGS_ADMIN_CACHE;
$arDef = array("LID" => "en", "ID" => "en", "SITE_ID" => "en", "FORMAT_DATE" => "MM/DD/YYYY", "FORMAT_DATETIME" => "MM/DD/YYYY HH24:MI:SS");
if ($cur_dir === false) {
$cur_dir = $this->GetCurDir();
}
if ($cur_host === false) {
$cur_host = $_SERVER["HTTP_HOST"];
}
if (substr($cur_dir, 0, strlen(BX_ROOT . "/admin/")) == BX_ROOT . "/admin/" || substr($cur_dir, 0, strlen(BX_ROOT . "/updates/")) == BX_ROOT . "/updates/" || defined("ADMIN_SECTION") && ADMIN_SECTION == true || defined("BX_PUBLIC_TOOLS") && BX_PUBLIC_TOOLS === true) {
//путь по параметру
if (strlen($lang) <= 0) {
$lang = COption::GetOptionString("main", "admin_lid", "ru");
}
$rs = CLanguage::GetList($o, $b, array("LID" => $lang, "ACTIVE" => $ACTIVE));
if ($ar = $rs->Fetch()) {
$MAIN_LANGS_ADMIN_CACHE[$ar["LID"]] = $ar;
return $ar;
}
//если переменная не задана - берем язык по умолчанию
$strSql = "\n\t\t\t\tSELECT\n\t\t\t\t\t*\n\t\t\t\tFROM\n\t\t\t\t\tb_language\n\t\t\t\tWHERE\n\t\t\t\t\tACTIVE='Y'\n\t\t\t\tORDER BY\n\t\t\t\t\tDEF DESC, SORT\n\t\t\t\t";
$rs = $DB->Query($strSql, false, $err_mess . __LINE__);
if ($ar = $rs->Fetch()) {
$MAIN_LANGS_ADMIN_CACHE[$ar["LID"]] = $ar;
return $ar;
}
//ну если вообще ничего не задано - вернем просто
return $arDef;
} else {
$arURL = parse_url("http://" . $cur_host);
if ($arURL["scheme"] == "" && strlen($arURL["host"]) > 0) {
$CURR_DOMAIN = $arURL["host"];
} else {
$CURR_DOMAIN = $cur_host;
}
if (strpos($CURR_DOMAIN, ':') > 0) {
$CURR_DOMAIN = substr($CURR_DOMAIN, 0, strpos($CURR_DOMAIN, ':'));
}
$CURR_DOMAIN = trim($CURR_DOMAIN, "\t\r\n .");
//текущий язык определяем по пути
if (CACHED_b_lang !== false && CACHED_b_lang_domain !== false) {
global $CACHE_MANAGER;
$strSql = "SELECT L.*, L.LID as ID, L.LID as SITE_ID " . "FROM b_lang L " . "WHERE L.ACTIVE='Y' " . "ORDER BY " . "\tLEN(L.DIR) DESC, " . "\tL.DOMAIN_LIMITED DESC, " . "\tSORT ";
if ($CACHE_MANAGER->Read(CACHED_b_lang, "b_lang" . md5($strSql), "b_lang")) {
$arLang = $CACHE_MANAGER->Get("b_lang" . md5($strSql));
} else {
$arLang = array();
$R = $DB->Query($strSql, false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
while ($row = $R->Fetch()) {
$arLang[] = $row;
}
$CACHE_MANAGER->Set("b_lang" . md5($strSql), $arLang);
}
$strSql = "SELECT " . "LD.LID as LD_LID,LD.DOMAIN as LD_DOMAIN " . "FROM " . "\t b_lang_domain LD " . "ORDER BY " . "\tLEN(LD.DOMAIN) DESC ";
if ($CACHE_MANAGER->Read(CACHED_b_lang_domain, "b_lang_domain2", "b_lang_domain")) {
$arLangDomain = $CACHE_MANAGER->Get("b_lang_domain2");
} else {
$arLangDomain = array();
$R = $DB->Query($strSql, false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
while ($row = $R->Fetch()) {
$arLangDomain[$row["LD_LID"]][] = $row;
}
$CACHE_MANAGER->Set("b_lang_domain2", $arLangDomain);
}
$arJoin = array();
foreach ($arLang as $row) {
//LEFT JOIN
$bLeft = true;
//LEFT JOIN b_lang_domain LD ON L.LID=LD.LID
if (array_key_exists($row["LID"], $arLangDomain)) {
foreach ($arLangDomain[$row["LID"]] as $dom) {
//AND '".$DB->ForSql($CURR_DOMAIN, 255)."' LIKE CONCAT('%', LD.DOMAIN)
if (strcasecmp(substr($CURR_DOMAIN, -strlen($dom["LD_DOMAIN"])), $dom["LD_DOMAIN"]) == 0) {
$arJoin[] = $row + $dom;
$bLeft = false;
}
}
}
if ($bLeft) {
$arJoin[] = $row + array("LD_LID" => "", "LD_DOMAIN" => "");
}
}
$A = array();
foreach ($arJoin as $row) {
//WHERE ('".$DB->ForSql($cur_dir)."' LIKE CONCAT(L.DIR, '%') OR LD.LID IS NOT NULL)
if ($row["LD_LID"] != "" || strcasecmp(substr($cur_dir, 0, strlen($row["DIR"])), $row["DIR"]) == 0) {
$A[] = $row;
}
}
$res = false;
if ($res === false) {
foreach ($A as $row) {
if (strcasecmp(substr($cur_dir, 0, strlen($row["DIR"])), $row["DIR"]) == 0 && ($row["DOMAIN_LIMITED"] == "Y" && $row["LD_LID"] != "" || $row["DOMAIN_LIMITED"] != "Y")) {
$res = $row;
break;
}
}
}
//.........这里部分代码省略.........