本文整理汇总了PHP中CForumUser::IsAdmin方法的典型用法代码示例。如果您正苦于以下问题:PHP CForumUser::IsAdmin方法的具体用法?PHP CForumUser::IsAdmin怎么用?PHP CForumUser::IsAdmin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CForumUser
的用法示例。
在下文中一共展示了CForumUser::IsAdmin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
}
$arUserPerm = array();
$db_res = CForumNew::GetList(array(), $arFilter);
if ($db_res && ($res = $db_res->GetNext())) {
$arUserGroup = CUser::GetUserGroup($arParams["UID"]);
do {
$arResult["FORUMS"][$res["ID"]] = $res;
$arUserPerm[] = CForumNew::GetUserPermission($res["ID"], $arUserGroup);
} while ($res = $db_res->GetNext());
}
rsort($arUserPerm);
$arRank = CForumUser::GetUserRank($arParams["UID"], LANGUAGE_ID);
list($arResult["USER_RANK_CODE"], $arResult["USER_RANK"]) = ForumGetUserForumStatus($arParams["UID"], $arUserPerm[0], array("Rank" => $arRank));
$arResult["SHOW_POINTS"] = "N";
$arResult["arRank"] = array_merge(is_array($arRank) ? $arRank : array(), array("NAME" => $arResult["USER_RANK"]));
if ($USER->IsAuthorized() && (CForumUser::IsAdmin() || intval($USER->GetID()) == $arParams["UID"])) {
$arResult["SHOW_POINTS"] = "Y";
$arResult["USER_POINTS"] = !empty($arRank["VOTES"]) ? intval($arRank["VOTES"]) : GetMessage("F_NO_VOTES");
}
/*******************************************************************/
$arResult["arTopic"] = "N";
if (!empty($arResult["FORUMS"])) {
$db_res = CForumUser::UserAddInfo(array("LAST_POST" => "DESC"), array("AUTHOR_ID" => $arParams["UID"], "@FORUM_ID" => array_keys($arResult["FORUMS"])), "topics");
if ($db_res && ($res = $db_res->GetNext())) {
$res["TITLE"] = $parser->wrap_long_words($res["TITLE"]);
$res["DESCRIPTION"] = $parser->wrap_long_words($res["DESCRIPTION"]);
$res["LAST_POST_DATE"] = CForumFormat::DateFormat($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($res["LAST_POST_DATE"], CSite::GetDateFormat()));
$arResult["arTopic"] = array_merge($res, array("read" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE"], array("FID" => $res["FORUM_ID"], "TID" => $res["TOPIC_ID"], "TITLE_SEO" => $res["TITLE_SEO"], "MID" => intval($res["LAST_POST"]))) . "#message" . intval($res["LAST_POST"])));
}
}
/************** User properties ************************************/
示例2: trim
}
if (strlen($_REQUEST["date_last_visit1"]) > 0) {
$arFilter[">=LAST_VISIT"] = $_REQUEST["date_last_visit1"];
}
if (strlen($_REQUEST["date_last_visit2"]) > 0) {
$arFilter["<=LAST_VISIT"] = $_REQUEST["date_last_visit2"];
}
}
$_REQUEST["user_name"] = trim($_REQUEST["user_name"]);
if (!empty($_REQUEST["user_name"])) {
$arFilter["SHOW_ABC"] = $_REQUEST["user_name"];
}
if ($_REQUEST["avatar"] == "Y") {
$arFilter[">=AVATAR"] = 1;
}
if (($_REQUEST["allow_post"] == "Y" || $_REQUEST["allow_post"] == "N") && CForumUser::IsAdmin()) {
$arFilter["ALLOW_POST"] = $_REQUEST["allow_post"];
}
/************** For custom ****************************************/
$arResult["filter"]["date_last_visit"] = CalendarPeriod("date_last_visit1", $_REQUEST["date_last_visit1"], "date_last_visit2", $_REQUEST["date_last_visit2"], "form1", "Y", "", "");
$arResult["filter"]["~user_name"] = $_REQUEST["user_name"];
$arResult["filter"]["user_name"] = htmlspecialcharsbx($_REQUEST["user_name"]);
/************** For custom/****************************************/
} elseif (strLen($_REQUEST["del_filter"]) > 0) {
unset($_REQUEST["user_name"]);
unset($_REQUEST["date_last_visit2"]);
unset($_REQUEST["date_last_visit1"]);
unset($_REQUEST["avatar"]);
unset($_REQUEST["sort"]);
/************** For custom ****************************************/
unset($GLOBALS["date_last_visit1_DAYS_TO_BACK"]);
示例3: UserAddInfo
public static function UserAddInfo($arOrder = array(), $arFilter = array(), $mode = false, $iNum = 0, $check_permission = true, $arNavigation = array())
{
global $DB, $USER;
$arSqlFrom = array();
$arSqlOrder = array();
$arSqlSearch = array();
$strSqlFrom = "";
$strSqlOrder = "";
$strSqlSearch = "";
$arFilter = is_array($arFilter) ? $arFilter : array();
if (!CForumUser::IsAdmin() && $check_permission) {
$arFilter["LID"] = SITE_ID;
$arFilter["PERMISSION"] = true;
}
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 "ID":
case "AUTHOR_ID":
case "FORUM_ID":
case "TOPIC_ID":
if ($strOperation == 'IN') {
$res = is_array($val) ? $val : explode(",", $val);
$val = array();
foreach ($res as $v) {
$val[] = intVal($v);
}
$val = implode(",", $val);
} else {
$val = intVal($val);
}
if ($val <= 0) {
$arSqlSearch[] = ($strNegative == "Y" ? "NOT" : "") . "(FM." . $key . " IS NULL OR FM." . $key . "<=0)";
} else {
$arSqlSearch[] = ($strNegative == "Y" ? " FM." . $key . " IS NULL OR NOT " : "") . "FM." . $key . " " . $strOperation . " (" . $DB->ForSql($val) . ")";
}
break;
case "APPROVED":
if (strLen($val) <= 0) {
$arSqlSearch[] = ($strNegative == "Y" ? "NOT" : "") . "(FM." . $key . " IS NULL OR " . ($DB->type == "MSSQL" ? "LEN" : "LENGTH") . "(FM." . $key . ")<=0)";
} else {
$arSqlSearch[] = ($strNegative == "Y" ? " FM." . $key . " IS NULL OR NOT " : "") . "FM." . $key . " " . $strOperation . " '" . $DB->ForSql($val) . "'";
}
break;
case "DATE":
case "POST_DATE":
if (strLen($val) <= 0) {
$arSqlSearch[] = ($strNegative == "Y" ? "NOT" : "") . "FM." . $key . " IS NULL";
} else {
$arSqlSearch[] = ($strNegative == "Y" ? " FM." . $key . " IS NULL OR NOT " : "") . "FM." . $key . " " . $strOperation . " " . $DB->CharToDateFunction($DB->ForSql($val), "SHORT");
}
break;
case "LID":
$arSqlFrom["FS2"] = "LEFT JOIN b_forum2site FS2 ON (FS2.FORUM_ID = FM.FORUM_ID)";
$arSqlSearch[] = ($strNegative == "Y" ? " NOT " : "") . "(FS2.SITE_ID " . $strOperation . " '" . $DB->ForSql($val) . "')";
break;
case "ACTIVE":
$arSqlFrom["F"] = "INNER JOIN b_forum F ON (F.ID = FM.FORUM_ID)";
if (strLen($val) <= 0) {
$arSqlSearch[] = ($strNegative == "Y" ? "NOT" : "") . "(F." . $key . " IS NULL OR " . ($DB->type == "MSSQL" ? "LEN" : "LENGTH") . "(F." . $key . ")<=0)";
} else {
$arSqlSearch[] = ($strNegative == "Y" ? " F." . $key . " IS NULL OR NOT " : "") . "F." . $key . " " . $strOperation . " '" . $DB->ForSql($val) . "'";
}
break;
case "USER_START_ID":
if (!is_array($val)) {
$val = array($val);
}
$tmp = array();
foreach ($val as $k => $v) {
$tmp[] = intVal(trim($v));
}
$val = implode(",", $tmp);
$arSqlFrom["FT"] = "INNER JOIN b_forum_topic FT ON (FT.ID = FM.TOPIC_ID)";
if (strLen($val) <= 0) {
$arSqlSearch[] = ($strNegative == "Y" ? "NOT" : "") . "FT." . $key . " IS NULL OR FT." . $key . "<=0";
} else {
$arSqlSearch[] = ($strNegative == "Y" ? " FT." . $key . " IS NULL OR NOT " : "") . "FT." . $key . " " . $strOperation . " (" . $DB->ForSql($val) . ")";
}
break;
case "PERMISSION":
$arSqlFrom["FP"] = "\n\t\t\t\t\t\tINNER JOIN (\n\t\t\t\t\t\t\tSELECT FP.FORUM_ID, MAX(FP.PERMISSION) AS PERMISSION\n\t\t\t\t\t\t\tFROM b_forum_perms FP\n\t\t\t\t\t\t\tWHERE FP.GROUP_ID IN (" . $DB->ForSql(implode(",", $USER->GetUserGroupArray())) . ") AND FP.PERMISSION > 'A'\n\t\t\t\t\t\t\tGROUP BY FP.FORUM_ID) FPP ON (FPP.FORUM_ID = FM.FORUM_ID) ";
$arSqlSearch[] = "(FPP.PERMISSION > 'A' AND (FM.APPROVED='Y' OR FPP.PERMISSION >= 'Q'))";
break;
case "TOPIC_TITLE":
case "POST_MESSAGE":
if ($key == "TOPIC_TITLE") {
$key = "FT.TITLE";
$arSqlFrom["FT"] = "INNER JOIN b_forum_topic FT ON (FT.ID = FM.TOPIC_ID)";
} else {
$key = "FM.POST_MESSAGE";
}
if ($strOperation == "LIKE") {
$val = "%" . $val . "%";
}
if (strLen($val) <= 0) {
$arSqlSearch[] = ($strNegative == "Y" ? "NOT" : "") . "(" . $key . " IS NULL OR " . ($DB->type == "MSSQL" ? "LEN" : "LENGTH") . "(" . $key . ")<=0)";
//.........这里部分代码省略.........
示例4: 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"];
示例5: list
$arParams["PERMISSION"] = "E";
}
} else {
$arForumSites = CForumNew::GetSites($arResult["FORUM"]["ID"]);
if (count($arForumSites) > 0) {
list($key, $val) = each($arForumSites);
if (strlen($key) > 0) {
$site_id_tmp = $key;
} else {
$site_id_tmp = false;
}
} else {
$site_id_tmp = false;
}
$bIsCurrentUserModuleAdmin = CSocNetUser::IsCurrentUserModuleAdmin($site_id_tmp);
if (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_USER, $owner_id, "forum", "full", CForumUser::IsAdmin($user_id))) {
$arParams["PERMISSION"] = "Y";
} elseif (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_USER, $owner_id, "forum", "newtopic", $bIsCurrentUserModuleAdmin)) {
$arParams["PERMISSION"] = "M";
} elseif (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_USER, $owner_id, "forum", "answer", $bIsCurrentUserModuleAdmin)) {
$arParams["PERMISSION"] = "I";
} elseif (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_USER, $owner_id, "forum", "view", $bIsCurrentUserModuleAdmin)) {
$arParams["PERMISSION"] = "E";
}
}
$arParams["PERMISSION"] = $arParams["PERMISSION"] < $sPermission ? $sPermission : $arParams["PERMISSION"];
}
}
if (empty($arResult["MESSAGE"])) {
$arError = array("code" => "EMPTY MESSAGE", "title" => GetMessage("F_EMPTY_MID"));
} elseif ($arParams["PERMISSION"]) {
示例6: CanUserDeleteGroup
function CanUserDeleteGroup($ID, $arUserGroups)
{
return CForumUser::IsAdmin($arUserGroups);
}
示例7: CheckPermissions
public static function CheckPermissions($ID)
{
global $USER, $APPLICATION;
$ID = intVal($ID);
if (CForumUser::IsAdmin()) {
return true;
}
$dbr = CForumPMFolder::GetByID($ID);
if ($arRes = $dbr->Fetch()) {
if ($arRes["USER_ID"] == $USER->GetID() || $arRes["USER_ID"] == 0) {
return true;
}
}
return false;
}
示例8: foreach
$arParams["URL_TEMPLATES_MESSAGE"] = $arParams["URL_TEMPLATES_READ"];
}
foreach ($URL_NAME_DEFAULT as $URL => $URL_VALUE) {
if (strLen(trim($arParams["URL_TEMPLATES_" . strToUpper($URL)])) <= 0) {
$arParams["URL_TEMPLATES_" . strToUpper($URL)] = $APPLICATION->GetCurPage() . "?" . $URL_VALUE;
}
$arParams["~URL_TEMPLATES_" . strToUpper($URL)] = $arParams["URL_TEMPLATES_" . strToUpper($URL)];
$arParams["URL_TEMPLATES_" . strToUpper($URL)] = htmlspecialcharsbx($arParams["~URL_TEMPLATES_" . strToUpper($URL)]);
}
/***************** ADDITIONAL **************************************/
$arParams["COUNT"] = intVal(intVal($arParams["COUNT"]) > 0 ? $arParams["COUNT"] : ($arParams["MODE_DATA"] == "forum" ? COption::GetOptionString("forum", "TOPICS_PER_PAGE", "10") : COption::GetOptionString("forum", "MESSAGES_PER_PAGE", "10")));
$arParams["COUNT"] = $arParams["COUNT"] > 0 ? $arParams["COUNT"] : 10;
$arParams["MAX_FILE_SIZE"] = intVal($arParams["MAX_FILE_SIZE"]) <= 0 ? 10 * 1024 * 1024 : intVal($arParams["MAX_FILE_SIZE"]) * 1024 * 1024;
$arParams["DATE_TIME_FORMAT"] = trim(empty($arParams["DATE_TIME_FORMAT"]) ? $DB->DateFormatToPHP(CSite::GetDateFormat("FULL")) : $arParams["DATE_TIME_FORMAT"]);
$arParams["NAME_TEMPLATE"] = !empty($arParams["NAME_TEMPLATE"]) ? $arParams["NAME_TEMPLATE"] : false;
$arParams["DESIGN_MODE"] = $GLOBALS["APPLICATION"]->GetShowIncludeAreas() && CForumUser::IsAdmin() ? "Y" : "N";
$arParams["TEMPLATES_TITLE_FORUMS"] = $arParams["TEMPLATES_TITLE_FORUMS"] ? $arParams["TEMPLATES_TITLE_FORUMS"] : GetMessage("F_TEMPLATES_TITLE_FORUMS");
$arParams["TEMPLATES_TITLE_FORUM"] = $arParams["TEMPLATES_TITLE_FORUM"] ? $arParams["TEMPLATES_TITLE_FORUM"] : GetMessage("F_TEMPLATES_TITLE_FORUM");
$arParams["TEMPLATES_TITLE_TOPIC"] = $arParams["TEMPLATES_TITLE_TOPIC"] ? $arParams["TEMPLATES_TITLE_TOPIC"] : GetMessage("F_TEMPLATES_TITLE_TOPIC");
$arParams["TEMPLATES_DESCRIPTION_FORUMS"] = $arParams["TEMPLATES_DESCRIPTION_FORUMS"] ? $arParams["TEMPLATES_DESCRIPTION_FORUMS"] : GetMessage("F_TEMPLATES_DESCRIPTION_FORUMS");
$arParams["TEMPLATES_DESCRIPTION_FORUM"] = $arParams["TEMPLATES_DESCRIPTION_FORUM"] ? $arParams["TEMPLATES_DESCRIPTION_FORUM"] : GetMessage("F_TEMPLATES_DESCRIPTION_FORUM");
$arParams["TEMPLATES_DESCRIPTION_TOPIC"] = $arParams["TEMPLATES_DESCRIPTION_TOPIC"] ? $arParams["TEMPLATES_DESCRIPTION_TOPIC"] : GetMessage("F_TEMPLATES_DESCRIPTION_TOPIC");
/***************** CACHE *******************************************/
if ($arParams["CACHE_TYPE"] == "Y" || $arParams["CACHE_TYPE"] == "A" && COption::GetOptionString("main", "component_cache_on", "Y") == "Y") {
$arParams["CACHE_TIME"] = intval($arParams["CACHE_TIME"]);
} else {
$arParams["CACHE_TIME"] = 0;
}
$arParams["CACHE_TIME"] = 0;
/********************************************************************
/Input params
示例9: ShowError
if (!CModule::IncludeModule("forum")) {
ShowError(GetMessage("FSL_NO_MODULE"));
return 0;
} elseif (!$USER->IsAuthorized()) {
$APPLICATION->AuthForm(GetMessage("FSL_AUTH"));
return 0;
}
$strErrorMessage = "";
$strOKMessage = "";
$bVarsFromForm = false;
/********************************************************************
Input params
********************************************************************/
/***************** BASE ********************************************/
$arParams["UID"] = intVal($_REQUEST["UID"]);
$arParams["UID"] = intVal(!CForumUser::IsAdmin() || $arParams["UID"] <= 0 ? $USER->GetID() : $arParams["UID"]);
$arParams["ACTION"] = strToUpper($_REQUEST["ACTION"]);
/***************** URL *********************************************/
if (empty($arParams["URL_TEMPLATES_MESSAGE"]) && !empty($arParams["URL_TEMPLATES_READ"])) {
$arParams["URL_TEMPLATES_MESSAGE"] = $arParams["URL_TEMPLATES_READ"];
}
$URL_NAME_DEFAULT = array("list" => "PAGE_NAME=list&FID=#FID#", "read" => "PAGE_NAME=read&FID=#FID#&TID=#TID#", "message" => "PAGE_NAME=message&FID=#FID#&TID=#TID#&MID=#MID#", "subscr_list" => "PAGE_NAME=subscr_list", "profile_view" => "PAGE_NAME=profile_view&UID=#UID#");
if (empty($arParams["URL_TEMPLATES_MESSAGE"]) && !empty($arParams["URL_TEMPLATES_READ"])) {
$arParams["URL_TEMPLATES_MESSAGE"] = $arParams["URL_TEMPLATES_READ"];
}
foreach ($URL_NAME_DEFAULT as $URL => $URL_VALUE) {
if (strLen(trim($arParams["URL_TEMPLATES_" . strToUpper($URL)])) <= 0) {
$arParams["URL_TEMPLATES_" . strToUpper($URL)] = $APPLICATION->GetCurPage() . "?" . $URL_VALUE;
}
$arParams["~URL_TEMPLATES_" . strToUpper($URL)] = $arParams["URL_TEMPLATES_" . strToUpper($URL)];
$arParams["URL_TEMPLATES_" . strToUpper($URL)] = htmlspecialcharsbx($arParams["~URL_TEMPLATES_" . strToUpper($URL)]);
示例10: FilterPerm
public static function FilterPerm()
{
return CForumUser::IsAdmin();
}
示例11: CanUserDeleteTopicMessage
function CanUserDeleteTopicMessage($TID, $arUserGroups, $iUserID = 0, $ExternalPermission = false)
{
$TID = intVal($TID);
$arTopic = CForumTopic::GetByID($TID);
if ($arTopic) {
if ($ExternalPermission === false && CForumUser::IsAdmin($arUserGroups)) {
return true;
}
if (!CForumUser::IsLocked($iUserID)) {
$strPerms = $ExternalPermission == false ? CForumNew::GetUserPermission($arTopic["FORUM_ID"], $arUserGroups) : $ExternalPermission;
} else {
$strPerms = CForumNew::GetPermissionUserDefault($arTopic["FORUM_ID"]);
}
if ($strPerms >= "Y") {
return true;
} elseif ($strPerms < "U") {
return false;
}
$arForum = CForumNew::GetByID($arTopic["FORUM_ID"]);
return $arForum["ACTIVE"] == "Y" ? true : false;
}
return false;
}
示例12: list
list($res["AUTHOR_STATUS_CODE"], $res["AUTHOR_STATUS"]) = ForumGetUserForumStatus(0);
} else {
if (!array_key_exists($res["AUTHOR_ID"], $UserInfo)) {
$perm = CForumNew::GetUserPermission($res["FORUM_ID"], CUser::GetUserGroup($res["AUTHOR_ID"]));
$arUser = array("Perms" => $perm, "Rank" => $perm <= "Q" ? CForumUser::GetUserRank($res["AUTHOR_ID"], LANGUAGE_ID) : "", "Points" => intVal($res["POINTS"]) > 0 ? array("POINTS" => $res["POINTS"], "DATE_UPDATE" => $res["DATE_UPDATE"]) : false);
$arUData = array();
// Status
list($arUData["AUTHOR_STATUS_CODE"], $arUData["AUTHOR_STATUS"]) = ForumGetUserForumStatus($res["AUTHOR_ID"], $arUser["Perms"], $arUser);
// Avatar
if (!empty($res["AVATAR"])) {
$arUData["AVATAR"] = array("ID" => $res["~AVATAR"], "FILE" => CFile::GetFileArray($res["~AVATAR"]));
$arUData["AVATAR"]["HTML"] = CFile::ShowImage($arUData["AVATAR"]["FILE"], COption::GetOptionString("forum", "avatar_max_width", 90), COption::GetOptionString("forum", "avatar_max_height", 90), "border=\"0\"", "", true);
}
// Voting
$arUData["VOTING"] = "N";
if (COption::GetOptionString("forum", "SHOW_VOTES", "Y") == "Y" && $USER->IsAuthorized() && (CForumUser::IsAdmin() || $USER->GetID() != $res["AUTHOR_ID"])) {
$bUnVote = $arUser["Points"];
$bVote = !$arUser["Points"] ? $arResult["USER"]["RANK"]["VOTES"] : intval($arUser["Points"]["POINTS"]) < intval($arResult["USER"]["RANK"]["VOTES"]);
$arUData["VOTING"] = $bVote ? "VOTE" : ($bUnVote ? "UNVOTE" : $res["VOTING"]);
}
// data
$arUData["DATE_REG"] = CForumFormat::DateFormat($arParams["DATE_FORMAT"], MakeTimeStamp($res["DATE_REG"], CSite::GetDateFormat()));
// Another data
$arUData["DESCRIPTION"] = $parser->wrap_long_words($res["DESCRIPTION"]);
$arUData["SIGNATURE"] = "";
if ($arResult["FORUM"]["ALLOW_SIGNATURE"] == "Y" && !empty($res["~SIGNATURE"])) {
$arUData["SIGNATURE"] = $parser->convert($res["~SIGNATURE"], array_merge($arAllow, array("SMILES" => "N")));
}
$UserInfo[$res["AUTHOR_ID"]] = $arUData;
}
$res = array_merge($res, $UserInfo[$res["AUTHOR_ID"]]);
示例13: ForumVote4User
function ForumVote4User($UID, $VOTES, $bDelVote, &$strErrorMessage, &$strOKMessage)
{
global $USER;
$arError = array();
$arNote = array();
$UID = IntVal($UID);
$VOTES = IntVal($VOTES);
$bDelVote = $bDelVote ? true : false;
$CurrUserID = 0;
if ($UID <= 0) {
$arError[] = GetMessage("F_NO_VPERS");
} else {
if (!$USER->IsAuthorized()) {
$arError[] = GetMessage("FORUM_GV_ERROR_AUTH");
} else {
$CurrUserID = IntVal($USER->GetParam("USER_ID"));
if ($CurrUserID == $UID && !CForumUser::IsAdmin()) {
$arError[] = GetMessage("FORUM_GV_OTHER");
} else {
$arUserRank = CForumUser::GetUserRank($CurrUserID);
if (IntVal($arUserRank["VOTES"]) <= 0 && !$bDelVote && !CForumUser::IsAdmin()) {
$arError[] = GetMessage("FORUM_GV_ERROR_NO_VOTE");
} else {
if (!CForumUser::IsAdmin() || $VOTES <= 0) {
$VOTES = IntVal($arUserRank["VOTES"]);
}
if ($VOTES == 0) {
$VOTES = 1;
}
// no ranks configured
$arFields = array("POINTS" => $VOTES);
$arUserPoints = CForumUserPoints::GetByID($CurrUserID, $UID);
if ($arUserPoints) {
if ($bDelVote || $VOTES <= 0) {
if (CForumUserPoints::Delete($CurrUserID, $UID)) {
$arNote[] = GetMessage("FORUM_GV_SUCCESS_UNVOTE");
} else {
$arError[] = GetMessage("FORUM_GV_ERROR_VOTE");
}
} else {
if (IntVal($arUserPoints["POINTS"]) < IntVal($arUserRank["VOTES"]) || CForumUser::IsAdmin()) {
if (CForumUserPoints::Update(IntVal($USER->GetParam("USER_ID")), $UID, $arFields)) {
$arNote[] = GetMessage("FORUM_GV_SUCCESS_VOTE_UPD");
} else {
$arError[] = GetMessage("FORUM_GV_ERROR_VOTE_UPD");
}
} else {
$arError[] = GetMessage("FORUM_GV_ALREADY_VOTE");
}
}
} else {
if (!$bDelVote && $VOTES > 0) {
$arFields["FROM_USER_ID"] = $USER->GetParam("USER_ID");
$arFields["TO_USER_ID"] = $UID;
if (CForumUserPoints::Add($arFields)) {
$arNote[] = GetMessage("FORUM_GV_SUCCESS_VOTE_ADD");
} else {
$arError[] = GetMessage("FORUM_GV_ERROR_VOTE_ADD");
}
} else {
$arError[] = GetMessage("FORUM_GV_ERROR_A");
}
}
}
}
}
}
if (!empty($arError)) {
$strErrorMessage .= implode(".\n", $arError) . ".\n";
}
if (!empty($arNote)) {
$strOKMessage .= implode(".\n", $arNote) . ".\n";
}
if (empty($arError)) {
return True;
} else {
return False;
}
}
示例14: array
/************** User info ******************************************/
if ($USER->IsAuthorized()) {
$arFields = array("USER_ID" => $USER->GetID(), "FORUM_ID" => $arParams["FID"], "TOPIC_ID" => 0, "SITE_ID" => SITE_ID);
$db_res = CForumSubscribe::GetList(array(), $arFields);
if ($db_res && ($res = $db_res->Fetch())) {
do {
$arResult["USER"]["SUBSCRIBE"][$res["ID"]] = $res;
} while ($res = $db_res->Fetch());
}
}
/********************************************************************
/Data
********************************************************************/
/************** For custom template ********************************/
$arResult["CURRENT_PAGE"] = $arResult["URL"]["TOPIC_LIST"];
$arResult["index"] = $arResult["URL"]["INDEX"];
$arResult["topic_new"] = $arResult["URL"]["TOPIC_NEW"];
$arResult["UserPermission"] = $arResult["PERMISSION"];
$arParams["IsAdmin"] = CForumUser::IsAdmin() ? "Y" : "N";
$arResult["sessid"] = bitrix_sessid_get();
/************** For custom template/********************************/
$this->IncludeComponentTemplate();
if ($arParams["SET_TITLE"] == "Y") {
$APPLICATION->SetTitle($arResult["FORUM"]["NAME"]);
}
if ($arParams["SET_NAVIGATION"] != "N") {
foreach ($arResult["GROUP_NAVIGATION"] as $key => $res) {
$APPLICATION->AddChainItem($res["NAME"], $res["URL"]["~GROUP"]);
}
$APPLICATION->AddChainItem($arResult["FORUM"]["NAME"]);
}
示例15: foreach
?>
</span><?php
$first = true;
foreach ($arResult["USERS"] as $res) {
if ($arParams["WORD_WRAP_CUT"] > 0 && strLen($res["~SHOW_NAME"]) > $arParams["WORD_WRAP_CUT"]) {
$res["SHOW_NAME"] = htmlspecialcharsEx(subStr($res["~SHOW_NAME"], 0, $arParams["WORD_WRAP_CUT"])) . "...";
}
echo !$first ? ", " : "";
?>
<span class="forum-user-online"><?php
echo str_replace(array("#URL#", "#NAME#"), array($res["profile_view"], $res["SHOW_NAME"]), $arParams["USER_TMPL"]);
?>
</span><?php
$first = false;
}
if (CForumUser::IsAdmin() && !empty($arResult["USERS_HIDDEN"])) {
foreach ($arResult["USERS_HIDDEN"] as $res) {
if ($arParams["WORD_WRAP_CUT"] > 0 && strLen($res["~SHOW_NAME"]) > $arParams["WORD_WRAP_CUT"]) {
$res["SHOW_NAME"] = htmlspecialcharsEx(subStr($res["~SHOW_NAME"], 0, $arParams["WORD_WRAP_CUT"])) . "...";
}
echo !$first ? ", " : "";
?>
<span class="forum-user-online-hidden"><?php
echo str_replace(array("#URL#", "#NAME#"), array($res["profile_view"], $res["SHOW_NAME"]), $arParams["USER_TMPL"]);
?>
</span><?php
$first = false;
}
}
?>
</div>