本文整理汇总了PHP中CMain::__GetConditionFName方法的典型用法代码示例。如果您正苦于以下问题:PHP CMain::__GetConditionFName方法的具体用法?PHP CMain::__GetConditionFName怎么用?PHP CMain::__GetConditionFName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMain
的用法示例。
在下文中一共展示了CMain::__GetConditionFName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetCurTemplate
function GetCurTemplate()
{
/** @noinspection PhpUnusedLocalVariableInspection */
global $DB, $APPLICATION, $USER;
$strSql = "\n\t\t\t\tSELECT\n\t\t\t\t\t" . CMain::__GetConditionFName() . ",\n\t\t\t\t\tTEMPLATE\n\t\t\t\tFROM\n\t\t\t\t\tb_site_template\n\t\t\t\tWHERE\n\t\t\t\t\tSITE_ID = '" . SITE_ID . "'\n\t\t\t\tORDER BY\n\t\t\t\t\tif(length(" . CMain::__GetConditionFName() . ")>0, 1, 2), SORT\n\t\t\t\t";
$dbr = $DB->Query($strSql);
while ($ar = $dbr->Fetch()) {
$strCondition = trim($ar["CONDITION"]);
if (strlen($strCondition) > 0 && !@eval("return " . $strCondition . ";")) {
continue;
}
if (($path = getLocalPath("templates/" . $ar["TEMPLATE"], FX_PERSONAL_ROOT)) !== false && is_dir($_SERVER["DOCUMENT_ROOT"] . $path)) {
return $ar["TEMPLATE"];
}
}
return ".default";
}
示例2: GetCurTemplate
public static function GetCurTemplate()
{
/** @noinspection PhpUnusedLocalVariableInspection */
global $DB, $APPLICATION, $USER, $CACHE_MANAGER;
if (CACHED_b_site_template === false) {
$strSql = "\n\t\t\t\tSELECT\n\t\t\t\t\t" . CMain::__GetConditionFName() . ",\n\t\t\t\t\tTEMPLATE\n\t\t\t\tFROM\n\t\t\t\t\tb_site_template\n\t\t\t\tWHERE\n\t\t\t\t\tSITE_ID = '" . SITE_ID . "'\n\t\t\t\tORDER BY\n\t\t\t\t\tif(length(" . CMain::__GetConditionFName() . ")>0, 1, 2), SORT\n\t\t\t\t";
$dbr = $DB->Query($strSql);
while ($ar = $dbr->Fetch()) {
$strCondition = trim($ar["CONDITION"]);
if (strlen($strCondition) > 0 && !@eval("return " . $strCondition . ";")) {
continue;
}
if (($path = getLocalPath("templates/" . $ar["TEMPLATE"], BX_PERSONAL_ROOT)) !== false && is_dir($_SERVER["DOCUMENT_ROOT"] . $path)) {
return $ar["TEMPLATE"];
}
}
} else {
if ($CACHE_MANAGER->Read(CACHED_b_site_template, "b_site_template")) {
$arSiteTemplateBySite = $CACHE_MANAGER->Get("b_site_template");
} else {
$dbr = $DB->Query("\n\t\t\t\t\tSELECT\n\t\t\t\t\t\t" . CMain::__GetConditionFName() . ",\n\t\t\t\t\t\tTEMPLATE,\n\t\t\t\t\t\tSITE_ID\n\t\t\t\t\tFROM\n\t\t\t\t\t\tb_site_template\n\t\t\t\t\tORDER BY\n\t\t\t\t\t\tSITE_ID, if(length(" . CMain::__GetConditionFName() . ")>0, 1, 2), SORT\n\t\t\t\t");
$arSiteTemplateBySite = array();
while ($ar = $dbr->Fetch()) {
$arSiteTemplateBySite[$ar['SITE_ID']][] = $ar;
}
$CACHE_MANAGER->Set("b_site_template", $arSiteTemplateBySite);
}
if (is_array($arSiteTemplateBySite[SITE_ID])) {
foreach ($arSiteTemplateBySite[SITE_ID] as $ar) {
$strCondition = trim($ar["CONDITION"]);
if (strlen($strCondition) > 0 && !@eval("return " . $strCondition . ";")) {
continue;
}
if (($path = getLocalPath("templates/" . $ar["TEMPLATE"], BX_PERSONAL_ROOT)) !== false && is_dir($_SERVER["DOCUMENT_ROOT"] . $path)) {
return $ar["TEMPLATE"];
}
}
}
}
return ".default";
}
示例3: Update
function Update($ID, $arFields)
{
global $DB, $MAIN_LANGS_CACHE, $MAIN_LANGS_ADMIN_CACHE, $CACHE_MANAGER;
unset($MAIN_LANGS_CACHE[$ID]);
unset($MAIN_LANGS_ADMIN_CACHE[$ID]);
if (!$this->CheckFields($arFields, $ID)) {
return false;
}
if (CACHED_b_lang !== false) {
$CACHE_MANAGER->CleanDir("b_lang");
}
if (is_set($arFields, "ACTIVE") && $arFields["ACTIVE"] != "Y") {
$arFields["ACTIVE"] = "N";
}
if (is_set($arFields, "DEF")) {
if ($arFields["DEF"] == "Y") {
$DB->Query("UPDATE b_lang SET DEF='N' WHERE DEF='Y'");
} else {
$arFields["DEF"] = "N";
}
}
$strUpdate = $DB->PrepareUpdate("b_lang", $arFields);
$strSql = "UPDATE b_lang SET " . $strUpdate . " WHERE LID='" . $DB->ForSql($ID, 2) . "'";
$DB->Query($strSql, false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
global $BX_CACHE_DOCROOT;
unset($BX_CACHE_DOCROOT[$ID]);
if (is_set($arFields, "DIR")) {
CheckDirPath($_SERVER["DOCUMENT_ROOT"] . $arFields["DIR"]);
}
if (is_set($arFields, "DOMAINS")) {
self::SaveDomains($ID, $arFields["DOMAINS"]);
}
if (is_set($arFields, "TEMPLATE")) {
if (CACHED_b_site_template !== false) {
$CACHE_MANAGER->Clean("b_site_template");
}
$DB->Query("DELETE FROM b_site_template WHERE SITE_ID='" . $DB->ForSQL($ID) . "'");
foreach ($arFields["TEMPLATE"] as $arTemplate) {
if (strlen(trim($arTemplate["TEMPLATE"])) > 0) {
$DB->Query("INSERT INTO b_site_template(SITE_ID, " . CMain::__GetConditionFName() . ", SORT, TEMPLATE) " . "VALUES('" . $DB->ForSQL($ID) . "', '" . $DB->ForSQL(trim($arTemplate["CONDITION"]), 255) . "', " . IntVal($arTemplate["SORT"]) . ", '" . $DB->ForSQL(trim($arTemplate["TEMPLATE"]), 255) . "')");
}
}
}
return true;
}
示例4: GetCurTemplate
function GetCurTemplate()
{
$err_mess = CSite::err_mess() . "<br>Function: GetCurTemplate<br>Line: ";
global $DB, $APPLICATION, $USER, $CACHE_MANAGER;
if (CACHED_b_site_template === false) {
$strSql = "\n\t\t\t\tSELECT\n\t\t\t\t\t" . CMain::__GetConditionFName() . ",\n\t\t\t\t\tTEMPLATE\n\t\t\t\tFROM\n\t\t\t\t\tb_site_template\n\t\t\t\tWHERE\n\t\t\t\t\tSITE_ID='" . SITE_ID . "'\n\t\t\t\tORDER BY\n\t\t\t\t\tCASE\n\t\t\t\t\t\twhen " . CMain::__GetConditionFName() . " is null then 2\n\t\t\t\t\t\telse 1\n\t\t\t\t\tEND,\n\t\t\t\t\tSORT\n\t\t\t\t";
$dbr = $DB->Query($strSql, false, $err_mess . __LINE__);
while ($ar = $dbr->Fetch()) {
$strCondition = trim($ar["CONDITION"]);
if (strlen($strCondition) > 0 && !@eval("return " . $strCondition . ";")) {
continue;
}
if (file_exists($_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/templates/" . $ar["TEMPLATE"]) && is_dir($_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/templates/" . $ar["TEMPLATE"])) {
return $ar["TEMPLATE"];
}
}
} else {
if ($CACHE_MANAGER->Read(CACHED_b_site_template, "b_site_template")) {
$arSiteTemplateBySite = $CACHE_MANAGER->Get("b_site_template");
} else {
$dbr = $DB->Query("\n\t\t\t\t\tSELECT\n\t\t\t\t\t\t" . CMain::__GetConditionFName() . ",\n\t\t\t\t\t\tTEMPLATE,\n\t\t\t\t\t\tSITE_ID\n\t\t\t\t\tFROM\n\t\t\t\t\t\tb_site_template\n\t\t\t\t\tORDER BY\n\t\t\t\t\t\tSITE_ID, CASE WHEN " . CMain::__GetConditionFName() . " IS NULL THEN 2 ELSE 1 END, SORT\n\t\t\t\t");
while ($ar = $dbr->Fetch()) {
$arSiteTemplateBySite[$ar['SITE_ID']][] = $ar;
}
$CACHE_MANAGER->Set("b_site_template", $arSiteTemplateBySite);
}
foreach ($arSiteTemplateBySite[SITE_ID] as $ar) {
$strCondition = trim($ar["CONDITION"]);
if (strlen($strCondition) > 0 && !@eval("return " . $strCondition . ";")) {
continue;
}
if (file_exists($_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/templates/" . $ar["TEMPLATE"]) && is_dir($_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/templates/" . $ar["TEMPLATE"])) {
return $ar["TEMPLATE"];
}
}
}
return ".default";
}
示例5: InstallFiles
function InstallFiles($arParams = array())
{
global $DB;
if ($_ENV["COMPUTERNAME"] != 'BX') {
//Admin files
CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/learning/install/admin", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/admin", false);
CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/learning/install/images", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/images/learning", true, true);
CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/learning/install/public/js", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/js", true, true);
CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/learning/install/js", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/js", true, true);
//Theme
CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/learning/install/themes", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/themes", true, true);
CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/learning/install/components", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/components", True, True);
}
//copy public scripts
$arSITE_ID = array();
$sites = CLang::GetList($by, $order, array("ACTIVE" => "Y"));
while ($site = $sites->Fetch()) {
if ($_REQUEST["copy_" . $site["LID"]] == "Y" && !empty($_REQUEST["path_" . $site["LID"]])) {
$arSITE_ID[] = $site["LID"];
$DOC_ROOT = strlen($site["DOC_ROOT"]) <= 0 ? $_SERVER["DOCUMENT_ROOT"] : $site["DOC_ROOT"];
$ldir = $site['LANGUAGE_ID'] == 'ru' ? 'ru' : 'en';
CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/learning/install/public/site/{$ldir}/", $DOC_ROOT . $_REQUEST["path_" . $site["LID"]], true, true);
}
}
if (!file_exists($_SERVER["DOCUMENT_ROOT"] . "/bitrix/templates/learning/")) {
CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/learning/install/public/template/", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/templates/learning/", true, true);
}
if (!empty($arSITE_ID)) {
if (strlen($_REQUEST["template_id"]) <= 0) {
$_REQUEST["template_id"] = "learning";
}
//Copy Template
CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/learning/install/public/template/", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/templates/" . $_REQUEST["template_id"] . "/", true, true);
foreach ($arSITE_ID as $SITE_ID) {
$path = $_REQUEST["path_" . $SITE_ID];
if (strlen($path) <= 0) {
continue;
}
if (substr($path, -1, 1) != "/") {
$path .= "/";
}
$cond = "CSite::InDir('" . $path . "course/')";
$DB->Query("INSERT INTO b_site_template(SITE_ID, " . CMain::__GetConditionFName() . ", SORT, TEMPLATE) " . "VALUES('" . $DB->ForSQL($SITE_ID) . "', '" . $DB->ForSQL($cond, 255) . "', '100', '" . $DB->ForSQL(trim($_REQUEST["template_id"]), 255) . "')", true);
}
}
return true;
}