当前位置: 首页>>代码示例>>PHP>>正文


PHP CLang::GetByID方法代码示例

本文整理汇总了PHP中CLang::GetByID方法的典型用法代码示例。如果您正苦于以下问题:PHP CLang::GetByID方法的具体用法?PHP CLang::GetByID怎么用?PHP CLang::GetByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CLang的用法示例。


在下文中一共展示了CLang::GetByID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ReplaceDetailUrl

 public static function ReplaceDetailUrl($url, $arr, $server_name = false, $arrType = false)
 {
     /** @global CDatabase $DB */
     global $DB;
     static $arSectionCache = array();
     static $arSectionPathCache = array();
     if ($server_name) {
         $url = str_replace("#LANG#", $arr["LANG_DIR"], $url);
         if (defined("ADMIN_SECTION") && ADMIN_SECTION === true || !defined("BX_STARTED")) {
             static $cache = array();
             if (!isset($cache[$arr["LID"]])) {
                 $db_lang = CLang::GetByID($arr["LID"]);
                 $arLang = $db_lang->Fetch();
                 $cache[$arr["LID"]] = $arLang;
             }
             $arLang = $cache[$arr["LID"]];
             $url = str_replace("#SITE_DIR#", $arLang["DIR"], $url);
             $url = str_replace("#SERVER_NAME#", $arLang["SERVER_NAME"], $url);
         } else {
             $url = str_replace("#SITE_DIR#", SITE_DIR, $url);
             $url = str_replace("#SERVER_NAME#", SITE_SERVER_NAME, $url);
         }
     }
     if (strpos($url, "#PRODUCT_URL#") !== false) {
         $url = str_replace("#PRODUCT_URL#", CIBlock::_GetProductUrl($arr["ID"], $arr["IBLOCK_ID"], $server_name, $arrType), $url);
     }
     static $arSearch = array("#SITE_DIR#", "#ID#", "#CODE#", "#EXTERNAL_ID#", "#IBLOCK_TYPE_ID#", "#IBLOCK_ID#", "#IBLOCK_CODE#", "#IBLOCK_EXTERNAL_ID#", "#ELEMENT_ID#", "#ELEMENT_CODE#", "#SECTION_ID#", "#SECTION_CODE#", "#SECTION_CODE_PATH#");
     $arReplace = array($arr["LANG_DIR"], intval($arr["ID"]) > 0 ? intval($arr["ID"]) : "", urlencode(isset($arr["~CODE"]) ? $arr["~CODE"] : $arr["CODE"]), urlencode(isset($arr["~EXTERNAL_ID"]) ? $arr["~EXTERNAL_ID"] : $arr["EXTERNAL_ID"]), urlencode(isset($arr["~IBLOCK_TYPE_ID"]) ? $arr["~IBLOCK_TYPE_ID"] : $arr["IBLOCK_TYPE_ID"]), intval($arr["IBLOCK_ID"]) > 0 ? intval($arr["IBLOCK_ID"]) : "", urlencode(isset($arr["~IBLOCK_CODE"]) ? $arr["~IBLOCK_CODE"] : $arr["IBLOCK_CODE"]), urlencode(isset($arr["~IBLOCK_EXTERNAL_ID"]) ? $arr["~IBLOCK_EXTERNAL_ID"] : $arr["IBLOCK_EXTERNAL_ID"]));
     if ($arrType === "E") {
         $arReplace[] = intval($arr["ID"]) > 0 ? intval($arr["ID"]) : "";
         $arReplace[] = urlencode(isset($arr["~CODE"]) ? $arr["~CODE"] : $arr["CODE"]);
         #Deal with symbol codes
         $SECTION_CODE = "";
         $SECTION_ID = intval($arr["IBLOCK_SECTION_ID"]);
         if ($SECTION_ID > 0 && (strpos($url, "#SECTION_CODE#") !== false || strpos($url, "#SECTION_CODE_PATH#") !== false)) {
             if (!array_key_exists($SECTION_ID, $arSectionCache)) {
                 $res = $DB->Query("SELECT IBLOCK_ID, CODE FROM b_iblock_section WHERE ID = " . $SECTION_ID);
                 $arSectionCache[$SECTION_ID] = $res->Fetch();
             }
             if (is_array($arSectionCache[$SECTION_ID])) {
                 $SECTION_CODE = $arSectionCache[$SECTION_ID]["CODE"];
             }
         }
         $SECTION_CODE_PATH = "";
         if ($SECTION_ID > 0 && array_key_exists($SECTION_ID, $arSectionCache) && strpos($url, "#SECTION_CODE_PATH#") !== false) {
             if (!array_key_exists($SECTION_ID, $arSectionPathCache)) {
                 $res = CIBlockSection::GetNavChain($arSectionCache[$SECTION_ID]["IBLOCK_ID"], $SECTION_ID, array("ID", "IBLOCK_SECTION_ID", "CODE"));
                 while ($a = $res->Fetch()) {
                     $arSectionPathCache[$SECTION_ID] .= urlencode($a["CODE"]) . "/";
                 }
             }
             if (isset($arSectionCache[$SECTION_ID])) {
                 $SECTION_CODE_PATH = rtrim($arSectionPathCache[$SECTION_ID], "/");
             }
         }
         $arReplace[] = $SECTION_ID > 0 ? $SECTION_ID : "";
         $arReplace[] = urlencode($SECTION_CODE);
         $arReplace[] = $SECTION_CODE_PATH;
     } elseif ($arrType === "S") {
         $SECTION_ID = intval($arr["ID"]);
         $SECTION_CODE_PATH = "";
         if (strpos($url, "#SECTION_CODE_PATH#") !== false && $SECTION_ID > 0) {
             if (!array_key_exists($SECTION_ID, $arSectionCache)) {
                 $res = $DB->Query("SELECT IBLOCK_ID, CODE FROM b_iblock_section WHERE ID = " . $SECTION_ID);
                 $arSectionCache[$SECTION_ID] = $res->Fetch();
             }
             if (is_array($arSectionCache[$SECTION_ID])) {
                 if (!array_key_exists($SECTION_ID, $arSectionPathCache)) {
                     $res = CIBlockSection::GetNavChain($arSectionCache[$SECTION_ID]["IBLOCK_ID"], $SECTION_ID, array("ID", "IBLOCK_SECTION_ID", "CODE"));
                     while ($a = $res->Fetch()) {
                         $arSectionPathCache[$SECTION_ID] .= urlencode($a["CODE"]) . "/";
                     }
                 }
                 if (isset($arSectionCache[$SECTION_ID])) {
                     $SECTION_CODE_PATH = rtrim($arSectionPathCache[$SECTION_ID], "/");
                 }
             }
         }
         $arReplace[] = "";
         $arReplace[] = "";
         $arReplace[] = $SECTION_ID > 0 ? $SECTION_ID : "";
         $arReplace[] = urlencode(isset($arr["~CODE"]) ? $arr["~CODE"] : $arr["CODE"]);
         $arReplace[] = $SECTION_CODE_PATH;
     } else {
         $arReplace[] = intval($arr["ELEMENT_ID"]) > 0 ? intval($arr["ELEMENT_ID"]) : "";
         $arReplace[] = urlencode(isset($arr["~ELEMENT_CODE"]) ? $arr["~ELEMENT_CODE"] : $arr["ELEMENT_CODE"]);
         $arReplace[] = intval($arr["IBLOCK_SECTION_ID"]) > 0 ? intval($arr["IBLOCK_SECTION_ID"]) : "";
         $arReplace[] = urlencode(isset($arr["~SECTION_CODE"]) ? $arr["~SECTION_CODE"] : $arr["SECTION_CODE"]);
         $arReplace[] = "";
     }
     $url = str_replace($arSearch, $arReplace, $url);
     return preg_replace("'(?<!:)/+'s", "/", $url);
 }
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:93,代码来源:iblock.php

示例2: CheckFields

	function CheckFields($arFields, $ID=false)
	{
		global $APPLICATION;
		$arMsg = array();

		if (is_set($arFields, 'NAME') && strlen($arFields['NAME']) < 1)
		{
			CMailError::SetError('B_MAIL_ERR_NAME', GetMessage('MAIL_CL_ERR_NAME').' "'.GetMessage('MAIL_CL_NAME').'"');
			$arMsg[] = array('id' => 'NAME', 'text' => GetMessage('MAIL_CL_ERR_NAME').' "'.GetMessage('MAIL_CL_NAME').'"');
		}

		if (in_array(strtolower($arFields['SERVER_TYPE']), array('pop3', 'imap', 'controller', 'domain', 'crdomain')) && is_set($arFields, 'LOGIN') && strlen($arFields['LOGIN']) < 1)
		{
			CMailError::SetError('B_MAIL_ERR_LOGIN', GetMessage('MAIL_CL_ERR_NAME').' "'.GetMessage('MAIL_CL_LOGIN').'"');
			$arMsg[] = array('id' => 'LOGIN', 'text' => GetMessage('MAIL_CL_ERR_NAME').' "'.GetMessage('MAIL_CL_LOGIN').'"');
		}

		if (in_array(strtolower($arFields['SERVER_TYPE']), array('pop3', 'imap')) && is_set($arFields, 'PASSWORD') && strlen($arFields['PASSWORD']) < 1)
		{
			CMailError::SetError('B_MAIL_ERR_PASSWORD', GetMessage('MAIL_CL_ERR_NAME').' "'.GetMessage('MAIL_CL_PASSWORD').'"');
			$arMsg[] = array('id' => 'PASSWORD', 'text' => GetMessage('MAIL_CL_ERR_NAME').' "'.GetMessage('MAIL_CL_PASSWORD').'"');
		}

		if (strtolower($arFields['SERVER_TYPE']) == 'imap' && is_set($arFields, 'LINK') && strlen($arFields['LINK']) < 1)
		{
			CMailError::SetError('B_MAIL_ERR_LINK', GetMessage('MAIL_CL_ERR_NAME').' "'.GetMessage('MAIL_CL_LINK').'"');
			$arMsg[] = array('id' => 'LINK', 'text' => GetMessage('MAIL_CL_ERR_NAME').' "'.GetMessage('MAIL_CL_LINK').'"');
		}

		if (in_array(strtolower($arFields['SERVER_TYPE']), array('imap', 'controller', 'domain', 'crdomain')) && is_set($arFields, 'USER_ID') && strlen($arFields['USER_ID']) < 1)
		{
			CMailError::SetError('B_MAIL_ERR_USER_ID', GetMessage('MAIL_CL_ERR_NAME').' "'.GetMessage('MAIL_CL_USER_ID').'"');
			$arMsg[] = array('id' => 'USER_ID', 'text' => GetMessage('MAIL_CL_ERR_NAME').' "'.GetMessage('MAIL_CL_USER_ID').'"');
		}

		if (in_array(strtolower($arFields['SERVER_TYPE']), array('pop3', 'smtp', 'imap')) && is_set($arFields, 'SERVER') && strlen($arFields['SERVER']) < 1)
		{
			CMailError::SetError('B_MAIL_ERR_SERVER_NAME', GetMessage('MAIL_CL_ERR_NAME').' "'.GetMessage('MAIL_CL_SERVER').'"');
			$arMsg[] = array('id' => 'SERVER', 'text' => GetMessage('MAIL_CL_ERR_NAME').' "'.GetMessage('MAIL_CL_SERVER').'"');
		}
		elseif (strtolower($arFields['SERVER_TYPE']) == 'smtp')
		{
			$dbres = CMailBox::GetList(array(), array('ACTIVE' => 'Y', 'SERVER_TYPE' => 'smtp', 'SERVER' => $arFields['SERVER'], 'PORT' => $arFields['PORT']));
			while($arres = $dbres->Fetch())
			{
				if ($ID === false || $arres['ID'] != $ID)
				{
					CMailError::SetError('B_MAIL_ERR_SERVER_NAME',  GetMessage('B_MAIL_ERR_SN').' "'.GetMessage('MAIL_CL_SERVER').'"');
					$arMsg[] = array('id' => 'SERVER', 'text' => GetMessage('B_MAIL_ERR_SN').' "'.GetMessage('MAIL_CL_SERVER').'"');
					break;
				}
			}
		}

		if (is_set($arFields, 'LID'))
		{
			$r = CLang::GetByID($arFields['LID']);
			if (!$r->Fetch())
			{
				CMailError::SetError('B_MAIL_ERR_BAD_LANG', GetMessage('MAIL_CL_ERR_BAD_LANG'));
				$arMsg[] = array('id' => 'LID', 'text' => GetMessage('MAIL_CL_ERR_BAD_LANG'));
			}
		}
		elseif ($ID === false)
		{
			CMailError::SetError('B_MAIL_ERR_BAD_LANG_NA', GetMessage('MAIL_CL_ERR_BAD_LANG_NX'));
			$arMsg[] = array('id' => 'LID', 'text' => GetMessage('MAIL_CL_ERR_BAD_LANG_NX'));
		}

		if ($arFields['USER_ID'])
		{
			if (is_set($arFields, 'SERVICE_ID'))
			{
				$result = Bitrix\Mail\MailServicesTable::getList(array(
					'filter' => array('=SITE_ID' => $arFields['LID'], '=ID' => $arFields['SERVICE_ID'])
				));
				if (!$result->fetch())
				{
					CMailError::SetError('B_MAIL_ERR_BAD_SERVICE_ID', GetMessage('MAIL_CL_ERR_BAD_SERVICE_ID'));
					$arMsg[] = array('id' => 'SERVICE_ID', 'text' => GetMessage('MAIL_CL_ERR_BAD_SERVICE_ID'));
				}
			}
			else if ($ID === false)
			{
				CMailError::SetError('B_MAIL_ERR_BAD_SERVICE_ID_NA', GetMessage('MAIL_CL_ERR_BAD_SERVICE_ID_NX'));
				$arMsg[] = array('id' => 'SERVICE_ID', 'text' => GetMessage('MAIL_CL_ERR_BAD_SERVICE_ID_NX'));
			}
		}

		if (!empty($arMsg))
		{
			$e = new CAdminException($arMsg);
			$APPLICATION->ThrowException($e);
			return false;
		}

		return true;
	}
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:98,代码来源:mail.php

示例3: ReplaceDetailUrl

 public static function ReplaceDetailUrl($url, $arr, $server_name = false, $arrType = false)
 {
     /** @global CDatabase $DB */
     global $DB;
     if ($server_name) {
         $url = str_replace("#LANG#", $arr["LANG_DIR"], $url);
         if (defined("ADMIN_SECTION") && ADMIN_SECTION === true || !defined("BX_STARTED")) {
             static $cache = array();
             if (!isset($cache[$arr["LID"]])) {
                 $db_lang = CLang::GetByID($arr["LID"]);
                 $arLang = $db_lang->Fetch();
                 $cache[$arr["LID"]] = $arLang;
             }
             $arLang = $cache[$arr["LID"]];
             $url = str_replace("#SITE_DIR#", $arLang["DIR"], $url);
             $url = str_replace("#SERVER_NAME#", $arLang["SERVER_NAME"], $url);
         } else {
             $url = str_replace("#SITE_DIR#", SITE_DIR, $url);
             $url = str_replace("#SERVER_NAME#", SITE_SERVER_NAME, $url);
         }
     }
     if (strpos($url, "#PRODUCT_URL#") !== false) {
         $url = str_replace("#PRODUCT_URL#", CIBlock::_GetProductUrl($arr["ID"], $arr["IBLOCK_ID"], $server_name, $arrType), $url);
     }
     static $arSearch = array("#SITE_DIR#", "#ID#", "#CODE#", "#EXTERNAL_ID#", "#IBLOCK_TYPE_ID#", "#IBLOCK_ID#", "#IBLOCK_CODE#", "#IBLOCK_EXTERNAL_ID#", "#ELEMENT_ID#", "#ELEMENT_CODE#", "#SECTION_ID#", "#SECTION_CODE#", "#SECTION_CODE_PATH#");
     $arReplace = array($arr["LANG_DIR"], intval($arr["ID"]) > 0 ? intval($arr["ID"]) : "", urlencode(isset($arr["~CODE"]) ? $arr["~CODE"] : $arr["CODE"]), urlencode(isset($arr["~EXTERNAL_ID"]) ? $arr["~EXTERNAL_ID"] : $arr["EXTERNAL_ID"]), urlencode(isset($arr["~IBLOCK_TYPE_ID"]) ? $arr["~IBLOCK_TYPE_ID"] : $arr["IBLOCK_TYPE_ID"]), intval($arr["IBLOCK_ID"]) > 0 ? intval($arr["IBLOCK_ID"]) : "", urlencode(isset($arr["~IBLOCK_CODE"]) ? $arr["~IBLOCK_CODE"] : $arr["IBLOCK_CODE"]), urlencode(isset($arr["~IBLOCK_EXTERNAL_ID"]) ? $arr["~IBLOCK_EXTERNAL_ID"] : $arr["IBLOCK_EXTERNAL_ID"]));
     if ($arrType === "E") {
         $arReplace[] = intval($arr["ID"]) > 0 ? intval($arr["ID"]) : "";
         $arReplace[] = urlencode(isset($arr["~CODE"]) ? $arr["~CODE"] : $arr["CODE"]);
         #Deal with symbol codes
         $SECTION_ID = intval($arr["IBLOCK_SECTION_ID"]);
         $SECTION_CODE = "";
         if ($SECTION_ID > 0 && strpos($url, "#SECTION_CODE#") !== false) {
             $SECTION_CODE = CIBlockSection::getSectionCode($SECTION_ID);
         }
         $SECTION_CODE_PATH = "";
         if ($SECTION_ID > 0 && strpos($url, "#SECTION_CODE_PATH#") !== false) {
             $SECTION_CODE_PATH = CIBlockSection::getSectionCodePath($SECTION_ID);
         }
         $arReplace[] = $SECTION_ID > 0 ? $SECTION_ID : "";
         $arReplace[] = $SECTION_CODE;
         $arReplace[] = $SECTION_CODE_PATH;
     } elseif ($arrType === "S") {
         $SECTION_ID = intval($arr["ID"]);
         $SECTION_CODE_PATH = "";
         if ($SECTION_ID > 0 && strpos($url, "#SECTION_CODE_PATH#") !== false) {
             $SECTION_CODE_PATH = CIBlockSection::getSectionCodePath($SECTION_ID);
         }
         $arReplace[] = "";
         $arReplace[] = "";
         $arReplace[] = $SECTION_ID > 0 ? $SECTION_ID : "";
         $arReplace[] = urlencode(isset($arr["~CODE"]) ? $arr["~CODE"] : $arr["CODE"]);
         $arReplace[] = $SECTION_CODE_PATH;
     } else {
         $arReplace[] = intval($arr["ELEMENT_ID"]) > 0 ? intval($arr["ELEMENT_ID"]) : "";
         $arReplace[] = urlencode(isset($arr["~ELEMENT_CODE"]) ? $arr["~ELEMENT_CODE"] : $arr["ELEMENT_CODE"]);
         $arReplace[] = intval($arr["IBLOCK_SECTION_ID"]) > 0 ? intval($arr["IBLOCK_SECTION_ID"]) : "";
         $arReplace[] = urlencode(isset($arr["~SECTION_CODE"]) ? $arr["~SECTION_CODE"] : $arr["SECTION_CODE"]);
         $arReplace[] = "";
     }
     $url = str_replace($arSearch, $arReplace, $url);
     return preg_replace("'(?<!:)/+'s", "/", $url);
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:63,代码来源:iblock.php

示例4: GetDateFormat

 function GetDateFormat($type = "FULL", $lang = false, $bSearchInSitesOnly = false)
 {
     $bFullFormat = strtoupper($type) == "FULL";
     if ($lang === false) {
         $lang = LANG;
     }
     if (defined("SITE_ID") && $lang == SITE_ID) {
         if ($bFullFormat && defined("FORMAT_DATETIME")) {
             return FORMAT_DATETIME;
         }
         if (!$bFullFormat && defined("FORMAT_DATE")) {
             return FORMAT_DATE;
         }
     }
     if (!$bSearchInSitesOnly && defined("ADMIN_SECTION") && ADMIN_SECTION === true) {
         global $MAIN_LANGS_ADMIN_CACHE;
         if (!is_set($MAIN_LANGS_ADMIN_CACHE, $lang)) {
             $res = CLanguage::GetByID($lang);
             if ($res = $res->Fetch()) {
                 $MAIN_LANGS_ADMIN_CACHE[$res["LID"]] = $res;
             }
         }
         if (is_set($MAIN_LANGS_ADMIN_CACHE, $lang)) {
             if ($bFullFormat) {
                 return strtoupper($MAIN_LANGS_ADMIN_CACHE[$lang]["FORMAT_DATETIME"]);
             }
             return strtoupper($MAIN_LANGS_ADMIN_CACHE[$lang]["FORMAT_DATE"]);
         }
     }
     // if LANG is not found in LangAdmin:
     global $MAIN_LANGS_CACHE;
     if (!is_set($MAIN_LANGS_CACHE, $lang)) {
         $res = CLang::GetByID($lang);
         $res = $res->Fetch();
         $MAIN_LANGS_CACHE[$res["LID"]] = $res;
         if (defined("ADMIN_SECTION") && ADMIN_SECTION === true) {
             $MAIN_LANGS_ADMIN_CACHE[$res["LID"]] = $res;
         }
     }
     if ($bFullFormat) {
         $format = strtoupper($MAIN_LANGS_CACHE[$lang]["FORMAT_DATETIME"]);
         if ($format == '') {
             $format = "DD.MM.YYYY HH:MI:SS";
         }
     } else {
         $format = strtoupper($MAIN_LANGS_CACHE[$lang]["FORMAT_DATE"]);
         if ($format == '') {
             $format = "DD.MM.YYYY";
         }
     }
     return $format;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:52,代码来源:main.php

示例5: Reindex

 function Reindex($ID, &$arMessage)
 {
     if (!($ID > 0) || !CModule::IncludeModule("search")) {
         return array("FORUM_ID", "TOPIC_ID", "TITLE_SEO", "MESSAGE_ID", "SOCNET_GROUP_ID", "OWNER_ID", "PARAM1", "PARAM2");
     }
     if (!is_array($arMessage) || !array_key_exists("FORUM_INFO", $arMessage) || !array_key_exists("TOPIC_INFO", $arMessage)) {
         $arMessage = CForumMessage::GetByIDEx($ID, array("GET_TOPIC_INFO" => "Y", "GET_FORUM_INFO" => "Y", "FILTER" => "Y"));
     }
     $arMessage["POST_MESSAGE"] = COption::GetOptionString("forum", "FILTER", "Y") == "Y" ? $arMessage["POST_MESSAGE_FILTER"] : $arMessage["POST_MESSAGE"];
     $arParams = array("PERMISSION" => array(), "SITE" => CForumNew::GetSites($arMessage["FORUM_ID"]), "DEFAULT_URL" => "/");
     $arGroups = CForumNew::GetAccessPermissions($arMessage["FORUM_ID"]);
     for ($i = 0; $i < count($arGroups); $i++) {
         if ($arGroups[$i][1] >= "E") {
             $arParams["PERMISSION"][] = $arGroups[$i][0];
             if ($arGroups[$i][0] == 2) {
                 break;
             }
         }
     }
     $arSearchInd = array("LID" => array(), "LAST_MODIFIED" => $arMessage["POST_DATE"], "PARAM1" => $arMessage["FORUM_ID"], "PARAM2" => $arMessage["TOPIC_ID"], "PERMISSIONS" => $arParams["PERMISSION"], "TITLE" => $arMessage["TOPIC_INFO"]["TITLE"] . ($arMessage["NEW_TOPIC"] == "Y" && !empty($arMessage["TOPIC_INFO"]["DESCRIPTION"]) ? ", " . $arMessage["TOPIC_INFO"]["DESCRIPTION"] : ""), "TAGS" => $arMessage["NEW_TOPIC"] == "Y" ? $arMessage["TOPIC_INFO"]["TAGS"] : "", "BODY" => GetMessage("AVTOR_PREF") . " " . $arMessage["AUTHOR_NAME"] . ". " . forumTextParser::clearAllTags($arMessage["POST_MESSAGE"]), "ENTITY_TYPE_ID" => $arMessage["NEW_TOPIC"] == "Y" ? "FORUM_TOPIC" : "FORUM_POST", "ENTITY_ID" => $arMessage["NEW_TOPIC"] == "Y" ? $arMessage["TOPIC_ID"] : $arMessage["ID"], "USER_ID" => $arMessage["AUTHOR_ID"], "URL" => "", "INDEX_TITLE" => $arMessage["NEW_TOPIC"] == "Y");
     // get mentions
     $arMentionedUserID = CForumMessage::GetMentionedUserID($arMessage["POST_MESSAGE"]);
     if (!empty($arMentionedUserID)) {
         $arSearchInd["PARAMS"] = array("mentioned_user_id" => $arMentionedUserID);
     }
     $urlPatterns = array("FORUM_ID" => $arMessage["FORUM_ID"], "TOPIC_ID" => $arMessage["TOPIC_ID"], "TITLE_SEO" => $arMessage["TOPIC_INFO"]["TITLE_SEO"], "MESSAGE_ID" => $arMessage["ID"], "SOCNET_GROUP_ID" => $arMessage["TOPIC_INFO"]["SOCNET_GROUP_ID"], "OWNER_ID" => $arMessage["TOPIC_INFO"]["OWNER_ID"], "PARAM1" => $arMessage["PARAM1"], "PARAM2" => $arMessage["PARAM2"]);
     foreach ($arParams["SITE"] as $key => $val) {
         $arSearchInd["LID"][$key] = CForumNew::PreparePath2Message($val, $urlPatterns);
         if (empty($arSearchInd["URL"]) && !empty($arSearchInd["LID"][$key])) {
             $arSearchInd["URL"] = $arSearchInd["LID"][$key];
         }
     }
     if (empty($arSearchInd["URL"])) {
         foreach ($arParams["SITE"] as $key => $val) {
             $db_lang = CLang::GetByID($key);
             if ($db_lang && ($ar_lang = $db_lang->Fetch())) {
                 $arParams["DEFAULT_URL"] = $ar_lang["DIR"];
                 break;
             }
         }
         $arParams["DEFAULT_URL"] .= COption::GetOptionString("forum", "REL_FPATH", "") . "forum/read.php?FID=#FID#&TID=#TID#&MID=#MID##message#MID#";
         $arSearchInd["URL"] = CForumNew::PreparePath2Message($arParams["DEFAULT_URL"], $urlPatterns);
     }
     CSearch::DeleteIndex("forum", $ID);
     CSearch::Index("forum", $ID, $arSearchInd, true);
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:46,代码来源:message.php

示例6: CheckFields

 function CheckFields($arFields)
 {
     global $DB;
     $this->LAST_ERROR = "";
     $aMsg = array();
     if (strlen($arFields["NAME"]) == 0) {
         $aMsg[] = array("id" => "NAME", "text" => GetMessage("class_rub_err_name"));
     }
     if (strlen($arFields["LID"]) > 0) {
         $r = CLang::GetByID($arFields["LID"]);
         if (!$r->Fetch()) {
             $aMsg[] = array("id" => "LID", "text" => GetMessage("class_rub_err_lang"));
         }
     } else {
         $aMsg[] = array("id" => "LID", "text" => GetMessage("class_rub_err_lang2"));
     }
     if (strlen($arFields["DAYS_OF_MONTH"]) > 0) {
         $arDoM = explode(",", $arFields["DAYS_OF_MONTH"]);
         $arFound = array();
         foreach ($arDoM as $strDoM) {
             if (preg_match("/^(\\d{1,2})\$/", trim($strDoM), $arFound)) {
                 if (intval($arFound[1]) < 1 || intval($arFound[1]) > 31) {
                     $aMsg[] = array("id" => "DAYS_OF_MONTH", "text" => GetMessage("class_rub_err_dom"));
                     break;
                 }
             } elseif (preg_match("/^(\\d{1,2})-(\\d{1,2})\$/", trim($strDoM), $arFound)) {
                 if (intval($arFound[1]) < 1 || intval($arFound[1]) > 31 || intval($arFound[2]) < 1 || intval($arFound[2]) > 31 || intval($arFound[1]) >= intval($arFound[2])) {
                     $aMsg[] = array("id" => "DAYS_OF_MONTH", "text" => GetMessage("class_rub_err_dom"));
                     break;
                 }
             } else {
                 $aMsg[] = array("id" => "DAYS_OF_MONTH", "text" => GetMessage("class_rub_err_dom2"));
                 break;
             }
         }
     }
     if (strlen($arFields["DAYS_OF_WEEK"]) > 0) {
         $arDoW = explode(",", $arFields["DAYS_OF_WEEK"]);
         $arFound = array();
         foreach ($arDoW as $strDoW) {
             if (preg_match("/^(\\d)\$/", trim($strDoW), $arFound)) {
                 if (intval($arFound[1]) < 1 || intval($arFound[1]) > 7) {
                     $aMsg[] = array("id" => "DAYS_OF_WEEK", "text" => GetMessage("class_rub_err_dow"));
                     break;
                 }
             } else {
                 $aMsg[] = array("id" => "DAYS_OF_WEEK", "text" => GetMessage("class_rub_err_dow2"));
                 break;
             }
         }
     }
     if (strlen($arFields["TIMES_OF_DAY"]) > 0) {
         $arToD = explode(",", $arFields["TIMES_OF_DAY"]);
         $arFound = array();
         foreach ($arToD as $strToD) {
             if (preg_match("/^(\\d{1,2}):(\\d{1,2})\$/", trim($strToD), $arFound)) {
                 if (intval($arFound[1]) > 23 || intval($arFound[2]) > 59) {
                     $aMsg[] = array("id" => "TIMES_OF_DAY", "text" => GetMessage("class_rub_err_tod"));
                     break;
                 }
             } else {
                 $aMsg[] = array("id" => "TIMES_OF_DAY", "text" => GetMessage("class_rub_err_tod2"));
                 break;
             }
         }
     }
     if (strlen($arFields["TEMPLATE"]) > 0 && !CPostingTemplate::IsExists($arFields["TEMPLATE"])) {
         $aMsg[] = array("id" => "TEMPLATE", "text" => GetMessage("class_rub_err_wrong_templ"));
     }
     if ($arFields["AUTO"] == "Y") {
         if (strlen($arFields["FROM_FIELD"]) < 3 || !check_email($arFields["FROM_FIELD"])) {
             $aMsg[] = array("id" => "FROM_FIELD", "text" => GetMessage("class_rub_err_email"));
         }
         if (strlen($arFields["DAYS_OF_MONTH"]) + strlen($arFields["DAYS_OF_WEEK"]) <= 0) {
             $aMsg[] = array("id" => "DAYS_OF_MONTH", "text" => GetMessage("class_rub_err_days_missing"));
         }
         if (strlen($arFields["TIMES_OF_DAY"]) <= 0) {
             $aMsg[] = array("id" => "TIMES_OF_DAY", "text" => GetMessage("class_rub_err_times_missing"));
         }
         if (strlen($arFields["TEMPLATE"]) <= 0) {
             $aMsg[] = array("id" => "TEMPLATE", "text" => GetMessage("class_rub_err_templ_missing"));
         }
         if (is_set($arFields, "FROM_FIELD") && strlen($arFields["FROM_FIELD"]) <= 0) {
             $aMsg[] = array("id" => "FROM_FIELD", "text" => GetMessage("class_rub_err_from"));
         }
         if (strlen($arFields["LAST_EXECUTED"]) <= 0) {
             $aMsg[] = array("id" => "LAST_EXECUTED", "text" => GetMessage("class_rub_err_le_missing"));
         } elseif (is_set($arFields, "LAST_EXECUTED") && $arFields["LAST_EXECUTED"] !== false && $DB->IsDate($arFields["LAST_EXECUTED"], false, false, "FULL") !== true) {
             $aMsg[] = array("id" => "LAST_EXECUTED", "text" => GetMessage("class_rub_err_le_wrong"));
         }
     }
     if (!empty($aMsg)) {
         $e = new CAdminException($aMsg);
         $GLOBALS["APPLICATION"]->ThrowException($e);
         $this->LAST_ERROR = $e->GetString();
         return false;
     }
     return true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:99,代码来源:rubric.php

示例7: GetMessage

    ?>
:</td>
			<td><?php 
    echo $str_DATE_INSERT_FORMAT;
    ?>
</td>
		</tr>
		<tr>
			<td><?php 
    echo GetMessage("P_ORDER_LANG");
    ?>
:</td>
			<td>
				<?php 
    echo "[" . $str_LID . "] ";
    $db_lang = CLang::GetByID($str_LID);
    if ($arLang = $db_lang->GetNext()) {
        echo $arLang["NAME"];
    }
    ?>
			</td>
		</tr>
		<tr>
			<td><?php 
    echo GetMessage("P_ORDER_STATUS");
    ?>
:</td>
			<td>
				<?php 
    $ar_status = CSaleStatus::GetByID($str_STATUS_ID);
    ?>
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:order_print.php

示例8: substr

 * @copyright 2001-2013 Bitrix
 */
require_once substr(__FILE__, 0, strlen(__FILE__) - strlen("/include.php")) . "/bx_root.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/start.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/virtual_io.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/virtual_file.php";
//define global application object
$GLOBALS["APPLICATION"] = new CMain();
if (defined("SITE_ID")) {
    define("LANG", SITE_ID);
}
if (defined("LANG")) {
    if (defined("ADMIN_SECTION") && ADMIN_SECTION === true) {
        $db_lang = CLangAdmin::GetByID(LANG);
    } else {
        $db_lang = CLang::GetByID(LANG);
    }
    $arLang = $db_lang->Fetch();
} else {
    $arLang = $GLOBALS["APPLICATION"]->GetLang();
    define("LANG", $arLang["LID"]);
}
$lang = $arLang["LID"];
define("SITE_ID", $arLang["LID"]);
define("SITE_DIR", $arLang["DIR"]);
define("SITE_SERVER_NAME", $arLang["SERVER_NAME"]);
define("SITE_CHARSET", $arLang["CHARSET"]);
define("FORMAT_DATE", $arLang["FORMAT_DATE"]);
define("FORMAT_DATETIME", $arLang["FORMAT_DATETIME"]);
define("LANG_DIR", $arLang["DIR"]);
define("LANG_CHARSET", $arLang["CHARSET"]);
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:include.php

示例9: GetMessage

        ?>
</font>
		</td>
	</tr>
	<tr>
		<td align="right" width="40%" class="tablebody">
			<font class="tablefieldtext"><?php 
        echo GetMessage("STPOD_ORDER_SITE'");
        ?>
:</font>
		</td>
		<td align="left" width="60%" class="tablebody">
			<font class="tablebodytext">
			<?php 
        echo "[" . $arOrder["LID"] . "] ";
        $dbSite = CLang::GetByID($arOrder["LID"]);
        if ($arSite = $dbSite->Fetch()) {
            echo $arSite["NAME"];
        }
        ?>
			</font>
		</td>
	</tr>
	//-->
	<tr>
		<td align="right" width="40%" class="tablebody">
			<font class="tablefieldtext"><?php 
        echo GetMessage("STPOD_ORDER_STATUS");
        ?>
</font>
		</td>
开发者ID:rasuldev,项目名称:torino,代码行数:31,代码来源:order_detail.php

示例10: CheckFields

 function CheckFields($action, &$arFields)
 {
     global $DB;
     $this->LAST_ERROR = "";
     $aMsg = array();
     if (($action == "update" && array_key_exists("TYPE", $arFields) || $action == "add") && strlen($arFields["TYPE"]) == 0) {
         $aMsg[] = array("id" => "TYPE", "text" => GetMessage("LFP_CLASS_SCHEME_ERR_TYPE"));
     }
     if (($action == "update" && array_key_exists("ENTITY_TYPE", $arFields) || $action == "add") && strlen($arFields["ENTITY_TYPE"]) == 0) {
         $aMsg[] = array("id" => "ENTITY_TYPE", "text" => GetMessage("LFP_CLASS_SCHEME_ERR_ENTITY_TYPE"));
     }
     if (($action == "update" && array_key_exists("EVENT_ID", $arFields) || $action == "add") && strlen($arFields["EVENT_ID"]) == 0) {
         $aMsg[] = array("id" => "EVENT_ID", "text" => GetMessage("LFP_CLASS_SCHEME_ERR_EVENT_ID"));
     }
     if (($action == "update" && array_key_exists("NAME", $arFields) || $action == "add") && strlen($arFields["NAME"]) == 0) {
         $aMsg[] = array("id" => "NAME", "text" => GetMessage("LFP_CLASS_SCHEME_ERR_NAME"));
     }
     if (strlen($arFields["LID"]) > 0) {
         $r = CLang::GetByID($arFields["LID"]);
         if (!$r->Fetch()) {
             $aMsg[] = array("id" => "LID", "text" => GetMessage("LFP_CLASS_SCHEME_ERR_SITE"));
         }
     } elseif ($action == "update" && array_key_exists("LID", $arFields) || $action == "add") {
         $aMsg[] = array("id" => "LID", "text" => GetMessage("LFP_CLASS_SCHEME_ERR_SITE2"));
     }
     if ($action == "add" && $arFields["TYPE"] == "POST" && (!array_key_exists("HASH", $arFields) || strlen($arFields["HASH"]) <= 0) || $action == "update" && $arFields["TYPE"] == "POST" && array_key_exists("HASH", $arFields) && strlen($arFields["HASH"]) <= 0) {
         $arFields["HASH"] = md5(randString(20));
     }
     if ($action == "add" && (!array_key_exists("ENABLE_COMMENTS", $arFields) || !in_array($arFields["ENABLE_COMMENTS"], array("Y", "N"))) || $action == "update" && array_key_exists("ENABLE_COMMENTS", $arFields) && !in_array($arFields["ENABLE_COMMENTS"], array("Y", "N"))) {
         $arFields["ENABLE_COMMENTS"] = "Y";
     }
     if (($action == "update" && array_key_exists("DAYS_OF_MONTH", $arFields) || $action == "add") && strlen($arFields["DAYS_OF_MONTH"]) > 0) {
         $arDoM = explode(",", $arFields["DAYS_OF_MONTH"]);
         $arFound = array();
         foreach ($arDoM as $strDoM) {
             if (preg_match("/^(\\d{1,2})\$/", trim($strDoM), $arFound)) {
                 if (intval($arFound[1]) < 1 || intval($arFound[1]) > 31) {
                     $aMsg[] = array("id" => "DAYS_OF_MONTH", "text" => GetMessage("LFP_CLASS_SCHEME_ERR_DOM"));
                     break;
                 }
             } elseif (preg_match("/^(\\d{1,2})-(\\d{1,2})\$/", trim($strDoM), $arFound)) {
                 if (intval($arFound[1]) < 1 || intval($arFound[1]) > 31 || intval($arFound[2]) < 1 || intval($arFound[2]) > 31 || intval($arFound[1]) >= intval($arFound[2])) {
                     $aMsg[] = array("id" => "DAYS_OF_MONTH", "text" => GetMessage("LFP_CLASS_SCHEME_ERR_DOM"));
                     break;
                 }
             } else {
                 $aMsg[] = array("id" => "DAYS_OF_MONTH", "text" => GetMessage("LFP_CLASS_SCHEME_ERR_DOM2"));
                 break;
             }
         }
     }
     if (($action == "update" && array_key_exists("DAYS_OF_WEEK", $arFields) || $action == "add") && strlen($arFields["DAYS_OF_WEEK"]) > 0) {
         $arDoW = explode(",", $arFields["DAYS_OF_WEEK"]);
         $arFound = array();
         foreach ($arDoW as $strDoW) {
             if (preg_match("/^(\\d)\$/", trim($strDoW), $arFound)) {
                 if (intval($arFound[1]) < 1 || intval($arFound[1]) > 7) {
                     $aMsg[] = array("id" => "DAYS_OF_WEEK", "text" => GetMessage("LFP_CLASS_SCHEME_ERR_DOW"));
                     break;
                 }
             } else {
                 $aMsg[] = array("id" => "DAYS_OF_WEEK", "text" => GetMessage("LFP_CLASS_SCHEME_ERR_DOW2"));
                 break;
             }
         }
     }
     if (($action == "update" && array_key_exists("TIMES_OF_DAY", $arFields) || $action == "add") && strlen($arFields["TIMES_OF_DAY"]) > 0) {
         $arToD = explode(",", $arFields["TIMES_OF_DAY"]);
         $arFound = array();
         foreach ($arToD as $strToD) {
             if (preg_match("/^(\\d{1,2}):(\\d{1,2})\$/", trim($strToD), $arFound)) {
                 if (intval($arFound[1]) > 23 || intval($arFound[2]) > 59) {
                     $aMsg[] = array("id" => "TIMES_OF_DAY", "text" => GetMessage("LFP_CLASS_SCHEME_ERR_TOD"));
                     break;
                 }
             } else {
                 $aMsg[] = array("id" => "TIMES_OF_DAY", "text" => GetMessage("LFP_CLASS_SCHEME_ERR_TOD2"));
                 break;
             }
         }
     }
     if (!array_key_exists("AUTO", $arFields)) {
         if (array_key_exists("TYPE", $arFields)) {
             if (in_array($arFields["TYPE"], array("XML", "RSS"))) {
                 $arFields["AUTO"] = "Y";
             } else {
                 $arFields["AUTO"] = "N";
             }
         }
     } elseif (!in_array($arFields["AUTO"], array("Y", "N"))) {
         $arFields["AUTO"] = "N";
     }
     if (array_key_exists("IS_HTML", $arFields) && !in_array($arFields["IS_HTML"], array("Y", "N"))) {
         $arFields["IS_HTML"] = "N";
     }
     if (array_key_exists("URI", $arFields)) {
         $arURI = parse_url($arFields["URI"]);
         if (array_key_exists("TYPE", $arFields) && in_array($arFields["TYPE"], array("XML", "RSS"))) {
             if (strlen($arURI["host"]) <= 0) {
                 $aMsg[] = array("id" => "URI", "text" => GetMessage("LFP_CLASS_SCHEME_ERR_URI_HOST"));
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:lf_scheme.php

示例11: Reindex

	public static function Reindex($ID, &$arMessage)
	{
		if (!CModule::IncludeModule("search")) return;
		if (!is_set($arMessage, "FORUM_INFO") || !is_set($arMessage, "TOPIC_INFO"))
			$arMessage = CForumMessage::GetByIDEx($arMessage['ID'], array("GET_TOPIC_INFO" => "Y", "GET_FORUM_INFO" => "Y", "FILTER" => "Y"));

		$arForum = $arMessage["FORUM_INFO"];
		$arTopic = $arMessage["TOPIC_INFO"];
		$arMessage["POST_MESSAGE"] = (COption::GetOptionString("forum", "FILTER", "Y") == "Y" ?
			$arMessage["POST_MESSAGE_FILTER"] : $arMessage["POST_MESSAGE"]);

		$arParams = array(
			"PERMISSION" => array(),
			"SITE" => CForumNew::GetSites($arMessage["FORUM_ID"]),
			"DEFAULT_URL" => "/");

		$arGroups = CForumNew::GetAccessPermissions($arMessage["FORUM_ID"]);
		for ($i = 0; $i < count($arGroups); $i++)
		{
			if ($arGroups[$i][1] >= "E")
			{
				$arParams["PERMISSION"][] = $arGroups[$i][0];
				if ($arGroups[$i][0] == 2)
					break;
			}
		}

		$arSearchInd = array(
			"LID" => array(),
			"LAST_MODIFIED" => $arMessage["POST_DATE"],
			"PARAM1" => $arMessage["FORUM_ID"],
			"PARAM2" => $arMessage["TOPIC_ID"],
			"PERMISSIONS" => $arParams["PERMISSION"],
			"TITLE" => $arMessage["TOPIC_INFO"]["TITLE"],
			"TAGS" => (($arMessage["NEW_TOPIC"] == "Y") ? $arMessage["TOPIC_INFO"]["TAGS"] : ""),
			"BODY" => GetMessage("AVTOR_PREF")." ".$arMessage["AUTHOR_NAME"].". ".(textParser::killAllTags($arMessage["POST_MESSAGE"])),
			"ENTITY_TYPE_ID"  => $arMessage["NEW_TOPIC"] == "Y"? "FORUM_TOPIC": "FORUM_POST",
			"ENTITY_ID"  => $arMessage["NEW_TOPIC"] == "Y"? $arMessage["TOPIC_ID"]: $arMessage["ID"],
			"USER_ID" => $arMessage["AUTHOR_ID"],
			"URL" => "",
			"INDEX_TITLE" => $arMessage["NEW_TOPIC"] == "Y",
		);

		foreach ($arParams["SITE"] as $key => $val)
		{
			$arSearchInd["LID"][$key] =
				CForumNew::PreparePath2Message(
					$val,
					array(
						"FORUM_ID" => $arMessage["FORUM_ID"],
						"TOPIC_ID" => $arMessage["TOPIC_ID"],
						"MESSAGE_ID" => $arMessage["ID"],
						"SOCNET_GROUP_ID" => $arMessage["TOPIC_INFO"]["SOCNET_GROUP_ID"],
						"OWNER_ID" => $arMessage["TOPIC_INFO"]["OWNER_ID"],
						"PARAM1" => $arMessage["PARAM1"],
						"PARAM2" => $arMessage["PARAM2"]));
			if (empty($arSearchInd["URL"]) && !empty($arSearchInd["LID"][$key]))
				$arSearchInd["URL"] = $arSearchInd["LID"][$key];
		}

		if (empty($arSearchInd["URL"]))
		{
			foreach ($arParams["SITE"] as $key => $val) {
				$db_lang = CLang::GetByID($key);
				if ($db_lang && $ar_lang = $db_lang->Fetch()){
					$arParams["DEFAULT_URL"] = $ar_lang["DIR"];
					break;
				}
			}
			$arParams["DEFAULT_URL"] .= COption::GetOptionString("forum", "REL_FPATH", "").
				"forum/read.php?FID=#FID#&TID=#TID#&MID=#MID##message#MID#";

			$arSearchInd["URL"] = CForumNew::PreparePath2Message($arParams["DEFAULT_URL"],
				array("FORUM_ID" => $arMessage["FORUM_ID"], "TOPIC_ID" => $arMessage["TOPIC_ID"], "MESSAGE_ID" => $arMessage["ID"],
				"SOCNET_GROUP_ID" => $arMessage["TOPIC_INFO"]["SOCNET_GROUP_ID"], "OWNER_ID" => $arMessage["TOPIC_INFO"]["OWNER_ID"],
				"PARAM1" => $arMessage["PARAM1"], "PARAM2" => $arMessage["PARAM2"]));
		}
		CSearch::DeleteIndex("forum", $ID);
		CSearch::Index("forum", $ID, $arSearchInd, true);
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:80,代码来源:message.php

示例12: CMain

require_once $_SERVER["DOCUMENT_ROOT"] . "/freetrix/modules/main" . "/SetCorePath.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/freetrix/modules/main/Start.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/freetrix/modules/main/classes/general/virtual_io.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/freetrix/modules/main/classes/general/virtual_file.php";
$Application = \Freetrix\Main\Application::getInstance();
$Application->initializeExtendedKernel(array("get" => $_GET, "post" => $_POST, "files" => $_FILES, "cookie" => $_COOKIE, "server" => $_SERVER, "env" => $_ENV));
$GLOBALS["APPLICATION"] = new CMain();
if (defined("SITE_ID")) {
    define("LANG", SITE_ID);
}
if (defined("LANG")) {
    if (defined("ADMIN_SECTION") && ADMIN_SECTION === true) {
        $currentLangGetter = CLangAdmin::GetByID(LANG);
    } else {
        $currentLangGetter = CLang::GetByID(LANG);
    }
    $definedLang = $currentLangGetter->Fetch();
} else {
    $definedLang = $GLOBALS["APPLICATION"]->GetLang();
    define("LANG", $definedLang["LID"]);
}
$_762722495 = $definedLang["LID"];
define("SITE_ID", $definedLang["LID"]);
define("SITE_DIR", $definedLang["DIR"]);
define("SITE_SERVER_NAME", $definedLang["SERVER_NAME"]);
define("SITE_CHARSET", $definedLang["CHARSET"]);
define("FORMAT_DATE", $definedLang["FORMAT_DATE"]);
define("FORMAT_DATETIME", $definedLang["FORMAT_DATETIME"]);
define("LANG_DIR", $definedLang["DIR"]);
define("LANG_CHARSET", $definedLang["CHARSET"]);
开发者ID:ASDAFF,项目名称:open_bx,代码行数:30,代码来源:include.php

示例13: OnReindex

 function OnReindex($NS = array(), $oCallback = NULL, $callback_method = "")
 {
     global $DB;
     $arResultAll = array();
     $arParams = array("PERMISSION" => array(), "SITE" => array(), "DEFAULT_URL" => array());
     $search_message_count = intVal(COption::GetOptionInt("forum", "search_message_count", 0));
     $strNSJoin = "";
     $strFilter = "";
     if ($NS["MODULE"] == "forum" && intVal($NS["ID"]) > 0 && intVal($NS["CNT"]) > 0) {
         $strFilter = " AND (FM.ID>" . intVal($NS["ID"]) . ") ";
     } elseif ($NS["MODULE"] == "forum" && intVal($NS["ID"]) > 0) {
         // out of date
         $strFilter = " AND (FM.ID>=" . intVal($NS["ID"]) . ") ";
     }
     if ($NS["SITE_ID"] != "") {
         $strNSJoin .= " INNER JOIN b_forum2site FS ON (FS.FORUM_ID=F.ID) ";
         $strFilter .= " AND FS.SITE_ID='" . $DB->ForSQL($NS["SITE_ID"]) . "' ";
     }
     $strSql = "SELECT STRAIGHT_JOIN FT.ID as TID, FM.ID as MID, FM.ID as ID, FT.FORUM_ID, FT.TITLE, " . CForumNew::Concat("-", array("FT.ID", "FT.TITLE_SEO")) . ",\n\t\t\t\tFT.DESCRIPTION, FT.TAGS, FT.HTML as FT_HTML,\n\t\t\t\tFM.PARAM1, FM.PARAM2, FM.POST_MESSAGE, FM.POST_MESSAGE_FILTER, FM.POST_MESSAGE_HTML, FM.AUTHOR_NAME, FM.AUTHOR_ID, FM.NEW_TOPIC,\n\t\t\t\t" . $DB->DateToCharFunction("FM.POST_DATE") . " as POST_DATE, " . $DB->DateToCharFunction("FM.EDIT_DATE") . " as EDIT_DATE, FT.SOCNET_GROUP_ID, FT.OWNER_ID\n\t\t\tFROM b_forum_message FM use index (PRIMARY), b_forum_topic FT, b_forum F\n\t\t\t" . $strNSJoin . "\n\t\t\tWHERE (FM.TOPIC_ID = FT.ID) AND (F.ID = FT.FORUM_ID) AND (F.INDEXATION = 'Y') AND (FM.APPROVED = 'Y')\n\t\t\t" . $strFilter . "\n\t\t\tORDER BY FM.ID";
     if ($search_message_count > 0) {
         $strSql .= " LIMIT 0, " . $search_message_count;
     }
     $db_res = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     if ($db_res && COption::GetOptionString("forum", "FILTER", "Y") == "Y") {
         $db_res = new _CMessageDBResult($db_res);
     }
     $rownum = 0;
     while ($res = $db_res->Fetch()) {
         $rownum++;
         if (empty($arParams["PERMISSION"][$res["FORUM_ID"]])) {
             $arGroups = CForumNew::GetAccessPermissions($res["FORUM_ID"]);
             $arParams["PERMISSION"][$res["FORUM_ID"]] = array();
             for ($i = 0; $i < count($arGroups); $i++) {
                 if ($arGroups[$i][1] >= "E") {
                     $arParams["PERMISSION"][$res["FORUM_ID"]][] = $arGroups[$i][0];
                     if ($arGroups[$i][0] == 2) {
                         break;
                     }
                 }
             }
         }
         if (empty($arParams["SITE"][$res["FORUM_ID"]])) {
             $arParams["SITE"][$res["FORUM_ID"]] = CForumNew::GetSites($res["FORUM_ID"]);
         }
         $arResult = array("ID" => $res["MID"], "LID" => array(), "LAST_MODIFIED" => !empty($res["EDIT_DATE"]) ? $res["EDIT_DATE"] : $res["POST_DATE"], "PARAM1" => $res["FORUM_ID"], "PARAM2" => $res["TID"], "USER_ID" => $res["AUTHOR_ID"], "ENTITY_TYPE_ID" => $res["NEW_TOPIC"] == "Y" ? "FORUM_TOPIC" : "FORUM_POST", "ENTITY_ID" => $res["NEW_TOPIC"] == "Y" ? $res["TID"] : $res["MID"], "PERMISSIONS" => $arParams["PERMISSION"][$res["FORUM_ID"]], "TITLE" => $res["TITLE"] . ($res["NEW_TOPIC"] == "Y" && !empty($res["DESCRIPTION"]) ? ", " . $res["DESCRIPTION"] : ""), "TAGS" => $res["NEW_TOPIC"] == "Y" ? $res["TAGS"] : "", "BODY" => GetMessage("AVTOR_PREF") . " " . $res["AUTHOR_NAME"] . ". " . textParser::killAllTags(COption::GetOptionString("forum", "FILTER", "Y") != "Y" ? $res["POST_MESSAGE"] : $res["POST_MESSAGE_FILTER"]), "URL" => "", "INDEX_TITLE" => $res["NEW_TOPIC"] == "Y");
         foreach ($arParams["SITE"][$res["FORUM_ID"]] as $key => $val) {
             $arResult["LID"][$key] = CForumNew::PreparePath2Message($val, array("FORUM_ID" => $res["FORUM_ID"], "TOPIC_ID" => $res["TID"], "MESSAGE_ID" => $res["MID"], "SOCNET_GROUP_ID" => $res["SOCNET_GROUP_ID"], "OWNER_ID" => $res["OWNER_ID"], "PARAM1" => $res["PARAM1"], "PARAM2" => $res["PARAM2"]));
             if (empty($arResult["URL"]) && !empty($arResult["LID"][$key])) {
                 $arResult["URL"] = $arResult["LID"][$key];
             }
         }
         if (empty($arResult["URL"])) {
             if (empty($arParams["DEFAULT_URL"][$res["FORUM_ID"]])) {
                 $arParams["DEFAULT_URL"][$res["FORUM_ID"]] = "/";
                 foreach ($arParams["SITE"][$res["FORUM_ID"]] as $key => $val) {
                     $db_lang = CLang::GetByID($key);
                     if ($db_lang && ($ar_lang = $db_lang->Fetch())) {
                         $arParams["DEFAULT_URL"][$res["FORUM_ID"]] = $ar_lang["DIR"];
                         break;
                     }
                 }
                 $arParams["DEFAULT_URL"][$res["FORUM_ID"]] .= COption::GetOptionString("forum", "REL_FPATH", "") . "forum/read.php?FID=#FID#&TID=#TID#&MID=#MID##message#MID#";
             }
             $arResult["URL"] = CForumNew::PreparePath2Message($arParams["DEFAULT_URL"][$res["FORUM_ID"]], array("FORUM_ID" => $res["FORUM_ID"], "TOPIC_ID" => $res["TID"], "MESSAGE_ID" => $res["MID"], "SOCNET_GROUP_ID" => $res["SOCNET_GROUP_ID"], "OWNER_ID" => $res["OWNER_ID"], "PARAM1" => $res["PARAM1"], "PARAM2" => $res["PARAM2"]));
         }
         if ($oCallback) {
             $resCall = call_user_func(array($oCallback, $callback_method), $arResult);
             if (!$resCall) {
                 return $arResult["ID"];
             }
         } else {
             $arResultAll[] = $arResult;
         }
     }
     if ($oCallback && $search_message_count > 0 && $rownum >= $search_message_count - 1) {
         return $arResult["ID"];
     }
     if ($oCallback) {
         return false;
     }
     return $arResultAll;
 }
开发者ID:spas-viktor,项目名称:books,代码行数:82,代码来源:forum_new.php

示例14: Add

	function Add($arFields, $strUploadDir = false, $arParams = array())
	{
		global $DB;

		$strUploadDir = ($strUploadDir === false ? "forum/upload" : $strUploadDir);

		if (!CForumMessage::CheckFields("ADD", $arFields))
			return false;

		$arForum = CForumNew::GetByID($arFields["FORUM_ID"]);
		$arParams["SKIP_STATISTIC"] = ($arParams["SKIP_STATISTIC"] == "Y" ? "Y" : "N");
		$arParams["SKIP_INDEXING"] = ($arParams["SKIP_INDEXING"] == "Y" || $arForum["INDEXATION"] != "Y" ? "Y" : "N");

		$POST_MESSAGE = $arFields["POST_MESSAGE"];
		$parser = new forumTextParser(LANGUAGE_ID);
		$allow = forumTextParser::GetFeatures($arForum);
		$allow['SMILES'] = (($arFields["USE_SMILES"] != "Y") ? 'N' : $allow['SMILES']);
		if (COption::GetOptionString("forum", "FILTER", "Y") == "Y")
		{
			$POST_MESSAGE = CFilterUnquotableWords::Filter($POST_MESSAGE);
			$arFields["POST_MESSAGE_FILTER"] = (empty($POST_MESSAGE) ? "*" : $POST_MESSAGE);
		}
/***************** Attach ******************************************/
		$arFiles = array();
		if (is_array($arFields["ATTACH_IMG"]))
			$arFields["FILES"] = array($arFields["ATTACH_IMG"]);
		unset($arFields["ATTACH_IMG"]);
		if (is_array($arFields["FILES"]) && !empty($arFields["FILES"]))
		{
			$res = array("FORUM_ID" => $arFields["FORUM_ID"], "USER_ID" => $arFields["AUTHOR_ID"], "upload_dir" => $strUploadDir);
			$arFiles = CForumFiles::Save($arFields["FILES"], $res, false);
			if (!empty($arFiles))
			{
				$arFiles = array_keys($arFiles);
				sort($arFiles);
				$arFields["ATTACH_IMG"] = $arFiles[0];
				$arFields["ATTACHED_FILES"] = $arFiles;
			}
			unset($arFields["FILES"]);
		}
/***************** Attach/******************************************/
		if (COption::GetOptionString("forum", "MESSAGE_HTML", "N") == "Y")
			$POST_MESSAGE = $parser->convert($POST_MESSAGE, $allow, "html", $arFiles);
		$arFields["POST_MESSAGE_HTML"] = $POST_MESSAGE;
/***************** Event onBeforeMessageAdd ************************/
		foreach(GetModuleEvents("forum", "onBeforeMessageAdd", true) as $arEvent)
		{
			if (ExecuteModuleEventEx($arEvent, array(&$arFields, &$strUploadDir)) === false)
				return false;
		}
/***************** /Event ******************************************/
		if (empty($arFields))
			return false;
		$arInsert = $DB->PrepareInsert("b_forum_message", $arFields, $strUploadDir);

		$strDatePostField = "";
		$strDatePostValue = "";
		if (!is_set($arFields, "POST_DATE"))
		{
			$strDatePostField = ", POST_DATE";
			$strDatePostValue = ", ".$DB->GetNowFunction()."";
		}

		$strSql = "INSERT INTO b_forum_message(".$arInsert[0].$strDatePostField.") VALUES(".$arInsert[1].$strDatePostValue.")";
		$DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);
		$ID = intVal($DB->LastID());
/***************** Attach ******************************************/
		if (!empty($arFiles))
			CForumFiles::UpdateByID($arFiles, array("FORUM_ID" => $arFields["FORUM_ID"],
				"TOPIC_ID" => $arFields["TOPIC_ID"], "MESSAGE_ID" => $ID));
/***************** Attach/******************************************/
/***************** Quota *******************************************/
		$_SESSION["SESS_RECOUNT_DB"] = "Y";

		$GLOBALS["USER_FIELD_MANAGER"]->Update("FORUM_MESSAGE", $ID, $arFields);
		if ($arParams["SKIP_STATISTIC"] == "Y" && $arParams["SKIP_INDEXING"] == "Y")
			return $ID;
		$arMessage = CForumMessage::GetByIDEx($ID, array("GET_FORUM_INFO" => "N", "GET_TOPIC_INFO" => "Y", "FILTER" => "Y"));

		if ($arParams["SKIP_STATISTIC"] != "Y")
		{
			if (intVal($arMessage["AUTHOR_ID"]) > 0)
			{
				CForumUser::SetStat($arMessage["AUTHOR_ID"], array("MESSAGE" => $arMessage));
			}
			CForumTopic::SetStat($arMessage["TOPIC_ID"],  array("MESSAGE" => $arMessage));
			CForumNew::SetStat($arMessage["FORUM_ID"],  array("MESSAGE" => $arMessage));
		}
/***************** Events onAfterMessageAdd ************************/
		foreach(GetModuleEvents("forum", "onAfterMessageAdd", true) as $arEvent)
			ExecuteModuleEventEx($arEvent, array(&$ID, $arMessage, $arMessage["TOPIC_INFO"], $arMessage["FORUM_INFO"], $arFields));
/***************** /Events *****************************************/
		if ($arMessage["APPROVED"] == "Y")
		{
			if ($arParams["SKIP_INDEXING"] != "Y" && CModule::IncludeModule("search"))
			{
				$arMessage["POST_MESSAGE"] = (COption::GetOptionString("forum", "FILTER", "Y") == "Y" ?
					$arMessage["POST_MESSAGE_FILTER"] : $arMessage["POST_MESSAGE"]);
				$arParams = array(
					"PERMISSION" => array(),
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:101,代码来源:message.php

示例15: ConfirmEvent

 function ConfirmEvent($ID, $SITE_ID = SITE_ID)
 {
     static $SITE_DIR_CACHE = array();
     CTimeZone::Disable();
     $subscr = CSubscription::GetByID($ID);
     CTimeZone::Enable();
     if ($subscr_arr = $subscr->Fetch()) {
         if (!array_key_exists($SITE_ID, $SITE_DIR_CACHE)) {
             $db_lang = CLang::GetByID($SITE_ID);
             if ($ar_lang = $db_lang->Fetch()) {
                 $SITE_DIR_CACHE[$SITE_ID] = $ar_lang["DIR"];
             } else {
                 $SITE_DIR_CACHE[$SITE_ID] = LANG_DIR;
             }
         }
         $subscr_arr["USER_NAME"] = "";
         $subscr_arr["USER_LAST_NAME"] = "";
         if (intval($subscr_arr["USER_ID"]) > 0) {
             $rsUser = CUser::GetByID($subscr_arr["USER_ID"]);
             if ($arUser = $rsUser->Fetch()) {
                 $subscr_arr["USER_NAME"] = $arUser["NAME"];
                 $subscr_arr["USER_LAST_NAME"] = $arUser["LAST_NAME"];
             }
         }
         $arFields = array("ID" => $subscr_arr["ID"], "EMAIL" => $subscr_arr["EMAIL"], "CONFIRM_CODE" => $subscr_arr["CONFIRM_CODE"], "USER_NAME" => $subscr_arr["USER_NAME"] . " " . $subscr_arr["USER_LAST_NAME"], "DATE_SUBSCR" => $subscr_arr["DATE_UPDATE"] != "" ? $subscr_arr["DATE_UPDATE"] : $subscr_arr["DATE_INSERT"], "SUBSCR_SECTION" => str_replace(array("#SITE_DIR#", "#LANG_DIR#"), array($SITE_DIR_CACHE[$SITE_ID], $SITE_DIR_CACHE[$SITE_ID]), COption::GetOptionString("subscribe", "subscribe_section")));
         CEvent::Send("SUBSCRIBE_CONFIRM", $SITE_ID, $arFields);
         return true;
     }
     return false;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:30,代码来源:subscription.php


注:本文中的CLang::GetByID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。