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


PHP CEvent::GetSiteFieldsArray方法代码示例

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


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

示例1: SendMailMessage


//.........这里部分代码省略.........
                 $db_lang = CSite::GetByID($site_id);
                 $arForumSites[$site_id] = "/";
                 if ($ar_lang = $db_lang->Fetch()) {
                     $arForumSites[$site_id] = $ar_lang["DIR"];
                 }
                 $arForumSites[$site_id] = COption::GetOptionString("forum", "REL_FPATH", "") . "forum/read.php?FID=#FID#&TID=#TID#&MID=#MID##message#MID#";
             }
         }
         foreach (GetModuleEvents("forum", "onBeforeMailMessageSend", true) as $arEvent) {
             if (ExecuteModuleEventEx($arEvent, array(&$mailTemplate, &$arForumSites, &$arFields, $arForum, $arTopic, $arMessage)) === false) {
                 return false;
             }
         }
     }
     /*
     		??
     		ALTER TABLE dbo.B_FORUM_MESSAGE ADD
     			MSG_ID varchar(255) NULL,
     			MAIL_MESSAGE_ID int NULL
     */
     $arFilter = array("FORUM_ID" => $FID, "TOPIC_ID_OR_NULL" => $TID, "ACTIVE" => "Y", ">=PERMISSION" => $arTopic["APPROVED"] != "Y" || $arMessage["APPROVED"] != "Y" ? "Q" : "E");
     if ($arMessage["NEW_TOPIC"] != "Y") {
         $arFilter["NEW_TOPIC_ONLY"] = "N";
     }
     if ($mailTemplate == "NEW_FORUM_MESSAGE") {
         $arFilter["LAST_SEND_OR_NULL"] = $MID;
     }
     if ($arTopic["SOCNET_GROUP_ID"] > 0) {
         $mailTemplate = "FORUM_NEW_MESSAGE_MAIL";
         $arFilter["SOCNET_GROUP_ID"] = $arTopic["SOCNET_GROUP_ID"];
     } else {
         $arFilter["SOCNET_GROUP_ID"] = false;
     }
     $db_res = CForumSubscribe::GetListEx(array("USER_ID" => "ASC"), $arFilter);
     $arID = array();
     $arSiteFields = array();
     $currentUserID = false;
     while ($res = $db_res->Fetch()) {
         // SUBSC_GET_MY_MESSAGE - Send my messages to myself.
         if ($res["SUBSC_GET_MY_MESSAGE"] == "N" && $res["USER_ID"] == $USER->GetId()) {
             continue;
         }
         // SUBSC_GROUP_MESSAGE  - Group messages.
         if ($currentUserID == $res["USER_ID"]) {
             continue;
         }
         // Check email
         if (empty($res["EMAIL"])) {
             continue;
         }
         if ($mailTemplate == "FORUM_NEW_MESSAGE_MAIL" && $res["USER_ID"] == $arMessage["AUTHOR_ID"]) {
             continue;
         }
         $currentUserID = $res["USER_ID"];
         $arFields_tmp = $arFields;
         if (!is_set($arFields_tmp, "PATH2FORUM")) {
             $arFields_tmp["PATH2FORUM"] = $arForumSites[$res["SITE_ID"]];
         }
         if (!is_set($arFields_tmp, "MESSAGE_TEXT")) {
             if (!isset(${"parser_" . $res["SITE_ID"]})) {
                 ${"parser_" . $res["SITE_ID"]} = new forumTextParser($res["SITE_ID"]);
             }
             if (empty($arSiteFields[$res["SITE_ID"]])) {
                 $arSiteFields[$res["SITE_ID"]] = $event->GetSiteFieldsArray($res["SITE_ID"]);
                 $db_site = CSite::GetByID($res["SITE_ID"]);
                 if ($db_site && ($arSite = $db_site->Fetch())) {
                     $arSiteFields[$res["SITE_ID"]] = array_merge($arSiteFields[$res["SITE_ID"]], $arSite, array("LANG_MESS" => IncludeModuleLangFile(__FILE__, $arSiteFields[$res["SITE_ID"]]["LANGUAGE_ID"], true)));
                     $arSiteFields[$res["SITE_ID"]]["ATTACHED_FILES"] = $arSiteFields[$res["SITE_ID"]]["LANG_MESS"]["F_ATTACHED_FILES"];
                 }
             }
             if (!empty($arSiteFields[$res["SITE_ID"]]["SERVER_NAME"])) {
                 ${"parser_" . $res["SITE_ID"]}->serverName = $arSiteFields[$res["SITE_ID"]]["SERVER_NAME"];
             }
             ${"parser_" . $res["SITE_ID"]}->arFiles = $arFiles;
             $POST_MESSAGE_HTML = $arMessage["POST_MESSAGE"];
             if (COption::GetOptionString("forum", "FILTER", "Y") == "Y") {
                 $POST_MESSAGE_HTML = empty($arMessage["POST_MESSAGE_FILTER"]) ? CFilterUnquotableWords::Filter($POST_MESSAGE_HTML) : $arMessage["POST_MESSAGE_FILTER"];
             }
             $arFields_tmp["MESSAGE_TEXT"] = ${"parser_" . $res["SITE_ID"]}->convert4mail($POST_MESSAGE_HTML);
             $arFields_tmp["PARSED_FILES"] = ${"parser_" . $res["SITE_ID"]}->arFilesIDParsed;
             $tmp = array_diff(array_keys($arFiles), ${"parser_" . $res["SITE_ID"]}->arFilesIDParsed);
             if (!empty($tmp)) {
                 $str = "[FILE ID=" . implode("]\n[FILE ID=", $tmp) . "]";
                 ${"parser_" . $res["SITE_ID"]}->ParserFile($str, ${"parser_" . $res["SITE_ID"]}, "mail");
                 $arFields_tmp["MESSAGE_TEXT"] .= "\n\n" . $arSiteFields[$res["SITE_ID"]]["ATTACHED_FILES"] . "\n" . $str;
             }
         }
         $arFields_tmp["RECIPIENT"] = $res["EMAIL"];
         $event->Send($mailTemplate, $res["SITE_ID"], $arFields_tmp, "N");
         $arID[] = $res["ID"];
         if (count($arID) > 255) {
             CForumSubscribe::UpdateLastSend($MID, implode(",", $arID));
             $arID = array();
         }
     }
     if (count($arID) > 0) {
         CForumSubscribe::UpdateLastSend($MID, implode(",", $arID));
     }
     return true;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:101,代码来源:message.php

示例2: array

 }
 if (empty($USER_INFO)) {
     $arError[] = array("id" => "bad_user_info", "text" => str_replace("##", htmlspecialcharsEx($_REQUEST["USER_ID"]), GetMessage("PM_USER_NOT_FOUND")));
 } else {
     $arrVars = array("AUTHOR_ID" => $USER->GetID(), "POST_SUBJ" => $_REQUEST["POST_SUBJ"], "POST_MESSAGE" => $_REQUEST["POST_MESSAGE"], "USE_SMILES" => $_REQUEST["USE_SMILES"], "USER_ID" => $USER_INFO["USER_ID"], "COPY_TO_OUTBOX" => $_REQUEST["COPY_TO_OUTBOX"], "REQUEST_IS_READ" => $_REQUEST["REQUEST_IS_READ"]);
     $arParams["MID"] = CForumPrivateMessage::Send($arrVars);
     if (intVal($arParams["MID"]) <= 0) {
         $err = $APPLICATION->GetException();
         $arError[] = array("id" => "bad_send", "text" => $err->GetString());
     } elseif ($arParams["version"] == 2) {
         $db_res = CForumPrivateMessage::GetListEx(array(), array("ID" => $arParams["MID"]));
         if (!($db_res && ($res = $db_res->GetNext()))) {
             "";
         } elseif (!empty($res["RECIPIENT_EMAIL"])) {
             $event = new CEvent();
             $arSiteInfo = $event->GetSiteFieldsArray(SITE_ID);
             if (!isset(${"parser_" . LANGUAGE_ID})) {
                 ${"parser_" . LANGUAGE_ID} = new forumTextParser(LANGUAGE_ID);
             }
             $POST_MESSAGE = ${"parser_" . LANGUAGE_ID}->convert4mail(str_replace("#SERVER_NAME#", SITE_SERVER_NAME, $_REQUEST["POST_MESSAGE"]));
             $arFields = array("FROM_NAME" => $res["AUTHOR_NAME"], "FROM_USER_ID" => $USER->GetID(), "FROM_EMAIL" => $USER->GetEmail(), "TO_NAME" => $res["RECIPIENT_NAME"], "TO_USER_ID" => $res["RECIPIENT_ID"], "TO_EMAIL" => $res["RECIPIENT_EMAIL"], "SUBJECT" => $_REQUEST["POST_SUBJ"], "MESSAGE" => $POST_MESSAGE, "MESSAGE_DATE" => date("d.m.Y H:i:s"), "MESSAGE_LINK" => "http://" . SITE_SERVER_NAME . CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_PM_READ"], array("FID" => "1", "MID" => $arParams["MID"])) . " \n");
             $event->Send("NEW_FORUM_PRIVATE_MESSAGE", SITE_ID, $arFields, "N");
         }
     }
     if ($arParams['AUTOSAVE']) {
         $arParams['AUTOSAVE']->Reset();
     }
     // Clear cache.
     BXClearCache(true, "/bitrix/forum/user/" . $res["RECIPIENT_ID"] . "/");
     $arComponentPath = array("bitrix:forum");
     foreach ($arComponentPath as $path) {
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php

示例3: CheckEvents

 function CheckEvents()
 {
     if (defined("DisableEventsCheck") && DisableEventsCheck === true || defined("BX_CRONTAB_SUPPORT") && BX_CRONTAB_SUPPORT === true && BX_CRONTAB !== true) {
         return;
     }
     $err_mess = CEvent::err_mess() . "<br>Function: CheckEvents<br>Line: ";
     global $DB;
     if (CACHED_b_event !== false && file_exists($_SERVER["DOCUMENT_ROOT"] . "/" . BX_ROOT . "/managed_cache/" . $DB->type . "/b_event")) {
         return "";
     }
     $arCharset = array();
     $DB->StartTransaction();
     $DB->Query("SET LOCK_TIMEOUT 0", false, $err_mess . __LINE__);
     $strSql = "\n\t\t\tSELECT TOP 5\n\t\t\t\tID,\n\t\t\t\tC_FIELDS,\n\t\t\t\tEVENT_NAME,\n\t\t\t\tMESSAGE_ID,\n\t\t\t\tLID,\n\t\t\t\t" . $DB->DateToCharFunction("DATE_INSERT") . " as DATE_INSERT_S,\n\t\t\t\tDUPLICATE\n\t\t\tFROM\n\t\t\t\tb_event\n\t\t\tWITH (TABLOCKX)\n\t\t\tWHERE\n\t\t\t\tSUCCESS_EXEC = 'N'\n\t\t\tORDER BY\n\t\t\t\tDATE_INSERT\n\t\t\t";
     //echo "<pre>".$strSql."</pre>";
     $rsMails = $DB->Query($strSql, true);
     if (!$rsMails) {
         $DB->Commit();
         return;
     }
     $eol = CEvent::GetMailEOL();
     $cnt = 0;
     while ($arMail = $rsMails->Fetch()) {
         $bWas = false;
         // сайты письма
         $site_id = "";
         $arSites = explode(",", $arMail["LID"]);
         $strSites = "";
         foreach ($arSites as $site_id) {
             $site_id = trim($site_id);
             if (strlen($site_id) > 0) {
                 if ($strSites != "") {
                     $strSites .= ",";
                 }
                 $strSites .= "'" . $DB->ForSql($site_id, 2) . "'";
             }
         }
         // если сайт определен
         if (strlen($site_id) > 0) {
             // кодировка письма
             if (!in_array($site_id, array_keys($arCharset))) {
                 $strSql = "\n\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\tCHARSET\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\tb_lang\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tLID = '" . $DB->ForSql($site_id, 2) . "'\n\t\t\t\t\t\t";
                 $rsSites = $DB->Query($strSql, false, $err_mess . __LINE__);
                 $arSite = $rsSites->Fetch();
                 $arCharset[$site_id] = $arSite["CHARSET"];
             }
             $charset = $arCharset[$site_id];
             // шаблоны письма
             $MESSAGE_ID = intval($arMail["MESSAGE_ID"]);
             if ($MESSAGE_ID > 0) {
                 $strSql = "\n\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\tM.ID,\n\t\t\t\t\t\t\tM.SUBJECT,\n\t\t\t\t\t\t\tM.MESSAGE,\n\t\t\t\t\t\t\tM.EMAIL_FROM,\n\t\t\t\t\t\t\tM.EMAIL_TO,\n\t\t\t\t\t\t\tM.BODY_TYPE,\n\t\t\t\t\t\t\tM.BCC\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\tb_event_message M\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tM.ID = {$MESSAGE_ID}\n\t\t\t\t\t\tand M.ACTIVE='Y'\n\t\t\t\t\t\t";
             } else {
                 $strSql = "\n\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\tM.ID,\n\t\t\t\t\t\t\tM.SUBJECT,\n\t\t\t\t\t\t\tM.MESSAGE,\n\t\t\t\t\t\t\tM.EMAIL_FROM,\n\t\t\t\t\t\t\tM.EMAIL_TO,\n\t\t\t\t\t\t\tM.BODY_TYPE,\n\t\t\t\t\t\t\tM.BCC\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\tb_event_message M\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\tM.ACTIVE = 'Y'\n\t\t\t\t\t\t\tand M.EVENT_NAME = '" . $DB->ForSql($arMail["EVENT_NAME"]) . "'\n\t\t\t\t\t\t\tand exists(\n\t\t\t\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\t\t\t\t'x'\n\t\t\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\t\t\tb_event_message_site MS\n\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t\tM.ID = MS.EVENT_MESSAGE_ID\n\t\t\t\t\t\t\t\t\tand MS.SITE_ID in (" . $strSites . ")\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t";
             }
             // поля письма
             $arFields = CEvent::ExtractMailFields($arMail["C_FIELDS"]);
             $bSuccess = false;
             $bFail = false;
             $rsTemplates = $DB->Query($strSql, false, $err_mess . __LINE__);
             while ($arTemplate = $rsTemplates->Fetch()) {
                 // добавим из настроек сайта поля #SITE_NAME#, #SERVER_NAME#, #DEFAULT_EMAIL_FROM#
                 $strSql = "\n\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\tMS.SITE_ID\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\tb_event_message_site MS\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\tMS.EVENT_MESSAGE_ID = " . $arTemplate["ID"] . "\n\t\t\t\t\t\t\tand MS.SITE_ID IN (" . $strSites . ")\n\t\t\t\t\t\t";
                 $rsSites = $DB->Query($strSql, false, "FILE: " . __FILE__ . "<br>LINE: " . __LINE__);
                 if ($arSite = $rsSites->Fetch()) {
                     $arFields += CEvent::GetSiteFieldsArray($arSite["SITE_ID"]);
                 } else {
                     $arFields += CEvent::GetSiteFieldsArray(false);
                 }
                 $email_from = CEvent::ReplaceTemplate($arTemplate["EMAIL_FROM"], $arFields);
                 $email_to = CEvent::ReplaceTemplate($arTemplate["EMAIL_TO"], $arFields);
                 $message = CEvent::ReplaceTemplate($arTemplate["MESSAGE"], $arFields);
                 $subject = CEvent::ReplaceTemplate($arTemplate["SUBJECT"], $arFields);
                 $bcc = CEvent::ReplaceTemplate($arTemplate["BCC"], $arFields);
                 $email_from = trim($email_from, "\r\n");
                 $email_to = trim($email_to, "\r\n");
                 $subject = trim($subject, "\r\n");
                 $bcc = trim($bcc, "\r\n");
                 if (COption::GetOptionString("main", "convert_mail_header", "Y") == "Y") {
                     $email_from = CEvent::EncodeMimeString($email_from, $charset);
                     $email_to = CEvent::EncodeMimeString($email_to, $charset);
                     $subject = CEvent::EncodeMimeString($subject, $charset);
                 }
                 //если есть желающие получать всю почту, добавим их...
                 if ($arMail["DUPLICATE"] == "Y") {
                     $all_bcc = COption::GetOptionString("main", "all_bcc", "");
                     $bcc .= strlen($all_bcc) > 0 ? (strlen($bcc) > 0 ? "," : "") . $all_bcc : "";
                 }
                 if (COption::GetOptionString("main", "send_mid", "N") == "Y") {
                     $message .= ($arTemplate["BODY_TYPE"] == "html" ? "<br><br>" : "\n\n") . "MID #" . $arMail["ID"] . "." . $arTemplate["ID"] . " (" . $arMail["DATE_INSERT"] . ")\n";
                 }
                 $message = str_replace("\r\n", "\n", $message);
                 if (COption::GetOptionString("main", "CONVERT_UNIX_NEWLINE_2_WINDOWS", "N") == "Y") {
                     $message = str_replace("\n", "\r\n", $message);
                 }
                 $header = "";
                 if (COption::GetOptionString("main", "fill_to_mail", "N") == "Y") {
                     $header = "To: {$email_to}" . $eol;
                 }
                 $header = "From: {$email_from}" . $eol . $header . "Reply-To: {$email_from}" . $eol . "X-Priority: 3 (Normal)" . $eol . "X-MID: " . $arMail["ID"] . "." . $arTemplate["ID"] . " (" . $arMail["DATE_INSERT_S"] . ")" . $eol . "X-EVENT_NAME: " . $arMail["EVENT_NAME"] . $eol;
                 if (strpos($bcc, "@") !== false) {
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


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