本文整理汇总了PHP中CBlogGroup::GetByID方法的典型用法代码示例。如果您正苦于以下问题:PHP CBlogGroup::GetByID方法的具体用法?PHP CBlogGroup::GetByID怎么用?PHP CBlogGroup::GetByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBlogGroup
的用法示例。
在下文中一共展示了CBlogGroup::GetByID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$arResult["urlToFriends"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER_FRIENDS"], array("user_id" => $user_id));
$arResult["urlToOwnNewPost"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_POST_EDIT"], array("blog" => $arOwnBlog["URL"], "post_id" => "new"));
$arResult["urlToOwnBlogEdit"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BLOG_EDIT"], array("blog" => $arOwnBlog["URL"]));
}
} else {
unset($arOwnBlog);
}
} else {
unset($arOwnBlog);
}
}
if (strlen($arParams["BLOG_URL"]) > 0) {
if ($arOwnBlog["URL"] != $arParams["BLOG_URL"]) {
$arBlog = CBlog::GetByUrl($arParams["BLOG_URL"], $arParams["GROUP_ID"]);
if ($arBlog["ACTIVE"] == "Y") {
$arGroup = CBlogGroup::GetByID($arBlog["GROUP_ID"]);
if ($arGroup["SITE_ID"] == SITE_ID) {
$arResult["Blog"] = $arBlog;
$arResult["urlToCurrentBlog"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BLOG"], array("blog" => $arParams["BLOG_URL"]));
} else {
unset($arBlog);
}
} else {
unset($arBlog);
}
} elseif (!empty($arOwnBlog)) {
$arBlog = $arOwnBlog;
}
if (!empty($arBlog)) {
if (IntVal($user_id) > 0) {
$perm = CBlog::GetBlogUserPostPerms($arBlog["ID"], $user_id);
示例2: Update
function Update($ID, $arFields, $bSearchIndex = true)
{
global $DB;
$ID = IntVal($ID);
if(strlen($arFields["PATH"]) > 0)
$arFields["PATH"] = str_replace("#post_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 (!CBlogPost::CheckFields("UPDATE", $arFields, $ID))
return false;
elseif(!$GLOBALS["USER_FIELD_MANAGER"]->CheckFields("BLOG_POST", $ID, $arFields))
return false;
foreach(GetModuleEvents("blog", "OnBeforePostUpdate", true) as $arEvent)
{
if (ExecuteModuleEventEx($arEvent, Array($ID, &$arFields))===false)
return false;
}
$arOldPost = CBlogPost::GetByID($ID);
if(is_array($arFields["ATTACH_IMG"]))
{
if (
!array_key_exists("MODULE_ID", $arFields["ATTACH_IMG"])
|| strlen($arFields["ATTACH_IMG"]["MODULE_ID"]) <= 0
)
$arFields["ATTACH_IMG"]["MODULE_ID"] = "blog";
$prefix = "blog";
if(strlen($arFields["URL"]) > 0)
$prefix .= "/".$arFields["URL"];
CFile::SaveForDB($arFields, "ATTACH_IMG", $prefix);
}
$strUpdate = $DB->PrepareUpdate("b_blog_post", $arFields);
foreach ($arFields1 as $key => $value)
{
if (strlen($strUpdate) > 0)
$strUpdate .= ", ";
$strUpdate .= $key."=".$value." ";
}
if (strlen($strUpdate) > 0)
{
$oldPostPerms = CBlogUserGroup::GetGroupPerms(1, $arOldPost["BLOG_ID"], $ID, BLOG_PERMS_POST);
$strSql =
"UPDATE b_blog_post SET ".
" ".$strUpdate." ".
"WHERE ID = ".$ID." ";
$DB->Query($strSql, False, "File: ".__FILE__."<br>Line: ".__LINE__);
unset($GLOBALS["BLOG_POST"]["BLOG_POST_CACHE_".$ID]);
foreach(GetModuleEvents("blog", "OnBeforePostUserFieldUpdate", true) as $arEvent)
ExecuteModuleEventEx($arEvent, Array("BLOG_POST", $ID, $arFields));
$GLOBALS["USER_FIELD_MANAGER"]->Update("BLOG_POST", $ID, $arFields);
}
else
{
$ID = False;
}
if ($ID)
{
$arNewPost = CBlogPost::GetByID($ID);
if($arNewPost["PUBLISH_STATUS"] != $arOldPost["PUBLISH_STATUS"] || $arNewPost["BLOG_ID"] != $arOldPost["BLOG_ID"])
CBlog::SetStat($arNewPost["BLOG_ID"]);
if ($arNewPost["BLOG_ID"] != $arOldPost["BLOG_ID"])
CBlog::SetStat($arOldPost["BLOG_ID"]);
if (is_set($arFields, "PERMS_POST"))
CBlogPost::SetPostPerms($ID, $arFields["PERMS_POST"], BLOG_PERMS_POST);
if (is_set($arFields, "PERMS_COMMENT"))
CBlogPost::SetPostPerms($ID, $arFields["PERMS_COMMENT"], BLOG_PERMS_COMMENT);
if(array_key_exists("SOCNET_RIGHTS", $arFields))
{
$arFields["SC_PERM_OLD"] = CBlogPost::GetSocNetPermsCode($ID);
$arFields["SC_PERM"] = CBlogPost::UpdateSocNetPerms($ID, $arFields["SOCNET_RIGHTS"], $arNewPost);
}
foreach(GetModuleEvents("blog", "OnPostUpdate", true) as $arEvent)
ExecuteModuleEventEx($arEvent, Array($ID, &$arFields));
if ($bSearchIndex && CModule::IncludeModule("search"))
//.........这里部分代码省略.........
示例3: trim
}
$arParams["PATH_TO_BLOG"] = trim($arParams["PATH_TO_BLOG"]);
if (strlen($arParams["PATH_TO_BLOG"]) <= 0) {
$arParams["PATH_TO_BLOG"] = htmlspecialcharsbx($APPLICATION->GetCurPage() . "?" . $arParams["PAGE_VAR"] . "=blog&" . $arParams["BLOG_VAR"] . "=#blog#");
}
$arParams["PATH_TO_POST"] = trim($arParams["PATH_TO_POST"]);
if (strlen($arParams["PATH_TO_POST"]) <= 0) {
$arParams["PATH_TO_POST"] = htmlspecialcharsbx($APPLICATION->GetCurPage() . "?" . $arParams["PAGE_VAR"] . "=post&" . $arParams["BLOG_VAR"] . "=#blog#&" . $arParams["POST_VAR"] . "=#post_id#");
}
$arParams["PATH_TO_USER"] = trim($arParams["PATH_TO_USER"]);
if (strlen($arParams["PATH_TO_USER"]) <= 0) {
$arParams["PATH_TO_USER"] = htmlspecialcharsbx($APPLICATION->GetCurPage() . "?" . $arParams["PAGE_VAR"] . "=user&" . $arParams["USER_VAR"] . "=#user_id#");
}
$arParams["DATE_TIME_FORMAT"] = trim(empty($arParams["DATE_TIME_FORMAT"]) ? $DB->DateFormatToPHP(CSite::GetDateFormat("FULL")) : $arParams["DATE_TIME_FORMAT"]);
if (empty($arParams["GROUP_ID"]) || !empty($arParams["GROUP_ID"]) && in_array($arParams["ID"], $arParams["GROUP_ID"]) || $bShowAll) {
$arGroup = CBlogGroup::GetByID($arParams["ID"]);
if (!empty($arGroup) || $bShowAll) {
$arGroup = CBlogTools::htmlspecialcharsExArray($arGroup);
$arResult["GROUP"] = $arGroup;
if ($arParams["SET_TITLE"] == "Y") {
if ($bShowAll) {
$APPLICATION->SetTitle(GetMessage("B_B_GR_TITLE"));
} else {
$APPLICATION->SetTitle(GetMessage("B_B_GR_TITLE_NAME", array("#group#" => $arGroup["NAME"])));
}
}
$cache = new CPHPCache();
$cache_id = "blog_groups_" . serialize($arParams) . "_" . CDBResult::NavStringForCache($arParams["BLOG_COUNT"]);
if (($tzOffset = CTimeZone::GetOffset()) != 0) {
$cache_id .= "_" . $tzOffset;
}
示例4: 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"],
//.........这里部分代码省略.........
示例5: BuildRSS
public static function BuildRSS($postID, $blogID, $type = "RSS2.0", $numPosts = 10, $arPathTemplate = Array())
{
$blogID = IntVal($blogID);
$postID = IntVal($postID);
if($blogID <= 0)
return false;
if($postID <= 0)
return false;
$numPosts = IntVal($numPosts);
$type = strtolower(preg_replace("/[^a-zA-Z0-9.]/is", "", $type));
if ($type != "rss.92" && $type != "atom.03")
$type = "rss2.0";
$rssText = False;
$arBlog = CBlog::GetByID($blogID);
if ($arBlog && $arBlog["ACTIVE"] == "Y" && $arBlog["ENABLE_RSS"] == "Y")
{
$arGroup = CBlogGroup::GetByID($arBlog["GROUP_ID"]);
if($arGroup["SITE_ID"] == SITE_ID)
{
$arPost = CBlogPost::GetByID($postID);
if(!empty($arPost) && $arPost["BLOG_ID"] == $arBlog["ID"] && $arPost["ENABLE_COMMENTS"] == "Y")
{
$now = date("r");
$nowISO = date("Y-m-d\TH:i:s").substr(date("O"), 0, 3).":".substr(date("O"), -2, 2);
$serverName = "";
$charset = "";
$language = "";
$dbSite = CSite::GetList(($b = "sort"), ($o = "asc"), array("LID" => SITE_ID));
if ($arSite = $dbSite->Fetch())
{
$serverName = $arSite["SERVER_NAME"];
$charset = $arSite["CHARSET"];
$language = $arSite["LANGUAGE_ID"];
}
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", "");
}
if (strlen($charset) <= 0)
{
if (defined("SITE_CHARSET") && strlen(SITE_CHARSET) > 0)
$charset = SITE_CHARSET;
else
$charset = "windows-1251";
}
if(strlen($arPathTemplate["PATH_TO_BLOG"])>0)
$blogURL = htmlspecialcharsbx("http://".$serverName.CComponentEngine::MakePathFromTemplate($arPathTemplate["PATH_TO_BLOG"], array("blog" => $arBlog["URL"], "user_id" => $arBlog["OWNER_ID"], "group_id" => $arBlog["SOCNET_GROUP_ID"])));
else
$blogURL = htmlspecialcharsbx("http://".$serverName.CBlog::PreparePath($arBlog["URL"], $arGroup["SITE_ID"]));
if(strlen($arPathTemplate["PATH_TO_POST"])>0)
$url = htmlspecialcharsbx("http://".$serverName.CComponentEngine::MakePathFromTemplate($arPathTemplate["PATH_TO_POST"], array("blog" => $arBlog["URL"], "post_id" => CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arPathTemplate["ALLOW_POST_CODE"]), "user_id" => $arBlog["OWNER_ID"], "group_id" => $arBlog["SOCNET_GROUP_ID"])));
else
$url = htmlspecialcharsbx("http://".$serverName.CBlogPost::PreparePath($arBlog["URL"], $arPost["ID"], $arGroup["SITE_ID"]));
$dbUser = CUser::GetByID($arPost["AUTHOR_ID"]);
$arUser = $dbUser->Fetch();
if($arPathTemplate["USE_SOCNET"] == "Y")
{
$blogName = GetMessage("BLG_GCM_RSS_TITLE_SOCNET", Array("#AUTHOR_NAME#" => htmlspecialcharsEx($arUser["NAME"]." ".$arUser["LAST_NAME"]), "#POST_TITLE#" => htmlspecialcharsEx($arPost["TITLE"])));
}
else
{
$blogName = GetMessage("BLG_GCM_RSS_TITLE", Array("#BLOG_NAME#" => htmlspecialcharsEx($arBlog["NAME"]), "#POST_TITLE#" => htmlspecialcharsEx($arPost["TITLE"])));
}
$rssText = "";
if ($type == "rss.92")
{
$rssText .= "<"."?xml version=\"1.0\" encoding=\"".$charset."\"?".">\n\n";
$rssText .= "<rss version=\".92\">\n";
$rssText .= " <channel>\n";
$rssText .= " <title>".$blogName."</title>\n";
$rssText .= " <description>".$blogName."</description>\n";
$rssText .= " <link>".$url."</link>\n";
$rssText .= " <language>".$language."</language>\n";
$rssText .= " <docs>http://backend.userland.com/rss092</docs>\n";
$rssText .= "\n";
}
elseif ($type == "rss2.0")
{
$rssText .= "<"."?xml version=\"1.0\" encoding=\"".$charset."\"?".">\n\n";
$rssText .= "<rss version=\"2.0\">\n";
$rssText .= " <channel>\n";
$rssText .= " <title>".$blogName."</title>\n";
$rssText .= " <description>".$blogName."</description>\n";
//$rssText .= " <guid>".$url."</guid>\n";
$rssText .= " <link>".$url."</link>\n";
$rssText .= " <language>".$language."</language>\n";
$rssText .= " <docs>http://backend.userland.com/rss2</docs>\n";
//.........这里部分代码省略.........
示例6: IntVal
);
*/
if (CModule::IncludeModule("blog")) {
$ID = IntVal($ID);
$BLOGS_COUNT = intval($BLOGS_COUNT) > 0 ? IntVal($BLOGS_COUNT) : 20;
$COUNT = array("nPageSize" => intval($BLOGS_COUNT), "bShowAll" => false);
$SORT_BY1 = isset($SORT_BY1) ? $SORT_BY1 : "LAST_POST_DATE";
$SORT_ORDER1 = isset($SORT_ORDER1) ? $SORT_ORDER1 : "DESC";
$SORT_BY2 = isset($SORT_BY2) ? $SORT_BY2 : "NAME";
$SORT_ORDER2 = isset($SORT_ORDER2) ? $SORT_ORDER2 : "ASC";
$SORT = array($SORT_BY1 => $SORT_ORDER1, $SORT_BY2 => $SORT_ORDER2);
$CACHE_TIME = intval($CACHE_TIME);
$is404 = $is404 == 'N' ? false : true;
$arFilter = array("SITE_ID" => SITE_ID, "GROUP_ID" => $ID, "ACTIVE" => "Y");
$arSelectFields = array("ID", "NAME", "DESCRIPTION", "URL", "SITE_ID", "DATE_CREATE", "DATE_UPDATE", "ACTIVE", "OWNER_ID", "OWNER_LOGIN", "OWNER_NAME", "OWNER_LAST_NAME", "LAST_POST_DATE", "LAST_POST_ID", "BLOG_USER_AVATAR", "BLOG_USER_ALIAS");
if ($arGroup = CBlogGroup::GetByID($ID)) {
$APPLICATION->SetTitle($arGroup["NAME"]);
//формируем кэш
$cache = new CPHPCache();
$cache_id = "blog_groups_" . serialize($arParams) . "_" . CDBResult::NavStringForCache($BLOGS_COUNT);
$cache_path = "/" . SITE_ID . "/blog/groups/" . $ID . "/";
if ($CACHE_TIME > 0 && $cache->InitCache($CACHE_TIME, $cache_id, $cache_path)) {
$cache->Output();
} else {
if ($CACHE_TIME > 0) {
$cache->StartDataCache($CACHE_TIME, $cache_id, $cache_path);
}
$dbBlogs = CBlog::GetList($SORT, $arFilter, false, $COUNT, $arSelectFields);
if ($arBlogs = $dbBlogs->NavNext(false)) {
//$dbBlogs->NavPrint(GetMessage("B_B_GR_TITLE"));
do {
示例7: ShowError
ShowError(GetMessage("BLOG_MODULE_NOT_INSTALL"));
return;
}
$arParams["BLOG_URL"] = preg_replace("/[^a-zA-Z0-9_-]/is", "", Trim($arParams["BLOG_URL"]));
if (!array_key_exists("PATH_TO_BLOG_CATEGORY", $arParams) || !is_string($arParams["PATH_TO_BLOG_CATEGORY"])) {
$arParams["PATH_TO_BLOG_CATEGORY"] = "";
}
//0 no limit
$arParams["TAGS_COUNT"] = intval($arParams["TAGS_COUNT"]);
$obCache = new CPHPCache();
$cache_id = md5(serialize(array($arParams["BLOG_URL"], $arParams["TAGS_COUNT"], $arParams["PATH_TO_BLOG_CATEGORY"])));
$cache_path = '/' . SITE_ID . '/idea/tags/';
if (!$obCache->StartDataCache(60 * 60 * 24, $cache_id, $cache_path)) {
$arResult = $obCache->GetVars();
} else {
if (($arBlog = CBlog::GetByUrl($arParams["BLOG_URL"])) && $arBlog["ACTIVE"] == "Y" && ($arGroup = CBlogGroup::GetByID($arBlog["GROUP_ID"])) && $arGroup["SITE_ID"] == SITE_ID) {
$arResult = array("BLOG" => $arBlog, "CATEGORY" => array());
$toCnt = array();
$res = CBlogCategory::GetList(array("NAME" => "ASC"), array("BLOG_ID" => $arBlog["ID"]));
while ($arCategory = $res->GetNext()) {
$arSumCat["C" . $arCategory["ID"]] = array("ID" => $arCategory["ID"], "NAME" => $arCategory["NAME"]);
$toCnt[] = $arCategory['ID'];
}
$resCnt = CBlogPostCategory::GetList(array(), array("BLOG_ID" => $arBlog["ID"], "CATEGORY_ID" => $toCnt), array("CATEGORY_ID"), $arParams["TAGS_COUNT"] > 0 ? array("nTopCount" => $arParams["TAGS_COUNT"]) : false, array("ID", "BLOG_ID", "CATEGORY_ID", "NAME"));
if (($arCategoryCount = $resCnt->Fetch()) && $arCategoryCount) {
$cntMin = $cntMax = $arCategoryCount['CNT'];
$arRes = array();
do {
$arRes["C" . $arCategoryCount["CATEGORY_ID"]] = array("CNT" => $arCategoryCount['CNT'], "URL" => CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BLOG_CATEGORY"], array("category_id" => $arCategoryCount["CATEGORY_ID"])));
$cntMin = min($cntMin, $arCategoryCount['CNT']);
$cntMax = max($cntMax, $arCategoryCount['CNT']);
示例8: GetPing
public static function GetPing($blogUrl, $postID, $arParams = array())
{
global $DB;
$blogUrl = Trim($blogUrl);
$postID = IntVal($postID);
$bSuccess = True;
$arPost = CBlogPost::GetByID($postID);
if (!$arPost) {
CBlogTrackback::SendPingResponce(1, "Invalid target post");
$bSuccess = False;
}
if ($bSuccess) {
if ($arPost["ENABLE_TRACKBACK"] != "Y" || COption::GetOptionString("blog", "enable_trackback", "Y") != "Y") {
CBlogTrackback::SendPingResponce(1, "Trackbacks disabled");
$bSuccess = False;
}
}
if ($bSuccess) {
$arBlog = CBlog::GetByID($arPost["BLOG_ID"]);
if (!$arBlog || $arBlog["URL"] != $blogUrl) {
CBlogTrackback::SendPingResponce(1, "Invalid target blog");
$bSuccess = False;
}
}
if ($bSuccess) {
if (!isset($arParams["title"]) || strlen($arParams["title"]) <= 0 || !isset($arParams["url"]) || strlen($arParams["url"]) <= 0) {
CBlogTrackback::SendPingResponce(1, "Missing required fields");
$bSuccess = False;
}
}
if ($bSuccess) {
if (!isset($arParams["excerpt"])) {
$arParams["excerpt"] = $arParams["title"];
}
if (!isset($arParams["blog_name"])) {
$arParams["blog_name"] = "";
}
}
if ($bSuccess) {
$serverCharset = "";
$arGroup = CBlogGroup::GetByID($arBlog["GROUP_ID"]);
$dbSite = CSite::GetList($b = "sort", $o = "asc", array("LID" => $arGroup["SITE_ID"]));
if ($arSite = $dbSite->Fetch()) {
$serverCharset = $arSite["CHARSET"];
}
if (strlen($serverCharset) <= 0) {
if (defined("SITE_CHARSET") && strlen(SITE_CHARSET) > 0) {
$serverCharset = SITE_CHARSET;
} else {
$serverCharset = "windows-1251";
}
}
preg_match("/charset=(\")*(.*?)(\")*(;|\$)/", $_SERVER["CONTENT_TYPE"], $charset);
$charset = preg_replace("#[^[:space:]a-zA-Z0-9\\-]#is", "", $charset[2]);
if (strlen($charset) <= 0) {
$charset = "utf-8";
}
if ($charset != $serverCharset) {
$arParams["title"] = $GLOBALS["APPLICATION"]->ConvertCharset($arParams["title"], $charset, $serverCharset);
$arParams["url"] = $GLOBALS["APPLICATION"]->ConvertCharset($arParams["url"], $charset, $serverCharset);
$arParams["excerpt"] = $GLOBALS["APPLICATION"]->ConvertCharset($arParams["excerpt"], $charset, $serverCharset);
$arParams["blog_name"] = $GLOBALS["APPLICATION"]->ConvertCharset($arParams["blog_name"], $charset, $serverCharset);
}
$arFields = array("TITLE" => $arParams["title"], "URL" => $arParams["url"], "PREVIEW_TEXT" => $arParams["excerpt"], "BLOG_NAME" => $arParams["blog_name"], "=POST_DATE" => $DB->CurrentTimeFunction(), "BLOG_ID" => $arPost["BLOG_ID"], "POST_ID" => $arPost["ID"]);
$dbTrackback = CBlogTrackback::GetList(array(), array("BLOG_ID" => $arPost["BLOG_ID"], "POST_ID" => $arPost["ID"], "URL" => $arParams["url"]));
if ($arTrackback = $dbTrackback->Fetch()) {
if (!CBlogTrackback::Update($arTrackback["ID"], $arFields)) {
if ($ex = $GLOBALS["APPLICATION"]->GetException()) {
$errorMessage = $ex->GetString() . ".<br>";
} else {
$errorMessage = "Unknown error" . ".<br>";
}
CBlogTrackback::SendPingResponce(1, $errorMessage);
}
} else {
if (!CBlogTrackback::Add($arFields)) {
if ($ex = $GLOBALS["APPLICATION"]->GetException()) {
$errorMessage = $ex->GetString() . ".<br>";
} else {
$errorMessage = "Unknown error" . ".<br>";
}
CBlogTrackback::SendPingResponce(1, $errorMessage);
}
}
CBlogTrackback::SendPingResponce(0, "Ping accepted");
}
return $bSuccess;
}
示例9: Update
function Update($ID, $arFields)
{
global $DB;
$ID = IntVal($ID);
$arFields1 = array();
foreach ($arFields as $key => $value) {
if (substr($key, 0, 1) == "=") {
$arFields1[substr($key, 1)] = $value;
unset($arFields[$key]);
}
}
if (!CBlogUser::CheckFields("UPDATE", $arFields, $ID)) {
return false;
}
$strUpdate = $DB->PrepareUpdate("b_blog_user", $arFields, "blog/avatar");
foreach ($arFields1 as $key => $value) {
if (strlen($strUpdate) > 0) {
$strUpdate .= ", ";
}
$strUpdate .= $key . "=" . $value . " ";
}
if (strlen($strUpdate) > 0) {
$arUser = CBlogUser::GetByID($ID, BLOG_BY_BLOG_USER_ID);
$strSql = "UPDATE b_blog_user SET " . "\t" . $strUpdate . " " . "WHERE ID = " . $ID . " ";
$DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
unset($GLOBALS["BLOG_USER_CACHE_" . $ID]);
unset($GLOBALS["BLOG_USER1_CACHE_" . $arUser["USER_ID"]]);
} else {
$ID = false;
}
if ($ID && !(count($arFields1) == 1 && strlen($arFields1["LAST_VISIT"]) > 0)) {
if (CModule::IncludeModule("search")) {
$arBlogUser = CBlogUser::GetByID($ID);
$dbUser = CUser::GetByID($arBlogUser["USER_ID"]);
$arUser = $dbUser->Fetch();
$arBlog = CBlog::GetByOwnerID($arBlogUser["USER_ID"]);
if ($arBlog) {
$arGroup = CBlogGroup::GetByID($arBlog["GROUP_ID"]);
$arPostSite = array($arGroup["SITE_ID"] => CBlogUser::PreparePath($arBlogUser["USER_ID"], $arGroup["SITE_ID"]));
} else {
$arPostSite = array(SITE_ID => CBlogUser::PreparePath($arBlogUser["USER_ID"], SITE_ID));
}
if (strlen($arBlogUser["LAST_VISIT"]) <= 0) {
$arBlogUser["LAST_VISIT"] = ConvertTimeStamp(false, "FULL", false);
}
$arSearchIndex = array("SITE_ID" => $arPostSite, "LAST_MODIFIED" => $arBlogUser["LAST_VISIT"], "PARAM1" => "USER", "PARAM2" => $arBlogUser["USER_ID"], "PERMISSIONS" => array(2), "TITLE" => CBlogUser::GetUserName($arBlogUser["ALIAS"], $arUser["NAME"], $arUser["LAST_NAME"], $arUser["LOGIN"]), "BODY" => blogTextParser::killAllTags($arBlogUser["INTERESTS"] . " " . $arBlogUser["DESCRIPTION"]));
CSearch::Index("blog", "U" . $ID, $arSearchIndex);
}
}
return $ID;
}
示例10: GetMessage
CBlog::DeleteSocnetRead($ID);
}
}
}
if (!$result) {
$bVarsFromForm = true;
if ($ex = $APPLICATION->GetException()) {
$errorMessage .= $ex->GetString() . "<br />";
} else {
$errorMessage .= GetMessage("BLBE_SAVE_ERROR") . "<br />";
}
}
if (strlen($errorMessage) <= 0) {
if (!empty($arBlogOld)) {
if ($arBlogOld["GROUP_ID"] != $arFields["GROUP_ID"]) {
$arBlogGroupCur = CBlogGroup::GetByID($arFields["GROUP_ID"]);
if ($arBlogOld["GROUP_SITE_ID"] != $arBlogGroupCur["SITE_ID"]) {
BXClearCache(True, "/" . $arBlogGroupCur["SITE_ID"] . "/blog/");
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/popular_blogs/");
BXClearCache(True, "/" . SITE_ID . "/blog/new_blogs/");
}
}
BXClearCache(True, "/" . $arBlogOld["GROUP_SITE_ID"] . "/blog/");
}
if (strlen($apply) <= 0) {
LocalRedirect("/bitrix/admin/blog_blog.php?lang=" . LANG . GetFilterParams("filter_", false));
} else {
示例11: 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;
}
示例12: BXClearCache
}
$arSites[] = $ar_sites;
}
if (empty($arFields["SITE_ID"])) {
$arFields["SITE_ID"] = $arSites[0]["LID"];
}
$BLOG_GROUP_ID = CBlogGroup::Add($arFields);
if ($BLOG_GROUP_ID <= 0) {
$bVarsFromForm = true;
if ($ex = $APPLICATION->GetException()) {
$strWarning .= $ex->GetString() . ". <br />";
} else {
$strWarning .= "Error creating blog group. <br />";
}
} else {
$arBlogGroupTmp = CBlogGroup::GetByID($BLOG_GROUP_ID);
BXClearCache(True, "/" . $arBlogGroupTmp["SITE_ID"] . "/blog/blog_groups/");
$_REQUEST["create_blog_group"] = "N";
$_REQUEST["blog_group_id"] = $BLOG_GROUP_ID;
$_REQUEST["blog_group_name"] = "";
}
}
if (!$bVarsFromForm) {
$arFields = array("ACTIVE" => "N", "NAME" => $_REQUEST["blog_name"], "DESCRIPTION" => $_REQUEST["blog_description"], "=DATE_UPDATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "URL" => $_REQUEST["blog_url"], "OWNER_ID" => $GLOBALS["USER"]->GetId(), "GROUP_ID" => $_REQUEST["blog_group_id"], "ENABLE_COMMENTS" => "Y", "ENABLE_IMG_VERIF" => "Y", "EMAIL_NOTIFY" => "N", "ENABLE_RSS" => "N", "ALLOW_HTML" => "N", "PERMS_POST" => array("1" => "I", "2" => "I"), "PERMS_COMMENT" => array("1" => "P", "2" => "P"));
$ID = CBlog::Add($arFields);
if (intVal($ID) <= 0) {
$bVarsFromForm = true;
if ($ex = $APPLICATION->GetException()) {
$strWarning .= $ex->GetString() . "<br />";
} else {
$strWarning .= "Error creating blog. <br />";
示例13: BuildRSSAll
function BuildRSSAll($GroupId = 0, $type = "RSS .92", $numPosts = 10, $siteID = SITE_ID, $postTemplate = "", $userTemplate = "", $arAvBlog = array(), $arPathTemplates = array(), $arGroupID = array(), $bUserSocNet = "N")
{
$GroupId = IntVal($GroupId);
$numPosts = IntVal($numPosts);
$user_id = IntVal($GLOBALS["USER"]->GetID());
$type = strtolower(preg_replace("/[^a-zA-Z0-9.]/is", "", $type));
if ($type != "rss2.0" && $type != "atom.03") {
$type = "rss.92";
}
$rssText = False;
$groupIdArray = array();
$arGroup = array();
if ($GroupId > 0) {
if (!empty($arGroupID) && in_array($GroupId, $arGroupID) || empty($arGroupID)) {
$arGroup = CBlogGroup::GetByID($GroupId);
}
}
$now = date("r");
$nowISO = date("Y-m-d\\TH:i:s") . substr(date("O"), 0, 3) . ":" . substr(date("O"), -2, 2);
$serverName = "";
$charset = "";
$language = "";
$dbSite = CSite::GetList($b = "sort", $o = "asc", array("LID" => SITE_ID));
if ($arSite = $dbSite->Fetch()) {
$serverName = $arSite["SERVER_NAME"];
$charset = $arSite["CHARSET"];
$language = $arSite["LANGUAGE_ID"];
}
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", "");
}
}
if (strlen($charset) <= 0) {
if (defined("SITE_CHARSET") && strlen(SITE_CHARSET) > 0) {
$charset = SITE_CHARSET;
} else {
$charset = "windows-1251";
}
}
$blogURL = "http://" . $serverName;
if ($GroupId > 0) {
$blogName = GetMessage("BLG_RSS_ALL_GROUP_TITLE") . " \"" . htmlspecialcharsbx($arGroup["NAME"]) . "\" (" . $serverName . ")";
} else {
$blogName = GetMessage("BLG_RSS_ALL_TITLE") . " \"" . htmlspecialcharsbx($arSite["NAME"]) . "\" (" . $serverName . ")";
}
$rssText = "";
if ($type == "rss.92") {
$rssText .= "<" . "?xml version=\"1.0\" encoding=\"" . $charset . "\"?" . ">\n\n";
$rssText .= "<rss version=\".92\">\n";
$rssText .= " <channel>\n";
$rssText .= "\t<title>" . $blogName . "</title>\n";
$rssText .= "\t<link>" . $blogURL . "</link>\n";
$rssText .= "\t<guid>" . $blogURL . "</guid>\n";
$rssText .= "\t<language>" . $language . "</language>\n";
$rssText .= "\t<docs>http://backend.userland.com/rss092</docs>\n";
$rssText .= "\n";
} elseif ($type == "rss2.0") {
$rssText .= "<" . "?xml version=\"1.0\" encoding=\"" . $charset . "\"?" . ">\n\n";
$rssText .= "<rss version=\"2.0\">\n";
$rssText .= " <channel>\n";
$rssText .= "\t<title>" . $blogName . "</title>\n";
$rssText .= "\t<description>" . $blogName . "</description>\n";
$rssText .= "\t<link>" . $blogURL . "</link>\n";
$rssText .= "\t<language>" . $language . "</language>\n";
$rssText .= "\t<docs>http://backend.userland.com/rss2</docs>\n";
$rssText .= "\t<pubDate>" . $now . "</pubDate>\n";
$rssText .= "\n";
} elseif ($type == "atom.03") {
$atomID = "tag:" . htmlspecialcharsbx($serverName) . "," . date("Y-m-d");
$rssText .= "<" . "?xml version=\"1.0\" encoding=\"" . $charset . "\"?" . ">\n\n";
$rssText .= "<feed version=\"0.3\" xmlns=\"http://purl.org/atom/ns#\" xml:lang=\"" . $language . "\">\n";
$rssText .= " <title>" . $blogName . "</title>\n";
$rssText .= " <tagline>" . $blogURL . "</tagline>\n";
$rssText .= " <id>" . $atomID . "</id>\n";
$rssText .= " <link rel=\"alternate\" type=\"text/html\" href=\"" . $blogURL . "\" />\n";
$rssText .= " <copyright>Copyright (c) " . $blogURL . "</copyright>\n";
$rssText .= " <modified>" . $nowISO . "</modified>\n";
$rssText .= "\n";
}
$parser = new blogTextParser();
$arParserParams = array("imageWidth" => $arPathTemplates["IMAGE_MAX_WIDTH"], "imageHeight" => $arPathTemplates["IMAGE_MAX_HEIGHT"]);
$arFilter = array("<=DATE_PUBLISH" => ConvertTimeStamp(false, "FULL", false), "PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH, "BLOG_ENABLE_RSS" => "Y", "MICRO" => "N");
$arSelFields = array("ID", "TITLE", "DETAIL_TEXT", "DATE_PUBLISH", "AUTHOR_ID", "BLOG_USER_ALIAS", "BLOG_ID", "DETAIL_TEXT_TYPE", "BLOG_URL", "BLOG_OWNER_ID", "BLOG_SOCNET_GROUP_ID", "BLOG_GROUP_SITE_ID", "CODE", "PATH");
if (!empty($arGroup)) {
$arFilter["BLOG_GROUP_ID"] = $arGroup["ID"];
} elseif (count($arGroupID) > 0) {
$arFilter["BLOG_GROUP_ID"] = $arGroupID;
}
if (count($arAvBlog) > 0) {
$arFilter["BLOG_ID"] = $arAvBlog;
}
if ($siteID !== false) {
$arFilter["BLOG_GROUP_SITE_ID"] = $siteID;
}
if ($bUserSocNet == "Y") {
$arFilter["BLOG_USE_SOCNET"] = "Y";
$arFilter["FOR_USER"] = $user_id;
//.........这里部分代码省略.........
示例14: 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;
//.........这里部分代码省略.........
示例15: array
if ($_REQUEST['action_target'] == 'selected') {
$arID = array();
$dbResultList = CBlogGroup::GetList(array($by => $order), $arFilter, false, false, array("ID"));
while ($arResult = $dbResultList->Fetch()) {
$arID[] = $arResult['ID'];
}
}
foreach ($arID as $ID) {
if (strlen($ID) <= 0) {
continue;
}
switch ($_REQUEST['action']) {
case "delete":
@set_time_limit(0);
$DB->StartTransaction();
$arBlogGroupTmp = CBlogGroup::GetByID($ID);
if (!CBlogGroup::Delete($ID)) {
$DB->Rollback();
if ($ex = $APPLICATION->GetException()) {
$lAdmin->AddGroupError($ex->GetString(), $ID);
} else {
$lAdmin->AddGroupError(GetMessage("BLG_DELETE_ERROR"), $ID);
}
}
BXClearCache(True, "/" . $arBlogGroupTmp["SITE_ID"] . "/blog/");
$DB->Commit();
break;
}
}
}
$dbResultList = CBlogGroup::GetList(array($by => $order), $arFilter, false, false, array("ID", "SITE_ID", "NAME"));