本文整理汇总了PHP中CBlogPost::GetSocNetPermsCode方法的典型用法代码示例。如果您正苦于以下问题:PHP CBlogPost::GetSocNetPermsCode方法的具体用法?PHP CBlogPost::GetSocNetPermsCode怎么用?PHP CBlogPost::GetSocNetPermsCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBlogPost
的用法示例。
在下文中一共展示了CBlogPost::GetSocNetPermsCode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
}
if (!empty($arUsers2Notify)) {
$arFieldsIM = array("TYPE" => "SHARE2USERS", "TITLE" => htmlspecialcharsback($arPost["TITLE"]), "URL" => CComponentEngine::MakePathFromTemplate(htmlspecialcharsBack($arParams["PATH_TO_POST"]), array("post_id" => $arParams["ID"], "user_id" => $arPost["AUTHOR_ID"])), "ID" => $arParams["ID"], "FROM_USER_ID" => $user_id, "TO_USER_ID" => $arUsers2Notify);
CBlogPost::NotifyIm($arFieldsIM);
}
}
/* update socnet log rights*/
$dbRes = CSocNetLog::GetList(array("ID" => "DESC"), array("EVENT_ID" => array("blog_post", "blog_post_important"), "SOURCE_ID" => $arPost["ID"]), false, false, array("ID", "ENTITY_TYPE", "ENTITY_ID"));
if ($arRes = $dbRes->Fetch()) {
$arLogSites = array();
$rsLogSite = CSocNetLog::GetSite($arRes["ID"]);
while ($arLogSite = $rsLogSite->Fetch()) {
$arLogSites[] = $arLogSite["LID"];
}
$arLogSitesNew = array_merge($arLogSitesNew, $arLogSites);
$socnetPerms = CBlogPost::GetSocNetPermsCode($arPost["ID"]);
if (!in_array("U" . $arPost["AUTHOR_ID"], $socnetPerms)) {
$socnetPerms[] = "U" . $arPost["AUTHOR_ID"];
}
$socnetPerms[] = "SA";
// socnet admin
if (in_array("AU", $socnetPerms) || in_array("G2", $socnetPerms)) {
$socnetPermsAdd = array();
foreach ($socnetPerms as $perm_tmp) {
if (preg_match('/^SG(\\d+)$/', $perm_tmp, $matches)) {
if (!in_array("SG" . $matches[1] . "_" . SONET_ROLES_USER, $socnetPerms) && !in_array("SG" . $matches[1] . "_" . SONET_ROLES_MODERATOR, $socnetPerms) && !in_array("SG" . $matches[1] . "_" . SONET_ROLES_OWNER, $socnetPerms)) {
$socnetPermsAdd[] = "SG" . $matches[1] . "_" . SONET_ROLES_USER;
}
}
}
if (count($socnetPermsAdd) > 0) {
示例2: OnSearchReindex
//.........这里部分代码省略.........
if (intVal($newBlogId) > 0) {
$arF["BLOG_ID"] = $newBlogId;
}
$arSites = array($ar["SITE_ID"]);
}
if (!empty($arF)) {
if (IntVal($arF["BLOG_ID"]) > 0) {
$Result["PARAM2"] = $ar["BLOG_ID"];
$sqlR = "UPDATE b_blog_post SET BLOG_ID=" . IntVal($arF["BLOG_ID"]) . " WHERE ID=" . IntVal($ar["ID"]);
$DB->Query($sqlR, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$sqlR = "UPDATE b_blog_post_category SET BLOG_ID=" . IntVal($arF["BLOG_ID"]) . " WHERE POST_ID=" . IntVal($ar["ID"]);
$DB->Query($sqlR, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$sqlR = "UPDATE b_blog_image SET BLOG_ID=" . IntVal($arF["BLOG_ID"]) . " WHERE POST_ID=" . IntVal($ar["ID"]);
$DB->Query($sqlR, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$sqlR = "UPDATE b_blog_comment SET BLOG_ID=" . IntVal($arF["BLOG_ID"]) . " WHERE POST_ID=" . IntVal($ar["ID"]);
$DB->Query($sqlR, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
}
$sqlR = "SELECT * FROM b_blog_socnet_rights where POST_ID=" . IntVal($ar["ID"]);
$dbBB = $DB->Query($sqlR);
if (!$dbBB->Fetch()) {
$arF["SC_PERM"] = CBlogPost::UpdateSocNetPerms($ar["ID"], $arF["SOCNET_RIGHTS"], array("AUTHOR_ID" => $ar["AUTHOR_ID"]));
}
if (IntVal($arF["BLOG_ID"]) > 0 && $ar["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH) {
$dbComment = CBlogComment::GetList(array(), array("POST_ID" => $ar["ID"]), false, false, array("ID", "POST_ID", "BLOG_ID", "PATH"));
if ($arComment = $dbComment->Fetch()) {
$arParamsComment = array("BLOG_ID" => $arF["BLOG_ID"], "POST_ID" => $ar["ID"], "SITE_ID" => $ar["SITE_ID"], "PATH" => $arPostSite[$arGroup["SITE_ID"]] . "?commentId=#comment_id###comment_id#", "USE_SOCNET" => "Y");
CBlogComment::_IndexPostComments($arParamsComment);
}
}
}
}
if ($ar["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH) {
if (empty($arF["SC_PERM"])) {
$arF["SC_PERM"] = CBlogPost::GetSocNetPermsCode($ar["ID"]);
}
$Result["PERMISSIONS"] = $arF["SC_PERM"];
if (IntVal($ar["SLID"]) <= 0) {
$arAllow = array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "TABLE" => "N", "LIST" => "N", "SMILES" => "N", "NL2BR" => "N", "VIDEO" => "N");
$text4message = $parserBlog->convert($ar["DETAIL_TEXT"], false, array(), $arAllow, array("isSonetLog" => true));
$arSoFields = array("EVENT_ID" => "blog_post", "=LOG_DATE" => $DB->CharToDateFunction($ar["DATE_PUBLISH"], "FULL", SITE_ID), "LOG_UPDATE" => $DB->CharToDateFunction($ar["DATE_PUBLISH"], "FULL", SITE_ID), "TITLE_TEMPLATE" => "#USER_NAME# add post", "TITLE" => $ar["TITLE"], "MESSAGE" => $text4message, "MODULE_ID" => "blog", "CALLBACK_FUNC" => false, "SOURCE_ID" => $ar["ID"], "ENABLE_COMMENTS" => "N", "ENTITY_TYPE" => SONET_ENTITY_USER, "ENTITY_ID" => $ar["AUTHOR_ID"], "USER_ID" => $ar["AUTHOR_ID"], "URL" => $arSite[$ar["SITE_ID"]], "SITE_ID" => $arSites);
$logID = CSocNetLog::Add($arSoFields, false);
if (intval($logID) > 0) {
$socnetPerms = $arF["SC_PERM"];
if (!in_array("U" . $ar["AUTHOR_ID"], $socnetPerms)) {
$socnetPerms[] = "U" . $ar["AUTHOR_ID"];
}
$socnetPerms[] = "SA";
// socnet admin
CSocNetLog::Update($logID, array("TMP_ID" => $logID, "=LOG_UPDATE" => $arSoFields["LOG_UPDATE"]));
CSocNetLogRights::DeleteByLogID($logID);
CSocNetLogRights::Add($logID, $socnetPerms);
}
} else {
$socnetPerms = $arF["SC_PERM"];
if (!in_array("U" . $ar["AUTHOR_ID"], $socnetPerms)) {
$socnetPerms[] = "U" . $ar["AUTHOR_ID"];
}
$socnetPerms[] = "SA";
// socnet admin
CSocNetLogRights::DeleteByLogID($ar["SLID"]);
CSocNetLogRights::Add($ar["SLID"], $socnetPerms);
}
}
}
if ($ar["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH && $ar["SEARCH_INDEX"] == "Y") {
//CBlogSearch::Trace('OnSearchReindex', 'Result', $Result);
示例3: 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"))
//.........这里部分代码省略.........