本文整理汇总了PHP中CBlogGroup类的典型用法代码示例。如果您正苦于以下问题:PHP CBlogGroup类的具体用法?PHP CBlogGroup怎么用?PHP CBlogGroup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CBlogGroup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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 (!CBlogGroup::CheckFields("UPDATE", $arFields, $ID)) {
return false;
}
$strUpdate = $DB->PrepareUpdate("b_blog_group", $arFields);
foreach ($arFields1 as $key => $value) {
if (strlen($strUpdate) > 0) {
$strUpdate .= ", ";
}
$strUpdate .= $key . "=" . $value . " ";
}
if (strlen($strUpdate) > 0) {
$strSql = "UPDATE b_blog_group SET " . "\t" . $strUpdate . " " . "WHERE ID = " . $ID . " ";
$DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
unset($GLOBALS["BLOG_GROUP_CACHE_" . $ID]);
return $ID;
}
return False;
}
示例2: CheckFields
function CheckFields($ACTION, &$arFields, $ID = 0)
{
if ((is_set($arFields, "NAME") || $ACTION == "ADD") && strlen($arFields["NAME"]) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("BLG_GG_EMPTY_NAME"), "EMPTY_NAME");
return false;
} elseif (is_set($arFields, "NAME")) {
$dbResult = CBlogGroup::GetList(array(), array("NAME" => $arFields["NAME"], "!ID" => $ID, "SITE_ID" => $arFields["SITE_ID"]), false, false, array("ID"));
if ($dbResult->Fetch()) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("BLG_GG_DUBLICATE_NAME"), "DUBLICATE_NAME");
return false;
}
}
if ((is_set($arFields, "SITE_ID") || $ACTION == "ADD") && strlen($arFields["SITE_ID"]) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("BLG_GG_EMPTY_SITE_ID"), "EMPTY_SITE_ID");
return false;
} elseif (is_set($arFields, "SITE_ID")) {
$dbResult = CSite::GetByID($arFields["SITE_ID"]);
if (!$dbResult->Fetch()) {
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["SITE_ID"], GetMessage("BLG_GG_ERROR_NO_SITE")), "ERROR_NO_SITE");
return false;
}
}
return True;
}
示例3: array
CBlogSitePath::Update($res["ID"], array("PATH" => $res_tmp[$res["TYPE"]]));
}
} while ($db_res && ($res = $db_res->Fetch()));
}
} else {
CBlogSitePath::Add(array("SITE_ID" => WIZARD_SITE_ID, "PATH" => WIZARD_SITE_DIR . "people/user/#user_id#/blog/", "TYPE" => "B"));
CBlogSitePath::Add(array("SITE_ID" => WIZARD_SITE_ID, "PATH" => WIZARD_SITE_DIR . "people/user/#user_id#/blog/#post_id#/", "TYPE" => "P"));
CBlogSitePath::Add(array("SITE_ID" => WIZARD_SITE_ID, "PATH" => WIZARD_SITE_DIR . "people/user/#user_id#/", "TYPE" => "U"));
CBlogSitePath::Add(array("SITE_ID" => WIZARD_SITE_ID, "PATH" => WIZARD_SITE_DIR . "groups/group/#group_id#/blog/", "TYPE" => "G"));
CBlogSitePath::Add(array("SITE_ID" => WIZARD_SITE_ID, "PATH" => WIZARD_SITE_DIR . "groups/group/#group_id#/blog/#post_id#/", "TYPE" => "H"));
}
/********************************************************************
Get users list with permission to create blog
********************************************************************/
if (!$SocNetGroupID) {
$SocNetGroupID = CBlogGroup::Add(array("SITE_ID" => WIZARD_SITE_ID, "NAME" => "[" . WIZARD_SITE_ID . "] " . GetMessage("BLOG_DEMO_GROUP_SOCNET")));
}
$arFilter = array();
if ($GLOBALS["APPLICATION"]->GetGroupRight("blog", array(2)) < "N") {
$arFilter["!ID"] = 1;
$arFilter["GROUPS"] = array();
$db_res = CGroup::GetList($by = "ID", $order = "DESC", array("ACTIVE" => "Y", "!ID" => 2));
if ($db_res && ($res = $db_res->Fetch())) {
do {
if ($GLOBALS["APPLICATION"]->GetGroupRight("blog", array($res["ID"])) >= "N") {
$arFilter["GROUPS"][] = $res["ID"];
}
} while ($res = $db_res->Fetch());
}
}
$db_res = CUser::GetList($by = "ID", $order = "DESC", $arFilter, array("NAV_PARAMS" => array("nPageSize" => 3, "iNumPage" => 1, "bDescPageNumbering" => false)));
示例4: 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);
示例5: array
$obCache->StartDataCache();
$dbBl = CBlog::GetList(array(), $arFilterblg);
$arBlog = $dbBl->Fetch();
if (!$arBlog && IsModuleInstalled("intranet")) {
$arIdeaBlogGroupID = array();
if (IsModuleInstalled("idea")) {
$rsSite = CSite::GetList($by = "sort", $order = "desc", array("ACTIVE" => "Y"));
while ($arSite = $rsSite->Fetch()) {
$arIdeaBlogGroupID[] = COption::GetOptionInt("idea", "blog_group_id", false, $arSite["LID"]);
}
}
if (empty($arIdeaBlogGroupID)) {
$arBlog = CBlog::GetByOwnerID($arParams["USER_ID"]);
} else {
$arBlogGroupID = array();
$rsBlogGroup = CBlogGroup::GetList(array(), array(), false, false, array("ID"));
while ($arBlogGroup = $rsBlogGroup->Fetch()) {
if (!in_array($arBlogGroup["ID"], $arIdeaBlogGroupID)) {
$arBlogGroupID[] = $arBlogGroup["ID"];
}
}
$arBlog = CBlog::GetByOwnerID($arParams["USER_ID"], $arBlogGroupID);
}
}
$obCache->EndDataCache($arBlog);
}
$arResult["Blog"] = $arBlog;
if ($GLOBALS["USER"]->IsAuthorized()) {
CSocNetTools::InitGlobalExtranetArrays();
if (isset($GLOBALS["arExtranetGroupID"])) {
$arResult["arExtranetGroupID"] = $GLOBALS["arExtranetGroupID"];
示例6: Update
//.........这里部分代码省略.........
ExecuteModuleEventEx($arEvent, Array($ID, &$arFields));
if ($bSearchIndex && CModule::IncludeModule("search"))
{
$newPostPerms = CBlogUserGroup::GetGroupPerms(1, $arNewPost["BLOG_ID"], $ID, BLOG_PERMS_POST);
$arBlog = CBlog::GetByID($arNewPost["BLOG_ID"]);
if (
$arOldPost["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH &&
$oldPostPerms >= BLOG_PERMS_READ
&& (
$arNewPost["PUBLISH_STATUS"] != BLOG_PUBLISH_STATUS_PUBLISH ||
$newPostPerms < BLOG_PERMS_READ
)
|| $arBlog["SEARCH_INDEX"] != "Y"
)
{
CSearch::Index("blog", "P".$ID,
array(
"TITLE" => "",
"BODY" => ""
)
);
CSearch::DeleteIndex("blog", false, "COMMENT", $arBlog["ID"]."|".$ID);
}
elseif (
$arNewPost["DATE_PUBLISHED"] == "Y"
&& $arNewPost["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH
&& $newPostPerms >= BLOG_PERMS_READ
&& $arBlog["SEARCH_INDEX"] == "Y"
)
{
$tag = "";
$arGroup = CBlogGroup::GetByID($arBlog["GROUP_ID"]);
if(strlen($arFields["PATH"]) > 0)
{
$arPostSite = array($arGroup["SITE_ID"] => $arFields["PATH"]);
}
elseif(strlen($arNewPost["PATH"]) > 0)
{
$arNewPost["PATH"] = (
strlen($arNewPost["CODE"]) > 0
? str_replace("#post_id#", $arNewPost["CODE"], $arNewPost["PATH"])
: str_replace("#post_id#", $ID, $arNewPost["PATH"])
);
$arPostSite = array($arGroup["SITE_ID"] => $arNewPost["PATH"]);
}
else
{
$arPostSite = array(
$arGroup["SITE_ID"] => CBlogPost::PreparePath(
$arBlog["URL"],
$arNewPost["ID"],
$arGroup["SITE_ID"],
false,
$arBlog["OWNER_ID"],
$arBlog["SOCNET_GROUP_ID"]
)
);
}
if (
$arBlog["USE_SOCNET"] == "Y"
&& CModule::IncludeModule("extranet")
)
{
示例7: 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"],
//.........这里部分代码省略.........
示例8: 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']);
示例9: GetMessage
</td>
</tr>
<tr valign=top>
<td nowrap valign="top" align="right" class="blogtablehead">
<font class="blogheadtext">
<font color="#FF0000">*</font> <b><?php
echo GetMessage('BLOG_GRP');
?>
</b>
</font>
</td>
<td class="blogtablebody">
<select name="GROUP_ID" class="inputselect">
<?php
$val = IntVal($bVarsFromForm ? $_POST['GROUP_ID'] : ($arBlog ? $arBlog["GROUP_ID"] : 0));
$dbBlogGroup = CBlogGroup::GetList(array("NAME" => "ASC"), array("SITE_ID" => SITE_ID));
while ($arBlogGroup = $dbBlogGroup->Fetch()) {
?>
<option value="<?php
echo $arBlogGroup["ID"];
?>
"<?php
if ($val == IntVal($arBlogGroup["ID"])) {
echo " selected";
}
?>
><?php
echo htmlspecialchars($arBlogGroup["NAME"]);
?>
</option><?php
}
示例10: array
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die;
}
if (!CModule::IncludeModule("blog")) {
return;
}
$dbGroup = CBlogGroup::GetList(array("ID" => "ASC"), array("SITE_ID" => WIZARD_SITE_ID));
if ($arGroup = $dbGroup->Fetch()) {
if (WIZARD_B24_TO_CP) {
$groupID = $arGroup["ID"];
CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/index.php", array("BLOG_GROUP_ID" => $groupID));
CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/index_b24.php", array("BLOG_GROUP_ID" => $groupID));
CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/contacts/personal.php", array("BLOG_GROUP_ID" => $groupID));
CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/workgroups/index.php", array("BLOG_GROUP_ID" => $groupID));
}
return;
}
CBlogSitePath::Add(array("SITE_ID" => WIZARD_SITE_ID, "PATH" => WIZARD_SITE_DIR . "contacts/personal/user/#user_id#/blog/", "TYPE" => "B"));
CBlogSitePath::Add(array("SITE_ID" => WIZARD_SITE_ID, "PATH" => WIZARD_SITE_DIR . "contacts/personal/user/#user_id#/blog/#post_id#/", "TYPE" => "P"));
CBlogSitePath::Add(array("SITE_ID" => WIZARD_SITE_ID, "PATH" => WIZARD_SITE_DIR . "contacts/personal/user/#user_id#/", "TYPE" => "U"));
CBlogSitePath::Add(array("SITE_ID" => WIZARD_SITE_ID, "PATH" => WIZARD_SITE_DIR . "workgroups/group/#group_id#/blog/", "TYPE" => "G"));
CBlogSitePath::Add(array("SITE_ID" => WIZARD_SITE_ID, "PATH" => WIZARD_SITE_DIR . "workgroups/group/#group_id#/blog/#post_id#/", "TYPE" => "H"));
$groupID = CBlogGroup::Add(array("SITE_ID" => WIZARD_SITE_ID, "NAME" => GetMessage("BLOG_SOCNET_GROUP_EXTRANET_NAME")));
CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/index.php", array("BLOG_GROUP_ID" => $groupID));
CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/index_b24.php", array("BLOG_GROUP_ID" => $groupID));
CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/contacts/personal.php", array("BLOG_GROUP_ID" => $groupID));
CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/workgroups/index.php", array("BLOG_GROUP_ID" => $groupID));
示例11: 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 />";
示例12: array
else
{
if ($arParams['BLOG_FROM_AJAX'] === 'N')
{
$fields = array(
'SITE_ID' => SITE_ID,
'NAME' => GetMessage('IBLOCK_CSC_BLOG_GROUP_NAME')
);
$blogGroupIterator = CBlogGroup::GetList(array(), $fields, false, false, array('ID'));
if ($blogGroup = $blogGroupIterator->Fetch())
{
$blogGroupID = (int)$blogGroup['ID'];
}
else
{
$blogGroupID = (int)CBlogGroup::Add($fields);
if ($blogGroupID == 0)
{
if ($ex = $APPLICATION->GetException())
$arResult["ERRORS"][] = $ex->GetString();
else
$arResult["ERRORS"][] = GetMessage("IBLOCK_CSC_BLOG_GROUP_CREATE_ERROR");
}
}
unset($fields);
if ($blogGroupID > 0)
{
if (!$blogExist)
{
$fields = array(
"NAME" => GetMessage("IBLOCK_CSC_BLOG_NAME"),
示例13: GetMessage
}
}
}
}
if ($arParams["SET_TITLE"] == "Y") {
if (!empty($arBlog)) {
$APPLICATION->SetTitle(str_replace("#BLOG#", $arBlog["NAME"], GetMessage('BLOG_TOP_TITLE')));
} else {
$APPLICATION->SetTitle(GetMessage('BLOG_NEW_BLOG'));
}
}
$arFilterGroup = array("SITE_ID" => SITE_ID);
if (!empty($arParams["GROUP_ID"])) {
$arFilterGroup["ID"] = $arParams["GROUP_ID"];
}
$dbBlogGroup = CBlogGroup::GetList(array("NAME" => "ASC"), $arFilterGroup);
$arBlogGroupTmp = array();
while ($arBlogGroup = $dbBlogGroup->GetNext()) {
if ($arBlogGroup["ID"] == $arResult["BLOG"]["GROUP_ID"]) {
$arBlogGroup["SELECTED"] = "Y";
}
$arBlogGroupTmp[] = $arBlogGroup;
}
$arResult["GROUP"] = $arBlogGroupTmp;
$arResult["AUTO_GROUPS"] = array();
if (!empty($arBlog)) {
$arResult["AUTO_GROUPS"] = unserialize($arBlog["AUTO_GROUPS"]);
}
if (!empty($arBlog)) {
$res = CBlogUserGroup::GetList(array("NAME" => "ASC"), array("BLOG_ID" => $arBlog["ID"]), array("ID", "NAME", "BLOG_ID", "COUNT" => "USER2GROUP_ID"));
while ($arGroup = $res->Fetch()) {
示例14: 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 {
示例15: 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;
}