本文整理匯總了PHP中CBlogImage::Delete方法的典型用法代碼示例。如果您正苦於以下問題:PHP CBlogImage::Delete方法的具體用法?PHP CBlogImage::Delete怎麽用?PHP CBlogImage::Delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CBlogImage
的用法示例。
在下文中一共展示了CBlogImage::Delete方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Delete
public static function Delete($ID)
{
global $DB;
$ID = IntVal($ID);
$arResult = CBlogComment::GetByID($ID);
foreach(GetModuleEvents("blog", "OnBeforeCommentDelete", true) as $arEvent)
{
if (ExecuteModuleEventEx($arEvent, Array($ID))===false)
return false;
}
if ($arResult)
{
$DB->Query(
"UPDATE b_blog_comment SET ".
" PARENT_ID = ".((IntVal($arResult["PARENT_ID"]) > 0) ? IntVal($arResult["PARENT_ID"]) : "null")." ".
"WHERE PARENT_ID = ".$ID." ".
" AND BLOG_ID = ".IntVal($arResult["BLOG_ID"])." ".
" AND POST_ID = ".IntVal($arResult["POST_ID"])." ",
true
);
if($arResult["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH)
CBlogPost::Update($arResult["POST_ID"], array("=NUM_COMMENTS" => "NUM_COMMENTS - 1"));
$res = CBlogImage::GetList(array(), array("BLOG_ID" => $arResult["BLOG_ID"], "POST_ID"=>$arResult["POST_ID"], "IS_COMMENT" => "Y", "COMMENT_ID" => $ID));
while($aImg = $res->Fetch())
CBlogImage::Delete($aImg['ID']);
$GLOBALS["USER_FIELD_MANAGER"]->Delete("BLOG_COMMENT", $ID);
}
unset($GLOBALS["BLOG_COMMENT"]["BLOG_COMMENT_CACHE_".$ID]);
foreach(GetModuleEvents("blog", "OnCommentDelete", true) as $arEvent)
ExecuteModuleEventEx($arEvent, Array($ID));
if (CModule::IncludeModule("search"))
{
CSearch::Index("blog", "C".$ID,
array(
"TITLE" => "",
"BODY" => ""
)
);
}
return $DB->Query("DELETE FROM b_blog_comment WHERE ID = ".$ID."", true);
}
示例2: array
$res = CBlogImage::GetList(array(), array("POST_ID" => $arPost["ID"], "BLOG_ID" => $arBlog["ID"], "COMMENT_ID" => $commentID, "IS_COMMENT" => "Y"));
while ($aImg = $res->Fetch()) {
$images[$aImg["ID"]] = $aImg["FILE_ID"];
}
$arParamsUpdateLog = array("PATH_TO_SMILE" => $arParams["PATH_TO_SMILE"], "IMAGES" => $images);
if (IntVal($user_id) > 0) {
$arResult["BlogUser"] = CBlogUser::GetByID($user_id, BLOG_BY_USER_ID);
$arResult["BlogUser"] = CBlogTools::htmlspecialcharsExArray($arResult["BlogUser"]);
$dbUser = CUser::GetByID($user_id);
$arResult["arUser"] = $dbUser->GetNext();
$arResult["User"]["NAME"] = CBlogUser::GetUserName($arResult["BlogUser"]["ALIAS"], $arResult["arUser"]["NAME"], $arResult["arUser"]["LAST_NAME"], $arResult["arUser"]["LOGIN"]);
}
CBlogComment::UpdateLog($commentID, $arResult["BlogUser"], $arResult["User"], $arFields, $arPost, $arParamsUpdateLog);
$res = CBlogImage::GetList(array(), array("POST_ID" => $arPost["ID"], "BLOG_ID" => $arBlog["ID"], "IS_COMMENT" => "Y", "COMMENT_ID" => false, "<=TIMESTAMP_X" => ConvertTimeStamp(AddToTimeStamp(array("HH" => -3)), "FULL")));
while ($aImg = $res->Fetch()) {
CBlogImage::Delete($aImg["ID"]);
}
$commentUrl = CComponentEngine::MakePathFromTemplate(htmlspecialcharsBack($arParams["PATH_TO_POST"]), array("post_id" => CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arParams["ALLOW_POST_CODE"]), "user_id" => $arBlog["OWNER_ID"]));
$commentUrl .= strpos($commentUrl, "?") !== false ? "&" : "?";
if (strlen($arFields["PUBLISH_STATUS"]) > 0 && $arFields["PUBLISH_STATUS"] != BLOG_PUBLISH_STATUS_PUBLISH) {
$arResult["MESSAGE"] = GetMessage("B_B_PC_MES_HIDDEN_EDITED");
}
$arResult["ajax_comment"] = $commentID;
$bHasImg = false;
$bHasProps = false;
$dbImg = CBlogImage::GetList(array(), array("BLOG_ID" => $arBlog["ID"], "POST_ID" => $arPost["ID"], "IS_COMMENT" => "Y"), false, false, array("ID"));
if ($dbImg->Fetch()) {
$bHasImg = true;
}
$arPostFields = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("BLOG_COMMENT", $commentID, LANGUAGE_ID);
foreach ($arPostFields as $arPostField) {
示例3: intval
}
}
echo CUtil::PhpToJsObject(array('SUCCESS' => 'Y', "FILE_ID" => $file_id));
}
}
if (isset($_REQUEST["post_id"]) && intval($_REQUEST["post_id"]) > 0) {
// Blog Images
$varKey = "MFU_UPLOADED_IMAGES_" . $GLOBALS["USER"]->GetId() . "_" . intval($_REQUEST["post_id"]);
if (in_array($file_id, $_SESSION[$varKey])) {
$rsFile = CFile::GetByID($file_id);
if ($arFile = $rsFile->Fetch()) {
$bFileFound = true;
if (CModule::IncludeModule('blog')) {
$rsBlogImage = CBlogImage::GetList(array(), array("FILE_ID" => $file_id));
if ($arBlogImage = $rsBlogImage->Fetch()) {
CBlogImage::Delete($arBlogImage["ID"]);
BXClearCache(true, "/blog/socnet_post/" . intval($_REQUEST["post_id"]) . "/");
BXClearCache(true, "/blog/socnet_post/gen/" . intval($_REQUEST["post_id"]) . "/");
}
}
CFile::Delete($file_id);
foreach ($_SESSION[$varKey] as $key => $session_file_id) {
if ($session_file_id == $file_id) {
unset($_SESSION[$varKey][$key]);
break;
}
}
echo CUtil::PhpToJsObject(array('SUCCESS' => 'Y', "FILE_ID" => $file_id));
}
}
}
示例4: GetMessage
CBlog::AddSocnetRead($blogID);
}
$arBlog = CBlog::GetByID($blogID, $arParams["GROUP_ID"]);
}
}
} else {
$arResult["ERROR_MESSAGE"] = GetMessage("BPE_SESS");
}
}
if ($_GET["image_upload_frame"] == "Y" || $_GET["image_upload"] || $_POST["do_upload"] || $_GET["del_image_id"]) {
if (check_bitrix_sessid()) {
if (IntVal($_GET["del_image_id"]) > 0) {
$del_image_id = IntVal($_GET["del_image_id"]);
$aImg = CBlogImage::GetByID($del_image_id);
if ($aImg["BLOG_ID"] == $arBlog["ID"] && $aImg["POST_ID"] == IntVal($arParams["ID"])) {
CBlogImage::Delete($del_image_id);
}
$APPLICATION->RestartBuffer();
die;
} else {
$arResult["imageUploadFrame"] = "Y";
$arResult["imageUpload"] = "Y";
$APPLICATION->RestartBuffer();
header("Pragma: no-cache");
$arFields = array();
if ($_FILES["BLOG_UPLOAD_FILE"]["size"] > 0) {
$arFields = array("BLOG_ID" => $arBlog["ID"], "POST_ID" => $arParams["ID"], "USER_ID" => $arResult["UserID"], "=TIMESTAMP_X" => $DB->GetNowFunction(), "TITLE" => $_POST["IMAGE_TITLE"], "IMAGE_SIZE" => $_FILES["BLOG_UPLOAD_FILE"]["size"]);
$arImage = array_merge($_FILES["BLOG_UPLOAD_FILE"], array("MODULE_ID" => "blog", "del" => "Y"));
$arFields["FILE_ID"] = $arImage;
} elseif ($_POST["do_upload"] && $_FILES["FILE_ID"]["size"] > 0) {
$arFields = array("BLOG_ID" => $arBlog["ID"], "POST_ID" => $arParams["ID"], "USER_ID" => $arResult["UserID"], "=TIMESTAMP_X" => $DB->GetNowFunction(), "TITLE" => $_POST["IMAGE_TITLE"], "IMAGE_SIZE" => $_FILES["FILE_ID"]["size"], "URL" => $arBlog["URL"]);
示例5: Delete
function Delete($ID)
{
global $DB;
$ID = IntVal($ID);
$bSuccess = True;
$db_events = GetModuleEvents("blog", "OnBeforeBlogDelete");
while ($arEvent = $db_events->Fetch()) {
if (ExecuteModuleEventEx($arEvent, array($ID)) === false) {
return false;
}
}
$events = GetModuleEvents("blog", "OnBlogDelete");
while ($arEvent = $events->Fetch()) {
ExecuteModuleEventEx($arEvent, array($ID));
}
$arBlog = CBlog::GetByID($ID);
$DB->StartTransaction();
if ($bSuccess) {
$bSuccess = $DB->Query("DELETE FROM b_blog_user2blog WHERE BLOG_ID = " . $ID . "", true);
}
if ($bSuccess) {
$bSuccess = $DB->Query("DELETE FROM b_blog_user_group_perms WHERE BLOG_ID = " . $ID . "", true);
}
if ($bSuccess) {
$bSuccess = $DB->Query("DELETE FROM b_blog_user2user_group WHERE BLOG_ID = " . $ID . "", true);
}
if ($bSuccess) {
$bSuccess = $DB->Query("DELETE FROM b_blog_user_group WHERE BLOG_ID = " . $ID . "", true);
}
if ($bSuccess) {
$bSuccess = $DB->Query("DELETE FROM b_blog_trackback WHERE BLOG_ID = " . $ID . "", true);
}
if ($bSuccess) {
$bSuccess = $DB->Query("DELETE FROM b_blog_comment WHERE BLOG_ID = " . $ID . "", true);
}
if ($bSuccess) {
$bSuccess = $DB->Query("DELETE FROM b_blog_post WHERE BLOG_ID = " . $ID . "", true);
}
if ($bSuccess) {
$bSuccess = $DB->Query("DELETE FROM b_blog_category WHERE BLOG_ID = " . $ID . "", true);
}
if ($bSuccess) {
unset($GLOBALS["BLOG"]["BLOG_CACHE_" . $ID]);
unset($GLOBALS["BLOG"]["BLOG4OWNER_CACHE_" . $arBlog["OWNER_ID"]]);
}
if ($bSuccess) {
$bSuccess = $DB->Query("DELETE FROM b_blog WHERE ID = " . $ID . "", true);
}
if ($bSuccess) {
$DB->Commit();
} else {
$DB->Rollback();
}
if ($bSuccess) {
if (CModule::IncludeModule("search")) {
CSearch::DeleteIndex("blog", false, "COMMENT", $ID . "|%");
CSearch::DeleteIndex("blog", false, "POST", $ID);
CSearch::DeleteIndex("blog", "B" . $ID);
}
}
if ($bSuccess) {
$res = CBlogImage::GetList(array(), array("BLOG_ID" => $ID));
while ($aImg = $res->Fetch()) {
CBlogImage::Delete($aImg['ID']);
}
}
if ($bSuccess) {
$GLOBALS["USER_FIELD_MANAGER"]->Delete("BLOG_BLOG", $ID);
}
CBlog::DeleteSocnetRead($ID);
return $bSuccess;
}