当前位置: 首页>>代码示例>>PHP>>正文


PHP CForumUser::Update方法代码示例

本文整理汇总了PHP中CForumUser::Update方法的典型用法代码示例。如果您正苦于以下问题:PHP CForumUser::Update方法的具体用法?PHP CForumUser::Update怎么用?PHP CForumUser::Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CForumUser的用法示例。


在下文中一共展示了CForumUser::Update方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Add

 public static function Add($arFields)
 {
     global $DB;
     if (!CForumUserPoints::CheckFields("ADD", $arFields)) {
         return false;
     }
     $arInsert = $DB->PrepareInsert("b_forum_user_points", $arFields);
     $strDatePostField = "";
     $strDatePostValue = "";
     if (!is_set($arFields, "DATE_UPDATE")) {
         $strDatePostField .= ", DATE_UPDATE";
         $strDatePostValue .= ", " . $DB->GetNowFunction() . "";
     }
     $strSql = "INSERT INTO b_forum_user_points(" . $arInsert[0] . $strDatePostField . ") VALUES(" . $arInsert[1] . $strDatePostValue . ")";
     $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     // Recount user points
     if (intVal($arFields["TO_USER_ID"]) > 0) {
         $arUserFields = array("POINTS" => CForumUser::CountUserPoints($arFields["TO_USER_ID"]));
         $arUser = CForumUser::GetByUSER_ID($arFields["TO_USER_ID"]);
         if ($arUser) {
             CForumUser::Update(intVal($arUser["ID"]), $arUserFields);
         } else {
             $arUserFields["USER_ID"] = $arFields["TO_USER_ID"];
             $ID_tmp = CForumUser::Add($arUserFields);
         }
     }
     return true;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:28,代码来源:points.php

示例2: array

     }
     $USER_FIELD_MANAGER->EditFormAddFields("USER", $arFields);
     if (!$obUser->Update($arResult["ID"], $arFields, true)) {
         $strError .= $obUser->LAST_ERROR;
     }
 }
 if ($strError == '') {
     if (CModule::IncludeModule("forum")) {
         $APPLICATION->ResetException();
         $arforumFields = array("SHOW_NAME" => $_REQUEST["forum_SHOW_NAME"] == "Y" ? "Y" : "N", "DESCRIPTION" => $_REQUEST["forum_DESCRIPTION"], "INTERESTS" => $_REQUEST["forum_INTERESTS"], "SIGNATURE" => $_REQUEST["forum_SIGNATURE"], "AVATAR" => $_FILES["forum_AVATAR"]);
         $arforumFields["AVATAR"]["del"] = $_REQUEST["forum_AVATAR_del"];
         $ar_res = CForumUser::GetByUSER_ID($arResult["ID"]);
         if ($ar_res) {
             $arforumFields["AVATAR"]["old_file"] = $ar_res["AVATAR"];
             $FORUM_USER_ID = IntVal($ar_res["ID"]);
             $FORUM_USER_ID1 = CForumUser::Update($FORUM_USER_ID, $arforumFields);
             $forum_res = IntVal($FORUM_USER_ID1) > 0;
         } else {
             $arforumFields["USER_ID"] = $arResult["ID"];
             $FORUM_USER_ID = CForumUser::Add($arforumFields);
             $forum_res = IntVal($FORUM_USER_ID) > 0;
         }
         if ($ex = $APPLICATION->GetException()) {
             $strError = $ex->GetString();
         }
     }
 }
 if ($strError == '') {
     if (CModule::IncludeModule("blog")) {
         $APPLICATION->ResetException();
         $arblogFields = array("ALIAS" => $_REQUEST["blog_ALIAS"], "DESCRIPTION" => $_REQUEST["blog_DESCRIPTION"], "INTERESTS" => $_REQUEST["blog_INTERESTS"], "AVATAR" => $_FILES["blog_AVATAR"]);
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php

示例3: 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

示例4: array

     $GLOBALS["USER_FIELD_MANAGER"]->EditFormAddFields("USER", $arFields);
     $USER->Update($arParams["UID"], $arFields);
     if ($USER->LAST_ERROR) {
         $APPLICATION->ThrowException($USER->LAST_ERROR);
     }
     // Update Forum info about user
     if (!$APPLICATION->GetException()) {
         $arFields = array("SHOW_NAME" => $_POST["FORUM_SHOW_NAME"] == "Y" ? "Y" : "N", "HIDE_FROM_ONLINE" => $_POST["FORUM_HIDE_FROM_ONLINE"] == "Y" ? "Y" : "N", "SUBSC_GROUP_MESSAGE" => $_POST["FORUM_SUBSC_GROUP_MESSAGE"] == "Y" ? "Y" : "N", "SUBSC_GET_MY_MESSAGE" => $_POST["FORUM_SUBSC_GET_MY_MESSAGE"] == "Y" ? "Y" : "N", "DESCRIPTION" => $_POST["FORUM_DESCRIPTION"], "INTERESTS" => $_POST["FORUM_INTERESTS"], "SIGNATURE" => $_POST["FORUM_SIGNATURE"], "AVATAR" => $_FILES["FORUM_AVATAR"]);
         $arFields["AVATAR"]["del"] = $_POST["FORUM_AVATAR_del"];
         if (CForumUser::IsAdmin()) {
             $arFields["ALLOW_POST"] = $_POST["FORUM_ALLOW_POST"] != "Y" ? "N" : "Y";
         }
         $ar_res = CForumUser::GetByUSER_ID($arParams["UID"]);
         if ($ar_res) {
             $arFields["AVATAR"]["old_file"] = $ar_res["AVATAR"];
             $FID = CForumUser::Update($ar_res["ID"], $arFields);
         } else {
             $arFields["USER_ID"] = $arParams["UID"];
             $FID = CForumUser::Add($arFields);
         }
         if (intVal($FID) <= 0 && !$APPLICATION->GetException()) {
             $APPLICATION->ThrowException(GetMessage("FP_ERR_PROF"));
         }
     }
 }
 if ($APPLICATION->GetException()) {
     $bVarsFromForm = true;
 } else {
     if ($USER->GetId() == $arParams["UID"]) {
         $USER->Authorize($arParams["UID"]);
     }
开发者ID:spas-viktor,项目名称:books,代码行数:31,代码来源:component.php

示例5: Delete

	/**
	 * <p>Функция удаляет из голосования голоса, отданные пользователем с кодом FROM_USER_ID пользователю с кодом TO_USER_ID.</p>
	 *
	 *
	 *
	 *
	 * @param int $FROM_USER_ID  Код пользователя, отдавшего голос.
	 *
	 *
	 *
	 * @param int $TO_USER_ID  Код пользователя, которому был отдан голос.
	 *
	 *
	 *
	 * @return bool <p>Функция возвращает True в случае успешного удаления и False - в
	 * случае ошибки.</p>
	 *
	 * @static
	 * @link http://dev.1c-bitrix.ru/api_help/forum/developer/cforumuserpoints/cforumuserpoints__delete.8bd6061a.php
	 * @author Bitrix
	 */
	public static function Delete($FROM_USER_ID, $TO_USER_ID)
	{
		global $DB;

		$FROM_USER_ID = IntVal($FROM_USER_ID);
		if ($FROM_USER_ID<=0) return False;

		$TO_USER_ID = IntVal($TO_USER_ID);
		if ($TO_USER_ID<=0) return False;

		$DB->Query("DELETE FROM b_forum_user_points WHERE FROM_USER_ID = ".$FROM_USER_ID." AND TO_USER_ID = ".$TO_USER_ID);

		// Recount user points.
		$arUserFields = array();
		$arUserFields["POINTS"] = CForumUser::CountUserPoints($TO_USER_ID);

		$arUser = CForumUser::GetByUSER_ID($TO_USER_ID);
		if ($arUser)
		{
			CForumUser::Update($arUser["ID"], $arUserFields);
		}
		else
		{
			$arUserFields["USER_ID"] = $TO_USER_ID;
			$ID_tmp = CForumUser::Add($arUserFields);
		}

		return true;
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:50,代码来源:points.php

示例6: ForumSetLastVisit

function ForumSetLastVisit($FID = false, $TID = false, $arAddParams = array())
{
    global $DB;
    // For custom components
    $GLOBALS["FID"] = $FID = $FID === false && intVal($GLOBALS["FID"]) > 0 ? intVal($GLOBALS["FID"]) : $FID;
    if ($GLOBALS["USER"]->IsAuthorized()) {
        $GLOBALS["SHOW_FORUM_ICON"] = true;
        // out-of-date param
        $USER_ID = $GLOBALS["USER"]->GetID();
        $arUserFields = array("=LAST_VISIT" => $DB->GetNowFunction());
        if (!is_array($_SESSION["FORUM"]["USER"]) || $_SESSION["FORUM"]["USER"]["USER_ID"] != $GLOBALS["USER"]->GetID()) {
            $_SESSION["FORUM"]["USER"] = CForumUser::GetByUSER_ID($USER_ID);
            if (!$_SESSION["FORUM"]["USER"]) {
                $arUserFields["USER_ID"] = $USER_ID;
                CForumUser::Add($arUserFields);
                $_SESSION["FORUM"]["USER"] = CForumUser::GetByUSER_ID($USER_ID);
            }
            $_SESSION["FORUM"]["SHOW_NAME"] = $_SESSION["FORUM"]["USER"]["SHOW_NAME"];
        }
        if (!is_set($arUserFields, "USER_ID")) {
            CForumUser::Update($USER_ID, $arUserFields, false, true);
        }
    }
    ForumInitParams();
    if ($_SESSION["SESS_SEARCHER_ID"] > 0 && CModule::IncludeModule("statistic")) {
        return;
    } else {
        CForumStat::RegisterUSER(array("SITE_ID" => SITE_ID, "FORUM_ID" => $FID, "TOPIC_ID" => $TID));
    }
    return true;
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:include.php


注:本文中的CForumUser::Update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。