本文整理汇总了PHP中CBlogUser::GetUserGroups方法的典型用法代码示例。如果您正苦于以下问题:PHP CBlogUser::GetUserGroups方法的具体用法?PHP CBlogUser::GetUserGroups怎么用?PHP CBlogUser::GetUserGroups使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBlogUser
的用法示例。
在下文中一共展示了CBlogUser::GetUserGroups方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetBlogUserCommentPerms
function GetBlogUserCommentPerms($ID, $userID)
{
$ID = IntVal($ID);
$userID = IntVal($userID);
$arAvailPerms = array_keys($GLOBALS["AR_BLOG_PERMS"]);
$blogModulePermissions = $GLOBALS["APPLICATION"]->GetGroupRight("blog");
if ($blogModulePermissions >= "W") {
return $arAvailPerms[count($arAvailPerms) - 1];
}
if (IntVal($ID) > 0) {
if (!($arPost = CBlogPost::GetByID($ID))) {
return $arAvailPerms[0];
} else {
$arBlog = CBlog::GetByID($arPost["BLOG_ID"]);
if ($arBlog["ENABLE_COMMENTS"] != "Y") {
return $arAvailPerms[0];
}
if (CBlog::IsBlogOwner($arPost["BLOG_ID"], $userID)) {
return $arAvailPerms[count($arAvailPerms) - 1];
}
$arUserGroups = CBlogUser::GetUserGroups($userID, $arPost["BLOG_ID"], "Y", BLOG_BY_USER_ID);
$perms = CBlogUser::GetUserPerms($arUserGroups, $arPost["BLOG_ID"], $ID, BLOG_PERMS_COMMENT, BLOG_BY_USER_ID);
if ($perms) {
return $perms;
}
}
} else {
return $arAvailPerms[0];
}
if (IntVal($userID) > 0) {
$arBlogUser = CBlogUser::GetByID($userID, BLOG_BY_USER_ID);
if ($arBlogUser && $arBlogUser["ALLOW_POST"] != "Y") {
return $arAvailPerms[0];
}
}
return $arAvailPerms[0];
}
示例2: GetList
//.........这里部分代码省略.........
"FIELD" => "BUGP.PERMS",
"TYPE" => "string",
"FROM" => "LEFT JOIN b_blog_user_group_perms BUGP
ON (C.BLOG_ID = BUGP.BLOG_ID
AND C.POST_ID = BUGP.POST_ID
AND BUGP.USER_GROUP_ID = ".$arFilter["GROUP_CHECK_PERMS"]."
AND BUGP.PERMS_TYPE = '".BLOG_PERMS_COMMENT."')"
);
$arSelectFields[] = "POST_PERM_".$arFilter["GROUP_CHECK_PERMS"];
}
}
unset($arFilter["GROUP_CHECK_PERMS"]);
}
// rating variable
if (
in_array("RATING_TOTAL_VOTES", $arSelectFields) ||
in_array("RATING_TOTAL_POSITIVE_VOTES", $arSelectFields) ||
in_array("RATING_TOTAL_NEGATIVE_VOTES", $arSelectFields) ||
array_key_exists("RATING_TOTAL_VALUE", $arOrder) ||
array_key_exists("RATING_TOTAL_VOTES", $arOrder)
)
{
$arFields["RATING_TOTAL_VALUE"] = array("FIELD" => $DB->IsNull('RV.TOTAL_VALUE', '0'), "TYPE" => "double", "FROM" => "LEFT JOIN b_rating_voting RV ON ( RV.ENTITY_TYPE_ID = 'BLOG_COMMENT' AND RV.ENTITY_ID = C.ID )");
$arFields["RATING_TOTAL_VOTES"] = array("FIELD" => $DB->IsNull('RV.TOTAL_VOTES', '0'), "TYPE" => "int", "FROM" => "LEFT JOIN b_rating_voting RV ON ( RV.ENTITY_TYPE_ID = 'BLOG_COMMENT' AND RV.ENTITY_ID = C.ID )");
$arFields["RATING_TOTAL_POSITIVE_VOTES"] = array("FIELD" => $DB->IsNull('RV.TOTAL_POSITIVE_VOTES', '0'), "TYPE" => "int", "FROM" => "LEFT JOIN b_rating_voting RV ON ( RV.ENTITY_TYPE_ID = 'BLOG_COMMENT' AND RV.ENTITY_ID = C.ID )");
$arFields["RATING_TOTAL_NEGATIVE_VOTES"] = array("FIELD" => $DB->IsNull('RV.TOTAL_NEGATIVE_VOTES', '0'), "TYPE" => "int", "FROM" => "LEFT JOIN b_rating_voting RV ON ( RV.ENTITY_TYPE_ID = 'BLOG_COMMENT' AND RV.ENTITY_ID = C.ID )");
}
$bNeedDistinct = false;
$blogModulePermissions = $GLOBALS["APPLICATION"]->GetGroupRight("blog");
if ($blogModulePermissions < "W")
{
$arUserGroups = CBlogUser::GetUserGroups(($GLOBALS["USER"]->IsAuthorized() ? $GLOBALS["USER"]->GetID() : 0), 0, "Y", BLOG_BY_USER_ID);
$strUserGroups = "0";
foreach($arUserGroups as $v)
$strUserGroups .= ",".IntVal($v);
$arFields["PERMS"] = array("FIELD" => "UGP.PERMS", "TYPE" => "char", "FROM" => "INNER JOIN b_blog_user_group_perms UGP ON (C.POST_ID = UGP.POST_ID AND C.BLOG_ID = UGP.BLOG_ID AND UGP.USER_GROUP_ID IN (".$strUserGroups.") AND UGP.PERMS_TYPE = '".BLOG_PERMS_COMMENT."')");
$bNeedDistinct = true;
}
else
{
$arFields["PERMS"] = array("FIELD" => "'W'", "TYPE" => "string");
}
$arSqls = CBlog::PrepareSql($arFields, $arOrder, $arFilter, $arGroupBy, $arSelectFields, $obUserFieldsSql);
if(array_key_exists("FOR_USER", $arFilter))
{
if(IntVal($arFilter["FOR_USER"]) > 0) //authorized user
{
$arSqls["FROM"] .=
" INNER JOIN b_blog_socnet_rights SR ON (C.POST_ID = SR.POST_ID) " .
" LEFT JOIN b_user_access UA ON (UA.ACCESS_CODE = SR.ENTITY AND UA.USER_ID = ".IntVal($arFilter["FOR_USER"]).") ";
if(strlen($arSqls["WHERE"]) > 0)
$arSqls["WHERE"] .= " AND ";
$arSqls["WHERE"] .= " (UA.USER_ID is not NULL OR SR.ENTITY = 'AU') ";
}
else
{
$arSqls["FROM"] .=
" INNER JOIN b_blog_socnet_rights SR ON (C.POST_ID = SR.POST_ID) ".
" INNER JOIN b_user_access UA ON (UA.ACCESS_CODE = SR.ENTITY AND UA.USER_ID = 0)";
}
$bNeedDistinct = true;
}
示例3: GetListCalendar
function GetListCalendar($blogID, $year = false, $month = false, $day = false)
{
global $DB;
$blogID = IntVal($blogID);
if ($year)
if (strlen($year) == 2)
$year = "20".$year;
if ($year && $month && $day)
{
$date1 = mktime(0, 0, 0, $month, $day, $year);
$date2 = mktime(0, 0, 0, $month, $day + 1, $year);
}
elseif ($month && $year)
{
$date1 = mktime(0, 0, 0, $month, 1, $year);
$date2 = mktime(0, 0, 0, $month + 1, 1, $year);
}
elseif ($year)
{
$date1 = mktime(0, 0, 0, 1, 1, $year);
$date2 = mktime(0, 0, 0, 1, 1, $year + 1);
}
$datePublishFrom = ConvertTimeStamp($date1, "SHORT", SITE_ID);
$datePublishTo = ConvertTimeStamp($date2, "SHORT", SITE_ID);
$arUserGroups = CBlogUser::GetUserGroups(($GLOBALS["USER"]->IsAuthorized() ? $GLOBALS["USER"]->GetID() : 0), $arFilter["BLOG_ID"], "Y", BLOG_BY_USER_ID);
$strUserGroups = "0";
foreach($arUserGroups as $v)
$strUserGroups .= ",".IntVal($v);
$strFromPerms =
" LEFT JOIN b_blog_user_group_perms UGP ".
" ON (P.ID = UGP.POST_ID ".
" AND P.BLOG_ID = UGP.BLOG_ID ".
" AND UGP.USER_GROUP_ID IN (".$strUserGroups.") ".
" AND UGP.PERMS_TYPE = '".$DB->ForSql(BLOG_PERMS_POST)."') ";
$strWherePerms = " AND (UGP.PERMS > 'D') ";
$blogModulePermissions = $GLOBALS["APPLICATION"]->GetGroupRight("blog");
if ($blogModulePermissions >= "W")
{
$strFromPerms = "";
$strWherePerms = "";
}
$strSql =
"SELECT DATE_FORMAT(P.DATE_PUBLISH, '%Y-%m-%d') as DATE_PUBLISH1, COUNT(P.ID) as CNT ".
"FROM b_blog_post P ".$strFromPerms." ".
"WHERE P.BLOG_ID = ".$blogID." ".
" AND P.DATE_PUBLISH >= ".$DB->CharToDateFunction($DB->ForSql($datePublishFrom), "SHORT")." ".
" AND P.DATE_PUBLISH < ".$DB->CharToDateFunction($DB->ForSql($datePublishTo), "SHORT")." ".
" AND P.PUBLISH_STATUS = '".$DB->ForSql(BLOG_PUBLISH_STATUS_PUBLISH)."' ".
" ".$strWherePerms." ".
"GROUP BY DATE_PUBLISH1 ".
"ORDER BY DATE_PUBLISH1 ";
$dbRes = $DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);
$arResult = array();
while ($arRes = $dbRes->Fetch())
{
$arDate = explode("-", $arRes["DATE_PUBLISH1"]);
$arResult[] = array(
"YEAR" => $arDate[0],
"MONTH" => $arDate[1],
"DAY" => $arDate[2],
"DATE" => ConvertTimeStamp(mktime(0, 0, 0, $arDate[1], $arDate[2], $arDate[0]), "SHORT", LANG)
);
}
return $arResult;
}
示例4: GetMessage
$arResultNFCache["OK_MESSAGE"][] = GetMessage("BLOG_BLOG_BLOG_REQUEST_ADDED_2");
break;
case 7:
$arResultNFCache["OK_MESSAGE"][] = GetMessage("BLOG_BLOG_BLOG_LEAVED");
break;
}
}
} else {
$arResultNFCache["ERROR_MESSAGE"][] = $_GET["frnd_res_ok"] . GetMessage("BLOG_BLOG_SESSID_WRONG");
}
} else {
$arResultNFCache["ERROR_MESSAGE"][] = GetMessage("BLOG_BLOG_BLOG_REQUEST_NEED_AUTH");
}
}
if ($GLOBALS["USER"]->IsAuthorized()) {
$arUserGroups = CBlogUser::GetUserGroups($user_id, $arParams["BLOG_URL"], "Y", BLOG_BY_USER_ID, "URL");
} else {
$arUserGroups = array(1);
}
$numUserGroups = count($arUserGroups);
for ($i = 0; $i < $numUserGroups - 1; $i++) {
for ($j = $i + 1; $j < $numUserGroups; $j++) {
if ($arUserGroups[$i] > $arUserGroups[$j]) {
$tmpGroup = $arUserGroups[$i];
$arUserGroups[$i] = $arUserGroups[$j];
$arUserGroups[$j] = $tmpGroup;
}
}
}
$strUserGroups = "";
for ($i = 0; $i < $numUserGroups; $i++) {
示例5: ShowError
ShowError(GetMessage("BLOG_BLOG_BLOG_NO_BLOG"));
CHTTP::SetStatus("404 Not Found");
return;
}
$arBlog = $arResult["BLOG"];
$tmpVal = COption::GetOptionInt("idea", "blog_group_id", false, SITE_ID);
if (intval($arBlog["GROUP_ID"]) > 0 && (!$tmpVal || $tmpVal != intval($arBlog["GROUP_ID"]))) {
COption::SetOptionInt("idea", "blog_group_id", $arBlog["GROUP_ID"], false, SITE_ID);
}
$arFilter = is_string($arParams["FILTER_NAME"]) && preg_match("/^[A-Za-z_][A-Za-z01-9_]*\$/i", $arParams["FILTER_NAME"]) ? $GLOBALS[$arParams["FILTER_NAME"]] : array();
$arFilter = is_array($arFilter) ? $arFilter : array();
$arResult["ERROR_MESSAGE"] = array();
$arResultNFCache = array("OK_MESSAGE" => array(), "ERROR_MESSAGE" => array());
$user_id = intval($USER->GetID());
$arResult["PostPerm"] = CBlog::GetBlogUserPostPerms($arResult["BLOG"]["ID"], $user_id);
$arUserGroups = $GLOBALS["USER"]->IsAuthorized() ? CBlogUser::GetUserGroups($user_id, $arParams["BLOG_URL"], "Y", BLOG_BY_USER_ID, "URL") : array(1);
sort($arUserGroups);
$cache_id = "blog_blog_message_" . serialize(array($arParams["BLOG_URL"], $arParams["RATING_TEMPLATE"], $arParams["SORT_BY1"] => $arParams["SORT_ORDER1"], $arParams["SORT_BY2"] => $arParams["SORT_ORDER2"], $arParams["IBLOCK_CATEGORIES"], $arParams["EXT_FILTER"], $arParams["PATH_TO_BLOG"], $arParams["POST_PROPERTY_LIST"], $arParams["DATE_TIME_FORMAT"], $arParams["NAV_TEMPLATE"], $arParams["GROUP_ID"], $arParams["NAME_TEMPLATE"], $arParams["SHOW_LOGIN"], $arParams["IMAGE_MAX_WIDTH"], $arParams["IMAGE_MAX_HEIGHT"], $arParams["ALLOW_POST_CODE"], $arParams["CATEGORY_ID"], CDBResult::NavStringForCache($arParams["MESSAGE_COUNT"]), $arUserGroups, $arResult["PostPerm"], $arResult["IDEA_MODERATOR"]));
if (!isset($_GET["PAGEN_1"]) || IntVal($_GET["PAGEN_1"]) < 1) {
$CACHE_TIME = $arParams["CACHE_TIME"];
$cache_path = "/" . SITE_ID . "/idea/" . $arBlog["ID"] . "/first_page/";
} else {
$CACHE_TIME = $arParams["CACHE_TIME_LONG"];
$cache_path = "/" . SITE_ID . "/idea/" . $arBlog["ID"] . "/pages/" . IntVal($_GET["PAGEN_1"]) . "/";
}
/********************************************************************
/Default params
********************************************************************/
/********************************************************************
Actions
********************************************************************/
示例6: GetUserPerms
function GetUserPerms($arGroups, $blogID, $postID = 0, $permsType = BLOG_PERMS_POST, $selectType = BLOG_BY_BLOG_USER_ID)
{
global $DB;
$blogID = IntVal($blogID);
$postID = IntVal($postID);
$permsType = $permsType == BLOG_PERMS_COMMENT ? BLOG_PERMS_COMMENT : BLOG_PERMS_POST;
$selectType = $selectType == BLOG_BY_USER_ID ? BLOG_BY_USER_ID : BLOG_BY_BLOG_USER_ID;
if (!is_array($arGroups)) {
$ID = IntVal($arGroups);
$arGroups = CBlogUser::GetUserGroups($ID, $blogID, "Y", $selectType);
}
$strGroups = "";
foreach ($arGroups as $val) {
if (strlen($strGroups) > 0) {
$strGroups .= ",";
}
$strGroups .= IntVal($val);
}
$varName = "BLOG_USER_PERMS_CACHE_" . $blogID . "_" . $postID . "_" . $permsType;
if (isset($GLOBALS["BLOG_USER"][$varName]) && is_array($GLOBALS["BLOG_USER"][$varName]) && isset($GLOBALS["BLOG_USER"][$varName][$strGroups]) && is_array($GLOBALS["BLOG_USER"][$varName][$strGroups])) {
return $GLOBALS["BLOG_USER"][$varName][$strGroups];
} else {
if ($postID > 0) {
$strSql = "SELECT MAX(P.PERMS) as PERMS " . "FROM b_blog_user_group_perms P " . "WHERE P.BLOG_ID = " . $blogID . " " . "\tAND P.USER_GROUP_ID IN (" . $strGroups . ") " . "\tAND P.PERMS_TYPE = '" . $DB->ForSql($permsType) . "' " . "\tAND P.POST_ID = " . $postID . " ";
$dbResult = $DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
if (($arResult = $dbResult->Fetch()) && strlen($arResult["PERMS"]) > 0) {
$GLOBALS["BLOG_USER"][$varName][$strGroups] = $arResult["PERMS"];
return $arResult["PERMS"];
}
}
$strSql = "SELECT MAX(P.PERMS) as PERMS " . "FROM b_blog_user_group_perms P " . "WHERE P.BLOG_ID = " . $blogID . " " . "\tAND P.USER_GROUP_ID IN (" . $strGroups . ") " . "\tAND P.PERMS_TYPE = '" . $DB->ForSql($permsType) . "' " . "\tAND P.POST_ID IS NULL ";
$dbResult = $DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
if (($arResult = $dbResult->Fetch()) && strlen($arResult["PERMS"]) > 0) {
$GLOBALS[$varName][$strGroups] = $arResult["PERMS"];
return $arResult["PERMS"];
}
return False;
}
}
示例7: BXClearCache
BXClearCache(True, "/" . SITE_ID . "/blog/" . $arBlog["URL"] . "/rss_out/");
} else {
$errorMessage = GetMessage("BLOG_BLOG_BLOG_MES_DEL_ERROR");
}
} else {
$errorMessage = GetMessage("BLOG_BLOG_BLOG_MES_DEL_NO_RIGHTS");
}
}
if (StrLen($errorMessage) > 0) {
echo "<div class=\"blogError\">" . $errorMessage . "</div>";
}
if (StrLen($okMessage) > 0) {
echo "<div class=\"blogOK\">" . $okMessage . "</div>";
}
//формируем кэш
$arUserGroups = CBlogUser::GetUserGroups($GLOBALS["USER"]->IsAuthorized() ? $user_id : 0, $arBlog["ID"], "Y", BLOG_BY_USER_ID);
$numUserGroups = count($arUserGroups);
for ($i = 0; $i < $numUserGroups - 1; $i++) {
for ($j = $i + 1; $j < $numUserGroups; $j++) {
if ($arUserGroups[$i] > $arUserGroups[$j]) {
$tmpGroup = $arUserGroups[$i];
$arUserGroups[$i] = $arUserGroups[$j];
$arUserGroups[$j] = $tmpGroup;
}
}
}
$strUserGroups = "";
for ($i = 0; $i < $numUserGroups; $i++) {
$strUserGroups .= "_" . $arUserGroups[$i];
}
if (!isset($_GET["PAGEN_1"]) || IntVal($_GET["PAGEN_1"]) < 1) {
示例8: array
}
if (empty($arBlogUser)) {
CBlogUser::Add(array("USER_ID" => $arUser["ID"], "=LAST_VISIT" => $DB->GetNowFunction(), "=DATE_REG" => $DB->GetNowFunction(), "ALLOW_POST" => "Y"));
}
CBlogUser::AddToUserGroup($arUser["ID"], $arBlog["ID"], $GLOBALS["add2groups"], "", BLOG_BY_USER_ID, BLOG_CHANGE);
$dbCandidate = CBlogCandidate::GetList(array(), array("BLOG_ID" => $arBlog["ID"], "USER_ID" => $arUser["ID"]));
if ($arCandidate = $dbCandidate->Fetch()) {
CBlogCandidate::Delete($arCandidate["ID"]);
}
LocalRedirect(CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER_SETTINGS"], array("blog" => $arBlog["URL"])));
}
$arResult["ERROR_MESSAGE"] = $errorMessage;
$arResult["OK_MESSAGE"] = $okMessage;
$arResult["userName"] = CBlogUser::GetUserName($arBlogUser["ALIAS"], $arUser["NAME"], $arUser["LAST_NAME"], $arUser["LOGIN"]);
$arResult["urlToUser"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arUser["ID"]));
$arResult["arUserGroups"] = CBlogUser::GetUserGroups($arUser["ID"], $arBlog["ID"], "Y", BLOG_BY_USER_ID);
$dbBlogGroups = CBlogUserGroup::GetList(array("NAME" => "ASC"), array("BLOG_ID" => $arBlog["ID"]), false, false, array("ID", "NAME"));
while ($arBlogGroups = $dbBlogGroups->GetNext()) {
$arResult["Groups"][] = $arBlogGroups;
}
} else {
$arResult["FATAL_ERROR"] = GetMessage("B_B_US_NO_RIGHT");
}
} else {
$arResult["FATAL_ERROR"] = GetMessage("B_B_US_NO_BLOG");
}
} else {
$arResult["FATAL_ERROR"] = GetMessage("B_B_US_NO_BLOG");
}
} else {
$arResult["FATAL_ERROR"] = GetMessage("B_B_US_NO_BLOG");
示例9: IntVal
if ($arParams["YEAR"] < 1990 || $arParams["YEAR"] > 2020) {
$arParams["YEAR"] = $todayYear;
}
$arParams["DAY"] = IntVal($arParams["DAY"]);
$bSelectDay = $arParams["DAY"] > 0 ? True : False;
if ($arParams["DAY"] < 1 || $arParams["DAY"] > 31) {
$arParams["DAY"] = $todayDay;
}
if ($arParams["YEAR"] > $todayYear || $arParams["YEAR"] == $todayYear && $arParams["MONTH"] > $todayMonth) {
$arParams["MONTH"] = $todayMonth;
$arParams["YEAR"] = $todayYear;
}
$arResult["CALENDAR"] = array();
if (StrLen($arParams["BLOG_URL"]) > 0) {
if ($GLOBALS["USER"]->IsAuthorized()) {
$arUserGroups = CBlogUser::GetUserGroups($USER->GetID(), $arBlog["ID"], "Y", BLOG_BY_USER_ID);
} else {
$arUserGroups = array(1);
}
$numUserGroups = count($arUserGroups);
for ($i = 0; $i < $numUserGroups - 1; $i++) {
for ($j = $i + 1; $j < $numUserGroups; $j++) {
if ($arUserGroups[$i] > $arUserGroups[$j]) {
$tmpGroup = $arUserGroups[$i];
$arUserGroups[$i] = $arUserGroups[$j];
$arUserGroups[$j] = $tmpGroup;
}
}
}
$strUserGroups = "";
for ($i = 0; $i < $numUserGroups; $i++) {
示例10: GetBlogUserCommentPerms
public static function GetBlogUserCommentPerms($ID, $userID)
{
$ID = IntVal($ID);
$userID = IntVal($userID);
$arAvailPerms = array_keys($GLOBALS["AR_BLOG_PERMS"]);
$blogModulePermissions = $GLOBALS["APPLICATION"]->GetGroupRight("blog");
if ($blogModulePermissions >= "W")
return $arAvailPerms[count($arAvailPerms) - 1];
if (CBlog::IsBlogOwner($ID, $userID))
return $arAvailPerms[count($arAvailPerms) - 1];
$arBlog = CBlog::GetByID($ID);
if ($arBlog["ENABLE_COMMENTS"] != "Y")
return $arAvailPerms[0];
$arBlogUser = CBlogUser::GetByID($userID, BLOG_BY_USER_ID);
if ($arBlogUser && $arBlogUser["ALLOW_POST"] != "Y")
return $arAvailPerms[0];
$arUserGroups = CBlogUser::GetUserGroups($userID, $ID, "Y", BLOG_BY_USER_ID);
$perms = CBlogUser::GetUserPerms($arUserGroups, $ID, 0, BLOG_PERMS_COMMENT, BLOG_BY_USER_ID);
if ($perms)
return $perms;
return $arAvailPerms[0];
}