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


PHP CBlog::GetByID方法代码示例

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


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

示例1: CheckFields

 function CheckFields($ACTION, &$arFields, $ID = 0)
 {
     if ((is_set($arFields, "POST_ID") || $ACTION == "ADD") && strlen($arFields["POST_ID"]) <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("BLG_GCT_EMPTY_POST_ID"), "EMPTY_POST_ID");
         return false;
     } elseif (is_set($arFields, "POST_ID")) {
         $arResult = CBlogPost::GetByID($arFields["POST_ID"]);
         if (!$arResult) {
             $GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["POST_ID"], GetMessage("BLG_GCT_ERROR_NO_POST")), "ERROR_NO_POST");
             return false;
         }
     }
     if ((is_set($arFields, "BLOG_ID") || $ACTION == "ADD") && IntVal($arFields["BLOG_ID"]) <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("BLG_GCT_EMPTY_BLOG_ID"), "EMPTY_BLOG_ID");
         return false;
     } elseif (is_set($arFields, "BLOG_ID")) {
         $arResult = CBlog::GetByID($arFields["BLOG_ID"]);
         if (!$arResult) {
             $GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["BLOG_ID"], GetMessage("BLG_GCT_ERROR_NO_BLOG")), "ERROR_NO_BLOG");
             return false;
         }
     }
     if ((is_set($arFields, "CATEGORY_ID") || $ACTION == "ADD") && IntVal($arFields["CATEGORY_ID"]) <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("BLG_GCT_EMPTY_CATEGORY_ID"), "EMPTY_CATEGORY_ID");
         return false;
     } elseif (is_set($arFields, "CATEGORY_ID")) {
         $arResult = CBlogCategory::GetByID($arFields["CATEGORY_ID"]);
         if (!$arResult) {
             $GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["CATEGORY_ID"], GetMessage("BLG_GCT_ERROR_NO_CATEGORY")), "ERROR_NO_CATEGORY");
             return false;
         }
     }
     return True;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:34,代码来源:blog_post_category.php

示例2: CanUserDeletePost

 public static function CanUserDeletePost($ID, $userID, $blogOwnerID, $groupOwnerID)
 {
     $ID = IntVal($ID);
     $userID = IntVal($userID);
     $blogOwnerID = IntVal($blogOwnerID);
     $groupOwnerID = IntVal($groupOwnerID);
     $blogModulePermissions = $GLOBALS["APPLICATION"]->GetGroupRight("blog");
     if ($blogModulePermissions >= "W") {
         return True;
     }
     $arPost = CBlogPost::GetByID($ID);
     if (empty($arPost)) {
         return False;
     }
     if ($groupOwnerID > 0) {
         $arBlogUser = CBlogUser::GetByID($userID, BLOG_BY_USER_ID);
         if ($arBlogUser && $arBlogUser["ALLOW_POST"] != "Y") {
             return False;
         }
         $perms = BLOG_PERMS_DENY;
         if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_GROUP, $groupOwnerID, "blog", "view_post")) {
             $perms = BLOG_PERMS_READ;
         }
         if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_GROUP, $groupOwnerID, "blog", "write_post")) {
             $perms = BLOG_PERMS_WRITE;
         }
         if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_GROUP, $groupOwnerID, "blog", "full_post")) {
             $perms = BLOG_PERMS_FULL;
         }
         if ($perms >= BLOG_PERMS_WRITE && $arPost["AUTHOR_ID"] == $userID) {
             return true;
         }
         if ($perms > BLOG_PERMS_WRITE) {
             return true;
         }
     } else {
         $arBlog = CBlog::GetByID($arPost["BLOG_ID"]);
         $arBlogUser = CBlogUser::GetByID($userID, BLOG_BY_USER_ID);
         if ($arBlogUser && $arBlogUser["ALLOW_POST"] != "Y") {
             return False;
         }
         $perms = BLOG_PERMS_DENY;
         if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_USER, $blogOwnerID, "blog", "view_post")) {
             $perms = BLOG_PERMS_READ;
         }
         if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_USER, $blogOwnerID, "blog", "write_post")) {
             $perms = BLOG_PERMS_WRITE;
         }
         if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_USER, $blogOwnerID, "blog", "full_post")) {
             $perms = BLOG_PERMS_FULL;
         }
         if ($perms >= BLOG_PERMS_WRITE && $arPost["AUTHOR_ID"] == $userID) {
             return true;
         }
         if ($perms > BLOG_PERMS_WRITE) {
             return true;
         }
     }
     return False;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:60,代码来源:sonet.php

示例3: Add

 public static 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 (!CBlogCandidate::CheckFields("ADD", $arFields)) {
         return false;
     }
     $arInsert = $DB->PrepareInsert("b_blog_user2blog", $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_user2blog(" . $arInsert[0] . ") " . "VALUES(" . $arInsert[1] . ")";
         $DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         $ID = IntVal($DB->LastID());
     }
     if ($ID) {
         $arCandidat = CBlogCandidate::GetByID($ID);
         if ($arCandidat) {
             $arBlog = CBlog::GetByID($arCandidat["BLOG_ID"]);
             if (strlen($arBlog["AUTO_GROUPS"]) > 0) {
                 $arAutoGroups = unserialize($arBlog["AUTO_GROUPS"]);
                 if (is_array($arAutoGroups) && count($arAutoGroups) > 0) {
                     $arBlogUser = CBlogUser::GetByID($arCandidat["USER_ID"], BLOG_BY_USER_ID);
                     if (!$arBlogUser) {
                         CBlogUser::Add(array("USER_ID" => $arCandidat["USER_ID"], "=LAST_VISIT" => $GLOBALS["DB"]->GetNowFunction(), "=DATE_REG" => $GLOBALS["DB"]->GetNowFunction(), "ALLOW_POST" => "Y"));
                     }
                     CBlogUser::AddToUserGroup($arCandidat["USER_ID"], $arCandidat["BLOG_ID"], $arAutoGroups, "", BLOG_BY_USER_ID, BLOG_CHANGE);
                     CBlogCandidate::Delete($ID);
                 }
             }
         }
     }
     return $ID;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:49,代码来源:blog_candid.php

示例4: CheckFields

 function CheckFields($ACTION, &$arFields, $ID = 0)
 {
     if ((is_set($arFields, "BLOG_ID") || $ACTION == "ADD") && IntVal($arFields["BLOG_ID"]) <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("BLG_GUGP_EMPTY_BLOG_ID"), "EMPTY_BLOG_ID");
         return false;
     } elseif (is_set($arFields, "BLOG_ID")) {
         $arResult = CBlog::GetByID($arFields["BLOG_ID"]);
         if (!$arResult) {
             $GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["BLOG_ID"], GetMessage("BLG_GUGP_ERROR_NO_BLOG")), "ERROR_NO_BLOG");
             return false;
         }
     }
     if ((is_set($arFields, "USER_GROUP_ID") || $ACTION == "ADD") && IntVal($arFields["USER_GROUP_ID"]) <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("BLG_GUGP_EMPTY_USER_GROUP_ID"), "EMPTY_USER_GROUP_ID");
         return false;
     } elseif (is_set($arFields, "USER_GROUP_ID")) {
         $arResult = CBlogUserGroup::GetByID($arFields["USER_GROUP_ID"]);
         if (!$arResult) {
             $GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["USER_GROUP_ID"], GetMessage("BLG_GUGP_ERROR_NO_USER_GROUP")), "ERROR_NO_USER_GROUP");
             return false;
         }
     }
     if ((is_set($arFields, "PERMS_TYPE") || $ACTION == "ADD") && $arFields["PERMS_TYPE"] != BLOG_PERMS_POST && $arFields["PERMS_TYPE"] != BLOG_PERMS_COMMENT) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("BLG_GUGP_EMPTY_PERMS_TYPE"), "EMPTY_PERMS_TYPE");
         return false;
     }
     if ((is_set($arFields, "PERMS") || $ACTION == "ADD") && strlen($arFields["PERMS"]) <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("BLG_GUGP_EMPTY_PERMS"), "EMPTY_PERMS");
         return false;
     } elseif (is_set($arFields, "PERMS")) {
         $arAvailPerms = array_keys($GLOBALS["AR_BLOG_PERMS"]);
         if (!in_array($arFields["PERMS"], $arAvailPerms)) {
             $GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["PERMS"], GetMessage("BLG_GUGP_ERROR_NO_PERMS")), "ERROR_NO_PERMS");
             return false;
         }
     }
     if ((is_set($arFields, "AUTOSET") || $ACTION == "ADD") && $arFields["AUTOSET"] != "Y" && $arFields["AUTOSET"] != "N") {
         $arFields["AUTOSET"] = "N";
     }
     return True;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:41,代码来源:blog_user_group_perms.php

示例5: CheckFields

 public static function CheckFields($ACTION, &$arFields, $ID = 0)
 {
     if ((is_set($arFields, "NAME") || $ACTION == "ADD") && strlen($arFields["NAME"]) <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("BLG_GCT_EMPTY_NAME"), "EMPTY_NAME");
         return false;
     }
     if ((is_set($arFields, "BLOG_ID") || $ACTION == "ADD") && IntVal($arFields["BLOG_ID"]) <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("BLG_GCT_EMPTY_BLOG_ID"), "EMPTY_BLOG_ID");
         return false;
     } elseif (is_set($arFields, "BLOG_ID")) {
         $arResult = CBlog::GetByID($arFields["BLOG_ID"]);
         if (!$arResult) {
             $GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["BLOG_ID"], GetMessage("BLG_GCT_ERROR_NO_BLOG")), "ERROR_NO_BLOG");
             return false;
         }
     }
     if (is_set($arFields, "NAME")) {
         if (intval($arFields["BLOG_ID"]) > 0) {
             $blogID = $arFields["BLOG_ID"];
         } elseif (IntVal($ID) > 0) {
             $arCat = CBlogCategory::GetByID($ID);
             $blogID = $arCat["BLOG_ID"];
         } else {
             $GLOBALS["APPLICATION"]->ThrowException(GetMessage("BLG_GCT_EMPTY_BLOG_ID"), "EMPTY_BLOG_ID");
             return false;
         }
         if (strlen($arFields["NAME"]) > 255) {
             $arFields["NAME"] = substr($arFields["NAME"], 0, 255);
         }
         $dbCategory = CBlogCategory::GetList(array(), array("BLOG_ID" => $blogID, "NAME" => $arFields["NAME"]));
         while ($arCategory = $dbCategory->Fetch()) {
             if ($ID != $arCategory["ID"]) {
                 $GLOBALS["APPLICATION"]->ThrowException(GetMessage("BLG_ALREADY_EXIST"), "ALREADY_EXIST");
                 return false;
             }
         }
     }
     return True;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:39,代码来源:blog_category.php

示例6: CheckFields

 public static function CheckFields($ACTION, &$arFields, $ID = 0)
 {
     if ((is_set($arFields, "BLOG_ID") || $ACTION == "ADD") && IntVal($arFields["BLOG_ID"]) <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("BLG_GC_EMPTY_BLOG_ID"), "EMPTY_BLOG_ID");
         return false;
     } elseif (is_set($arFields, "BLOG_ID")) {
         $arResult = CBlog::GetByID($arFields["BLOG_ID"]);
         if (!$arResult) {
             $GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["BLOG_ID"], GetMessage("BLG_GB_ERROR_NO_BLOG")), "ERROR_NO_BLOG");
             return false;
         }
     }
     if ((is_set($arFields, "USER_ID") || $ACTION == "ADD") && IntVal($arFields["USER_ID"]) <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("BLG_GB_EMPTY_USER_ID"), "EMPTY_USER_ID");
         return false;
     } elseif (is_set($arFields, "USER_ID")) {
         $dbResult = CUser::GetByID($arFields["USER_ID"]);
         if (!$dbResult->Fetch()) {
             $GLOBALS["APPLICATION"]->ThrowException(GetMessage("BLG_GB_ERROR_NO_USER_ID"), "ERROR_NO_USER_ID");
             return false;
         }
     }
     return True;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:24,代码来源:blog_candid.php

示例7: while

     $arSelectedFields[] = "SOCNET_BLOG_READ";
     $arFilter["BLOG_USE_SOCNET"] = "Y";
 }
 $dbItem = CBlogPost::GetList(array("VIEWS" => "DESC", "NUM_COMMENTS" => "DESC"), $arFilter, false, false, $arSelectedFields);
 while ($arItem = $dbItem->Fetch()) {
     $arBlogs[$arItem["BLOG_ID"]]["VIEWS"] += $arItem["VIEWS"];
     $arBlogs[$arItem["BLOG_ID"]]["NUM_COMMENTS"] += $arItem["NUM_COMMENTS"];
 }
 if (!empty($arBlogs)) {
     uasort($arBlogs, create_function('$a, $b', 'if($a["VIEWS"] == $b["VIEWS"]) { if($a["NUM_COMMENTS"] < $b["NUM_COMMENTS"]) return 1; elseif($a["NUM_COMMENTS"] > $b["NUM_COMMENTS"]) return -1; else return 0;} return ($a["VIEWS"] < $b["VIEWS"])? 1 : -1;'));
     $i = 0;
     foreach ($arBlogs as $blogID => $info) {
         if ($i >= $arParams["BLOG_COUNT"] && IntVal($arParams["BLOG_COUNT"]) > 0) {
             continue;
         }
         $arBlog = CBlog::GetByID($blogID);
         $arBlog = CBlogTools::htmlspecialcharsExArray($arBlog);
         $arBlog["BlogUser"] = CBlogUser::GetByID($arBlog["OWNER_ID"], BLOG_BY_USER_ID);
         $arBlog["BlogUser"] = CBlogTools::htmlspecialcharsExArray($arBlog["BlogUser"]);
         $dbUser = CUser::GetByID($arBlog["OWNER_ID"]);
         $arBlog["arUser"] = $dbUser->GetNext();
         $arBlog["AuthorName"] = CBlogUser::GetUserName($arBlog["BlogUser"]["ALIAS"], $arBlog["arUser"]["NAME"], $arBlog["arUser"]["LAST_NAME"], $arBlog["arUser"]["LOGIN"]);
         if (IntVal($arBlog["SOCNET_GROUP_ID"]) > 0) {
             $arBlog["urlToBlog"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP_BLOG"], array("blog" => $arBlog["URL"], "group_id" => $arBlog["SOCNET_GROUP_ID"]));
             $arBlog["urlToAuthor"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP"], array("group_id" => $arBlog["SOCNET_GROUP_ID"]));
         } else {
             $arBlog["urlToBlog"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BLOG"], array("blog" => $arBlog["URL"], "user_id" => $arBlog["OWNER_ID"]));
             $arBlog["urlToAuthor"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arBlog["OWNER_ID"]));
         }
         if ($i == 0) {
             $arBlog["FIRST_BLOG"] = "Y";
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php

示例8: PostIntoBuzzAsBlog

 public static function PostIntoBuzzAsBlog($userTwit, $arSiteId = array(), $userLogin = '')
 {
     global $DB;
     if (!CModule::IncludeModule("blog")) {
         return;
     }
     $arParams = array();
     if (IsModuleInstalled('bitrix24') && defined('BX24_HOST_NAME') && $userLogin != '') {
         if ($arUserTwit = unserialize(base64_decode($userTwit))) {
             $userTwit = $arUserTwit;
         }
         if ($arSiteIdCheck = unserialize(base64_decode($arSiteId))) {
             $arSiteId = $arSiteIdCheck;
         }
         $dbUser = CUser::GetByLogin($userLogin);
         if ($arUser = $dbUser->Fetch()) {
             $arParams["USER_ID"] = $arUser["ID"];
         }
     } else {
         $arParams["USER_ID"] = $userTwit['kp_user_id'];
     }
     if (isset($arSiteId[$userTwit['kp_user_id']])) {
         $siteId = $arSiteId[$userTwit['kp_user_id']];
     }
     if (strlen($siteId) <= 0) {
         $siteId = SITE_ID;
     }
     if (isset($userTwit['text'])) {
         $arParams["GROUP_ID"] = COption::GetOptionString("socialnetwork", "userbloggroup_id", false, $siteId);
         $arParams["PATH_TO_BLOG"] = COption::GetOptionString("socialnetwork", "userblogpost_page", false, $siteId);
         $arParams["PATH_TO_SMILE"] = COption::GetOptionString("socialnetwork", "smile_page", false, $siteId);
         $arParams["NAME_TEMPLATE"] = COption::GetOptionString("main", "TOOLTIP_NAME_TEMPLATE", false, $siteId);
         $arParams["SHOW_LOGIN"] = 'Y';
         $arParams["PATH_TO_POST"] = $arParams["PATH_TO_BLOG"];
         $arFilterblg = array("ACTIVE" => "Y", "USE_SOCNET" => "Y", "GROUP_ID" => $arParams["GROUP_ID"], "GROUP_SITE_ID" => $siteId, "OWNER_ID" => $arParams["USER_ID"]);
         $groupId = is_array($arParams["GROUP_ID"]) ? IntVal($arParams["GROUP_ID"][0]) : IntVal($arParams["GROUP_ID"]);
         if (isset($GLOBALS["BLOG_POST"]["BLOG_P_" . $groupId . "_" . $arParams["USER_ID"]]) && !empty($GLOBALS["BLOG_POST"]["BLOG_P_" . $groupId . "_" . $arParams["USER_ID"]])) {
             $arBlog = $GLOBALS["BLOG_POST"]["BLOG_P_" . $groupId . "_" . $arParams["USER_ID"]];
         } else {
             $dbBl = CBlog::GetList(array(), $arFilterblg);
             $arBlog = $dbBl->Fetch();
             if (!$arBlog && IsModuleInstalled("intranet")) {
                 $arBlog = CBlog::GetByOwnerID($arParams["USER_ID"]);
             }
             $GLOBALS["BLOG_POST"]["BLOG_P_" . $groupId . "_" . $arParams["USER_ID"]] = $arBlog;
         }
         $arResult["Blog"] = $arBlog;
         if (empty($arBlog)) {
             if (!empty($arParams["GROUP_ID"])) {
                 $arFields = array("=DATE_UPDATE" => $DB->CurrentTimeFunction(), "GROUP_ID" => is_array($arParams["GROUP_ID"]) ? IntVal($arParams["GROUP_ID"][0]) : IntVal($arParams["GROUP_ID"]), "ACTIVE" => "Y", "ENABLE_COMMENTS" => "Y", "ENABLE_IMG_VERIF" => "Y", "EMAIL_NOTIFY" => "Y", "ENABLE_RSS" => "Y", "ALLOW_HTML" => "N", "ENABLE_TRACKBACK" => "N", "SEARCH_INDEX" => "Y", "USE_SOCNET" => "Y", "=DATE_CREATE" => $DB->CurrentTimeFunction(), "PERMS_POST" => array(1 => "I", 2 => "I"), "PERMS_COMMENT" => array(1 => "P", 2 => "P"));
                 $bRights = false;
                 $rsUser = CUser::GetByID($arParams["USER_ID"]);
                 $arUser = $rsUser->Fetch();
                 if (strlen($arUser["NAME"] . "" . $arUser["LAST_NAME"]) <= 0) {
                     $arFields["NAME"] = GetMessage("BLG_NAME") . " " . $arUser["LOGIN"];
                 } else {
                     $arFields["NAME"] = GetMessage("BLG_NAME") . " " . $arUser["NAME"] . " " . $arUser["LAST_NAME"];
                 }
                 $arFields["URL"] = str_replace(" ", "_", $arUser["LOGIN"]) . "-blog-" . SITE_ID;
                 $arFields["OWNER_ID"] = $arParams["USER_ID"];
                 $urlCheck = preg_replace("/[^a-zA-Z0-9_-]/is", "", $arFields["URL"]);
                 if ($urlCheck != $arFields["URL"]) {
                     $arFields["URL"] = "u" . $arParams["USER_ID"] . "-blog-" . SITE_ID;
                 }
                 if (CBlog::GetByUrl($arFields["URL"])) {
                     $uind = 0;
                     do {
                         $uind++;
                         $arFields["URL"] = $arFields["URL"] . $uind;
                     } while (CBlog::GetByUrl($arFields["URL"]));
                 }
                 $featureOperationPerms = CSocNetFeaturesPerms::GetOperationPerm(SONET_ENTITY_USER, $arFields["OWNER_ID"], "blog", "view_post");
                 if ($featureOperationPerms == SONET_RELATIONS_TYPE_ALL) {
                     $bRights = true;
                 }
                 $arFields["PATH"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BLOG"], array("blog" => $arFields["URL"], "user_id" => $arFields["OWNER_ID"], "group_id" => $arFields["SOCNET_GROUP_ID"]));
                 $blogID = CBlog::Add($arFields);
                 if ($bRights) {
                     CBlog::AddSocnetRead($blogID);
                 }
                 $arBlog = CBlog::GetByID($blogID, $arParams["GROUP_ID"]);
             }
         }
         //	$DATE_PUBLISH = "";
         //	if(strlen($_POST["DATE_PUBLISH_DEF"]) > 0)
         //		$DATE_PUBLISH = $_POST["DATE_PUBLISH_DEF"];
         //	elseif (strlen($_POST["DATE_PUBLISH"])<=0)
         $DATE_PUBLISH = ConvertTimeStamp(time() + CTimeZone::GetOffset(), "FULL");
         //	else
         //		$DATE_PUBLISH = $_POST["DATE_PUBLISH"];
         $arFields = array("DETAIL_TEXT" => $userTwit['text'], "DETAIL_TEXT_TYPE" => "text", "DATE_PUBLISH" => $DATE_PUBLISH, "PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH, "PATH" => CComponentEngine::MakePathFromTemplate(htmlspecialcharsBack($arParams["PATH_TO_POST"]), array("post_id" => "#post_id#", "user_id" => $arBlog["OWNER_ID"])), "URL" => $arBlog["URL"], "SOURCE_TYPE" => "twitter");
         $arFields["PERMS_POST"] = array();
         $arFields["PERMS_COMMENT"] = array();
         $arFields["MICRO"] = "N";
         if (strlen($arFields["TITLE"]) <= 0) {
             $arFields["MICRO"] = "Y";
             $arFields["TITLE"] = trim(blogTextParser::killAllTags($arFields["DETAIL_TEXT"]));
             if (strlen($arFields["TITLE"]) <= 0) {
                 $arFields["TITLE"] = GetMessage("BLOG_EMPTY_TITLE_PLACEHOLDER");
             }
//.........这里部分代码省略.........
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:101,代码来源:authmanager.php

示例9: 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;
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:88,代码来源:blog_trackback.php

示例10: BuildRSS

 function BuildRSS($ID, $type = "RSS .92", $numPosts = 10, $blogTemplate = "", $postTemplate = "", $userTemplate = "", $bSoNet = false, $arParams = array())
 {
     $ID = IntVal($ID);
     if ($ID <= 0 && $arParams["USE_SOCNET"] != "Y") {
         return false;
     }
     $numPosts = IntVal($numPosts);
     $type = strtolower(preg_replace("/[^a-zA-Z0-9.]/is", "", $type));
     if ($type != "rss2.0" && $type != "atom.03") {
         $type = "rss.92";
     }
     $rssText = False;
     $arBlog = CBlog::GetByID($ID);
     if ($arBlog && $arBlog["ACTIVE"] == "Y" && $arBlog["ENABLE_RSS"] == "Y" || $arParams["USE_SOCNET"] == "Y") {
         if (!empty($arBlog)) {
             $arGroup = CBlogGroup::GetByID($arBlog["GROUP_ID"]);
         }
         if ($arGroup["SITE_ID"] == SITE_ID || $arParams["USE_SOCNET"] == "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 ($bSoNet) {
                 if (IntVal($arParams["USER_ID"]) > 0) {
                     $dbUser = CUser::GetByID($arParams["USER_ID"]);
                     if ($arUser = $dbUser->Fetch()) {
                         $blogName = htmlspecialcharsbx(GetMessage("BLG_RSS_NAME_SONET", array("#AUTHOR_NAME#" => CUser::FormatName(CSite::GetNameFormat(false), $arUser, true))));
                         $blogURL = htmlspecialcharsbx("http://" . $serverName . CComponentEngine::MakePathFromTemplate($blogTemplate, array("user_id" => $arParams["USER_ID"])));
                     }
                 } else {
                     if ($arGroupSoNet = CSocNetGroup::GetByID($arParams["SOCNET_GROUP_ID"])) {
                         $blogName = htmlspecialcharsbx(GetMessage("BLG_RSS_NAME_SONET_GROUP", array("#GROUP_NAME#" => $arGroupSoNet["NAME"])));
                         $blogURL = htmlspecialcharsbx("http://" . $serverName . CComponentEngine::MakePathFromTemplate($blogTemplate, array("group_id" => $arParams["SOCNET_GROUP_ID"])));
                     }
                 }
                 $blogDescr = "";
             } else {
                 if (strlen($blogTemplate) > 0) {
                     $blogURL = htmlspecialcharsbx("http://" . $serverName . CComponentEngine::MakePathFromTemplate($blogTemplate, 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"]));
                 }
                 $blogName = htmlspecialcharsbx($arBlog["NAME"]);
                 $blogDescr = htmlspecialcharsbx($arBlog["DESCRIPTION"]);
             }
             $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<description>" . $blogDescr . "</description>\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 .= "	<guid>".$blogURL."</guid>\n";
                 $rssText .= "\t<link>" . $blogURL . "</link>\n";
                 $rssText .= "\t<description>" . $blogDescr . "</description>\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") . ":" . $ID;
                 $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 .= "  <link href=\"".$blogURL."\"/>";
                 $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";
//.........这里部分代码省略.........
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:101,代码来源:blog.php

示例11: createBlog

 private function createBlog($userId, $blogGroupId, $siteId)
 {
     global $DB;
     $arFields = array("=DATE_UPDATE" => $DB->CurrentTimeFunction(), "GROUP_ID" => $blogGroupId, "ACTIVE" => "Y", "ENABLE_COMMENTS" => "Y", "ENABLE_IMG_VERIF" => "Y", "EMAIL_NOTIFY" => "Y", "ENABLE_RSS" => "Y", "ALLOW_HTML" => "N", "ENABLE_TRACKBACK" => "N", "SEARCH_INDEX" => "Y", "USE_SOCNET" => "Y", "=DATE_CREATE" => $DB->CurrentTimeFunction(), "PERMS_POST" => array(1 => "I", 2 => "I"), "PERMS_COMMENT" => array(1 => "P", 2 => "P"));
     $bRights = false;
     $rsUser = CUser::GetByID($userId);
     $arUser = $rsUser->Fetch();
     if (strlen($arUser["NAME"] . "" . $arUser["LAST_NAME"]) <= 0) {
         $arFields["NAME"] = GetMessage("SNBPA_BLOG_NAME") . " " . $arUser["LOGIN"];
     } else {
         $arFields["NAME"] = GetMessage("SNBPA_BLOG_NAME") . " " . $arUser["NAME"] . " " . $arUser["LAST_NAME"];
     }
     $arFields["URL"] = str_replace(" ", "_", $arUser["LOGIN"]) . "-blog-" . $siteId;
     $arFields["OWNER_ID"] = $userId;
     $urlCheck = preg_replace("/[^a-zA-Z0-9_-]/is", "", $arFields["URL"]);
     if ($urlCheck != $arFields["URL"]) {
         $arFields["URL"] = "u" . $userId . "-blog-" . $siteId;
     }
     if (CBlog::GetByUrl($arFields["URL"])) {
         $uind = 0;
         do {
             $uind++;
             $arFields["URL"] = $arFields["URL"] . $uind;
         } while (CBlog::GetByUrl($arFields["URL"]));
     }
     $featureOperationPerms = CSocNetFeaturesPerms::GetOperationPerm(SONET_ENTITY_USER, $arFields["OWNER_ID"], "blog", "view_post");
     if ($featureOperationPerms == SONET_RELATIONS_TYPE_ALL) {
         $bRights = true;
     }
     $blogID = CBlog::Add($arFields);
     BXClearCache(true, "/blog/form/blog/");
     if ($bRights) {
         CBlog::AddSocnetRead($blogID);
     }
     return CBlog::GetByID($blogID, $blogGroupId);
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:36,代码来源:socnetblogpostactivity.php

示例12: AddToUserGroup

 function AddToUserGroup($ID, $blogID, $arGroups = array(), $joinStatus = "Y", $selectType = BLOG_BY_BLOG_USER_ID, $action = BLOG_CHANGE)
 {
     global $DB;
     $ID = IntVal($ID);
     $blogID = IntVal($blogID);
     if (!is_array($arGroups)) {
         $arGroups = array($arGroups);
     }
     $joinStatus = $joinStatus == "Y" ? "Y" : "N";
     $selectType = $selectType == BLOG_BY_USER_ID ? BLOG_BY_USER_ID : BLOG_BY_BLOG_USER_ID;
     $action = $action == BLOG_ADD ? BLOG_ADD : BLOG_CHANGE;
     $bSuccess = True;
     $arResult = CBlog::GetByID($blogID);
     if (!$arResult) {
         $GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $blogID, GetMessage("BLG_GU_ERROR_NO_BLOG")), "ERROR_NO_BLOG");
         $bSuccess = False;
     }
     if ($bSuccess) {
         $arUser = CBlogUser::GetByID($ID, $selectType);
         $dbResult = CUser::GetByID($arUser["USER_ID"]);
         if (!$dbResult->Fetch()) {
             $GLOBALS["APPLICATION"]->ThrowException(GetMessage("BLG_GU_ERROR_NO_USER_ID"), "ERROR_NO_USER_ID");
             $bSuccess = False;
         }
     }
     if ($bSuccess) {
         if ($action == BLOG_CHANGE) {
             $DB->Query("DELETE FROM b_blog_user2user_group " . "WHERE USER_ID = " . IntVal($arUser["USER_ID"]) . " " . "\tAND BLOG_ID = " . $blogID . " ");
         }
         if (count($arGroups) > 0) {
             array_walk($arGroups, create_function("&\$item", "\$item=IntVal(\$item);"));
             $dbUserGroups = CBlogUserGroup::GetList(array(), array("ID" => $arGroups, "BLOG_ID" => $blogID), false, false, array("ID"));
             $arGroups = array();
             while ($arUserGroup = $dbUserGroups->Fetch()) {
                 $arGroups[] = IntVal($arUserGroup["ID"]);
             }
             if ($action == BLOG_ADD) {
                 $arCurrentGroups = CBlogUser::GetUserGroups($ID, $blogID, "", $selectType);
             }
             foreach ($arGroups as $val) {
                 if ($val != 1 && $val != 2) {
                     if ($action == BLOG_CHANGE || $action == BLOG_ADD && !in_array($val, $arCurrentGroups)) {
                         $DB->Query("INSERT INTO b_blog_user2user_group (USER_ID, BLOG_ID, USER_GROUP_ID) " . "VALUES (" . IntVal($arUser["USER_ID"]) . ", " . $blogID . ", " . IntVal($val) . ")");
                     }
                 }
             }
         }
         unset($GLOBALS["BLOG_USER"]["BLOG_USER2GROUP_CACHE_" . $arUser["ID"]]);
         unset($GLOBALS["BLOG_USER"]["BLOG_USER2GROUP1_CACHE_" . $arUser["USER_ID"]]);
     }
     return $bSuccess;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:52,代码来源:blog_user.php

示例13: 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"))
//.........这里部分代码省略.........
开发者ID:akniyev,项目名称:arteva.ru,代码行数:101,代码来源:blog_post.php

示例14: GetMessage

     $dbUser = CUser::GetByID($arBlogUser["USER_ID"]);
     $arUser = $dbUser->GetNext();
     if ($arParams["SET_TITLE"] == "Y") {
         $APPLICATION->SetTitle(str_replace("#NAME#", CBlogUser::GetUserName($arBlogUser["ALIAS"], $arUser["NAME"], $arUser["LAST_NAME"], $arUser["LOGIN"]), GetMessage("B_B_FR_TITLE_OF")));
     }
 }
 $dbList = CBlogUser::GetUserFriendsList($arParams["ID"], $USER->GetID(), $USER->IsAuthorized(), $arParams["MESSAGE_COUNT"], $arParams["GROUP_ID"]);
 $arResult["FRIENDS_POSTS"] = array();
 $arResult["IDS"] = array();
 $p = new blogTextParser(false, $arParams["PATH_TO_SMILE"]);
 $arParserParams = array("imageWidth" => $arParams["IMAGE_MAX_WIDTH"], "imageHeight" => $arParams["IMAGE_MAX_HEIGHT"]);
 while ($arList = $dbList->Fetch()) {
     $arResult["IDS"][] = $arList["ID"];
     $arPost = CBlogPost::GetByID($arList["ID"]);
     $arPost = CBlogTools::htmlspecialcharsExArray($arPost);
     $arBlog = CBlog::GetByID($arPost["BLOG_ID"]);
     $arBlog = CBlogTools::htmlspecialcharsExArray($arBlog);
     $arPost["urlToPost"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_POST"], array("blog" => $arBlog["URL"], "post_id" => CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arParams["ALLOW_POST_CODE"])));
     $arPost["urlToAuthor"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arPost["AUTHOR_ID"]));
     if ($arPost["AUTHOR_ID"] == $arBlog["OWNER_ID"]) {
         $arPost["urlToBlog"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BLOG"], array("blog" => $arBlog["URL"]));
     } else {
         if ($arOwnerBlog = CBlog::GetByOwnerID($arPost["AUTHOR_ID"], $arParams["GROUP_ID"])) {
             $arPost["urlToBlog"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BLOG"], array("blog" => $arOwnerBlog["URL"]));
         }
     }
     $arImages = array();
     $dbImage = CBlogImage::GetList(array("ID" => "ASC"), array("POST_ID" => $arPost["ID"], "BLOG_ID" => $arBlog["ID"], "IS_COMMENT" => "N"));
     while ($arImage = $dbImage->Fetch()) {
         $arImages[$arImage['ID']] = $arImage['FILE_ID'];
         $arPost["arImages"][$arImage['ID']] = array("small" => "/bitrix/components/bitrix/blog/show_file.php?fid=" . $arImage['ID'] . "&width=70&height=70&type=square", "full" => "/bitrix/components/bitrix/blog/show_file.php?fid=" . $arImage['ID'] . "&width=1000&height=1000");
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php

示例15: while

                     do {
                         $uind++;
                         $arFields["URL"] = $arFields["URL"] . $uind;
                     } while (CBlog::GetByUrl($arFields["URL"]));
                 }
                 $featureOperationPerms = CSocNetFeaturesPerms::GetOperationPerm(SONET_ENTITY_USER, $arFields["OWNER_ID"], "blog", "view_post");
                 if ($featureOperationPerms == SONET_RELATIONS_TYPE_ALL) {
                     $bRights = true;
                 }
                 $arFields["PATH"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BLOG"], array("blog" => $arFields["URL"], "user_id" => $arFields["OWNER_ID"], "group_id" => $arFields["SOCNET_GROUP_ID"]));
                 $blogID = CBlog::Add($arFields);
                 BXClearCache(true, "/blog/form/blog/");
                 if ($bRights) {
                     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();
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:component.php


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