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


PHP CSocNetLogTools::AddComment_Review_CheckIBlock方法代码示例

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


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

示例1: AddComment_News

 function AddComment_News($arFields)
 {
     if (!CModule::IncludeModule("forum")) {
         return false;
     }
     if (!CModule::IncludeModule("iblock")) {
         return false;
     }
     if (!CModule::IncludeModule("socialnetwork")) {
         return false;
     }
     $dbResult = CSocNetLog::GetList(array("ID" => "DESC"), array("TMP_ID" => $arFields["LOG_ID"]), false, false, array("ID", "SOURCE_ID", "PARAMS"));
     $bFound = false;
     if ($arLog = $dbResult->Fetch()) {
         if (intval($arLog["SOURCE_ID"]) > 0) {
             $arFilter = array("ID" => $arLog["SOURCE_ID"]);
             $arSelectedFields = array("IBLOCK_ID", "ID", "CREATED_BY", "NAME", "PROPERTY_FORUM_TOPIC_ID", "PROPERTY_FORUM_MESSAGE_CNT");
             $db_res = CIBlockElement::GetList(array(), $arFilter, false, false, $arSelectedFields);
             if ($db_res && ($res = $db_res->GetNext())) {
                 $arElement = $res;
                 $val = COption::GetOptionString("intranet", "sonet_log_news_iblock_forum");
                 if (strlen($val) > 0) {
                     $arIBlockForum = unserialize($val);
                 } else {
                     $arIBlockForum = array();
                 }
                 if (array_key_exists($arElement["IBLOCK_ID"], $arIBlockForum)) {
                     $FORUM_ID = $arIBlockForum[$arElement["IBLOCK_ID"]];
                 }
                 if (intval($FORUM_ID) > 0) {
                     CSocNetLogTools::AddComment_Review_CheckIBlock($arElement);
                     $dbMessage = CForumMessage::GetList(array(), array("PARAM2" => $arElement["ID"]));
                     if (!($arMessage = $dbMessage->Fetch())) {
                         // Add Topic
                         $TOPIC_ID = CSocNetLogTools::AddComment_Review_CreateRoot($arElement, $FORUM_ID);
                         $bNewTopic = true;
                     } else {
                         $TOPIC_ID = $arMessage["TOPIC_ID"];
                     }
                     if (intval($TOPIC_ID) > 0) {
                         // Add comment
                         $messageID = false;
                         $bError = false;
                         if (CForumMessage::CanUserAddMessage($TOPIC_ID, $GLOBALS["USER"]->GetUserGroupArray(), $GLOBALS["USER"]->GetID(), false)) {
                             $bSHOW_NAME = true;
                             $res = CForumUser::GetByUSER_ID($GLOBALS["USER"]->GetID());
                             if ($res) {
                                 $bSHOW_NAME = $res["SHOW_NAME"] == "Y";
                             }
                             if ($bSHOW_NAME) {
                                 $AUTHOR_NAME = $GLOBALS["USER"]->GetFullName();
                             }
                             if (strlen(Trim($AUTHOR_NAME)) <= 0) {
                                 $AUTHOR_NAME = $GLOBALS["USER"]->GetLogin();
                             }
                             if (strlen($AUTHOR_NAME) <= 0) {
                                 $bError = true;
                             }
                         }
                         if (!$bError) {
                             $arFieldsMessage = array("POST_MESSAGE" => $arFields["TEXT_MESSAGE"], "USE_SMILES" => "Y", "APPROVED" => "Y", "PARAM2" => $arElement["ID"], "AUTHOR_NAME" => $AUTHOR_NAME, "AUTHOR_ID" => IntVal($GLOBALS["USER"]->GetParam("USER_ID")), "FORUM_ID" => $FORUM_ID, "TOPIC_ID" => $TOPIC_ID, "NEW_TOPIC" => "N", "GUEST_ID" => $_SESSION["SESS_GUEST_ID"], "ADD_TO_LOG" => "N");
                             $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);
                                 }
                             }
                             $arFieldsMessage["AUTHOR_IP"] = $AUTHOR_IP !== False ? $AUTHOR_IP : "<no address>";
                             $arFieldsMessage["AUTHOR_REAL_IP"] = $AUTHOR_REAL_IP !== False ? $AUTHOR_REAL_IP : "<no address>";
                             $messageID = CForumMessage::Add($arFieldsMessage, false);
                             if (intVal($messageID) <= 0) {
                                 $bError = true;
                             } else {
                                 if (CModule::IncludeModule("statistic")) {
                                     $arForum = CForumNew::GetByID($FORUM_ID);
                                     $F_EVENT1 = $arForum["EVENT1"];
                                     $F_EVENT2 = $arForum["EVENT2"];
                                     $F_EVENT3 = $arForum["EVENT3"];
                                     if (strlen($F_EVENT3) <= 0) {
                                         $arForumSite_tmp = CForumNew::GetSites($FORUM_ID);
                                         $F_EVENT3 = CForumNew::PreparePath2Message($arForumSite_tmp[SITE_ID], array("FORUM_ID" => $FORUM_ID, "TOPIC_ID" => $TOPIC_ID, "MESSAGE_ID" => $messageID));
                                     }
                                     CStatistic::Set_Event($F_EVENT1, $F_EVENT2, $F_EVENT3);
                                 }
                                 CForumMessage::SendMailMessage($messageID, array(), false, "NEW_FORUM_MESSAGE");
                                 CSocNetLogTools::AddComment_Review_UpdateElement($arElement, $TOPIC_ID, $bNewTopic);
                             }
                         }
                     }
                 }
             }
         }
     }
     if (intval($messageID) <= 0) {
         $strError = GetMessage("SONET_ADD_COMMENT_SOURCE_ERROR");
//.........这里部分代码省略.........
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:101,代码来源:include.php

示例2: AddComment_Wiki

 static function AddComment_Wiki($arFields)
 {
     if (!CModule::IncludeModule('iblock')) {
         return false;
     }
     if (!CModule::IncludeModule('socialnetwork')) {
         return false;
     }
     $ufFileID = array();
     $ufDocID = array();
     $dbResult = CSocNetLog::GetList(array('ID' => 'DESC'), array('TMP_ID' => $arFields['LOG_ID']), false, false, array('ID', 'SOURCE_ID', 'PARAMS', 'URL'));
     $bFound = false;
     if ($arLog = $dbResult->Fetch()) {
         if (strlen($arLog['PARAMS']) > 0) {
             $arFieldsParams = explode('&', $arLog['PARAMS']);
             if (is_array($arFieldsParams) && count($arFieldsParams) > 0) {
                 foreach ($arFieldsParams as $tmp) {
                     list($key, $value) = explode('=', $tmp);
                     if ($key == 'forum_id') {
                         $FORUM_ID = intval($value);
                         break;
                     }
                 }
             }
         }
         if ($FORUM_ID > 0 && intval($arLog['SOURCE_ID']) > 0) {
             $bFound = true;
         }
     }
     if ($bFound) {
         $arElement = false;
         $arFilter = array('ID' => $arLog['SOURCE_ID']);
         $arSelectedFields = array('IBLOCK_ID', 'ID', 'NAME', 'TAGS', 'CODE', 'IBLOCK_SECTION_ID', 'DETAIL_PAGE_URL', 'CREATED_BY', 'PREVIEW_PICTURE', 'PREVIEW_TEXT', 'PROPERTY_FORUM_TOPIC_ID', 'PROPERTY_FORUM_MESSAGE_CNT');
         $db_res = CIBlockElement::GetList(array(), $arFilter, false, false, $arSelectedFields);
         if ($db_res && ($res = $db_res->GetNext())) {
             $arElement = $res;
         }
         if ($arElement) {
             // check iblock properties
             CSocNetLogTools::AddComment_Review_CheckIBlock($arElement);
             $dbMessage = CForumMessage::GetList(array(), array('PARAM2' => $arElement['ID']));
             if (!($arMessage = $dbMessage->Fetch())) {
                 // Add Topic and Root Message
                 $TOPIC_ID = CSocNetLogTools::AddComment_Review_CreateRoot($arElement, $FORUM_ID, false);
                 $bNewTopic = true;
             } else {
                 $TOPIC_ID = $arMessage['TOPIC_ID'];
             }
             if (intval($TOPIC_ID) > 0) {
                 // Add comment
                 $messageID = false;
                 $arFieldsMessage = array('POST_MESSAGE' => $arFields['TEXT_MESSAGE'], 'USE_SMILES' => 'Y', 'PARAM2' => $arElement['ID'], 'APPROVED' => 'Y');
                 $GLOBALS["USER_FIELD_MANAGER"]->EditFormAddFields("SONET_COMMENT", $arTmp);
                 if (is_array($arTmp)) {
                     if (array_key_exists("UF_SONET_COM_DOC", $arTmp)) {
                         $GLOBALS["UF_FORUM_MESSAGE_DOC"] = $arTmp["UF_SONET_COM_DOC"];
                     } elseif (array_key_exists("UF_SONET_COM_FILE", $arTmp)) {
                         $arFieldsMessage["FILES"] = array();
                         foreach ($arTmp["UF_SONET_COM_FILE"] as $file_id) {
                             $arFieldsMessage["FILES"][] = array("FILE_ID" => $file_id);
                         }
                     }
                 }
                 $messageID = ForumAddMessage('REPLY', $FORUM_ID, $TOPIC_ID, 0, $arFieldsMessage, $sError, $sNote);
                 if (!$messageID) {
                     $strError = GetMessage('SONET_ADD_COMMENT_SOURCE_ERROR');
                 } else {
                     $dbAddedMessageFiles = CForumFiles::GetList(array("ID" => "ASC"), array("MESSAGE_ID" => $messageID));
                     while ($arAddedMessageFiles = $dbAddedMessageFiles->Fetch()) {
                         $ufFileID[] = $arAddedMessageFiles["FILE_ID"];
                     }
                     $ufDocID = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFieldValue("FORUM_MESSAGE", "UF_FORUM_MESSAGE_DOC", $messageID, LANGUAGE_ID);
                     CSocNetLogTools::AddComment_Review_UpdateElement($arElement, $TOPIC_ID, $bNewTopic);
                     $userID = $GLOBALS["USER"]->GetID();
                     if (CModule::IncludeModule("im") && intval($arElement["CREATED_BY"]) > 0 && $arElement["CREATED_BY"] != $userID) {
                         $rsUnFollower = CSocNetLogFollow::GetList(array("USER_ID" => $arElement["CREATED_BY"], "CODE" => "L" . $arLog["ID"], "TYPE" => "N"), array("USER_ID"));
                         $arUnFollower = $rsUnFollower->Fetch();
                         if (!$arUnFollower) {
                             $arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => $arElement["CREATED_BY"], "FROM_USER_ID" => $userID, "LOG_ID" => $arLog["ID"], "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "wiki", "NOTIFY_EVENT" => "comment");
                             $arParams["TITLE"] = str_replace(array("\r\n", "\n"), " ", $arElement["NAME"]);
                             $arParams["TITLE"] = TruncateText($arParams["TITLE"], 100);
                             $arParams["TITLE_OUT"] = TruncateText($arParams["TITLE"], 255);
                             $arTmp = CSocNetLogTools::ProcessPath(array("ELEMENT_URL" => $arLog["URL"]), $arElement["CREATED_BY"]);
                             $serverName = $arTmp["SERVER_NAME"];
                             $url = $arTmp["URLS"]["ELEMENT_URL"];
                             $arMessageFields["NOTIFY_TAG"] = "WIKI|COMMENT|" . $arElement['ID'];
                             $arMessageFields["NOTIFY_MESSAGE"] = GetMessage("WIKI_SONET_FROM_LOG_IM_COMMENT", array("#title#" => strlen($url) > 0 ? "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>" : htmlspecialcharsbx($arParams["TITLE"])));
                             $arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("WIKI_SONET_FROM_LOG_IM_COMMENT", array("#title#" => htmlspecialcharsbx($arParams["TITLE"]))) . (strlen($url) > 0 ? " (" . $serverName . $url . ")" : "") . "#BR##BR#" . $arFields["TEXT_MESSAGE"];
                             CIMNotify::Add($arMessageFields);
                         }
                     }
                 }
             } else {
                 $strError = GetMessage('SONET_ADD_COMMENT_SOURCE_ERROR');
             }
         } else {
             $strError = GetMessage('SONET_ADD_COMMENT_SOURCE_ERROR');
         }
     } else {
         $strError = GetMessage('SONET_ADD_COMMENT_SOURCE_ERROR');
//.........这里部分代码省略.........
开发者ID:rasuldev,项目名称:torino,代码行数:101,代码来源:wiki_socnet.php

示例3: AddComment_Wiki

 static function AddComment_Wiki($arFields)
 {
     if (!CModule::IncludeModule('iblock')) {
         return false;
     }
     if (!CModule::IncludeModule('socialnetwork')) {
         return false;
     }
     $dbResult = CSocNetLog::GetList(array('ID' => 'DESC'), array('TMP_ID' => $arFields['LOG_ID']), false, false, array('ID', 'SOURCE_ID', 'PARAMS'));
     $bFound = false;
     if ($arLog = $dbResult->Fetch()) {
         if (strlen($arLog['PARAMS']) > 0) {
             $arFieldsParams = explode('&', $arLog['PARAMS']);
             if (is_array($arFieldsParams) && count($arFieldsParams) > 0) {
                 foreach ($arFieldsParams as $tmp) {
                     list($key, $value) = explode('=', $tmp);
                     if ($key == 'forum_id') {
                         $FORUM_ID = intval($value);
                         break;
                     }
                 }
             }
         }
         if ($FORUM_ID > 0 && intval($arLog['SOURCE_ID']) > 0) {
             $bFound = true;
         }
     }
     if ($bFound) {
         $arElement = false;
         $arFilter = array('ID' => $arLog['SOURCE_ID']);
         $arSelectedFields = array('IBLOCK_ID', 'ID', 'NAME', 'TAGS', 'CODE', 'IBLOCK_SECTION_ID', 'DETAIL_PAGE_URL', 'CREATED_BY', 'PREVIEW_PICTURE', 'PREVIEW_TEXT', 'PROPERTY_FORUM_TOPIC_ID', 'PROPERTY_FORUM_MESSAGE_CNT');
         $db_res = CIBlockElement::GetList(array(), $arFilter, false, false, $arSelectedFields);
         if ($db_res && ($res = $db_res->GetNext())) {
             $arElement = $res;
         }
         if ($arElement) {
             // check iblock properties
             CSocNetLogTools::AddComment_Review_CheckIBlock($arElement);
             $dbMessage = CForumMessage::GetList(array(), array('PARAM2' => $arElement['ID']));
             if (!($arMessage = $dbMessage->Fetch())) {
                 // Add Topic and Root Message
                 $TOPIC_ID = CSocNetLogTools::AddComment_Review_CreateRoot($arElement, $FORUM_ID, false);
                 $bNewTopic = true;
             } else {
                 $TOPIC_ID = $arMessage['TOPIC_ID'];
             }
             if (intval($TOPIC_ID) > 0) {
                 // Add comment
                 $messageID = false;
                 $arFieldsMessage = array('POST_MESSAGE' => $arFields['TEXT_MESSAGE'], 'USE_SMILES' => 'Y', 'PARAM2' => $arElement['ID']);
                 $messageID = ForumAddMessage('REPLY', $FORUM_ID, $TOPIC_ID, 0, $arFieldsMessage, $sError, $sNote);
                 if (!$messageID) {
                     $strError = GetMessage('SONET_ADD_COMMENT_SOURCE_ERROR');
                 } else {
                     CSocNetLogTools::AddComment_Review_UpdateElement($arElement, $TOPIC_ID, $bNewTopic);
                 }
             } else {
                 $strError = GetMessage('SONET_ADD_COMMENT_SOURCE_ERROR');
             }
         } else {
             $strError = GetMessage('SONET_ADD_COMMENT_SOURCE_ERROR');
         }
     } else {
         $strError = GetMessage('SONET_ADD_COMMENT_SOURCE_ERROR');
     }
     return array('SOURCE_ID' => $messageID, 'RATING_TYPE_ID' => 'FORUM_POST', 'RATING_ENTITY_ID' => $messageID, 'ERROR' => $strError, 'NOTES' => '');
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:67,代码来源:wiki_socnet.php


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