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


PHP CForumUser::GetByUSER_ID方法代码示例

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


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

 function GetUserName($USER_ID, $nameTemplate = "")
 {
     $ar_res = false;
     if (IntVal($USER_ID) > 0) {
         $db_res = CUser::GetByID(IntVal($USER_ID));
         $ar_res = $db_res->Fetch();
     }
     if (!$ar_res) {
         $db_res = CUser::GetByLogin($USER_ID);
         $ar_res = $db_res->Fetch();
     }
     $USER_ID = IntVal($ar_res["ID"]);
     $f_LOGIN = htmlspecialcharsex($ar_res["LOGIN"]);
     $forum_user = CForumUser::GetByUSER_ID($USER_ID);
     if ($forum_user["SHOW_NAME"] == "Y" && (strlen(trim($ar_res["NAME"])) > 0 || strlen(trim($ar_res["LAST_NAME"])) > 0)) {
         $nameTemplate = trim(empty($nameTemplate)) ? CSite::GetNameFormat() : $nameTemplate;
         return trim(CUser::FormatName($nameTemplate, array("NAME" => htmlspecialcharsEx($ar_res["NAME"]), "LAST_NAME" => htmlspecialcharsEx($ar_res["LAST_NAME"]), "SECOND_NAME" => htmlspecialcharsEx($ar_res["SECOND_NAME"]))));
     } else {
         return $f_LOGIN;
     }
 }
开发者ID:Satariall,项目名称:izurit,代码行数:21,代码来源:component.php

示例3: array

$arResult["CURRENT_USER"] = array();
$arResult["URL"] = array("RECIPIENT" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_PROFILE_VIEW"], array("UID" => $arParams["UID"])), "~RECIPIENT" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_PROFILE_VIEW"], array("UID" => $arParams["UID"])), "MESSAGE_SEND" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE_SEND"], array("UID" => $arParams["UID"], "TYPE" => strtolower($arParams["TYPE"]))), "~MESSAGE_SEND" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_MESSAGE_SEND"], array("UID" => $arParams["UID"], "TYPE" => strtolower($arParams["TYPE"]))));
$arResult["profile_view"] = $arResult["URL"]["RECIPIENT"];
$res = CForumUser::GetByUSER_ID($arParams["UID"]);
if ($res) {
    while (list($key, $val) = each($res)) {
        $userRec[$key] = htmlspecialcharsbx($val);
    }
}
$userRec["FULL_NAME"] = CForumUser::GetFormattedNameByUserID($arParams["UID"], $arParams["NAME_TEMPLATE"], $userRec);
if ($USER->IsAuthorized()) {
    $db_userY = CUser::GetByID($USER->GetID());
    if ($db_userY) {
        $userSend = $db_userY->GetNext();
    }
    $db_res = CForumUser::GetByUSER_ID($USER->GetID());
    if ($db_res) {
        while (list($key, $val) = each($db_res)) {
            $userSend[$key] = htmlspecialcharsbx($val);
        }
    }
    $userSend["FULL_NAME"] = CForumUser::GetFormattedNameByUserID($USER->GetID(), $arParams["NAME_TEMPLATE"], $userSend);
    $userSend["E-MAIL"] = $arParams["TYPE"] == "ICQ" ? $userSend["PERSONAL_ICQ"] : $USER->GetEmail();
    $arResult["CURRENT_USER"] = $userSend;
}
/********************************************************************
				/Default params
********************************************************************/
/********************************************************************
				Action
********************************************************************/
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php

示例4: AddComment_News

 function AddComment_News($arFields)
 {
     if (!CModule::IncludeModule("forum")) {
         return false;
     }
     if (!CModule::IncludeModule("iblock")) {
         return false;
     }
     if (!CModule::IncludeModule("socialnetwork")) {
         return false;
     }
     $dbResult = CSocNetLog::GetList(array("ID" => "DESC"), array("TMP_ID" => $arFields["LOG_ID"]), false, false, array("ID", "SOURCE_ID", "PARAMS"));
     $bFound = false;
     if ($arLog = $dbResult->Fetch()) {
         if (intval($arLog["SOURCE_ID"]) > 0) {
             $arFilter = array("ID" => $arLog["SOURCE_ID"]);
             $arSelectedFields = array("IBLOCK_ID", "ID", "CREATED_BY", "NAME", "PROPERTY_FORUM_TOPIC_ID", "PROPERTY_FORUM_MESSAGE_CNT");
             $db_res = CIBlockElement::GetList(array(), $arFilter, false, false, $arSelectedFields);
             if ($db_res && ($res = $db_res->GetNext())) {
                 $arElement = $res;
                 $val = COption::GetOptionString("intranet", "sonet_log_news_iblock_forum");
                 if (strlen($val) > 0) {
                     $arIBlockForum = unserialize($val);
                 } else {
                     $arIBlockForum = array();
                 }
                 if (array_key_exists($arElement["IBLOCK_ID"], $arIBlockForum)) {
                     $FORUM_ID = $arIBlockForum[$arElement["IBLOCK_ID"]];
                 }
                 if (intval($FORUM_ID) > 0) {
                     CSocNetLogTools::AddComment_Review_CheckIBlock($arElement);
                     $dbMessage = CForumMessage::GetList(array(), array("PARAM2" => $arElement["ID"]));
                     if (!($arMessage = $dbMessage->Fetch())) {
                         // Add Topic
                         $TOPIC_ID = CSocNetLogTools::AddComment_Review_CreateRoot($arElement, $FORUM_ID);
                         $bNewTopic = true;
                     } else {
                         $TOPIC_ID = $arMessage["TOPIC_ID"];
                     }
                     if (intval($TOPIC_ID) > 0) {
                         // Add comment
                         $messageID = false;
                         $bError = false;
                         if (CForumMessage::CanUserAddMessage($TOPIC_ID, $GLOBALS["USER"]->GetUserGroupArray(), $GLOBALS["USER"]->GetID(), false)) {
                             $bSHOW_NAME = true;
                             $res = CForumUser::GetByUSER_ID($GLOBALS["USER"]->GetID());
                             if ($res) {
                                 $bSHOW_NAME = $res["SHOW_NAME"] == "Y";
                             }
                             if ($bSHOW_NAME) {
                                 $AUTHOR_NAME = $GLOBALS["USER"]->GetFullName();
                             }
                             if (strlen(Trim($AUTHOR_NAME)) <= 0) {
                                 $AUTHOR_NAME = $GLOBALS["USER"]->GetLogin();
                             }
                             if (strlen($AUTHOR_NAME) <= 0) {
                                 $bError = true;
                             }
                         }
                         if (!$bError) {
                             $arFieldsMessage = array("POST_MESSAGE" => $arFields["TEXT_MESSAGE"], "USE_SMILES" => "Y", "APPROVED" => "Y", "PARAM2" => $arElement["ID"], "AUTHOR_NAME" => $AUTHOR_NAME, "AUTHOR_ID" => IntVal($GLOBALS["USER"]->GetParam("USER_ID")), "FORUM_ID" => $FORUM_ID, "TOPIC_ID" => $TOPIC_ID, "NEW_TOPIC" => "N", "GUEST_ID" => $_SESSION["SESS_GUEST_ID"], "ADD_TO_LOG" => "N");
                             $AUTHOR_IP = ForumGetRealIP();
                             $AUTHOR_IP_tmp = $AUTHOR_IP;
                             $AUTHOR_REAL_IP = $_SERVER['REMOTE_ADDR'];
                             if (COption::GetOptionString("forum", "FORUM_GETHOSTBYADDR", "N") == "Y") {
                                 $AUTHOR_IP = @gethostbyaddr($AUTHOR_IP);
                                 if ($AUTHOR_IP_tmp == $AUTHOR_REAL_IP) {
                                     $AUTHOR_REAL_IP = $AUTHOR_IP;
                                 } else {
                                     $AUTHOR_REAL_IP = @gethostbyaddr($AUTHOR_REAL_IP);
                                 }
                             }
                             $arFieldsMessage["AUTHOR_IP"] = $AUTHOR_IP !== False ? $AUTHOR_IP : "<no address>";
                             $arFieldsMessage["AUTHOR_REAL_IP"] = $AUTHOR_REAL_IP !== False ? $AUTHOR_REAL_IP : "<no address>";
                             $messageID = CForumMessage::Add($arFieldsMessage, false);
                             if (intVal($messageID) <= 0) {
                                 $bError = true;
                             } else {
                                 if (CModule::IncludeModule("statistic")) {
                                     $arForum = CForumNew::GetByID($FORUM_ID);
                                     $F_EVENT1 = $arForum["EVENT1"];
                                     $F_EVENT2 = $arForum["EVENT2"];
                                     $F_EVENT3 = $arForum["EVENT3"];
                                     if (strlen($F_EVENT3) <= 0) {
                                         $arForumSite_tmp = CForumNew::GetSites($FORUM_ID);
                                         $F_EVENT3 = CForumNew::PreparePath2Message($arForumSite_tmp[SITE_ID], array("FORUM_ID" => $FORUM_ID, "TOPIC_ID" => $TOPIC_ID, "MESSAGE_ID" => $messageID));
                                     }
                                     CStatistic::Set_Event($F_EVENT1, $F_EVENT2, $F_EVENT3);
                                 }
                                 CForumMessage::SendMailMessage($messageID, array(), false, "NEW_FORUM_MESSAGE");
                                 CSocNetLogTools::AddComment_Review_UpdateElement($arElement, $TOPIC_ID, $bNewTopic);
                             }
                         }
                     }
                 }
             }
         }
     }
     if (intval($messageID) <= 0) {
         $strError = GetMessage("SONET_ADD_COMMENT_SOURCE_ERROR");
//.........这里部分代码省略.........
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:101,代码来源:include.php

示例5: is_array

        $ar_res = $db_res->Fetch();
        $arParams["UID"] = $ar_res["ID"];
    }
    $bUserFound = !empty($ar_res) && is_array($ar_res);
}
if (!$bUserFound) {
    CHTTP::SetStatus("404 Not Found");
    ShowError(empty($arParams["UID"]) ? GetMessage("F_NO_UID") : GetMessage("F_NO_DUSER", array("#UID#" => htmlspecialcharsEx($arParams["UID"]))));
    return false;
}
foreach ($ar_res as $key => $val) {
    $arResult["USER"]["~" . $key] = $val;
    $arResult["USER"][$key] = is_string($val) ? $parser->wrap_long_words(htmlspecialcharsex(trim($val))) : $val;
}
$arResult["USER"]["PERSONAL_BIRTHDAY_FORMATED"] = CForumFormat::FormatDate($arResult["USER"]["~PERSONAL_BIRTHDAY"], CLang::GetDateFormat("SHORT"), $arParams["DATE_FORMAT"]);
$arResult["FORUM_USER"] = CForumUser::GetByUSER_ID($arParams["UID"]);
$arResult["FORUM_USER"] = empty($arResult["FORUM_USER"]) ? array() : $arResult["FORUM_USER"];
foreach ($arResult["FORUM_USER"] as $key => $val) {
    $arResult["FORUM_USER"]["~" . $key] = $val;
    $arResult["FORUM_USER"][$key] = is_string($val) ? $parser->wrap_long_words(htmlspecialcharsEx($val)) : $val;
}
/********************************************************************
				Default values
********************************************************************/
$strErrorMessage = "";
$strOKMessage = "";
$arParams["UID"] = intval($arParams["UID"]);
$arResult["FID"] = intval($_REQUEST["FID"]);
$arResult["TID"] = intval($_REQUEST["TID"]);
$arResult["TITLE_SEO"] = trim($_REQUEST["TITLE_SEO"]);
$arResult["MID"] = intval($_REQUEST["MID"]);
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例6: OnAfterUserUpdate

 public static function OnAfterUserUpdate($arFields = array())
 {
     if ($arFields["RESULT"] && array_key_exists("PERSONAL_PHOTO", $arFields) && $arFields["PERSONAL_PHOTO"] > 0 && ($user = CForumUser::GetByUSER_ID($arFields["ID"])) && $user) {
         self::Update($user["ID"], array("AVATAR" => CFile::MakeFileArray($arFields["PERSONAL_PHOTO"])));
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:6,代码来源:user.php

示例7: array

                }
            }
            $arFields["LANG"][$lang] = array("LID" => $lang, "NAME" => $name);
        }
        $res = CForumPoints::Add($arFields);
    }
}
$db_res = CForumPoints2Post::GetList();
if (!($db_res && ($res = $db_res->Fetch()))) {
    $arFields = array("MIN_NUM_POSTS" => 1, "POINTS_PER_POST" => "0.5000");
    CForumPoints2Post::Add($arFields);
    $arFields = array("MIN_NUM_POSTS" => 50, "POINTS_PER_POST" => "0.8000");
    CForumPoints2Post::Add($arFields);
}
/* User */
$res = CForumUser::GetByUSER_ID(1);
if (empty($res) || !is_array($res)) {
    $arFields = array("=LAST_VISIT" => $DB->GetNowFunction(), "USER_ID" => 1);
    $ID = CForumUser::Add($arUserFields);
}
/* Vote */
$res = CForumUserPoints::GetByID(1, 1);
if (!$res) {
    $arFields = array("POINTS" => 1000, "FROM_USER_ID" => 1, "TO_USER_ID" => 1);
    $ID = CForumUserPoints::Add($arFields);
}
// Forum group
$arGroup = array("PUBLIC" => 0, "PARTNER" => 0, "COMMENTS" => 0);
$db_res = CForumGroup::GetListEx(array(), array("LID" => LANGUAGE_ID));
if ($db_res && ($res = $db_res->Fetch())) {
    do {
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:index.php

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

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

示例10: htmlspecialcharsEx

//$arParams["SHOW_LINK"] = ($arParams["SHOW_LINK"] == "Y" ? "Y" : "N");
$arParams["ADDITIONAL_URL"] = htmlspecialcharsEx(trim($arParams["ADDITIONAL_URL"]));
$arParams["SERVER_NAME"] = defined("SITE_SERVER_NAME") && strLen(SITE_SERVER_NAME) > 0 ? SITE_SERVER_NAME : COption::GetOptionString("main", "server_name");
$arParams["NAME_TEMPLATE"] = str_replace(array("#NOBR#", "#/NOBR#"), "", !!$arParams["NAME_TEMPLATE"] ? $arParams["NAME_TEMPLATE"] : CSite::GetDefaultNameFormat());
// *************************/Input params***************************************************************
// ************************* Default params*************************************************************
$arResult["FILE"] = $arParams["FILE"];
if (!is_array($arParams["FILE"]) && intVal($arParams["FILE"]) > 0) {
    $arResult["FILE"] = CFile::GetFileArray($arParams["FILE"]);
}
$arResult["FILE"]["~SRC"] = $arResult["FILE"]["SRC"];
if (intVal($arResult["FILE"]["ID"]) > 0) {
    $arResult["FILE"]["SRC"] = "/bitrix/components/bitrix/forum.interface/show_file.php?fid=" . htmlspecialcharsbx($arResult["FILE"]["ID"]) . (!empty($arParams["ADDITIONAL_URL"]) ? "&" . $arParams["ADDITIONAL_URL"] : "");
}
if ($arResult["FILE"]["USER_ID"] > 0) {
    $forumUser = CForumUser::GetByUSER_ID($arResult["FILE"]["USER_ID"]);
    $db_res = CUser::GetById($arResult["FILE"]["USER_ID"]);
    if ($db_res && ($arUser = $db_res->Fetch())) {
        $arResult["FILE"]["OWNER"] = $forumUser && $forumUser["SHOW_NAME"] != "Y" ? $arUser["LOGIN"] : CUser::FormatName($arParams["NAME_TEMPLATE"], $arUser, true, false);
    }
}
$arResult["RETURN_DATA"] = "";
$arResult["RETURN_DATA_ARRAY"] = array();
// *************************/Default params*************************************************************
if (is_array($arResult["FILE"]) && !empty($arResult["FILE"]["SRC"])) {
    $arResult["FILE"]["FULL_SRC"] = CHTTP::URN2URI($arResult["FILE"]["SRC"], $arParams["SERVER_NAME"]);
    $ct = strToLower($arResult["FILE"]["CONTENT_TYPE"]);
    if ($arParams["SHOW_MODE"] == "LINK") {
        // do nothing
    } elseif ($arParams["MAX_FILE_SIZE"] >= $arResult["FILE"]["FILE_SIZE"] && substr($ct, 0, 6) == "image/") {
        $arResult["RETURN_DATA"] = $GLOBALS["APPLICATION"]->IncludeComponent("bitrix:forum.interface", "popup_image", array("URL" => $arParams["SHOW_MODE"] == "RSS" ? $arResult["FILE"]["FULL_SRC"] : $arResult["FILE"]["SRC"], "SIZE" => $arParams["SIZE"], "MAX_SIZE" => $arParams["MAX_SIZE"], "HTML_SIZE" => $arParams["HTML_SIZE"], "MODE" => $arParams["SHOW_MODE"] == "RSS" ? "RSS" : "SHOW2IMAGES", "IMG_WIDTH" => $arResult["FILE"]["WIDTH"], "IMG_HEIGHT" => $arResult["FILE"]["HEIGHT"], "IMG_NAME" => $arResult["FILE"]["ORIGINAL_NAME"], "IMG_SIZE" => $arResult["FILE"]["FILE_SIZE"], "CONVERT" => $arParams["CONVERT"], "FAMILY" => $arParams["FAMILY"], "RETURN" => "Y"), $this->__component->__parent !== null ? $this->__component->__parent : $this->__component, array("HIDE_ICONS" => "Y"));
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:template.php

示例11: array

         $arFields["PASSWORD"] = $_POST["NEW_PASSWORD"];
         $arFields["CONFIRM_PASSWORD"] = $_POST["NEW_PASSWORD_CONFIRM"];
     }
     $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 {
开发者ID:spas-viktor,项目名称:books,代码行数:31,代码来源:component.php

示例12: array

/********************************************************************
				Default params # 2
********************************************************************/
$arResult["MESSAGE_FIRST"] = array();
$arResult["MESSAGE_LIST"] = array();
$arResult["MESSAGE_VIEW"] = array();
$arResult["VIEW"] = "N";
$bVarsFromForm = false;
/************** Current User ***************************************/
$arResult["USER"] = array("INFO" => array(), "PERMISSION" => $arParams["PERMISSION"], "RIGHTS" => array("ADD_TOPIC" => CForumTopic::CanUserAddTopic($arParams["FID"], $USER->GetUserGroupArray(), $USER->GetID(), $arResult["FORUM"], $arParams["PERMISSION"]) ? "Y" : "N", "MODERATE" => CForumNew::CanUserModerateForum($arParams["FID"], $USER->GetUserGroupArray(), $USER->GetID(), $arParams["PERMISSION"]) == true ? "Y" : "N", "EDIT" => CForumNew::CanUserEditForum($arParams["FID"], $USER->GetUserGroupArray(), $USER->GetID(), $arParams["PERMISSION"]) ? "Y" : "N", "ADD_MESSAGE" => CForumMessage::CanUserAddMessage($arParams["TID"], $USER->GetUserGroupArray(), $USER->GetID(), $arParams["PERMISSION"]) ? "Y" : "N"), "SUBSCRIBE" => array(), "SHOW_NAME" => $GLOBALS["FORUM_STATUS_NAME"]["guest"]);
// to avoid forum module permissions extension for admin
if ($arParams["PERMISSION"] <= "E") {
    $arResult["USER"]["RIGHTS"] = array("ADD_TOPIC" => "N", "MODERATE" => "N", "EDIT" => "N", "ADD_MESSAGE" => "N");
}
if ($USER->IsAuthorized()) {
    $arResult["USER"]["INFO"] = CForumUser::GetByUSER_ID($USER->GetParam("USER_ID"));
    $arResult["USER"]["SHOW_NAME"] = $_SESSION["FORUM"]["SHOW_NAME"];
    $arResult["USER"]["RANK"] = CForumUser::GetUserRank($USER->GetParam("USER_ID"));
    $db_res = CForumSubscribe::GetList(array(), array("USER_ID" => $USER->GetID(), "FORUM_ID" => $arParams["FID"], "TOPIC_ID" => $arParams["TID"], "SITE_ID" => SITE_ID));
    if ($db_res && ($res = $db_res->Fetch())) {
        $arResult["USER"]["SUBSCRIBE"][$res["ID"]] = $res;
    }
}
/*******************************************************************/
$arResult["PANELS"] = array("MODERATE" => $arResult["USER"]["RIGHTS"]["MODERATE"], "DELETE" => $arResult["USER"]["RIGHTS"]["EDIT"], "SUPPORT" => IsModuleInstalled("support") && $APPLICATION->GetGroupRight("forum") >= "W" ? "Y" : "N", "EDIT" => $arResult["USER"]["RIGHTS"]["EDIT"], "STATISTIC" => IsModuleInstalled("statistic") && $APPLICATION->GetGroupRight("statistic") > "D" ? "Y" : "N", "MAIN" => $APPLICATION->GetGroupRight("main") > "D" ? "Y" : "N", "MAIL" => $APPLICATION->GetGroupRight("mail") > "R" ? "Y" : "N");
/*******************************************************************/
$_SERVER["REQUEST_URI"] = $arResult["CURRENT_PAGE"];
unset($_GET["MID"]);
unset($GLOBALS["HTTP_GET_VARS"]["MID"]);
unset($_GET["ACTION"]);
unset($GLOBALS["HTTP_GET_VARS"]["ACTION"]);
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:component.php

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


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