本文整理汇总了PHP中CBlogPost类的典型用法代码示例。如果您正苦于以下问题:PHP CBlogPost类的具体用法?PHP CBlogPost怎么用?PHP CBlogPost使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CBlogPost类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: CallBack_AddComment
public static function CallBack_AddComment($arFields)
{
if (!CModule::IncludeModule('blog')) {
return false;
}
$arResult = array();
$arLog = CSocNetLog::GetList(array("ID" => "DESC"), array("TMP_ID" => $arFields["LOG_ID"]), false, false, array("ID", "SOURCE_ID", "SITE_ID", "RATING_ENTITY_ID"))->Fetch();
if ($arLog) {
$arIdeaPost = CBlogPost::GetById($arLog["SOURCE_ID"]);
if ($arIdeaPost) {
$UserIP = CBlogUser::GetUserIP();
$IdeaCommentId = CBlogComment::Add(array("BLOG_ID" => $arIdeaPost["BLOG_ID"], "POST_ID" => $arIdeaPost["ID"], "AUTHOR_ID" => $arFields["USER_ID"], "POST_TEXT" => $arFields["MESSAGE"], "DATE_CREATE" => ConvertTimeStamp(time() + CTimeZone::GetOffset(), "FULL"), "PARENT_ID" => false, "AUTHOR_IP" => $UserIP[0], "AUTHOR_IP1" => $UserIP[1]));
$arResult = array("SOURCE_ID" => $IdeaCommentId);
if ($arLog["RATING_ENTITY_ID"] > 0) {
$arResult["RATING_TYPE_ID"] = "BLOG_COMMENT";
$arResult["RATING_ENTITY_ID"] = $IdeaCommentId;
}
if (intval($IdeaCommentId) == 0) {
global $APPLICATION;
if ($ex = $APPLICATION->GetException()) {
$arResult["ERROR"] = $ex->GetString();
}
} else {
//clear cache on succcess
BXClearCache(True, "/" . SITE_ID . "/idea/" . $arIdeaPost["BLOG_ID"] . "/first_page/");
BXClearCache(True, "/" . SITE_ID . "/idea/" . $arIdeaPost["BLOG_ID"] . "/pages/");
BXClearCache(True, "/" . SITE_ID . "/idea/" . $arIdeaPost["BLOG_ID"] . "/comment/" . $arIdeaPost["ID"] . "/");
BXClearCache(True, "/" . SITE_ID . "/idea/" . $arIdeaPost["BLOG_ID"] . "/post/" . $arIdeaPost["ID"] . "/");
}
}
}
return $arResult;
}
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:33,代码来源:idea_sonet_notify.php
示例3: AddBlogPost
public static function AddBlogPost($arFields)
{
if (!is_array($_POST)) {
$_POST = array();
}
$_POST = array_merge($_POST, array("apply" => "Y", "decode" => "N"), $arFields);
$strPathToPost = COption::GetOptionString("socialnetwork", "userblogpost_page", false, SITE_ID);
$strPathToSmile = COption::GetOptionString("socialnetwork", "smile_page", false, SITE_ID);
$BlogGroupID = COption::GetOptionString("socialnetwork", "userbloggroup_id", false, SITE_ID);
$arBlogComponentParams = array("IS_REST" => "Y", "ID" => "new", "PATH_TO_POST" => $strPathToPost, "PATH_TO_SMILE" => $strPathToSmile, "GROUP_ID" => $BlogGroupID, "USER_ID" => $GLOBALS["USER"]->GetID(), "USE_SOCNET" => "Y", "MICROBLOG" => "Y");
ob_start();
$result = $GLOBALS["APPLICATION"]->IncludeComponent("bitrix:socialnetwork.blog.post.edit", "", $arBlogComponentParams, false, array("HIDE_ICONS" => "Y"));
ob_end_clean();
if (!$result) {
throw new Exception('Error');
} else {
if (isset($arFields["FILES"]) && \Bitrix\Main\Config\Option::get('disk', 'successfully_converted', false) && CModule::includeModule('disk') && ($storage = \Bitrix\Disk\Driver::getInstance()->getStorageByUserId($GLOBALS["USER"]->GetID())) && ($folder = $storage->getFolderForUploadedFiles($GLOBALS["USER"]->GetID()))) {
// upload to storage
$arResultFile = array();
foreach ($arFields["FILES"] as $tmp) {
$arFile = CRestUtil::saveFile($tmp);
if (is_array($arFile)) {
$file = $folder->uploadFile($arFile, array('NAME' => $arFile["name"], 'CREATED_BY' => $GLOBALS["USER"]->GetID()), array(), true);
if ($file) {
$arResultFile[] = \Bitrix\Disk\Uf\FileUserType::NEW_FILE_PREFIX . $file->getId();
}
}
}
if (!empty($arResultFile)) {
CBlogPost::Update($result, array("HAS_PROPS" => "Y", "UF_BLOG_POST_FILE" => $arResultFile));
}
}
return $result;
}
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:35,代码来源:rest.php
示例4: 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
示例5: checkUserReadAccess
/**
* Returns true if current user has read access to the blog post.
* @param array $params Allowed keys: postId, userId.
* @param int $userId Current user's id.
* @return bool
*/
public static function checkUserReadAccess(array $params, $userId)
{
if (!Loader::includeModule('blog')) {
return false;
}
$permissions = \CBlogPost::GetSocNetPostPerms($params['postId'], true, $userId);
return $permissions >= BLOG_PERMS_READ;
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:14,代码来源:post.php
示例6: 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 (!CBlogTrackback::CheckFields("ADD", $arFields))
return false;
$arInsert = $DB->PrepareInsert("b_blog_trackback", $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_trackback(".$arInsert[0].") ".
"VALUES(".$arInsert[1].")";
$DB->Query($strSql, False, "File: ".__FILE__."<br>Line: ".__LINE__);
$ID = IntVal($DB->LastID());
}
if ($ID)
{
$arTrackback = CBlogTrackback::GetByID($ID);
CBlogPost::Update($arTrackback["POST_ID"], array("=NUM_TRACKBACKS" => "NUM_TRACKBACKS + 1"));
}
return $ID;
}
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:48,代码来源:blog_trackback.php
示例7: __AutoSetPerms
function __AutoSetPerms($ID)
{
$ID = IntVal($ID);
$arGroupPerms = CBlogUserGroupPerms::GetByID($ID);
if (IntVal($arGroupPerms["POST_ID"]) == 0) {
$dbBlogPosts = CBlogPost::GetList(array(), array("BLOG_ID" => $arGroupPerms["BLOG_ID"]), false, false, array("ID"));
while ($arBlogPosts = $dbBlogPosts->Fetch()) {
$dbGroupPerms1 = CBlogUserGroupPerms::GetList(array(), array("BLOG_ID" => $arGroupPerms["BLOG_ID"], "USER_GROUP_ID" => $arGroupPerms["USER_GROUP_ID"], "PERMS_TYPE" => $arGroupPerms["PERMS_TYPE"], "POST_ID" => $arBlogPosts["ID"]), false, false, array("ID", "AUTOSET", "PERMS"));
if ($arGroupPerms1 = $dbGroupPerms1->Fetch()) {
if ($arGroupPerms1["AUTOSET"] == "Y" && $arGroupPerms["PERMS"] != $arGroupPerms1["PERMS"]) {
CBlogUserGroupPerms::Update($arGroupPerms1["ID"], array("PERMS" => $arGroupPerms["PERMS"]));
}
} else {
CBlogUserGroupPerms::Add(array("BLOG_ID" => $arGroupPerms["BLOG_ID"], "USER_GROUP_ID" => $arGroupPerms["USER_GROUP_ID"], "PERMS_TYPE" => $arGroupPerms["PERMS_TYPE"], "POST_ID" => $arBlogPosts["ID"], "PERMS" => $arGroupPerms["PERMS"], "AUTOSET" => "Y"));
}
}
}
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:18,代码来源:blog_user_group_perms.php
示例8: prepareData
protected function prepareData()
{
if (strlen(trim($this->arParams["NAME_TEMPLATE"])) <= 0) {
$this->arParams["NAME_TEMPLATE"] = \CSite::GetNameFormat();
}
$dbPost = \CBlogPost::GetList(array(), array("ID" => $this->arParams["postId"]), false, false, array("ID", "BLOG_ID", "PUBLISH_STATUS", "TITLE", "AUTHOR", "ENABLE_COMMENTS", "NUM_COMMENTS", "VIEWS", "CODE", "MICRO", "DETAIL_TEXT", "DATE_PUBLISH", "CATEGORY_ID", "HAS_SOCNET_ALL", "HAS_TAGS", "HAS_IMAGES", "HAS_PROPS", "HAS_COMMENT_IMAGES"));
if ($arPost = $dbPost->Fetch()) {
if (strlen($arPost['TITLE']) > 30) {
$arPost['TITLE'] = substr($arPost['TITLE'], 0, 30) . "...";
}
$this->arResult['POST'] = $arPost;
$this->arResult['POST']['PUBLISH_STATUS_DESCRIPTION'] = Loc::getMessage('BLOG_POST_PUBLISH_STATUS_' . $arPost['PUBLISH_STATUS']);
$this->arResult['POST']['AUTHOR_FORMATTED_NAME'] = \CUser::FormatName($this->arParams['NAME_TEMPLATE'], array('LOGIN' => $this->arResult['POST']['LOGIN'], 'NAME' => $this->arResult['POST']['NAME'], 'LAST_NAME' => $this->arResult['POST']['LAST_NAME']), true, false);
$this->arResult["POST"]['AUTHOR_PROFILE'] = \CComponentEngine::MakePathFromTemplate($this->arParams["PATH_TO_USER_PROFILE"], array("user_id" => $this->arResult['POST']['AUTHOR']));
$this->arResult["POST"]['AUTHOR_UNIQID'] = 'u_' . $this->randString();
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS['CACHE_MANAGER']->RegisterTag('blog_post_' . $this->arParams['postId']);
}
}
}
开发者ID:webgksupport,项目名称:alpina,代码行数:20,代码来源:class.php
示例9: Execute
public function Execute()
{
global $DB;
if (!CModule::IncludeModule("socialnetwork") || !CModule::IncludeModule("blog")) {
return CBPActivityExecutionStatus::Closed;
}
$rootActivity = $this->GetRootActivity();
$documentId = $rootActivity->GetDocumentId();
$siteId = $this->PostSite ? $this->PostSite : SITE_ID;
$ownerId = CBPHelper::ExtractUsers($this->OwnerId, $documentId, true);
$pathToPost = COption::GetOptionString("socialnetwork", "userblogpost_page", false, $siteId);
$pathToSmile = COption::GetOptionString("socialnetwork", "smile_page", false, $siteId);
$blogGroupID = COption::GetOptionString("socialnetwork", "userbloggroup_id", false, $siteId);
$blog = CBlog::GetByOwnerID($ownerId);
if (!$blog) {
$blog = $this->createBlog($ownerId, $blogGroupID, $siteId);
}
$micro = 'N';
$title = trim($this->PostTitle);
if (!$title) {
$micro = 'Y';
$title = trim(preg_replace(array("/\n+/is" . BX_UTF_PCRE_MODIFIER, '/\\s+/is' . BX_UTF_PCRE_MODIFIER), " ", blogTextParser::killAllTags($this->PostMessage)));
}
try {
$postFields = array('TITLE' => $title, 'DETAIL_TEXT' => $this->PostMessage, 'DETAIL_TEXT_TYPE' => $this->PostMessageType == 'html' ? 'html' : 'text', '=DATE_PUBLISH' => $DB->CurrentTimeFunction(), 'PUBLISH_STATUS' => BLOG_PUBLISH_STATUS_PUBLISH, 'CATEGORY_ID' => '', 'PATH' => CComponentEngine::MakePathFromTemplate($pathToPost, array("post_id" => "#post_id#", "user_id" => $ownerId)), 'URL' => $blog['URL'], 'PERMS_POST' => array(), 'PERMS_COMMENT' => array(), 'MICRO' => $micro, 'SOCNET_RIGHTS' => $this->getSocnetRights($this->UsersTo), '=DATE_CREATE' => $DB->CurrentTimeFunction(), 'AUTHOR_ID' => $ownerId, 'BLOG_ID' => $blog['ID'], "HAS_IMAGES" => "N", "HAS_TAGS" => "N", "HAS_PROPS" => "N", "HAS_SOCNET_ALL" => "N");
if (!empty($postFields["SOCNET_RIGHTS"]) && count($postFields["SOCNET_RIGHTS"]) == 1 && in_array("UA", $postFields["SOCNET_RIGHTS"])) {
$postFields['HAS_SOCNET_ALL'] = 'Y';
}
$newId = CBlogPost::add($postFields);
$postFields["ID"] = $newId;
$arParamsNotify = array("bSoNet" => true, "UserID" => $ownerId, "allowVideo" => COption::GetOptionString("blog", "allow_video", "Y"), "PATH_TO_SMILE" => $pathToSmile, "PATH_TO_POST" => $pathToPost, "SOCNET_GROUP_ID" => $blogGroupID, "user_id" => $ownerId, "NAME_TEMPLATE" => CSite::GetNameFormat(false));
CBlogPost::Notify($postFields, $blog, $arParamsNotify);
BXClearCache(true, "/" . $siteId . "/blog/last_messages_list/");
$arFieldsIM = array("TYPE" => "POST", "TITLE" => $postFields["TITLE"], "URL" => CComponentEngine::MakePathFromTemplate($pathToPost, array("post_id" => $newId, "user_id" => $ownerId)), "ID" => $newId, "FROM_USER_ID" => $ownerId, "TO_USER_ID" => array(), "TO_SOCNET_RIGHTS" => $postFields["SOCNET_RIGHTS"], "TO_SOCNET_RIGHTS_OLD" => array());
CBlogPost::NotifyIm($arFieldsIM);
} catch (Exception $e) {
$this->WriteToTrackingService($e->getMessage());
}
return CBPActivityExecutionStatus::Closed;
}
开发者ID:webgksupport,项目名称:alpina,代码行数:40,代码来源:socnetblogpostactivity.php
示例10: UnBind
public function UnBind()
{
if (!$this->IsAvailable()) {
return false;
}
//Comment doesn't exists
$arComment = $this->Get();
if (!$arComment) {
return false;
}
$arIdea = CBlogPost::GetList(array(), array("ID" => $arComment["POST_ID"]), false, false, array("ID", CIdeaManagment::UFAnswerIdField))->Fetch();
if ($arIdea) {
if (!is_array($arIdea[CIdeaManagment::UFAnswerIdField])) {
$arIdea[CIdeaManagment::UFAnswerIdField] = array();
}
$arIdea[CIdeaManagment::UFAnswerIdField] = array_unique($arIdea[CIdeaManagment::UFAnswerIdField]);
$key = array_search($arComment["ID"], $arIdea[CIdeaManagment::UFAnswerIdField]);
if (is_numeric($key)) {
unset($arIdea[CIdeaManagment::UFAnswerIdField][$key], $arIdea["ID"]);
return CBlogPost::Update($arComment["POST_ID"], $arIdea) > 0;
}
}
return false;
}
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:24,代码来源:idea_idea_comment.php
示例11: ShowError
}
if (!CModule::IncludeModule("blog")) {
ShowError(GetMessage("BLOG_MODULE_NOT_INSTALL"));
return;
}
if (!CModule::IncludeModule('idea')) {
ShowError(GetMessage("IDEA_MODULE_NOT_INSTALL"));
return;
}
if (strlen($arParams["BLOG_URL"]) == 0) {
return;
}
$arResult = array();
$obCache = new CPHPCache();
$life_time = 60 * 60 * 24;
//1 day
$cache_id = 'idea_statistic_list_' . $arParams["BLOG_URL"];
$cache_path = '/' . SITE_ID . '/idea/statistic_list/';
if ($obCache->StartDataCache($life_time, $cache_id, $cache_path)) {
$arResult = CIdeaManagment::getInstance()->Idea()->GetStatusList();
if ($arCurBlog = CBlog::GetByUrl($arParams["BLOG_URL"])) {
$dbPosts = CBlogPost::GetList(array(), array("BLOG_ID" => $arCurBlog["ID"], "PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH), false, false, array("ID", "UF_STATUS"));
while ($arPost = $dbPosts->Fetch()) {
$arResult[intval($arPost["UF_STATUS"])]["CNT"]++;
}
}
$obCache->EndDataCache($arResult);
} else {
$arResult = $obCache->GetVars();
}
$this->IncludeComponentTemplate();
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php
示例12: SetFeaturePermissions
function SetFeaturePermissions($entity_type, $entity_id, $feature, $operation, $new_perm)
{
if (substr($operation, 0, 4) == "view") {
if (CModule::IncludeModule('search')) {
global $arSonetFeaturesPermsCache;
unset($arSonetFeaturesPermsCache[$entity_type . "_" . $entity_id]);
$arGroups = CSocNetSearch::GetSearchGroups($entity_type, $entity_id, $feature, $operation);
$arParams = CSocNetSearch::GetSearchParams($entity_type, $entity_id, $feature, $operation);
CSearch::ChangePermission(false, $arGroups, false, false, false, false, $arParams);
}
}
if ($feature == "blog" && in_array($operation, array("view_post", "view_comment")) && CModule::IncludeModule('blog')) {
if ($operation == "view_post") {
CBlogPost::ChangeSocNetPermission($entity_type, $entity_id, $operation);
}
if ($operation == "view_post") {
$arPost = CBlogPost::GetSocNetPostsPerms($entity_type, $entity_id);
foreach ($arPost as $id => $perms) {
CSearch::ChangePermission("blog", $perms["PERMS"], "P" . $id);
}
} else {
$arTmpCache = array();
$arPost = CBlogPost::GetSocNetPostsPerms($entity_type, $entity_id);
$dbComment = CBlogComment::GetSocNetPostsPerms($entity_type, $entity_id);
while ($arComment = $dbComment->Fetch()) {
if (!empty($arPost[$arComment["POST_ID"]])) {
if (empty($arPost[$arComment["POST_ID"]]["PERMS_CALC"])) {
$arPost[$arComment["POST_ID"]]["PERMS_CALC"] = array();
if (is_array($arPost[$arComment["POST_ID"]]["PERMS_FULL"]) && !empty($arPost[$arComment["POST_ID"]]["PERMS_FULL"])) {
foreach ($arPost[$arComment["POST_ID"]]["PERMS_FULL"] as $e => $v) {
if (in_array($v["TYPE"], array("SG", "U"))) {
$type = $v["TYPE"] == "SG" ? "G" : "U";
if (array_key_exists($type . $v["ID"], $arTmpCache)) {
$spt = $arTmpCache[$type . $v["ID"]];
} else {
$spt = CBlogPost::GetSocnetGroups($type, $v["ID"], "view_comment");
$arTmpCache[$type . $v["ID"]] = $spt;
}
foreach ($spt as $vv) {
if (!in_array($vv, $arPost[$arComment["POST_ID"]]["PERMS_CALC"])) {
$arPost[$arComment["POST_ID"]]["PERMS_CALC"][] = $vv;
}
}
} else {
$arPost[$arComment["POST_ID"]]["PERMS_CALC"][] = $e;
}
}
}
}
CSearch::ChangePermission("blog", $arPost[$arComment["POST_ID"]]["PERMS_CALC"], "C" . $arComment["ID"]);
}
}
}
}
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:55,代码来源:search.php
示例13: array
}
$arFieldsHave = array();
if ($arPost["HAS_IMAGES"] == "") {
$arFieldsHave["HAS_IMAGES"] = $bHasImg ? "Y" : "N";
}
if ($arPost["HAS_TAGS"] == "") {
$arFieldsHave["HAS_TAGS"] = $bHasTag ? "Y" : "N";
}
if ($arPost["HAS_PROPS"] == "") {
$arFieldsHave["HAS_PROPS"] = $bHasProps ? "Y" : "N";
}
if ($arPost["HAS_SOCNET_ALL"] == "") {
$arFieldsHave["HAS_SOCNET_ALL"] = $bHasOnlyAll ? "Y" : "N";
}
if (!empty($arFieldsHave)) {
CBlogPost::Update($arPost["ID"], $arFieldsHave);
}
if ($bAll || $arPost["HAS_SOCNET_ALL"] == "Y") {
$arResult["Post"]["HAVE_ALL_IN_ADR"] = "Y";
}
if ($arParams["CACHE_TIME"] > 0) {
$arCacheData = array("templateCachedData" => $this->GetTemplateCachedData(), "Post" => $arResult["Post"], "images" => $arResult["images"], "Category" => $arResult["Category"], "GRATITUDE" => $arResult["GRATITUDE"], "POST_PROPERTIES" => $arResult["POST_PROPERTIES"], "arUser" => $arResult["arUser"]);
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->EndTagCache();
}
$cache->EndDataCache($arCacheData);
}
}
$arResult["arUser"]["urlToPostImportant"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_POST_IMPORTANT"], array("user_id" => $arPost["AUTHOR_ID"]));
$arResult["CanComment"] = $GLOBALS["USER"]->IsAuthorized();
$arResult["dest_users"] = array();
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php
示例14: array
$arParams["POST_ID"] = CBlogPost::GetID($arParams["POST_ID"], $arBlog["ID"]);
$arPost = CBlogPost::GetByID($arParams["POST_ID"]);
}
if (!empty($arBlog) && $arBlog["ACTIVE"] == "Y" && $arBlog["ENABLE_RSS"] == "Y" && !empty($arPost) && $arPost["ENABLE_COMMENTS"] == "Y" && $arPost["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH) {
$arGroup = CBlogGroup::GetByID($arBlog["GROUP_ID"]);
if ($arGroup["SITE_ID"] == SITE_ID) {
if ($arParams["RSS1"] == "Y") {
$arResult[] = array("type" => "rss1", "name" => GetMessage("BRL_C") . "RSS .92", "url" => CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_POST_RSS"], array("blog" => $arBlog["URL"], "type" => "rss1", "user_id" => $arBlog["OWNER_ID"], "group_id" => $arParams["SOCNET_GROUP_ID"], "post_id" => CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arParams["ALLOW_POST_CODE"]))));
}
if ($arParams["RSS2"] == "Y") {
$arResult[] = array("type" => "rss2", "name" => GetMessage("BRL_C") . "RSS 2.0", "url" => CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_POST_RSS"], array("blog" => $arBlog["URL"], "type" => "rss2", "user_id" => $arBlog["OWNER_ID"], "group_id" => $arParams["SOCNET_GROUP_ID"], "post_id" => CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arParams["ALLOW_POST_CODE"]))));
}
if ($arParams["ATOM"] == "Y") {
$arResult[] = array("type" => "atom", "name" => GetMessage("BRL_C") . "Atom .3", "url" => CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_POST_RSS"], array("blog" => $arBlog["URL"], "type" => "atom", "user_id" => $arBlog["OWNER_ID"], "group_id" => $arParams["SOCNET_GROUP_ID"], "post_id" => CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arParams["ALLOW_POST_CODE"]))));
}
$APPLICATION->AddHeadString('<link rel="alternate" type="application/rss+xml" title="RSS" href="' . CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_POST_RSS"], array("blog" => $arBlog["URL"], "type" => "rss2", "user_id" => $arBlog["OWNER_ID"], "group_id" => $arParams["SOCNET_GROUP_ID"], "post_id" => CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arParams["ALLOW_POST_CODE"]))) . '" />');
}
}
} else {
if ($bSoNet) {
$blogOwnerID = $arParams["USER_ID"];
$arFilterblg = array("ACTIVE" => "Y", "GROUP_ID" => $arParams["PARAM_GROUP_ID"], "GROUP_SITE_ID" => SITE_ID, "USE_SOCNET" => "Y");
if ($bGroupMode) {
$arFilterblg["SOCNET_GROUP_ID"] = $arParams["SOCNET_GROUP_ID"];
} else {
$arFilterblg["OWNER_ID"] = $arParams["USER_ID"];
}
$dbBl = CBlog::GetList(array(), $arFilterblg);
$arBlog = $dbBl->Fetch();
} else {
$arBlog = CBlog::GetByUrl($arParams["BLOG_URL"], $arParams["PARAM_GROUP_ID"]);
开发者ID:rasuldev,项目名称:torino,代码行数:31,代码来源:component.php
示例15: GetSocNetUserPerms
public static function GetSocNetUserPerms($postId = 0, $authorId = 0)
{
global $APPLICATION, $USER, $AR_BLOG_PERMS, $BLOG_POST;
$userId = IntVal($USER->GetID());
$postId = IntVal($postId);
$authorId = IntVal($authorId);
if($postId <= 0)
return false;
$perms = BLOG_PERMS_DENY;
$blogModulePermissions = $APPLICATION->GetGroupRight("blog");
if($authorId > 0 && $userId == $authorId)
$perms = BLOG_PERMS_FULL;
elseif ($blogModulePermissions >= "W" || CSocNetUser::IsCurrentUserModuleAdmin())
{
end($AR_BLOG_PERMS);
$perms = key($AR_BLOG_PERMS);
reset($AR_BLOG_PERMS);
}
if($perms <= BLOG_PERMS_DENY)
{
$arPerms = CBlogPost::GetSocNetPerms($postId);
$arEntities = Array();
if (isset($BLOG_POST["UAC_CACHE_".$userId]) && !empty($BLOG_POST["UAC_CACHE_".$userId]))
{
$arEntities = $BLOG_POST["UAC_CACHE_".$userId];
}
else
{
$dbA = CAccess::GetUserCodes($userId);
while($arA = $dbA->Fetch())
{
if($arA["PROVIDER_ID"] == "intranet")
{
$arEntities["DR"][$arA["ACCESS_CODE"]] = $arA["ACCESS_CODE"];
}
elseif($arA["PROVIDER_ID"] == "socnetgroup")
{
$g = substr($arA["ACCESS_CODE"], 2);
$gId = IntVal($g);
$gR = substr($g, strpos($g, "_")+1);
$arEntities["SG"][$gId][$gR] = $gR;
}
}
$BLOG_POST["UAC_CACHE_".$userId] = $arEntities;
}
if(!empty($arEntities["DR"]) && !empty($arPerms["DR"]))
{
foreach($arPerms["DR"] as $id => $val)
{
if(isset($arEntities["DR"]["DR".$id]))
{
$perms = BLOG_PERMS_READ;
break;
}
}
}
if((!empty($arPerms["U"][$userId]) && in_array("US".$userId, $arPerms["U"][$userId])) || ($authorId >0 && $userId == $authorId)) // if author
$perms = BLOG_PERMS_FULL;
else
{
if($authorId <= 0)
{
foreach($arPerms["U"] as $id => $p)
{
if(in_array("US".$id, $p))
{
$authorId = $id;
break;
}
}
}
if(!empty($arPerms["U"][$userId]) || (!empty($arPerms["U"][$authorId]) && in_array("US".$authorId, $arPerms["U"][$authorId])) || $perms == BLOG_PERMS_READ)
{
if (CSocNetFeaturesPerms::CanPerformOperation($userId, SONET_ENTITY_USER, $authorId, "blog", "write_comment"))
$perms = BLOG_PERMS_WRITE;
elseif (CSocNetFeaturesPerms::CanPerformOperation($userId, SONET_ENTITY_USER, $authorId, "blog", "premoderate_comment"))
$perms = BLOG_PERMS_PREMODERATE;
elseif (CSocNetFeaturesPerms::CanPerformOperation($userId, SONET_ENTITY_USER, $authorId, "blog", "view_comment"))
$perms = BLOG_PERMS_READ;
}
}
if($perms <= BLOG_PERMS_FULL)
{
$arGroupsId = Array();
if(!empty($arPerms["SG"]))
{
foreach($arPerms["SG"] as $gid => $val)
{
//if(!empty($arEntities["SG"][$gid]))
$arGroupsId[] = $gid;
}
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:101,代码来源:blog_comment.php
示例16: 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
示例17: SetStatus
public function SetStatus($StatusId)
{
if (!$this->IsAvailable()) {
return false;
}
$arStatusList = $this->GetStatusList();
$arStatusListXML = $this->GetStatusList(true);
$arPost = CBlogPost::GetList(array(), array("ID" => $this->IdeaId), false, false, array("ID", CIdeaManagment::UFStatusField))->Fetch();
$bUpdate = false;
//Get Status ID from XML List
if (array_key_exists($StatusId, $arStatusListXML)) {
$StatusId = $arStatusListXML[$StatusId]["ID"];
}
//Status Exists and not current
if (array_key_exists($StatusId, $arStatusList)) {
$bUpdate = $arPost[CIdeaManagment::UFStatusField] != $StatusId;
}
if ($arPost && $bUpdate) {
return CBlogPost::Update($this->IdeaId, array(CIdeaManagment::UFStatusField => $StatusId));
}
return false;
}
开发者ID:rasuldev,项目名称:torino,代码行数:22,代码来源:idea_idea.php
示例18: LocalRedirect
} else {
$url .= "&";
}
$url .= "del_id=" . $arParams["ID"] . "&success=Y";
LocalRedirect($url);
} else {
$arResult["ERROR_MESSAGE"] .= GetMessage("BLOG_BLOG_BLOG_MES_DEL_ERROR") . '<
|
请发表评论