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


PHP CBlogPost::Update方法代码示例

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


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

示例1: AddBlogPost

 public static function AddBlogPost($arFields)
 {
     if (!is_array($_POST)) {
         $_POST = array();
     }
     $_POST = array_merge($_POST, array("apply" => "Y", "decode" => "N"), $arFields);
     $strPathToPost = COption::GetOptionString("socialnetwork", "userblogpost_page", false, SITE_ID);
     $strPathToSmile = COption::GetOptionString("socialnetwork", "smile_page", false, SITE_ID);
     $BlogGroupID = COption::GetOptionString("socialnetwork", "userbloggroup_id", false, SITE_ID);
     $arBlogComponentParams = array("IS_REST" => "Y", "ID" => "new", "PATH_TO_POST" => $strPathToPost, "PATH_TO_SMILE" => $strPathToSmile, "GROUP_ID" => $BlogGroupID, "USER_ID" => $GLOBALS["USER"]->GetID(), "USE_SOCNET" => "Y", "MICROBLOG" => "Y");
     ob_start();
     $result = $GLOBALS["APPLICATION"]->IncludeComponent("bitrix:socialnetwork.blog.post.edit", "", $arBlogComponentParams, false, array("HIDE_ICONS" => "Y"));
     ob_end_clean();
     if (!$result) {
         throw new Exception('Error');
     } else {
         if (isset($arFields["FILES"]) && \Bitrix\Main\Config\Option::get('disk', 'successfully_converted', false) && CModule::includeModule('disk') && ($storage = \Bitrix\Disk\Driver::getInstance()->getStorageByUserId($GLOBALS["USER"]->GetID())) && ($folder = $storage->getFolderForUploadedFiles($GLOBALS["USER"]->GetID()))) {
             // upload to storage
             $arResultFile = array();
             foreach ($arFields["FILES"] as $tmp) {
                 $arFile = CRestUtil::saveFile($tmp);
                 if (is_array($arFile)) {
                     $file = $folder->uploadFile($arFile, array('NAME' => $arFile["name"], 'CREATED_BY' => $GLOBALS["USER"]->GetID()), array(), true);
                     if ($file) {
                         $arResultFile[] = \Bitrix\Disk\Uf\FileUserType::NEW_FILE_PREFIX . $file->getId();
                     }
                 }
             }
             if (!empty($arResultFile)) {
                 CBlogPost::Update($result, array("HAS_PROPS" => "Y", "UF_BLOG_POST_FILE" => $arResultFile));
             }
         }
         return $result;
     }
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:35,代码来源:rest.php

示例2: Delete

 public static function Delete($ID)
 {
     global $DB;
     $ID = IntVal($ID);
     $arTrackback = CBlogTrackback::GetByID($ID);
     if ($arTrackback) {
         CBlogPost::Update($arTrackback["POST_ID"], array("=NUM_TRACKBACKS" => "NUM_TRACKBACKS - 1"));
     }
     unset($GLOBALS["BLOG_TRACKBACK"]["BLOG_TRACKBACK_CACHE_" . $ID]);
     return $DB->Query("DELETE FROM b_blog_trackback WHERE ID = " . $ID . "", true);
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:11,代码来源:blog_trackback.php

示例3: Add

	function Add($arFields)
	{
		global $DB;

		$arFields1 = array();
		foreach ($arFields as $key => $value)
		{
			if (substr($key, 0, 1) == "=")
			{
				$arFields1[substr($key, 1)] = $value;
				unset($arFields[$key]);
			}
		}

		if (!CBlogTrackback::CheckFields("ADD", $arFields))
			return false;

		$arInsert = $DB->PrepareInsert("b_blog_trackback", $arFields);

		foreach ($arFields1 as $key => $value)
		{
			if (strlen($arInsert[0]) > 0)
				$arInsert[0] .= ", ";
			$arInsert[0] .= $key;
			if (strlen($arInsert[1]) > 0)
				$arInsert[1] .= ", ";
			$arInsert[1] .= $value;
		}

		$ID = False;
		if (strlen($arInsert[0]) > 0)
		{
			$strSql =
				"INSERT INTO b_blog_trackback(".$arInsert[0].") ".
				"VALUES(".$arInsert[1].")";
			$DB->Query($strSql, False, "File: ".__FILE__."<br>Line: ".__LINE__);

			$ID = IntVal($DB->LastID());
		}

		if ($ID)
		{
			$arTrackback = CBlogTrackback::GetByID($ID);
			CBlogPost::Update($arTrackback["POST_ID"], array("=NUM_TRACKBACKS" => "NUM_TRACKBACKS + 1"));
		}

		return $ID;
	}
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:48,代码来源:blog_trackback.php

示例4: UnBind

 public function UnBind()
 {
     if (!$this->IsAvailable()) {
         return false;
     }
     //Comment doesn't exists
     $arComment = $this->Get();
     if (!$arComment) {
         return false;
     }
     $arIdea = CBlogPost::GetList(array(), array("ID" => $arComment["POST_ID"]), false, false, array("ID", CIdeaManagment::UFAnswerIdField))->Fetch();
     if ($arIdea) {
         if (!is_array($arIdea[CIdeaManagment::UFAnswerIdField])) {
             $arIdea[CIdeaManagment::UFAnswerIdField] = array();
         }
         $arIdea[CIdeaManagment::UFAnswerIdField] = array_unique($arIdea[CIdeaManagment::UFAnswerIdField]);
         $key = array_search($arComment["ID"], $arIdea[CIdeaManagment::UFAnswerIdField]);
         if (is_numeric($key)) {
             unset($arIdea[CIdeaManagment::UFAnswerIdField][$key], $arIdea["ID"]);
             return CBlogPost::Update($arComment["POST_ID"], $arIdea) > 0;
         }
     }
     return false;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:24,代码来源:idea_idea_comment.php

示例5: array

$arBlogPostId = array();
foreach ($arBlogPostFields as $BlogPostFields) {
    $arBlogPostId[] = CBlogPost::Add($BlogPostFields);
}
foreach ($arBlogPostId as $key => $BlogPostId) {
    if (!is_array($categoryID[$key])) {
        continue;
    }
    foreach ($categoryID[$key] as $v) {
        CBlogPostCategory::Add(array("BLOG_ID" => $blogID, "POST_ID" => $BlogPostId, "CATEGORY_ID" => $v));
    }
}
//Post Comments
$arBlogCommentFields = array();
$arBlogCommentFields[] = array("TITLE" => '', "POST_TEXT" => GetMessage("IDEA_BLOG_DEMO_COMMENT_BODY_1"), "BLOG_ID" => $blogID, "POST_ID" => $arBlogPostId[0], "PARENT_ID" => 0, "AUTHOR_ID" => 1, "DATE_CREATE" => ConvertTimeStamp(false, "FULL"), "AUTHOR_IP" => "192.168.0.108", "PATH" => "/services/idea/#post_id#/?commentId=#comment_id###comment_id#");
$arBlogCommentFields[] = array("TITLE" => '', "POST_TEXT" => GetMessage("IDEA_BLOG_DEMO_COMMENT_BODY_2"), "BLOG_ID" => $blogID, "POST_ID" => $arBlogPostId[0], "PARENT_ID" => 0, "AUTHOR_ID" => 1, "DATE_CREATE" => ConvertTimeStamp(false, "FULL"), "AUTHOR_IP" => "192.168.0.108", "PATH" => "/services/idea/#post_id#/?commentId=#comment_id###comment_id#");
$arCommentId = array();
foreach ($arBlogCommentFields as $BlogCommentFields) {
    $arCommentId[] = CBlogComment::Add($BlogCommentFields);
}
if ($arBlogPost = CBlogPost::GetList(array(), array("BLOG_ID" => $blogID, "ID" => $arBlogPostId[0]), false, false, array("ID", CIdeaManagment::UFAnswerIdField, CIdeaManagment::UFStatusField))->Fetch()) {
    //if Empty value make an array
    if (!is_array($arBlogPost[CIdeaManagment::UFAnswerIdField])) {
        $arBlogPost[CIdeaManagment::UFAnswerIdField] = array();
    }
    $arBlogPost[CIdeaManagment::UFAnswerIdField][] = $arCommentId[1];
    unset($arBlogPost["ID"]);
    CBlogPost::Update($arBlogPostId[0], $arBlogPost);
}
//Replace in file
CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/services/idea/index.php", array("IDEA_BLOG_CODE" => $IdeaBlogUrl, "IDEA_BIND_STATUS_DEFAULT" => $arUFIdByName["NEW"]));
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:idea_blog.php

示例6: GetMessage

 } 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));
                 if (intval($_GET["hide_id"]) > 0) {
                     $Notify->getSonetNotify()->HideMessage();
                 } else {
                     $Notify->getSonetNotify()->ShowMessage();
                 }
             }
             BXClearCache(True, "/" . SITE_ID . "/idea/" . $arResult["BLOG"]["ID"] . "/first_page/");
             BXClearCache(True, "/" . SITE_ID . "/idea/" . $arResult["BLOG"]["ID"] . "/pages/");
             BXClearCache(True, "/" . SITE_ID . "/idea/" . $arResult["BLOG"]["ID"] . "/post/" . $postId . "/");
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php

示例7: InstallBlogComment

 private function InstallBlogComment()
 {
     global $USER;
     $arBlogComments = $this->arResult["INSTALLATION"]["BLOG_COMMENT_ID"] = array();
     if ($this->arResult["INSTALLATION"]["BLOG_POST_ID"]["NY"]) {
         $arBlogComments["COMMON"] = array("TITLE" => '', "POST_TEXT" => GetMessage("IDEA_BLOG_COMMENT_TEXT_1"), "BLOG_ID" => $this->arResult["INSTALLATION"]["BLOG_ID"], "POST_ID" => $this->arResult["INSTALLATION"]["BLOG_POST_ID"]["NY"], "PARENT_ID" => 0, "AUTHOR_ID" => $USER->GetID(), "DATE_CREATE" => ConvertTimeStamp(false, "FULL"), "PATH" => $this->PublicDir . "#post_id#/?commentId=#comment_id###comment_id#");
     }
     if ($this->arResult["INSTALLATION"]["BLOG_POST_ID"]["NY"]) {
         $arBlogComments["OFFICIAL"] = array("TITLE" => '', "POST_TEXT" => GetMessage("IDEA_BLOG_COMMENT_TEXT_2"), "BLOG_ID" => $this->arResult["INSTALLATION"]["BLOG_ID"], "POST_ID" => $this->arResult["INSTALLATION"]["BLOG_POST_ID"]["NY"], "PARENT_ID" => 0, "AUTHOR_ID" => $USER->GetID(), "DATE_CREATE" => ConvertTimeStamp(false, "FULL"), "PATH" => $this->PublicDir . "#post_id#/");
     }
     foreach ($arBlogComments as $key => $BlogComment) {
         $this->arResult["INSTALLATION"]["BLOG_COMMENT_ID"][$key] = CBlogComment::Add($BlogComment);
         //Make offical answer
         if ($key == "OFFICIAL" && $this->arResult["INSTALLATION"]["BLOG_COMMENT_ID"][$key] > 0) {
             if ($arBlogPost = CBlogPost::GetList(array(), array("BLOG_ID" => $this->arResult["INSTALLATION"]["BLOG_ID"], "ID" => $this->arResult["INSTALLATION"]["BLOG_POST_ID"]["NY"]), false, false, array("ID", CIdeaManagment::UFAnswerIdField, CIdeaManagment::UFStatusField))->Fetch()) {
                 //if Empty value make an array
                 if (!is_array($arBlogPost[CIdeaManagment::UFAnswerIdField])) {
                     $arBlogPost[CIdeaManagment::UFAnswerIdField] = array();
                 }
                 $arBlogPost[CIdeaManagment::UFAnswerIdField][] = $this->arResult["INSTALLATION"]["BLOG_COMMENT_ID"][$key];
                 unset($arBlogPost["ID"]);
                 CBlogPost::Update($this->arResult["INSTALLATION"]["BLOG_POST_ID"]["NY"], $arBlogPost);
             }
         }
     }
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:26,代码来源:step1.php

示例8: Update

 function Update($ID, $arFields)
 {
     global $DB;
     $ID = IntVal($ID);
     if (strlen($arFields["PATH"]) > 0) {
         $arFields["PATH"] = str_replace("#comment_id#", $ID, $arFields["PATH"]);
     }
     $arFields1 = array();
     foreach ($arFields as $key => $value) {
         if (substr($key, 0, 1) == "=") {
             $arFields1[substr($key, 1)] = $value;
             unset($arFields[$key]);
         }
     }
     if (!CBlogComment::CheckFields("UPDATE", $arFields, $ID)) {
         return false;
     } elseif (!$GLOBALS["USER_FIELD_MANAGER"]->CheckFields("BLOG_COMMENT", $ID, $arFields)) {
         return false;
     }
     $db_events = GetModuleEvents("blog", "OnBeforeCommentUpdate");
     while ($arEvent = $db_events->Fetch()) {
         if (ExecuteModuleEventEx($arEvent, array($ID, &$arFields)) === false) {
             return false;
         }
     }
     $strUpdate = $DB->PrepareUpdate("b_blog_comment", $arFields);
     foreach ($arFields1 as $key => $value) {
         if (strlen($strUpdate) > 0) {
             $strUpdate .= ", ";
         }
         $strUpdate .= $key . "=" . $value . " ";
     }
     if (strlen($strUpdate) > 0) {
         if (is_set($arFields["PUBLISH_STATUS"]) && strlen($arFields["PUBLISH_STATUS"]) > 0) {
             $arComment = CBlogComment::GetByID($ID);
             if ($arComment["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH && $arFields["PUBLISH_STATUS"] != BLOG_PUBLISH_STATUS_PUBLISH) {
                 CBlogPost::Update($arComment["POST_ID"], array("=NUM_COMMENTS" => "NUM_COMMENTS - 1"));
             } elseif ($arComment["PUBLISH_STATUS"] != BLOG_PUBLISH_STATUS_PUBLISH && $arFields["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH) {
                 CBlogPost::Update($arComment["POST_ID"], array("=NUM_COMMENTS" => "NUM_COMMENTS + 1"));
             }
         }
         $strSql = "UPDATE b_blog_comment SET " . "\t" . $strUpdate . " " . "WHERE ID = " . $ID . " ";
         $DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         unset($GLOBALS["BLOG_COMMENT"]["BLOG_COMMENT_CACHE_" . $ID]);
         $GLOBALS["USER_FIELD_MANAGER"]->Update("BLOG_COMMENT", $ID, $arFields);
         $arComment = CBlogComment::GetByID($ID);
         $arBlog = CBlog::GetByID($arComment["BLOG_ID"]);
         if ($arBlog["USE_SOCNET"] == "Y") {
             $arFields["SC_PERM"] = CBlogComment::GetSocNetCommentPerms($arComment["POST_ID"]);
         }
         $db_events = GetModuleEvents("blog", "OnCommentUpdate");
         while ($arEvent = $db_events->Fetch()) {
             ExecuteModuleEventEx($arEvent, array($ID, &$arFields));
         }
         if (CModule::IncludeModule("search")) {
             $newPostPerms = CBlogUserGroup::GetGroupPerms(1, $arComment["BLOG_ID"], $arComment["POST_ID"], BLOG_PERMS_POST);
             if ($arBlog["SEARCH_INDEX"] != "Y" || $arComment["PUBLISH_STATUS"] != BLOG_PUBLISH_STATUS_PUBLISH) {
                 CSearch::Index("blog", "C" . $ID, array("TITLE" => "", "BODY" => ""));
             } else {
                 $arGroup = CBlogGroup::GetByID($arBlog["GROUP_ID"]);
                 if (strlen($arFields["PATH"]) > 0) {
                     $arFields["PATH"] = str_replace("#comment_id#", $ID, $arFields["PATH"]);
                     $arPostSite = array($arGroup["SITE_ID"] => $arFields["PATH"]);
                 } elseif (strlen($arComment["PATH"]) > 0) {
                     $arComment["PATH"] = str_replace("#comment_id#", $ID, $arComment["PATH"]);
                     $arPostSite = array($arGroup["SITE_ID"] => $arComment["PATH"]);
                 } else {
                     $arPostSite = array($arGroup["SITE_ID"] => CBlogPost::PreparePath($arBlog["URL"], $arComment["POST_ID"], $arGroup["SITE_ID"], false, $arBlog["OWNER_ID"], $arBlog["SOCNET_GROUP_ID"]));
                 }
                 $searchContent = blogTextParser::killAllTags($arComment["POST_TEXT"]);
                 $searchContent .= "\r\n" . $GLOBALS["USER_FIELD_MANAGER"]->OnSearchIndex("BLOG_COMMENT", $arComment["ID"]);
                 $authorName = "";
                 if (IntVal($arComment["AUTHOR_ID"]) > 0) {
                     $dbUser = CUser::GetByID($arComment["AUTHOR_ID"]);
                     if ($arUser = $dbUser->Fetch()) {
                         $arTmpUser = array("NAME" => $arUser["NAME"], "LAST_NAME" => $arUser["LAST_NAME"], "SECOND_NAME" => $arUser["SECOND_NAME"], "LOGIN" => $arUser["LOGIN"]);
                         $authorName = CUser::FormatName(CSite::GetNameFormat(), $arTmpUser, false, false);
                     }
                 } elseif (strlen($arComment["AUTHOR_NAME"]) > 0) {
                     $authorName = $arComment["AUTHOR_NAME"];
                 }
                 if (strlen($authorName) > 0) {
                     $searchContent .= "\r\n" . $authorName;
                 }
                 $arSearchIndex = array("SITE_ID" => $arPostSite, "LAST_MODIFIED" => $arComment["DATE_CREATE"], "PARAM1" => "COMMENT", "PARAM2" => $arComment["BLOG_ID"] . "|" . $arComment["POST_ID"], "PERMISSIONS" => array(2), "TITLE" => $arComment["TITLE"], "BODY" => $searchContent, "USER_ID" => IntVal($arComment["AUTHOR_ID"]) > 0 ? $arComment["AUTHOR_ID"] : false, "ENTITY_TYPE_ID" => "BLOG_COMMENT", "ENTITY_ID" => $arComment["ID"]);
                 if ($arBlog["USE_SOCNET"] == "Y") {
                     if (is_array($arFields["SC_PERM"])) {
                         $arSearchIndex["PERMISSIONS"] = $arFields["SC_PERM"];
                     }
                 }
                 if (strlen($arComment["TITLE"]) <= 0) {
                     //$arPost = CBlogPost::GetByID($arComment["POST_ID"]);
                     $arSearchIndex["TITLE"] = substr($arSearchIndex["BODY"], 0, 100);
                 }
                 CSearch::Index("blog", "C" . $ID, $arSearchIndex, True);
             }
         }
         return $ID;
     }
     return False;
//.........这里部分代码省略.........
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:101,代码来源:blog_comment.php

示例9: array

     }
     $arFieldsHave = array();
     if ($arPost["HAS_IMAGES"] == "") {
         $arFieldsHave["HAS_IMAGES"] = $bHasImg ? "Y" : "N";
     }
     if ($arPost["HAS_TAGS"] == "") {
         $arFieldsHave["HAS_TAGS"] = $bHasTag ? "Y" : "N";
     }
     if ($arPost["HAS_PROPS"] == "") {
         $arFieldsHave["HAS_PROPS"] = $bHasProps ? "Y" : "N";
     }
     if ($arPost["HAS_SOCNET_ALL"] == "") {
         $arFieldsHave["HAS_SOCNET_ALL"] = $bHasOnlyAll ? "Y" : "N";
     }
     if (!empty($arFieldsHave)) {
         CBlogPost::Update($arPost["ID"], $arFieldsHave);
     }
     if ($bAll || $arPost["HAS_SOCNET_ALL"] == "Y") {
         $arResult["Post"]["HAVE_ALL_IN_ADR"] = "Y";
     }
     if ($arParams["CACHE_TIME"] > 0) {
         $arCacheData = array("templateCachedData" => $this->GetTemplateCachedData(), "Post" => $arResult["Post"], "images" => $arResult["images"], "Category" => $arResult["Category"], "GRATITUDE" => $arResult["GRATITUDE"], "POST_PROPERTIES" => $arResult["POST_PROPERTIES"], "arUser" => $arResult["arUser"]);
         if (defined("BX_COMP_MANAGED_CACHE")) {
             $GLOBALS["CACHE_MANAGER"]->EndTagCache();
         }
         $cache->EndDataCache($arCacheData);
     }
 }
 $arResult["arUser"]["urlToPostImportant"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_POST_IMPORTANT"], array("user_id" => $arPost["AUTHOR_ID"]));
 $arResult["CanComment"] = $GLOBALS["USER"]->IsAuthorized();
 $arResult["dest_users"] = array();
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php

示例10: 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);
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:52,代码来源:blog_comment.php

示例11: SetStatus

 public function SetStatus($StatusId)
 {
     if (!$this->IsAvailable()) {
         return false;
     }
     $arStatusList = $this->GetStatusList();
     $arStatusListXML = $this->GetStatusList(true);
     $arPost = CBlogPost::GetList(array(), array("ID" => $this->IdeaId), false, false, array("ID", CIdeaManagment::UFStatusField))->Fetch();
     $bUpdate = false;
     //Get Status ID from XML List
     if (array_key_exists($StatusId, $arStatusListXML)) {
         $StatusId = $arStatusListXML[$StatusId]["ID"];
     }
     //Status Exists and not current
     if (array_key_exists($StatusId, $arStatusList)) {
         $bUpdate = $arPost[CIdeaManagment::UFStatusField] != $StatusId;
     }
     if ($arPost && $bUpdate) {
         return CBlogPost::Update($this->IdeaId, array(CIdeaManagment::UFStatusField => $StatusId));
     }
     return false;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:22,代码来源:idea_idea.php

示例12: GetMessage

             } else {
                 $arResult["ERROR_MESSAGE"][] = GetMessage("BLOG_BLOG_BLOG_MES_DEL_NO_RIGHTS");
             }
         } else {
             $arResult["ERROR_MESSAGE"][] = GetMessage("BLOG_BLOG_SESSID_WRONG");
         }
     }
 } elseif (IntVal($_GET["pub_id"]) > 0) {
     if ($_GET["success"] == "Y") {
         $arResult["OK_MESSAGE"][] = GetMessage("BLOG_BLOG_BLOG_MES_PUB");
     } else {
         if (check_bitrix_sessid()) {
             $pub_id = IntVal($_GET["pub_id"]);
             if ($arPost = CBlogPost::GetByID($pub_id)) {
                 if ($arPost["AUTHOR_ID"] == $user_id && $arPost["PUBLISH_STATUS"] != BLOG_PUBLISH_STATUS_PUBLISH) {
                     if (CBlogPost::Update($pub_id, array("PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH, "=DATE_PUBLISH" => $DB->GetNowFunction()))) {
                         $arParamsNotify = array("bSoNet" => true, "allowVideo" => $arResult["allowVideo"], "PATH_TO_SMILE" => $arParams["PATH_TO_SMILE"], "PATH_TO_POST" => $arParams["PATH_TO_POST"], "SOCNET_GROUP_ID" => $arParams["SOCNET_GROUP_ID"], "user_id" => $arParams["USER_ID"], "NAME_TEMPLATE" => $arParams["NAME_TEMPLATE"], "SHOW_LOGIN" => $arParams["SHOW_LOGIN"]);
                         CBlogPost::Notify($arPost, false, $arParamsNotify);
                         $socnetRights = CBlogPost::GetSocNetPermsCode($arPost["ID"]);
                         $arFieldsIM = array("TYPE" => "POST", "TITLE" => $arPost["TITLE"], "URL" => CComponentEngine::MakePathFromTemplate(htmlspecialcharsBack($arParams["PATH_TO_POST"]), array("post_id" => $arPost["ID"], "user_id" => $arParams["USER_ID"])), "ID" => $arPost["ID"], "FROM_USER_ID" => $arParams["USER_ID"], "TO_USER_ID" => array(), "TO_SOCNET_RIGHTS" => $socnetRights, "TO_SOCNET_RIGHTS_OLD" => array());
                         CBlogPost::NotifyIm($arFieldsIM);
                         LocalRedirect($APPLICATION->GetCurPageParam("pub_id=" . $pub_id . "&success=Y", array("del_id", "pub_id", "sessid", "success")));
                     } else {
                         $arResult["ERROR_MESSAGE"][] = GetMessage("BLOG_BLOG_BLOG_MES_PUB_ERROR");
                     }
                 }
             } else {
                 $arResult["ERROR_MESSAGE"][] = GetMessage("BLOG_BLOG_BLOG_MES_PUB_NO_RIGHTS");
             }
         } else {
             $arResult["ERROR_MESSAGE"][] = GetMessage("BLOG_BLOG_SESSID_WRONG");
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:component.php

示例13: implode

     if (empty($arCatBlogCopy[ToLower($arCat["NAME"])])) {
         $v = CBlogCategory::Add(array("BLOG_ID" => $arCopyBlog["ID"], "NAME" => $arCat["NAME"]));
     } else {
         $v = $arCatBlogCopy[ToLower($arCat["NAME"])];
     }
     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);
         }
开发者ID:rasuldev,项目名称:torino,代码行数:31,代码来源:component.php

示例14: array

     $dbImg = CBlogImage::GetList(array(), array("BLOG_ID" => $arBlog["ID"], "POST_ID" => $newID, "IS_COMMENT" => "N"), false, false, array("ID"));
     if ($dbImg->Fetch()) {
         $bHasImg = true;
     }
     $arPostFields = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("BLOG_POST", $newID, LANGUAGE_ID);
     foreach ($arPostFields as $FIELD_NAME => $arPostField) {
         if (!empty($arPostField["VALUE"]) > 0) {
             $bHasProps = true;
             break;
         }
     }
     if (!empty($arFields["SOCNET_RIGHTS"]) && count($arFields["SOCNET_RIGHTS"]) == 1 && in_array("UA", $arFields["SOCNET_RIGHTS"])) {
         $bHasOnlyAll = true;
     }
     $arFieldsHave = array("HAS_IMAGES" => $bHasImg ? "Y" : "N", "HAS_TAGS" => $bHasTag ? "Y" : "N", "HAS_PROPS" => $bHasProps ? "Y" : "N", "HAS_SOCNET_ALL" => $bHasOnlyAll ? "Y" : "N");
     CBlogPost::Update($newID, $arFieldsHave);
 }
 if ($bAdd && $newID && $arFields["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH || $arOldPost["PUBLISH_STATUS"] != BLOG_PUBLISH_STATUS_PUBLISH && $arFields["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH) {
     $arFields["ID"] = $newID;
     $arParamsNotify = array("bSoNet" => true, "UserID" => $arResult["UserID"], "allowVideo" => $arResult["allowVideo"], "PATH_TO_SMILE" => $arParams["PATH_TO_SMILE"], "PATH_TO_POST" => $arParams["PATH_TO_POST"], "SOCNET_GROUP_ID" => $arParams["SOCNET_GROUP_ID"], "user_id" => $arParams["USER_ID"], "NAME_TEMPLATE" => $arParams["NAME_TEMPLATE"], "SHOW_LOGIN" => $arParams["SHOW_LOGIN"]);
     CBlogPost::Notify($arFields, $arBlog, $arParamsNotify);
     if (COption::GetOptionString("blog", "send_blog_ping", "N") == "Y") {
         if (strlen($serverName) <= 0) {
             $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", "");
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:component.php

示例15: Update

	public static function Update($ID, $arFields, $bSearchIndex = true)
	{
		global $DB;

		$ID = IntVal($ID);
		
		if(strlen($arFields["PATH"]) > 0)
			$arFields["PATH"] = str_replace("#comment_id#", $ID, $arFields["PATH"]);

		$arFields1 = array();
		foreach ($arFields as $key => $value)
		{
			if (substr($key, 0, 1) == "=")
			{
				$arFields1[substr($key, 1)] = $value;
				unset($arFields[$key]);
			}
		}

		if (!CBlogComment::CheckFields("UPDATE", $arFields, $ID))
			return false;
		elseif(!$GLOBALS["USER_FIELD_MANAGER"]->CheckFields("BLOG_COMMENT", $ID, $arFields))
			return false;

		foreach(GetModuleEvents("blog", "OnBeforeCommentUpdate", true) as $arEvent)
		{
			if (ExecuteModuleEventEx($arEvent, Array($ID, &$arFields))===false)
				return false;
		}

		$strUpdate = $DB->PrepareUpdate("b_blog_comment", $arFields);

		foreach ($arFields1 as $key => $value)
		{
			if (strlen($strUpdate) > 0)
				$strUpdate .= ", ";
			$strUpdate .= $key."=".$value." ";
		}

		if (strlen($strUpdate) > 0)
		{
			if(is_set($arFields["PUBLISH_STATUS"]) && strlen($arFields["PUBLISH_STATUS"]) > 0)
			{
				$arComment = CBlogComment::GetByID($ID);
				if($arComment["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH && $arFields["PUBLISH_STATUS"] != BLOG_PUBLISH_STATUS_PUBLISH)
					CBlogPost::Update($arComment["POST_ID"], array("=NUM_COMMENTS" => "NUM_COMMENTS - 1"));
				elseif($arComment["PUBLISH_STATUS"] != BLOG_PUBLISH_STATUS_PUBLISH && $arFields["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH)
					CBlogPost::Update($arComment["POST_ID"], array("=NUM_COMMENTS" => "NUM_COMMENTS + 1"));
			}
			
			$strSql =
				"UPDATE b_blog_comment SET ".
				"	".$strUpdate." ".
				"WHERE ID = ".$ID." ";
			$DB->Query($strSql, False, "File: ".__FILE__."<br>Line: ".__LINE__);
			unset($GLOBALS["BLOG_COMMENT"]["BLOG_COMMENT_CACHE_".$ID]);
			
			$GLOBALS["USER_FIELD_MANAGER"]->Update("BLOG_COMMENT", $ID, $arFields);

			$arComment = CBlogComment::GetByID($ID);			
			$arBlog = CBlog::GetByID($arComment["BLOG_ID"]);
			if($arBlog["USE_SOCNET"] == "Y")
				$arFields["SC_PERM"] = CBlogComment::GetSocNetCommentPerms($arComment["POST_ID"]);

			foreach(GetModuleEvents("blog", "OnCommentUpdate", true) as $arEvent)
				ExecuteModuleEventEx($arEvent, Array($ID, &$arFields));
			
			if ($bSearchIndex && CModule::IncludeModule("search"))
			{
				$newPostPerms = CBlogUserGroup::GetGroupPerms(1, $arComment["BLOG_ID"], $arComment["POST_ID"], BLOG_PERMS_POST);
				
				if ($arBlog["SEARCH_INDEX"] != "Y" || $arComment["PUBLISH_STATUS"] != BLOG_PUBLISH_STATUS_PUBLISH)
				{
					CSearch::Index("blog", "C".$ID,
						array(
							"TITLE" => "",
							"BODY" => ""
						)
					);
				}
				else
				{
					$arGroup = CBlogGroup::GetByID($arBlog["GROUP_ID"]);

					if(strlen($arFields["PATH"]) > 0)
					{
						$arFields["PATH"] = str_replace("#comment_id#", $ID, $arFields["PATH"]);
						$arPostSite = array($arGroup["SITE_ID"] => $arFields["PATH"]);
					}
					elseif(strlen($arComment["PATH"]) > 0)
					{
						$arComment["PATH"] = str_replace("#comment_id#", $ID, $arComment["PATH"]);
						$arPostSite = array($arGroup["SITE_ID"] => $arComment["PATH"]);
					}
					else
					{
						$arPostSite = array(
							$arGroup["SITE_ID"] => CBlogPost::PreparePath(
									$arBlog["URL"],
									$arComment["POST_ID"],
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:101,代码来源:blog_comment.php


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