本文整理汇总了PHP中CBlog::CheckFields方法的典型用法代码示例。如果您正苦于以下问题:PHP CBlog::CheckFields方法的具体用法?PHP CBlog::CheckFields怎么用?PHP CBlog::CheckFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBlog
的用法示例。
在下文中一共展示了CBlog::CheckFields方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Update
function Update($ID, $arFields)
{
global $DB;
$ID = IntVal($ID);
if ($ID <= 0) {
return false;
}
if (strlen($arFields["PATH"]) > 0) {
$path = $arFields["PATH"];
unset($arFields["PATH"]);
}
$arFields1 = array();
foreach ($arFields as $key => $value) {
if (substr($key, 0, 1) == "=") {
$arFields1[substr($key, 1)] = $value;
unset($arFields[$key]);
}
}
if (!CBlog::CheckFields("UPDATE", $arFields, $ID)) {
return false;
} elseif (!$GLOBALS["USER_FIELD_MANAGER"]->CheckFields("BLOG_BLOG", $ID, $arFields)) {
return false;
}
$db_events = GetModuleEvents("blog", "OnBeforeBlogUpdate");
while ($arEvent = $db_events->Fetch()) {
if (ExecuteModuleEventEx($arEvent, array($ID, &$arFields)) === false) {
return false;
}
}
$arBlogOld = CBlog::GetByID($ID);
$strUpdate = $DB->PrepareUpdate("b_blog", $arFields);
foreach ($arFields1 as $key => $value) {
if (strlen($strUpdate) > 0) {
$strUpdate .= ", ";
}
$strUpdate .= $key . "=" . $value . " ";
}
if (strlen($strUpdate) > 0) {
$strSql = "UPDATE b_blog SET " . "\t" . $strUpdate . " " . "WHERE ID = " . $ID . " ";
$DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
unset($GLOBALS["BLOG"]["BLOG_CACHE_" . $ID]);
unset($GLOBALS["BLOG"]["BLOG4OWNER_CACHE_" . $arBlogOld["OWNER_ID"]]);
unset($GLOBALS["BLOG"]["BLOG4OWNERGROUP_CACHE_" . $arBlogOld["SOCNET_GROUP_ID"]]);
$events = GetModuleEvents("blog", "OnBlogUpdate");
while ($arEvent = $events->Fetch()) {
ExecuteModuleEventEx($arEvent, array($ID, &$arFields));
}
if (is_set($arFields, "PERMS_POST")) {
CBlog::SetBlogPerms($ID, $arFields["PERMS_POST"], BLOG_PERMS_POST);
}
if (is_set($arFields, "PERMS_COMMENT")) {
CBlog::SetBlogPerms($ID, $arFields["PERMS_COMMENT"], BLOG_PERMS_COMMENT);
}
$GLOBALS["USER_FIELD_MANAGER"]->Update("BLOG_BLOG", $ID, $arFields);
} else {
$ID = False;
}
if ($ID && (is_set($arFields, "NAME") || is_set($arFields, "DESCRIPTION"))) {
if (CModule::IncludeModule("search")) {
$arBlog = CBlog::GetByID($ID);
if ($arBlogOld["ACTIVE"] == "Y" && $arBlog["ACTIVE"] != "Y" || $arBlogOld["SEARCH_INDEX"] == "Y" && $arBlog["SEARCH_INDEX"] != "Y") {
CSearch::DeleteIndex("blog", false, "COMMENT", $ID . "|%");
CSearch::DeleteIndex("blog", false, "POST", $ID);
CSearch::DeleteIndex("blog", "B" . $ID);
} elseif ($arBlog["ACTIVE"] == "Y" && $arBlog["SEARCH_INDEX"] == "Y") {
if ($arBlog["USE_SOCNET"] == "Y") {
CSearch::DeleteIndex("blog", "B" . $ID);
} else {
$arGroup = CBlogGroup::GetByID($arBlog["GROUP_ID"]);
if (strlen($path) > 0) {
$path = str_replace("#blog_url#", $arBlog["URL"], $path);
$arPostSite = array($arGroup["SITE_ID"] => $path);
} else {
$arPostSite = array($arGroup["SITE_ID"] => CBlog::PreparePath($arBlog["URL"], $arGroup["SITE_ID"], false, $arBlog["OWNER_ID"], $arBlog["SOCNET_GROUP_ID"]));
}
$arSearchIndex = array("SITE_ID" => $arPostSite, "LAST_MODIFIED" => $arBlog["DATE_UPDATE"], "PARAM1" => "BLOG", "PARAM2" => $arBlog["OWNER_ID"], "PERMISSIONS" => array(2), "TITLE" => $arBlog["NAME"], "BODY" => strlen($arBlog["DESCRIPTION"]) > 0 ? $arBlog["DESCRIPTION"] : $arBlog["NAME"]);
CSearch::Index("blog", "B" . $ID, $arSearchIndex);
}
}
}
}
return $ID;
}