本文整理汇总了PHP中RSMembershipHelper::checkContentJ16方法的典型用法代码示例。如果您正苦于以下问题:PHP RSMembershipHelper::checkContentJ16方法的具体用法?PHP RSMembershipHelper::checkContentJ16怎么用?PHP RSMembershipHelper::checkContentJ16使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RSMembershipHelper
的用法示例。
在下文中一共展示了RSMembershipHelper::checkContentJ16方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkContent
function checkContent(&$has_access, &$found_shared, &$redirect, $memberships, $extras)
{
if (RSMembershipHelper::isJ16()) {
return RSMembershipHelper::checkContentJ16($has_access, $found_shared, $redirect, $memberships, $extras);
}
// Get the database object
$db =& JFactory::getDBO();
$shared = RSMembershipHelper::getShared(array('article', 'category', 'section'));
$view = JRequest::getVar('view');
$id = JRequest::getInt('id');
if ($view == 'article') {
// Must check if it belongs to a category or section that we are sharing
$db->setQuery("SELECT `sectionid`, `catid` FROM #__content WHERE `id`='" . $id . "'");
$content = $db->loadObject();
foreach ($shared as $share) {
$what = isset($share->membership_id) ? 'membership_id' : 'extra_value_id';
$where = isset($share->membership_id) ? $memberships : $extras;
$table = isset($share->membership_id) ? '#__rsmembership_memberships' : '#__rsmembership_extra_values';
if ($share->type == 'article' && $share->params == $id || $share->type == 'category' && $share->params == $content->catid || $share->type == 'section' && $share->params == $content->sectionid) {
$found_shared = true;
// Found a membership that shares this article
if (!empty($where) && in_array($share->{$what}, $where)) {
$has_access = true;
break;
} else {
// Get the redirect page
$db->setQuery("SELECT `share_redirect` FROM " . $table . " WHERE `id`='" . $share->{$what} . "'");
$redirect = $db->loadResult();
}
}
}
} elseif ($view == 'category') {
// Must check if it belongs to a category or section that we are sharing
$db->setQuery("SELECT `section` FROM #__categories WHERE `id`='" . $id . "'");
$sectionid = $db->loadResult();
foreach ($shared as $share) {
$what = isset($share->membership_id) ? 'membership_id' : 'extra_value_id';
$where = isset($share->membership_id) ? $memberships : $extras;
$table = isset($share->membership_id) ? '#__rsmembership_memberships' : '#__rsmembership_extra_values';
if ($share->type == 'category' && $share->params == $id || $share->type == 'section' && $share->params == $sectionid) {
$found_shared = true;
// Found a membership that shares this category
if (!empty($where) && in_array($share->{$what}, $where)) {
$has_access = true;
break;
} else {
// Get the redirect page
$db->setQuery("SELECT `share_redirect` FROM " . $table . " WHERE `id`='" . $share->{$what} . "'");
$redirect = $db->loadResult();
}
}
}
} elseif ($view == 'section') {
foreach ($shared as $share) {
$what = isset($share->membership_id) ? 'membership_id' : 'extra_value_id';
$where = isset($share->membership_id) ? $memberships : $extras;
$table = isset($share->membership_id) ? '#__rsmembership_memberships' : '#__rsmembership_extra_values';
if ($share->type == 'section' && $share->params == $id) {
$found_shared = true;
// found a membership that shares this article
if (!empty($where) && in_array($share->{$what}, $where)) {
$has_access = true;
break;
} else {
// Get the redirect page
$db->setQuery("SELECT `share_redirect` FROM " . $table . " WHERE `id`='" . $share->{$what} . "'");
$redirect = $db->loadResult();
}
}
}
}
}