本文整理汇总了PHP中CBlogPost::getSocNetPostPerms方法的典型用法代码示例。如果您正苦于以下问题:PHP CBlogPost::getSocNetPostPerms方法的具体用法?PHP CBlogPost::getSocNetPostPerms怎么用?PHP CBlogPost::getSocNetPostPerms使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBlogPost
的用法示例。
在下文中一共展示了CBlogPost::getSocNetPostPerms方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: canRead
/**
* @param $userId
* @return bool
*/
public function canRead($userId)
{
if ($this->canRead !== null) {
return $this->canRead;
}
if (!Loader::includeModule('socialnetwork')) {
return false;
}
$cacheTtl = 2592000;
$cacheId = 'blog_post_socnet_general_' . $this->entityId . '_' . LANGUAGE_ID;
$timezoneOffset = \CTimeZone::getOffset();
if ($timezoneOffset != 0) {
$cacheId .= "_" . $timezoneOffset;
}
$cacheDir = '/blog/socnet_post/gen/' . intval($this->entityId / 100) . '/' . $this->entityId;
$cache = new \CPHPCache();
if ($cache->initCache($cacheTtl, $cacheId, $cacheDir)) {
$post = $cache->getVars();
} else {
$cache->startDataCache();
$queryPost = \CBlogPost::getList(array(), array("ID" => $this->entityId), false, false, array("ID", "BLOG_ID", "PUBLISH_STATUS", "TITLE", "AUTHOR_ID", "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"));
$post = $queryPost->fetch();
$cache->endDataCache($post);
}
if (!$post) {
$this->canRead = false;
return false;
}
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
$this->canRead = \CBlogPost::getSocNetPostPerms($this->entityId, true, $userId, $post["AUTHOR_ID"]) >= BLOG_PERMS_READ;
return $this->canRead;
}