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


PHP CSite::GetById方法代码示例

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


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

示例1: SocnetEMailMessageAdd


//.........这里部分代码省略.........
     }
     if (!empty($arMessageFields["FIELD_BCC"])) {
         $arRes[] = "Bcc: " . $arMessageFields["FIELD_BCC"];
     }
     $arRes[] = "Subject: " . $arMessageFields["SUBJECT"];
     $arRes[] = "Date: " . $arMessageFields["FIELD_DATE"];
     $arFields["MAIL_HEADER"] = implode("\r\n", $arRes);
     preg_match_all('#Received:\\s+from\\s+(.*)by.*#i', $arMessageFields["HEADER"], $regs);
     if (is_array($regs) && is_array($regs[1])) {
         $arFields["AUTHOR_IP"] = $arFields["AUTHOR_REAL_IP"] = '<email: ' . $regs[1][count($regs[1]) - 1] . '>';
     } else {
         $arFields["AUTHOR_IP"] = $arFields["AUTHOR_REAL_IP"] = '<email: no address>';
     }
     /*
     
     $AUTHOR_IP = ForumGetRealIP();
     $AUTHOR_IP_tmp = $AUTHOR_IP;
     $AUTHOR_REAL_IP = $_SERVER['REMOTE_ADDR'];
     if (COption::GetOptionString("forum", "FORUM_GETHOSTBYADDR", "N") == "Y")
     {
     	$AUTHOR_IP = @gethostbyaddr($AUTHOR_IP);
     
     	if ($AUTHOR_IP_tmp==$AUTHOR_REAL_IP)
     		$AUTHOR_REAL_IP = $AUTHOR_IP;
     	else
     		$AUTHOR_REAL_IP = @gethostbyaddr($AUTHOR_REAL_IP);
     }
     
     $arFields["AUTHOR_IP"] = ($AUTHOR_IP!==False) ? $AUTHOR_IP : "<no address>";
     $arFields["AUTHOR_REAL_IP"] = ($AUTHOR_REAL_IP!==False) ? $AUTHOR_REAL_IP : "<no address>";
     */
     $strErrorMessage = '';
     $MESSAGE_ID = CForumMessage::Add($arFields, false);
     if (intVal($MESSAGE_ID) <= 0) {
         $str = $GLOBALS['APPLICATION']->GetException();
         if ($str && $str->GetString()) {
             $strErrorMessage .= "[" . $str->GetString() . "]";
         }
         if ($arFields["NEW_TOPIC"] == 'Y') {
             CForumTopic::Delete($TOPIC_ID);
         }
         CMailLog::AddMessage(array("MAILBOX_ID" => $arMessageFields["MAILBOX_ID"], "MESSAGE_ID" => $arMessageFields["ID"], "FILTER_ID" => $arParams["MAIL_FILTER_ID"], "LOG_TYPE" => "FILTER_ERROR", "MESSAGE" => GetMessage("FORUM_MAIL_ERROR5") . " " . $strErrorMessage));
     }
     if ($MESSAGE_ID > 0) {
         CMailLog::AddMessage(array("MAILBOX_ID" => $arMessageFields["MAILBOX_ID"], "MESSAGE_ID" => $arMessageFields["ID"], "FILTER_ID" => $arParams["MAIL_FILTER_ID"], "LOG_TYPE" => "FILTER_COMPLETE", "MESSAGE" => GetMessage("FORUM_MAIL_OK") . " " . $MESSAGE_ID . " (TID#" . $TOPIC_ID . ")"));
         CForumMessage::SendMailMessage($MESSAGE_ID, array(), false, "NEW_FORUM_MESSAGE");
         $dbSite = CSite::GetById($arMessageFields["LID"]);
         if ($arSite = $dbSite->Fetch()) {
             $lang = $arSite['LANGUAGE_ID'];
         } else {
             $lang = $LANGUAGE_ID;
         }
         $parser = new forumTextParser();
         $arForum = CForumNew::GetByID($FORUM_ID);
         $arAllow = array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "LIST" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "SMILES" => "N", "UPLOAD" => $arForum["ALLOW_UPLOAD"], "NL2BR" => "N", "TABLE" => "N", "ALIGN" => "N");
         if ($arFields["NEW_TOPIC"] == "Y") {
             $arFieldsForSocnet = array("ENTITY_TYPE" => SONET_ENTITY_GROUP, "ENTITY_ID" => $SOCNET_GROUP_ID, "EVENT_ID" => "forum", "=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "TITLE_TEMPLATE" => str_replace("#AUTHOR_NAME#", $AUTHOR_NAME, CForumEmail::GetLangMessage("FORUM_MAIL_SOCNET_TITLE_TOPIC", $lang)), "TITLE" => $subject, "MESSAGE" => $parser->convert($body, $arAllow), "TEXT_MESSAGE" => $parser->convert4mail($body), "URL" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE"], array("UID" => $AUTHOR_USER_ID, "FID" => $FORUM_ID, "TID" => $TOPIC_ID, "MID" => $MESSAGE_ID)), "PARAMS" => serialize(array("PATH_TO_MESSAGE" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE"], array("TID" => $TOPIC_ID)))), "MODULE_ID" => false, "CALLBACK_FUNC" => false, "SOURCE_ID" => $MESSAGE_ID, "RATING_TYPE_ID" => "FORUM_TOPIC", "RATING_ENTITY_ID" => intval($TOPIC_ID));
             if (intVal($AUTHOR_USER_ID) > 0) {
                 $arFieldsForSocnet["USER_ID"] = $AUTHOR_USER_ID;
             }
             $logID = CSocNetLog::Add($arFieldsForSocnet, false);
             if (intval($logID) > 0) {
                 CSocNetLog::Update($logID, array("TMP_ID" => $logID));
                 CSocNetLogRights::SetForSonet($logID, $arFieldsForSocnet["ENTITY_TYPE"], $arFieldsForSocnet["ENTITY_ID"], "forum", "view", true);
                 CSocNetLog::SendEvent($logID, "SONET_NEW_EVENT", $logID);
             }
         } else {
             $dbForumMessage = CForumMessage::GetList(array("ID" => "ASC"), array("TOPIC_ID" => $TOPIC_ID));
             if ($arForumMessage = $dbForumMessage->Fetch()) {
                 $dbRes = CSocNetLog::GetList(array("ID" => "DESC"), array("EVENT_ID" => "forum", "SOURCE_ID" => $arForumMessage["ID"]), false, false, array("ID", "TMP_ID"));
                 if ($arRes = $dbRes->Fetch()) {
                     $log_id = $arRes["TMP_ID"];
                 } else {
                     $dbFirstMessage = CForumMessage::GetList(array("ID" => "ASC"), array("TOPIC_ID" => $arForumMessage["TOPIC_ID"]), false, 1);
                     if ($arFirstMessage = $dbFirstMessage->Fetch()) {
                         $arTopic = CForumTopic::GetByID($arFirstMessage["TOPIC_ID"]);
                         $sFirstMessageText = COption::GetOptionString("forum", "FILTER", "Y") == "Y" ? $arFirstMessage["POST_MESSAGE_FILTER"] : $arFirstMessage["POST_MESSAGE"];
                         $sFirstMessageURL = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE"], array("UID" => $arFirstMessage["AUTHOR_ID"], "FID" => $arFirstMessage["FORUM_ID"], "TID" => $arFirstMessage["TOPIC_ID"], "MID" => $arFirstMessage["ID"]));
                         $arFieldsForSocnet = array("ENTITY_TYPE" => SONET_ENTITY_GROUP, "ENTITY_ID" => $SOCNET_GROUP_ID, "EVENT_ID" => "forum", "LOG_DATE" => $arFirstMessage["POST_DATE"], "LOG_UPDATE" => $arFirstMessage["POST_DATE"], "TITLE_TEMPLATE" => str_replace("#AUTHOR_NAME#", $arFirstMessage["AUTHOR_NAME"], GetMessage("SONET_FORUM_LOG_TOPIC_TEMPLATE")), "TITLE" => $arTopic["TITLE"], "MESSAGE" => $parser->convert($sFirstMessageText, $arAllow), "TEXT_MESSAGE" => $parser->convert4mail($sFirstMessageText), "URL" => $sFirstMessageURL, "PARAMS" => serialize(array("PATH_TO_MESSAGE" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE"], array("TID" => $arFirstMessage["TOPIC_ID"])))), "MODULE_ID" => false, "CALLBACK_FUNC" => false, "SOURCE_ID" => $arFirstMessage["ID"], "RATING_TYPE_ID" => "FORUM_TOPIC", "RATING_ENTITY_ID" => intval($arFirstMessage["TOPIC_ID"]));
                         if (intVal($arFirstMessage["AUTHOR_ID"]) > 0) {
                             $arFieldsForSocnet["USER_ID"] = $arFirstMessage["AUTHOR_ID"];
                         }
                         $log_id = CSocNetLog::Add($arFieldsForSocnet, false);
                         if (intval($log_id) > 0) {
                             CSocNetLog::Update($log_id, array("TMP_ID" => $log_id));
                             CSocNetLogRights::SetForSonet($log_id, $arFieldsForSocnet["ENTITY_TYPE"], $arFieldsForSocnet["ENTITY_ID"], "forum", "view", true);
                         }
                     }
                 }
                 if (intval($log_id) > 0) {
                     $arFieldsForSocnet = array("ENTITY_TYPE" => SONET_ENTITY_GROUP, "ENTITY_ID" => $SOCNET_GROUP_ID, "EVENT_ID" => "forum", "LOG_ID" => $log_id, "=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "MESSAGE" => $parser->convert($body, $arAllow), "TEXT_MESSAGE" => $parser->convert4mail($body), "URL" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE"], array("UID" => $AUTHOR_USER_ID, "FID" => $FORUM_ID, "TID" => $TOPIC_ID, "MID" => $MESSAGE_ID)), "MODULE_ID" => false, "SOURCE_ID" => $MESSAGE_ID, "RATING_TYPE_ID" => "FORUM_POST", "RATING_ENTITY_ID" => intval($MESSAGE_ID));
                     if (intVal($AUTHOR_USER_ID) > 0) {
                         $arFieldsForSocnet["USER_ID"] = $AUTHOR_USER_ID;
                     }
                     CSocNetLogComments::Add($arFieldsForSocnet);
                 }
             }
         }
     }
 }
开发者ID:,项目名称:,代码行数:101,代码来源:

示例2: CreateCatalog

 public static function CreateCatalog($originatorID = '', $name = '', $siteID = null)
 {
     if (!is_string($originatorID) || strlen($originatorID) == 0) {
         $originatorID = null;
     }
     if ($siteID == null) {
         $siteID = SITE_ID;
     }
     $langID = LANGUAGE_ID;
     $dbSite = CSite::GetById($siteID);
     if ($arSite = $dbSite->Fetch()) {
         $langID = $arSite['LANGUAGE_ID'];
     }
     $result = true;
     //check type type
     $typeID = self::GetCatalogTypeID();
     //$rsIBlockTypes = CIBlockType::GetByID($typeID); // CIBlockType::GetByID() is unstable
     $rsIBlockTypes = CIBlockType::GetList(array(), array("=ID" => $typeID));
     if (!$rsIBlockTypes->Fetch()) {
         $iblocktype = new CIBlockType();
         $result = $iblocktype->Add(array('ID' => $typeID, 'SECTIONS' => 'Y', 'IN_RSS' => 'N', 'SORT' => 100, 'LANG' => array($langID => array('NAME' => GetMessage('CRM_PRODUCT_CATALOG_TYPE_TITLE'), 'SECTION_NAME' => GetMessage('CRM_PRODUCT_CATALOG_SECTION_NAME'), 'ELEMENT_NAME' => GetMessage('CRM_PRODUCT_CATALOG_PRODUCT_NAME')))));
         if (!$result) {
             self::RegisterError($iblocktype->LAST_ERROR);
             return false;
         }
     }
     //echo 'Error: '.$obBlocktype->LAST_ERROR.'<br/>';
     $arSite = array();
     $sites = CSite::GetList($by = 'sort', $order = 'desc', array('ACTIVE' => 'Y'));
     while ($site = $sites->Fetch()) {
         $arSite[] = $site['LID'];
     }
     //creation of iblock
     $iblock = new CIBlock();
     $iblockID = $iblock->Add(array('NAME' => isset($name[0]) ? $name : GetMessage('CRM_PRODUCT_CATALOG_TITLE'), 'ACTIVE' => 'Y', 'IBLOCK_TYPE_ID' => $typeID, 'LID' => $siteID, 'SORT' => 100, 'XML_ID' => 'crm_external_' . $originatorID, 'INDEX_ELEMENT' => 'N', 'WORKFLOW' => 'N', 'BIZPROC' => 'N', 'VERSION' => 1, 'GROUP_ID' => array(2 => 'R')));
     if ($iblockID === false) {
         self::RegisterError($iblock->LAST_ERROR);
         return false;
     }
     //echo 'Error: '.$iblock->LAST_ERROR.'<br/>';
     //creation of catalog
     $result = CCrmCatalog::Add(array('ID' => $iblockID, 'ORIGINATOR_ID' => $originatorID));
     if ($result === false) {
         self::RegisterError('Catalog creation error');
         return false;
     }
     return $iblockID;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:48,代码来源:crm_catalog.php

示例3: array

        if (strlen($str) > 0) {
            $lAdmin->AddFilterError($str);
            return false;
        }
        return true;
    }
    if (CheckFilter($arFilterFields)) {
        $arFilter = array("NAME" => $find != '' && $find_type == "name" ? $find : $find_name, "TIMESTAMP_1" => $find_timestamp_1, "TIMESTAMP_2" => $find_timestamp_2, "TYPE" => $find_type);
    } else {
        $arFilter = array();
    }
} else {
    $arFilter = array();
}
$documentRoot = CSite::GetSiteDocRoot($site);
$arSite = CSite::GetById($site);
$arSite = $arSite->Fetch();
$addUrl = 'lang=' . LANGUAGE_ID . ($logical == "Y" ? '&logical=Y' : '');
$addUrl_s = $addUrl;
if ($bSearch) {
    $addUrl_s .= '&search=Y' . ($searchSess ? '&ssess=' . $searchSess : '');
}
$path = $io->CombinePath("/", $path);
if (strpos($path, '/..') !== false) {
    $path = '';
}
$absPath = $documentRoot . $path;
// Only for AJAX reuest from Quick Path controll in form - jump to viewing file
if (isset($_GET['check_for_file']) && $_GET['check_for_file'] == 'Y' && $io->FileExists($absPath)) {
    die('<script>top.location="' . "fileman_file_view.php?path=" . urlencode($path) . '&' . bitrix_sessid_get() . '&' . $addUrl . '"</script>');
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:fileman_admin.php

示例4: CIBlockType

<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
if (!CModule::IncludeModule("bizproc") || !CModule::IncludeModule("iblock")) {
    return;
}
$langTmp = "";
$dbSite = CSite::GetById(WIZARD_SITE_ID);
if ($arSite = $dbSite->Fetch()) {
    $langTmp = $arSite["LANGUAGE_ID"];
}
$iblockType = "bizproc_iblockx";
$ib = new CIBlockType();
$arFields = array("ID" => $iblockType, "LANG" => array($langTmp => array("NAME" => GetMessage("BIZPROC_DEMO_TYPE_TITLE"))));
$ib->Add($arFields);
$runtime = CBPRuntime::GetRuntime();
$runtime->StartRuntime();
$arResult["DocumentService"] = $runtime->GetService("DocumentService");
$iblockCode = "bizproc1_" . WIZARD_SITE_ID;
$rsIBlock = CIBlock::GetList(array(), array("XML_ID" => $iblockCode, "IBLOCK_TYPE_ID" => $iblockType));
$iblockID = false;
if ($arIBlock = $rsIBlock->Fetch()) {
    $iblockID = $arIBlock["ID"];
}
if ($iblockID == false && WIZARD_SITE_ID == "s1") {
    $rsIBlock = CIBlock::GetList(array(), array("CODE" => "bizproc1", "TYPE" => $iblockType));
    $iblockID = false;
    if ($arIBlock = $rsIBlock->Fetch()) {
        $iblockID = $arIBlock["ID"];
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:index.php


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