コード例 #1
0
ファイル: event_manager.php プロジェクト: DarneoStudio/bitrix
 public static function updateIBlockProperty($ID, $TYPE, $arMessage, $arTopic = array())
 {
     if ($ID > 0 && $arMessage["PARAM1"] != "IB" && IsModuleInstalled("iblock")) {
         $arTopic = empty($arTopic) ? CForumTopic::GetByID($arMessage["TOPIC_ID"]) : $arTopic;
         if (!empty($arTopic) && $arTopic["XML_ID"] == "IBLOCK_" . $arMessage["PARAM2"] && CModule::IncludeModule("iblock")) {
             CIBlockElement::SetPropertyValuesEx($arMessage["PARAM2"], 0, array("FORUM_MESSAGE_CNT" => array("VALUE" => CForumMessage::GetList(array(), array("TOPIC_ID" => $arMessage["TOPIC_ID"], "APPROVED" => "Y", "!PARAM1" => "IB"), true), "DESCRIPTION" => "")));
         }
     }
 }
コード例 #2
0
ファイル: ufs.php プロジェクト: vim84/b-markt
 function OnPrepareComments()
 {
     $arResult =& $this->component->arResult;
     $arParams =& $this->component->arParams;
     $arMessages =& $arResult['MESSAGES'];
     $arResult['UFS'] = array();
     if (!empty($arMessages) && !empty($arResult["USER_FIELDS"])) {
         $res = array_keys($arMessages);
         $arFilter = array("FORUM_ID" => $arParams["FORUM_ID"], "TOPIC_ID" => $arResult["FORUM_TOPIC_ID"], "APPROVED_AND_MINE" => $GLOBALS["USER"]->GetId(), ">ID" => intVal(min($res)) - 1, "<ID" => intVal(max($res)) + 1);
         if ($arResult["USER"]["RIGHTS"]["MODERATE"] == "Y") {
             unset($arFilter["APPROVED_AND_MINE"]);
         }
         $db_res = CForumMessage::GetList(array("ID" => "ASC"), $arFilter, false, 0, array("SELECT" => array_keys($arResult["USER_FIELDS"])));
         if ($db_res && ($res = $db_res->Fetch())) {
             do {
                 $arResult['UFS'][$res["ID"]] = array_intersect_key($res, $arResult["USER_FIELDS"]);
             } while ($res = $db_res->Fetch());
         }
     }
 }
コード例 #3
0
ファイル: include.php プロジェクト: DarneoStudio/bitrix
function ForumActions($action, $arFields, &$strErrorMessage, &$strOKMessage)
{
    $result = false;
    $sError = "";
    $sNote = "";
    if (empty($action)) {
        $sError = GetMessage("FORUM_NO_ACTION");
    } else {
        switch ($action) {
            case "REPLY":
                $result = ForumAddMessage("REPLY", $arFields["FID"], $arFields["TID"], 0, $arFields, $sError, $sNote, false, $arFields["captcha_word"], 0, $arFields["captcha_code"], $arFields["NAME_TEMPLATE"]);
                break;
            case "DEL":
                $result = ForumDeleteMessage($arFields["MID"], $sError, $sNote, $arFields);
                break;
            case "SHOW":
            case "HIDE":
                $result = ForumModerateMessage($arFields["MID"], $action, $sError, $sNote, $arFields);
                break;
            case "VOTE4USER":
                $result = ForumVote4User($arFields["UID"], $arFields["VOTES"], $arFields["VOTE"], $sError, $sNote, $arFields);
                break;
            case "FORUM_MESSAGE2SUPPORT":
                $result = ForumMoveMessage2Support($arFields["MID"], $sError, $sNote, $arFields);
                break;
            case "FORUM_SUBSCRIBE":
            case "TOPIC_SUBSCRIBE":
            case "FORUM_SUBSCRIBE_TOPICS":
                $result = ForumSubscribeNewMessagesEx($arFields["FID"], $arFields["TID"], $arFields["NEW_TOPIC_ONLY"], $sError, $sNote);
                break;
            case "SET_ORDINARY":
            case "SET_TOP":
            case "ORDINARY":
            case "TOP":
                if ($action == "SET_ORDINARY") {
                    $action = "ORDINARY";
                } elseif ($action == "SET_TOP") {
                    $action = "TOP";
                }
                $result = ForumTopOrdinaryTopic($arFields["TID"], $action, $sError, $sNote, $arFields);
                break;
            case "DEL_TOPIC":
                $result = ForumDeleteTopic($arFields["TID"], $sError, $sNote, $arFields);
                break;
            case "OPEN":
            case "CLOSE":
            case "STATE_Y":
            case "STATE_N":
                if ($action == "STATE_Y") {
                    $action = "OPEN";
                } elseif ($action == "STATE_N") {
                    $action = "CLOSE";
                }
                $result = ForumOpenCloseTopic($arFields["TID"], $action, $sError, $sNote, $arFields);
                break;
            case "SHOW_TOPIC":
            case "HIDE_TOPIC":
                $db_res = CForumMessage::GetList(array(), array("TOPIC_ID" => $arFields["TID"], "APPROVED" => $action == "HIDE_TOPIC" ? "Y" : "N"));
                $message = array();
                if ($db_res && ($res = $db_res->Fetch())) {
                    do {
                        $message[] = $res["ID"];
                    } while ($res = $db_res->Fetch());
                }
                if (!empty($message)) {
                    $s = "";
                    $result = ForumModerateMessage($message, $action == "HIDE_TOPIC" ? "HIDE" : "SHOW", $sError, $s, $arFields);
                } else {
                    $result = true;
                }
                CForumEventLog::Log("topic", $action == "HIDE_TOPIC" ? "unapprove" : "approve", $arFields["TID"], serialize(CForumTopic::GetByID($arFields["TID"])));
                break;
            case "SPAM_TOPIC":
                $result = ForumSpamTopic($arFields["TID"], $sError, $sNote, $arFields);
                break;
            case "SPAM":
                $result = ForumSpamMessage($arFields["MID"], $sError, $sNote, $arFields);
                break;
            default:
                $sError = GetMessage("FORUM_NO_ACTION") . " (" . htmlspecialcharsbx($action) . ")";
                break;
        }
    }
    $strErrorMessage = $sError;
    $strOKMessage = $sNote;
    return $result;
}
コード例 #4
0
ファイル: timeman.php プロジェクト: DarneoStudio/bitrix
     $res["USERS"][$arRes['ID']]["FULL_REPORT_INFO"]["GOOD"] = 0;
     $res["USERS"][$arRes['ID']]["FULL_REPORT_INFO"]["MARKED"] = 0;
     while ($report = $dbres->Fetch()) {
         if ($report["MARK"] != "X") {
             $res["USERS"][$arRes['ID']]["FULL_REPORT_INFO"]["MARKED"]++;
         }
         if ($report["MARK"] == "G") {
             $res["USERS"][$arRes['ID']]["FULL_REPORT_INFO"]["GOOD"]++;
         }
         $res["USERS"][$arRes['ID']]["FULL_REPORT_INFO"]["COUNT"]++;
         $report["DATE_TO"] = MakeTimeStamp($report["DATE_TO"], $datefomat);
         $report["DATE_FROM"] = MakeTimeStamp($report["DATE_FROM"], $datefomat);
         $report["FOR_JS"] = CTimeManReportFull::__getReportJSDraw(array("PERIOD_DATE_FROM" => $_POST["ts"], "REPORT_DATE_FROM" => $report['DATE_FROM'], "REPORT_DATE_TO" => $report['DATE_TO']));
         $report["COMMENTS_COUNT"] = 0;
         if ($report['FORUM_TOPIC_ID'] && CModule::IncludeModule("forum")) {
             $count = CForumMessage::GetList(array("ID" => "ASC"), array("TOPIC_ID" => $report['FORUM_TOPIC_ID']), true);
             $report["COMMENTS_COUNT"] = $count;
         }
         $res["USERS"][$arRes['ID']]["FULL_REPORT"][] = $report;
     }
     if ($arRes['ID'] == $USER->GetID() && !CTimeMan::IsAdmin()) {
         $res["USERS"][$arRes['ID']]["CAN_EDIT_TIME"] = "N";
     } else {
         $res["USERS"][$arRes['ID']]["CAN_EDIT_TIME"] = "Y";
     }
     $tm_user = new CUserReportFull($arRes["ID"]);
     $res["USERS"][$arRes['ID']]["SETTINGS"] = $tm_user->GetSettings(true);
 }
 if (count($arSections) > 0) {
     $arSubordination = CIntranetUtils::GetSubordinateDepartments($USER->GetID(), true);
     $arChains = array();
コード例 #5
0
ファイル: component.php プロジェクト: webgksupport/alpina
// activation rating
CRatingsComponentsMain::GetShowRating($arParams);
$arDefaultUrlTemplates404 = array('index' => 'index.php', 'post' => '#wiki_name#/', 'category' => '#wiki_name#/', 'discussion' => '#wiki_name#/discussion/', 'categories' => 'categories/', 'search' => 'search/', 'post_edit' => '#wiki_name#/edit/', 'history' => '#wiki_name#/history/', 'history_diff' => '#wiki_name#/history/diff/', 'comment' => 'comment/#message_id#/');
$arDefaultVariableAliases404 = array();
$arDefaultVariableAliases = array();
$componentPage = '';
$arComponentVariables = array('wiki_name', 'oper', 'message_id', 'title');
if ($arParams['SEF_MODE'] == 'Y') {
    $arVariables = array();
    $arUrlTemplates = CComponentEngine::MakeComponentUrlTemplates($arDefaultUrlTemplates404, $arParams['SEF_URL_TEMPLATES']);
    $arVariableAliases = CComponentEngine::MakeComponentVariableAliases($arDefaultVariableAliases404, $arParams['VARIABLE_ALIASES']);
    $componentPage = CComponentEngine::ParseComponentPath($arParams['SEF_FOLDER'], $arUrlTemplates, $arVariables);
    //message on like on comment lead here
    if ($componentPage == "comment") {
        CModule::IncludeModule('forum');
        $dbMessage = CForumMessage::GetList(array(), array('ID' => intval($arVariables["message_id"])));
        if ($arMessage = $dbMessage->Fetch()) {
            $elementID = intval($arMessage['PARAM2']);
            if ($elementID > 0) {
                $dbElement = CIBlockElement::GetList(array(), array('ID' => $elementID));
            }
            if ($dbElement && ($arElement = $dbElement->Fetch())) {
                if ($arElement['IBLOCK_ID'] == $arParams['IBLOCK_ID']) {
                    $redirectPath = $arParams['SEF_FOLDER'];
                    $redirectPath .= CComponentEngine::MakePathFromTemplate($arParams["SEF_URL_TEMPLATES"]['post'], array("wiki_name" => rawurlencode($arElement['NAME'])));
                    $redirectPath .= "?MID=" . $arVariables["message_id"] . "#message" . $arVariables["message_id"];
                    LocalRedirect($redirectPath);
                }
            }
        }
    }
コード例 #6
0
ファイル: component.php プロジェクト: ASDAFF/bitrix-5
	if (empty($arError))
	{
		$strErrorMessage = "";
		switch ($action)
		{
			case "DEL":
				ForumDeleteMessageArray($message, $strErrorMessage, $strOKMessage);
			break;
			case "SHOW":
			case "HIDE":
				ForumModerateMessageArray($message, $action, $strErrorMessage, $strOKMessage);
			break;
		}
		if (empty($strErrorMessage))
		{
			$res = CForumMessage::GetList(array("ID" => "ASC"), array("APPROVED" => "N"));
			if ($res <= 0)
				LocalRedirect(CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_LIST"], array("FID" => $arParams["FID"])));
			else
				LocalRedirect($arResult["URL"]["MODERATE_MESSAGE"]);
		}
		else
			$arError[] = array("id" => "bad_action", "text" => $strErrorMessage);
	}
	if (!empty($arError)):
		$e = new CAdminException(array_reverse($arError));
		$GLOBALS["APPLICATION"]->ThrowException($e);
		$err = $GLOBALS['APPLICATION']->GetException();
		$arResult["ERROR_MESSAGE"] .= $err->GetString();
	endif;
	$arResult["OK_MESSAGE"] = $strOKMessage;
コード例 #7
0
ファイル: wiki_socnet.php プロジェクト: rasuldev/torino
 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');
     }
     return array('SOURCE_ID' => $messageID, 'RATING_TYPE_ID' => 'FORUM_POST', 'RATING_ENTITY_ID' => $messageID, 'ERROR' => $strError, 'NOTES' => '', "UF" => array("FILE" => $ufFileID, "DOC" => $ufDocID));
 }
コード例 #8
0
ファイル: topic.php プロジェクト: k-kalashnikov/geekcon_new
 function GetMessageCount($forumID, $topicID, $approved = null)
 {
     global $CACHE_MANAGER;
     static $arCacheCount = array();
     static $obCache = null;
     static $cacheLabel = 'forum_msg_count';
     static $notCached = 0;
     static $TTL = 3600000;
     if ($approved === true) {
         $approved = "Y";
     }
     if ($approved === false) {
         $approved = "N";
     }
     if ($approved === null) {
         $approved = "A";
     }
     if ($approved !== "Y" && $approved !== "N" && $approved !== "A") {
         return false;
     }
     if (isset($arCacheCount[$forumID][$topicID][$approved])) {
         return $arCacheCount[$forumID][$topicID][$approved];
     }
     if ($obCache === null) {
         $obCache = new CPHPCache();
     }
     $cacheID = md5($cacheLabel . $forumID);
     $cachePath = str_replace(array(":", "//"), "/", "/" . SITE_ID . "/" . $cacheLabel . "/");
     if ($obCache->InitCache($TTL, $cacheID, $cachePath)) {
         $resCache = $obCache->GetVars();
         if (is_array($resCache['messages'])) {
             $arCacheCount[$forumID] = $resCache['messages'];
         }
     }
     if (isset($arCacheCount[$forumID][$topicID][$approved])) {
         return $arCacheCount[$forumID][$topicID][$approved];
     } else {
         $bCount = true;
         if ($approved === "N" || $approved === "Y") {
             $bCount = "cnt_not_approved";
         }
         if (intval($topicID) > 0 || $topicID === 0) {
             $arFilter = array("TOPIC_ID" => $topicID);
         } else {
             $arRes = CForumTopic::GetByID($topicID);
             if ($arRes) {
                 $arFilter = array("TOPIC_ID" => $arRes['ID']);
             } else {
                 return false;
             }
         }
         $count = CForumMessage::GetList(null, $arFilter, $bCount);
         $result = 0;
         if ($approved === "N") {
             $result = intval($count['CNT_NOT_APPROVED']);
         } elseif ($approved === "Y") {
             $result = $count['CNT'] - $count['CNT_NOT_APPROVED'];
         } else {
             $result = intval($count);
         }
         $notCached++;
     }
     $arCacheCount[$forumID][$topicID][$approved] = $result;
     if ($notCached > 2) {
         $obCache->StartDataCache($TTL, $cacheID, $cachePath);
         CForumCacheManager::SetTag($cachePath, $cacheLabel . $forumID);
         $obCache->EndDataCache(array("messages" => $arCacheCount[$forumID]));
         $notCached = 0;
     }
     return $result;
 }
コード例 #9
0
ファイル: forum_new.php プロジェクト: DarneoStudio/bitrix
 function SetStat($ID = 0, $arParams = array())
 {
     global $DB;
     $ID = intVal($ID);
     if ($ID <= 0) {
         return false;
     }
     $arParams = is_array($arParams) ? $arParams : array();
     $arMessage = is_array($arParams["MESSAGE"]) ? $arParams["MESSAGE"] : array();
     if ($arMessage["FORUM_ID"] != $ID) {
         $arMessage = array();
     }
     $arForum = CForumNew::GetByID($ID);
     $arParams["ACTION"] = $arParams["ACTION"] == "DECREMENT" || $arParams["ACTION"] == "UPDATE" ? $arParams["ACTION"] : "INCREMENT";
     $arParams["POSTS"] = intVal($arParams["POSTS"] > 0 ? $arParams["POSTS"] : 1);
     $arFields = array();
     if (empty($arMessage)) {
         // full recount
     } elseif ($arParams["ACTION"] == "INCREMENT") {
         if ($arMessage["ID"] > $arForum["ABS_LAST_MESSAGE_ID"]) {
             $arFields["ABS_LAST_POSTER_ID"] = intVal($arMessage["AUTHOR_ID"]) > 0 ? $arMessage["AUTHOR_ID"] : false;
             $arFields["ABS_LAST_POSTER_NAME"] = $arMessage["AUTHOR_NAME"];
             $arFields["ABS_LAST_POST_DATE"] = $arMessage["POST_DATE"];
             $arFields["ABS_LAST_MESSAGE_ID"] = $arMessage["ID"];
             if ($arMessage["APPROVED"] == "Y") {
                 $arFields["LAST_POSTER_ID"] = $arFields["ABS_LAST_POSTER_ID"];
                 $arFields["LAST_POSTER_NAME"] = $arFields["ABS_LAST_POSTER_NAME"];
                 $arFields["LAST_POST_DATE"] = $arFields["ABS_LAST_POST_DATE"];
                 $arFields["LAST_MESSAGE_ID"] = $arFields["ABS_LAST_MESSAGE_ID"];
             }
         }
         if ($arMessage["APPROVED"] == "Y") {
             $arFields["=POSTS"] = "POSTS+1";
             if ($arMessage["NEW_TOPIC"] == "Y") {
                 $arFields["=TOPICS"] = "TOPICS+1";
             }
         } else {
             $arFields["=POSTS_UNAPPROVED"] = "POSTS_UNAPPROVED+1";
         }
     } elseif ($arMessage["ID"] > $arForum["ABS_LAST_MESSAGE_ID"]) {
         // full recount
     } elseif ($arParams["ACTION"] == "DECREMENT" && ($arMessage["ID"] == $arForum["ABS_LAST_MESSAGE_ID"] || $arMessage["ID"] == $arForum["LAST_MESSAGE_ID"])) {
         // full recount
     } elseif ($arParams["ACTION"] == "DECREMENT") {
         if ($arMessage["APPROVED"] == "Y") {
             $arFields["=POSTS"] = "POSTS-1";
             if ($arMessage["NEW_TOPIC"] == "Y") {
                 $arFields["=TOPICS"] = "TOPICS-1";
             }
         } else {
             $arFields["=POSTS_UNAPPROVED"] = "POSTS_UNAPPROVED-1";
         }
     } elseif ($arParams["ACTION"] == "UPDATE") {
         if ($arMessage["APPROVED"] == "Y") {
             if ($arMessage["ID"] > $arForum["LAST_MESSAGE_ID"]) {
                 $arFields["LAST_POSTER_ID"] = intVal($arMessage["AUTHOR_ID"]) > 0 ? $arMessage["AUTHOR_ID"] : false;
                 $arFields["LAST_POSTER_NAME"] = $arMessage["AUTHOR_NAME"];
                 $arFields["LAST_POST_DATE"] = $arMessage["POST_DATE"];
                 $arFields["LAST_MESSAGE_ID"] = $arMessage["ID"];
             }
             $arFields["=POSTS"] = "POSTS+1";
             $arFields["=POSTS_UNAPPROVED"] = "POSTS_UNAPPROVED-1";
             if ($arMessage["NEW_TOPIC"] == "Y") {
                 $arFields["=TOPICS"] = "TOPICS+1";
             }
         } elseif ($arMessage["ID"] != $arForum["LAST_MESSAGE_ID"]) {
             $arFields["=POSTS"] = "POSTS-1";
             $arFields["=POSTS_UNAPPROVED"] = "POSTS_UNAPPROVED+1";
             if ($arMessage["NEW_TOPIC"] == "Y") {
                 $arFields["=TOPICS"] = "TOPICS-1";
             }
         }
     }
     if (empty($arFields)) {
         $res = CForumMessage::GetList(array(), array("FORUM_ID" => $ID), "cnt_not_approved");
         $res = is_array($res) ? $res : array();
         $res["CNT"] = intVal($res["CNT"]) - intVal($res["CNT_NOT_APPROVED"]);
         $res["CNT"] = $res["CNT"] > 0 ? $res["CNT"] : 0;
         $arFields = array("TOPICS" => CForumTopic::GetList(array(), array("FORUM_ID" => $ID, "APPROVED" => "Y"), true), "POSTS" => $res["CNT"], "LAST_POSTER_ID" => false, "LAST_POSTER_NAME" => false, "LAST_POST_DATE" => false, "LAST_MESSAGE_ID" => intVal($res["LAST_MESSAGE_ID"]), "POSTS_UNAPPROVED" => intVal($res["CNT_NOT_APPROVED"]), "ABS_LAST_POSTER_ID" => false, "ABS_LAST_POSTER_NAME" => false, "ABS_LAST_POST_DATE" => false, "ABS_LAST_MESSAGE_ID" => intVal($res["ABS_LAST_MESSAGE_ID"]));
         if ($arFields["ABS_LAST_MESSAGE_ID"] > 0) {
             $res = CForumMessage::GetByID($arFields["ABS_LAST_MESSAGE_ID"], array("FILTER" => "N"));
             $arFields["ABS_LAST_POSTER_ID"] = intVal($res["AUTHOR_ID"]) > 0 ? $res["AUTHOR_ID"] : false;
             $arFields["ABS_LAST_POSTER_NAME"] = $res["AUTHOR_NAME"];
             $arFields["ABS_LAST_POST_DATE"] = $res["POST_DATE"];
             if (intVal($arFields["LAST_MESSAGE_ID"]) > 0) {
                 if ($arFields["LAST_MESSAGE_ID"] < $arFields["ABS_LAST_MESSAGE_ID"]) {
                     $res = CForumMessage::GetByID($arFields["LAST_MESSAGE_ID"], array("FILTER" => "N"));
                 }
                 $arFields["LAST_POSTER_ID"] = intVal($res["AUTHOR_ID"]) > 0 ? $res["AUTHOR_ID"] : false;
                 $arFields["LAST_POSTER_NAME"] = $res["AUTHOR_NAME"];
                 $arFields["LAST_POST_DATE"] = $res["POST_DATE"];
             }
         }
     }
     if (!CForumNew::CheckFields("UPDATE", $arFields)) {
         return false;
     }
     $strUpdate = $DB->PrepareUpdate("b_forum", $arFields);
     if (!empty($arFields)) {
         $res = array();
         foreach ($arFields as $key => $val) {
             if (substr($key, 0, 1) == "=") {
                 $key = substr($key, 1);
                 if (!empty($key)) {
                     $res[] = $key . "=" . (empty($val) ? $key . "+1" : $val);
                 }
             }
         }
         if (!empty($res)) {
             $strUpdate = empty($strUpdate) ? "" : $strUpdate . ",";
             $strUpdate .= implode(", ", $res);
         }
     }
     if (empty($strUpdate)) {
         return false;
     }
     $strSql = "UPDATE b_forum SET " . $strUpdate . " WHERE ID=" . $ID;
     return $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
 }
コード例 #10
0
ファイル: message.php プロジェクト: andy-profi/bxApiDocs
 public static function QueryFirstUnread($arFilter)
 {
     $db_res = CForumMessage::GetList(array("ID" => "ASC"), $arFilter, false, 1);
     return $db_res;
 }
コード例 #11
0
ファイル: component.php プロジェクト: Satariall/izurit
 } while ($res = $db_res->Fetch());
 switch ($ACTION) {
     case "SET_TOP":
     case "SET_ORDINARY":
     case "TOP":
     case "ORDINARY":
         $ACTION = $ACTION == "SET_ORDINARY" ? "ORDINARY" : ($ACTION == "SET_TOP" ? "TOP" : $ACTION);
         $sort = $ACTION == "TOP" ? "150" : "100";
         $result = ForumTopOrdinaryTopic($arTopic, $ACTION, $strErrorMessage, $strOkMessage, array("PERMISSION" => $arParams["PERMISSION"]));
         break;
     case "DEL_TOPIC":
     case "DELETE":
         $arLogID = array();
         foreach ($arTopic as $topic_id_tmp) {
             // delete message log records
             $dbForumMessage = CForumMessage::GetList(array("ID" => "ASC"), array("TOPIC_ID" => $topic_id_tmp));
             while ($arForumMessage = $dbForumMessage->Fetch()) {
                 $dbRes = CSocNetLog::GetList(array("ID" => "DESC"), array("EVENT_ID" => "forum", "SOURCE_ID" => $arForumMessage["ID"]), false, false, array("ID", "PARAMS"));
                 while ($arRes = $dbRes->Fetch()) {
                     $arLogID[] = $arRes["ID"];
                 }
             }
         }
         $result = ForumDeleteTopic($arTopic, $strErrorMessage, $strOkMessage, array("PERMISSION" => $arParams["PERMISSION"]));
         if ($result) {
             foreach ($arLogID as $log_id) {
                 CSocNetLog::Delete($log_id);
             }
         }
         break;
     case "STATE_Y":
コード例 #12
0
 /**
  * Checking forum comment for spam - part 1 - checking itself
  * @param &array Comment fields to check
  * @return null|boolean NULL when success or FALSE when spam detected
  */
 function OnBeforeMessageAddHandler(&$arFields)
 {
     // works
     global $APPLICATION, $USER;
     $ct_status = COption::GetOptionString('cleantalk.antispam', 'status', '0');
     $ct_comment_forum = COption::GetOptionString('cleantalk.antispam', 'form_comment_forum', '0');
     if ($ct_status == 1 && $ct_comment_forum == 1) {
         if ($USER->IsAdmin()) {
             return;
         }
         // Skip authorized user with more than 5 approved messages
         if ($USER->IsAuthorized()) {
             $approved_messages = CForumMessage::GetList(array('ID' => 'ASC'), array('AUTHOR_ID' => $arFields['AUTHOR_ID'], 'APPROVED' => 'Y'), TRUE);
             if (intval($approved_messages) > 5) {
                 return;
             }
         }
         $aComment = array();
         $aComment['type'] = 'comment';
         $aComment['sender_email'] = isset($arFields['AUTHOR_EMAIL']) ? $arFields['AUTHOR_EMAIL'] : '';
         $aComment['sender_nickname'] = isset($arFields['AUTHOR_NAME']) ? $arFields['AUTHOR_NAME'] : '';
         $aComment['message_title'] = '';
         $aComment['message_body'] = isset($arFields['POST_MESSAGE']) ? $arFields['POST_MESSAGE'] : '';
         $aComment['example_title'] = '';
         $aComment['example_body'] = '';
         $aComment['example_comments'] = '';
         if (COption::GetOptionString('cleantalk.antispam', 'form_send_example', '0') == 1) {
             $arTopic = CForumTopic::GetByID($arFields['TOPIC_ID']);
             if (is_array($arTopic)) {
                 $aComment['example_title'] = $arTopic['TITLE'];
                 // Messages contains both topic bodies and comment bodies
                 // First find topic body
                 $db_res = CForumMessage::GetList(array('ID' => 'ASC'), array('TOPIC_ID' => $arFields['TOPIC_ID'], 'NEW_TOPIC' => 'Y', 'APPROVED' => 'Y'), FALSE, 1);
                 $ar_res = $db_res->Fetch();
                 if ($ar_res) {
                     $aComment['example_body'] = $ar_res['POST_MESSAGE'];
                 }
                 // Second find last 10 approved comment bodies
                 $comments = array();
                 $db_res = CForumMessage::GetList(array('POST_DATE' => 'DESC'), array('TOPIC_ID' => $arFields['TOPIC_ID'], 'NEW_TOPIC' => 'N', 'APPROVED' => 'Y'), FALSE, 10);
                 while ($ar_res = $db_res->Fetch()) {
                     $aComment['example_comments'] .= $ar_res['POST_MESSAGE'] . "\n\n";
                 }
             }
         }
         $aResult = self::CheckAllBefore($aComment, TRUE);
         if (isset($aResult) && is_array($aResult)) {
             if ($aResult['errno'] == 0) {
                 if ($aResult['allow'] == 1) {
                     // Not spammer - just return;
                     return;
                 } else {
                     if ($aResult['stop_queue'] == 1) {
                         // Spammer and stop_queue - return false and throw
                         if (preg_match('//u', $aResult['ct_result_comment'])) {
                             $err_str = preg_replace('/^[^\\*]*?\\*\\*\\*|\\*\\*\\*[^\\*]*?$/iu', '', $aResult['ct_result_comment']);
                             $err_str = preg_replace('/<[^<>]*>/iu', '', $err_str);
                         } else {
                             $err_str = preg_replace('/^[^\\*]*?\\*\\*\\*|\\*\\*\\*[^\\*]*?$/i', '', $aResult['ct_result_comment']);
                             $err_str = preg_replace('/<[^<>]*>/i', '', $err_str);
                         }
                         $APPLICATION->ThrowException($err_str);
                         return FALSE;
                     } else {
                         // Spammer and NOT stop_queue - to manual approvement
                         // It works!
                         $arFields['APPROVED'] = 'N';
                         return;
                     }
                 }
             }
         }
     }
 }
コード例 #13
0
ファイル: component.php プロジェクト: ASDAFF/bitrix-5
	"~RSS_DEFAULT" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_RSS"], array("TYPE" => "rss2", "MODE" => "topic", "IID" => $arParams["TID"])),
	"RSS_DEFAULT" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_RSS"], array("TYPE" => "rss2", "MODE" => "topic", "IID" => $arParams["TID"])));

$arResult["ERROR_MESSAGE"] = $strErrorMessage;
$arResult["OK_MESSAGE"] = $strOKMessage;
$arResult["PARSER"] = $parser;
$arResult["FILES"] = array();
$arResult["MESSAGE_FILES"] = array();
/************** Message List ***************************************/
$arAllow = forumTextParser::GetFeatures($arResult["FORUM"]);

// LAST MESSAGE
$arResult["TOPIC"]["iLAST_TOPIC_MESSAGE"] = 0;
if ($arResult["USER"]["RIGHTS"]["EDIT"] != "Y" && $USER->IsAuthorized() && COption::GetOptionString("forum", "USER_EDIT_OWN_POST", "N") != "Y"):
	if ($arResult["FORUM"]["MODERATION"] == "Y"):
		$db_res = CForumMessage::GetList(array("ID" => "DESC"), array("TOPIC_ID" => $arParams["TID"], "APPROVED" => "N",
			">ID" => $arResult["TOPIC"]["LAST_MESSAGE_ID"]), false, 1);
		if ($db_res && $res = $db_res->Fetch()):
			$arResult["TOPIC"]["iLAST_TOPIC_MESSAGE"] = intVal($res["ID"]);
		endif;
	endif;
	if ($arResult["TOPIC"]["iLAST_TOPIC_MESSAGE"] <= 0):
		$arResult["TOPIC"]["iLAST_TOPIC_MESSAGE"] = $arResult["TOPIC"]["LAST_MESSAGE_ID"];
	endif;
endif;
// NUMBER CURRENT PAGE
$iNumPage = ($arParams["MID"] > 0 ? CForumMessage::GetMessagePage($arParams["MID"], $arParams["MESSAGES_PER_PAGE"], $arUserGroups, $arParams["TID"]) : 0);
// Create filter and additional fields for message select
$arFilter = array("TOPIC_ID" => $arParams["TID"]);
if ($arResult["USER"]["RIGHTS"]["MODERATE"] != "Y") {$arFilter["APPROVED"] = "Y";}
if ($USER->IsAuthorized()) {$arFilter["POINTS_TO_AUTHOR_ID"] = $USER->GetID();}
/*******************************************************************/
コード例 #14
0
ファイル: log_tools.php プロジェクト: Satariall/izurit
 function GetDataFromRatingEntity($rating_entity_type_id, $rating_entity_id, $bCheckRights = true)
 {
     $rating_entity_type_id = preg_replace("/[^a-z0-9_-]/i", "", $rating_entity_type_id);
     $rating_entity_id = intval($rating_entity_id);
     if (strlen($rating_entity_type_id) <= 0) {
         return false;
     }
     if ($rating_entity_id <= 0) {
         return false;
     }
     switch ($rating_entity_type_id) {
         case "BLOG_POST":
             $log_type = "log";
             $log_event_id = array("blog_post", "blog_post_important");
             break;
         case "BLOG_COMMENT":
             $log_type = "comment";
             $log_event_id = array("blog_comment", "photo_comment");
             break;
         case "FORUM_TOPIC":
             $log_type = "log";
             $log_event_id = array("forum");
             if (CModule::IncludeModule("forum")) {
                 $dbForumMessage = CForumMessage::GetList(array("ID" => "ASC"), array("TOPIC_ID" => $rating_entity_id), false, 1);
                 if ($arForumMessage = $dbForumMessage->Fetch()) {
                     $rating_entity_id = $arForumMessage["ID"];
                 }
             }
             break;
         case "FORUM_POST":
             $log_type = "comment";
             $log_event_id = array("forum", "photo_comment", "files_comment", "commondocs_comment", "tasks_comment", "wiki_comment", "news_comment", "lists_new_element_comment");
             break;
         case "IBLOCK_ELEMENT":
             $log_type = "log";
             $log_event_id = array("photo_photo", "files", "commondocs", "wiki");
             break;
         case "INTRANET_NEW_USER":
             $log_type = "log";
             $log_event_id = array("intranet_new_user");
             break;
         case "INTRANET_NEW_USER_COMMENT":
             $log_type = "comment";
             $log_event_id = array("intranet_new_user_comment");
             break;
         case "BITRIX24_NEW_USER":
             $log_type = "log";
             $log_event_id = array("bitrix24_new_user");
             break;
         case "BITRIX24_NEW_USER_COMMENT":
             $log_type = "comment";
             $log_event_id = array("bitrix24_new_user_comment");
             break;
         case "VOTING":
             $log_type = "log";
             $log_event_id = array("blog_post", "blog_post_important");
             if (CModule::IncludeModule("blog")) {
                 $rsBlogPost = CBlogPost::GetList(array("ID" => "DESC"), array("UF_BLOG_POST_VOTE" => $rating_entity_id), false, array("nTopCount" => 1), array("ID"));
                 if ($arBlogPost = $rsBlogPost->Fetch()) {
                     $rating_entity_id = $arBlogPost["ID"];
                 }
             }
             break;
         case "LISTS_NEW_ELEMENT":
             $log_type = "log";
             $log_event_id = array("lists_new_element");
             break;
         case "LOG_ENTRY":
             $log_type = "log_entry";
             break;
         case "LOG_COMMENT":
             $log_type = "log_comment";
             break;
         default:
     }
     if ($log_type == "log") {
         $rsLogSrc = CSocNetLog::GetList(array(), array("EVENT_ID" => $log_event_id, "SOURCE_ID" => $rating_entity_id), false, false, array("ID"), array("CHECK_RIGHTS" => $bCheckRights ? "Y" : "N", "USE_SUBSCRIBE" => "N"));
         if ($arLogSrc = $rsLogSrc->Fetch()) {
             $log_id = $arLogSrc["ID"];
         }
     } elseif ($log_type == "log_entry") {
         $rsLogSrc = CSocNetLog::GetList(array(), array("ID" => $rating_entity_id), false, false, array("ID"), array("CHECK_RIGHTS" => $bCheckRights ? "Y" : "N", "USE_SUBSCRIBE" => "N"));
         if ($arLogSrc = $rsLogSrc->Fetch()) {
             $log_id = $arLogSrc["ID"];
         }
     } elseif ($log_type == "comment") {
         $rsLogCommentSrc = CSocNetLogComments::GetList(array(), array("EVENT_ID" => $log_event_id, "SOURCE_ID" => $rating_entity_id), false, false, array("ID", "LOG_ID"), array("CHECK_RIGHTS" => $bCheckRights ? "Y" : "N", "USE_SUBSCRIBE" => "N"));
         if ($arLogCommentSrc = $rsLogCommentSrc->Fetch()) {
             $log_id = $arLogCommentSrc["LOG_ID"];
             $log_comment_id = $arLogCommentSrc["ID"];
         }
     } elseif ($log_type == "log_comment") {
         $rsLogCommentSrc = CSocNetLogComments::GetList(array(), array("ID" => $rating_entity_id), false, false, array("ID", "LOG_ID"), array("CHECK_RIGHTS" => $bCheckRights ? "Y" : "N", "USE_SUBSCRIBE" => "N"));
         if ($arLogCommentSrc = $rsLogCommentSrc->Fetch()) {
             $log_id = $arLogCommentSrc["LOG_ID"];
             $log_comment_id = $arLogCommentSrc["ID"];
         }
     }
     if ($log_id > 0) {
         $arResult = array("LOG_ID" => $log_id);
         if ($log_comment_id > 0) {
             $arResult["LOG_COMMENT_ID"] = $log_comment_id;
         }
         return $arResult;
     } else {
         return false;
     }
 }
コード例 #15
0
ファイル: include.php プロジェクト: mrdeadmouse/u136006
 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");
     }
     return array("SOURCE_ID" => $messageID, "RATING_TYPE_ID" => "FORUM_POST", "RATING_ENTITY_ID" => $messageID, "ERROR" => $strError, "NOTES" => "");
 }
コード例 #16
0
ファイル: user.php プロジェクト: rasuldev/torino
 public static function SetStat($USER_ID = 0, $arParams = array())
 {
     $USER_ID = intVal($USER_ID);
     if ($USER_ID <= 0) {
         return 0;
     }
     $bNeedCreateUser = false;
     $arUser = array();
     $arUserFields = array();
     $arParams = is_array($arParams) ? $arParams : array();
     $arMessage = is_array($arParams["MESSAGE"]) ? $arParams["MESSAGE"] : array();
     $arMessage = $arMessage["AUTHOR_ID"] != $USER_ID ? array() : $arMessage;
     if (!empty($arMessage)) {
         $arParams["ACTION"] = $arParams["ACTION"] == "DECREMENT" || $arParams["ACTION"] == "UPDATE" ? $arParams["ACTION"] : "INCREMENT";
         if ($arParams["ACTION"] == "UPDATE") {
             $arParams["ACTION"] = $arMessage["APPROVED"] == "Y" ? "INCREMENT" : "DECREMENT";
             $arMessage["APPROVED"] = "Y";
         }
         $arParams["POSTS"] = intVal($arParams["POSTS"] > 0 ? $arParams["POSTS"] : 1);
         $arUser = CForumUser::GetByUSER_ID($USER_ID);
     }
     if (empty($arMessage)) {
         // full recount;
     } elseif ($arMessage["APPROVED"] != "Y") {
         return true;
     } elseif (empty($arUser)) {
         $bNeedCreateUser = true;
         // full recount;
     } elseif ($arParams["ACTION"] == "DECREMENT" && $arMessage["ID"] >= $arUser["LAST_POST"]) {
         // full recount;
     } elseif ($arParams["ACTION"] == "DECREMENT") {
         $arUserFields = array("=NUM_POSTS" => "NUM_POSTS-" . $arParams["POSTS"], "POINTS" => intVal(CForumUser::GetUserPoints($USER_ID, array("DECREMENT" => $arParams["POSTS"]))));
     } elseif ($arParams["ACTION"] == "INCREMENT" && $arMessage["ID"] < $arUser["LAST_POST"]) {
         $arUserFields = array("=NUM_POSTS" => "NUM_POSTS+" . $arParams["POSTS"], "POINTS" => intVal(CForumUser::GetUserPoints($USER_ID, array("INCREMENT" => $arParams["POSTS"]))));
     } elseif ($arParams["ACTION"] == "INCREMENT") {
         $arUserFields["IP_ADDRESS"] = $arMessage["AUTHOR_IP"];
         $arUserFields["REAL_IP_ADDRESS"] = $arMessage["AUTHOR_REAL_IP"];
         $arUserFields["LAST_POST"] = intVal($arMessage["ID"]);
         $arUserFields["LAST_POST_DATE"] = $arMessage["POST_DATE"];
         $arUserFields["=NUM_POSTS"] = "NUM_POSTS+" . $arParams["POSTS"];
         $arUserFields["POINTS"] = intVal(CForumUser::GetUserPoints($USER_ID, array("INCREMENT" => $arParams["POSTS"])));
     }
     if (empty($arUserFields)) {
         $arUserFields = array("LAST_POST" => false, "LAST_POST_DATE" => false);
         if ($bNeedCreateUser == false) {
             $arUser = CForumUser::GetByUSER_IDEx($USER_ID);
         }
         if (empty($arUser) || $bNeedCreateUser == true) {
             $bNeedCreateUser = true;
             $arUser = CForumMessage::GetList(array(), array("AUTHOR_ID" => $USER_ID, "APPROVED" => "Y"), "cnt_and_last_mid");
             $arUser = is_array($arUser) ? $arUser : array();
         }
         $arMessage = CForumMessage::GetByID($arUser["LAST_MESSAGE_ID"], array("FILTER" => "N"));
         if ($arMessage) {
             $arUserFields["IP_ADDRESS"] = $arMessage["AUTHOR_IP"];
             $arUserFields["REAL_IP_ADDRESS"] = $arMessage["AUTHOR_REAL_IP"];
             $arUserFields["LAST_POST"] = intVal($arMessage["ID"]);
             $arUserFields["LAST_POST_DATE"] = $arMessage["POST_DATE"];
         }
         $arUserFields["NUM_POSTS"] = intVal($arUser["CNT"]);
         $arUserFields["POINTS"] = intVal(CForumUser::GetUserPoints($USER_ID, array("NUM_POSTS" => $arUserFields["NUM_POSTS"])));
     }
     if ($bNeedCreateUser) {
         $arUserFields["USER_ID"] = $USER_ID;
         $arUser = CForumUser::Add($arUserFields);
     } else {
         CForumUser::Update($USER_ID, $arUserFields, false, true);
     }
     return $USER_ID;
 }
コード例 #17
0
ファイル: webdav.php プロジェクト: k-kalashnikov/geekcon_new
     $componentPage = str_replace("_short", "", $componentPage);
 } elseif ($componentPage == "user_files_element_history_get" || $componentPage == "group_files_element_history_get") {
     $APPLICATION->RestartBuffer();
     $ob->SendHistoryFile($arResult["VARIABLES"]["element_id"], 0, false, $_REQUEST);
     die;
 } elseif ($componentPage == "user_files_webdav_bizproc_history_get" || $componentPage == "group_files_webdav_bizproc_history_get") {
     $APPLICATION->RestartBuffer();
     $ob->SendHistoryFile($arResult["VARIABLES"]["element_id"], $arResult["VARIABLES"]["id"]);
     die;
 } elseif (($componentPage == "user_files_section_edit" || $componentPage == "group_files_section_edit") && strToUpper($_REQUEST["use_light_view"]) == "Y") {
     $componentPage .= "_simple";
 } elseif ($componentPage == "user_files_element_comment" || $componentPage == "group_files_element_comment") {
     $topicID = intval($arResult["VARIABLES"]['topic_id']);
     $messageID = intval($arResult["VARIABLES"]['message_id']);
     if ($topicID > 0 && $messageID > 0 && CModule::IncludeModule('forum')) {
         $dbMessage = CForumMessage::GetList(array(), array('FORUM_ID' => $arParams['FILES_FORUM_ID'], 'TOPIC_ID' => $topicID, 'NEW_TOPIC' => 'Y', 'PARAM1' => 'IB'));
         if ($dbMessage && ($arMessage = $dbMessage->Fetch())) {
             $elementID = intval($arMessage['PARAM2']);
             if ($elementID > 0) {
                 // check if this iblock
                 $dbElement = CIBlockElement::GetList(array(), array('ID' => $elementID), false, false, array('IBLOCK_ID'));
                 if ($dbElement && ($arElement = $dbElement->Fetch()) && $arElement['IBLOCK_ID'] == $arParams['IBLOCK_ID']) {
                     $elementUrl = '';
                     if (is_array($arResult['USER']) && isset($arResult['USER']['ID'])) {
                         $elementUrl = str_replace("#user_id#", $arResult['USER']['ID'], $arResult['PATH_TO_USER_FILES_ELEMENT']);
                     } elseif (is_array($arResult['GROUP']) && isset($arResult['GROUP']['ID'])) {
                         $elementUrl = str_replace("#group_id#", $arResult['GROUP']['ID'], $arResult['PATH_TO_GROUP_FILES_ELEMENT']);
                     }
                     if (!empty($elementUrl)) {
                         $arParams["FORM_ID"] = "webdavForm" . $arParams["IBLOCK_ID"];
                         $elementUrl = str_replace('#element_id#', $elementID, $elementUrl);
コード例 #18
0
ファイル: log_tools_photo.php プロジェクト: rasuldev/torino
 public static function AddComment_Photo_Forum($arFields, $FORUM_ID, $arLog)
 {
     if (!CModule::IncludeModule("forum")) {
         return false;
     }
     if (!CModule::IncludeModule("iblock")) {
         return false;
     }
     $ufFileID = array();
     $ufDocID = array();
     $arElement = false;
     $arFilteredText = array();
     $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_Forum($arElement);
         $dbMessage = CForumMessage::GetList(array(), array("PARAM2" => $arElement["ID"]));
         if (!($arMessage = $dbMessage->Fetch())) {
             // Add Topic
             $TOPIC_ID = CSocNetLogTools::AddComment_Review_CreateRoot_Forum($arElement, $FORUM_ID);
             $bNewTopic = true;
         } else {
             $TOPIC_ID = $arMessage["TOPIC_ID"];
         }
         if (intval($TOPIC_ID) > 0) {
             if (COption::GetOptionString("forum", "FILTER", "Y") == "Y") {
                 $arFields["TEXT_MESSAGE"] = $arFilteredText["TEXT_MESSAGE"] = CFilterUnquotableWords::Filter($arFields["TEXT_MESSAGE"]);
                 $arFilteredText["MESSAGE"] = CFilterUnquotableWords::Filter($arFields["MESSAGE"]);
             }
             // 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 {
                 // get UF DOC value and FILE_ID there
                 $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_Forum($arElement, $TOPIC_ID, $bNewTopic);
             }
         } else {
             $strError = GetMessage("SONET_ADD_COMMENT_SOURCE_ERROR");
         }
     } else {
         $strError = GetMessage("SONET_ADD_COMMENT_SOURCE_ERROR");
     }
     return array_merge($arFilteredText, array("SOURCE_ID" => $messageID, "RATING_TYPE_ID" => "FORUM_POST", "RATING_ENTITY_ID" => $messageID, "ERROR" => $strError, "NOTES" => "", "UF" => array("FILE" => $ufFileID, "DOC" => $ufDocID), "IM_MESSAGE" => $messageID ? $arFields["TEXT_MESSAGE"] : false));
 }
コード例 #19
0
ファイル: component.php プロジェクト: vim84/b-markt
        } while ($res = $db_files->Fetch());
        $bNeedLoop = false;
        if ($bNeedFirstMessage && !$bBreakLoop) {
            $db_files = CForumFiles::GetList(array("MESSAGE_ID" => "ASC"), array("MESSAGE_ID" => $arResult["MESSAGE_FIRST"]["ID"]));
            if ($db_files && ($res = $db_files->Fetch())) {
                $bNeedLoop = $bBreakLoop = true;
            }
        }
    }
    if (!empty($arParams["USER_FIELDS"])) {
        $db_props = CForumMessage::GetList(array("ID" => "ASC"), $arFilterProps, false, 0, array("SELECT" => $arParams["USER_FIELDS"]));
        while ($db_props && ($res = $db_props->Fetch())) {
            $arResult["MESSAGE_LIST"][$res["ID"]]["PROPS"] = array_intersect_key($res, array_flip($arParams["USER_FIELDS"]));
        }
        if ($bNeedFirstMessage) {
            $db_props = CForumMessage::GetList(array("ID" => "ASC"), array("ID" => $arResult["MESSAGE_FIRST"]["ID"]), false, 0, array("SELECT" => $arParams["USER_FIELDS"]));
            if ($db_props && ($res = $db_props->Fetch())) {
                $arResult["MESSAGE_FIRST"]["PROPS"] = array_intersect_key($res, array_flip($arParams["USER_FIELDS"]));
            }
        }
    }
}
$parser->arFiles = $arResult["FILES"];
if (!empty($arResult["MESSAGE_FIRST"])) {
    $parser->arUserfields = $arResult["MESSAGE_FIRST"]["PROPS"];
    $arResult["MESSAGE_FIRST"]["POST_MESSAGE_TEXT"] = $parser->convert($arResult["MESSAGE_FIRST"]["~POST_MESSAGE_TEXT"], $arResult["MESSAGE_FIRST"]["ALLOW"]);
    $arResult["MESSAGE_FIRST"]["FILES_PARSED"] = $parser->arFilesIDParsed;
}
foreach ($arResult["MESSAGE_LIST"] as $iID => $res) {
    $parser->arUserfields = $res["PROPS"];
    $arResult["MESSAGE_LIST"][$iID]["POST_MESSAGE_TEXT"] = $parser->convert($res["~POST_MESSAGE_TEXT"], $res["ALLOW"]);
コード例 #20
0
ファイル: message.php プロジェクト: ASDAFF/entask.ru
	function QueryFirstUnread($arFilter) // out-of-date function
	{
		$db_res = CForumMessage::GetList(array("ID"=>"ASC"), $arFilter, false, 1);
		return $db_res;
	}
コード例 #21
0
 function SocnetEMailMessageAdd($arMessageFields, $ACTION_VARS)
 {
     if (!is_array($arMessageFields["FORUM_EMAIL_FILTER"])) {
         return false;
     }
     if (!CModule::IncludeModule("socialnetwork")) {
         return false;
     }
     $arParams = $arMessageFields["FORUM_EMAIL_FILTER"];
     if (!CSocNetFeatures::IsActiveFeature(SONET_ENTITY_GROUP, $arParams["SOCNET_GROUP_ID"], "forum")) {
         return false;
     }
     // Найдем кто отправитель
     $message_email = strlen($arMessageFields["FIELD_REPLY_TO"]) > 0 ? $arMessageFields["FIELD_REPLY_TO"] : $arMessageFields["FIELD_FROM"];
     $message_email_addr = strtolower(CMailUtil::ExtractMailAddress($message_email));
     $o = "LAST_LOGIN";
     $b = "DESC";
     $res = CUser::GetList($o, $b, array("ACTIVE" => "Y", "EMAIL" => $message_email_addr));
     if (($arUser = $res->Fetch()) && strtolower(CMailUtil::ExtractMailAddress($arUser["EMAIL"])) == $message_email_addr) {
         $AUTHOR_USER_ID = $arUser["ID"];
     } elseif ($arParams["NOT_MEMBER_POST"] == "Y") {
         $AUTHOR_USER_ID = false;
     } else {
         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_ERROR1") . ": " . $message_email_addr));
         return false;
     }
     if ($arParams["NOT_MEMBER_POST"] != "Y") {
         // Проверим права доступа
         if (CSocNetFeaturesPerms::CanPerformOperation($AUTHOR_USER_ID, SONET_ENTITY_GROUP, $arParams["SOCNET_GROUP_ID"], "forum", "full")) {
             $PERMISSION = "Y";
         } elseif (CSocNetFeaturesPerms::CanPerformOperation($AUTHOR_USER_ID, SONET_ENTITY_GROUP, $arParams["SOCNET_GROUP_ID"], "forum", "newtopic")) {
             $PERMISSION = "M";
         } elseif (CSocNetFeaturesPerms::CanPerformOperation($AUTHOR_USER_ID, SONET_ENTITY_GROUP, $arParams["SOCNET_GROUP_ID"], "forum", "answer")) {
             $PERMISSION = "I";
         } else {
             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_ERROR2") . " " . $arUser["LOGIN"] . " [" . $AUTHOR_USER_ID . "] (" . $message_email_addr . ")"));
             return false;
         }
     }
     $body = $arMessageFields["BODY"];
     //$body = preg_replace("/(\r\n)+/", "\r\n", $body);
     $p = strpos($body, "\r\nFrom:");
     if ($p > 0) {
         $body = substr($body, 0, $p) . "\r\n[CUT]" . substr($body, $p) . "[/CUT]";
     }
     $subject = $arMessageFields["SUBJECT"];
     // обрежем все RE и FW
     $subject = trim(preg_replace('#^\\s*((RE[0-9\\[\\]]*:\\s*)|(FW:\\s*))+(.*)$#i', '\\4', $subject));
     if ($subject == '') {
         $subject = GetMessage("FORUM_MAIL_EMPTY_TOPIC_TITLE") . " " . rand();
     }
     // Найдем какая тема
     $arFields = array();
     $FORUM_ID = IntVal($arParams["FORUM_ID"]);
     $SOCNET_GROUP_ID = IntVal($arParams["SOCNET_GROUP_ID"]);
     $TOPIC_ID = 0;
     global $DB;
     if ($arMessageFields["IN_REPLY_TO"] != '') {
         $dbTopic = $DB->Query("SELECT FT.ID FROM b_forum_topic FT INNER JOIN b_forum_message FM ON FM.TOPIC_ID=FT.ID WHERE FM.XML_ID='" . $DB->ForSQL($arMessageFields["IN_REPLY_TO"], 255) . "' AND FT.FORUM_ID=" . $FORUM_ID . " AND FT.SOCNET_GROUP_ID=" . $SOCNET_GROUP_ID);
         if ($arTopic = $dbTopic->Fetch()) {
             $TOPIC_ID = $arTopic["ID"];
         }
     }
     if ($arParams["USE_SUBJECT"] == "Y" && $TOPIC_ID <= 0) {
         $dbTopic = $DB->Query("SELECT ID FROM b_forum_topic WHERE TITLE='" . $DB->ForSQL($subject, 255) . "' AND FORUM_ID=" . $FORUM_ID . " AND SOCNET_GROUP_ID=" . $SOCNET_GROUP_ID);
         // ограничить по старости?
         if ($arTopic = $dbTopic->Fetch()) {
             $TOPIC_ID = $arTopic["ID"];
         }
     }
     if ($AUTHOR_USER_ID > 0) {
         if ($TOPIC_ID < 0 && $PERMISSION <= "I") {
             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_ERROR3") . " " . $arUser["LOGIN"] . " [" . $AUTHOR_USER_ID . "] (" . $message_email_addr . ")"));
             return false;
         }
         $bSHOW_NAME = true;
         $res = CForumUser::GetByUSER_ID($AUTHOR_USER_ID);
         if ($res) {
             $bSHOW_NAME = $res["SHOW_NAME"] == "Y";
         }
         if ($bSHOW_NAME) {
             $AUTHOR_NAME = $arUser["NAME"] . (strlen($arUser["NAME"]) <= 0 || strlen($arUser["LAST_NAME"]) <= 0 ? "" : " ") . $arUser["LAST_NAME"];
         }
         if (strlen(Trim($AUTHOR_NAME)) <= 0) {
             $AUTHOR_NAME = $arUser["LOGIN"];
         }
     } else {
         $AUTHOR_NAME = $arMessageFields["FIELD_FROM"];
         $arFields["AUTHOR_EMAIL"] = $arMessageFields["FIELD_FROM"];
     }
     $arFields["NEW_TOPIC"] = "N";
     if ($PERMISSION >= "Q") {
         $arFields["APPROVED"] = "Y";
     } else {
         $arFields["APPROVED"] = $arParams["MODERATION"] == "Y" ? "N" : "Y";
     }
     // Добавим новую тему
     if ($TOPIC_ID <= 0) {
         $arTopicFields = array("TITLE" => $subject, "FORUM_ID" => $FORUM_ID, "USER_START_ID" => $AUTHOR_USER_ID, "OWNER_ID" => $AUTHOR_USER_ID, "SOCNET_GROUP_ID" => $SOCNET_GROUP_ID);
         $arTopicFields["XML_ID"] = $arMessageFields["MSG_ID"];
         $arTopicFields["APPROVED"] = $arFields['APPROVED'];
         $arTopicFields["USER_START_NAME"] = $AUTHOR_NAME;
         $arTopicFields["LAST_POSTER_NAME"] = $AUTHOR_NAME;
         $TOPIC_ID = CForumTopic::Add($arTopicFields);
         if (IntVal($TOPIC_ID) <= 0) {
             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_ERROR4")));
             return false;
         }
         $arFields["NEW_TOPIC"] = "Y";
     }
     // Добавим сообщение
     $arFields["POST_MESSAGE"] = $body;
     // Аттаченные файлы
     $arFILES = array();
     $rsAttach = CMailAttachment::GetList(array(), array("MESSAGE_ID" => $arMessageFields["ID"]));
     while ($arAttach = $rsAttach->Fetch()) {
         $filename = CTempFile::GetFileName(md5(uniqid("")) . ".tmp");
         CheckDirPath($filename);
         if (file_put_contents($filename, $arAttach["FILE_DATA"]) !== false) {
             $arFile = array("name" => $arAttach["FILE_NAME"], "type" => $arAttach["CONTENT_TYPE"], "size" => @filesize($filename), "tmp_name" => $filename, "MODULE_ID" => "forum");
             $arFilter = array("FORUM_ID" => $FORUM_ID);
             $arFiles = array($arFile);
             if (CForumFiles::CheckFields($arFiles, $arFilter)) {
                 $arFILES[] = $arFiles[0];
             } else {
                 $oError = $GLOBALS["APPLICATION"]->GetException();
                 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_ERROR6") . " (" . $arAttach["FILE_NAME"] . "): " . ($oError && $oError->GetString() ? $oError->GetString() : "")));
             }
         }
     }
     if (count($arFILES) > 0) {
         $arFields["FILES"] = $arFILES;
     }
     $arFields["AUTHOR_NAME"] = $AUTHOR_NAME;
     $arFields["AUTHOR_ID"] = $AUTHOR_USER_ID;
     $arFields["FORUM_ID"] = $FORUM_ID;
     $arFields["TOPIC_ID"] = $TOPIC_ID;
     $arFields["XML_ID"] = $arMessageFields["MSG_ID"];
     $arFields["SOURCE_ID"] = "EMAIL";
     $arRes = array();
     if (!empty($arMessageFields["FIELD_FROM"])) {
         $arRes[] = "From: " . $arMessageFields["FIELD_FROM"];
     }
     if (!empty($arMessageFields["FIELD_TO"])) {
         $arRes[] = "To: " . $arMessageFields["FIELD_TO"];
     }
     if (!empty($arMessageFields["FIELD_CC"])) {
         $arRes[] = "Cc: " . $arMessageFields["FIELD_CC"];
     }
     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);
                 }
             }
         }
     }
 }
コード例 #22
0
ファイル: message.php プロジェクト: mrdeadmouse/u136006
 /**
  * @param $arFilter - array("FORUM_ID" => 241, "TOPIC_ID" => 82383, "APPROVED" => "Y")
  * @param $rights - string(1) (A|R|U|W);
  */
 public static function setWebdavRights($arFilter, $rights)
 {
     if (IsModuleInstalled("webdav")) {
         $arFilter = is_array($arFilter) ? $arFilter : array($arFilter);
         $arFilter[">UF_FORUM_MESSAGE_DOC"] = 0;
         $db_res = CForumMessage::GetList(array("ID" => "ASC"), $arFilter, false, 0, array("SELECT" => array("UF_FORUM_MESSAGE_DOC")));
         $arDocs = array();
         if ($db_res && ($res = $db_res->Fetch())) {
             do {
                 if (!empty($res["UF_FORUM_MESSAGE_DOC"]) && is_array($res["UF_FORUM_MESSAGE_DOC"])) {
                     $arDocs = array_merge($arDocs, $res["UF_FORUM_MESSAGE_DOC"]);
                 }
             } while ($res = $db_res->Fetch());
         }
         if (!empty($arDocs) && CModule::IncludeModule("webdav")) {
             CWebDavIblock::appendRightsOnElements($arDocs, $rights);
         }
     }
 }
コード例 #23
0
ファイル: component.php プロジェクト: akniyev/arteva.ru
					$res["SRC"] = CFile::GetFileSRC($res);
					if ($arMessages[$res["MESSAGE_ID"]]["~ATTACH_IMG"] == $res["FILE_ID"])
					{
					// attach for custom
						$arMessages[$res["MESSAGE_ID"]]["~ATTACH_FILE"] = $res;
						$arMessages[$res["MESSAGE_ID"]]["ATTACH_IMG"] = CFile::ShowFile($res["FILE_ID"], 0,
							$arParams["IMAGE_SIZE"], $arParams["IMAGE_SIZE"], true, "border=0", false);
						$arMessages[$res["MESSAGE_ID"]]["ATTACH_FILE"] = $arMessages[$res["MESSAGE_ID"]]["ATTACH_IMG"];
					}
					$arMessages[$res["MESSAGE_ID"]]["FILES"][$res["FILE_ID"]] = $res;
					$arResult["FILES"][$res["FILE_ID"]] = $res;
				}while ($res = $db_files->Fetch());
			}
			if (!empty($arParams["USER_FIELDS"]))
			{
				$db_props = CForumMessage::GetList(array("ID" => "ASC"), $arFilterProps, false, 0, array("SELECT" => $arParams["USER_FIELDS"]));
				while ($db_props && ($res = $db_props->Fetch()))
				{
					$arMessages[$res["ID"]]["PROPS"] = array_intersect_key($res, array_flip($arParams["USER_FIELDS"]));
				}
			}
			/************** Message info ***************************************/
			$parser->arFiles = $arResult["FILES"];
			foreach ($arMessages as $iID => $res)
				$arMessages[$iID]["POST_MESSAGE_TEXT"] = $parser->convert($res["~POST_MESSAGE_TEXT"], array_merge($res["ALLOW"], array("USERFIELDS" => $res["PROPS"])));
		}

/************** Message List/***************************************/
		if ($arParams["CACHE_TIME"] > 0)
		{
			$cache->StartDataCache();
コード例 #24
0
ファイル: component.php プロジェクト: Satariall/izurit
            $arResult["MESSAGE_VIEW"]["FILES_PARSED"] = $parser->arFilesIDParsed;
            if ($arParams['AUTOSAVE']) {
                $arParams['AUTOSAVE']->Reset();
            }
        }
    }
    if (!empty($strErrorMessage)) {
        $arResult["ERROR_MESSAGE"] = $strErrorMessage;
        $bVarsFromForm = true;
    }
}
/************** Show message for ajax ******************************/
if ($arResult["SHOW_MESSAGE_FOR_AJAX"] == "Y") {
    $APPLICATION->RestartBuffer();
    if (empty($arResult["MESSAGE"])) {
        $db_res = CForumMessage::GetList(array(), array("ID" => $MID1));
        if ($db_res && ($res = $db_res->GetNext())) {
            $arResult["MESSAGE"] = $res;
        }
    }
    if (!empty($arResult["MESSAGE"])) {
        $arResult["MESSAGE"]["FILES"] = array();
        $db_res = CForumFiles::GetList(array(), array("MESSAGE_ID" => $arResult["MESSAGE"]["ID"]));
        if ($db_res && ($res = $db_res->GetNext())) {
            do {
                $res["SRC"] = CFile::GetFileSRC($res);
                $arResult["MESSAGE"]["FILES"][$res["FILE_ID"]] = $res;
            } while ($res = $db_res->GetNext());
        }
        $res = $arResult["MESSAGE"];
        $res["POST_MESSAGE_TEXT"] = COption::GetOptionString("forum", "FILTER", "Y") == "Y" ? $res["~POST_MESSAGE_FILTER"] : $res["~POST_MESSAGE"];
コード例 #25
0
<?php

if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) {
    die;
}
//http://jabber.bx/view.php?id=25340
$arComponentVariables = array('message_id', 'group_id', 'wiki_name');
if ($arParams['SEF_MODE'] != 'Y') {
    return;
}
if (!CModule::IncludeModule('forum')) {
    return;
}
$dbMessage = CForumMessage::GetList(array(), array('ID' => intval($arResult['VARIABLES']['message_id'])));
if (!$dbMessage || !($arMessage = $dbMessage->Fetch())) {
    return;
}
$elementID = intval($arMessage['PARAM2']);
if ($elementID <= 0) {
    return;
}
$dbElement = CIBlockElement::GetList(array(), array('ID' => $elementID), false, false, array("IBLOCK_SECTION_ID", "IBLOCK_ID", "NAME"));
if (!$dbElement || !($arElement = $dbElement->Fetch()) || !($arElement['IBLOCK_ID'] == COption::GetOptionString('wiki', 'socnet_iblock_id'))) {
    return;
}
$ibSectionID = $arElement['IBLOCK_SECTION_ID'];
do {
    $dbIBSection = CIBlockSection::GetList(array(), array('ID' => $ibSectionID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('IBLOCK_SECTION_ID', 'SOCNET_GROUP_ID'));
    if (!$dbIBSection || !($arIBSection = $dbIBSection->Fetch())) {
        break;
    }
コード例 #26
0
ファイル: event_manager.php プロジェクト: spas-viktor/books
 public static function updateIBlockProperty($ID, $TYPE, $arMessage)
 {
     if ($ID > 0 && $arMessage["PARAM1"] != "IB" && !empty($arMessage["PARAM2"]) && CModule::IncludeModule("iblock")) {
         CIBlockElement::SetPropertyValuesEx($arMessage["PARAM2"], 0, array("FORUM_MESSAGE_CNT" => array("VALUE" => CForumMessage::GetList(array(), array("TOPIC_ID" => $arMessage["TOPIC_ID"], "APPROVED" => "Y", "!PARAM1" => "IB"), true), "DESCRIPTION" => "")));
     }
 }
コード例 #27
0
ファイル: action.php プロジェクト: rasuldev/torino
             $mid = intVal($message);
             if (is_array($message)) {
                 sort($message);
                 $mid = array_pop($message);
             }
             $arFilter = array("TOPIC_ID" => $arParams["TID"], ">ID" => $mid);
             if ($arResult["PERMISSION"] < "Q") {
                 $arFilter["APPROVED"] = "Y";
             }
             $db_res = CForumMessage::GetList(array("ID" => "ASC"), $arFilter, false, 1);
             if ($db_res && ($res = $db_res->Fetch())) {
                 $mid = $res["ID"];
             } else {
                 unset($arFilter[">ID"]);
                 $arFilter["<ID"] = $mid;
                 $db_res = CForumMessage::GetList(array("ID" => "DESC"), $arFilter, false, 1);
                 if ($db_res && ($res = $db_res->Fetch())) {
                     $mid = $res["ID"];
                 }
             }
             $mid = intVal($mid) > 0 ? $mid : "s";
             $url = str_replace("#MID#", $mid, $url);
         }
     } elseif ($action == "VOTE4USER") {
         $result = true;
     } elseif ($action == "REPLY") {
         $arParams["MID"] = intVal($result);
     }
     $url = str_replace("#result#", $result, $url);
 } else {
     $result = true;
コード例 #28
0
								<?php 
                }
                ?>
							</td>
						</tr>
						<?php 
            }
            $currentGroupID = IntVal($ar_Forum["FORUM_GROUP_ID"]);
        }
        ?>
<tr class="forumbody"><?php 
        if ($perm >= "Q") {
            $GlobPerm = true;
            ?>
<td align="center" class="forumbodytext" valign="top">&nbsp;<?php 
            $mCnt = CForumMessage::GetList(array(), array("FORUM_ID" => $ar_Forum["ID"], "APPROVED" => "N"), true);
            if ($mCnt > 0) {
                ?>
<a href="appr_message.php?FID=<?php 
                echo $ar_Forum["ID"];
                ?>
" title="<?php 
                echo GetMessage("FL_MESSAGE_NOT_APPROVED");
                ?>
">(<?php 
                echo $mCnt;
                ?>
)</a><?php 
            }
            ?>
</td><?php 
コード例 #29
0
ファイル: forumimporter.php プロジェクト: ASDAFF/mp
	public static function import()
	{
		// include required modules
		if (!CModule::IncludeModule('forum'))
		{
			return false;
		}
		$moduleId = 'prmedia.treelikecomments';

		// retrieve or init session storage
		$sessionStorage = $_SESSION['tlc_import'];
		if ($_REQUEST['start'] == 'Y')
		{
			// get total count of comments
			$rsMessage = CForumMessage::GetList();
			$rsMessage->NavStart();
			$totalCount = $rsMessage->NavRecordCount;

			$sessionStorage = array(
				'processing_time' => time(),
				'current_count' => 0,
				'actual_count' => 0,
				'total_count' => $totalCount,
				'comment_id' => 1,
				'allow_smiles' => COption::GetOptionString($moduleId, 'smiles_enable') == 1 ? true : false,
				'allow_bb' => COption::GetOptionString($moduleId, 'bb_code_enable') == 1 ? true : false
			);
		}


		// import comments...
		$obComment = new CTreelikeComments;
		$is_finish = true;
		$currentTime = time();
		$arOrder = array(
			'ID' => 'ASC'
		);
		$arFilter = array(
			'>ID' => $sessionStorage['comment_id']
		);
		$rsMessage = CForumMessage::GetList($arOrder, $arFilter);
		while ($arMessage = $rsMessage->Fetch())
		{
			$is_finish = false;
			$sessionStorage['current_count']++;
			$sessionStorage['comment_id'] = $arMessage['ID'];

			$comment = $arMessage['POST_MESSAGE'];
			if ($sessionStorage['allow_smiles'])
			{
				$comment = CTreelikeForumImporter::setSmiles($comment);
			}
			if ($sessionStorage['allow_bb'])
			{
				$comment = CTreelikeForumImporter::setBB($comment);
			}


			$arFields = array(
				'REMOTE_ADDR' => $arMessage['AUTHOR_REAL_IP'],
				'AUTHOR_NAME' => $arMessage['AUTHOR_NAME'],
				'USER_ID' => $arMessage['AUTHOR_ID'],
				'OBJECT_ID' => $arMessage['PARAM2'],
				'COMMENT' => $comment,
				'DATE' => CDatabase::FormatDate($arMessage['POST_DATE'], "DD.MM.YYYY HH:MI:SS", "YYYY-MM-DD HH:MI:SS"),
				'ACTIVATED' => $arMessage['APPROVED'] == 'Y' ? 1 : 0
			);

			// counter
			if (!empty($arFields['USER_ID']))
			{
				$elementId = $obComment->Add($arFields);
				if (!empty($elementId))
				{
					if (empty($sessionStorage['first_element']))
					{
						$sessionStorage['first_element'] = $elementId;
					}
					$sessionStorage['actual_count']++;
					CTreelikeForumImporter::addImportedComment($elementId);
				}
			}

			// one step is one second
			if ($currentTime != time())
			{
				break;
			}
		}


		if ($is_finish)
		{
			// go to finish step
			echo '<script>document.getElementsByClassName("wizard-next-button")[0].click();</script>';
			CTreelikeForumImporter::clearCache();
			return;
		}

		// progress message
		$text = GetMessage('PRMEDIA_WIZARDS_IMPORT_FORUM_PROGRESS_MESSAGE');
		$arReplace = array(
			"#IMPORTED#" => $sessionStorage['current_count'],
			"#COUNT#" => $sessionStorage['total_count'],
			"#TIME#" => gmdate("i:s", time() - $sessionStorage['processing_time'])
		);
		$progressMessage = str_replace(array_keys($arReplace), $arReplace, $text);
		CAdminMessage::ShowMessage(array(
			"TYPE" => "PROGRESS",
			"MESSAGE" => GetMessage('PRMEDIA_SS_DIST_PROGRESS_TITLE'),
			"DETAILS" => $progressMessage,
			"HTML" => true,
			"PROGRESS_VALUE" => $sessionStorage['current_count'],
			"PROGRESS_TOTAL" => $sessionStorage['total_count']
		));
		echo "<script>jsPrmediaCommentImporter.update();</script>";

		$_SESSION['tlc_import'] = $sessionStorage;
	}
コード例 #30
0
     while ($res = $db_topics->Fetch()) {
         $arTopic_posts[$res["TOPIC_ID"]] = $res["COUNT_MESSAGE"];
         $arForum_posts[$res["FORUM_ID"]] += intVal($res["COUNT_MESSAGE"]);
         $arTopics_info[$res["TOPIC_ID"]] = $res;
         $arTopics_info[$res["TOPIC_ID"]]["ID"] = $res["TOPIC_ID"];
         $strPerms = ForumCurrUserPermissions($res["FORUM_ID"]);
         $FilterMess[] = $strPerms < "Q" ? array("TOPIC_ID" => $res["TOPIC_ID"], "APPROVED" => "Y") : array("TOPIC_ID" => $res["TOPIC_ID"]);
         $arTopics_info[$res["TOPIC_ID"]]["USER_PERM_DELETE"] = $strPerms < "U" ? false : true;
     }
 }
 //Message
 // ќбщий список сообщений 1 запрос
 $main = array();
 $dbMessage = false;
 if (count($FilterMess) > 0) {
     $dbMessage = CForumMessage::GetList(array("FORUM_ID" => "ASC", "TOPIC_ID" => "ASC"), array("AUTHOR_ID" => $UID, "PERMISSION" => $FilterMess));
     $dbMessage->NavStart($PAGE_ELEMENTS, false);
     if ($dbMessage) {
         $arMessage = array();
         $arTopic = array();
         $arForum = array();
         // User right`s
         $arUserGroup = CUser::GetUserGroup($UID);
         if (!in_array(2, $arUserGroup)) {
             $arUserGroup[] = 2;
         }
         while ($arMessage = $dbMessage->Fetch()) {
             if ($arForum["ID"] != $arMessage["FORUM_ID"]) {
                 // »нформаци¤ о форуме 1 запрос
                 $arForum = CForumNew::GetByIDEx($arMessage["FORUM_ID"]);
                 $arForum["NUM_POSTS_ALL"] = $arForum_posts[$arForum["ID"]];