本文整理汇总了PHP中CBlogImage::Update方法的典型用法代码示例。如果您正苦于以下问题:PHP CBlogImage::Update方法的具体用法?PHP CBlogImage::Update怎么用?PHP CBlogImage::Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBlogImage
的用法示例。
在下文中一共展示了CBlogImage::Update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: EditPost
function EditPost($params)
{
global $USER, $DB;
$postId = IntVal(CBlogMetaWeblog::DecodeParams($params[0]["#"]["value"][0]["#"]));
$user = CBlogMetaWeblog::DecodeParams($params[1]["#"]["value"][0]["#"]);
$password = CBlogMetaWeblog::DecodeParams($params[2]["#"]["value"][0]["#"]);
$arPostInfo = $params[3]["#"]["value"][0]["#"]["struct"][0]["#"]["member"];
$publish = $params[4]["#"]["value"][0]["#"]["boolean"][0]["#"];
foreach ($arPostInfo as $val) {
${$val["#"]["name"][0]["#"]} = CBlogMetaWeblog::DecodeParams($val["#"]["value"][0]["#"]);
}
$arCategory = array();
if (is_array($categories["data"][0]["#"]["value"])) {
foreach ($categories["data"][0]["#"]["value"] as $val) {
$catTmp = CBlogMetaWeblog::DecodeParams($val["#"]);
if (strlen($catTmp) > 0) {
$arCategory[] = $catTmp;
}
}
}
if (CBlogMetaWeblog::Authorize($user, $password)) {
$result = '';
$userId = $USER->GetID();
if (IntVal($postId) > 0) {
$arSelectedFields = array("ID", "BLOG_ID", "TITLE", "DATE_PUBLISH", "AUTHOR_ID", "DETAIL_TEXT", "DETAIL_TEXT_TYPE");
$dbPost = CBlogPost::GetList(array(), array("AUTHOR_ID" => $userId, "ID" => $postId), false, array("nTopCount" => 1), $arSelectedFields);
if ($arPost = $dbPost->Fetch()) {
$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);
}
$CATEGORYtmp = array();
$dbCategory = CBlogCategory::GetList(array(), array("BLOG_ID" => $arPost["BLOG_ID"]));
while ($arCat = $dbCategory->Fetch()) {
$arCatBlog[ToLower($arCat["NAME"])] = $arCat["ID"];
}
foreach ($arCategory as $tg) {
$tg = trim($tg);
if (!in_array($arCatBlog[ToLower($tg)], $CATEGORYtmp)) {
if (IntVal($arCatBlog[ToLower($tg)]) > 0) {
$CATEGORYtmp[] = $arCatBlog[ToLower($tg)];
} else {
$CATEGORYtmp[] = CBlogCategory::Add(array("BLOG_ID" => $arPost["BLOG_ID"], "NAME" => $tg));
foreach ($arSites as $site_id_tmp) {
BXClearCache(True, "/" . $site_id_tmp . "/blog/" . $arBlog["URL"] . "/category/");
}
}
}
}
$dbSite = CSite::GetByID(SITE_ID);
$arSite = $dbSite->Fetch();
$serverName = htmlspecialcharsEx($arSite["SERVER_NAME"]);
if (strlen($serverName) <= 0) {
if (defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0) {
$serverName = SITE_SERVER_NAME;
} else {
$serverName = COption::GetOptionString("main", "server_name", "www.bitrixsoft.com");
}
}
$dbImage = CBlogImage::GetList(array(), array("POST_ID" => false, "BLOG_ID" => $arBlog["ID"], "IS_COMMENT" => "N"));
while ($arImage = $dbImage->Fetch()) {
$path = "";
$path = CFile::GetPath($arImage["FILE_ID"]);
$path = "http://" . $serverName . $path;
if (strpos($description, $path) !== false) {
$description = str_replace('<img src="' . $path . '" alt=""/>', "[IMG ID=" . $arImage["ID"] . "]", $description);
CBlogImage::Update($arImage["ID"], array("POST_ID" => $arPost["ID"]));
}
}
$arFields = array("TITLE" => $title, "DETAIL_TEXT" => $description, "DETAIL_TEXT_TYPE" => "html", "PUBLISH_STATUS" => $publish == 1 ? "P" : "D", "CATEGORY_ID" => implode(",", $CATEGORYtmp));
$postId = CBlogPost::Update($arPost["ID"], $arFields);
CBlogPostCategory::DeleteByPostID($arPost["ID"]);
foreach ($CATEGORYtmp as $v) {
CBlogPostCategory::Add(array("BLOG_ID" => $arPost["BLOG_ID"], "POST_ID" => $arPost["ID"], "CATEGORY_ID" => $v));
}
if (IntVal($postId) > 0) {
foreach ($arSites as $site_id_tmp) {
BXClearCache(True, "/" . $site_id_tmp . "/blog/" . $arBlog["URL"] . "/first_page/");
BXClearCache(True, "/" . $site_id_tmp . "/blog/" . $arBlog["URL"] . "/calendar/");
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/" . $arBlog["GROUP_ID"] . "/");
BXClearCache(True, "/" . $site_id_tmp . "/blog/" . $arBlog["URL"] . "/trackback/" . $arPost["ID"] . "/");
BXClearCache(True, "/" . $site_id_tmp . "/blog/" . $arBlog["URL"] . "/comment/" . $arPost["ID"] . "/");
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/");
BXClearCache(True, "/" . $site_id_tmp . "/blog/" . $arBlog["URL"] . "/favorite/");
BXClearCache(True, "/" . $site_id_tmp . "/blog/" . $arBlog["URL"] . "/post/" . $arPost["ID"] . "/");
}
return '<params>
//.........这里部分代码省略.........
示例2: array
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"]);
}
}
}
BXClearCache(True, "/" . SITE_ID . "/blog/" . $arCopyBlog["URL"] . "/first_page/");
BXClearCache(True, "/" . SITE_ID . "/blog/" . $arCopyBlog["URL"] . "/calendar/");
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/" . $arCopyBlog["GROUP_ID"] . "/");
示例3: array
}
CSocNetLog::Update($logID, array("TMP_ID" => $logID));
if (CModule::IncludeModule("extranet")) {
$arSiteID = CExtranet::GetSitesByLogDestinations($socnetPerms);
CSocNetLog::Update($logID, array("SITE_ID" => $arSiteID));
}
CSocNetLogRights::DeleteByLogID($logID);
CSocNetLogRights::Add($logID, $socnetPerms);
CSocNetLog::SendEvent($logID, "SONET_NEW_EVENT", $logID);
}
}
}
// IMAGES UPDATE
if (!empty($arImagesToUpdate)) {
foreach ($arImagesToUpdate as $imgID) {
CBlogImage::Update($imgID, array("POST_ID" => $postID));
}
}
// category update
foreach ($iCategory as $iCategoryValue) {
CBlogPostCategory::Add(array("BLOG_ID" => $blogID, "POST_ID" => $postID, "CATEGORY_ID" => $iCategoryValue));
}
// COMMENTS
if (!empty($arComments)) {
if (!function_exists("__blog_add_comments")) {
function __blog_add_comments($arComments, $parentID, $arParams)
{
if (!is_array($arComments) || empty($arComments)) {
return;
}
foreach ($arComments as $res) {