コード例 #1
0
ファイル: component.php プロジェクト: mrdeadmouse/u136006
        $arUserPerm[] = CForumNew::GetUserPermission($res["ID"], $arUserGroup);
    } while ($res = $db_res->GetNext());
}
rsort($arUserPerm);
$arRank = CForumUser::GetUserRank($arParams["UID"], LANGUAGE_ID);
list($arResult["USER_RANK_CODE"], $arResult["USER_RANK"]) = ForumGetUserForumStatus($arParams["UID"], $arUserPerm[0], array("Rank" => $arRank));
$arResult["SHOW_POINTS"] = "N";
$arResult["arRank"] = array_merge(is_array($arRank) ? $arRank : array(), array("NAME" => $arResult["USER_RANK"]));
if ($USER->IsAuthorized() && (CForumUser::IsAdmin() || intval($USER->GetID()) == $arParams["UID"])) {
    $arResult["SHOW_POINTS"] = "Y";
    $arResult["USER_POINTS"] = !empty($arRank["VOTES"]) ? intval($arRank["VOTES"]) : GetMessage("F_NO_VOTES");
}
/*******************************************************************/
$arResult["arTopic"] = "N";
if (!empty($arResult["FORUMS"])) {
    $db_res = CForumUser::UserAddInfo(array("LAST_POST" => "DESC"), array("AUTHOR_ID" => $arParams["UID"], "@FORUM_ID" => array_keys($arResult["FORUMS"])), "topics");
    if ($db_res && ($res = $db_res->GetNext())) {
        $res["TITLE"] = $parser->wrap_long_words($res["TITLE"]);
        $res["DESCRIPTION"] = $parser->wrap_long_words($res["DESCRIPTION"]);
        $res["LAST_POST_DATE"] = CForumFormat::DateFormat($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($res["LAST_POST_DATE"], CSite::GetDateFormat()));
        $arResult["arTopic"] = array_merge($res, array("read" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE"], array("FID" => $res["FORUM_ID"], "TID" => $res["TOPIC_ID"], "TITLE_SEO" => $res["TITLE_SEO"], "MID" => intval($res["LAST_POST"]))) . "#message" . intval($res["LAST_POST"])));
    }
}
/************** User properties ************************************/
$arResult["USER_PROPERTIES"] = array("SHOW" => "N");
if (!empty($arParams["USER_PROPERTY"])) {
    $arUserFields = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("USER", $arParams["UID"], LANGUAGE_ID);
    if (count($arParams["USER_PROPERTY"]) > 0) {
        foreach ($arUserFields as $FIELD_NAME => $arUserField) {
            if (!in_array($FIELD_NAME, $arParams["USER_PROPERTY"])) {
                continue;
コード例 #2
0
             $main[$arForum["ID"]]["TOPIC"][$arTopic["ID"]]["MESSAGE"][] = CForumMessage::GetByID($arTopic["FIRST_POST"]);
             // User
             $main[$arForum["ID"]]["TOPIC"][$arTopic["ID"]]["USER_PERM_DELETE"] = ForumCurrUserPermissions($arTopic["FORUM_ID"]) < "U" ? false : true;
             $main[$arForum["ID"]]["TOPIC"][$arTopic["ID"]]["LAST_TOPIC_MESSAGE"] = false;
             $main[$arForum["ID"]]["NUM_POSTS_ALL"] += intVal($arTopic["COUNT_MESSAGE"]);
         } while ($arTopic = $db_topics->GetNext());
     }
     $db_topics->NavPrint(GetMessage("LU_TITLE_TOPIC"));
     PrintMessages($main, $arUser);
     $db_topics->NavPrint(GetMessage("LU_TITLE_TOPIC"));
     break;
 case "all":
     // »нформаци¤ о пользователе 1 запрос
     $arUser = CForumUser::GetListEx(array(), array("USER_ID" => $UID));
     $arUser = $arUser->GetNext();
     $db_topics = CForumUser::UserAddInfo(array("FORUM_ID" => "ASC"), array("AUTHOR_ID" => $UID), "topics");
     $arForum_posts = array();
     $arTopic_posts = array();
     $FilterMess = array();
     $arTopics_info = array();
     if ($db_topics) {
         while ($res = $db_topics->Fetch()) {
             $arTopic_posts[$res["TOPIC_ID"]] = $res["COUNT_MESSAGE"];
             $arForum_posts[$res["FORUM_ID"]] += intVal($res["COUNT_MESSAGE"]);
             $arTopics_info[$res["TOPIC_ID"]] = $res;
             $arTopics_info[$res["TOPIC_ID"]]["ID"] = $res["TOPIC_ID"];
             $strPerms = ForumCurrUserPermissions($res["FORUM_ID"]);
             $FilterMess[] = $strPerms < "Q" ? array("TOPIC_ID" => $res["TOPIC_ID"], "APPROVED" => "Y") : array("TOPIC_ID" => $res["TOPIC_ID"]);
             $arTopics_info[$res["TOPIC_ID"]]["USER_PERM_DELETE"] = $strPerms < "U" ? false : true;
         }
     }
コード例 #3
0
ファイル: component.php プロジェクト: spas-viktor/books
             $props = array_intersect_key($res, array_flip($arParams["USER_FIELDS"]));
             $arResult["MESSAGE_LIST"][$res["ID"]]["PROPS"] = $topics[$res["TOPIC_ID"]]["MESSAGES"][$res["ID"]]["PROPS"] = $props;
             $arResult["MESSAGE_LIST"][$res["ID"]]["ALLOW"] = array_merge($arResult["MESSAGE_LIST"][$res["ID"]]["ALLOW"], array("USERFIELDS" => $props));
         }
     }
     /************** Message info ***************************************/
     /* This is needed for parsing attachments in text such as [file=ID]*/
     /* And second loop whith messages array is more economy-way ********/
     $arResult["PARSER"]->arFiles = $arResult["FILES"];
     foreach ($arResult["MESSAGE_LIST"] as $iID => $res) {
         $topics[$res["TOPIC_ID"]]["MESSAGES"][$iID]["POST_MESSAGE_TEXT"] = $arResult["MESSAGE_LIST"][$iID]["POST_MESSAGE_TEXT"] = $arResult["PARSER"]->convert($res["~POST_MESSAGE_TEXT"], $res["ALLOW"]);
     }
 }
 /************** Message List/***************************************/
 if (!empty($arTopicNeeded)) {
     $db_res = CForumUser::UserAddInfo(array(), array("@TOPIC_ID" => implode(",", $arTopicNeeded), "AUTHOR_ID" => $arParams["UID"]), false, false, false);
     if ($db_res && ($res = $db_res->GetNext())) {
         do {
             $arTopics[$res["TOPIC_ID"]] = $res;
         } while ($res = $db_res->GetNext());
     }
 }
 foreach ($topics as $topic_id => $res) {
     $forum_id = intval($arTopics[$topic_id]["FORUM_ID"]);
     if (!array_key_exists($forum_id, $forums)) {
         $UserPermStr = "";
         $UserPermCode = "";
         $UserPerm = CForumNew::GetUserPermission($forum_id, $arResult["USER"]["GROUPS"]);
         list($UserPermCode, $UserPermStr) = ForumGetUserForumStatus($arParams["UID"], $UserPerm, $arResult["USER"]["RANK"]);
         $forums[$forum_id] = array_merge($arResult["FORUMS_ALL"][$forum_id], array("NUM_POSTS_ALL" => $arForum_posts[$forum_id], "PERMISSION" => $UserPerm, "USER_PERM" => $UserPerm, "AUTHOR_STATUS" => $UserPermStr, "USER_PERM_STR" => $UserPermStr, "AUTHOR_STATUS_CODE" => $UserPermCode, "TOPICS" => array()));
     }
コード例 #4
0
        echo GetMessage("FV_DATE_VISIT");
        ?>
</td>
			<td class="forumbodytext" width="30%"><?php 
        echo $fu_LAST_VISIT;
        ?>
&nbsp;</td>
		</tr>
		<tr valign="top" class="forumbody">
			<td class="forumbodytext" width="20%" style=""><?php 
        echo GetMessage("FV_LAST_MESSAGE");
        ?>
</td>
			<td class="forumbodytext" width="30%"><?php 
        $arFilter = array("AUTHOR_ID" => $UID);
        $arTopic = CForumUser::UserAddInfo(array("ID" => "DESC"), array("AUTHOR_ID" => $UID), "topics");
        if ($arTopic) {
            if ($arTopic = $arTopic->GetNext()) {
                echo $arTopic["LAST_POST_DATE"];
                ?>
<br><?php 
                echo GetMessage("FV_IN_TOPIC");
                ?>
: <?php 
                ?>
<a href="read.php?TID=<?php 
                echo $arTopic["TOPIC_ID"];
                ?>
&MID=<?php 
                echo $arTopic["LAST_POST"];
                ?>