• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CForumUser类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了CForumUser类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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, $sNameTemplate = "")
 {
     $sNameTemplate = str_replace(array("#NOBR#", "#/NOBR#"), "", !empty($sNameTemplate) ? $sNameTemplate : CSite::GetDefaultNameFormat());
     if (intval($USER_ID) <= 0) {
         $db_res = CUser::GetByLogin($USER_ID);
         $ar_res = $db_res->Fetch();
         $USER_ID = $ar_res["ID"];
     }
     return CForumUser::GetFormattedNameByUserID($USER_ID, $sNameTemplate);
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:10,代码来源:component.php


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


示例4: IncludeModuleLangFile

<?php

IncludeModuleLangFile(__FILE__);
ClearVars("str_forum_");
if (CModule::IncludeModule("forum")) {
    $ID = IntVal($ID);
    $db_res = CForumUser::GetList(array(), array("USER_ID" => $ID));
    $db_res->ExtractFields("str_forum_", True);
    if (!isset($str_forum_ALLOW_POST) || $str_forum_ALLOW_POST != "Y" && $str_forum_ALLOW_POST != "N") {
        $str_forum_ALLOW_POST = "Y";
    }
    if (!isset($str_forum_SHOW_NAME) || $str_forum_SHOW_NAME != "Y" && $str_forum_SHOW_NAME != "N") {
        $str_forum_SHOW_NAME = "Y";
    }
    $str_forum_SUBSC_GET_MY_MESSAGE = $str_forum_SUBSC_GET_MY_MESSAGE == "Y" ? "Y" : "N";
    if ($COPY_ID > 0) {
        $str_forum_AVATAR = "";
    }
    if (strlen($strError) > 0) {
        $DB->InitTableVarsForEdit("b_forum_user", "forum_", "str_forum_");
        $DB->InitTableVarsForEdit("b_user", "forum_", "str_forum_");
    }
    ?>
	<input type="hidden" name="profile_module_id[]" value="forum">
	<?php 
    if ($USER->IsAdmin() || $GLOBALS["APPLICATION"]->GetGroupRight("forum") >= "W") {
        ?>
		<tr>
			<td width="40%"><?php 
        echo GetMessage("forum_ALLOW_POST");
        ?>
开发者ID:spas-viktor,项目名称:books,代码行数:31,代码来源:options_user_settings.php


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


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


示例7: array

    } else {
        $arFilter = array();
        if (!CForumUser::IsAdmin()) {
            $arFilter = array("LID" => SITE_ID, "PERMS" => array($USER->GetGroups(), 'A'), "ACTIVE" => "Y");
        } elseif ($arParams["SHOW_FORUM_ANOTHER_SITE"] == "Y") {
            $arFilter["LID"] = SITE_ID;
        }
        if (is_array($arParams["FORUM_ID"]) && !empty($arParams["FORUM_ID"])) {
            $arFilter["@ID"] = $arParams["FORUM_ID"];
        }
        if (!empty($arParams["FID"])) {
            $arFilter["ID"] = $arParams["FID"];
        } else {
            $arResult["STATISTIC"]["USERS"] = CUser::GetCount();
            $arResult["STATISTIC"]["USERS_ON_FORUM"] = CForumUser::CountUsers(false, array("ACTIVE" => "Y"));
            $arResult["STATISTIC"]["USERS_ON_FORUM_ACTIVE"] = CForumUser::CountUsers(true, array("ACTIVE" => "Y"));
        }
        $db_res = CForumNew::GetListEx(array(), $arFilter);
        if ($db_res && ($res = $db_res->GetNext())) {
            do {
                $arResult["STATISTIC"]["FORUMS"]++;
                $arResult["STATISTIC"]["TOPICS"] += intVal($res["TOPICS"]);
                $arResult["STATISTIC"]["POSTS"] += intVal($res["POSTS"]);
            } while ($res = $db_res->GetNext());
        }
        if ($arParams["CACHE_TIME_FOR_FORUM_STAT"] > 0) {
            $cache->StartDataCache($arParams["CACHE_TIME_FOR_FORUM_STAT"], $cache_id, $cache_path);
            $cache->EndDataCache(array("STATISTIC" => $arResult["STATISTIC"]));
        }
    }
}
开发者ID:rasuldev,项目名称:torino,代码行数:31,代码来源:component.php


示例8: GetListEx

 public static function GetListEx($arOrder = array("ID" => "ASC"), $arFilter = array(), $arAddParams = array())
 {
     global $DB;
     $arSqlSearch = array();
     $arSqlFrom = array();
     $arSqlOrder = array();
     $strSqlSearch = "";
     $strSqlFrom = "";
     $strSqlOrder = "";
     $arFilter = is_array($arFilter) ? $arFilter : array();
     foreach ($arFilter as $key => $val) {
         $key_res = CForumNew::GetFilterOperation($key);
         $key = strtoupper($key_res["FIELD"]);
         $strNegative = $key_res["NEGATIVE"];
         $strOperation = $key_res["OPERATION"];
         switch ($key) {
             case "TOPIC_ID":
             case "FORUM_ID":
                 if (intVal($val) <= 0) {
                     $arSqlSearch[] = ($strNegative == "Y" ? "NOT" : "") . "(FSTAT." . $key . " IS NULL OR FSTAT." . $key . "<=0)";
                 } else {
                     $arSqlSearch[] = ($strNegative == "Y" ? " FSTAT." . $key . " IS NULL OR NOT " : "") . "(FSTAT." . $key . " " . $strOperation . " " . intVal($val) . ")";
                 }
                 break;
             case "SITE_ID":
                 $bOrNull = false;
                 if (is_array($val)) {
                     $res = array();
                     foreach ($val as $v) {
                         $v = trim($v);
                         if ($v == "NULL") {
                             $bOrNull = true;
                         } elseif (!empty($v)) {
                             $res[] = "'" . $DB->ForSql($v) . "'";
                         }
                     }
                     $val = !empty($res) ? implode(", ", $res) : "";
                     $strOperation = !empty($res) ? "IN" : $strOperation;
                 } else {
                     $val = "'" . $DB->ForSql($val) . "'";
                 }
                 if (strlen($val) <= 0) {
                     $arSqlSearch[] = ($strNegative == "Y" ? "NOT" : "") . "(FSTAT." . $key . " IS NULL OR LENGTH(FSTAT." . $key . ")<=0)";
                 } elseif ($strOperation == "IN") {
                     $arSqlSearch[] = ($strNegative == "Y" ? " FSTAT." . $key . " IS NULL OR NOT " : "") . "(FSTAT." . $key . " IN (" . $val . ")" . ($bOrNull ? " OR (FSTAT." . $key . " IS NULL OR LENGTH(FSTAT." . $key . ")<=0)" : "") . ")";
                 } else {
                     $arSqlSearch[] = ($strNegative == "Y" ? " FSTAT." . $key . " IS NULL OR NOT " : "") . "(FSTAT." . $key . " " . $strOperation . " " . $val . ")";
                 }
                 break;
             case "LAST_VISIT":
                 if (strLen($val) <= 0) {
                     $arSqlSearch[] = ($strNegative == "Y" ? "NOT" : "") . "(FSTAT." . $key . " IS NULL)";
                 } else {
                     $arSqlSearch[] = ($strNegative == "Y" ? " FSTAT." . $key . " IS NULL OR NOT " : "") . "(FSTAT." . $key . " " . $strOperation . " " . $DB->CharToDateFunction($DB->ForSql($val), "FULL") . ")";
                 }
                 break;
             case "PERIOD":
                 if (strLen($val) <= 0) {
                     $arSqlSearch[] = ($strNegative == "Y" ? "NOT" : "") . "(FSTAT.LAST_VISIT IS NULL)";
                 } else {
                     $arSqlSearch[] = ($strNegative == "Y" ? " FSTAT.LAST_VISIT IS NULL OR NOT " : "") . "(FROM_UNIXTIME(UNIX_TIMESTAMP(CURRENT_TIMESTAMP) - " . intVal($val) . ") " . $strOperation . "  FSTAT.LAST_VISIT)";
                 }
                 break;
             case "HIDE_FROM_ONLINE":
                 $arSqlFrom["FU"] = "LEFT JOIN b_forum_user FU ON (FSTAT.USER_ID=FU.USER_ID)";
                 if (strLen($val) <= 0) {
                     $arSqlSearch[] = ($strNegative == "Y" ? "NOT" : "") . "(FU." . $key . " IS NULL OR LENGTH(FU." . $key . ")<=0)";
                 } else {
                     $arSqlSearch[] = ($strNegative == "Y" ? " FU." . $key . " IS NULL OR NOT " : "") . "(((FU." . $key . " " . $strOperation . " '" . $DB->ForSql($val) . "' ) AND (FSTAT.USER_ID > 0)) OR (FSTAT.USER_ID <= 0))";
                 }
                 break;
                 break;
             case "ACTIVE":
                 $arSqlFrom["U"] = "LEFT JOIN b_user U ON (FSTAT.USER_ID=U.ID)";
                 $arSqlSearch[] = ($strNegative == "Y" ? " U." . $key . " IS NULL OR NOT " : "") . "(FSTAT.USER_ID = 0 OR U.ACTIVE = 'Y')";
                 break;
         }
     }
     if (!empty($arSqlSearch)) {
         $strSqlSearch = " AND " . implode(" AND ", $arSqlSearch) . " ";
     }
     if (!empty($arSqlFrom)) {
         $strSqlFrom = implode("\n", $arSqlFrom);
     }
     foreach ($arOrder as $by => $order) {
         $by = strtoupper($by);
         $order = strtoupper($order);
         $order = $order != "ASC" ? $order = "DESC" : "ASC";
         if ($by == "USER_ID") {
             $arSqlOrder[] = " FSTAT.USER_ID " . $order . " ";
         }
     }
     DelDuplicateSort($arSqlOrder);
     if (count($arSqlOrder) > 0) {
         $strSqlOrder = " ORDER BY " . implode(", ", $arSqlOrder);
     }
     $strSql = "SELECT FSTAT.USER_ID, FSTAT.IP_ADDRESS, FSTAT.PHPSESSID, \n" . "\t" . $DB->DateToCharFunction("FSTAT.LAST_VISIT", "FULL") . " AS LAST_VISIT, \n" . "\tFSTAT.FORUM_ID, FSTAT.TOPIC_ID \n" . "FROM b_forum_stat FSTAT " . $strSqlFrom . "\n" . "WHERE 1=1 " . $strSqlSearch . "\n" . $strSqlOrder;
     if (is_set($arFilter, "COUNT_GUEST")) {
         $strSql = "SELECT FST.*, FU.*, FSTAT.IP_ADDRESS, FSTAT.PHPSESSID, \n" . "\t" . $DB->DateToCharFunction("FSTAT.LAST_VISIT", "FULL") . " AS LAST_VISIT, \n" . "\tFSTAT.FORUM_ID, FSTAT.TOPIC_ID, \n" . "\tU.LOGIN, U.NAME, U.SECOND_NAME, U.LAST_NAME, \n" . "\t" . (!empty($arAddParams["sNameTemplate"]) ? CForumUser::GetFormattedNameFieldsForSelect(array_merge($arAddParams, array("sUserTablePrefix" => "U.", "sForumUserTablePrefix" => "FU.", "sFieldName" => "SHOW_NAME")), false) : "FSTAT.SHOW_NAME") . "\n " . " FROM ( " . " SELECT FSTAT.USER_ID, MAX(FSTAT.ID) FST_ID, COUNT(FSTAT.PHPSESSID) COUNT_USER " . " FROM b_forum_stat FSTAT " . $strSqlFrom . " WHERE 1=1 " . $strSqlSearch . " GROUP BY FSTAT.USER_ID" . ") FST " . "LEFT JOIN b_forum_stat FSTAT ON (FST.FST_ID = FSTAT.ID) " . "LEFT JOIN b_forum_user FU ON (FST.USER_ID = FU.USER_ID) " . "LEFT JOIN b_user U ON (FST.USER_ID = U.ID) " . $strSqlOrder;
     }
//.........这里部分代码省略.........
开发者ID:rasuldev,项目名称:torino,代码行数:101,代码来源:user.php


示例9: GetListEx


//.........这里部分代码省略.........
					$db_res = $DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);
					if ($ar_res = $db_res->Fetch())
					{
						$iLAST_MESSAGE_ID = intVal($ar_res["LAST_MESSAGE_ID"]);
					}
				}
			}
			// / This code exists because of http://bugs.mysql.com/bug.php?id=64002
			if ($bCount === 4)
				return array("CNT" => $iCnt, "LAST_MESSAGE_ID" => $iLAST_MESSAGE_ID);

			if ($bCount)
				return $iCnt;
		}

		if ($UseGroup)
		{
			$strSql =
				"SELECT F_M.*, FM.FORUM_ID, FM.TOPIC_ID, FM.USE_SMILES, FM.NEW_TOPIC, \n".
				"	FM.APPROVED, FM.SOURCE_ID, \n".
				"	".$DB->DateToCharFunction("FM.POST_DATE", "FULL")." as POST_DATE, \n".
				"	FM.POST_MESSAGE, FM.POST_MESSAGE_HTML, FM.POST_MESSAGE_FILTER, \n".
				"	FM.ATTACH_IMG, FM.XML_ID, FM.PARAM1, FM.PARAM2, \n".
				"	FM.AUTHOR_ID, FM.AUTHOR_NAME, FM.AUTHOR_EMAIL, \n".
				"	FM.AUTHOR_IP, FM.AUTHOR_REAL_IP, FM.GUEST_ID, \n".
				"	FM.EDITOR_ID, FM.EDITOR_NAME, FM.EDITOR_EMAIL, FM.EDIT_REASON, \n".
				"	".$DB->DateToCharFunction("FM.EDIT_DATE", "FULL")." as EDIT_DATE, \n".
				"	FM.HTML, FM.MAIL_HEADER, \n".
				"	FU.SHOW_NAME, FU.DESCRIPTION, FU.NUM_POSTS, FU.POINTS as NUM_POINTS, FU.SIGNATURE, FU.AVATAR, \n".
				"	".$DB->DateToCharFunction("FU.DATE_REG", "SHORT")." as DATE_REG, \n".
				"	U.LOGIN, U.NAME, U.SECOND_NAME, U.LAST_NAME, U.PERSONAL_PHOTO, FU.RANK_ID, U.PERSONAL_WWW, U.PERSONAL_GENDER, \n".
				"	U.EMAIL, U.PERSONAL_ICQ, U.PERSONAL_CITY, U.PERSONAL_COUNTRY".
				(!empty($arAddParams["sNameTemplate"]) ?
					",\n\t".CForumUser::GetFormattedNameFieldsForSelect(array_merge(
						$arAddParams, array(
						"sUserTablePrefix" => "U.",
						"sForumUserTablePrefix" => "FU.",
						"sFieldName" => "AUTHOR_NAME_FRMT")), false) : "")." \n".
				"FROM ( \n".
				"		SELECT FM.ID".$strSqlSelect." \n".
				"		FROM b_forum_message FM \n".
				"			LEFT JOIN b_forum_user FU ON FM.AUTHOR_ID = FU.USER_ID \n".
				"			LEFT JOIN b_user U ON FM.AUTHOR_ID = U.ID \n".
				"			".$strSqlFrom." \n".
				"		WHERE (1=1 ".$strSqlSearch.") \n".
				"		GROUP BY FM.ID".$strSqlGroup." \n".
				"	) F_M \n".
				"	INNER JOIN b_forum_message FM ON (F_M.ID = FM.ID) \n".
				"	LEFT JOIN b_forum_user FU ON (FM.AUTHOR_ID = FU.USER_ID) \n".
				"	LEFT JOIN b_user U ON (FM.AUTHOR_ID = U.ID) \n".
				$strSqlOrder;
		}
		else
		{
			$strSql =
				"SELECT FM.ID, FM.FORUM_ID, FM.TOPIC_ID, FM.USE_SMILES, FM.NEW_TOPIC, \n".
				"	FM.APPROVED, FM.SOURCE_ID, \n".
				"	".$DB->DateToCharFunction("FM.POST_DATE", "FULL")." as POST_DATE, \n".
				"	FM.POST_MESSAGE, FM.POST_MESSAGE_HTML, FM.POST_MESSAGE_FILTER, \n".
				"	FM.ATTACH_IMG, FM.XML_ID, FM.PARAM1, FM.PARAM2, \n".
				"	FM.AUTHOR_ID, FM.AUTHOR_NAME, FM.AUTHOR_EMAIL, \n".
				"	FM.AUTHOR_IP, FM.AUTHOR_REAL_IP, FM.GUEST_ID, \n".
				"	FM.EDITOR_ID, FM.EDITOR_NAME, FM.EDITOR_EMAIL, FM.EDIT_REASON, \n".
				"	".$DB->DateToCharFunction("FM.EDIT_DATE", "FULL")." as EDIT_DATE, \n".
				"	FM.HTML, FM.MAIL_HEADER, \n".
				"	FU.SHOW_NAME, FU.DESCRIPTION, FU.NUM_POSTS, FU.POINTS as NUM_POINTS, FU.SIGNATURE, FU.AVATAR, \n".
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:67,代码来源:message.php


示例10: htmlspecialcharsbx

        $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
********************************************************************/
if ($_SERVER["REQUEST_METHOD"] == "POST" && $_POST["ACTION"] == "SEND" && check_bitrix_sessid()) {
    $userSend["FULL_NAME"] = trim(empty($userSend["FULL_NAME"]) ? $_POST["NAME"] : $userSend["FULL_NAME"]);
    $userSend["E-MAIL"] = trim(empty($userSend["E-MAIL"]) ? $_POST["EMAIL"] : $userSend["E-MAIL"]);
    // Use captcha
    if ($arParams["SEND_" . strToUpper($arParams["TYPE"])] < "Y" && !$USER->IsAuthorized()) {
        include_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/captcha.php";
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php


示例11: getUserFromForum

 private static function getUserFromForum($userId)
 {
     if ($userId > 0 && !array_key_exists($userId, self::$users)) {
         self::$users[$userId] = \CForumUser::GetListEx(array(), array("USER_ID" => $userId))->fetch();
     }
     return self::$users[$userId];
 }
开发者ID:rasuldev,项目名称:torino,代码行数:7,代码来源:baseobject.php


示例12: array

// FORUM
CPageOption::SetOptionString("main", "nav_page_in_session", "N");
$arResult['FORUM_TOPIC_ID'] = null;
$arResult["TOPIC"] = array();
$arFilter = array("FORUM_ID" => $arParams['FORUM_ID'], "XML_ID" => $arParams['ENTITY_XML_ID']);
$dbRes = CForumTopic::GetList(null, $arFilter);
if ($dbRes && ($arResult["TOPIC"] = $dbRes->Fetch())) {
    $arResult['FORUM_TOPIC_ID'] = $arResult["TOPIC"]['ID'];
}
$arResult["ELEMENT"] = array();
$arResult["USER"] = array("PERMISSION" => $arParams['PERMISSION'] !== null ? $arParams['PERMISSION'] : ForumCurrUserPermissions($arParams["FORUM_ID"]), "SHOWED_NAME" => $GLOBALS["FORUM_STATUS_NAME"]["guest"], "SUBSCRIBE" => array(), "FORUM_SUBSCRIBE" => "N", "TOPIC_SUBSCRIBE" => "N");
// A - NO ACCESS		E - READ			I - ANSWER
// M - NEW TOPIC		Q - MODERATE	U - EDIT			Y - FULL_ACCESS
$userId = $USER->GetID();
$arUserGroups = $USER->GetUserGroupArray();
if ($arResult["USER"]["PERMISSION"] !== null && !CForumUser::IsAdmin()) {
    $arResult["USER"]["RIGHTS"] = array("ADD_TOPIC" => $arParams['PERMISSION'] >= 'M' ? "Y" : "N", "MODERATE" => $arParams['PERMISSION'] >= 'Q' ? "Y" : "N", "EDIT" => $arParams['PERMISSION'] >= 'U' ? "Y" : "N", "ADD_MESSAGE" => $arParams['PERMISSION'] >= 'I' ? "Y" : "N");
} else {
    $arResult["USER"]["RIGHTS"] = array("ADD_TOPIC" => CForumTopic::CanUserAddTopic($arParams["FORUM_ID"], $arUserGroups, $userId, $arResult["FORUM"]) ? "Y" : "N", "MODERATE" => CForumNew::CanUserModerateForum($arParams["FORUM_ID"], $arUserGroups, $userId) == true ? "Y" : "N", "EDIT" => CForumNew::CanUserEditForum($arParams["FORUM_ID"], $arUserGroups, $userId) ? "Y" : "N", "ADD_MESSAGE" => CForumMessage::CanUserAddMessage($arResult['FORUM_TOPIC_ID'], $arUserGroups, $userId) ? "Y" : "N");
}
if ($USER->IsAuthorized()) {
    $arResult["USER"]["ID"] = $GLOBALS["USER"]->GetID();
    $tmpName = empty($arParams["NAME_TEMPLATE"]) ? $GLOBALS["USER"]->GetFormattedName(false) : CUser::FormatName($arParams["NAME_TEMPLATE"], array("NAME" => $USER->GetFirstName(), "LAST_NAME" => $USER->GetLastName(), "SECOND_NAME" => $USER->GetSecondName(), "LOGIN" => $USER->GetLogin()));
    $arResult["USER"]["SHOWED_NAME"] = trim($_SESSION["FORUM"]["SHOW_NAME"] == "Y" ? $tmpName : $GLOBALS["USER"]->GetLogin());
    $arResult["USER"]["SHOWED_NAME"] = trim(!empty($arResult["USER"]["SHOWED_NAME"]) ? $arResult["USER"]["SHOWED_NAME"] : $GLOBALS["USER"]->GetLogin());
}
$arResult['DO_NOT_CACHE'] = true;
// PARSER
$parser = new forumTextParser(LANGUAGE_ID, $arParams["PATH_TO_SMILE"]);
$parser->imageWidth = $arParams["IMAGE_SIZE"];
$parser->imageHtmlWidth = $arParams["IMAGE_HTML_SIZE"];
开发者ID:spas-viktor,项目名称:books,代码行数:31,代码来源:component.php


示例13: RegisterUSER_OLD

 /**
  * @param array $arFields
  * @return bool
  * @deprecated
  * @see CALLForumStat::RegisterUSER()
  */
 public static function RegisterUSER_OLD($arFields = array())
 {
     global $DB, $USER;
     $tmp = "";
     if ($_SESSION["FORUM"]["SHOW_NAME"] == "Y" && strLen(trim($USER->GetFormattedName(false))) > 0) {
         $tmp = $USER->GetFormattedName(false);
     } else {
         $tmp = $USER->GetLogin();
     }
     $session_id = "'" . $DB->ForSQL(session_id(), 255) . "'";
     $Fields = array("FS.USER_ID" => intVal($USER->GetID()), "FS.IP_ADDRESS" => "'" . $DB->ForSql($_SERVER["REMOTE_ADDR"], 15) . "'", "FS.SHOW_NAME" => "'" . $DB->ForSQL($tmp, 255) . "'", "FS.LAST_VISIT" => $DB->GetNowFunction(), "FS.FORUM_ID" => intVal($arFields["FORUM_ID"]), "FS.TOPIC_ID" => intVal($arFields["TOPIC_ID"]));
     $FieldsForInsert = array("USER_ID" => $Fields["FS.USER_ID"], "IP_ADDRESS" => $Fields["FS.IP_ADDRESS"], "SHOW_NAME" => $Fields["FS.SHOW_NAME"], "LAST_VISIT" => $Fields["FS.LAST_VISIT"], "FORUM_ID" => $Fields["FS.FORUM_ID"], "TOPIC_ID" => $Fields["FS.TOPIC_ID"], "PHPSESSID" => $session_id);
     if (intVal($USER->GetID()) > 0) {
         $FieldsForUpdate = $Fields;
         $FieldsForUpdate["FU.LAST_VISIT"] = $DB->GetNowFunction();
         $rows = $DB->Update("b_forum_user FU, b_forum_stat FS", $FieldsForUpdate, "WHERE (FU.USER_ID=" . $Fields["FS.USER_ID"] . ") AND (FS.PHPSESSID=" . $session_id . ")", "File: " . __FILE__ . "<br>Line: " . __LINE__, false);
         if (intVal($rows) < 2) {
             if (intVal($rows) <= 0) {
                 $rows = $DB->Update("b_forum_user", array("USER_ID" => $Fields["FS.USER_ID"]), "WHERE (USER_ID=" . $Fields["FS.USER_ID"] . ")", "File: " . __FILE__ . "<br>Line: " . __LINE__, false);
                 if (intVal($rows) <= 0) {
                     $ID = CForumUser::Add(array("USER_ID" => $Fields["FS.USER_ID"]));
                 }
                 $rows = $DB->Update("b_forum_stat", array("USER_ID" => $Fields["FS.USER_ID"], "IP_ADDRESS" => $Fields["FS.IP_ADDRESS"], "SHOW_NAME" => $Fields["FS.SHOW_NAME"], "LAST_VISIT" => $Fields["FS.LAST_VISIT"], "FORUM_ID" => $Fields["FS.FORUM_ID"], "TOPIC_ID" => $Fields["FS.TOPIC_ID"]), "WHERE (PHPSESSID=" . $session_id . ")", "File: " . __FILE__ . "<br>Line: " . __LINE__, false);
                 if (intVal($rows) <= 0) {
                     $DB->Insert("b_forum_stat", $FieldsForInsert, "File: " . __FILE__ . "<br>Line: " . __LINE__);
                 }
             }
         }
     } else {
         $rows = $DB->Update("b_forum_stat", array("USER_ID" => $Fields["FS.USER_ID"], "IP_ADDRESS" => $Fields["FS.IP_ADDRESS"], "SHOW_NAME" => $Fields["FS.SHOW_NAME"], "LAST_VISIT" => $Fields["FS.LAST_VISIT"], "FORUM_ID" => $Fields["FS.FORUM_ID"], "TOPIC_ID" => $Fields["FS.TOPIC_ID"]), "WHERE (PHPSESSID=" . $session_id . ")", "File: " . __FILE__ . "<br>Line: " . __LINE__);
         if (intVal($rows) <= 0) {
             $DB->Insert("b_forum_stat", $FieldsForInsert, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         }
     }
     return true;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:42,代码来源:user.php


示例14: GetListEx


//.........这里部分代码省略.........
                 $arSqlFrom["FP"] = "LEFT JOIN b_forum_perms FP ON (FP.FORUM_ID=FT.FORUM_ID)";
                 $arSqlSearch[] = "FP.GROUP_ID IN (" . $DB->ForSql($USER->GetGroups()) . ") AND (FP.PERMISSION IN ('Q','U','Y'))";
                 $UseGroup = true;
                 break;
         }
     }
     if (count($arSqlSearch) > 0) {
         $strSqlSearch = " AND (" . implode(") AND (", $arSqlSearch) . ")";
     }
     if (count($arSqlSelect) > 0) {
         $res = array();
         foreach ($arSqlSelect as $key => $val) {
             if (substr($key, 0, 1) == "!") {
                 $key = substr($key, 1);
             }
             if ($key != $val) {
                 $res[] = $val . " AS " . $key;
             } else {
                 $res[] = $val;
             }
         }
         $strSqlSelect = ", " . implode(", ", $res);
     }
     if (count($arSqlFrom) > 0) {
         $strSqlFrom = implode("\n", $arSqlFrom);
     }
     if ($UseGroup) {
         foreach ($arSqlSelect as $key => $val) {
             if (substr($key, 0, 1) != "!") {
                 $arSqlGroup[$key] = $val;
             }
         }
         if (!empty($arSqlGroup)) {
             $strSqlGroup = ", " . implode(", ", $arSqlGroup);
         }
     }
     foreach ($arOrder as $by => $order) {
         $by = strtoupper($by);
         $order = strtoupper($order);
         if ($order != "ASC") {
             $order = "DESC";
         }
         if (in_array($by, array("ID", "FORUM_ID", "TOPIC_ID", "TITLE", "TAGS", "DESCRIPTION", "ICON_ID", "STATE", "APPROVED", "SORT", "VIEWS", "USER_START_ID", "USER_START_NAME", "START_DATE", "POSTS", "LAST_POSTER_ID", "LAST_POSTER_NAME", "LAST_POST_DATE", "LAST_MESSAGE_ID", "POSTS_UNAPPROVED", "ABS_LAST_POSTER_ID", "ABS_LAST_POSTER_NAME", "ABS_LAST_POST_DATE", "ABS_LAST_MESSAGE_ID", "SOCNET_GROUP_ID", "OWNER_ID", "HTML", "XML_ID"))) {
             $arSqlOrder[] = "FT." . $by . " " . $order;
         } elseif ($by == "FORUM_NAME") {
             $arSqlOrder[] = "F.NAME " . $order;
         } else {
             $arSqlOrder[] = "FT.SORT " . $order;
             $by = "SORT";
         }
     }
     $arSqlOrder = array_unique($arSqlOrder);
     DelDuplicateSort($arSqlOrder);
     if (count($arSqlOrder) > 0) {
         $strSqlOrder = " ORDER BY " . implode(", ", $arSqlOrder);
     }
     if ($bCount || is_set($arAddParams, "bDescPageNumbering") && intVal($arAddParams["nTopCount"]) <= 0) {
         $strSql = "SELECT COUNT(FT.ID) as CNT FROM b_forum_topic FT ";
         $arCountSqlFrom = $arSqlFrom;
         if (isset($arSqlFrom['FUT']) && strpos($strSqlSearch, "FUT.") === false) {
             unset($arCountSqlFrom['FUT']);
         }
         $strSqlCountFrom = implode("\n", $arCountSqlFrom);
         $strSql .= $strSqlCountFrom . " WHERE 1 = 1 " . $strSqlSearch;
         $db_res = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         $iCnt = 0;
         if ($ar_res = $db_res->Fetch()) {
             $iCnt = intVal($ar_res["CNT"]);
         }
         if ($bCount) {
             return $iCnt;
         }
     }
     $arSQL = array("select" => "", "join" => "");
     if (!empty($arAddParams["sNameTemplate"])) {
         $arSQL = array_merge_recursive(CForumUser::GetFormattedNameFieldsForSelect(array_merge($arAddParams, array("sUserTablePrefix" => "U_START.", "sForumUserTablePrefix" => "FU_START.", "sFieldName" => "USER_START_NAME_FRMT", "sUserIDFieldName" => "FT.USER_START_ID"))), CForumUser::GetFormattedNameFieldsForSelect(array_merge($arAddParams, array("sUserTablePrefix" => "U_LAST.", "sForumUserTablePrefix" => "FU_LAST.", "sFieldName" => "LAST_POSTER_NAME_FRMT", "sUserIDFieldName" => "FT.LAST_POSTER_ID"))), CForumUser::GetFormattedNameFieldsForSelect(array_merge($arAddParams, array("sUserTablePrefix" => "U_ABS_LAST.", "sForumUserTablePrefix" => "FU_ABS_LAST.", "sFieldName" => "ABS_LAST_POSTER_NAME_FRMT", "sUserIDFieldName" => "FT.ABS_LAST_POSTER_ID"))));
         $arSQL["select"] = ",\n\t" . implode(",\n\t", $arSQL["select"]);
         $arSQL["join"] = "\n" . implode("\n", $arSQL["join"]);
     }
     if ($UseGroup) {
         $strSql = " SELECT F_T.*, FT.FORUM_ID, FT.TOPIC_ID, FT.TITLE, FT.TAGS, FT.DESCRIPTION, FT.ICON_ID, \n" . "\tFT.STATE, FT.APPROVED, FT.SORT, FT.VIEWS, FT.USER_START_ID, FT.USER_START_NAME, \n" . "\t" . CForumNew::Concat("-&qu 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CFriendsHelper类代码示例发布时间:2022-05-23
下一篇:
PHP CForumTopic类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap