本文整理匯總了PHP中CBlogPost::AddSocNetPerms方法的典型用法代碼示例。如果您正苦於以下問題:PHP CBlogPost::AddSocNetPerms方法的具體用法?PHP CBlogPost::AddSocNetPerms怎麽用?PHP CBlogPost::AddSocNetPerms使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CBlogPost
的用法示例。
在下文中一共展示了CBlogPost::AddSocNetPerms方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Add
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 (!CBlogPost::CheckFields("ADD", $arFields))
return false;
elseif(!$GLOBALS["USER_FIELD_MANAGER"]->CheckFields("BLOG_POST", 0, $arFields))
return false;
foreach(GetModuleEvents("blog", "OnBeforePostAdd", true) as $arEvent)
{
if (ExecuteModuleEventEx($arEvent, Array(&$arFields))===false)
return false;
}
if (
array_key_exists("ATTACH_IMG", $arFields)
&& is_array($arFields["ATTACH_IMG"])
&& (
!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);
$arInsert = $DB->PrepareInsert("b_blog_post", $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_post(".$arInsert[0].") ".
"VALUES(".$arInsert[1].")";
$DB->Query($strSql, False, "File: ".__FILE__."<br>Line: ".__LINE__);
$ID = IntVal($DB->LastID());
foreach(GetModuleEvents("blog", "OnBeforePostUserFieldUpdate", true) as $arEvent)
ExecuteModuleEventEx($arEvent, Array("BLOG_POST", $ID, $arFields));
$GLOBALS["USER_FIELD_MANAGER"]->Update("BLOG_POST", $ID, $arFields);
}
if ($ID)
{
$arPost = CBlogPost::GetByID($ID);
CBlog::SetStat($arPost["BLOG_ID"]);
CBlogPost::SetPostPerms($ID, $arFields["PERMS_POST"], BLOG_PERMS_POST);
CBlogPost::SetPostPerms($ID, $arFields["PERMS_COMMENT"], BLOG_PERMS_COMMENT);
$arFields["SC_PERM"] = Array();
if(array_key_exists("SOCNET_RIGHTS", $arFields))
$arFields["SC_PERM"] = CBlogPost::AddSocNetPerms($ID, $arFields["SOCNET_RIGHTS"], $arPost);
foreach(GetModuleEvents("blog", "OnPostAdd", true) as $arEvent)
ExecuteModuleEventEx($arEvent, Array($ID, &$arFields));
if (CModule::IncludeModule("search"))
{
if ($arPost["DATE_PUBLISHED"] == "Y"
&& $arPost["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH
&& CBlogUserGroup::GetGroupPerms(1, $arPost["BLOG_ID"], $ID, BLOG_PERMS_POST) >= BLOG_PERMS_READ)
{
$tag = "";
$arBlog = CBlog::GetByID($arPost["BLOG_ID"]);
if($arBlog["SEARCH_INDEX"] == "Y")
{
$arGroup = CBlogGroup::GetByID($arBlog["GROUP_ID"]);
if(strlen($arFields["PATH"]) > 0)
{
$arFields["PATH"] = (
//.........這裏部分代碼省略.........