Ejemplo n.º 1
0
    }
    $arResult["ERROR_MESSAGE"] = $strErrorMessage;
    $arResult["OK_MESSAGE"] = $strOKMessage;
}
/********************************************************************
				/Action
********************************************************************/
/********************************************************************
				Data
********************************************************************/
/************** Topic for move *************************************/
$arFilter = array("@ID" => implode(",", $topics), "FORUM_ID" => $arParams["FID"]);
if (!CForumUser::IsAdmin()) {
    $arFilter["PERMISSION_STRONG"] = true;
}
$db_res = CForumTopic::GetListEx(array(), $arFilter);
if ($db_res && ($res = $db_res->GetNext())) {
    do {
        $res["read"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_READ"], array("FID" => $res["FORUM_ID"], "TID" => $res["ID"], "TITLE_SEO" => $res["TITLE_SEO"], "MID" => "s"));
        $res["read_last_message"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE"], array("FID" => $res["FORUM_ID"], "TID" => $res["ID"], "TITLE_SEO" => $res["TITLE_SEO"], "MID" => intVal($res["LAST_MESSAGE_ID"]))) . "#message" . $res["LAST_MESSAGE_ID"];
        $res["USER_START_HREF"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_PROFILE_VIEW"], array("UID" => intVal($res["USER_START_ID"])));
        $res["LAST_POSTER_HREF"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_PROFILE_VIEW"], array("UID" => intVal($res["LAST_POSTER_ID"])));
        $arResult["TOPICS"][$res["ID"]] = $res;
    } while ($res = $db_res->GetNext());
}
$arParams["TID"] = implode(",", array_keys($arResult["TOPICS"]));
/************** Forums *********************************************/
$arFilter = array();
if ($arParams["SHOW_FORUM_ANOTHER_SITE"] == "N" || !CForumUser::IsAdmin()) {
    $arFilter["LID"] = SITE_ID;
}
Ejemplo n.º 2
0
 $db_res = CForumNew::GetListEx(array(), $arFilter);
 if ($db_res && ($res = $db_res->GetNext())) {
     do {
         $res["URL"] = array("LIST" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_LIST"], array("FID" => $res["ID"])), "~LIST" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_LIST"], array("FID" => $res["ID"])));
         $res["list"] = $res["URL"]["list"];
         // for custom
         $arForums[$res["ID"]] = $res;
     } while ($res = $db_res->GetNext());
 }
 if (!empty($arForums)) {
     // it need for custom components
     foreach (array("TITLE", "USER_START_NAME", "POSTS", "VIEWS", "LAST_POST_DATE") as $res) {
         $arResult["SortingEx"][$res] = SortingEx($res, false, "by" . $orderIndex, "order" . $orderIndex);
     }
     // /it need for custom components
     $db_res = CForumTopic::GetListEx($arSort, array("@FORUM_ID" => array_keys($arForums), "APPROVED" => "Y"), false, false, $arNavParams);
     if ($db_res) {
         $db_res->NavStart($arParams["TOPICS_PER_PAGE"], false);
         $arResult["NAV_STRING"] = $db_res->GetPageNavStringEx($navComponentObject, $arParams["PAGER_TITLE"], $arParams["PAGER_TEMPLATE"], $arParams["PAGER_SHOW_ALWAYS"]);
         //$arResult["NAV_CACHED_DATA"] = $navComponentObject->GetTemplateCachedData();
         $arResult["NAV_RESULT"] = $db_res;
         while ($res = $db_res->GetNext()) {
             if (strLen(trim($res["LAST_POST_DATE"])) > 0) {
                 $res["LAST_POST_DATE"] = CForumFormat::DateFormat($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($res["LAST_POST_DATE"], CSite::GetDateFormat()));
             }
             $res["URL"] = array("AUTHOR" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_PROFILE_VIEW"], array("UID" => $res["USER_START_ID"])), "~AUTHOR" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_PROFILE_VIEW"], array("UID" => $res["USER_START_ID"])), "READ" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE"], array("FID" => $res["FORUM_ID"], "TID" => $res["ID"], "MID" => intVal($res["LAST_MESSAGE_ID"]))) . "#message" . intVal($res["LAST_MESSAGE_ID"]), "~READ" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_MESSAGE"], array("FID" => $res["FORUM_ID"], "TID" => $res["ID"], "MID" => intVal($res["LAST_MESSAGE_ID"]))) . "#message" . intVal($res["LAST_MESSAGE_ID"]));
             $res["user_start_id_profile"] = $res["URL"]["AUTHOR"];
             // For custom
             $res["read"] = $res["URL"]["READ"];
             // For custom
             $arTopics[] = $res;
Ejemplo n.º 3
0
     $res["USER_START_NAME"] = $parser->wrap_long_words($res["USER_START_NAME"]);
     $res["LAST_POSTER_NAME"] = $parser->wrap_long_words($res["LAST_POSTER_NAME"]);
     $res["LAST_POST_DATE"] = CForumFormat::DateFormat($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($res["LAST_POST_DATE"], CSite::GetDateFormat()));
     $res["START_DATE"] = CForumFormat::DateFormat($arParams["DATE_FORMAT"], MakeTimeStamp($res["START_DATE"], CSite::GetDateFormat()));
     /************** For custom template ********************************/
     $res["read"] = $res["URL"]["TOPIC"];
     $res["read_last_unread"] = $res["URL"]["MESSAGE_UNREAD"];
     $res["read_last_message"] = $res["URL"]["LAST_MESSAGE"];
     $res["USER_START_HREF"] = $res["URL"]["USER_START"];
     $res["LAST_POSTER_HREF"] = $res["URL"]["LAST_POSTER_HREF"];
     $res["author_profile"] = $res["URL"]["LAST_POSTER_HREF"];
     /************** For custom template/********************************/
     $arResult["Topics"][] = $res;
 }
 if (count($topicLinks) > 0) {
     $db_res1 = CForumTopic::GetListEx(array("SORT" => "ASC"), array("@ID" => $topicLinks));
     $topicLinks1 = array();
     while ($res = $db_res1->GetNext()) {
         $key = array_search($res["ID"], $topicLinks);
         if (array_key_exists($key, $arResult["Topics"])) {
             $arResult["Topics"][$key]["URL"] = array_merge($arResult["Topics"][$key]["URL"], array("TOPIC" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_READ"], array("FID" => $res["FORUM_ID"], "TID" => $res["ID"], "TITLE_SEO" => $res["TITLE_SEO"], "MID" => "s")), "~TOPIC" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_READ"], array("FID" => $res["FORUM_ID"], "TID" => $res["ID"], "TITLE_SEO" => $res["TITLE_SEO"], "MID" => "s")), "LAST_MESSAGE" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE"], array("FID" => $res["FORUM_ID"], "TID" => $res["ID"], "TITLE_SEO" => $res["TITLE_SEO"], "MID" => intVal($res["LAST_MESSAGE_ID"]))), "~LAST_MESSAGE" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_MESSAGE"], array("FID" => $res["FORUM_ID"], "TID" => $res["ID"], "TITLE_SEO" => $res["TITLE_SEO"], "MID" => intVal($res["LAST_MESSAGE_ID"]))), "MESSAGE_UNREAD" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE"], array("FID" => $res["FORUM_ID"], "TID" => $res["ID"], "TITLE_SEO" => $res["TITLE_SEO"], "MID" => "unread_mid")), "~MESSAGE_UNREAD" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_MESSAGE"], array("FID" => $res["FORUM_ID"], "TID" => $res["ID"], "TITLE_SEO" => $res["TITLE_SEO"], "MID" => "unread_mid"))));
         }
     }
 }
 /*******************************************************************
 				CACHE
 *******************************************************************/
 if ($PAGEN == null && $arParams["CACHE_TIME"] > 0 && defined("BX_COMP_MANAGED_CACHE")) {
     $cache->StartDataCache($arParams["CACHE_TIME"], $cache_id, $cache_path);
     CForumCacheManager::SetTag($cache_path, "forum_msg_count" . $arParams['FID']);
     CForumCacheManager::SetTag($cache_path, "forum_" . $arParams['FID']);
Ejemplo n.º 4
0
				/Action
********************************************************************/
/*******************************************************************/
CPageOption::SetOptionString("main", "nav_page_in_session", "N");
if (!$USER->IsAuthorized()) {
    $rsTopics = CForumTopic::GetListEx(array($by => $order, "POSTS" => "DESC"), $arFilter, false, 500, array("sNameTemplate" => $arParams["NAME_TEMPLATE"]));
    while ($arTopic = $rsTopics->Fetch()) {
        if (!NewMessageTopic($arTopic["FORUM_ID"], $arTopic["ID"], $arTopic["LAST_POST_DATE"], false)) {
            continue;
        }
        $arrTOPICS[] = $arTopic;
    }
    $rsTopics = new CDBResult();
    $rsTopics->InitFromArray($arrTOPICS);
} else {
    $rsTopics = CForumTopic::GetListEx(array($by => $order, "POSTS" => "DESC"), $arFilter, false, 0, array("bDescPageNumbering" => false, "nPageSize" => $arParams["TOPICS_PER_PAGE"], "bShowAll" => false, "sNameTemplate" => $arParams["NAME_TEMPLATE"]));
}
$rsTopics->nPageWindow = $arParams["PAGE_NAVIGATION_WINDOW"];
$rsTopics->NavStart($arParams["TOPICS_PER_PAGE"], false);
$arResult["NAV_RESULT"] = $rsTopics;
$arResult["NAV_STRING"] = $rsTopics->GetPageNavStringEx($navComponentObject, GetMessage("FL_TOPIC_LIST"), $arParams["PAGE_NAVIGATION_TEMPLATE"]);
while ($res = $rsTopics->GetNext()) {
    if (!$USER->IsAuthorized()) {
        $res["PERMISSION"] = ForumCurrUserPermissions($res["FORUM_ID"]);
        //	elseif ($res["PERMISSION"] >= "Q"):
    }
    /*******************************************************************/
    $res["URL"] = array("TOPIC" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_READ"], array("FID" => $res["FORUM_ID"], "TID" => $res["ID"], "TITLE_SEO" => $res["TITLE_SEO"], "MID" => "s")), "~TOPIC" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_READ"], array("FID" => $res["FORUM_ID"], "TID" => $res["ID"], "TITLE_SEO" => $res["TITLE_SEO"], "MID" => "s")), "LAST_MESSAGE" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE"], array("FID" => $res["FORUM_ID"], "TID" => $res["ID"], "TITLE_SEO" => $res["TITLE_SEO"], "MID" => intVal($res["LAST_MESSAGE_ID"]))), "~LAST_MESSAGE" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_MESSAGE"], array("FID" => $res["FORUM_ID"], "TID" => $res["ID"], "TITLE_SEO" => $res["TITLE_SEO"], "MID" => intVal($res["LAST_MESSAGE_ID"]))), "MESSAGE_UNREAD" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE"], array("FID" => $res["FORUM_ID"], "TID" => $res["ID"], "TITLE_SEO" => $res["TITLE_SEO"], "MID" => "unread_mid")), "~MESSAGE_UNREAD" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_MESSAGE"], array("FID" => $res["FORUM_ID"], "TID" => $res["ID"], "TITLE_SEO" => $res["TITLE_SEO"], "MID" => "unread_mid")), "USER_START" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_PROFILE_VIEW"], array("UID" => $res["USER_START_ID"])), "~USER_START" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_PROFILE_VIEW"], array("UID" => $res["USER_START_ID"])), "LAST_POSTER" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_PROFILE_VIEW"], array("UID" => $res["LAST_POSTER_ID"])), "~LAST_POSTER" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_PROFILE_VIEW"], array("UID" => $res["LAST_POSTER_ID"])));
    $res["TopicStatus"] = "NEW";
    /*******************************************************************/
    if ($res["PERMISSION"] >= "Q") {
Ejemplo n.º 5
0
                        $ex = $APPLICATION->GetException();
                        if ($ex && ($err = $ex->GetString())) {
                            $lAdmin->AddUpdateError($err, $ID);
                        } else {
                            $lAdmin->AddUpdateError(GetMessage("FM_WRONG_UPDATE"), $ID);
                        }
                    }
                    break;
            }
        }
    }
    if (!empty($sError)) {
        $lAdmin->AddFilterError($sError);
    }
}
$rsData = CForumTopic::GetListEx(array($by => $order), $arFilter, false, 0, array("NoFilter" => true));
$rsData = new CAdminResult($rsData, $sTableID);
$rsData->NavStart();
$lAdmin->NavText($rsData->GetNavPrint(GetMessage("FM_TOPICS")));
/*******************************************************************/
$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" => "DESCRIPTION", "content" => GetMessage("FM_TITLE_DESCRIPTION"), "sort" => "DESCRIPTION", "default" => false), array("id" => "STATE", "content" => GetMessage("FM_TITLE_STATE"), "sort" => "STATE", "default" => true), array("id" => "APPROVED", "content" => GetMessage("FM_TITLE_APPROVED"), "sort" => "APPROVED", "default" => true), array("id" => "SORT", "content" => GetMessage("FM_TITLE_SORT"), "sort" => "SORT", "default" => true), array("id" => "USER_START_NAME", "content" => GetMessage("FM_TITLE_AUTHOR"), "sort" => "USER_START_NAME", "default" => true), array("id" => "START_DATE", "content" => GetMessage("FM_TITLE_DATE_CREATE"), "sort" => "START_DATE", "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_NAME", "default" => true), array("id" => "LAST_POST_DATE", "content" => GetMessage("FM_TITLE_LAST_MESSAGE"), "sort" => "LAST_POST_DATE", "default" => false)));
/*******************************************************************/
while ($res = $rsData->NavNext(true, "t_")) {
    $row =& $lAdmin->AddRow($t_ID, $res);
    $bCanUpdateForum = CForumTopic::CanUserUpdateTopic($t_ID, $USER->GetUserGroupArray(), $USER->GetID());
    $bCanDeleteForum = CForumTopic::CanUserDeleteTopic($t_ID, $USER->GetUserGroupArray(), $USER->GetID());
    $row->bReadOnly = !$bCanUpdateForum || !$bCanDeleteForum ? true : false;
    $row->AddField("ID", $t_ID);
    $row->AddInputField("TITLE", array("size" => "35"));
    $row->AddInputField("DESCRIPTION", array("size" => "35"));
    if ($t_STATE != "L") {
Ejemplo n.º 6
0
        $res["URL"] = array("TOPIC" => $res["read"], "FORUM" => $res["list"], "LAST_MESSAGE" => $res["read_last_send"], "DELETE" => $res["subscr_delete"]);
        $arResult["SUBSCRIBE_LIST"][] = $res;
    } while ($res = $db_res->GetNext());
}
if (!empty($arResult["~FORUMS"])) {
    $arResult["~FORUMS"] = array_unique($arResult["~FORUMS"]);
    $db_res = CForumNew::GetListEx(array("SORT" => "ASC"), array("@ID" => $arResult["~FORUMS"]));
    if ($db_res && ($res = $db_res->GetNext())) {
        do {
            $arResult["FORUMS"][$res["ID"]] = $res;
        } while ($res = $db_res->GetNext());
    }
}
if (!empty($arResult["~TOPICS"])) {
    $arResult["~TOPICS"] = array_unique(array_diff($arResult["~TOPICS"], array(0, "")));
    $db_res = CForumTopic::GetListEx(array("SORT" => "ASC"), array("@ID" => $arResult["~TOPICS"]));
    if ($db_res && ($res = $db_res->GetNext())) {
        do {
            $arResult["TOPICS"][$res["ID"]] = $res;
        } while ($res = $db_res->GetNext());
    }
}
foreach ($arResult["SUBSCRIBE_LIST"] as $key => $res) {
    $arResult["SUBSCRIBE_LIST"][$key]["FORUM_INFO"] = $arResult["FORUMS"][$res["FORUM_ID"]];
    $arResult["SUBSCRIBE_LIST"][$key]["TOPIC_INFO"] = $arResult["TOPICS"][$res["TOPIC_ID"]];
}
/********************************************************************
				/Data
********************************************************************/
/*******************************************************************/
$this->IncludeComponentTemplate();
Ejemplo n.º 7
0
				Data
********************************************************************/
$arFilter = array("SOCNET_GROUP_ID" => false);
if ($arParams["PERMISSION"] < "Q") {
    $arFilter["APPROVED"] = "Y";
}
if ($USER->IsAuthorized()) {
    $arFilter["USER_ID"] = $USER->GetID();
}
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::GetListEx(array("SORT" => "ASC", $by => $order), $arFilter, false, false, array("bDescPageNumbering" => $arParams["USE_DESC_PAGE"] == "Y" ? true : false, "nPageSize" => $arParams["TOPICS_PER_PAGE"], "bShowAll" => false, "sNameTemplate" => $arParams["NAME_TEMPLATE"]));
$db_res->NavStart($arParams["TOPICS_PER_PAGE"], false);
//******************************************************************/
$arResult["NAV_RESULT"] = $db_res;
$arResult["NAV_STRING"] = $db_res->GetPageNavStringEx($navComponentObject, GetMessage("F_TOPIC_LIST"), $arParams["PAGE_NAVIGATION_TEMPLATE"]);
while ($res = $db_res->GetNext()) {
    $res["STATUS"] = "OLD";
    if ($res["APPROVED"] != "Y") {
        $res["STATUS"] = "NA";
    } elseif ($res["STATE"] == "L") {
        $res["STATUS"] = "MOVED";
        $res["URL"]["READ"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_TOPIC"], array("FID" => $res["FORUM_ID"], "TID" => $res["TOPIC_ID"], "MID" => "s"));
    } elseif (NewMessageTopic($res["FORUM_ID"], $res["ID"], $arParams["PERMISSION"] < "Q" ? $res["LAST_POST_DATE"] : $res["ABS_LAST_POST_DATE"], $res["LAST_VISIT"])) {
        $res["STATUS"] = "NEW";
    }
    $res["TopicStatus"] = $res["STATUS"];
Ejemplo n.º 8
0
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;
}
Ejemplo n.º 9
0
        }
        if ($NUM <= 0 || $NUM > 100) {
            $NUM = 100;
        }
        if ($ORDER_BY != "TITLE" && $ORDER_BY != "POSTS" && $ORDER_BY != "USER_START_NAME" && $ORDER_BY != "VIEWS" && $ORDER_BY != "START_DATE") {
            $ORDER_BY = "LAST_POST_DATE";
        }
        if ($ORDER_DIRECTION != "ASC") {
            $ORDER_DIRECTION = "DESC";
        }
        $arOrder = array($ORDER_BY => $ORDER_DIRECTION);
        $arFilter = array("APPROVED" => "Y");
        if ($FID > 0) {
            $arFilter["FORUM_ID"] = $FID;
        }
        $db_Topic = CForumTopic::GetListEx($arOrder, $arFilter, false, $NUM > 0 ? $NUM : false);
        $ind = 0;
        while ($ar_Topic = $db_Topic->Fetch()) {
            $ind++;
            if ($NUM > 0 && $ind > $NUM) {
                break;
            }
            ?>
		<font class="text">
		<img src="/bitrix/templates/.default/forum/forum_pieces/images/news_bullet.gif" width="3" height="5" border="0">&nbsp;<a href="<?php 
            echo $PATH2MESSAGES . (strpos($PATH2MESSAGES, "?") !== false ? "&amp;" : "?") . "FID=" . $ar_Topic["FORUM_ID"] . "&amp;TID=" . $ar_Topic["ID"];
            ?>
"><?php 
            echo htmlspecialcharsEx($ar_Topic["TITLE"]);
            ?>
</a>
Ejemplo n.º 10
0
}
/********************************************************************
				Default params
********************************************************************/
$by = $arParams["SORT_BY"];
$order = $arParams["SORT_ORDER"];
$by = $by == "LAST_POST_DATE" && $arParams["PERMISSION"] >= "Q" ? "ABS_LAST_POST_DATE" : "LAST_POST_DATE";
$arResult["Topics"] = array();
$arFilter = array("FORUM_ID" => $arParams["FID"], "APPROVED" => "Y", "STATE" => "Y", "SOCNET_GROUP_ID" => false);
if ($arParams["MODE"] == "GROUP") {
    $arFilter["SOCNET_GROUP_ID"] = $arParams["SOCNET_GROUP_ID"];
} else {
    $arFilter["OWNER_ID"] = $arParams["USER_ID"];
}
$bFirst = true;
$db_res = CForumTopic::GetListEx(array($by => $order), $arFilter, false, false, array("nTopCount" => $arParams["TOPICS_COUNT"]));
while ($arTopic = $db_res->GetNext()) {
    if ($bFirst) {
        $arTopic["FIRST"] = "Y";
        $bFirst = false;
    }
    $arTopic["read"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_TOPIC"], array("TID" => $arTopic["ID"], "UID" => $arParams["USER_ID"], "GID" => $arParams["SOCNET_GROUP_ID"]));
    $arTopic["read_last_message"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE"], array("TID" => $arTopic["ID"], "MID" => intVal($arTopic["LAST_MESSAGE_ID"]), "UID" => $arParams["USER_ID"], "GID" => $arParams["SOCNET_GROUP_ID"]));
    if (intVal($arTopic["LAST_POSTER_ID"]) > 0) {
        $arTopic["LAST_POSTER_HREF"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_USER"], array("UID" => $arTopic["LAST_POSTER_ID"]));
    }
    // ********************************************************************
    $arTopic["numMessages"] = $arTopic["POSTS"] + 1;
    if (strLen(trim($arTopic["LAST_POST_DATE"])) > 0) {
        $arTopic["LAST_POST_DATE"] = CForumFormat::DateFormat($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($arTopic["LAST_POST_DATE"], CSite::GetDateFormat()));
    }
Ejemplo n.º 11
0
        $arResult["TOPIC"]["~TITLE"] = $arResult["TOPIC"]["TITLE"];
        $arResult["TOPIC"]["TITLE"] = Cutil::JSEscape($arResult["TOPIC"]["TITLE"]);
        $arResult["TOPIC"]["LINK"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_READ"], array("FID" => $arResult["FORUM"]["ID"], "TID" => $arResult["TOPIC"]["ID"], "MID" => "s"));
        $arResult["FORUM"]["LINK"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_LIST"], array("FID" => $arResult["FORUM"]["ID"]));
    }
} elseif (strlen($_REQUEST["search_template"]) > 0) {
    $arFilter = array("@FORUM_ID" => array_keys($arResult["FORUMS"]));
    if (intVal($_REQUEST["FID"]) > 0) {
        $arFilter["FORUM_ID"] = intVal($_REQUEST["FID"]);
    }
    if ($_REQUEST["search_field"] == "title" || $_REQUEST["search_field"] == "description") {
        $arFilter[strToUpper($_REQUEST["search_field"])] = $_REQUEST["search_template"];
    } else {
        $arFilter["TITLE_ALL"] = $_REQUEST["search_template"];
    }
    $db_res = CForumTopic::GetListEx(array("ID" => "DESC"), $arFilter);
    $db_res->NavStart($arParams["TOPICS_PER_PAGE"]);
    $db_res->bShowAll = false;
    $db_res->nPageWindow = $arParams["PAGE_NAVIGATION_WINDOW"];
    $arResult["NAV_RESULT"] = $db_res;
    $arResult["NAV_STRING"] = $db_res->GetPageNavStringEx($navComponentObject, " ", $arParams["PAGE_NAVIGATION_TEMPLATE"]);
    if ($db_res && ($res = $db_res->GetNext())) {
        do {
            $res["topic_id_search"] = ForumAddPageParams($arResult["CURRENT_PAGE"], array("TID" => $res["ID"]));
            $arResult["TOPICS"][] = $res;
        } while ($res = $db_res->GetNext());
    }
}
/************** For custom templates *******************************/
$arResult["FORUMS_LIST"] = array("data" => $arResult["FORUMS"], "active" => $arResult["FID"]);
if (!empty($arResult["TOPICS"])) {
Ejemplo n.º 12
0
    } elseif ($ORDER_BY == "D") {
        $strOrderBy = "START_DATE";
    } else {
        $strOrderBy = "LAST_POST_DATE";
    }
    if (strtoupper($ORDER_DIRECTION) == "ASC") {
        $strOrderDir = "ASC";
    } else {
        $strOrderDir = "DESC";
    }
    $arOrder = array("SORT" => "ASC", $strOrderBy => $strOrderDir);
    $arFilter = array("FORUM_ID" => $FID);
    if (ForumCurrUserPermissions($FID) < "Q") {
        $arFilter["APPROVED"] = "Y";
    }
    $db_Topic = CForumTopic::GetListEx($arOrder, $arFilter);
    $db_Topic->NavStart($GLOBALS["FORUM_TOPICS_PER_PAGE"]);
    ?>
<table width="100%" border="0">
	<tr>
		<td align="left">
			<?php 
    echo $db_Topic->NavPrint("Темы");
    ?>
		</td>
		<td align="right">
			<?php 
    if (CForumTopic::CanUserAddTopic($FID, $USER->GetUserGroupArray(), $USER->GetID())) {
        ?>
				<a href="new_topic.php?FID=<?php 
        echo $FID;