本文整理汇总了PHP中CBlogPost::Delete方法的典型用法代码示例。如果您正苦于以下问题:PHP CBlogPost::Delete方法的具体用法?PHP CBlogPost::Delete怎么用?PHP CBlogPost::Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBlogPost
的用法示例。
在下文中一共展示了CBlogPost::Delete方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$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));
}
}
}
if ($_GET["delete"] == "Y" && !$arResult["bFromList"]) {
if (check_bitrix_sessid()) {
if ($arResult["PostPerm"] >= BLOG_PERMS_FULL) {
CBlogPost::DeleteLog($arParams["ID"]);
if (CBlogPost::Delete($arParams["ID"])) {
BXClearCache(True, "/" . SITE_ID . "/blog/popular_posts/");
$url = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BLOG"], array("blog" => $arBlog["URL"], "user_id" => $arBlog["OWNER_ID"], "group_id" => $arBlog["SOCNET_GROUP_ID"]));
if (strpos($url, "?") === false) {
$url .= "?";
} else {
$url .= "&";
}
$url .= "del_id=" . $arParams["ID"] . "&success=Y";
BXClearCache(true, "/blog/socnet_post/" . intval($arParams["ID"] / 100) . "/" . $arParams["ID"] . "/");
BXClearCache(true, "/blog/socnet_post/gen/" . intval($arParams["ID"] / 100) . "/" . $arParams["ID"] . "/");
LocalRedirect($url);
} else {
$arResult["ERROR_MESSAGE"] .= GetMessage("BLOG_BLOG_BLOG_MES_DEL_ERROR") . '<br />';
}
}
示例2: DeletePost
function DeletePost($params)
{
global $USER;
$postId = IntVal(CBlogMetaWeblog::DecodeParams($params[1]["#"]["value"][0]["#"]));
$user = CBlogMetaWeblog::DecodeParams($params[2]["#"]["value"][0]["#"]);
$password = CBlogMetaWeblog::DecodeParams($params[3]["#"]["value"][0]["#"]);
if (CBlogMetaWeblog::Authorize($user, $password)) {
$result = '';
$userId = $USER->GetID();
if (IntVal($postId) > 0) {
$dbPost = CBlogPost::GetList(array(), array("AUTHOR_ID" => $userId, "ID" => $postId), false, array("nTopCount" => 1), array("ID", "BLOG_ID", "AUTHOR_ID"));
if ($arPost = $dbPost->Fetch()) {
CBlogPost::Delete($postId);
$arBlog = CBlog::GetByID($arPost["BLOG_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"] . "/first_page/");
BXClearCache(True, "/" . $site_id_tmp . "/blog/" . $arBlog["URL"] . "/pages/");
BXClearCache(True, "/" . $site_id_tmp . "/blog/" . $arBlog["URL"] . "/calendar/");
BXClearCache(True, "/" . $site_id_tmp . "/blog/" . $arBlog["URL"] . "/post/" . $postId . "/");
BXClearCache(True, "/" . $site_id_tmp . "/blog/last_messages/");
BXClearCache(True, "/" . $site_id_tmp . "/blog/commented_posts/");
BXClearCache(True, "/" . $site_id_tmp . "/blog/popular_posts/");
BXClearCache(True, "/" . $site_id_tmp . "/blog/last_comments/");
BXClearCache(True, "/" . $site_id_tmp . "/blog/groups/" . $arResult["BLOG"]["GROUP_ID"] . "/");
BXClearCache(True, "/" . $site_id_tmp . "/blog/" . $arBlog["URL"] . "/trackback/" . $postId . "/");
BXClearCache(True, "/" . $site_id_tmp . "/blog/" . $arBlog["URL"] . "/rss_out/");
BXClearCache(True, "/" . $site_id_tmp . "/blog/" . $arBlog["URL"] . "/rss_all/");
BXClearCache(True, "/" . $site_id_tmp . "/blog/rss_sonet/");
BXClearCache(True, "/" . $site_id_tmp . "/blog/rss_all/");
}
}
}
return '<params>
<param>
<value>
<boolean>1</boolean>
</value>
</param>
</params>';
} else {
return '<fault>
<value>
<struct>
<member>
<name>faultCode</name>
<value><int>3</int></value>
</member>
<member>
<name>faultString</name>
<value><string>' . $arAuthResult["MESSAGE"] . '</string></value>
</member>
</struct>
</value>
</fault>';
}
}
示例3: 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/");
BXClearCache(True, "/" . SITE_ID . "/blog/rss_sonet/");
BXClearCache(True, "/" . SITE_ID . "/blog/rss_all/");
BXClearCache(True, "/" . SITE_ID . "/blog/last_messages_list_extranet/");
示例4: GetMessage
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");
}
}
if (empty($arResultNFCache["ERROR_MESSAGE"])) {
if (intval($_GET["hide_id"]) > 0 || intval($_GET["show_id"]) > 0) {
$Notify = CIdeaManagment::getInstance()->Notification(array("ID" => $postId));
示例5: Delete
function Delete($ID)
{
global $DB;
$ID = IntVal($ID);
$bSuccess = True;
$arUser = CBlogUser::GetByID($ID, BLOG_BY_USER_ID);
if ($arUser) {
$dbResult = CBlog::GetList(array(), array("OWNER_ID" => $arUser["USER_ID"]), false, false, array("ID"));
if ($dbResult->Fetch()) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("BLG_GU_ERROR_OWNER"), "ERROR_OWNER");
$bSuccess = False;
}
if ($bSuccess) {
$dbResult = CBlogPost::GetList(array(), array("AUTHOR_ID" => $arUser["USER_ID"]), false, false, array("ID"));
if ($arResult = $dbResult->Fetch()) {
if (!CBlogPost::Delete($arResult["ID"])) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("BLG_GU_ERROR_AUTHOR"), "ERROR_AUTHOR");
$bSuccess = False;
}
}
}
if ($bSuccess) {
$dbGloUser = CUser::GetByID($arUser["USER_ID"]);
$arGloUser = $dbGloUser->Fetch();
$DB->Query("UPDATE b_blog_comment SET " . "\tAUTHOR_NAME = '" . $DB->ForSql(CBlogUser::GetUserName($arUser["ALIAS"], $arGloUser["NAME"], $arGloUser["LAST_NAME"], $arGloUser["LOGIN"], $arGloUser["SECOND_NAME"])) . "', " . "\tAUTHOR_ID = null " . "WHERE AUTHOR_ID = " . $arUser["USER_ID"] . "", true);
$DB->Query("DELETE FROM b_blog_user2user_group WHERE USER_ID = " . $arUser["USER_ID"] . "", true);
}
if ($bSuccess) {
$strSql = "SELECT F.ID " . "FROM b_blog_user FU, b_file F " . "WHERE FU.ID = " . $arUser["ID"] . " " . "\tAND FU.AVATAR = F.ID ";
$z = $DB->Query($strSql, false, "FILE: " . __FILE__ . " LINE:" . __LINE__);
while ($zr = $z->Fetch()) {
CFile::Delete($zr["ID"]);
}
if (CModule::IncludeModule("search")) {
CSearch::Index("blog", "U" . $arUser["ID"], array("TITLE" => "", "BODY" => ""));
}
unset($GLOBALS["BLOG_USER"]["BLOG_USER_CACHE_" . $arUser["ID"]]);
unset($GLOBALS["BLOG_USER"]["BLOG_USER1_CACHE_" . $arUser["USER_ID"]]);
unset($GLOBALS["BLOG_USER"]["BLOG_USER2GROUP_CACHE_" . $arUser["ID"]]);
unset($GLOBALS["BLOG_USER"]["BLOG_USER2GROUP1_CACHE_" . $arUser["USER_ID"]]);
return $DB->Query("DELETE FROM b_blog_user WHERE ID = " . $arUser["ID"] . "", true);
}
if (!$bSuccess) {
return false;
}
}
return True;
}
示例6: IntVal
}
}
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");
}
} else {
$arResult["ERROR_MESSAGE"] .= GetMessage("BLOG_BLOG_SESSID_WRONG");
}
$arResult["delete_blog_post"] = "Y";
$this->IncludeComponentTemplate();
示例7: switch
switch ($_REQUEST["ACTION"]) {
case "drop":
if (!CIBlockElement::Delete($itemID)) {
$sError = GetMessage("P_DELETE_ERROR");
if ($ex = $APPLICATION->GetException()) {
$sError = $ex->GetString();
}
$arError[] = array("id" => "drop error", "text" => PhotoShowError(array("code" => "NOT_DELETED", "title" => $sError, "DATA" => $arRes)));
continue;
}
$iFileSize += intVal($arRes["REAL_PICTURE"]["FILE_SIZE"]);
if ($arRes["BLOG_POST_ID"] > 0) {
CModule::IncludeModule("blog");
$arPost = CBlogPost::GetByID($arRes["BLOG_POST_ID"]);
$arBlog = CBlog::GetByID($arPost["BLOG_ID"]);
CBlogPost::Delete($arRes["BLOG_POST_ID"]);
BXClearCache(True, "/" . SITE_ID . "/blog/" . $arBlog["URL"]);
}
if ($arRes["FORUM_TOPIC_ID"] > 0) {
CModule::IncludeModule("forum");
ForumDeleteTopic($arRes["FORUM_TOPIC_ID"]);
}
$events = GetModuleEvents("photogallery", "OnAfterPhotoDrop");
$arEventFields = array("ID" => $arRes["ID"], "SECTION_ID" => $arRes["IBLOCK_SECTION_ID"]);
$sectionsIds[] = $arRes["IBLOCK_SECTION_ID"];
while ($arEvent = $events->Fetch()) {
ExecuteModuleEventEx($arEvent, array($arEventFields, $arParams));
}
break;
case "move":
$bs = new CIBlockElement();
示例8: GetMessage
$strError = GetMessage("BLOG_MOBILE_AJAX_BLOG_MODULE_ERROR");
} elseif (!CModule::IncludeModule("socialnetwork")) {
$strError = GetMessage("BLOG_MOBILE_AJAX_SONET_MODULE_ERROR");
} elseif (!($arBlogPost = CBlogPost::GetByID($post_id))) {
$strError = GetMessage("BLOG_MOBILE_BLOG_POST_ERROR");
} elseif (!($arBlog = CBlog::GetByID($arBlogPost["BLOG_ID"]))) {
$strError = GetMessage("BLOG_MOBILE_BLOG_ERROR");
}
if (!$strError) {
if ($action == "delete_post") {
$PostPerm = CBlogPost::GetSocNetPostPerms($post_id, true, $GLOBALS["USER"]->GetID(), $arBlogPost["AUTHOR_ID"]);
if ($PostPerm < BLOG_PERMS_FULL) {
$strError = GetMessage("BLOG_MOBILE_DELETE_PERMISSION_ERROR");
} else {
CBlogPost::DeleteLog($post_id);
if (CBlogPost::Delete($post_id)) {
BXClearCache(True, "/" . SITE_ID . "/blog/popular_posts/");
BXClearCache(true, "/blog/socnet_post/" . $post_id . "/");
BXClearCache(true, "/blog/socnet_post/gen/" . $post_id . "/");
} else {
$strError = GetMessage("BLOG_MOBILE_DELETE_ERROR");
}
}
} elseif ($action == "get_blog_post_data") {
$rsLog = CSocNetLog::GetList(array(), array("EVENT_ID" => array("blog_post", "blog_post_important"), "SOURCE_ID" => $post_id), false, false, array("ID"));
if ($arLog = $rsLog->Fetch()) {
$arResult["log_id"] = $arLog["ID"];
$arResult["post_user_id"] = $arBlogPost["AUTHOR_ID"];
$arResult["PostPerm"] = CBlogPost::GetSocNetPostPerms($post_id, true, $GLOBALS["USER"]->GetID(), $arBlogPost["AUTHOR_ID"]);
if ($arResult["PostPerm"] >= BLOG_PERMS_FULL) {
$arRights = array();