本文整理汇总了PHP中CBlogPost::GetSocNetPostPerms方法的典型用法代码示例。如果您正苦于以下问题:PHP CBlogPost::GetSocNetPostPerms方法的具体用法?PHP CBlogPost::GetSocNetPostPerms怎么用?PHP CBlogPost::GetSocNetPostPerms使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBlogPost
的用法示例。
在下文中一共展示了CBlogPost::GetSocNetPostPerms方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkUserReadAccess
/**
* Returns true if current user has read access to the blog post.
* @param array $params Allowed keys: postId, userId.
* @param int $userId Current user's id.
* @return bool
*/
public static function checkUserReadAccess(array $params, $userId)
{
if (!Loader::includeModule('blog')) {
return false;
}
$permissions = \CBlogPost::GetSocNetPostPerms($params['postId'], true, $userId);
return $permissions >= BLOG_PERMS_READ;
}
示例2: elseif
$bNoLogEntry = true;
}
}
if (!$arResult["bFromList"]) {
CBlogPost::CounterInc($arPost["ID"]);
}
$arPost = CBlogTools::htmlspecialcharsExArray($arPost);
if ($arPost["AUTHOR_ID"] == $user_id) {
$arPost["perms"] = $arResult["PostPerm"] = BLOG_PERMS_FULL;
} elseif ($arResult["bFromList"]) {
$arPost["perms"] = $arResult["PostPerm"] = BLOG_PERMS_READ;
if (CSocNetUser::IsCurrentUserModuleAdmin(SITE_ID, !isset($arParams["MOBILE"]) || $arParams["MOBILE"] != "Y") || $APPLICATION->GetGroupRight("blog") >= "W") {
$arPost["perms"] = $arResult["PostPerm"] = BLOG_PERMS_FULL;
}
} else {
$arPost["perms"] = $arResult["PostPerm"] = $bNoLogEntry ? BLOG_PERMS_DENY : CBlogPost::GetSocNetPostPerms($arPost["ID"], true, false, $arPost["AUTHOR_ID"]);
}
$arResult["Post"] = $arPost;
$arResult["PostSrc"] = $arPost;
$arResult["Blog"] = $arBlog;
$arResult["PostSrc"]["PATH_TO_CONPANY_DEPARTMENT"] = $arParams["PATH_TO_CONPANY_DEPARTMENT"];
$arResult["PostSrc"]["PATH_TO_GROUP"] = $arParams["PATH_TO_GROUP"];
$arResult["PostSrc"]["bExtranetSite"] = $arResult["bExtranetSite"];
$arResult["urlToPost"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_POST"], array("post_id" => CBlogPost::GetPostID($arResult["Post"]["ID"], $arResult["Post"]["CODE"], $arParams["ALLOW_POST_CODE"]), "user_id" => $arPost["AUTHOR_ID"]));
if (is_set($arParams["PATH_TO_GROUP"])) {
$strSiteWorkgroupsPage = COption::GetOptionString("socialnetwork", "workgroups_page", SITE_DIR . "workgroups/", SITE_ID);
if (strlen($strSiteWorkgroupsPage) > 0) {
if (strpos($arParams["PATH_TO_GROUP"], $strSiteWorkgroupsPage) === 0) {
$arParams["PATH_TO_GROUP"] = "#GROUPS_PATH#" . substr($arParams["PATH_TO_GROUP"], strlen($strSiteWorkgroupsPage), strlen($arParams["PATH_TO_GROUP"]) - strlen($strSiteWorkgroupsPage));
}
}
示例3: BuildRSS
//.........这里部分代码省略.........
$rssText .= " <pubDate>".$now."</pubDate>\n";
$rssText .= "\n";
}
elseif ($type == "atom.03")
{
$atomID = "tag:".htmlspecialcharsbx($serverName).",".date("Y-m-d").":".$postID;
$rssText .= "<"."?xml version=\"1.0\" encoding=\"".$charset."\"?".">\n\n";
$rssText .= "<feed version=\"0.3\" xmlns=\"http://purl.org/atom/ns#\" xml:lang=\"".$language."\">\n";
$rssText .= " <title>".$blogName."</title>\n";
$rssText .= " <tagline>".$url."</tagline>\n";
$rssText .= " <id>".$atomID."</id>\n";
$rssText .= " <link rel=\"alternate\" type=\"text/html\" href=\"".$url."\" />\n";
$rssText .= " <modified>".$nowISO."</modified>\n";
$BlogUser = CBlogUser::GetByID($arPost["AUTHOR_ID"], BLOG_BY_USER_ID);
$authorP = htmlspecialcharsex(CBlogUser::GetUserName($BlogUser["ALIAS"], $arUser["NAME"], $arUser["LAST_NAME"], $arUser["LOGIN"], $arUser["SECOND_NAME"]));
if(strLen($arPathTemplate["PATH_TO_USER"])>0)
$authorURLP = htmlspecialcharsbx("http://".$serverName.CComponentEngine::MakePathFromTemplate($arPathTemplate["PATH_TO_USER"], array("user_id"=>$arPost["AUTHOR_ID"])));
else
$authorURLP = "http://".$serverName.CBlogUser::PreparePath($arPost["AUTHOR_ID"], $arGroup["SITE_ID"]);
$rssText .= " <author>\n";
$rssText .= " <name>".$authorP."</name>\n";
$rssText .= " <uri>".$authorURLP."</uri>\n";
$rssText .= " </author>\n";
$rssText .= "\n";
}
$user_id = $GLOBALS["USER"]->GetID();
if($arPathTemplate["USE_SOCNET"] == "Y")
{
$postPerm = CBlogPost::GetSocNetPostPerms($postID);
if($postPerm > BLOG_PERMS_DENY)
$postPerm = CBlogComment::GetSocNetUserPerms($postID, $arPost["AUTHOR_ID"]);
}
else
$postPerm = CBlogPost::GetBlogUserCommentPerms($postID, IntVal($user_id));
if($postPerm >= BLOG_PERMS_READ)
{
$parser = new blogTextParser();
$arParserParams = Array(
"imageWidth" => $arPathTemplate["IMAGE_MAX_WIDTH"],
"imageHeight" => $arPathTemplate["IMAGE_MAX_HEIGHT"],
);
CTimeZone::Disable();
$dbComments = CBlogComment::GetList(
array("DATE_CREATE" => "DESC"),
array(
//"BLOG_ID" => $blogID,
"POST_ID" => $postID,
"PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH,
),
false,
array("nTopCount" => $numPosts),
array("ID", "TITLE", "DATE_CREATE", "POST_TEXT", "AUTHOR_EMAIL", "AUTHOR_ID", "AUTHOR_NAME", "USER_LOGIN", "USER_LAST_NAME", "USER_SECOND_NAME", "USER_NAME", "BLOG_USER_ALIAS")
);
CTimeZone::Enable();
$arImages = Array();
$dbImages = CBlogImage::GetList(Array(), Array("BLOG_ID" => $blogID, "POST_ID" => $postID, "IS_COMMENT" => "Y", "!COMMENT_ID" => false));
while($arI = $dbImages->Fetch())
$arImages[$arI["ID"]] = $arI["FILE_ID"];
示例4: NotifyIm
//.........这里部分代码省略.........
if (strpos($url, "http://") === 0 || strpos($url, "https://") === 0) {
$serverName = "";
} else {
$serverName = $arTmp["SERVER_NAME"];
}
if ($arParams["TYPE"] == "POST") {
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage("BLG_GP_IM_1" . $aditGM, array("#title#" => "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("BLG_GP_IM_1" . $aditGM, array("#title#" => htmlspecialcharsbx($arParams["TITLE_OUT"]))) . " (" . $serverName . $url . ")";
} elseif ($arParams["TYPE"] == "COMMENT") {
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage("BLG_GP_IM_4" . $aditGM, array("#title#" => "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("BLG_GP_IM_4" . $aditGM, array("#title#" => htmlspecialcharsbx($arParams["TITLE_OUT"]))) . " " . $serverName . $url . "\n\n" . $arParams["BODY"];
$arMessageFields["NOTIFY_MESSAGE_AUTHOR"] = GetMessage("BLG_GP_IM_5" . $aditGM, array("#title#" => "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_AUTHOR_OUT"] = GetMessage("BLG_GP_IM_5" . $aditGM, array("#title#" => htmlspecialcharsbx($arParams["TITLE_OUT"]))) . " " . $serverName . $url . "\n\n" . $arParams["BODY"];
} elseif ($arParams["TYPE"] == "SHARE") {
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage("BLG_GP_IM_8" . $aditGM, array("#title#" => "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("BLG_GP_IM_8" . $aditGM, array("#title#" => htmlspecialcharsbx($arParams["TITLE_OUT"]))) . " " . $serverName . $url . "";
} elseif ($arParams["TYPE"] == "SHARE2USERS") {
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage("BLG_GP_IM_9" . $aditGM, array("#title#" => "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("BLG_GP_IM_9" . $aditGM, array("#title#" => htmlspecialcharsbx($arParams["TITLE_OUT"]))) . " " . $serverName . $url . "";
}
}
$arMessageFieldsTmp = $arMessageFields;
if ($arParams["TYPE"] == "COMMENT") {
if ($arParams["AUTHOR_ID"] == $v) {
$arMessageFieldsTmp["NOTIFY_MESSAGE"] = $arMessageFields["NOTIFY_MESSAGE_AUTHOR"];
$arMessageFieldsTmp["NOTIFY_MESSAGE_OUT"] = $arMessageFields["NOTIFY_MESSAGE_AUTHOR_OUT"];
}
}
$arMessageFieldsTmp["TO_USER_ID"] = $v;
$ID = CIMNotify::Add($arMessageFieldsTmp);
$arUserIDSent[] = $v;
}
if (!empty($arParams["MENTION_ID"])) {
if (!is_array($arParams["MENTION_ID_OLD"])) {
$arParams["MENTION_ID_OLD"] = array();
}
foreach ($arParams["MENTION_ID"] as $val) {
$val = IntVal($val);
if (IntVal($val) > 0 && !in_array($val, $arUsers) && !in_array($val, $arParams["MENTION_ID_OLD"]) && $val != $arParams["FROM_USER_ID"]) {
if (CBlogPost::GetSocNetPostPerms($arParams["ID"], false, $val) >= BLOG_PERMS_READ) {
$arMessageFields["TO_USER_ID"] = $val;
$arMessageFields["NOTIFY_EVENT"] = "mention";
if (IsModuleInstalled("extranet")) {
$arTmp = CSocNetLogTools::ProcessPath(array("URL" => $arParams["URL"]), $val);
$url = $arTmp["URLS"]["URL"];
if (strpos($url, "http://") === 0 || strpos($url, "https://") === 0) {
$serverName = "";
} else {
$serverName = $arTmp["SERVER_NAME"];
}
if ($arParams["TYPE"] == "POST") {
$arMessageFields["NOTIFY_TAG"] = "BLOG|POST_MENTION|" . $arParams["ID"];
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage("BLG_GP_IM_6" . $aditGM, array("#title#" => "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("BLG_GP_IM_6" . $aditGM, array("#title#" => htmlspecialcharsbx($arParams["TITLE_OUT"]))) . " " . $serverName . $url . "";
} elseif ($arParams["TYPE"] == "COMMENT") {
$arMessageFields["NOTIFY_TAG"] = "BLOG|COMMENT_MENTION|" . $arParams["ID"];
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage("BLG_GP_IM_7" . $aditGM, array("#title#" => "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("BLG_GP_IM_7" . $aditGM, array("#title#" => htmlspecialcharsbx($arParams["TITLE_OUT"]))) . " " . $serverName . $url . "";
}
} else {
if ($arParams["TYPE"] == "POST") {
$arMessageFields["NOTIFY_TAG"] = "BLOG|POST_MENTION|" . $arParams["ID"];
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage("BLG_GP_IM_6" . $aditGM, array("#title#" => "<a href=\"" . $arParams["URL"] . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("BLG_GP_IM_6" . $aditGM, array("#title#" => htmlspecialcharsbx($arParams["TITLE_OUT"]))) . " " . $serverName . $arParams["URL"] . "";
} elseif ($arParams["TYPE"] == "COMMENT") {
$arMessageFields["NOTIFY_TAG"] = "BLOG|COMMENT_MENTION|" . $arParams["ID"];
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage("BLG_GP_IM_7" . $aditGM, array("#title#" => "<a href=\"" . $arParams["URL"] . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("BLG_GP_IM_7" . $aditGM, array("#title#" => htmlspecialcharsbx($arParams["TITLE_OUT"]))) . " " . $serverName . $arParams["URL"] . "";
}
}
$ID = CIMNotify::Add($arMessageFields);
$arUserIDSent[] = $val;
if (intval($ID) > 0 && intval($arMessageFields["LOG_ID"]) > 0) {
foreach (GetModuleEvents("blog", "OnBlogPostMentionNotifyIm", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($ID, $arMessageFields));
}
}
}
}
}
}
if ($arParams["TYPE"] == "POST" && !empty($arParams["TO_SOCNET_RIGHTS"])) {
$arGroupsId = array();
foreach ($arParams["TO_SOCNET_RIGHTS"] as $perm_tmp) {
if (preg_match('/^SG(\\d+)_' . SONET_ROLES_USER . '$/', $perm_tmp, $matches) || preg_match('/^SG(\\d+)$/', $perm_tmp, $matches)) {
$group_id_tmp = $matches[1];
if ($group_id_tmp > 0 && (!array_key_exists("SG", $arParams["TO_SOCNET_RIGHTS_OLD"]) || empty($arParams["TO_SOCNET_RIGHTS_OLD"]["SG"][$group_id_tmp]))) {
$arGroupsId[] = $group_id_tmp;
}
}
}
if (!empty($arGroupsId)) {
$title_tmp = str_replace(array("\r\n", "\n"), " ", $arParams["TITLE"]);
$title = TruncateText($title_tmp, 100);
$title_out = TruncateText($title_tmp, 255);
$arNotifyParams = array("LOG_ID" => $arMessageFields["LOG_ID"], "GROUP_ID" => $arGroupsId, "NOTIFY_MESSAGE" => "", "FROM_USER_ID" => $arParams["FROM_USER_ID"], "URL" => $arParams["URL"], "MESSAGE" => GetMessage("SONET_IM_NEW_POST", array("#title#" => "<a href=\"#URL#\" class=\"bx-notifier-item-action\">" . $title . "</a>")), "MESSAGE_OUT" => GetMessage("SONET_IM_NEW_POST", array("#title#" => $title_out)) . " #URL#", "EXCLUDE_USERS" => array_merge(array($arParams["FROM_USER_ID"]), array($arUserIDSent)));
CSocNetSubscription::NotifyGroup($arNotifyParams);
}
}
}
示例5: elseif
}
}
}
if (!$arResult["bFromList"]) {
CBlogPost::CounterInc($arPost["ID"]);
}
$arPost = CBlogTools::htmlspecialcharsExArray($arPost);
if ($arPost["AUTHOR_ID"] == $user_id) {
$arPost["perms"] = $arResult["PostPerm"] = BLOG_PERMS_FULL;
} elseif ($arResult["bFromList"]) {
$arPost["perms"] = $arResult["PostPerm"] = BLOG_PERMS_READ;
if (CSocNetUser::IsCurrentUserModuleAdmin(SITE_ID, !isset($arParams["MOBILE"]) || $arParams["MOBILE"] != "Y") || $APPLICATION->GetGroupRight("blog") >= "W") {
$arPost["perms"] = $arResult["PostPerm"] = BLOG_PERMS_FULL;
}
} else {
$arPost["perms"] = $arResult["PostPerm"] = CBlogPost::GetSocNetPostPerms($arPost["ID"], true, false, $arPost["AUTHOR_ID"]);
}
$arResult["Post"] = $arPost;
$arResult["PostSrc"] = $arPost;
$arResult["Blog"] = $arBlog;
$arResult["PostSrc"]["PATH_TO_CONPANY_DEPARTMENT"] = $arParams["PATH_TO_CONPANY_DEPARTMENT"];
$arResult["PostSrc"]["PATH_TO_GROUP"] = $arParams["PATH_TO_GROUP"];
$arResult["PostSrc"]["bExtranetSite"] = $arResult["bExtranetSite"];
$arResult["urlToPost"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_POST"], array("post_id" => CBlogPost::GetPostID($arResult["Post"]["ID"], $arResult["Post"]["CODE"], $arParams["ALLOW_POST_CODE"]), "user_id" => $arPost["AUTHOR_ID"]));
if (is_set($arParams["PATH_TO_GROUP"])) {
$strSiteWorkgroupsPage = COption::GetOptionString("socialnetwork", "workgroups_page", SITE_DIR . "workgroups/", SITE_ID);
if (strlen($strSiteWorkgroupsPage) > 0) {
if (strpos($arParams["PATH_TO_GROUP"], $strSiteWorkgroupsPage) === 0) {
$arParams["PATH_TO_GROUP"] = "#GROUPS_PATH#" . substr($arParams["PATH_TO_GROUP"], strlen($strSiteWorkgroupsPage), strlen($arParams["PATH_TO_GROUP"]) - strlen($strSiteWorkgroupsPage));
}
}
示例6: strlen
$arPost = CBlogPost::GetById($arParams["ID"]);
$arPost = CBlogTools::htmlspecialcharsExArray($arPost);
$arBlog = CBlog::GetById($arPost["BLOG_ID"]);
$arBlog = CBlogTools::htmlspecialcharsExArray($arBlog);
if ($arPost["AUTHOR_ID"] == $user_id) {
$arResult["Perm"] = BLOG_PERMS_FULL;
$arResult["PostPerm"] = BLOG_PERMS_FULL;
} else {
$arResult["PostPerm"] = CBlogPost::GetSocNetPostPerms($arParams["ID"]);
if ($arResult["PostPerm"] > BLOG_PERMS_DENY) {
$arResult["Perm"] = CBlogComment::GetSocNetUserPerms($arParams["ID"], $arPost["AUTHOR_ID"]);
}
}
$arResult["is_ajax_post"] = "Y";
} else {
$arResult["PostPerm"] = strlen($arParams["POST_DATA"]["perms"]) <= 0 ? CBlogPost::GetSocNetPostPerms($arParams["ID"]) : $arParams["POST_DATA"]["perms"];
if ($arResult["PostPerm"] > BLOG_PERMS_DENY) {
if ($bIntranetInstalled && IsModuleInstalled("bitrix24") && $arParams["POST_DATA"]["HAVE_ALL_IN_ADR"] == "Y") {
if ($arPost["AUTHOR_ID"] != $user_id) {
$arResult["Perm"] = BLOG_PERMS_WRITE;
} else {
$arResult["Perm"] = BLOG_PERMS_FULL;
}
} else {
$arResult["Perm"] = CBlogComment::GetSocNetUserPerms($arParams["ID"], $arPost["AUTHOR_ID"]);
}
}
}
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_REQUEST['mfi_mode']) && $_REQUEST['mfi_mode'] == "upload") {
CBlogImage::AddImageResizeHandler(array("width" => 400, "height" => 400));
}
示例7: getBlogPostUsersImprtnt
public static function getBlogPostUsersImprtnt($arFields)
{
if (!is_array($arFields)) {
throw new Exception('Incorrect input data');
}
$arParams["postId"] = intval($arFields['POST_ID']);
if ($arParams["postId"] <= 0) {
throw new Exception('Wrong post ID');
}
$arParams["nTopCount"] = 500;
$arParams["paramName"] = 'BLOG_POST_IMPRTNT';
$arParams["paramValue"] = 'Y';
$arResult = array();
$cache = new CPHPCache();
$cache_id = "blog_post_param_" . serialize(array($arParams["postId"], $arParams["nTopCount"], $arParams["paramName"], $arParams["paramValue"]));
$cache_path = $GLOBALS["CACHE_MANAGER"]->GetCompCachePath(CComponentEngine::MakeComponentPath("socialnetwork.blog.blog")) . "/" . $arParams["postId"];
$cache_time = defined("BX_COMP_MANAGED_CACHE") ? 3600 * 24 * 365 : 600;
if ($cache->InitCache($cache_time, $cache_id, $cache_path)) {
$arResult = $cache->GetVars();
} else {
$cache->StartDataCache($cache_time, $cache_id, $cache_path);
if (CModule::IncludeModule("blog")) {
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->StartTagCache($cache_path);
$GLOBALS["CACHE_MANAGER"]->RegisterTag($arParams["paramName"] . $arParams["postId"]);
}
if ($arBlogPost = CBlogPost::GetByID($arParams["postId"])) {
$postPerms = CBlogPost::GetSocNetPostPerms($arParams["postId"], true, $GLOBALS["USER"]->GetID(), $arBlogPost["AUTHOR_ID"]);
if ($postPerms >= BLOG_PERMS_READ) {
$db_res = CBlogUserOptions::GetList(array(), array('POST_ID' => $arParams["postId"], 'NAME' => $arParams["paramName"], 'VALUE' => $arParams["paramValue"], 'USER_ACTIVE' => 'Y'), array("nTopCount" => $arParams["nTopCount"], "SELECT" => array("USER_ID")));
if ($db_res) {
while ($res = $db_res->Fetch()) {
$arResult[] = $res["USER_ID"];
}
}
}
}
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->EndTagCache();
}
$cache->EndDataCache($arResult);
}
}
return $arResult;
}
示例8:
$arPost = CBlogTools::htmlspecialcharsExArray($arPost);
$arBlog = CBlog::GetById($arPost["BLOG_ID"]);
$arBlog = CBlogTools::htmlspecialcharsExArray($arBlog);
if ($arPost["AUTHOR_ID"] == $user_id) {
$arResult["Perm"] = BLOG_PERMS_FULL;
$arResult["PostPerm"] = BLOG_PERMS_FULL;
} else {
$arResult["PostPerm"] = CBlogPost::GetSocNetPostPerms($arParams["ID"]);
if ($arResult["PostPerm"] > BLOG_PERMS_DENY) {
$arResult["Perm"] = CBlogComment::GetSocNetUserPerms($arParams["ID"], $arPost["AUTHOR_ID"]);
}
}
$arResult["is_ajax_post"] = "Y";
} else {
if (strlen($arParams["POST_DATA"]["perms"]) <= 0) {
$arResult["PostPerm"] = CBlogPost::GetSocNetPostPerms($arParams["ID"]);
} else {
$arResult["PostPerm"] = $arParams["POST_DATA"]["perms"];
}
if ($arResult["PostPerm"] > BLOG_PERMS_DENY) {
if (IsModuleInstalled("intranet") && IsModuleInstalled("bitrix24") && $arParams["POST_DATA"]["HAVE_ALL_IN_ADR"] == "Y") {
if ($arPost["AUTHOR_ID"] != $user_id) {
$arResult["Perm"] = BLOG_PERMS_WRITE;
} else {
$arResult["Perm"] = BLOG_PERMS_FULL;
}
} else {
$arResult["Perm"] = CBlogComment::GetSocNetUserPerms($arParams["ID"], $arPost["AUTHOR_ID"]);
}
}
}
示例9: IntVal
}
}
} else {
$arParams["ID"] = 0;
if ($arParams["SET_TITLE"] == "Y") {
$APPLICATION->SetTitle(GetMessage("BLOG_NEW_MESSAGE"));
}
}
if (IntVal($_GET["delete_blog_post_id"]) > 0 && $_GET["ajax_blog_post_delete"] == "Y") {
if (check_bitrix_sessid()) {
$delId = IntVal($_GET["delete_blog_post_id"]);
if ($arPost = CBlogPost::GetByID($delId)) {
if ($arPost["AUTHOR_ID"] == $user_id) {
$perms = BLOG_PERMS_FULL;
} else {
$perms = CBlogPost::GetSocNetPostPerms($_GET["delete_blog_post_id"], true);
}
if ($perms >= BLOG_PERMS_FULL) {
CBlogPost::DeleteLog($delId);
BXClearCache(True, "/" . SITE_ID . "/blog/popular_posts/");
BXClearCache(true, "/blog/socnet_post/" . $delId . "/");
if (!CBlogPost::Delete($delId)) {
$arResult["ERROR_MESSAGE"] .= GetMessage("BLOG_BLOG_BLOG_MES_DEL_ERROR");
} else {
$arResult["OK_MESSAGE"] .= GetMessage("BLOG_BLOG_BLOG_MES_DEL_OK");
}
} else {
$arResult["ERROR_MESSAGE"] .= GetMessage("BLOG_BLOG_BLOG_MES_DEL_NO_RIGHTS");
}
} else {
$arResult["ERROR_MESSAGE"] .= GetMessage("BLOG_BLOG_BLOG_MES_DEL_ERROR");
示例10: IntVal
}
$arResult["PostToShow"]["GRAT_CURRENT"] = $arGrat;
}
}
}
} else {
$arParams["ID"] = 0;
if ($arParams["SET_TITLE"] == "Y") {
$APPLICATION->SetTitle(GetMessage("BLOG_NEW_MESSAGE"));
}
}
if (IntVal($_GET["delete_blog_post_id"]) > 0 && $_GET["ajax_blog_post_delete"] == "Y") {
if (check_bitrix_sessid() || $arParams["IS_REST"] == "Y") {
$delId = IntVal($_GET["delete_blog_post_id"]);
if ($arPost = CBlogPost::GetByID($delId)) {
$perms = $arPost["AUTHOR_ID"] == $user_id ? BLOG_PERMS_FULL : CBlogPost::GetSocNetPostPerms($_GET["delete_blog_post_id"], true);
if ($perms >= BLOG_PERMS_FULL) {
CBlogPost::DeleteLog($delId);
BXClearCache(True, "/" . SITE_ID . "/blog/popular_posts/");
BXClearCache(true, "/blog/socnet_post/" . intval($delId / 100) . "/" . $delId . "/");
BXClearCache(true, "/blog/socnet_post/gen/" . intval($delId / 100) . "/" . $delId . "/");
BXClearCache(true, CComponentEngine::MakeComponentPath("bitrix:socialnetwork.blog.blog"));
if (!CBlogPost::Delete($delId)) {
$arResult["ERROR_MESSAGE"] .= GetMessage("BLOG_BLOG_BLOG_MES_DEL_ERROR");
} else {
$arResult["OK_MESSAGE"] .= GetMessage("BLOG_BLOG_BLOG_MES_DEL_OK");
}
} else {
$arResult["ERROR_MESSAGE"] .= GetMessage("BLOG_BLOG_BLOG_MES_DEL_NO_RIGHTS");
}
} else {
示例11: foreach
$arResult["userCache"][$userId] = $arUserCache;
}
}
$db_user = CUser::GetById($GLOBALS["USER"]->GetId());
$arResult["USER"] = $db_user->Fetch();
foreach ($arPostsAll as $arPost) {
$text = preg_replace($patt, $repl, $arPost["~DETAIL_TEXT"]);
$text = TruncateText($text, $arParams["MESSAGE_LENGTH"]);
$text = CBlogTools::DeleteDoubleBR($p->convert($text, true, false, $allow));
$arPost["~CLEAR_TEXT"] = $text;
$arPost["CLEAR_TEXT"] = $p->wrap_long_words($text);
$arPost["perms"] = $arResult["perms"];
if (!$bGroupMode && $arParams["USER_ID"] == $user_id && (empty($arParams["4ME"]) || $arPost["AUTHOR_ID"] == $user_id)) {
$arPost["perms"] = BLOG_PERMS_FULL;
} elseif (!$bGroupMode && $arParams["USER_ID"] != $user_id || strlen($arParams["4ME"]) > 0) {
$arPost["perms"] = CBlogPost::GetSocNetPostPerms($arPost["ID"], true);
}
$arUser = $arResult["userCache"][$arPost["AUTHOR_ID"]];
$arPost["~AUTHOR_NAME"] = $arUser["~AUTHOR_NAME"];
$arPost["AUTHOR_NAME"] = $arUser["AUTHOR_NAME"];
$arPost["AUTHOR_AVATAR"] = $arUser["PERSONAL_PHOTO_resized"];
$arPost["urlToPost"] = CComponentEngine::MakePathFromTemplate($arParams["~PATH_TO_POST"], array("post_id" => CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arParams["ALLOW_POST_CODE"]), "user_id" => $arPost["BLOG_OWNER_ID"]));
$arPost["urlToPosts"] = CComponentEngine::MakePathFromTemplate($arParams["~PATH_TO_BLOG_POSTS"], array("user_id" => $arPost["BLOG_OWNER_ID"]));
$arPost["urlToPostsImportant"] = CComponentEngine::MakePathFromTemplate($arParams["~PATH_TO_POST_IMPORTANT"], array("user_id" => $arPost["BLOG_OWNER_ID"]));
$arPost["urlToUser"] = $arPost["urlToAuthor"] = $arUser["url"];
if ($arPost["perms"] >= BLOG_PERMS_WRITE) {
if ($arPost["perms"] >= BLOG_PERMS_FULL || $arPost["perms"] >= BLOG_PERMS_WRITE && $arPost["AUTHOR_ID"] == $user_id) {
$arPost["urlToEdit"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_POST_EDIT"], array("post_id" => $arPost["ID"], "user_id" => $arPost["AUTHOR_ID"]));
}
if ($arPost["perms"] >= BLOG_PERMS_MODERATE) {
$arPost["urlToHide"] = htmlspecialcharsex($APPLICATION->GetCurPageParam("hide_id=" . $arPost["ID"] . "&" . bitrix_sessid_get(), array("del_id", "sessid", "success", "hide_id")));
示例12: array
}
}
if (empty($arResult["FILE"])) {
$arError = array("code" => "EMPTY FILE", "title" => GetMessage("F_EMPTY_FID"));
} else {
if (intVal($arResult["FILE_INFO"]["POST_ID"]) > 0) {
if (empty($arResult['POST'])) {
$dbPost = CBlogPost::GetList(array(), array("ID" => $arResult["FILE_INFO"]["POST_ID"], "BLOG_ID" => $arResult["FILE_INFO"]["BLOG_ID"]), false, false, array("ID", "BLOG_ID", "BLOG_OWNER_ID", "BLOG_SOCNET_GROUP_ID", "BLOG_USE_SOCNET", "AUTHOR_ID"));
$arResult["POST"] = $dbPost->Fetch();
}
if (!empty($arResult['POST'])) {
if ($arResult["POST"]["BLOG_USE_SOCNET"] == "Y") {
if (!CModule::IncludeModule("socialnetwork")) {
return;
}
$arParams["PERMISSION"] = CBlogPost::GetSocNetPostPerms($arResult["POST"]["ID"]);
} else {
$arParams["PERMISSION"] = CBlogPost::GetBlogUserPostPerms($arResult["POST"]["ID"], $user_id);
}
}
}
}
if (empty($arError)) {
if (empty($arResult["POST"])) {
$arError = array("code" => "EMPTY POST", "title" => GetMessage("F_EMPTY_MID"));
} elseif ($arParams["PERMISSION"] < BLOG_PERMS_READ) {
$arError = array("code" => "NOT RIGHT", "title" => GetMessage("F_NOT_RIGHT"));
}
}
if (!empty($arError)) {
require $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/include/prolog_after.php";
示例13: htmlspecialcharsback
if ($comment_id > 0 && ($arComment = CBlogComment::GetByID($comment_id)) && $arComment["POST_ID"] == $post_id) {
$postPerm = CBlogPost::GetSocNetPostPerms($post_id, false, $GLOBALS["USER"]->GetId(), $arBlogPost["AUTHOR_ID"]);
if ($postPerm > BLOG_PERMS_DENY) {
if ($arComment["AUTHOR_ID"] == $GLOBALS["USER"]->GetId() || CSocNetUser::IsCurrentUserModuleAdmin(SITE_ID, false)) {
$arResult["CommentCanEdit"] = 'Y';
}
$arResult["CommentDetailText"] = htmlspecialcharsback($arComment["POST_TEXT"]);
$bDiskOrWebDavInstalled = IsModuleInstalled('disk') || IsModuleInstalled('webdav');
$ufCode = $bDiskOrWebDavInstalled ? "UF_BLOG_COMMENT_FILE" : "UF_BLOG_COMMENT_DOC";
$arResult["CommentUFCode"] = $ufCode;
$arResult["CommentFiles"] = CMobileHelper::getUFForPostForm(array("ENTITY_TYPE" => "BLOG_COMMENT", "ENTITY_ID" => $comment_id, "UF_CODE" => $ufCode, "IS_DISK_OR_WEBDAV_INSTALLED" => $bDiskOrWebDavInstalled));
}
}
} elseif ($action == "file_comment_upload") {
$perm = BLOG_PERMS_DENY;
$postPerm = CBlogPost::GetSocNetPostPerms($arBlogPost["ID"]);
if ($postPerm > BLOG_PERMS_DENY) {
if (IsModuleInstalled("bitrix24")) {
$perm = $arBlogPost["AUTHOR_ID"] != $GLOBALS["USER"]->GetId() ? BLOG_PERMS_WRITE : BLOG_PERMS_FULL;
} else {
$perm = CBlogComment::GetSocNetUserPerms($arBlogPost["ID"], $arBlogPost["AUTHOR_ID"]);
}
}
if ($perm < BLOG_PERMS_PREMODERATE) {
$strError = "Can't save file";
}
if (!$strError && (!is_array($_FILES) || count($_FILES) <= 0 || !array_key_exists("file", $_FILES))) {
$strError = "Empty file";
}
if (!$strError) {
$arFileStorage = CMobileHelper::InitFileStorage();
示例14: array
{
$result = false;
if (strpos($arParams['arUserField']['FIELD_NAME'], 'UF_BLOG_POST_DOC') === 0 || strpos($arParams['arUserField']['FIELD_NAME'], 'UF_BLOG_COMMENT_DOC') === 0) {
$componentParams = array('INPUT_NAME' => $arParams["arUserField"]["FIELD_NAME"], 'INPUT_NAME_UNSAVED' => 'FILE_NEW_TMP', 'MAX_FILE_SIZE' => intval($arParams['arUserField']['SETTINGS']['MAX_ALLOWED_SIZE']) > 0 ? $arParams['arUserField']['SETTINGS']['MAX_ALLOWED_SIZE'] : 5000000, 'MULTIPLE' => $arParams['arUserField']['MULTIPLE'], 'MODULE_ID' => 'uf', 'ALLOW_UPLOAD' => 'I', 'POST_ID' => $arParams['POST_ID']);
$GLOBALS["APPLICATION"]->IncludeComponent('bitrix:mobile.file.upload', '', $componentParams, false, array("HIDE_ICONS" => "Y"));
}
return true;
}
}
if (intval($arParams["SOCNET_GROUP_ID"]) > 0 && CModule::IncludeModule("socialnetwork")) {
if ($arSonetGroup = CSocNetGroup::GetByID($arParams["SOCNET_GROUP_ID"])) {
$arResult["SONET_GROUP_NAME"] = $arSonetGroup["NAME"];
}
}
if (intval($_REQUEST["post_id"]) > 0 && CModule::IncludeModule("blog") && CModule::IncludeModule("socialnetwork") && ($arBlogPost = CBlogPost::GetByID(intval($_REQUEST["post_id"])))) {
$postPerms = CBlogPost::GetSocNetPostPerms(intval($_REQUEST["post_id"]), true, $GLOBALS["USER"]->GetID(), $arBlogPost["AUTHOR_ID"]);
if ($postPerms > BLOG_PERMS_MODERATE || $postPerms >= BLOG_PERMS_WRITE && $arBlogPost["AUTHOR_ID"] == $GLOBALS["USER"]->GetID()) {
$arResult["Post"] = $arBlogPost;
$arResult["Post"]["arSonetPerms"] = array();
$arResult["Post"]["arSonetPermsHidden"] = array();
$arSonetPerms = CBlogPost::GetSocnetPerms(intval($_REQUEST["post_id"]));
$bExtranetInstalled = CModule::IncludeModule("extranet");
$arAvailableGroupID = CSocNetLogTools::GetAvailableGroups();
foreach ($arSonetPerms as $key => $arSonetPerm) {
foreach ($arSonetPerm as $entityId => $arPerm) {
if ($key == "U") {
if (in_array("G2", $arPerm)) {
$arResult["Post"]["arSonetPerms"][] = array("type" => "groups", "item" => array("id" => "UA"));
} else {
$rsUserTmp = CUser::GetByID($entityId);
if ($arUserTmp = $rsUserTmp->Fetch()) {