Ejemplo n.º 1
0
$arResult["CURRENT_PAGE"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_PM_SEARCH"], array());
// *****************************************************************************************
$arResult["sessid"] = bitrix_sessid_post();
$arResult["SITE_CHARSET"] = SITE_CHARSET;
// *****************************************************************************************
$arResult["~search_template"] = trim($_REQUEST["search_template"]);
if (!empty($arResult["~search_template"])) {
    $arResult["~search_template"] = preg_replace("/[%]+/", "%", "%" . str_replace("*", "%", $arResult["~search_template"]) . "%");
}
$arResult["search_template"] = htmlspecialcharsEx($_REQUEST["search_template"]);
// *****************************************************************************************
$arResult["SHOW_SEARCH_RESULT"] = "N";
$arResult["SEARCH_RESULT"] = array();
if (!empty($arResult["~search_template"]) && $arResult["~search_template"] != "%") {
    $arResult["SHOW_SEARCH_RESULT"] = "Y";
    $reqSearch = CForumUser::SearchUser($arResult["~search_template"], array("bDescPageNumbering" => false, "bShowAll" => false, "nPageSize" => $arParams["PM_USER_PAGE"], "sNameTemplate" => $arParams["NAME_TEMPLATE"]));
    $reqSearch->NavStart($arParams["PM_USER_PAGE"], false);
    $arResult["NAV_RESULT"] = $reqSearch;
    $arResult["NAV_STRING"] = $reqSearch->GetPageNavStringEx($navComponentObject, GetMessage("PM_SEARCH_RESULT"), $arParams["PAGE_NAVIGATION_TEMPLATE"]);
    if ($reqSearch && ($res = $reqSearch->GetNext())) {
        do {
            $arResult["SEARCH_RESULT"][] = array_merge(array("link" => ForumAddPageParams($arResult["CURRENT_PAGE"], array("search_insert" => "Y", "UID" => intVal($res["ID"]), "sessid" => bitrix_sessid()))), $res);
        } while ($res = $reqSearch->GetNext());
    }
}
$arResult["SHOW_SELF_CLOSE"] = "N";
if ($_REQUEST["search_insert"] == "Y" && intval($UID) > 0 || !empty($_REQUEST["search_by_login"])) {
    if (empty($_REQUEST["search_by_login"])) {
        $db_res = CForumUser::GetList(array(), array("USER_ID" => $UID, "SHOW_ABC" => ""), array("sNameTemplate" => $arParams["NAME_TEMPLATE"]));
        if ($db_res && ($res = $db_res->GetNext())) {
            $arResult["SHOW_SELF_CLOSE"] = "Y";
Ejemplo n.º 2
0
$arResult["CURRENT_PAGE"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_PM_SEARCH"], array());
// *****************************************************************************************
$arResult["sessid"] = bitrix_sessid_post();
$arResult["SITE_CHARSET"] = SITE_CHARSET;
// *****************************************************************************************
$arResult["~search_template"] = trim($_REQUEST["search_template"]);
if (!empty($arResult["~search_template"])) {
    $arResult["~search_template"] = preg_replace("/[%]+/", "%", "%" . str_replace("*", "%", $arResult["~search_template"]) . "%");
}
$arResult["search_template"] = htmlspecialcharsEx($_REQUEST["search_template"]);
// *****************************************************************************************
$arResult["SHOW_SEARCH_RESULT"] = "N";
$arResult["SEARCH_RESULT"] = array();
if (!empty($arResult["~search_template"]) && $arResult["~search_template"] != "%") {
    $arResult["SHOW_SEARCH_RESULT"] = "Y";
    $reqSearch = CForumUser::SearchUser($arResult["~search_template"], array("sNameTemplate" => $arParams["NAME_TEMPLATE"]));
    $reqSearch->NavStart($arParams["PM_USER_PAGE"], false);
    $arResult["NAV_RESULT"] = $reqSearch;
    $arResult["NAV_STRING"] = $reqSearch->GetPageNavStringEx($navComponentObject, GetMessage("PM_SEARCH_RESULT"), $arParams["PAGE_NAVIGATION_TEMPLATE"]);
    if ($reqSearch && ($res = $reqSearch->GetNext())) {
        do {
            $arResult["SEARCH_RESULT"][] = array_merge(array("link" => ForumAddPageParams($arResult["CURRENT_PAGE"], array("search_insert" => "Y", "UID" => intVal($res["ID"]), "sessid" => bitrix_sessid()))), $res);
        } while ($res = $reqSearch->GetNext());
    }
}
$arResult["SHOW_SELF_CLOSE"] = "N";
if ($_REQUEST["search_insert"] == "Y" && intval($UID) > 0 || !empty($_REQUEST["search_by_login"])) {
    if (empty($_REQUEST["search_by_login"])) {
        $db_res = CForumUser::GetList(array(), array("USER_ID" => $UID, "SHOW_ABC" => ""), array("sNameTemplate" => $arParams["NAME_TEMPLATE"]));
        if ($db_res && ($res = $db_res->GetNext())) {
            $arResult["SHOW_SELF_CLOSE"] = "Y";