Exemplo n.º 1
0
 if (!empty($arPost) && $arBlog["ID"] == $arPost["BLOG_ID"]) {
     CBlogPost::CounterInc($arParams["ID"]);
     $arPost = CBlogTools::htmlspecialcharsExArray($arPost);
     $arResult["Post"] = $arPost;
     if (!$bSoNet) {
         $arResult["PostPerm"] = CBlogPost::GetBlogUserPostPerms($arParams["ID"], $arResult["USER_ID"]);
     }
     if ($arPost["AUTHOR_ID"] == $arBlog["OWNER_ID"]) {
         $arResult["urlToBlog"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BLOG"], array("blog" => $arBlog["URL"], "user_id" => $arPost["AUTHOR_ID"], "group_id" => $arParams["SOCNET_GROUP_ID"]));
     } else {
         $arOwnerBlog = CBlog::GetByOwnerID($arPost["AUTHOR_ID"], $arParams["GROUP_ID"]);
         $arResult["urlToBlog"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BLOG"], array("blog" => $arOwnerBlog["URL"], "user_id" => $arPost["AUTHOR_ID"], "group_id" => $arParams["SOCNET_GROUP_ID"]));
     }
     $arResult["urlToPost"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_POST"], array("blog" => $arPost["AUTHOR_ID"] == $arBlog["OWNER_ID"] ? $arBlog["URL"] : $arOwnerBlog["URL"], "post_id" => CBlogPost::GetPostID($arResult["Post"]["ID"], $arResult["Post"]["CODE"], $arParams["ALLOW_POST_CODE"]), "user_id" => $arPost["AUTHOR_ID"]));
     if ($_GET["delete"] == "Y" && $arResult["IDEA_MODERATOR"]) {
         if (check_bitrix_sessid() && (!$bSoNet && CBlogPost::CanUserDeletePost(IntVal($arParams["ID"]), $USER->IsAuthorized() ? $arResult["USER_ID"] : 0) || $bSoNet && CBlogSoNetPost::CanUserDeletePost(IntVal($arParams["ID"]), $user_id, $arParams["USER_ID"], $arParams["SOCNET_GROUP_ID"]))) {
             //Remove Sonet
             $Notify = CIdeaManagment::getInstance()->Notification(array("TYPE" => "IDEA", "ID" => $arParams["ID"]))->getSonetNotify()->Remove();
             if (CBlogPost::Delete($arParams["ID"])) {
                 BXClearCache(True, '/' . SITE_ID . '/idea/statistic_list/');
                 BXClearCache(True, '/' . SITE_ID . '/idea/tags/');
                 BXClearCache(True, "/" . SITE_ID . "/idea/" . $arBlog["ID"] . "/pages/");
                 BXClearCache(True, "/" . SITE_ID . "/idea/" . $arBlog["ID"] . "/first_page/");
                 BXClearCache(True, "/" . SITE_ID . "/idea/" . $arBlog["ID"] . "/post/" . $arParams["ID"] . "/");
                 //RSS
                 BXClearCache(True, "/" . SITE_ID . "/idea/" . $arBlog["ID"] . "/rss_list");
                 $url = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_INDEX"], array("blog" => $arBlog["URL"], "user_id" => $arBlog["OWNER_ID"], "group_id" => $arBlog["SOCNET_GROUP_ID"]));
                 if (strpos("?", $url) === false) {
                     $url .= "?";
                 } else {
                     $url .= "&";
Exemplo n.º 2
0
}
if (!empty($arBlog) && $arBlog["ACTIVE"] == "Y") {
    $arGroup = CBlogGroup::GetByID($arBlog["GROUP_ID"]);
    if ($arGroup["SITE_ID"] == SITE_ID) {
        $arResult["BLOG"] = $arBlog;
        if ($arParams["SET_TITLE"] == "Y") {
            $APPLICATION->SetTitle(str_replace("#NAME#", $arBlog["NAME"], GetMessage("B_B_HIDE_TITLE_BLOG")));
        }
        if ($arParams["SET_NAV_CHAIN"] == "Y") {
            $APPLICATION->AddChainItem($arBlog["NAME"], CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BLOG"], array("blog" => $arBlog["URL"], "group_id" => $arParams["SOCNET_GROUP_ID"])));
        }
        if ($arResult["PostPerm"] >= BLOG_PERMS_MODERATE) {
            $errorMessage = "";
            $okMessage = "";
            if (IntVal($_GET["del_id"]) > 0) {
                if (check_bitrix_sessid() && (!$bSoNet && CBlogPost::CanUserDeletePost(IntVal($_GET["del_id"]), $user_id) || $bSoNet && CBlogSoNetPost::CanUserDeletePost(IntVal($_GET["del_id"]), $user_id, $arParams["USER_ID"], $arParams["SOCNET_GROUP_ID"]))) {
                    $DEL_ID = IntVal($_GET["del_id"]);
                    if (CBlogPost::Delete($DEL_ID)) {
                        $okMessage = GetMessage("B_B_HIDE_M_DEL");
                    } else {
                        $errorMessage = GetMessage("B_B_HIDE_M_DEL_ERR");
                    }
                } else {
                    $errorMessage = GetMessage("B_B_HIDE_M_DEL_RIGHTS");
                }
            } elseif (IntVal($_GET["show_id"]) > 0) {
                if ($_GET["success"] == "Y") {
                    $okMessage = GetMessage("BLOG_BLOG_BLOG_MES_SHOWED");
                } else {
                    if (check_bitrix_sessid()) {
                        $show_id = IntVal($_GET["show_id"]);