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


PHP CBlog::Add方法代码示例

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


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

示例1: 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

示例2: OnSearchReindex


//.........这里部分代码省略.........
                 $arF = array();
                 if (COption::GetOptionString("blog", "socNetNewPerms", "N") == "N") {
                     if (IntVal($ar["SOCNET_GROUP_ID"]) > 0) {
                         $newBlogId = 0;
                         if (IntVal($arUser2Blog[$ar["AUTHOR_ID"]][$ar["GROUP_ID"]]) > 0) {
                             $newBlogId = IntVal($arUser2Blog[$ar["AUTHOR_ID"]][$ar["GROUP_ID"]]);
                         } else {
                             $arFields = array("=DATE_UPDATE" => $DB->CurrentTimeFunction(), "GROUP_ID" => $ar["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($ar["AUTHOR_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-" . $ar["SITE_ID"];
                             $arFields["OWNER_ID"] = $ar["AUTHOR_ID"];
                             $urlCheck = preg_replace("/[^a-zA-Z0-9_-]/is", "", $arFields["URL"]);
                             if ($urlCheck != $arFields["URL"]) {
                                 $arFields["URL"] = "u" . $arUser["ID"] . "-blog-" . $ar["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, $ar["AUTHOR_ID"], "blog", "view_post");
                             if ($featureOperationPerms == SONET_RELATIONS_TYPE_ALL) {
                                 $bRights = true;
                             }
                             $blogID = CBlog::Add($arFields);
                             if ($bRights) {
                                 CBlog::AddSocnetRead($blogID);
                             }
                             $newBlogId = $blogID;
                             $arUser2Blog[$arFields["OWNER_ID"]][$arFields["GROUP_ID"]] = $newBlogId;
                         }
                         if (intVal($newBlogId) > 0) {
                             $arF = array("BLOG_ID" => $newBlogId, "SOCNET_RIGHTS" => array("SG" . $ar["SOCNET_GROUP_ID"]));
                         }
                         if (IntVal($ar["SLID"]) > 0) {
                             CSocNetLog::Delete($ar["SLID"]);
                             $ar["SLID"] = 0;
                         }
                         $arSites = array();
                         $rsGroupSite = CSocNetGroup::GetSite($ar["SOCNET_GROUP_ID"]);
                         while ($arGroupSite = $rsGroupSite->Fetch()) {
                             $arSites[] = $arGroupSite["LID"];
                         }
                     } else {
                         $newBlogId = 0;
                         if ($ar["OWNER_ID"] != $ar["AUTHOR_ID"]) {
                             if (IntVal($arUser2Blog[$ar["AUTHOR_ID"]][$ar["GROUP_ID"]]) > 0) {
                                 $newBlogId = IntVal($arUser2Blog[$ar["AUTHOR_ID"]][$ar["GROUP_ID"]]);
                             } else {
                                 $arFields = array("=DATE_UPDATE" => $DB->CurrentTimeFunction(), "GROUP_ID" => $ar["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($ar["AUTHOR_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"];
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:67,代码来源:blog_search.php

示例3: while

    		if ($res_blog = $db_blog->Fetch())
    		{
    			do 
    			{
    				CBlog::Delete($res_blog["ID"]); 
    			} while ($res_blog = $db_blog->Fetch()); 
    		}
    		BXClearCache(True, "/".WIZARD_SITE_ID."/blog/");
    		BXClearCache(True, "/".WIZARD_SITE_ID."/idea/");
    	 } */
}
if (!$SocNetGroupID) {
    $SocNetGroupID = CBlogGroup::Add(array("SITE_ID" => WIZARD_SITE_ID, "NAME" => $IdeaBlogGroupName));
}
//Blog
$blogID = CBlog::Add(array("NAME" => GetMessage("IDEA_DEMO_BLOG_NAME"), "DESCRIPTION" => "", "GROUP_ID" => $SocNetGroupID, "ENABLE_IMG_VERIF" => 'Y', "EMAIL_NOTIFY" => 'Y', "ENABLE_RSS" => "Y", "ALLOW_HTML" => "Y", "URL" => $IdeaBlogUrl, "ACTIVE" => "Y", "=DATE_CREATE" => $DB->GetNowFunction(), "=DATE_UPDATE" => $DB->GetNowFunction(), "SOCNET_GROUP_ID" => 1, "PERMS_POST" => array("1" => BLOG_PERMS_READ, "2" => BLOG_PERMS_WRITE), "PERMS_COMMENT" => array("1" => BLOG_PERMS_WRITE, "2" => BLOG_PERMS_WRITE), "PATH" => '/services/idea/'));
//UF
$arUFIdByName = array();
$arStatusList = CIdeaManagment::getInstance()->GetStatusList();
foreach ($arStatusList as $UF) {
    $arUFIdByName[$UF["XML_ID"]] = $UF["ID"];
}
//Categories
$categoryID = array();
$categoryID[0][] = CBlogCategory::Add(array("BLOG_ID" => $blogID, "NAME" => GetMessage("IDEA_BLOG_DEMO_CATEGORY_1")));
$categoryID[0][] = CBlogCategory::Add(array("BLOG_ID" => $blogID, "NAME" => GetMessage("IDEA_BLOG_DEMO_CATEGORY_2")));
$categoryID[1][] = CBlogCategory::Add(array("BLOG_ID" => $blogID, "NAME" => GetMessage("IDEA_BLOG_DEMO_CATEGORY_3")));
//Post messages
$arBlogPostFields = array();
$arBlogPostFields[] = array("TITLE" => GetMessage("IDEA_BLOG_DEMO_MESSAGE_TITLE_1"), "DETAIL_TEXT" => GetMessage("IDEA_BLOG_DEMO_MESSAGE_BODY_1"), "DETAIL_TEXT_TYPE" => "text", "BLOG_ID" => $blogID, "AUTHOR_ID" => 1, "=DATE_CREATE" => $DB->GetNowFunction(), "=DATE_PUBLISH" => $DB->GetNowFunction(), "PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH, "ENABLE_TRACKBACK" => 'N', "ENABLE_COMMENTS" => 'Y', "CATEGORY_ID" => implode(",", $categoryID[0]), "UF_CATEGORY_CODE" => ToUpper(GetMessage("IDEA_UF_CATEGORY_CODE_1")), "UF_STATUS" => $arUFIdByName["COMPLETED"], "PERMS_POST" => array(1 => BLOG_PERMS_READ, 2 => BLOG_PERMS_READ), "PERMS_COMMENT" => array(1 => BLOG_PERMS_WRITE, 2 => BLOG_PERMS_WRITE), "PATH" => '/services/idea/#post_id#/', "CODE" => "company_new_year_2012");
$arBlogPostFields[] = array("TITLE" => GetMessage("IDEA_BLOG_DEMO_MESSAGE_TITLE_2"), "DETAIL_TEXT" => GetMessage("IDEA_BLOG_DEMO_MESSAGE_BODY_2"), "DETAIL_TEXT_TYPE" => "text", "BLOG_ID" => $blogID, "AUTHOR_ID" => 1, "=DATE_CREATE" => $DB->GetNowFunction(), "=DATE_PUBLISH" => $DB->GetNowFunction(), "PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH, "ENABLE_TRACKBACK" => 'N', "ENABLE_COMMENTS" => 'Y', "CATEGORY_ID" => implode(",", $categoryID[1]), "UF_CATEGORY_CODE" => ToUpper(GetMessage("IDEA_UF_CATEGORY_CODE_2")), "UF_STATUS" => $arUFIdByName["NEW"], "PERMS_POST" => array(1 => BLOG_PERMS_READ, 2 => BLOG_PERMS_READ), "PERMS_COMMENT" => array(1 => BLOG_PERMS_WRITE, 2 => BLOG_PERMS_WRITE), "PATH" => '/services/idea/#post_id#/', "CODE" => "new_workers");
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:idea_blog.php

示例4: defined

$SITE_ID = defined("SITE_ID") && strLen(SITE_ID) > 0 ? SITE_ID : "s1";
$arFields = array("SITE_ID" => $SITE_ID, "NAME" => GetMessage("IBLOCK_CSC_BLOG_GROUP_NAME"));
$dbBlogGroup = CBlogGroup::GetList(array(), $arFields, false, false, array("ID"));
if ($arBlogGroup = $dbBlogGroup->Fetch()) {
    $blogGroupID = $arBlogGroup["ID"];
} else {
    $blogGroupID = CBlogGroup::Add($arFields);
}
$blogGroupID = intval($blogGroupID);
if ($blogGroupID > 0) {
    $dbBlog = CBlog::GetList(array(), array("URL" => $arResult["BLOG_URL"]), false, false, array("ID"));
    if ($arBlog = $dbBlog->Fetch()) {
        $blogId = $arBlog["ID"];
    } else {
        $arFields = array("NAME" => GetMessage("IBLOCK_CSC_BLOG_NAME"), "DESCRIPTION" => GetMessage("IBLOCK_CSC_BLOG_DESCRIPTION"), "GROUP_ID" => $blogGroupID, "ENABLE_COMMENTS" => 'Y', "ENABLE_IMG_VERIF" => 'Y', "EMAIL_NOTIFY" => isset($arParams["EMAIL_NOTIFY"]) && $arParams["EMAIL_NOTIFY"] == 'Y' ? 'Y' : 'N', "URL" => $arResult["BLOG_URL"], "ACTIVE" => "Y", "OWNER_ID" => 1, "AUTO_GROUPS" => "N");
        $blogId = CBlog::Add($arFields);
        if (IntVal($blogId) > 0) {
            CBlog::SetBlogPerms($blogId, array("1" => BLOG_PERMS_WRITE, "2" => BLOG_PERMS_WRITE), BLOG_PERMS_COMMENT);
        } else {
            if ($ex = $APPLICATION->GetException()) {
                $arResult["ERRORS"][] = $ex->GetString();
            } else {
                $arResult["ERRORS"][] = GetMessage("IBLOCK_CSC_BLOG_CREATE_ERROR");
            }
        }
    }
} else {
    if ($ex = $APPLICATION->GetException()) {
        $arResult["ERRORS"][] = $ex->GetString();
    } else {
        $arResult["ERRORS"][] = GetMessage("IBLOCK_CSC_BLOG_GROUP_CREATE_ERROR");
开发者ID:spas-viktor,项目名称:books,代码行数:31,代码来源:component.php

示例5: InstallBlog

 private function InstallBlog()
 {
     if ($this->arResult["INSTALLATION"]["BLOG_INSTALL"]) {
         global $DB, $APPLICATION;
         $arFields = array("ACTIVE" => "Y", "NAME" => GetMessage("IDEA_BLOG_TITLE"), "=DATE_UPDATE" => $DB->CurrentTimeFunction(), "=DATE_CREATE" => $DB->CurrentTimeFunction(), "URL" => $this->ModuleBlogUrl, "SOCNET_GROUP_ID" => 1, "GROUP_ID" => $this->arResult["INSTALLATION"]["BLOG_GROUP_ID"], "ENABLE_COMMENTS" => "Y", "ENABLE_IMG_VERIF" => "Y", "EMAIL_NOTIFY" => "Y", "ENABLE_RSS" => "Y", "ALLOW_HTML" => "Y", "PERMS_POST" => array("1" => BLOG_PERMS_READ, "2" => BLOG_PERMS_WRITE), "PERMS_COMMENT" => array("1" => BLOG_PERMS_WRITE, "2" => BLOG_PERMS_WRITE), "PATH" => $this->PublicDir);
         if (!($BlogId = CBlog::Add($arFields))) {
             if ($ex = $APPLICATION->GetException()) {
                 $this->arResult["ERRORS"][] = $ex->GetString();
             } else {
                 $this->arResult["ERRORS"][] = GetMessage("IDEA_INSTALL_ERROR_BLOG_NOT_INSTALLED");
             }
         }
         $this->arResult["INSTALLATION"]["BLOG_ID"] = $BlogId;
         if (!$this->HaveError()) {
             $this->InstallBlogPost();
             $this->InstallBlogComment();
         }
     }
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:19,代码来源:step1.php

示例6: array

								"OWNER_ID" => 1,
								"SEARCH_INDEX" => "N",
								"AUTO_GROUPS" => "N",
								"PERMS_POST" => array(
									1 => BLOG_PERMS_READ,
									2 => BLOG_PERMS_READ
								),
								"PERMS_COMMENT" => array(
									1 => BLOG_PERMS_WRITE,
									2 => BLOG_PERMS_WRITE
								),
								"=DATE_CREATE" => $DB->GetNowFunction(),
								"=DATE_UPDATE" => $DB->GetNowFunction()
							);

							$blogID = (int)CBlog::Add($fields);
							unset($fields);

							if ($blogID == 0)
							{
								if ($ex = $APPLICATION->GetException())
									$arResult["ERRORS"][] = $ex->GetString();
								else
									$arResult["ERRORS"][] = GetMessage("IBLOCK_CSC_BLOG_CREATE_ERROR");
							}
						}
					}
				}
			}
			if ($blogExist)
			{
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:31,代码来源:component.php

示例7: array

    $arUsers = array($arUsers[0], $arUsers[1], $arUsers[2]);
    $arUsers[0]["POSTS"] = array($arPosts[0]);
    $arUsers[1]["POSTS"] = array($arPosts[1], $arPosts[2]);
    $arUsers[2]["POSTS"] = array($arPosts[3], $arPosts[4]);
}
/********************************************************************
				/Creating Posts array and arranging for Users 
********************************************************************/
/********************************************************************
				Create users blog and posts
********************************************************************/
$cnt = 0;
foreach ($arUsers as $key => $arUser) {
    $cnt++;
    $GLOBALS["APPLICATION"]->ResetException();
    $blogID = CBlog::Add(array("NAME" => trim(GetMessage("BLG_NAME") . " " . $arUser["NAME"] . " " . $arUser["LAST_NAME"]), "DESCRIPTION" => "", "GROUP_ID" => $SocNetGroupID, "ENABLE_IMG_VERIF" => 'Y', "EMAIL_NOTIFY" => 'Y', "USE_SOCNET" => 'Y', "ENABLE_RSS" => "Y", "ALLOW_HTML" => "Y", "URL" => WIZARD_SITE_ID . "_blog_" . $arUser["ID"], "ACTIVE" => "Y", "=DATE_CREATE" => $DB->GetNowFunction(), "=DATE_UPDATE" => $DB->GetNowFunction(), "OWNER_ID" => $arUser["ID"], "PERMS_POST" => array("1" => BLOG_PERMS_READ, "2" => BLOG_PERMS_READ), "PERMS_COMMENT" => array("1" => BLOG_PERMS_WRITE, "2" => BLOG_PERMS_WRITE)));
    $res = $GLOBALS["APPLICATION"]->GetException();
    if ($blogID <= 0 || !empty($res)) {
        continue;
    }
    CBlog::AddSocnetRead($blogID);
    $arUsers[$key]["BLOG_ID"] = $blogID;
    $categoryID = array();
    foreach ($arUser["POSTS"] as $k => $arPost) {
        $arComments = $arPost["COMMENTS"];
        unset($arPost["COMMENTS"]);
        // CATEGORY
        $category = explode(", ", $arPost["CATEGORY_ID"]);
        $category = array_unique($category);
        $iCategory = array();
        foreach ($category as $sCategoryValue) {
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:index.php

示例8: 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

示例9: while

if (is_dir($dir) && ($dh = opendir($dir))) {
    while (($file = readdir($dh)) !== false) {
        if ($file == "." || $file == "..") {
            continue;
        }
        $arImages[$file] = array("name" => $file, "type" => "image/jpeg", "tmp_name" => $dir . $file, "error" => 0, "size" => filesize($dir . $file));
    }
    closedir($dh);
}
$arPosts = array(array("TITLE" => GetMessage("BLOG_MESSAGE1_TITLE"), "DETAIL_TEXT" => GetMessage("BLOG_MESSAGE1_BODY"), "DETAIL_TEXT_TYPE" => "text", "=DATE_CREATE" => $DB->GetNowFunction(), "=DATE_PUBLISH" => $DB->GetNowFunction(), "PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH, "ENABLE_TRACKBACK" => 'N', "ENABLE_COMMENTS" => 'Y', "VIEWS" => 10, "CATEGORY_ID" => GetMessage("BLOG_MESSAGE1_TAGS"), "PERMS_POST" => array(1 => BLOG_PERMS_READ, 2 => BLOG_PERMS_READ), "PERMS_COMMENT" => array(1 => BLOG_PERMS_WRITE, 2 => BLOG_PERMS_WRITE), "COMMENTS" => array(array("AUTHOR" => GetMessage("BLOG_MESSAGE1_COMMENTS1_AUTHOR"), "TEXT" => GetMessage("BLOG_MESSAGE1_COMMENTS1_TEXT")), array("AUTHOR" => GetMessage("BLOG_MESSAGE1_COMMENTS2_AUTHOR"), "TEXT" => GetMessage("BLOG_MESSAGE1_COMMENTS2_TEXT"), "COMMENTS" => array(array("AUTHOR" => false, "TEXT" => GetMessage("BLOG_MESSAGE1_COMMENTS3_TEXT")))))), array("TITLE" => GetMessage("BLOG_MESSAGE2_TITLE"), "DETAIL_TEXT" => GetMessage("BLOG_MESSAGE2_BODY"), "DETAIL_TEXT_TYPE" => "text", "=DATE_CREATE" => $DB->GetNowFunction(), "=DATE_PUBLISH" => $DB->GetNowFunction(), "PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH, "ENABLE_TRACKBACK" => 'N', "ENABLE_COMMENTS" => 'Y', "VIEWS" => 12, "CATEGORY_ID" => GetMessage("BLOG_MESSAGE2_TAGS"), "PERMS_POST" => array(1 => BLOG_PERMS_READ, 2 => BLOG_PERMS_READ), "PERMS_COMMENT" => array(1 => BLOG_PERMS_WRITE, 2 => BLOG_PERMS_WRITE), "COMMENTS" => array(array("AUTHOR" => GetMessage("BLOG_MESSAGE2_COMMENTS1_AUTHOR"), "TEXT" => GetMessage("BLOG_MESSAGE2_COMMENTS1_TEXT")), array("AUTHOR" => GetMessage("BLOG_MESSAGE2_COMMENTS2_AUTHOR"), "TEXT" => GetMessage("BLOG_MESSAGE2_COMMENTS2_TEXT"), "COMMENTS" => array(array("AUTHOR" => false, "TEXT" => GetMessage("BLOG_MESSAGE2_COMMENTS3_TEXT")))))), array("TITLE" => GetMessage("BLOG_MESSAGE3_TITLE"), "DETAIL_TEXT" => GetMessage("BLOG_MESSAGE3_BODY"), "DETAIL_TEXT_TYPE" => "text", "=DATE_CREATE" => $DB->GetNowFunction(), "=DATE_PUBLISH" => $DB->GetNowFunction(), "PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH, "ENABLE_TRACKBACK" => 'N', "ENABLE_COMMENTS" => 'Y', "VIEWS" => 8, "CATEGORY_ID" => GetMessage("BLOG_MESSAGE3_TAGS"), "PERMS_POST" => array(1 => BLOG_PERMS_READ, 2 => BLOG_PERMS_READ), "PERMS_COMMENT" => array(1 => BLOG_PERMS_WRITE, 2 => BLOG_PERMS_WRITE), "COMMENTS" => array(array("AUTHOR" => GetMessage("BLOG_MESSAGE3_COMMENTS1_AUTHOR"), "TEXT" => GetMessage("BLOG_MESSAGE3_COMMENTS1_TEXT"), "COMMENTS" => array(array("AUTHOR" => false, "TEXT" => GetMessage("BLOG_MESSAGE3_COMMENTS2_TEXT")))), array("AUTHOR" => GetMessage("BLOG_MESSAGE3_COMMENTS3_AUTHOR"), "TEXT" => GetMessage("BLOG_MESSAGE3_COMMENTS3_TEXT"), "COMMENTS" => array(array("AUTHOR" => false, "TEXT" => GetMessage("BLOG_MESSAGE3_COMMENTS4_TEXT")))))), array("TITLE" => GetMessage("BLOG_MESSAGE4_TITLE"), "DETAIL_TEXT" => GetMessage("BLOG_MESSAGE4_BODY"), "DETAIL_TEXT_TYPE" => "text", "=DATE_CREATE" => $DB->GetNowFunction(), "=DATE_PUBLISH" => $DB->GetNowFunction(), "PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH, "ENABLE_TRACKBACK" => 'N', "ENABLE_COMMENTS" => 'Y', "VIEWS" => 7, "CATEGORY_ID" => GetMessage("BLOG_MESSAGE4_TAGS"), "PERMS_POST" => array(1 => BLOG_PERMS_READ, 2 => BLOG_PERMS_READ), "PERMS_COMMENT" => array(1 => BLOG_PERMS_WRITE, 2 => BLOG_PERMS_WRITE)), array("TITLE" => GetMessage("BLOG_MESSAGE5_TITLE"), "DETAIL_TEXT" => GetMessage("BLOG_MESSAGE5_BODY"), "DETAIL_TEXT_TYPE" => "text", "=DATE_CREATE" => $DB->GetNowFunction(), "=DATE_PUBLISH" => $DB->GetNowFunction(), "PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH, "ENABLE_TRACKBACK" => 'N', "ENABLE_COMMENTS" => 'Y', "VIEWS" => 2, "CATEGORY_ID" => GetMessage("BLOG_MESSAGE5_TAGS"), "PERMS_POST" => array(1 => BLOG_PERMS_READ, 2 => BLOG_PERMS_READ), "PERMS_COMMENT" => array(1 => BLOG_PERMS_WRITE, 2 => BLOG_PERMS_WRITE)));
$arPosts = array_reverse($arPosts);
/********************************************************************
				Create users blog and posts
********************************************************************/
$blogID = CBlog::Add(array("NAME" => trim(GetMessage("BLG_NAME") . " " . $USER->GetFullName()), "DESCRIPTION" => "", "GROUP_ID" => $SocNetGroupID, "ENABLE_IMG_VERIF" => 'Y', "EMAIL_NOTIFY" => 'Y', "USE_SOCNET" => 'N', "ENABLE_RSS" => "Y", "ALLOW_HTML" => "Y", "URL" => "admin-blog" . "-" . WIZARD_SITE_ID . "", "ACTIVE" => "Y", "=DATE_CREATE" => $DB->GetNowFunction(), "=DATE_UPDATE" => $DB->GetNowFunction(), "OWNER_ID" => 1, "PERMS_POST" => array("1" => BLOG_PERMS_READ, "2" => BLOG_PERMS_READ), "PERMS_COMMENT" => array("1" => BLOG_PERMS_WRITE, "2" => BLOG_PERMS_WRITE)));
$blogUtilID = CBlog::Add(array("NAME" => trim(GetMessage("BLG_NAME_UTIL")) . " (" . WIZARD_SITE_ID . ")", "DESCRIPTION" => "", "GROUP_ID" => $utilGroupID, "ENABLE_IMG_VERIF" => 'Y', "EMAIL_NOTIFY" => 'Y', "USE_SOCNET" => 'N', "ENABLE_RSS" => "Y", "ALLOW_HTML" => "N", "URL" => "util-photo-blog-" . WIZARD_SITE_ID, "ACTIVE" => "Y", "=DATE_CREATE" => $DB->GetNowFunction(), "=DATE_UPDATE" => $DB->GetNowFunction(), "OWNER_ID" => 1, "PERMS_POST" => array("1" => BLOG_PERMS_READ, "2" => BLOG_PERMS_READ), "PERMS_COMMENT" => array("1" => BLOG_PERMS_WRITE, "2" => BLOG_PERMS_WRITE)));
if ($res = $GLOBALS["APPLICATION"]->GetException()) {
    return $res->GetString();
    die;
}
$arBlog = CBlog::GetByID($blogID);
$arUtilBlog = CBlog::GetByID($blogUtilID);
$categoryID = array();
foreach ($arPosts as $k => $arPost) {
    $arComments = $arPost["COMMENTS"];
    // CATEGORY
    $category = explode(", ", $arPost["CATEGORY_ID"]);
    $category = array_unique($category);
    $iCategory = array();
    foreach ($category as $sCategoryValue) {
        if (empty($categoryID[$sCategoryValue])) {
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:index.php


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