當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CForumUser::GetByUSER_IDEx方法代碼示例

本文整理匯總了PHP中CForumUser::GetByUSER_IDEx方法的典型用法代碼示例。如果您正苦於以下問題:PHP CForumUser::GetByUSER_IDEx方法的具體用法?PHP CForumUser::GetByUSER_IDEx怎麽用?PHP CForumUser::GetByUSER_IDEx使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CForumUser的用法示例。


在下文中一共展示了CForumUser::GetByUSER_IDEx方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: SetStat

 public static function SetStat($USER_ID = 0, $arParams = array())
 {
     $USER_ID = intVal($USER_ID);
     if ($USER_ID <= 0) {
         return 0;
     }
     $bNeedCreateUser = false;
     $arUser = array();
     $arUserFields = array();
     $arParams = is_array($arParams) ? $arParams : array();
     $arMessage = is_array($arParams["MESSAGE"]) ? $arParams["MESSAGE"] : array();
     $arMessage = $arMessage["AUTHOR_ID"] != $USER_ID ? array() : $arMessage;
     if (!empty($arMessage)) {
         $arParams["ACTION"] = $arParams["ACTION"] == "DECREMENT" || $arParams["ACTION"] == "UPDATE" ? $arParams["ACTION"] : "INCREMENT";
         if ($arParams["ACTION"] == "UPDATE") {
             $arParams["ACTION"] = $arMessage["APPROVED"] == "Y" ? "INCREMENT" : "DECREMENT";
             $arMessage["APPROVED"] = "Y";
         }
         $arParams["POSTS"] = intVal($arParams["POSTS"] > 0 ? $arParams["POSTS"] : 1);
         $arUser = CForumUser::GetByUSER_ID($USER_ID);
     }
     if (empty($arMessage)) {
         // full recount;
     } elseif ($arMessage["APPROVED"] != "Y") {
         return true;
     } elseif (empty($arUser)) {
         $bNeedCreateUser = true;
         // full recount;
     } elseif ($arParams["ACTION"] == "DECREMENT" && $arMessage["ID"] >= $arUser["LAST_POST"]) {
         // full recount;
     } elseif ($arParams["ACTION"] == "DECREMENT") {
         $arUserFields = array("=NUM_POSTS" => "NUM_POSTS-" . $arParams["POSTS"], "POINTS" => intVal(CForumUser::GetUserPoints($USER_ID, array("DECREMENT" => $arParams["POSTS"]))));
     } elseif ($arParams["ACTION"] == "INCREMENT" && $arMessage["ID"] < $arUser["LAST_POST"]) {
         $arUserFields = array("=NUM_POSTS" => "NUM_POSTS+" . $arParams["POSTS"], "POINTS" => intVal(CForumUser::GetUserPoints($USER_ID, array("INCREMENT" => $arParams["POSTS"]))));
     } elseif ($arParams["ACTION"] == "INCREMENT") {
         $arUserFields["IP_ADDRESS"] = $arMessage["AUTHOR_IP"];
         $arUserFields["REAL_IP_ADDRESS"] = $arMessage["AUTHOR_REAL_IP"];
         $arUserFields["LAST_POST"] = intVal($arMessage["ID"]);
         $arUserFields["LAST_POST_DATE"] = $arMessage["POST_DATE"];
         $arUserFields["=NUM_POSTS"] = "NUM_POSTS+" . $arParams["POSTS"];
         $arUserFields["POINTS"] = intVal(CForumUser::GetUserPoints($USER_ID, array("INCREMENT" => $arParams["POSTS"])));
     }
     if (empty($arUserFields)) {
         $arUserFields = array("LAST_POST" => false, "LAST_POST_DATE" => false);
         if ($bNeedCreateUser == false) {
             $arUser = CForumUser::GetByUSER_IDEx($USER_ID);
         }
         if (empty($arUser) || $bNeedCreateUser == true) {
             $bNeedCreateUser = true;
             $arUser = CForumMessage::GetList(array(), array("AUTHOR_ID" => $USER_ID, "APPROVED" => "Y"), "cnt_and_last_mid");
             $arUser = is_array($arUser) ? $arUser : array();
         }
         $arMessage = CForumMessage::GetByID($arUser["LAST_MESSAGE_ID"], array("FILTER" => "N"));
         if ($arMessage) {
             $arUserFields["IP_ADDRESS"] = $arMessage["AUTHOR_IP"];
             $arUserFields["REAL_IP_ADDRESS"] = $arMessage["AUTHOR_REAL_IP"];
             $arUserFields["LAST_POST"] = intVal($arMessage["ID"]);
             $arUserFields["LAST_POST_DATE"] = $arMessage["POST_DATE"];
         }
         $arUserFields["NUM_POSTS"] = intVal($arUser["CNT"]);
         $arUserFields["POINTS"] = intVal(CForumUser::GetUserPoints($USER_ID, array("NUM_POSTS" => $arUserFields["NUM_POSTS"])));
     }
     if ($bNeedCreateUser) {
         $arUserFields["USER_ID"] = $USER_ID;
         $arUser = CForumUser::Add($arUserFields);
     } else {
         CForumUser::Update($USER_ID, $arUserFields, false, true);
     }
     return $USER_ID;
 }
開發者ID:rasuldev,項目名稱:torino,代碼行數:70,代碼來源:user.php

示例2: ForumAddMessage


//.........這裏部分代碼省略.........
            } elseif (!CForumFiles::CheckFields($arFieldsG["FILES"], $res, "NOT_CHECK_DB")) {
                if ($ex = $APPLICATION->GetException()) {
                    $aMsg[] = array("id" => "FILE", "text" => $ex->GetString());
                } else {
                    $aMsg[] = array("id" => "FILE", "text" => "File upload error.");
                }
            }
        }
    }
    //*************************/ATTACH_IMG*****************************************************************************
    if (empty($aMsg) && ($MESSAGE_TYPE == "NEW" || $MESSAGE_TYPE == "REPLY")) {
        $AUTHOR_ID = IntVal($USER->GetParam("USER_ID"));
        if ($USER->IsAuthorized()) {
            $res = CForumUser::GetByUSER_ID($USER->GetID());
            $bSHOW_NAME = !empty($res) ? $res["SHOW_NAME"] == "Y" : true;
            $arFieldsG["AUTHOR_NAME"] = $bSHOW_NAME ? trim($USER->GetFullName()) : "";
            $arFieldsG["AUTHOR_NAME"] = !empty($arFieldsG["AUTHOR_NAME"]) ? $arFieldsG["AUTHOR_NAME"] : $USER->GetLogin();
        }
        if (empty($arFieldsG["AUTHOR_NAME"])) {
            $aMsg[] = array("id" => "AUTHOR_NAME", "text" => GetMessage("ADDMESS_INPUT_AUTHOR") . ".");
        }
    } elseif (empty($aMsg) && $MESSAGE_TYPE == "EDIT") {
        $AUTHOR_ID = IntVal($arMessage["AUTHOR_ID"]);
        if (is_set($arFieldsG, "AUTHOR_NAME") && empty($arFieldsG["AUTHOR_NAME"])) {
            if ($AUTHOR_ID <= 0) {
                $aMsg[] = array("id" => "AUTHOR_NAME", "text" => GetMessage("ADDMESS_INPUT_AUTHOR") . ".");
            } else {
                $res = CForumUser::GetByUSER_ID($AUTHOR_ID);
                $bSHOW_NAME = !empty($res) ? $res["SHOW_NAME"] == "Y" : true;
                if ($USER->GetID() == $AUTHOR_ID) {
                    $arFieldsG["AUTHOR_NAME"] = $bSHOW_NAME ? trim($USER->GetFullName()) : "";
                    $arFieldsG["AUTHOR_NAME"] = !empty($arFieldsG["AUTHOR_NAME"]) ? $arFieldsG["AUTHOR_NAME"] : $USER->GetLogin();
                } else {
                    $res = CForumUser::GetByUSER_IDEx($AUTHOR_ID);
                    if ($res) {
                        $arFieldsG["AUTHOR_NAME"] = trim($bSHOW_NAME ? $res["NAME"] . " " . $res["LAST_NAME"] : "");
                        $arFieldsG["AUTHOR_NAME"] = !empty($arFieldsG["AUTHOR_NAME"]) ? $arFieldsG["AUTHOR_NAME"] : $res["LOGIN"];
                    } else {
                        unset($arFieldsG["AUTHOR_NAME"]);
                    }
                }
            }
        }
        if ($USER->IsAuthorized()) {
            $res = CForumUser::GetByUSER_ID($USER->GetID());
            $bSHOW_NAME = !empty($res) ? $res["SHOW_NAME"] == "Y" : true;
            $arFieldsG["EDITOR_NAME"] = $bSHOW_NAME ? trim($USER->GetFullName()) : "";
            $arFieldsG["EDITOR_NAME"] = !empty($arFieldsG["EDITOR_NAME"]) ? $arFieldsG["EDITOR_NAME"] : $USER->GetLogin();
        }
        if ($bAddEditNote && empty($arFieldsG["EDITOR_NAME"])) {
            $aMsg[] = array("id" => "EDITOR_NAME", "text" => GetMessage("ADDMESS_INPUT_EDITOR") . ".");
        }
    }
    //*************************/Input params ***************************************************************************
    //************************* Actions ********************************************************************************
    //************************* Add/edit topic *************************************************************************
    if (empty($aMsg)) {
        // The longest step by time. Actualization of topic, user and forum statistic info (~0.7-0.8 sec)
        if ($MESSAGE_TYPE == "EDIT" && ($arMessage["APPROVED"] == "Y" || $arMessage["APPROVED"] == "N")) {
            $arFieldsG["APPROVED"] = $arMessage["APPROVED"];
        } elseif (!empty($arTopic) && $arTopic["APPROVED"] != "Y") {
            $arFieldsG["APPROVED"] = "N";
        } else {
            $arFieldsG["APPROVED"] = $arForum["MODERATION"] == "Y" ? "N" : "Y";
            if (ForumCurrUserPermissions($FID, $arParams) >= "Q") {
                $arFieldsG["APPROVED"] = "Y";
開發者ID:DarneoStudio,項目名稱:bitrix,代碼行數:67,代碼來源:include.php


注:本文中的CForumUser::GetByUSER_IDEx方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。