本文整理汇总了PHP中CForumNew::GetSites方法的典型用法代码示例。如果您正苦于以下问题:PHP CForumNew::GetSites方法的具体用法?PHP CForumNew::GetSites怎么用?PHP CForumNew::GetSites使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CForumNew
的用法示例。
在下文中一共展示了CForumNew::GetSites方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkParams
protected static function checkParams($arMessage = array(), &$arTopic, &$arForum)
{
if (\Freetrix\Main\Loader::includeModule('forum')) {
$arTopic = !empty($arTopic) ? $arTopic : \CForumTopic::GetByID($arMessage["TOPIC_ID"]);
if (empty($arTopic)) {
return false;
}
$arSitemaps = SitemapForumTable::getSitemapsByEntityId($arTopic["FORUM_ID"]);
if (!empty($arSitemaps) && ($arForum = \CForumNew::GetByIDEx($arTopic["FORUM_ID"])) && $arForum) {
$arForum["PATH2FORUM_MESSAGE"] = \CForumNew::GetSites($arTopic["FORUM_ID"]);
$date = MakeTimeStamp($arTopic['LAST_POST_DATE']);
$result = array();
foreach ($arSitemaps as $arSitemap) {
$path = $arForum["PATH2FORUM_MESSAGE"][$arSitemap["SITE_ID"]];
if (!empty($path)) {
$arSitemap["fileName"] = str_replace("#FORUM_ID#", $arForum["ID"], $arSitemap['SITEMAP_FILE_FORUM']);
$arSitemap["url"] = \CForumNew::PreparePath2Message($path, array("FORUM_ID" => $arForum["ID"], "TOPIC_ID" => $arTopic["ID"], "TITLE_SEO" => $arTopic["TITLE_SEO"], "MESSAGE_ID" => "s", "SOCNET_GROUP_ID" => $arTopic["SOCNET_GROUP_ID"], "OWNER_ID" => $arTopic["OWNER_ID"], "PARAM1" => $arTopic["PARAM1"], "PARAM2" => $arTopic["PARAM2"]));
$arSitemap["date"] = $date;
$result[] = $arSitemap;
}
}
return empty($result) ? false : $result;
}
}
return false;
}
示例2: updateStatisticModule
private function updateStatisticModule($mid)
{
if (\CModule::IncludeModule("statistic")) {
$F_EVENT1 = $this->forum["EVENT1"];
$F_EVENT2 = $this->forum["EVENT2"];
$F_EVENT3 = $this->forum["EVENT3"];
if (empty($F_EVENT3)) {
$site = (array) \CForumNew::GetSites($this->forum["ID"]);
$F_EVENT3 = \CForumNew::PreparePath2Message(array_key_exists(SITE_ID, $site) ? $site[SITE_ID] : reset($site), array("FORUM_ID" => $this->forum["ID"], "TOPIC_ID" => $this->topic["ID"], "MESSAGE_ID" => $mid));
}
\CStatistics::Set_Event($F_EVENT1, $F_EVENT2, $F_EVENT3);
}
}
示例3: array
$lAdmin->NavText($dbResultList->GetNavPrint(GetMessage("NAV")));
$lAdmin->AddHeaders(array(array("id" => "ID", "content" => "ID", "sort" => "ID", "default" => false), array("id" => "FORUM_GROUP_ID", "content" => GetMessage("FORUM_GROUP_ID"), "sort" => "FORUM_GROUP_LEFT_MARGIN", "default" => true), array("id" => "NAME", "content" => GetMessage("NAME"), "sort" => "NAME", "default" => true), array("id" => "ACTIVE", "content" => GetMessage("ACTIVE"), "sort" => "ACTIVE", "default" => true), array("id" => "LAND", "content" => GetMessage('LAND'), "default" => true), array("id" => "SORT", "content" => GetMessage("SORT"), "sort" => "SORT", "align" => "right"), array("id" => "MODERATION", "content" => GetMessage("MODERATION"), "sort" => "MODERATION"), array("id" => "INDEXATION", "content" => GetMessage("INDEXATION"), "sort" => "INDEXATION"), array("id" => "ORDER_BY", "content" => GetMessage("ORDER_BY"), "sort" => "ORDER_BY"), array("id" => "ORDER_DIRECTION", "content" => GetMessage("ORDER_DIRECTION"), "sort" => "ORDER_DIRECTION")));
$arVisibleColumns = $lAdmin->GetVisibleHeaderColumns();
while ($arForum = $dbResultList->NavNext(true, "f_")) {
$row =& $lAdmin->AddRow($f_ID, $arForum);
$bCanUpdateForum = CForumNew::CanUserUpdateForum($f_ID, $USER->GetUserGroupArray(), $USER->GetID());
$bCanDeleteForum = CForumNew::CanUserDeleteForum($f_ID, $USER->GetUserGroupArray(), $USER->GetID());
$row->bReadOnly = $bCanUpdateForum ? false : true;
$row->AddField("ID", $f_ID);
$row->AddViewField("NAME", '<a title="' . GetMessage("FORUM_EDIT") . '" href="forum_edit.php?ID=' . $f_ID . '&lang=' . LANG . GetFilterParams("filter_") . '">' . $f_NAME . '</a>');
$row->AddInputField("NAME", $bCanUpdateForum ? array("size" => "30") : false);
$row->AddCheckField("ACTIVE", $bCanUpdateForum ? array() : false);
$res = array();
$res2 = array();
if (in_array("LAND", $arVisibleColumns)) {
$arForumSite = CForumNew::GetSites($f_ID);
foreach ($arSites as $lid => $site) {
if (array_key_exists($lid, $arForumSite)) {
$res[] = $site["NAME"] . " [" . $lid . "]";
}
$class = empty($arForumSite[$lid]) ? "empty-path" : "";
$res2[] = <<<HTML
<dt class="{$class}" id="site_lid_{$key}">{$site["NAME"]} [{$key}]</dt>
<dd>
\t<textarea id="site_path_{$key}" rows="2" cols="40" name="SITE_PATH[{$key}]"
\t\tonfocus="BX.removeClass(BX('site_lid_{$key}'), 'empty-path')"
\t\tonblur="if(!BX.type.isNotEmptyString(this.value)){ BX.addClass(BX('site_lid_{$key}'), 'empty-path')}"
\t\t>{$arForumSite[$lid]}</textarea>
</dd>
HTML;
}
示例4: GetCommentPath
/**
* Gets right search path for comments,
* http://jabber.bx/view.php?id=25340
* @param int $forumID - forum's ID were comments saving (for example $arParams['FORUM_ID'])
* @return array( $siteID => $forumURL )
*/
static function GetCommentPath($forumID)
{
$arForumPath = array();
if (!$forumID || !CModule::IncludeModule('forum')) {
return false;
}
$arSites = CForumNew::GetSites($forumID);
if (!is_array($arSites)) {
return false;
}
foreach ($arSites as $siteID => $forumUrl) {
$arForumPath[$siteID] = $forumUrl;
}
return $arForumPath;
}
示例5: AddComment_News
function AddComment_News($arFields)
{
if (!CModule::IncludeModule("forum")) {
return false;
}
if (!CModule::IncludeModule("iblock")) {
return false;
}
if (!CModule::IncludeModule("socialnetwork")) {
return false;
}
$dbResult = CSocNetLog::GetList(array("ID" => "DESC"), array("TMP_ID" => $arFields["LOG_ID"]), false, false, array("ID", "SOURCE_ID", "PARAMS"));
$bFound = false;
if ($arLog = $dbResult->Fetch()) {
if (intval($arLog["SOURCE_ID"]) > 0) {
$arFilter = array("ID" => $arLog["SOURCE_ID"]);
$arSelectedFields = array("IBLOCK_ID", "ID", "CREATED_BY", "NAME", "PROPERTY_FORUM_TOPIC_ID", "PROPERTY_FORUM_MESSAGE_CNT");
$db_res = CIBlockElement::GetList(array(), $arFilter, false, false, $arSelectedFields);
if ($db_res && ($res = $db_res->GetNext())) {
$arElement = $res;
$val = COption::GetOptionString("intranet", "sonet_log_news_iblock_forum");
if (strlen($val) > 0) {
$arIBlockForum = unserialize($val);
} else {
$arIBlockForum = array();
}
if (array_key_exists($arElement["IBLOCK_ID"], $arIBlockForum)) {
$FORUM_ID = $arIBlockForum[$arElement["IBLOCK_ID"]];
}
if (intval($FORUM_ID) > 0) {
CSocNetLogTools::AddComment_Review_CheckIBlock($arElement);
$dbMessage = CForumMessage::GetList(array(), array("PARAM2" => $arElement["ID"]));
if (!($arMessage = $dbMessage->Fetch())) {
// Add Topic
$TOPIC_ID = CSocNetLogTools::AddComment_Review_CreateRoot($arElement, $FORUM_ID);
$bNewTopic = true;
} else {
$TOPIC_ID = $arMessage["TOPIC_ID"];
}
if (intval($TOPIC_ID) > 0) {
// Add comment
$messageID = false;
$bError = false;
if (CForumMessage::CanUserAddMessage($TOPIC_ID, $GLOBALS["USER"]->GetUserGroupArray(), $GLOBALS["USER"]->GetID(), false)) {
$bSHOW_NAME = true;
$res = CForumUser::GetByUSER_ID($GLOBALS["USER"]->GetID());
if ($res) {
$bSHOW_NAME = $res["SHOW_NAME"] == "Y";
}
if ($bSHOW_NAME) {
$AUTHOR_NAME = $GLOBALS["USER"]->GetFullName();
}
if (strlen(Trim($AUTHOR_NAME)) <= 0) {
$AUTHOR_NAME = $GLOBALS["USER"]->GetLogin();
}
if (strlen($AUTHOR_NAME) <= 0) {
$bError = true;
}
}
if (!$bError) {
$arFieldsMessage = array("POST_MESSAGE" => $arFields["TEXT_MESSAGE"], "USE_SMILES" => "Y", "APPROVED" => "Y", "PARAM2" => $arElement["ID"], "AUTHOR_NAME" => $AUTHOR_NAME, "AUTHOR_ID" => IntVal($GLOBALS["USER"]->GetParam("USER_ID")), "FORUM_ID" => $FORUM_ID, "TOPIC_ID" => $TOPIC_ID, "NEW_TOPIC" => "N", "GUEST_ID" => $_SESSION["SESS_GUEST_ID"], "ADD_TO_LOG" => "N");
$AUTHOR_IP = ForumGetRealIP();
$AUTHOR_IP_tmp = $AUTHOR_IP;
$AUTHOR_REAL_IP = $_SERVER['REMOTE_ADDR'];
if (COption::GetOptionString("forum", "FORUM_GETHOSTBYADDR", "N") == "Y") {
$AUTHOR_IP = @gethostbyaddr($AUTHOR_IP);
if ($AUTHOR_IP_tmp == $AUTHOR_REAL_IP) {
$AUTHOR_REAL_IP = $AUTHOR_IP;
} else {
$AUTHOR_REAL_IP = @gethostbyaddr($AUTHOR_REAL_IP);
}
}
$arFieldsMessage["AUTHOR_IP"] = $AUTHOR_IP !== False ? $AUTHOR_IP : "<no address>";
$arFieldsMessage["AUTHOR_REAL_IP"] = $AUTHOR_REAL_IP !== False ? $AUTHOR_REAL_IP : "<no address>";
$messageID = CForumMessage::Add($arFieldsMessage, false);
if (intVal($messageID) <= 0) {
$bError = true;
} else {
if (CModule::IncludeModule("statistic")) {
$arForum = CForumNew::GetByID($FORUM_ID);
$F_EVENT1 = $arForum["EVENT1"];
$F_EVENT2 = $arForum["EVENT2"];
$F_EVENT3 = $arForum["EVENT3"];
if (strlen($F_EVENT3) <= 0) {
$arForumSite_tmp = CForumNew::GetSites($FORUM_ID);
$F_EVENT3 = CForumNew::PreparePath2Message($arForumSite_tmp[SITE_ID], array("FORUM_ID" => $FORUM_ID, "TOPIC_ID" => $TOPIC_ID, "MESSAGE_ID" => $messageID));
}
CStatistic::Set_Event($F_EVENT1, $F_EVENT2, $F_EVENT3);
}
CForumMessage::SendMailMessage($messageID, array(), false, "NEW_FORUM_MESSAGE");
CSocNetLogTools::AddComment_Review_UpdateElement($arElement, $TOPIC_ID, $bNewTopic);
}
}
}
}
}
}
}
if (intval($messageID) <= 0) {
$strError = GetMessage("SONET_ADD_COMMENT_SOURCE_ERROR");
//.........这里部分代码省略.........
示例6: SendMailMessage
//.........这里部分代码省略.........
if ($arMailParams['USE_EMAIL'] == 'Y' && $arMessage["AUTHOR_EMAIL"] != '') {
$arFields["FROM_EMAIL"] = '"' . $arMessage['AUTHOR_NAME'] . '" <' . $arMessage['AUTHOR_EMAIL'] . '>';
} elseif ($arMailParams['USE_EMAIL'] == 'Y' && $arMessage["EMAIL"] != '') {
$arFields["FROM_EMAIL"] = '"' . $arMessage['AUTHOR_NAME'] . '" <' . $arMessage['EMAIL'] . '>';
} else {
$arFields["FROM_EMAIL"] = '"' . $arMessage['AUTHOR_NAME'] . '" <' . $arMailParams['EMAIL'] . '>';
}
if ($arMessage["NEW_TOPIC"] == "Y") {
$arFields["=Message-Id"] = $arFields["MSG_ID"] = "<" . $arTopic["XML_ID"] . ">";
} else {
$arFields["TOPIC_TITLE"] = "Re" . ($arMessage["TOPIC_INFO"]["POSTS"] > 1 ? "[" . $arMessage["TOPIC_INFO"]["POSTS"] . "]" : "") . ": " . $arFields["TOPIC_TITLE"];
$arFields["=Message-Id"] = $arFields["MSG_ID"] = "<" . $arMessage["XML_ID"] . ">";
$arFields["=In-Reply-To"] = $arFields["IN_REPLY_TO"] = "<" . $arTopic["XML_ID"] . ">";
}
//fill REPLY_TO from the settings of the mail processor
$arFields["=Reply-To"] = $arFields["REPLY_TO"] = $arMailParams["EMAIL"];
$arFields["FORUM_EMAIL"] = $arMailParams["EMAIL"];
$arSocNetGroup = CSocNetGroup::GetById($arTopic["SOCNET_GROUP_ID"]);
$arFields["FORUM_NAME"] = $arSocNetGroup["NAME"];
if ($arMailParams["SUBJECT_SUF"] != '') {
$arFields["TOPIC_TITLE"] .= ' ' . $arMailParams["SUBJECT_SUF"];
}
if ($arMailParams["USE_SUBJECT"] == "Y") {
$arFields["=Subject"] = $arFields["TOPIC_TITLE"];
}
$arFields["PATH2FORUM"] = CComponentEngine::MakePathFromTemplate($arMailParams["URL_TEMPLATES_MESSAGE"], array("FID" => $arMessage["FORUM_ID"], "TID" => $arMessage["TOPIC_ID"], "TITLE_SEO" => $arMessage["TOPIC_INFO"]["TITLE_SEO"], "MID" => $arMessage["ID"]));
} else {
return false;
}
} else {
return false;
}
} else {
$arForumSites = CForumNew::GetSites($FID);
foreach ($arForumSites as $site_id => $path) {
$arForumSites[$site_id] = trim(CForumNew::PreparePath2Message($arForumSites[$site_id], array("FORUM_ID" => $arMessage["FORUM_ID"], "TOPIC_ID" => $arMessage["TOPIC_ID"], "TITLE_SEO" => $arMessage["TOPIC_INFO"]["TITLE_SEO"], "MESSAGE_ID" => $arMessage["ID"], "SOCNET_GROUP_ID" => $arTopic["SOCNET_GROUP_ID"], "OWNER_ID" => $arTopic["OWNER_ID"], "PARAM1" => $arMessage["PARAM1"], "PARAM2" => $arMessage["PARAM2"])));
if (empty($arForumSites[$site_id])) {
$db_lang = CSite::GetByID($site_id);
$arForumSites[$site_id] = "/";
if ($ar_lang = $db_lang->Fetch()) {
$arForumSites[$site_id] = $ar_lang["DIR"];
}
$arForumSites[$site_id] = COption::GetOptionString("forum", "REL_FPATH", "") . "forum/read.php?FID=#FID#&TID=#TID#&MID=#MID##message#MID#";
}
}
foreach (GetModuleEvents("forum", "onBeforeMailMessageSend", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array(&$mailTemplate, &$arForumSites, &$arFields, $arForum, $arTopic, $arMessage)) === false) {
return false;
}
}
}
/*
??
ALTER TABLE dbo.B_FORUM_MESSAGE ADD
MSG_ID varchar(255) NULL,
MAIL_MESSAGE_ID int NULL
*/
$arFilter = array("FORUM_ID" => $FID, "TOPIC_ID_OR_NULL" => $TID, "ACTIVE" => "Y", ">=PERMISSION" => $arTopic["APPROVED"] != "Y" || $arMessage["APPROVED"] != "Y" ? "Q" : "E");
if ($arMessage["NEW_TOPIC"] != "Y") {
$arFilter["NEW_TOPIC_ONLY"] = "N";
}
if ($mailTemplate == "NEW_FORUM_MESSAGE") {
$arFilter["LAST_SEND_OR_NULL"] = $MID;
}
if ($arTopic["SOCNET_GROUP_ID"] > 0) {
$mailTemplate = "FORUM_NEW_MESSAGE_MAIL";
示例7: Add
//.........这里部分代码省略.........
if (!empty($arFiles))
CForumFiles::UpdateByID($arFiles, array("FORUM_ID" => $arFields["FORUM_ID"],
"TOPIC_ID" => $arFields["TOPIC_ID"], "MESSAGE_ID" => $ID));
/***************** Attach/******************************************/
/***************** Quota *******************************************/
$_SESSION["SESS_RECOUNT_DB"] = "Y";
$GLOBALS["USER_FIELD_MANAGER"]->Update("FORUM_MESSAGE", $ID, $arFields);
if ($arParams["SKIP_STATISTIC"] == "Y" && $arParams["SKIP_INDEXING"] == "Y")
return $ID;
$arMessage = CForumMessage::GetByIDEx($ID, array("GET_FORUM_INFO" => "N", "GET_TOPIC_INFO" => "Y", "FILTER" => "Y"));
if ($arParams["SKIP_STATISTIC"] != "Y")
{
if (intVal($arMessage["AUTHOR_ID"]) > 0)
{
CForumUser::SetStat($arMessage["AUTHOR_ID"], array("MESSAGE" => $arMessage));
}
CForumTopic::SetStat($arMessage["TOPIC_ID"], array("MESSAGE" => $arMessage));
CForumNew::SetStat($arMessage["FORUM_ID"], array("MESSAGE" => $arMessage));
}
/***************** Events onAfterMessageAdd ************************/
foreach(GetModuleEvents("forum", "onAfterMessageAdd", true) as $arEvent)
ExecuteModuleEventEx($arEvent, array(&$ID, $arMessage, $arMessage["TOPIC_INFO"], $arMessage["FORUM_INFO"], $arFields));
/***************** /Events *****************************************/
if ($arMessage["APPROVED"] == "Y")
{
if ($arParams["SKIP_INDEXING"] != "Y" && CModule::IncludeModule("search"))
{
$arMessage["POST_MESSAGE"] = (COption::GetOptionString("forum", "FILTER", "Y") == "Y" ?
$arMessage["POST_MESSAGE_FILTER"] : $arMessage["POST_MESSAGE"]);
$arParams = array(
"PERMISSION" => array(),
"SITE" => CForumNew::GetSites($arMessage["FORUM_ID"]),
"DEFAULT_URL" => "/");
$arGroups = CForumNew::GetAccessPermissions($arMessage["FORUM_ID"]);
foreach($arGroups as $arGroup)
{
if ($arGroup[1] >= "E")
{
$arParams["PERMISSION"][] = $arGroup[0];
if ($arGroup[0] == 2)
break;
}
}
$arSearchInd = array(
"LID" => array(),
"LAST_MODIFIED" => $arMessage["POST_DATE"],
"PARAM1" => $arMessage["FORUM_ID"],
"PARAM2" => $arMessage["TOPIC_ID"],
"ENTITY_TYPE_ID" => ($arMessage["NEW_TOPIC"] == "Y"? "FORUM_TOPIC": "FORUM_POST"),
"ENTITY_ID" => ($arMessage["NEW_TOPIC"] == "Y"? $arMessage["TOPIC_ID"]: $ID),
"USER_ID" => $arMessage["AUTHOR_ID"],
"PERMISSIONS" => $arParams["PERMISSION"],
"TITLE" => $arMessage["TOPIC_INFO"]["TITLE"].($arMessage["NEW_TOPIC"] == "Y" && !empty($arMessage["TOPIC_INFO"]["DESCRIPTION"]) ?
", ".$arMessage["TOPIC_INFO"]["DESCRIPTION"] : ""),
"TAGS" => ($arMessage["NEW_TOPIC"] == "Y" ? $arMessage["TOPIC_INFO"]["TAGS"] : ""),
"BODY" => GetMessage("AVTOR_PREF")." ".$arMessage["AUTHOR_NAME"].". ".(textParser::killAllTags($arMessage["POST_MESSAGE"])),
"URL" => "",
"INDEX_TITLE" => $arMessage["NEW_TOPIC"] == "Y",
);
// get mentions
$arMentionedUserID = CForumMessage::GetMentionedUserID($arMessage["POST_MESSAGE"]);
示例8: ShowError
}
$arParams["SET_TITLE"] = $arParams["SET_TITLE"] == "N" ? "N" : "Y";
$arParams["SET_NAVIGATION"] = $arParams["SET_NAVIGATION"] == "N" ? "N" : "Y";
// $arParams["DISPLAY_PANEL"] = ($arParams["DISPLAY_PANEL"] == "Y" ? "Y" : "N");
/********************************************************************
/Input params
********************************************************************/
$arResult["FORUM"] = CForumNew::GetByID($arParams["FID"]);
if (empty($arResult["FORUM"])) {
CHTTP::SetStatus("404 Not Found");
ShowError(GetMessage("F_ERROR_FORUM_NOT_EXISTS"));
return false;
} elseif (!CForumNew::CanUserViewForum($arParams["FID"], $USER->GetUserGroupArray())) {
$APPLICATION->AuthForm(GetMessage("F_NO_FPERMS"));
return false;
} elseif (!array_key_exists(SITE_ID, CForumNew::GetSites($arParams["FID"])) && ($arParams["SHOW_FORUM_ANOTHER_SITE"] == "N" || $GLOBALS["APPLICATION"]->GetGroupRight("forum") < "W")) {
CHTTP::SetStatus("404 Not Found");
ShowError(GetMessage("F_ERROR_FORUM_NOT_EXISTS"));
return false;
}
/********************************************************************
Default values
********************************************************************/
$arParams["PERMISSION"] = $arResult["PERMISSION"] = ForumCurrUserPermissions($arParams["FID"]);
$arResult["Topics"] = array();
$arResult["TOPICS"] = array();
$arResult["URL"] = array("INDEX" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_INDEX"], array()), "~INDEX" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_INDEX"], array()), "TOPIC_LIST" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_LIST"], array("FID" => $arParams["FID"])), "~TOPIC_LIST" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_LIST"], array("FID" => $arParams["FID"])), "TOPIC_NEW" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_TOPIC_NEW"], array("FID" => $arParams["FID"])), "~TOPIC_NEW" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_TOPIC_NEW"], array("FID" => $arParams["FID"])), "RSS" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_RSS"], array("TYPE" => "default", "MODE" => "forum", "IID" => $arParams["FID"])), "~RSS" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_RSS"], array("TYPE" => "default", "MODE" => "forum", "IID" => $arParams["FID"])), "RSS_DEFAULT" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_RSS"], array("TYPE" => "rss2", "MODE" => "forum", "IID" => $arParams["FID"])), "~RSS_DEFAULT" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_RSS"], array("TYPE" => "rss2", "MODE" => "forum", "IID" => $arParams["FID"])));
$arResult["CanUserAddTopic"] = CForumTopic::CanUserAddTopic($arParams["FID"], $USER->GetUserGroupArray(), $USER->GetID(), $arResult["FORUM"]);
global $by, $order;
if (empty($by)) {
$by = "LAST_POST_DATE";
示例9: elseif
case "FORUM_TOPIC_EDIT":
if (intval($a_ITEM_ID) <= 0) {
continue;
} elseif (!array_key_exists($a_ITEM_ID, $arForumCache["TOPIC"])) {
CModule::IncludeModule("forum");
$res = CForumTopic::GetByID($a_ITEM_ID);
$res["MESSAGE_ID"] = $res["LAST_MESSAGE_ID"];
$res["TOPIC_ID"] = $res["ID"];
$arForumCache["TOPIC"][$a_ITEM_ID] = $res;
} else {
$res = $arForumCache["TOPIC"][$a_ITEM_ID];
}
if (!array_key_exists($res["FORUM_ID"], $arForumCache["FORUM"])) {
$arForumCache["FORUM"][$res["FORUM_ID"]] = CForumNew::GetByID($res["FORUM_ID"]);
if ($arForumCache["FORUM"][$res["FORUM_ID"]]) {
$arSitesPath = CForumNew::GetSites($res["FORUM_ID"]);
$arForumCache["FORUM"][$res["FORUM_ID"]]["PATH"] = array_shift($arSitesPath);
}
}
if ($arForumCache["FORUM"][$res["FORUM_ID"]]["PATH"]) {
$sPath = CForumNew::PreparePath2Message($arForumCache["FORUM"][$res["FORUM_ID"]]["PATH"], $res);
$row->AddViewField("ITEM_ID", '[<a href="' . $sPath . '">' . $a_ITEM_ID . '</a>] ' . GetMessage("MAIN_EVENTLOG_FORUM_TOPIC"));
} else {
$row->AddViewField("ITEM_ID", '[' . $a_ITEM_ID . '] ' . GetMessage("MAIN_EVENTLOG_FORUM_TOPIC"));
}
break;
case "FORUM_MESSAGE_DELETE":
$row->AddViewField("ITEM_ID", '[' . $a_ITEM_ID . '] ' . GetMessage("MAIN_EVENTLOG_FORUM_MESSAGE"));
break;
case "FORUM_TOPIC_DELETE":
$row->AddViewField("ITEM_ID", '[' . $a_ITEM_ID . '] ' . GetMessage("MAIN_EVENTLOG_FORUM_TOPIC"));
示例10: elseif
$site_id_tmp = $arSonetGroup["SITE_ID"];
} else {
$site_id_tmp = false;
}
$bIsCurrentUserModuleAdmin = CSocNetUser::IsCurrentUserModuleAdmin($site_id_tmp);
if (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_GROUP, $group_id, "forum", "full", $bIsCurrentUserModuleAdmin)) {
$arParams["PERMISSION"] = "Y";
} elseif (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_GROUP, $group_id, "forum", "newtopic", $bIsCurrentUserModuleAdmin)) {
$arParams["PERMISSION"] = "M";
} elseif (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_GROUP, $group_id, "forum", "answer", $bIsCurrentUserModuleAdmin)) {
$arParams["PERMISSION"] = "I";
} elseif (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_GROUP, $group_id, "forum", "view", $bIsCurrentUserModuleAdmin)) {
$arParams["PERMISSION"] = "E";
}
} else {
$arForumSites = CForumNew::GetSites($arResult["FORUM"]["ID"]);
if (count($arForumSites) > 0) {
list($key, $val) = each($arForumSites);
if (strlen($key) > 0) {
$site_id_tmp = $key;
} else {
$site_id_tmp = false;
}
} else {
$site_id_tmp = false;
}
$bIsCurrentUserModuleAdmin = CSocNetUser::IsCurrentUserModuleAdmin($site_id_tmp);
if (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_USER, $owner_id, "forum", "full", CForumUser::IsAdmin($user_id))) {
$arParams["PERMISSION"] = "Y";
} elseif (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_USER, $owner_id, "forum", "newtopic", $bIsCurrentUserModuleAdmin)) {
$arParams["PERMISSION"] = "M";
示例11: array
endif;
else:
$res = CForumTopic::GetByIDEx($arParams["TID"], array("GET_FORUM_INFO" => "Y"));
if (empty($res)):
$arError = array(
"code" => "404",
"title" => GetMessage("F_ERROR_TID_IS_LOST"));
else:
$arResult["TOPIC"] = $res;
$arResult["FORUM"] = $res["FORUM_INFO"];
endif;
endif;
if ($arParams["FID"] > 0)
{
$arValidSites = CForumNew::GetSites($arParams["FID"]);
if (!isset($arValidSites[SITE_ID]) && ($arParams["SHOW_FORUM_ANOTHER_SITE"] == "N" || $GLOBALS["APPLICATION"]->GetGroupRight("forum") < "W"))
{
$arError = array(
"code" => "404",
"title" => GetMessage("F_ERROR_TID_IS_LOST"));
}
}
if (empty($arResult["TOPIC"])):
elseif ($arResult["TOPIC"]["STATE"] == "L" && intVal($arResult["TOPIC"]["TOPIC_ID"]) > 0):
$res = CForumTopic::GetByIDEx($arResult["TOPIC"]["TOPIC_ID"], array("GET_FORUM_INFO" => "Y"));
if (empty($res)):
$arError = array(
"code" => "404",
"title" => GetMessage("F_ERROR_TID_IS_LOST"));
else:
示例12: ForumAddMessage
//.........这里部分代码省略.........
$TID = 0;
}
}
} else {
if (empty($AUTHOR_ID)) {
if (is_set($arFieldsG, "AUTHOR_NAME")) {
$arFields["AUTHOR_NAME"] = $arFieldsG["AUTHOR_NAME"];
}
if (is_set($arFieldsG, "AUTHOR_EMAIL")) {
$arFields["AUTHOR_EMAIL"] = $arFieldsG["AUTHOR_EMAIL"];
}
}
if ($bAddEditNote) {
$arFields["EDITOR_NAME"] = $arFieldsG["EDITOR_NAME"];
$arFields["EDITOR_EMAIL"] = $arFieldsG["EDITOR_EMAIL"];
$arFields["EDIT_REASON"] = $arFieldsG["EDIT_REASON"];
$arFields["EDIT_DATE"] = "";
if ($GLOBALS["USER"]->IsAuthorized()) {
$arFields["EDITOR_ID"] = $GLOBALS["USER"]->GetID();
}
}
$MID1 = CForumMessage::Update($MID, $arFields);
if (IntVal($MID1) <= 0) {
$ex = $GLOBALS['APPLICATION']->GetException();
if ($ex) {
$aMsg[] = array("id" => "MESSAGE_ID", "text" => $ex->GetString());
} else {
$aMsg[] = array("id" => "MESSAGE_ID", "text" => GetMessage("ADDMESS_ERROR_EDIT_MESSAGE") . ".");
}
} elseif ($AUTHOR_ID == $GLOBALS["USER"]->GetId() && COption::GetOptionString("forum", "LOGS", "Q") < "U") {
} else {
$res_log = array();
foreach ($arFields as $key => $val) {
if ($arFields[$key] != $arMessage[$key]) {
if ($key == "FILES" || $key == "ATTACH_IMG") {
$res_log[$key] = GetMessage("F_ATTACH_IS_MODIFIED");
continue;
}
$res_log["BeforeMessage"] = $arMessage[$key];
$res_log["AfterMessage"] = $arFields[$key];
}
}
if (!empty($res_log)) {
$arMessage = CForumMessage::GetByID($MID);
$TID = $arMessage['TOPIC_ID'];
$res_log['FORUM_ID'] = $arMessage['FORUM_ID'];
$arTopic = CForumTopic::GetByID($TID);
$res_log['TITLE'] = $arTopic['TITLE'];
$res_log['TOPIC_ID'] = $TID;
$res_log = serialize($res_log);
CForumEventLog::Log("message", "edit", $MID, $res_log);
}
}
}
}
//*************************/Add/edit message ***********************************************************************
if (empty($aMsg)) {
$DB->Commit();
} else {
$DB->Rollback();
}
if (empty($aMsg) && CModule::IncludeModule("statistic")) {
$F_EVENT1 = $arForum["EVENT1"];
$F_EVENT2 = $arForum["EVENT2"];
$F_EVENT3 = $arForum["EVENT3"];
if (empty($F_EVENT3)) {
$arForumSite_tmp = CForumNew::GetSites($FID);
if (defined("ADMIN_SECTION") && ADMIN_SECTION === true) {
$arForumSiteCode_tmp = array_keys($arForumSite_tmp);
$F_EVENT3 = CForumNew::PreparePath2Message(empty($arForumSite_tmp[$arForumSiteCode_tmp[0]]) ? '' : $arForumSite_tmp[$arForumSiteCode_tmp[0]], array("FORUM_ID" => $FID, "TOPIC_ID" => $TID, "MESSAGE_ID" => $MID));
} else {
$F_EVENT3 = CForumNew::PreparePath2Message(empty($arForumSite_tmp[SITE_ID]) ? '' : $arForumSite_tmp[SITE_ID], array("FORUM_ID" => $FID, "TOPIC_ID" => $TID, "MESSAGE_ID" => $MID));
}
}
CStatistics::Set_Event($F_EVENT1, $F_EVENT2, $F_EVENT3);
}
if (empty($aMsg)) {
$arNote = array();
if ($MESSAGE_TYPE == "NEW" || $MESSAGE_TYPE == "REPLY") {
CForumMessage::SendMailMessage($MID, array(), false, "NEW_FORUM_MESSAGE");
$arNote = array("id" => $MESSAGE_TYPE, "text" => GetMessage("ADDMESS_SUCCESS_ADD") . ". \n");
} else {
CForumMessage::SendMailMessage($MID, array(), false, "EDIT_FORUM_MESSAGE");
$arNote = array("id" => "EDIT", "text" => GetMessage("ADDMESS_SUCCESS_EDIT") . ". \n");
}
if ($arFieldsG["APPROVED"] != "Y") {
$arNote["id"] .= "_NOT_APPROVED";
$arNote["text"] .= GetMessage("ADDMESS_AFTER_MODERATE") . ". \n";
}
if (is_array($strOKMessage)) {
$strOKMessage[] = $arNote;
} else {
$strOKMessage .= $arNote["text"];
}
return $MID;
}
$e = new CAdminException($aMsg);
$strErrorMessage = $e->GetString();
return false;
}
示例13: _check_iblock_prop
function _check_iblock_prop($arProperty = false)
{
static $dataType = 'IblockProperties';
$checked = $this->_dataCache($dataType);
if (!$checked) {
$arProps = $this->GetProperties();
foreach ($arProps as $code => &$arIBProp) {
if (!isset($arProperty[$code])) {
continue;
}
if ($arIBProp['PROPERTY_TYPE'] != $arProperty[$code]['type'] || $arIBProp['USER_TYPE'] != null) {
continue;
}
unset($arProperty[$code]);
}
$prp = new CIBlockProperty();
foreach ($arProperty as $sPropertyCode => $arPropertyParams) {
$properties = array("IBLOCK_ID" => $this->IBLOCK_ID, "ACTIVE" => "Y", "CODE" => $sPropertyCode, "MULTIPLE" => "N", "PROPERTY_TYPE" => $arPropertyParams["type"], "NAME" => $arPropertyParams["name"]);
if (isset($arPropertyParams["properties"])) {
$properties += $arPropertyParams["properties"];
}
$res = $prp->Add($properties);
}
if ($this->FORUM_ID !== null && empty($this->arRootSection) && CModule::IncludeModule('forum')) {
$arForum = CForumNew::GetByID($this->FORUM_ID);
if ($arForum['ACTIVE'] == 'Y') {
$arSites = CForumNew::GetSites($this->FORUM_ID);
foreach ($arSites as $siteID => $forumUrl) {
if (strpos($forumUrl, '/community/forum/') === 0) {
$arSites[$siteID] = str_replace(array('///', '//'), '/', $this->base_url . "/element/comment/#TOPIC_ID#/#MESSAGE_ID#/");
}
}
$arUpForum = array();
$arUpForum["SITES"] = $arSites;
CForumNew::Update($this->FORUM_ID, $arUpForum);
}
}
$this->_dataCache($dataType, true);
}
}
示例14: unset
$arAdmin = $arUsers[1];
unset($arUsers[1]);
$arUser = !empty($arUsers) ? array_shift($arUsers) : array("USER_ID" => 0, "SHOW_ABC" => GetMessage("GUEST1"));
$arUser2 = !empty($arUsers) ? array_shift($arUsers) : array("USER_ID" => 0, "SHOW_ABC" => GetMessage("GUEST2"));
$arUser3 = !empty($arUsers) ? array_shift($arUsers) : array("USER_ID" => 0, "SHOW_ABC" => GetMessage("GUEST3"));
$arUser4 = !empty($arUsers) ? array_shift($arUsers) : array("USER_ID" => 0, "SHOW_ABC" => GetMessage("GUEST4"));
$arUser5 = !empty($arUsers) ? array_shift($arUsers) : array("USER_ID" => 0, "SHOW_ABC" => GetMessage("GUEST5"));
$arUser6 = !empty($arUsers) ? array_shift($arUsers) : array("USER_ID" => 0, "SHOW_ABC" => GetMessage("GUEST6"));
$arForums = array(array("XML_ID" => "COMMUNITY_PHOTO_COMMENTS", "NAME" => GetMessage("PHOTOGALLERY_COMMENTS_FORUM_NAME"), "DESCRIPTION" => "", "SORT" => 3, "ACTIVE" => "Y", "ALLOW_HTML" => "N", "ALLOW_ANCHOR" => "Y", "ALLOW_BIU" => "Y", "ALLOW_IMG" => "Y", "ALLOW_LIST" => "Y", "ALLOW_QUOTE" => "Y", "ALLOW_CODE" => "Y", "ALLOW_FONT" => "Y", "ALLOW_SMILES" => "Y", "ALLOW_UPLOAD" => "Y", "ALLOW_NL2BR" => "N", "MODERATION" => "N", "ALLOW_MOVE_TOPIC" => "Y", "ORDER_BY" => "P", "ORDER_DIRECTION" => "DESC", "LID" => LANGUAGE_ID, "PATH2FORUM_MESSAGE" => "", "ALLOW_UPLOAD_EXT" => "", "FORUM_GROUP_ID" => $arGroupID["HIDDEN"], "ASK_GUEST_EMAIL" => "N", "USE_CAPTCHA" => "N", "INDEXATION" => "Y", "SITES" => array(WIZARD_SITE_ID => WIZARD_SITE_DIR . "forum/messages/forum#FORUM_ID#/topic#TOPIC_ID#/message#MESSAGE_ID#/#message#MESSAGE_ID#"), "EVENT1" => "forum", "EVENT2" => "message", "EVENT3" => "", "GROUP_ID" => array("2" => "M", "1" => "Y")), array("XML_ID" => "COMMUNITY_USERS_AND_GROUPS", "NAME" => GetMessage("USERS_AND_GROUPS_FORUM_NAME"), "DESCRIPTION" => GetMessage("USERS_AND_GROUPS_FORUM_DESCRIPTION"), "SORT" => 4, "ACTIVE" => "Y", "ALLOW_HTML" => "N", "ALLOW_ANCHOR" => "Y", "ALLOW_BIU" => "Y", "ALLOW_IMG" => "Y", "ALLOW_LIST" => "Y", "ALLOW_QUOTE" => "Y", "ALLOW_CODE" => "Y", "ALLOW_FONT" => "Y", "ALLOW_SMILES" => "Y", "ALLOW_UPLOAD" => "Y", "ALLOW_NL2BR" => "N", "MODERATION" => "N", "ALLOW_MOVE_TOPIC" => "Y", "ORDER_BY" => "P", "ORDER_DIRECTION" => "DESC", "LID" => LANGUAGE_ID, "PATH2FORUM_MESSAGE" => "", "ALLOW_UPLOAD_EXT" => "", "FORUM_GROUP_ID" => $arGroupID["HIDDEN"], "ASK_GUEST_EMAIL" => "N", "USE_CAPTCHA" => "N", "INDEXATION" => "Y", "SITES" => array(WIZARD_SITE_ID => WIZARD_SITE_DIR . "forum/messages/forum#FORUM_ID#/topic#TOPIC_ID#/message#MESSAGE_ID#/#message#MESSAGE_ID#"), "EVENT1" => "forum", "EVENT2" => "message", "EVENT3" => "", "GROUP_ID" => array("1" => "Y")));
foreach ($arForums as $arForum) {
$dbForum = CForumNew::GetList(array(), array("SITE_ID" => WIZARD_SITE_ID, "XML_ID" => $arForum["XML_ID"]));
if ($resForum = $dbForum->Fetch()) {
if (WIZARD_INSTALL_DEMO_DATA) {
CForumNew::Delete($resForum["ID"]);
} else {
$res = CForumNew::GetSites($resForum["ID"]);
if (!array_key_exists(WIZARD_SITE_ID, $res)) {
$res[WIZARD_SITE_ID] = WIZARD_SITE_DIR . "forum/messages/forum#FORUM_ID#/topic#TOPIC_ID#/message#MESSAGE_ID#/#message#MESSAGE_ID#";
CForumNew::Update($resForum["ID"], array("SITES" => $res));
}
continue;
}
}
$forumID = CForumNew::Add($arForum);
if ($forumID < 1 || !isset($arForum["TOPICS"]) || !is_array($arForum["TOPICS"])) {
continue;
}
foreach ($arForum["TOPICS"] as $arTopic) {
$arTopic["FORUM_ID"] = $forumID;
$topicID = CForumTopic::Add($arTopic);
if ($topicID < 1 || !isset($arTopic["MESSAGES"]) || !is_array($arTopic["MESSAGES"])) {
示例15: ShowError
}
$arParams["SET_TITLE"] = $arParams["SET_TITLE"] == "N" ? "N" : "Y";
$arParams["SET_NAVIGATION"] = $arParams["SET_NAVIGATION"] == "N" ? "N" : "Y";
// $arParams["DISPLAY_PANEL"] = ($arParams["DISPLAY_PANEL"] == "Y" ? "Y" : "N");
/********************************************************************
/Input params
********************************************************************/
$arResult["FORUM"] = CForumNew::GetByID($arParams["FID"]);
if (empty($arResult["FORUM"])) {
CHTTP::SetStatus("404 Not Found");
ShowError(GetMessage("F_ERROR_FORUM_NOT_EXISTS"));
return false;
} elseif (!CForumNew::CanUserViewForum($arParams["FID"], $USER->GetUserGroupArray())) {
$APPLICATION->AuthForm(GetMessage("F_NO_FPERMS"));
return false;
} elseif (!array_key_exists(SITE_ID, CForumNew::GetSites($arParams["FID"])) && ($arParams["SHOW_FORUM_ANOTHER_SITE"] == "N" || !CForumUser::IsAdmin())) {
CHTTP::SetStatus("404 Not Found");
ShowError(GetMessage("F_ERROR_FORUM_NOT_EXISTS"));
return false;
}
/********************************************************************
Default values
********************************************************************/
$arParams["PERMISSION"] = $arResult["PERMISSION"] = ForumCurrUserPermissions($arParams["FID"]);
$arResult["Topics"] = array();
$arResult["TOPICS"] = array();
$arResult["URL"] = array("INDEX" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_INDEX"], array()), "~INDEX" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_INDEX"], array()), "TOPIC_LIST" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_LIST"], array("FID" => $arParams["FID"])), "~TOPIC_LIST" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_LIST"], array("FID" => $arParams["FID"])), "TOPIC_NEW" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_TOPIC_NEW"], array("FID" => $arParams["FID"])), "~TOPIC_NEW" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_TOPIC_NEW"], array("FID" => $arParams["FID"])), "RSS" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_RSS"], array("TYPE" => "default", "MODE" => "forum", "IID" => $arParams["FID"])), "~RSS" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_RSS"], array("TYPE" => "default", "MODE" => "forum", "IID" => $arParams["FID"])), "RSS_DEFAULT" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_RSS"], array("TYPE" => "rss2", "MODE" => "forum", "IID" => $arParams["FID"])), "~RSS_DEFAULT" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_RSS"], array("TYPE" => "rss2", "MODE" => "forum", "IID" => $arParams["FID"])));
$arResult["CanUserAddTopic"] = CForumTopic::CanUserAddTopic($arParams["FID"], $USER->GetUserGroupArray(), $USER->GetID(), $arResult["FORUM"]);
$arResult["ERROR_MESSAGE"] = "";
$arResult["OK_MESSAGE"] = "";
$parser = new forumTextParser(false, false, false, "light");