当前位置: 首页>>代码示例>>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;未经允许,请勿转载。