当前位置: 首页>>代码示例>>PHP>>正文


PHP CBlogPost::CanUserDeletePost方法代码示例

本文整理汇总了PHP中CBlogPost::CanUserDeletePost方法的典型用法代码示例。如果您正苦于以下问题:PHP CBlogPost::CanUserDeletePost方法的具体用法?PHP CBlogPost::CanUserDeletePost怎么用?PHP CBlogPost::CanUserDeletePost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CBlogPost的用法示例。


在下文中一共展示了CBlogPost::CanUserDeletePost方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: GetMessage

				/Default params
********************************************************************/
/********************************************************************
				Actions
********************************************************************/
$postId = $_GET["del_id"] > 0 ? $_GET["del_id"] : ($_GET["hide_id"] > 0 ? $_GET["hide_id"] : $_GET["show_id"]);
if ($arResult["IDEA_MODERATOR"] && $postId > 0) {
    if ($_GET["success"] == "Y") {
        $arResultNFCache["OK_MESSAGE"][] = $_GET["del_id"] > 0 ? GetMessage("BLOG_BLOG_BLOG_MES_DELED") : ($_GET["hide_id"] > 0 ? GetMessage("BLOG_BLOG_BLOG_MES_HIDED") : GetMessage("IDEA_BLOG_BLOG_MES_SHOWED"));
    } else {
        if (!check_bitrix_sessid()) {
            $arResultNFCache["ERROR_MESSAGE"][] = GetMessage("BLOG_BLOG_SESSID_WRONG");
        } else {
            if (CBlogPost::GetByID($postId)) {
                if ($_GET["del_id"] > 0) {
                    if (!CBlogPost::CanUserDeletePost(IntVal($_GET["del_id"]), $user_id)) {
                        $arResultNFCache["ERROR_MESSAGE"][] = GetMessage("BLOG_BLOG_BLOG_MES_DEL_NO_RIGHTS");
                    } else {
                        if (!CBlogPost::Delete($postId)) {
                            $arResultNFCache["ERROR_MESSAGE"][] = GetMessage("BLOG_BLOG_BLOG_MES_DEL_ERROR");
                        } else {
                            CIdeaManagment::getInstance()->Notification(array("TYPE" => "IDEA", "ID" => $postId))->getSonetNotify()->Remove();
                        }
                    }
                } else {
                    if ($arResult["PostPerm"] < BLOG_PERMS_MODERATE) {
                        $arResultNFCache["ERROR_MESSAGE"][] = $_GET["hide_id"] > 0 ? GetMessage("BLOG_BLOG_BLOG_MES_HIDE_NO_RIGHTS") : GetMessage("IDEA_BLOG_BLOG_MES_SHOW_NO_RIGHTS");
                    } elseif (!CBlogPost::Update($postId, array("PUBLISH_STATUS" => $_GET["hide_id"] > 0 ? BLOG_PUBLISH_STATUS_READY : BLOG_PUBLISH_STATUS_PUBLISH))) {
                        $arResultNFCache["ERROR_MESSAGE"][] = $_GET["hide_id"] > 0 ? GetMessage("BLOG_BLOG_BLOG_MES_HIDE_ERROR") : GetMessage("BLOG_BLOG_BLOG_MES_SHOW_ERROR");
                    }
                }
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php

示例2: array

                 $arMailFields = array("BLOG_ID" => $arBlog["ID"], "BLOG_NAME" => $arBlog["NAME"], "BLOG_URL" => $arBlog["URL"], "BLOG_ADR" => "http://" . $serverName . CComponentEngine::MakePathFromTemplate(htmlspecialcharsBack($arParams["PATH_TO_BLOG"]), array("blog" => $arBlog["URL"])), "USER_ID" => $user_id, "USER" => $AuthorName, "USER_URL" => "http://" . $serverName . CComponentEngine::MakePathFromTemplate(htmlspecialcharsBack($arParams["PATH_TO_USER"]), array("user_id" => $user_id)), "EMAIL_FROM" => COption::GetOptionString("main", "email_from", "nobody@nobody.com"));
                 $arF1 = $arF2 = $arMailFields;
                 $arF1["EMAIL_TO"] = $arUser["EMAIL"];
                 $arF2["EMAIL_TO"] = $arUserBlog["EMAIL"];
                 CEvent::Send("BLOG_YOU_TO_BLOG", SITE_ID, $arF1);
                 CEvent::Send("BLOG_USER_TO_YOUR_BLOG", SITE_ID, $arF2);
             } else {
                 $arResult["ERROR_MESSAGE"] = GetMessage("B_B_MES_REQUEST_ERROR") . "<br />";
             }
         }
     } else {
         $arResult["ERROR_MESSAGE"] .= GetMessage("B_B_MES_REQUEST_AUTH") . "<br />";
     }
 }
 if ($_GET["delete"] == "Y") {
     if (check_bitrix_sessid() && CBlogPost::CanUserDeletePost(IntVal($arParams["ID"]), $USER->IsAuthorized() ? $arResult["USER_ID"] : 0)) {
         if (CBlogPost::Delete($arParams["ID"])) {
             BXClearCache(True, "/" . SITE_ID . "/blog/" . $arBlog["URL"] . "/pages/");
             BXClearCache(True, "/" . SITE_ID . "/blog/" . $arBlog["URL"] . "/first_page/");
             BXClearCache(True, "/" . SITE_ID . "/blog/" . $arBlog["URL"] . "/calendar/");
             BXClearCache(True, "/" . SITE_ID . "/blog/" . $arBlog["URL"] . "/post/" . $arParams["ID"] . "/");
             BXClearCache(True, "/" . SITE_ID . "/blog/last_messages/");
             BXClearCache(True, "/" . SITE_ID . "/blog/commented_posts/");
             BXClearCache(True, "/" . SITE_ID . "/blog/popular_posts/");
             BXClearCache(True, "/" . SITE_ID . "/blog/last_comments/");
             BXClearCache(True, "/" . SITE_ID . "/blog/groups/" . $arBlog["GROUP_ID"] . "/");
             BXClearCache(True, "/" . SITE_ID . "/blog/" . $arBlog["URL"] . "/trackback/" . $arParams["ID"] . "/");
             BXClearCache(True, "/" . SITE_ID . "/blog/" . $arBlog["URL"] . "/rss_out/");
             BXClearCache(True, "/" . SITE_ID . "/blog/" . $arBlog["URL"] . "/rss_all/");
             BXClearCache(True, "/" . SITE_ID . "/blog/rss_sonet/");
             BXClearCache(True, "/" . SITE_ID . "/blog/rss_all/");
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php

示例3: array

    if (!is_array($arFilter)) {
        $arFilter = array();
    }
}
$arResult["ERROR_MESSAGE"] = array();
$arResultNFCache["OK_MESSAGE"] = array();
$arResultNFCache["ERROR_MESSAGE"] = array();
if (strlen($arParams["BLOG_URL"]) > 0) {
    $user_id = IntVal($USER->GetID());
    //Message delete
    if (IntVal($_GET["del_id"]) > 0) {
        if ($arResult["BLOG"] = CBlog::GetByUrl($arParams["BLOG_URL"], $arParams["GROUP_ID"])) {
            if ($_GET["success"] == "Y") {
                $arResultNFCache["OK_MESSAGE"][] = GetMessage("BLOG_BLOG_BLOG_MES_DELED");
            } else {
                if (check_bitrix_sessid() && CBlogPost::CanUserDeletePost(IntVal($_GET["del_id"]), $user_id)) {
                    $DEL_ID = IntVal($_GET["del_id"]);
                    if (CBlogPost::GetByID($DEL_ID)) {
                        if (CBlogPost::Delete($DEL_ID)) {
                            BXClearCache(True, "/" . SITE_ID . "/blog/" . $arParams["BLOG_URL"] . "/first_page/");
                            BXClearCache(True, "/" . SITE_ID . "/blog/" . $arParams["BLOG_URL"] . "/pages/");
                            BXClearCache(True, "/" . SITE_ID . "/blog/" . $arParams["BLOG_URL"] . "/calendar/");
                            BXClearCache(True, "/" . SITE_ID . "/blog/" . $arParams["BLOG_URL"] . "/post/" . $DEL_ID . "/");
                            BXClearCache(True, "/" . SITE_ID . "/blog/last_messages/");
                            BXClearCache(True, "/" . SITE_ID . "/blog/commented_posts/");
                            BXClearCache(True, "/" . SITE_ID . "/blog/popular_posts/");
                            BXClearCache(True, "/" . SITE_ID . "/blog/last_comments/");
                            BXClearCache(True, "/" . SITE_ID . "/blog/groups/" . $arResult["BLOG"]["GROUP_ID"] . "/");
                            BXClearCache(True, "/" . SITE_ID . "/blog/" . $arParams["BLOG_URL"] . "/trackback/" . $DEL_ID . "/");
                            BXClearCache(True, "/" . SITE_ID . "/blog/" . $arParams["BLOG_URL"] . "/rss_out/");
                            BXClearCache(True, "/" . SITE_ID . "/blog/" . $arParams["BLOG_URL"] . "/rss_all/");
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:component.php

示例4: trim

}
$arParams["DATE_TIME_FORMAT"] = trim(empty($arParams["DATE_TIME_FORMAT"]) ? $DB->DateFormatToPHP(CSite::GetDateFormat("FULL")) : $arParams["DATE_TIME_FORMAT"]);
if (COption::GetOptionString("blog", "enable_trackback", "Y") == "Y") {
    if ($arPost = CBlogPost::GetByID($arParams["ID"])) {
        $arPost = CBlogTools::htmlspecialcharsExArray($arPost);
        $arResult["Post"] = $arPost;
        $arBlog = CBlog::GetByID($arPost["BLOG_ID"]);
        $arBlog = CBlogTools::htmlspecialcharsExArray($arBlog);
        $arResult["USER_ID"] = $USER->GetID();
        $arResult["PostPerm"] = CBlogPost::GetBlogUserPostPerms($arParams["ID"], $arResult["USER_ID"]);
        $arResult["Blog"] = $arBlog;
        $arBlogUrl = CBlog::GetByUrl($arParams["BLOG_URL"]);
        if (!empty($arBlogUrl) && $arBlogUrl["URL"] == $arBlog["URL"]) {
            if ($arPost["ENABLE_TRACKBACK"] == "Y") {
                if ($arResult["PostPerm"] > BLOG_PERMS_DENY) {
                    if (check_bitrix_sessid() && IntVal($_GET["delete_trackback_id"]) > 0 && CBlogPost::CanUserDeletePost(IntVal($arPost["ID"]), IntVal($USER->GetID()))) {
                        CBlogTrackback::Delete(IntVal($_GET["delete_trackback_id"]));
                        if (intval($arBlog["SOCNET_GROUP_ID"]) > 0 && CModule::IncludeModule("socialnetwork") && method_exists("CSocNetGroup", "GetSite")) {
                            $arSites = array();
                            $rsGroupSite = CSocNetGroup::GetSite($arBlog["SOCNET_GROUP_ID"]);
                            while ($arGroupSite = $rsGroupSite->Fetch()) {
                                $arSites[] = $arGroupSite["LID"];
                            }
                        } else {
                            $arSites = array(SITE_ID);
                        }
                        foreach ($arSites as $site_id_tmp) {
                            BXClearCache(True, "/" . $site_id_tmp . "/blog/" . $arBlog["URL"] . "/trackback/" . $arPost["ID"] . "/");
                        }
                    }
                    $cache = new CPHPCache();
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:component.php

示例5: GetMessage

 $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"])));
 }
 if ($arResult["PostPerm"] >= BLOG_PERMS_MODERATE) {
     $errorMessage = "";
     $okMessage = "";
     if (IntVal($_GET["del_id"]) > 0) {
         if ($_GET["success"] == "Y") {
             $okMessage = GetMessage("B_B_HIDE_M_DEL");
         } else {
             $DEL_ID = IntVal($_GET["del_id"]);
             if (check_bitrix_sessid() && CBlogPost::CanUserDeletePost($DEL_ID, $user_id)) {
                 if (CBlogPost::Delete($DEL_ID)) {
                     LocalRedirect($APPLICATION->GetCurPageParam("del_id=" . $DEL_ID . "&success=Y", array("del_id", "sessid", "success", "show_id")));
                 } 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"]);
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:component.php

示例6: array

 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 .= "&";
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php

示例7: implode

     }
     CBlogPostCategory::Add(array("BLOG_ID" => $arCopyBlog["ID"], "POST_ID" => $copyID, "CATEGORY_ID" => $v));
     $arCopyCat[] = $v;
 }
 if (!empty($arCopyCat)) {
     $arCopyPostUpdate["CATEGORY_ID"] = implode(",", $arCopyCat);
 }
 if ($_POST["move2blogcopy"] == "Y") {
     $arCopyPostUpdate["NUM_COMMENTS"] = 0;
 }
 if (!empty($arCopyPostUpdate)) {
     $copyID = CBlogPost::Update($copyID, $arCopyPostUpdate);
     $arCopyPost = CBlogPost::GetByID($copyID);
 }
 if ($_POST["move2blogcopy"] != "Y") {
     if (CBlogPost::CanUserDeletePost($arParams["ID"], $user_id)) {
         $dbC = CBlogComment::GetList(array("ID" => "ASC"), array("BLOG_ID" => $arBlog["ID"], "POST_ID" => $arParams["ID"]), false, false, array("PATH", "PUBLISH_STATUS", "POST_TEXT", "TITLE", "DATE_CREATE", "AUTHOR_IP1", "AUTHOR_IP", "AUTHOR_EMAIL", "AUTHOR_NAME", "AUTHOR_ID", "PARENT_ID", "POST_ID", "BLOG_ID", "ID"));
         while ($arC = $dbC->Fetch()) {
             $arCTmp = array("BLOG_ID" => $arCopyBlog["ID"], "POST_ID" => $copyID);
             CBlogComment::Update($arC["ID"], $arCTmp);
         }
         $arFilter = array("POST_ID" => $arParams["ID"], "BLOG_ID" => $arBlog["ID"], "IS_COMMENT" => "Y");
         $res = CBlogImage::GetList(array("ID" => "ASC"), $arFilter);
         while ($arImg = $res->GetNext()) {
             $arNewImg = array("BLOG_ID" => $arCopyBlog["ID"], "POST_ID" => $copyID);
             CBlogImage::Update($arImg["ID"], $arNewImg);
         }
         if (!CBlogPost::Delete($arParams["ID"])) {
             $arResult["ERROR_MESSAGE"] = GetMessage("BPE_COPY_DELETE_ERROR");
         } else {
             CBlogPost::DeleteLog($arParams["ID"], $arParams["MICROBLOG"]);
开发者ID:rasuldev,项目名称:torino,代码行数:31,代码来源:component.php


注:本文中的CBlogPost::CanUserDeletePost方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。