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


PHP CForumTopic::GetList方法代码示例

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


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

示例1: AddComment_Calendar

 public static function AddComment_Calendar($arFields)
 {
     global $DB;
     if (!CModule::IncludeModule("forum")) {
         return false;
     }
     $ufFileID = array();
     $ufDocID = array();
     $dbResult = CSocNetLog::GetList(array(), array("ID" => $arFields["LOG_ID"]), false, false, array("ID", "SOURCE_ID", "SITE_ID"));
     if ($arLog = $dbResult->Fetch()) {
         $arCalendarEvent = CCalendarEvent::GetById($arLog["SOURCE_ID"]);
         if ($arCalendarEvent) {
             $arCalendarSettings = CCalendar::GetSettings();
             $forumID = $arCalendarSettings["forum_id"];
             if ($forumID) {
                 $arFilter = array("FORUM_ID" => $forumID, "XML_ID" => "EVENT_" . $arLog["SOURCE_ID"]);
                 $dbTopic = CForumTopic::GetList(null, $arFilter);
                 if ($dbTopic && ($arTopic = $dbTopic->Fetch())) {
                     $topicID = $arTopic["ID"];
                 } else {
                     $topicID = 0;
                 }
                 $currentUserId = CCalendar::GetCurUserId();
                 $strPermission = $currentUserId == $arCalendarEvent["OWNER_ID"] ? "Y" : "M";
                 $arFieldsMessage = array("POST_MESSAGE" => $arFields["TEXT_MESSAGE"], "USE_SMILES" => "Y", "PERMISSION_EXTERNAL" => "Q", "PERMISSION" => $strPermission, "APPROVED" => "Y");
                 if ($topicID === 0) {
                     $arFieldsMessage["TITLE"] = "EVENT_" . $arLog["SOURCE_ID"];
                     $arFieldsMessage["TOPIC_XML_ID"] = "EVENT_" . $arLog["SOURCE_ID"];
                 }
                 $arTmp = false;
                 $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($topicID > 0 ? "REPLY" : "NEW", $forumID, $topicID, 0, $arFieldsMessage, $sError, $sNote);
                 // get UF DOC value and FILE_ID there
                 if ($messageID > 0) {
                     $messageUrl = CCalendar::GetPath("user", $arCalendarEvent["OWNER_ID"]);
                     $messageUrl = $messageUrl . (strpos($messageUrl, "?") === false ? "?" : "&") . "EVENT_ID=" . $arCalendarEvent["ID"] . "&MID=" . $messageID;
                     $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);
                 }
             }
         }
     }
     if (!$messageID) {
         $sError = GetMessage("EC_LF_ADD_COMMENT_SOURCE_ERROR");
     }
     return array("SOURCE_ID" => $messageID, "MESSAGE" => $arFieldsMessage ? $arFieldsMessage["POST_MESSAGE"] : false, "RATING_TYPE_ID" => "FORUM_POST", "RATING_ENTITY_ID" => $messageID, "ERROR" => $sError, "NOTES" => $sNote, "UF" => array("FILE" => $ufFileID, "DOC" => $ufDocID), "URL" => $messageUrl);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:60,代码来源:calendar_livefeed.php

示例2: setTopic

 protected function setTopic()
 {
     if (!array_key_exists($this->entity->getXmlId(), self::$topics)) {
         $dbRes = \CForumTopic::GetList(null, array("FORUM_ID" => $this->forum["ID"], "XML_ID" => $this->entity->getXmlId()));
         self::$topics[$this->entity->getXmlId()] = ($res = $dbRes->Fetch()) && $res ? $res : null;
     }
     $this->topic = self::$topics[$this->entity->getXmlId()];
     return $this;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:9,代码来源:baseobject.php

示例3: substr

             $res["SITE_URL"] = substr($res["SITE_URL"], 0, strpos($res["SITE_URL"], "#message"));
         }
         $res["TAGS"] = array();
         if (!empty($res["~TAGS_FORMATED"])) {
             foreach ($res["~TAGS_FORMATED"] as $name => $tag) {
                 $tags = $tag;
                 $res["TAGS"][] = array("URL" => $APPLICATION->GetCurPageParam("tags=" . urlencode($tags), array("tags")), "TAG_NAME" => htmlspecialcharsbx($name));
             }
         }
         $topics[$res["PARAM2"]] = !!$topics[$res["PARAM2"]] ? $topics[$res["PARAM2"]] : array();
         $topics[$res["PARAM2"]][] = count($arResult["TOPICS"]);
         $arResult["TOPICS"][] = $res;
     } while ($res = $obSearch->GetNext());
 }
 if (strpos($arParams["URL_TEMPLATES_READ"], "#TITLE_SEO#") !== false && !empty($topics)) {
     $db_res2 = CForumTopic::GetList(array(), array("@ID" => array_keys($topics)));
     while ($db_res2 && ($res2 = $db_res2->Fetch())) {
         if (array_key_exists($res2["ID"], $topics)) {
             foreach ($topics[$res2["ID"]] as $key) {
                 $res = $arResult["TOPICS"][$key];
                 if (intVal($res["ITEM_ID"]) > 0) {
                     $res["URL"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE"], array("FID" => $res["PARAM1"], "TID" => $res["PARAM2"], "TITLE_SEO" => $res2["TITLE_SEO"], "MID" => $res["ITEM_ID"]));
                     $res["~URL"] = CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_MESSAGE"], array("FID" => $res["PARAM1"], "TID" => $res["PARAM2"], "TITLE_SEO" => $res2["TITLE_SEO"], "MID" => $res["ITEM_ID"]));
                 } else {
                     $res["URL"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_READ"], array("FID" => $res["PARAM1"], "TID" => $res["PARAM2"], "TITLE_SEO" => $res2["TITLE_SEO"], "MID" => "s"));
                     $res["~URL"] = CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_READ"], array("FID" => $res["PARAM1"], "TID" => $res["PARAM2"], "TITLE_SEO" => $res2["TITLE_SEO"], "MID" => "s"));
                 }
                 $arResult["TOPICS"][$key] = $res;
             }
         }
     }
开发者ID:rasuldev,项目名称:torino,代码行数:31,代码来源:component.php

示例4: array

        $arResult["MESSAGE"] = $res;
        $arParams["TID"] = $res["TOPIC_INFO"]["ID"];
        if ($res["APPROVED"] != "Y" && $arParams["PERMISSION"] < "Q") {
            $arNote[] = array("id" => "mid is not approved", "text" => GetMessage("F_MID_IS_NOT_APPROVED"));
        }
    }
}
/************** Topic **********************************************/
$arFilter = array("ID" => $arParams["TID"], "SOCNET_GROUP_ID" => false);
if ($arParams["MODE"] == "GROUP") {
    $arFilter["SOCNET_GROUP_ID"] = $arParams["SOCNET_GROUP_ID"];
} else {
    $arFilter["OWNER_ID"] = $arParams["USER_ID"];
    $arFilter["FORUM_ID"] = $arParams["FID"];
}
$db_res = CForumTopic::GetList(array(), $arFilter);
if (!($db_res && ($res = $db_res->GetNext()))) {
    $res = CForumTopic::GetByID($arParams["TID"]);
    if (empty($res) || !is_array($res)) {
        $arError[] = array("id" => "topic is not found", "text" => GetMessage("F_TID_IS_LOST"));
    } elseif ($arParams["MODE"] == "GROUP" && $res["SOCNET_GROUP_ID"] != $arParams["SOCNET_GROUP_ID"] || $arParams["MODE"] != "GROUP" && $res["OWNER_ID"] != $arParams["USER_ID"]) {
        $arError[] = array("id" => "not correct socnet_object", "text" => str_replace("#SOCNET_OBJECT#", $arParams["MODE"] == "GROUP" ? GetMessage("F_GROUPS") : GetMessage("F_USERS"), GetMessage("F_TID_IS_LOST_IN_OBJECT")));
    } elseif ($res["FORUM_ID"] != $arParams["FID"]) {
        $arError[] = array("id" => "not correct forum_id", "text" => GetMessage("F_TID_IS_LOST_IN_FORUM"));
    }
} elseif ($res["STATE"] == "L") {
    $arError[] = array("id" => "topic is topic-link", "text" => GetMessage("F_TID_IS_LINK"));
} elseif ($res["APPROVED"] != "Y" && $arParams["PERMISSION"] < "Q") {
    $arError[] = array("id" => "topic is not approved", "text" => GetMessage("F_TID_IS_NOT_APPROVED"));
} else {
    $arResult["TOPIC"] = $res;
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:component.php

示例5: addCommentLists

 public static function addCommentLists($fields)
 {
     if (!CModule::IncludeModule('forum') || !CModule::IncludeModule('bizproc')) {
         return false;
     }
     $ufFileId = array();
     $ufDocId = array();
     $fieldsMessage = array();
     $messageId = array();
     $error = array();
     $note = array();
     $sonetLogQuery = CSocNetLog::GetList(array(), array('ID' => $fields['LOG_ID']), false, false, array('ID', 'SOURCE_ID', 'SITE_ID', 'MESSAGE', 'USER_ID'));
     if ($sonetLog = $sonetLogQuery->fetch()) {
         $users = CBPTaskService::getWorkflowParticipants($sonetLog['MESSAGE'], CBPTaskUserStatus::Waiting);
         if (preg_match_all("/(?<=\\[USER=)(?P<id>[0-9]+)(?=\\])/", $fields['TEXT_MESSAGE'], $matches)) {
             $users = array_unique(array_merge($users, $matches['id']));
         }
         $users[] = $sonetLog['USER_ID'];
         self::setSocnetFollow($users, $sonetLog['ID'], 'Y', false, true);
         $forumId = CBPHelper::getForumId();
         if ($forumId) {
             $topicQuery = CForumTopic::GetList(array(), array('FORUM_ID' => $forumId, 'XML_ID' => 'WF_' . $sonetLog['MESSAGE']));
             if ($topicQuery && ($topic = $topicQuery->fetch())) {
                 $topicId = $topic['ID'];
             } else {
                 $arTopic = array('AUTHOR_ID' => 0, 'TITLE' => 'WF_' . $sonetLog['MESSAGE'], 'TAGS' => '', 'MESSAGE' => 'WF_' . $sonetLog['MESSAGE'], 'XML_ID' => 'WF_' . $sonetLog['MESSAGE']);
                 $arUserStart = array("ID" => $arTopic["AUTHOR_ID"], "NAME" => $GLOBALS["FORUM_STATUS_NAME"]["guest"]);
                 $GLOBALS["DB"]->StartTransaction();
                 $arTopicFields = array("TITLE" => $arTopic["TITLE"], "TAGS" => $arTopic["TAGS"], "FORUM_ID" => $forumId, "USER_START_ID" => $arUserStart["ID"], "USER_START_NAME" => $arUserStart["NAME"], "LAST_POSTER_NAME" => $arUserStart["NAME"], "XML_ID" => $arTopic["XML_ID"], "APPROVED" => "Y", "PERMISSION_EXTERNAL" => 'Q', "PERMISSION" => 'Y');
                 $topicId = CForumTopic::Add($arTopicFields);
                 if (intval($topicId) > 0) {
                     $arTopic['MESSAGE'] = strip_tags($arTopic['MESSAGE']);
                     $arFields = array("POST_MESSAGE" => $arTopic['MESSAGE'], "AUTHOR_ID" => $arUserStart["ID"], "AUTHOR_NAME" => $arUserStart["NAME"], "FORUM_ID" => $forumId, "TOPIC_ID" => $topicId, "APPROVED" => "Y", "NEW_TOPIC" => "Y", "PARAM1" => "WF", "PARAM2" => 0, "PERMISSION_EXTERNAL" => 'Q', "PERMISSION" => 'Y');
                     $startMessageId = CForumMessage::Add($arFields, false, array("SKIP_INDEXING" => "Y", "SKIP_STATISTIC" => "N"));
                     if (intVal($startMessageId) <= 0) {
                         CForumTopic::Delete($topicId);
                         $topicId = 0;
                     }
                 }
                 if (intval($topicId) <= 0) {
                     $GLOBALS["DB"]->Rollback();
                 } else {
                     $GLOBALS["DB"]->Commit();
                 }
             }
             if ($topicId) {
                 $fieldsMessage = array('POST_MESSAGE' => $fields['TEXT_MESSAGE'], 'USE_SMILES' => 'Y', 'PERMISSION_EXTERNAL' => 'Q', 'PERMISSION' => 'Y', 'APPROVED' => 'Y');
                 $tmp = false;
                 $GLOBALS['USER_FIELD_MANAGER']->editFormAddFields('SONET_COMMENT', $tmp);
                 if (is_array($tmp)) {
                     if (array_key_exists('UF_SONET_COM_DOC', $tmp)) {
                         $GLOBALS['UF_FORUM_MESSAGE_DOC'] = $tmp['UF_SONET_COM_DOC'];
                     } elseif (array_key_exists('UF_SONET_COM_FILE', $tmp)) {
                         $fieldsMessage['FILES'] = array();
                         foreach ($tmp['UF_SONET_COM_FILE'] as $fileId) {
                             $fieldsMessage['FILES'][] = array('FILE_ID' => $fileId);
                         }
                     }
                     if (array_key_exists("UF_SONET_COM_URL_PRV", $tmp)) {
                         $GLOBALS["UF_FORUM_MES_URL_PRV"] = $tmp["UF_SONET_COM_URL_PRV"];
                     }
                 }
                 $messageId = ForumAddMessage("REPLY", $forumId, $topicId, 0, $fieldsMessage, $error, $note);
                 if ($messageId > 0) {
                     $addedMessageFilesQuery = CForumFiles::getList(array('ID' => 'ASC'), array('MESSAGE_ID' => $messageId));
                     while ($addedMessageFiles = $addedMessageFilesQuery->fetch()) {
                         $ufFileId[] = $addedMessageFiles['FILE_ID'];
                     }
                     $ufDocId = $GLOBALS['USER_FIELD_MANAGER']->getUserFieldValue('FORUM_MESSAGE', 'UF_FORUM_MESSAGE_DOC', $messageId, LANGUAGE_ID);
                     $ufUrlPreview = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFieldValue("FORUM_MESSAGE", "UF_FORUM_MES_URL_PRV", $messageID, LANGUAGE_ID);
                 }
             }
         }
     }
     if (!$messageId) {
         $error = Loc::getMessage('LISTS_LF_ADD_COMMENT_SOURCE_ERROR');
     }
     return array('SOURCE_ID' => $messageId, 'MESSAGE' => $fieldsMessage ? $fieldsMessage['POST_MESSAGE'] : false, 'RATING_TYPE_ID' => 'FORUM_POST', 'RATING_ENTITY_ID' => $messageId, 'ERROR' => $error, 'NOTES' => $note, 'UF' => array('FILE' => $ufFileId, 'DOC' => $ufDocId, 'URL_PREVIEW' => $ufUrlPreview));
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:79,代码来源:livefeed.php

示例6: array

********************************************************************/
$arError = array();
$arNote = array();
$arResult["ERROR_MESSAGE"] = "";
$arResult["OK_MESSAGE"] = $_REQUEST["result"] == "reply" ? GetMessage("COMM_COMMENT_OK") : ($_REQUEST["result"] == "not_approved" ? GetMessage("COMM_COMMENT_OK_AND_NOT_APPROVED") : "");
unset($_GET["result"]);
unset($GLOBALS["HTTP_GET_VARS"]["result"]);
DeleteParam(array("result"));
$arResult["MESSAGES"] = array();
$arResult["MESSAGE_VIEW"] = array();
// FORUM
CPageOption::SetOptionString("main", "nav_page_in_session", "N");
$arResult['FORUM_TOPIC_ID'] = null;
$arResult["TOPIC"] = array();
$arFilter = array("FORUM_ID" => $arParams['FORUM_ID'], "XML_ID" => $arParams['ENTITY_XML_ID']);
$dbRes = CForumTopic::GetList(null, $arFilter);
if ($dbRes && ($arResult["TOPIC"] = $dbRes->Fetch())) {
    $arResult['FORUM_TOPIC_ID'] = $arResult["TOPIC"]['ID'];
}
$arResult["ELEMENT"] = array();
$arResult["USER"] = array("PERMISSION" => $arParams['PERMISSION'] !== null ? $arParams['PERMISSION'] : ForumCurrUserPermissions($arParams["FORUM_ID"]), "SHOWED_NAME" => $GLOBALS["FORUM_STATUS_NAME"]["guest"], "SUBSCRIBE" => array(), "FORUM_SUBSCRIBE" => "N", "TOPIC_SUBSCRIBE" => "N");
// A - NO ACCESS		E - READ			I - ANSWER
// M - NEW TOPIC		Q - MODERATE	U - EDIT			Y - FULL_ACCESS
$userId = $USER->GetID();
$arUserGroups = $USER->GetUserGroupArray();
if ($arResult["USER"]["PERMISSION"] !== null && !CForumUser::IsAdmin()) {
    $arResult["USER"]["RIGHTS"] = array("ADD_TOPIC" => $arParams['PERMISSION'] >= 'M' ? "Y" : "N", "MODERATE" => $arParams['PERMISSION'] >= 'Q' ? "Y" : "N", "EDIT" => $arParams['PERMISSION'] >= 'U' ? "Y" : "N", "ADD_MESSAGE" => $arParams['PERMISSION'] >= 'I' ? "Y" : "N");
} else {
    $arResult["USER"]["RIGHTS"] = array("ADD_TOPIC" => CForumTopic::CanUserAddTopic($arParams["FORUM_ID"], $arUserGroups, $userId, $arResult["FORUM"]) ? "Y" : "N", "MODERATE" => CForumNew::CanUserModerateForum($arParams["FORUM_ID"], $arUserGroups, $userId) == true ? "Y" : "N", "EDIT" => CForumNew::CanUserEditForum($arParams["FORUM_ID"], $arUserGroups, $userId) ? "Y" : "N", "ADD_MESSAGE" => CForumMessage::CanUserAddMessage($arResult['FORUM_TOPIC_ID'], $arUserGroups, $userId) ? "Y" : "N");
}
if ($USER->IsAuthorized()) {
开发者ID:spas-viktor,项目名称:books,代码行数:31,代码来源:component.php

示例7: array_merge

    $arFilter = array_merge($arFilter, array(">=START_DATE" => $CREATE_DATE_FROM));
}
if (strlen($date2_create_stm) > 0) {
    $arFilter = array_merge($arFilter, array("<=START_DATE" => $CREATE_DATE_TO));
}
if (strlen($date1_stm) > 0) {
    $arFilter = array_merge($arFilter, array(">=LAST_POST_DATE" => $DATE_FROM));
}
if (strlen($date2_stm) > 0) {
    $arFilter = array_merge($arFilter, array("<=LAST_POST_DATE" => $DATE_TO));
}
if (!empty($arMsg)) {
    $err = new CAdminException($arMsg);
    $lAdmin->AddFilterError($err->GetString());
}
$rsData = CForumTopic::GetList(array($by => $order), $arFilter);
$rsData = new CAdminResult($rsData, $sTableID);
$rsData->NavStart();
$lAdmin->NavText($rsData->GetNavPrint(GetMessage("FM_TOPICS")));
//************************************ Headers ********************************************************************
$lAdmin->AddHeaders(array(array("id" => "ID", "content" => "ID", "sort" => "ID", "default" => true), array("id" => "TITLE", "content" => GetMessage("FM_TITLE_NAME"), "sort" => "TITLE", "default" => true), array("id" => "START_DATE", "content" => GetMessage("FM_TITLE_DATE_CREATE"), "sort" => "START_DATE", "default" => true), array("id" => "USER_START_NAME", "content" => GetMessage("FM_TITLE_AUTHOR"), "sort" => "USER_START_NAME", "default" => true), array("id" => "POSTS", "content" => GetMessage("FM_TITLE_MESSAGES"), "sort" => "POSTS", "default" => false), array("id" => "VIEWS", "content" => GetMessage("FM_TITLE_VIEWS"), "sort" => "VIEWS", "default" => false), array("id" => "FORUM_ID", "content" => GetMessage("FM_TITLE_FORUM"), "sort" => "FORUM_ID", "default" => true), array("id" => "LAST_POST_DATE", "content" => GetMessage("FM_TITLE_LAST_MESSAGE"), "sort" => "LAST_POST_DATE", "default" => false), array("id" => "ACTION", "content" => GetMessage("MAIN_ACTION"), "default" => true)));
//************************************ Body ***********************************************************************
while ($arForum = $rsData->NavNext(true, "t_")) {
    $row =& $lAdmin->AddRow($t_ID, $arForum);
    $row->bReadOnly = True;
    $row->AddViewField("ID", $t_ID);
    $row->AddViewField("TITLE", $t_TITLE);
    $row->AddViewField("START_DATE", $t_START_DATE);
    $row->AddViewField("USER_START_NAME", $t_USER_START_NAME);
    $row->AddViewField("POSTS", $t_POSTS);
    $row->AddViewField("VIEWS", $t_VIEWS);
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:forum_topics_search.php

示例8: array

         $res["FORUM_LINK"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_LIST"], array("FID" => $res["ID"]));
         $res["~URL"] = "http://" . $arResult["SERVER_NAME"] . $res["~FORUM_LINK"];
         $res["URL"] = "http://" . htmlspecialcharsEx($arResult["SERVER_NAME"]) . $res["FORUM_LINK"];
         $arResult["FORUMS"][$res["ID"]] = $res;
     } while ($res = $db_res->Fetch());
 }
 if (empty($arResult["FORUMS"])) {
     ShowError(GetMessage("F_EMPTY_FORUMS"));
     CHTTP::SetStatus("404 Not Found");
     return false;
 } elseif ($arParams["MODE_DATA"] == "topic" && $arParams["TID"] <= 0) {
     ShowError(GetMessage("F_EMPTY_TOPIC_ID"));
     CHTTP::SetStatus("404 Not Found");
     return false;
 } elseif ($arParams["MODE_DATA"] == "topic") {
     $db_res = CForumTopic::GetList(array(), array("ID" => $arParams["TID"]));
     if (!($db_res && ($res = $db_res->Fetch()))) {
         ShowError(GetMessage("F_EMPTY_TOPIC"));
         CHTTP::SetStatus("404 Not Found");
         return false;
     } elseif (empty($arResult["FORUMS"][$res["FORUM_ID"]])) {
         ShowError(GetMessage("F_EMPTY_TOPIC"));
         CHTTP::SetStatus("404 Not Found");
         return false;
     }
     foreach ($res as $key => $val) {
         $res["~" . $key] = $val;
         $res[$key] = htmlspecialcharsbx($val);
     }
     $arResult["TOPIC"] = $res;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例9: SetStat

 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();
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:forum_new.php

示例10: GetNeighboringTopics

 function GetNeighboringTopics($TID, $arUserGroups)
 {
     $TID = intVal($TID);
     $arTopic = CForumTopic::GetByID($TID);
     if (!$arTopic) {
         return False;
     }
     //-- PREV_TOPIC
     $arFilter = array("FORUM_ID" => $arTopic["FORUM_ID"], "<LAST_POST_DATE" => $arTopic["LAST_POST_DATE"]);
     if (CForumNew::GetUserPermission($arTopic["FORUM_ID"], $arUserGroups) < "Q") {
         $arFilter["APPROVED"] = "Y";
     }
     $db_res = CForumTopic::GetList(array("LAST_POST_DATE" => "DESC"), $arFilter, false, 1);
     $PREV_TOPIC = 0;
     if ($ar_res = $db_res->Fetch()) {
         $PREV_TOPIC = $ar_res["ID"];
     }
     //-- NEXT_TOPIC
     $arFilter = array("FORUM_ID" => $arTopic["FORUM_ID"], ">LAST_POST_DATE" => $arTopic["LAST_POST_DATE"]);
     if (CForumNew::GetUserPermission($arTopic["FORUM_ID"], $arUserGroups) < "Q") {
         $arFilter["APPROVED"] = "Y";
     }
     $db_res = CForumTopic::GetList(array("LAST_POST_DATE" => "ASC"), $arFilter, false, 1);
     $NEXT_TOPIC = 0;
     if ($ar_res = $db_res->Fetch()) {
         $NEXT_TOPIC = $ar_res["ID"];
     }
     return array($PREV_TOPIC, $NEXT_TOPIC);
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:29,代码来源:topic.php

示例11: array

			}
			elseif(is_array($arCurrentForum))
			{
				$bActive = (array_key_exists($forumId, $arSitemap['SETTINGS']['FORUM_TOPIC']) && $arSitemap['SETTINGS']['FORUM_TOPIC'][$forumId] == "Y");
				if($bActive)
				{
					if($dbTopicResult == null)
					{
						$dbTopicResult = CForumTopic::GetList(
							array("LAST_POST_DATE" => "DESC"),
							array_merge(
								array(
									"FORUM_ID" => $forumId,
									"APPROVED" => "Y"),
								($NS['FORUM_CURRENT_TOPIC'] > 0 ? array(
										">ID" => $NS["FORUM_CURRENT_TOPIC"]
									) : array()
								)
							),
							false,
							0,
							array('nTopCount' => 100)
						);
					}
					if(($arTopic = $dbTopicResult->fetch()) && $arTopic)
					{
						$NS["FORUM_CURRENT_TOPIC"] = $arTopic["ID"];
						$url = CForumNew::PreparePath2Message(
							$arCurrentForum["PATH2FORUM_MESSAGE"],
							array(
								"FORUM_ID" => $arCurrentForum["ID"],
开发者ID:ASDAFF,项目名称:open_bx,代码行数:31,代码来源:seo_sitemap_run.php

示例12: NewMessageForum

function NewMessageForum($FID, $LAST_POST_DATE = false)
{
    if (intVal($_SESSION["FORUM"]["LAST_VISIT_FORUM_0"]) <= 0) {
        ForumInitParams();
    }
    $FID = intVal($FID);
    $LAST_VISIT = max($_SESSION["FORUM"]["LAST_VISIT_FORUM_0"], $_SESSION["FORUM"]["LAST_VISIT_FORUM_" . $FID]);
    $LAST_POST_DATE = MakeTimeStamp($LAST_POST_DATE);
    if (intVal($LAST_POST_DATE) > 0 && $LAST_POST_DATE < $LAST_VISIT) {
        "";
    } elseif ($GLOBALS["USER"]->IsAuthorized()) {
        $arFilter = array("FORUM_ID" => $FID, "RENEW" => $GLOBALS["USER"]->GetID());
        if (ForumCurrUserPermissions($FID) < "Q") {
            $arFilter["APPROVED"] = "Y";
        }
        $db_res = CForumTopic::GetListEx(array("ID" => "DESC"), $arFilter, false, 1);
        if ($db_res && ($res = $db_res->Fetch())) {
            return true;
        }
    } else {
        $arFilter = array("FORUM_ID" => $FID);
        if (is_array($_SESSION["FORUM"]["GUEST_TID"]) && !empty($_SESSION["FORUM"]["GUEST_TID"])) {
            $arFilter["RENEW_TOPIC"][0] = ConvertTimeStamp($LAST_VISIT, "FULL");
            foreach ($_SESSION["FORUM"]["GUEST_TID"] as $key => $val) {
                $arFilter["RENEW_TOPIC"][intVal($key)] = ConvertTimeStamp($val, "FULL");
            }
        } else {
            $arFilter[">LAST_POST_DATE"] = ConvertTimeStamp($LAST_VISIT, "FULL");
        }
        if (ForumCurrUserPermissions($FID) < "Q") {
            $arFilter["APPROVED"] = "Y";
        }
        $db_res = CForumTopic::GetList(array(), $arFilter, false, 1);
        if ($db_res && ($res = $db_res->Fetch())) {
            return true;
        }
    }
    ForumInitParams();
    return false;
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:40,代码来源:include.php

示例13: elseif

         if ($res) {
             ${strToUpper($nameProperty)} = 0;
         }
     }
 }
 // 1.5 Set NULL for topic_id if it was deleted
 if ($FORUM_TOPIC_ID > 0) {
     $arTopic = CForumTopic::GetByID($FORUM_TOPIC_ID);
     if (!$arTopic || !is_array($arTopic) || count($arTopic) <= 0 || $arTopic["FORUM_ID"] != $arParams["FORUM_ID"]) {
         CIBlockElement::SetPropertyValues($arParams["ELEMENT_ID"], $PRODUCT_IBLOCK_ID, 0, "FORUM_TOPIC_ID");
         CIBlockElement::SetPropertyValues($arParams["ELEMENT_ID"], $PRODUCT_IBLOCK_ID, 0, "FORUM_MESSAGE_CNT");
         $FORUM_TOPIC_ID = 0;
     } elseif ($arTopic["XML_ID"] !== "IBLOCK_" . $arParams["ELEMENT_ID"]) {
         CForumTopic::Update($FORUM_TOPIC_ID, array("XML_ID" => "IBLOCK_" . $arParams["ELEMENT_ID"]));
     }
 } elseif (($arTopic = CForumTopic::GetList(array(), array("XML_ID" => "IBLOCK_" . $arParams["ELEMENT_ID"]))->fetch()) && $arTopic) {
     $FORUM_TOPIC_ID = intval($arTopic["ID"]);
     CIBlockElement::SetPropertyValues($arParams["ELEMENT_ID"], $PRODUCT_IBLOCK_ID, $arTopic["ID"], "FORUM_TOPIC_ID");
     CIBlockElement::SetPropertyValues($arParams["ELEMENT_ID"], $PRODUCT_IBLOCK_ID, $arTopic["POSTS"], "FORUM_MESSAGE_CNT");
 }
 // 1.6 Create New topic and add messages
 $MID = 0;
 $TID = 0;
 if ($FORUM_TOPIC_ID <= 0) {
     // 1.6.a Create New topic
     // 1.6.a.1 Get author info
     $arUserStart = array("ID" => intVal($arResult["ELEMENT"]["~CREATED_BY"]), "NAME" => $GLOBALS["FORUM_STATUS_NAME"]["guest"]);
     if ($arUserStart["ID"] > 0) {
         $res = array();
         $db_res = CForumUser::GetListEx(array(), array("USER_ID" => $arResult["ELEMENT"]["~CREATED_BY"]));
         if ($db_res && ($res = $db_res->Fetch())) {
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:action.php

示例14: intVal

 if ($TID <= 0) {
     $res = CForumMessage::GetByID($MID);
     $TID = $arResult['FORUM_TOPIC_ID'] = intVal($res["TOPIC_ID"]);
 }
 if ($_REQUEST['REVIEW_ACTION'] == "EDIT") {
     foreach (GetModuleEvents('forum', 'OnAfterCommentUpdate', true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array($arParams['ENTITY_TYPE'], $arParams['ENTITY_ID'], array("TOPIC_ID" => $TID, "MESSAGE_ID" => $MID, "ACTION" => "EDIT", "PARAMS" => $arFieldsG)));
     }
 } else {
     foreach (GetModuleEvents('forum', 'OnAfterCommentAdd', true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array($arParams['ENTITY_TYPE'], $arParams['ENTITY_ID'], array("TOPIC_ID" => $TID, "MESSAGE_ID" => $MID, "PARAMS" => $arFieldsG)));
     }
 }
 $strOKMessage = GetMessage("COMM_COMMENT_OK");
 $arResult["FORUM_TOPIC_ID"] = intVal($arResult['FORUM_TOPIC_ID']);
 $dbRes = CForumTopic::GetList(null, array("FORUM_ID" => $arParams['FORUM_ID'], "ID" => $arResult["FORUM_TOPIC_ID"]));
 $arResult["TOPIC"] = $dbRes->Fetch();
 if ($arParams["AUTOSAVE"]) {
     $arParams["AUTOSAVE"]->Reset();
 }
 // SUBSCRIBE
 if ($_REQUEST["TOPIC_SUBSCRIBE"] == "Y") {
     if ($_REQUEST["TOPIC_SUBSCRIBE"] == "Y") {
         ForumSubscribeNewMessagesEx($arParams["FORUM_ID"], $arResult['FORUM_TOPIC_ID'], "N", $strErrorMessage, $strOKMessage);
     }
     BXClearCache(true, "/bitrix/forum/user/" . $GLOBALS["USER"]->GetID() . "/subscribe/");
 }
 $strURL = !empty($_REQUEST["back_page"]) ? $_REQUEST["back_page"] : $APPLICATION->GetCurPageParam("", array("MID", "SEF_APPLICATION_CUR_PAGE_URL", BX_AJAX_PARAM_ID, "result", "sessid", "bxajaxid"));
 $bNotModerated = $arResult["FORUM"]["MODERATION"] != "Y" || CForumNew::CanUserModerateForum($arParams["FORUM_ID"], $USER->GetUserGroupArray());
 $strURL = ForumAddPageParams($strURL, array("MID" => $MID, "result" => $bNotModerated ? "reply" : "not_approved"));
 $strURL .= $bNotModerated ? "#message" . $MID : "#reviewnote";
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:action.php

示例15: array

            $res["FORUM_LINK"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_LIST"], array("FID" => $res["ID"]));
            $res["~URL"] = "http://" . $arResult["SERVER_NAME"] . $res["~FORUM_LINK"];
            $res["URL"] = "http://" . htmlspecialcharsEx($arResult["SERVER_NAME"]) . $res["FORUM_LINK"];
            $arResult["FORUMS"][$res["ID"]] = $res;
        } while ($res = $db_res->Fetch());
    }
    if (empty($arResult["FORUMS"])) {
        ShowError(GetMessage("F_EMPTY_FORUMS"));
        CHTTP::SetStatus("404 Not Found");
        return false;
    } elseif ($arParams["MODE_DATA"] == "topic" && $arParams["TID"] <= 0) {
        ShowError(GetMessage("F_EMPTY_TOPIC_ID"));
        CHTTP::SetStatus("404 Not Found");
        return false;
    } elseif ($arParams["MODE_DATA"] == "topic") {
        if (!($res = CForumTopic::GetList(array(), array("ID" => $arParams["TID"]))->fetch())) {
            ShowError(GetMessage("F_EMPTY_TOPIC"));
            CHTTP::SetStatus("404 Not Found");
            return false;
        } elseif (!array_key_exists($res["FORUM_ID"], $arResult["FORUMS"])) {
            ShowError(GetMessage("F_EMPTY_TOPIC"));
            CHTTP::SetStatus("404 Not Found");
            return false;
        }
        foreach ($res as $key => $val) {
            $res["~" . $key] = $val;
            $res[$key] = htmlspecialcharsbx($val);
        }
        $arResult["TOPIC"] = $res;
    }
}
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php


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