本文整理汇总了PHP中CBlog::IsBlogOwner方法的典型用法代码示例。如果您正苦于以下问题:PHP CBlog::IsBlogOwner方法的具体用法?PHP CBlog::IsBlogOwner怎么用?PHP CBlog::IsBlogOwner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBlog
的用法示例。
在下文中一共展示了CBlog::IsBlogOwner方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetList
//.........这里部分代码省略.........
array_key_exists("RATING_TOTAL_VOTES", $arOrder) ||
array_key_exists("RATING_TOTAL_POSITIVE_VOTES", $arOrder) ||
array_key_exists("RATING_TOTAL_NEGATIVE_VOTES", $arOrder)
)
{
$arSelectFields[] = 'RATING_TOTAL_VALUE';
$arSelectFields[] = 'RATING_TOTAL_VOTES';
$arSelectFields[] = 'RATING_TOTAL_POSITIVE_VOTES';
$arSelectFields[] = 'RATING_TOTAL_NEGATIVE_VOTES';
$arFields["RATING_TOTAL_VALUE"] = array("FIELD" => $DB->IsNull('RV.TOTAL_VALUE', '0'), "ORDER" => "RATING_TOTAL_VALUE", "TYPE" => "double", "FROM" => "LEFT JOIN b_rating_voting RV ON ( RV.ENTITY_TYPE_ID = 'BLOG_POST' AND RV.ENTITY_ID = P.ID )");
$arFields["RATING_TOTAL_VOTES"] = array("FIELD" => $DB->IsNull('RV.TOTAL_VOTES', '0'), "ORDER" => "RATING_TOTAL_VALUE", "TYPE" => "int", "FROM" => "LEFT JOIN b_rating_voting RV ON ( RV.ENTITY_TYPE_ID = 'BLOG_POST' AND RV.ENTITY_ID = P.ID )");
$arFields["RATING_TOTAL_POSITIVE_VOTES"] = array("FIELD" => $DB->IsNull('RV.TOTAL_POSITIVE_VOTES', '0'), "ORDER" => "RATING_TOTAL_POSITIVE_VOTES", "TYPE" => "int", "FROM" => "LEFT JOIN b_rating_voting RV ON ( RV.ENTITY_TYPE_ID = 'BLOG_POST' AND RV.ENTITY_ID = P.ID )");
$arFields["RATING_TOTAL_NEGATIVE_VOTES"] = array("FIELD" => $DB->IsNull('RV.TOTAL_NEGATIVE_VOTES', '0'), "ORDER" => "RATING_TOTAL_POSITIVE_VOTES", "TYPE" => "int", "FROM" => "LEFT JOIN b_rating_voting RV ON ( RV.ENTITY_TYPE_ID = 'BLOG_POST' AND RV.ENTITY_ID = P.ID )");
}
if (in_array("RATING_USER_VOTE_VALUE", $arSelectFields))
{
global $USER;
if (isset($USER) && is_object($USER))
{
$arSelectFields[] = 'RATING_USER_VOTE_VALUE';
$arFields["RATING_USER_VOTE_VALUE"] = Array("FIELD" => $DB->IsNull('RVV.VALUE', '0'), "ORDER" => "RATING_USER_VOTE_VALUE", "TYPE" => "double", "FROM" => "LEFT JOIN b_rating_vote RVV ON RVV.ENTITY_TYPE_ID = 'BLOG_POST' AND RVV.ENTITY_ID = P.ID AND RVV.USER_ID = ".intval($USER->GetId()));
}
}
// <-- FIELDS
$bNeedDistinct = false;
$blogModulePermissions = $GLOBALS["APPLICATION"]->GetGroupRight("blog");
if ($blogModulePermissions < "W")
{
$user_id = 0;
if(isset($USER) && is_object($USER) && $USER->IsAuthorized())
$user_id = $GLOBALS["USER"]->GetID();
if(!CBlog::IsBlogOwner($arFilter["BLOG_ID"], $user_id))
{
$arUserGroups = CBlogUser::GetUserGroups($user_id, IntVal($arFilter["BLOG_ID"]), "Y", BLOG_BY_USER_ID);
$strUserGroups = "0";
foreach($arUserGroups as $v)
$strUserGroups .= ",".IntVal($v);
$arFields["PERMS"] = array("FIELD" => "UGP.PERMS", "TYPE" => "string", "FROM" => "INNER 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 = '".BLOG_PERMS_POST."')");
$bNeedDistinct = true;
}
else
$arFields["PERMS"] = array("FIELD" => "'W'", "TYPE" => "string");
}
else
{
$arFields["PERMS"] = array("FIELD" => "'W'", "TYPE" => "string");
}
$arSqls = CBlog::PrepareSql($arFields, $arOrder, $arFilter, $arGroupBy, $arSelectFields, $obUserFieldsSql);
if(array_key_exists("SOCNET_GROUP_ID", $arFilter) || array_key_exists("SOCNET_GROUP_ID", $arFilter))
$bNeedDistinct = true;
if(array_key_exists("FOR_USER", $arFilter))
{
if(IntVal($arFilter["FOR_USER"]) > 0) //authorized user
{
if($arFilter["FOR_USER_TYPE"] == "ALL")
{
$arSqls["FROM"] .=
" INNER JOIN b_blog_socnet_rights SR ON (P.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 ";
示例2: 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];
}