本文整理汇总了PHP中JTable::getINstance方法的典型用法代码示例。如果您正苦于以下问题:PHP JTable::getINstance方法的具体用法?PHP JTable::getINstance怎么用?PHP JTable::getINstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JTable
的用法示例。
在下文中一共展示了JTable::getINstance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkPhotoAccess
public function checkPhotoAccess($albumid = null, $photoid = null)
{
$mainframe = JFactory::getApplication();
$jinput = $mainframe->input;
$config = CFactory::getConfig();
$userId = $jinput->get('userid');
$groupId = $jinput->get('groupid');
$my = CFactory::getUser();
if ($userId) {
$creator = CFactory::getuser($userId);
$creatorId = $creator->id;
}
if ($albumid) {
$album = JTable::getInstance('Album', 'CTable');
$album->load($albumid);
$creatorId = $album->creator;
}
if ($photoid) {
$photo = JTable::getINstance('Photo', 'CTable');
$photo->load($photoid);
$creatorId = $photo->creator;
}
// check privacy
$allowed = true;
// default privacy levels
if (isset($creatorId) && !$groupId) {
if (isset($album) && $album->permission <= 10) {
return true;
} else {
if (!CPrivacy::isAccessAllowed($my->id, $creatorId, 'privacyPhotoView', 'privacyPhotoView')) {
$allowed = false;
}
}
} elseif (isset($groupId) && $groupId) {
$group = JTable::getInstance('Group', 'CTable');
$group->load($group);
if ($group->approvals == 1 && !$group->isMember($my->id) && !COwnerHelper::isCommunityAdmin()) {
$allowed = false;
} else {
$allowed = true;
}
}
if (!$allowed) {
echo "<div class=\"cEmpty cAlert\">" . JText::_('COM_COMMUNITY_PRIVACY_ERROR_MSG') . "</div>";
return;
}
if (!$config->get('enablephotos')) {
$mainframe->enqueueMessage(JText::_('COM_COMMUNITY_PHOTOS_DISABLED'), '');
return false;
}
return true;
}