本文整理汇总了PHP中COwnerHelper类的典型用法代码示例。如果您正苦于以下问题:PHP COwnerHelper类的具体用法?PHP COwnerHelper怎么用?PHP COwnerHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了COwnerHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: isPublic
/**
* Determines whether the current album is public or not
*
* @params
* @return Boolean True upon success
**/
public function isPublic()
{
$my = CFactory::getUser();
if (COwnerHelper::isCommunityAdmin()) {
return true;
}
switch ($this->album->permissions) {
case self::PRIVACY_PRIVATE:
return $my->id == $this->album->creator;
break;
case self::PRIVACY_FRIENDS:
return CFriendsHelper::isConnected($my->id, $this->album->creator);
break;
case self::PRIVACY_MEMBERS:
if ($my->id != 0) {
return true;
}
break;
case self::PRIVACY_PUBLIC:
case self::PRIVACY_PUBLIC_LEGACY:
return true;
break;
}
return false;
}
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:31,代码来源:albums.php
示例2: hasAccess
/**
* Allows us to test if the user has access to the album
**/
function hasAccess($userId, $permissionType)
{
CFactory::load('helpers', 'owner');
CFactory::load('helpers', 'group');
// @rule: For super admin, regardless of what permission, they should be able to access
if (COwnerHelper::isCommunityAdmin()) {
return true;
}
switch ($this->type) {
case PHOTOS_USER_TYPE:
if ($permissionType == 'upload') {
return $this->creator == $userId;
}
if ($permissionType == 'deletephotos') {
return $this->creator == $userId;
}
break;
case PHOTOS_GROUP_TYPE:
CFactory::load('models', 'groups');
$group =& JTable::getInstance('Group', 'CTable');
$group->load($this->groupid);
if ($permissionType == 'upload') {
return CGroupHelper::allowManagePhoto($group->id);
}
if ($permissionType == 'deletephotos') {
return $this->creator == $userId || $group->isAdmin($userId);
}
return false;
break;
}
}
开发者ID:bizanto,项目名称:Hooked,代码行数:34,代码来源:album.php
示例3: getAccessLevel
public static function getAccessLevel($actorId, $targetId)
{
$actor = CFactory::getUser($actorId);
$target = CFactory::getUser($targetId);
CFactory::load('helpers', 'owner');
CFactory::load('helpers', 'friends');
// public guest
$access = 0;
// site members
if ($actor->id > 0) {
$access = 20;
}
// they are friends
if ($target->id > 0 && CFriendsHelper::isConnected($actor->id, $target->id)) {
$access = 30;
}
// mine, target and actor is the same person
if ($target->id > 0 && COwnerHelper::isMine($actor->id, $target->id)) {
$access = 40;
}
if (COwnerHelper::isCommunityAdmin()) {
$access = 40;
}
return $access;
}
开发者ID:Simarpreet05,项目名称:joomla,代码行数:25,代码来源:privacy.php
示例4: ajaxAddFeatured
/**
* Feature the given user
*
* @param int $memberId userid to feature
* @return [type] [description]
*/
public function ajaxAddFeatured($memberId)
{
$filter = JFilterInput::getInstance();
$memberId = $filter->clean($memberId, 'int');
$my = CFactory::getUser();
if ($my->id == 0) {
return $this->ajaxBlockUnregister();
}
if (COwnerHelper::isCommunityAdmin()) {
$model = CFactory::getModel('Featured');
if (!$model->isExists(FEATURED_USERS, $memberId)) {
$featured = new CFeatured(FEATURED_USERS);
$member = CFactory::getUser($memberId);
$config = CFactory::getConfig();
$limit = $config->get('featured' . FEATURED_USERS . 'limit', 10);
if ($featured->add($memberId, $my->id) === true) {
$html = JText::sprintf('COM_COMMUNITY_MEMBER_IS_FEATURED', $member->getDisplayName());
} else {
$html = JText::sprintf('COM_COMMUNITY_MEMBER_LIMIT_REACHED_FEATURED', $member->getDisplayName(), $limit);
}
} else {
$html = JText::_('COM_COMMUNITY_USER_ALREADY_FEATURED');
}
} else {
$html = JText::_('COM_COMMUNITY_NOT_ALLOWED_TO_ACCESS_SECTION');
}
$this->cacheClean(array(COMMUNITY_CACHE_TAG_FEATURED));
$json = array();
$json['title'] = ' ';
$json['html'] = $html;
die(json_encode($json));
}
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:38,代码来源:search.php
示例5: ajaxAddFeatured
public function ajaxAddFeatured($memberId)
{
$filter = JFilterInput::getInstance();
$memberId = $filter->clean($memberId, 'int');
$objResponse = new JAXResponse();
CFactory::load('helpers', 'owner');
$my = CFactory::getUser();
if ($my->id == 0) {
return $this->ajaxBlockUnregister();
}
if (COwnerHelper::isCommunityAdmin()) {
$model = CFactory::getModel('Featured');
if (!$model->isExists(FEATURED_USERS, $memberId)) {
CFactory::load('libraries', 'featured');
$featured = new CFeatured(FEATURED_USERS);
$member = CFactory::getUser($memberId);
$featured->add($memberId, $my->id);
$html = JText::sprintf('COM_COMMUNITY_MEMBER_IS_FEATURED', $member->getDisplayName());
} else {
$html = JText::_('COM_COMMUNITY_USER_ALREADY_FEATURED');
}
} else {
$html = JText::_('COM_COMMUNITY_NOT_ALLOWED_TO_ACCESS_SECTION');
}
$actions = '<input type="button" class="button" onclick="window.location.reload();" value="' . JText::_('COM_COMMUNITY_BUTTON_CLOSE_BUTTON') . '"/>';
$objResponse->addScriptCall('cWindowAddContent', $html, $actions);
$this->cacheClean(array(COMMUNITY_CACHE_TAG_FEATURED));
return $objResponse->sendResponse();
}
开发者ID:Simarpreet05,项目名称:joomla,代码行数:29,代码来源:search.php
示例6: hasAccess
/**
* Allows us to test if the user has access to the album
* */
public function hasAccess($userId, $permissionType)
{
//CFactory::load( 'helpers' , 'owner' );
// @rule: For super admin, regardless of what permission, they should be able to access
if (COwnerHelper::isCommunityAdmin()) {
return true;
}
$album = JTable::getInstance('Album', 'CTable');
$album->load($this->albumid);
switch ($album->type) {
case PHOTOS_USER_TYPE:
if ($permissionType == 'delete') {
return $this->creator == $userId;
}
break;
case PHOTOS_GROUP_TYPE:
//CFactory::load( 'models' , 'groups' );
$group = JTable::getInstance('Group', 'CTable');
$group->load($album->groupid);
if ($permissionType == 'delete') {
return $album->creator == $userId || $group->isAdmin($userId);
}
return false;
break;
}
}
开发者ID:SMARTRESPONSOR,项目名称:SMARTRESPONSOR,代码行数:29,代码来源:photo.php
示例7: showMiniHeader
function showMiniHeader($userId)
{
CMiniHeader::load();
CFactory::load('helpers', 'friends');
CFactory::load('helpers', 'owner');
$option = JRequest::getVar('option', '', 'REQUEST');
$lang =& JFactory::getLanguage();
$lang->load('com_community');
$my = CFactory::getUser();
$config = CFactory::getConfig();
if (!empty($userId)) {
$user = CFactory::getUser($userId);
CFactory::load('libraries', 'messaging');
$sendMsg = CMessaging::getPopup($user->id);
$tmpl = new CTemplate();
$tmpl->set('my', $my);
$tmpl->set('user', $user);
$tmpl->set('isMine', COwnerHelper::isMine($my->id, $user->id));
$tmpl->set('sendMsg', $sendMsg);
$tmpl->set('config', $config);
$tmpl->set('isFriend', CFriendsHelper::isConnected($user->id, $my->id) && $user->id != $my->id);
$showMiniHeader = $option == 'com_community' ? $tmpl->fetch('profile.miniheader') : '<div id="community-wrap" style="min-height:50px;">' . $tmpl->fetch('profile.miniheader') . '</div>';
return $showMiniHeader;
}
}
开发者ID:bizanto,项目名称:Hooked,代码行数:25,代码来源:miniheader.php
示例8: isAccessAllowed
/**
* Return true if actor have access to target's item
* @param type where the privacy setting should be extracted, {user, group, global, custom}
* Site super admin waill always have access to all area
*/
static function isAccessAllowed($actorId, $targetId, $type, $userPrivacyParam)
{
$actor = CFactory::getUser($actorId);
$target = CFactory::getUser($targetId);
CFactory::load('helpers', 'owner');
CFactory::load('helpers', 'friends');
// Load User params
$params =& $target->getParams();
// guest
$relation = 10;
// site members
if ($actor->id != 0) {
$relation = 20;
}
// friends
if (CFriendsHelper::isConnected($actorId, $targetId)) {
$relation = 30;
}
// mine, target and actor is the same person
if (COwnerHelper::isMine($actor->id, $target->id)) {
$relation = 40;
}
// @todo: respect privacy settings
// If type is 'custom', then $userPrivacyParam will contain the exact
// permission level
$permissionLevel = $type == 'custom' ? $userPrivacyParam : $params->get($userPrivacyParam);
if ($relation < $permissionLevel && !COwnerHelper::isCommunityAdmin($actorId)) {
return false;
}
return true;
}
开发者ID:bizanto,项目名称:Hooked,代码行数:36,代码来源:privacy.php
示例9: getFieldHTML
public function getFieldHTML($field, $required)
{
$html = '';
$selectedElement = 0;
$elementSelected = 0;
$elementCnt = 0;
$params = new CParameter($field->params);
$readonly = $params->get('readonly') && !COwnerHelper::isCommunityAdmin() ? ' disabled="disabled"' : '';
for ($i = 0; $i < count($field->options); $i++) {
$option = $field->options[$i];
$selected = $option == $field->value ? ' checked="checked"' : '';
if (empty($selected)) {
$elementSelected++;
}
$elementCnt++;
}
$cnt = 0;
$html .= '<div style="display:inline-block" title="' . CStringHelper::escape(JText::_($field->tips)) . '">';
for ($i = 0; $i < count($field->options); $i++) {
$option = $field->options[$i];
$selected = html_entity_decode($option) == html_entity_decode($field->value) ? ' checked="checked"' : '';
$html .= '<label class="lblradio-block">';
$html .= '<input type="radio" name="field' . $field->id . '" value="' . $option . '"' . $selected . $readonly . ' style="margin: 2px 5px 0 0" />';
$html .= JText::_($option) . '</label>';
}
$html .= '</div>';
return $html;
}
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:28,代码来源:radio.php
示例10: ajaxAddFeatured
public function ajaxAddFeatured($memberId)
{
$objResponse = new JAXResponse();
CFactory::load('helpers', 'owner');
$my = CFactory::getUser();
if ($my->id == 0) {
return $this->ajaxBlockUnregister();
}
if (COwnerHelper::isCommunityAdmin()) {
$model = CFactory::getModel('Featured');
if (!$model->isExists(FEATURED_USERS, $memberId)) {
CFactory::load('libraries', 'featured');
$featured = new CFeatured(FEATURED_USERS);
$member = CFactory::getUser($memberId);
$featured->add($memberId, $my->id);
$objResponse->addAssign('cWindowContent', 'innerHTML', JText::sprintf('CC MEMBER IS FEATURED', $member->getDisplayName()));
} else {
$objResponse->addAssign('cWindowContent', 'innerHTML', JText::_('CC USER ALREADY FEATURED'));
}
} else {
$objResponse->addAssign('cWindowContent', 'innerHTML', JText::_('CC NOT ALLOWED TO ACCESS SECTION'));
}
$buttons = '<input type="button" class="button" onclick="window.location.reload();" value="' . JText::_('CC BUTTON CLOSE') . '"/>';
$objResponse->addScriptCall('cWindowActions', $buttons);
return $objResponse->sendResponse();
}
开发者ID:bizanto,项目名称:Hooked,代码行数:26,代码来源:search.php
示例11: getItems
/**
* Retrieve menu items in JomSocial's toolbar
*
* @access public
* @param
*
* @return Array An array of #__menu objects.
**/
public function getItems()
{
$config = CFactory::getConfig();
$db = JFactory::getDBO();
$menus = array();
// For menu access
$my = CFactory::getUser();
//joomla 1.6
$menutitlecol = !C_JOOMLA_15 ? 'title' : 'name';
$query = 'SELECT a.' . $db->nameQuote('id') . ', a.' . $db->nameQuote('link') . ', a.' . $menutitlecol . ' as name, a.' . $db->nameQuote(TABLE_MENU_PARENTID) . ', false as script ' . ' FROM ' . $db->nameQuote('#__menu') . ' AS a ' . ' LEFT JOIN ' . $db->nameQuote('#__menu') . ' AS b ' . ' ON b.' . $db->nameQuote('id') . '=a.' . $db->nameQuote(TABLE_MENU_PARENTID) . ' AND b.' . $db->nameQuote('published') . '=' . $db->Quote(1) . ' ' . ' WHERE a.' . $db->nameQuote('published') . '=' . $db->Quote(1) . ' ' . ' AND a.' . $db->nameQuote('menutype') . '=' . $db->Quote($config->get('toolbar_menutype'));
if ($my->id == 0) {
$query .= ' AND a.' . $db->nameQuote('access') . '=' . $db->Quote(0);
}
CFactory::load('helpers', 'owner');
if ($my->id > 0 && !COwnerHelper::isCommunityAdmin()) {
// $query .= ' AND a.' . $db->nameQuote( 'access' ) . '>=' . $db->Quote( 0 ) . ' AND a.' . $db->nameQuote( 'access' ) . '<' . $db->Quote( 2 );
//we haven't supported access level setting for toolbar menu yet.
$query .= ' AND a.' . $db->nameQuote('access') . '>=' . $db->Quote(0);
}
if (COwnerHelper::isCommunityAdmin()) {
$query .= ' AND a.' . $db->nameQuote('access') . '>=' . $db->Quote(0);
}
$ordering_field = TABLE_MENU_ORDERING_FIELD;
$query .= ' ORDER BY a.' . $db->nameQuote($ordering_field);
$db->setQuery($query);
$result = $db->loadObjectList();
// remove disabled apps base on &view=value in result's link
$this->cleanMenus($result);
//avoid multiple count execution
$parentColumn = TABLE_MENU_PARENTID;
$menus = array();
foreach ($result as $i => $row) {
//get top main links on toolbar
//add Itemid if not our components and dont add item id for external link
$row->link = CString::str_ireplace('https://', 'http://', $row->link);
if (strpos($row->link, 'com_community') == false && strpos($row->link, 'http://') === false) {
$row->link .= "&Itemid=" . $row->id;
}
if ($row->{$parentColumn} == MENU_PARENT_ID) {
$obj = new stdClass();
$obj->item = $row;
$obj->item->script = false;
$obj->childs = null;
$menus[$row->id] = $obj;
}
}
// Retrieve child menus from the original result.
// Since we reduce the number of sql queries, we need to use php to split the menu's out
// accordingly.
foreach ($result as $i => $row) {
if ($row->{$parentColumn} != MENU_PARENT_ID && isset($menus[$row->{$parentColumn}])) {
if (!is_array($menus[$row->{$parentColumn}]->childs)) {
$menus[$row->{$parentColumn}]->childs = array();
}
$menus[$row->{$parentColumn}]->childs[] = $row;
}
}
return $menus;
}
开发者ID:Simarpreet05,项目名称:joomla,代码行数:67,代码来源:toolbar.php
示例12: getFieldHTML
public function getFieldHTML($field, $required)
{
$params = new CParameter($field->params);
$readonly = $params->get('readonly') && !COwnerHelper::isCommunityAdmin() ? ' readonly=""' : '';
$style = $this->getStyle() ? ' style="' . $this->getStyle() . '"' : '';
$required = $field->required == 1 ? ' data-required="true"' : '';
// If maximum is not set, we define it to a default
$field->max = empty($field->max) ? 200 : $field->max;
$html = '<input type="text" value="' . $field->value . '" id="field' . $field->id . '" name="field' . $field->id . '" maxlength="' . $field->max . '" class="joms-input" ' . $readonly . $required . $style . ' />';
return $html;
}
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:11,代码来源:text.php
示例13: ajaxResetNotification
public function ajaxResetNotification($params)
{
$response = new JAXResponse();
if (!COwnerHelper::isCommunityAdmin()) {
$response->addAssign('notification-update-result', 'innerHTML', JText::_('COM_COMMUNITY_NOT_ALLOWED'));
return $response->sendResponse();
}
$model = $this->getModel('Configuration');
$model->updateNotification($params);
$response->addAssign('notification-update-result', 'innerHTML', JText::_('COM_COMMUNITY_FRONTPAGE_ALL_NOTIFICATION_RESET'));
$response->addScriptCall("joms.jQuery('#notification-update-result').parent().find('input').val('" . JText::_('COM_COMMUNITY_CONFIGURATION_PRIVACY_RESET_EXISTING_NOTIFICATION_BUTTON') . "');");
return $response->sendResponse();
}
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:13,代码来源:configuration.php
示例14: ajaxResetPrivacy
public function ajaxResetPrivacy($photoPrivacy = 0, $profilePrivacy = 0, $friendsPrivacy = 0)
{
$response = new JAXResponse();
CFactory::load('helpers', 'owner');
if (!COwnerHelper::isCommunityAdmin()) {
$response->addScriptCall(JText::_('COM_COMMUNITY_NOT_ALLOWED'));
return $response->sendResponse();
}
$model = $this->getModel('Configuration');
$model->updatePrivacy($photoPrivacy, $profilePrivacy, $friendsPrivacy);
$response->addAssign('privacy-update-result', 'innerHTML', JText::_('COM_COMMUNITY_FRONTPAGE_ALL_PRIVACY_RESET'));
return $response->sendResponse();
}
开发者ID:Simarpreet05,项目名称:joomla,代码行数:13,代码来源:configuration.php
示例15: wallsDelete
public static function wallsDelete($userid, $wall)
{
$my = CFactory::getUser();
//community admin can always delete
if (COwnerHelper::isCommunityAdmin()) {
return true;
}
//bear in mind that not all contentid is activity id, it could be photo id or album id depending on the type
$cid = 0;
if ($wall->params != '' && $wall->params != '{}') {
if ($wall->params instanceof JRegistry) {
$cid = $wall->params->get('activityId', 0);
} else {
$wall->params = new JRegistry($wall->params);
$cid = $wall->params->get('activityId', 0);
}
} elseif ($wall->type == 'profile.status') {
//in the case of profile status, the contentid is linked to the activity id
$cid = $wall->contentid;
}
//check if this is a photo owner, if he is, he can always remove the comment under the photo
if ($wall->type == 'photos') {
$photoTable = JTable::getInstance('photo', 'CTable');
$photoTable->load($wall->contentid);
if ($photoTable->creator == $my->id) {
return true;
}
} elseif ($wall->type == 'videos') {
$photoTable = JTable::getInstance('video', 'CTable');
$photoTable->load($wall->contentid);
if ($photoTable->creator == $my->id) {
return true;
}
} elseif ($wall->type == 'discussions') {
$photoTable = JTable::getInstance('discussion', 'CTable');
$photoTable->load($wall->contentid);
if ($photoTable->creator == $my->id) {
return true;
}
}
$actModel = CFactory::getModel('activities');
$activity = $actModel->getActivity($cid);
$ownPost = $my->id == $wall->post_by;
$targetPost = $activity->target == $my->id;
$allowRemove = ($ownPost || $targetPost || $activity->actor == $my->id) && $my->id;
return $allowRemove;
}
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:47,代码来源:walls.php
示例16: getStreamPermissionHTML
public static function getStreamPermissionHTML($privacy, $actorId = NULL)
{
$my = CFactory::getUser();
if ($my->id != $actorId && !is_null($actorId) && !COwnerHelper::isCommunityAdmin()) {
return;
}
$html = '<span class="joms-share-meta joms-share-privacy">' . JText::_(self::$_permission[$privacy]) . '</span>';
$html .= '<div class="joms-privacy-dropdown joms-stream-privacy">';
$html .= '<button type="button" class="dropdown-toggle" data-value="" data-toggle="dropdown"><span class="dropdown-value"><i class="' . self::$_icons[$privacy] . '"></i></span><span class="dropdown-caret joms-icon-caret-down"></span></button>';
$html .= '<ul class="dropdown-menu">';
$permissions = self::$_permission;
unset($permissions[0]);
foreach ($permissions as $value => $permission) {
$html .= '<li><a href="javascript:" data-option-value="' . $value . '"><i class="' . self::$_icons[$value] . '"></i><span>' . JText::_($permission) . '</span></a></li>';
}
$html .= '</ul></div>';
return $html;
}
开发者ID:SMARTRESPONSOR,项目名称:SMARTRESPONSOR,代码行数:18,代码来源:activities.php
示例17: exceededPhotoUpload
public static function exceededPhotoUpload($id, $type = PHOTOS_USER_TYPE)
{
// @rule: Administrator should not be restricted
//CFactory::load( 'helpers' , 'owner' );
if (COwnerHelper::isCommunityAdmin()) {
return false;
}
// Get the configuration for uploader tool
$config = CFactory::getConfig();
$model = CFactory::getModel('photos');
$photoLimit = $config->get('photouploadlimit');
if ($type == PHOTOS_GROUP_TYPE) {
$photoLimit = $config->get('groupphotouploadlimit');
}
$totalPhotos = $model->getPhotosCount($id, $type);
if ($totalPhotos >= $photoLimit && $photoLimit != 0) {
return true;
}
return false;
}
开发者ID:SMARTRESPONSOR,项目名称:SMARTRESPONSOR,代码行数:20,代码来源:limits.php
示例18: getStreamPermissionHTML
public static function getStreamPermissionHTML($privacy, $actorId = NULL)
{
$my = CFactory::getUser();
if ($my->id != $actorId && !is_null($actorId) && !COwnerHelper::isCommunityAdmin()) {
return;
}
$html = ' <span class="joms-stream__meta--separator">•</span> ';
$html .= '<span class="joms-stream__privacy" data-ui-object="stream-privacy">';
$html .= '<button class="joms-stream__privacy--button" data-ui-object="stream-privacy-button"><i class="joms-icon ' . self::$_icons[$privacy] . '"></i>';
$html .= '<span class="joms-icon joms-icon__caret-down"></span></button>';
$html .= '<div class="joms-stream__privacy--dropdown" data-ui-object="stream-privacy-dropdown">';
$permissions = self::$_permission;
unset($permissions[0]);
foreach ($permissions as $value => $permission) {
$html .= '<a href="#" data-ui-object="stream-privacy-dropdown-item" data-value="' . $value . '"' . ($value == $privacy ? ' class="active"' : '') . '>';
$html .= '<i class="joms-icon ' . self::$_icons[$value] . '"></i><span>' . JText::_($permission) . '</span></a>';
}
$html .= '</div>';
$html .= '</span>';
return $html;
}
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:21,代码来源:activities.php
示例19: get
/**
* Get the user status
*
* @param int userid
*
* @todo: this should return the status object. Use Jtable for this
*/
public function get($id, $limit = 1)
{
$db =& $this->getDBO();
$config = CFactory::getConfig();
CFactory::load('helpers', 'owner');
//enforce user's status privacy
$andWhere = array();
$andWhere[] = $db->nameQuote('userid') . '=' . $db->Quote($id);
if ($config->get('respectactivityprivacy')) {
$my = CFactory::getUser();
if ($my->id == 0) {
// for guest, it is enough to just test access <= 0
$andWhere[] = '(' . $db->nameQuote('status_access') . ' <= 10)';
} elseif (!COwnerHelper::isCommunityAdmin($my->id)) {
$orWherePrivacy = array();
$orWherePrivacy[] = '(' . $db->nameQuote('status_access') . ' = 0) ';
$orWherePrivacy[] = '(' . $db->nameQuote('status_access') . ' = 10) ';
$orWherePrivacy[] = '((' . $db->nameQuote('status_access') . ' = 20) AND ( ' . $db->Quote($my->id) . ' != 0)) ';
if ($my->id != 0) {
$orWherePrivacy[] = '((' . $db->nameQuote('status_access') . ' = ' . $db->Quote(40) . ') AND (' . $db->Quote($id) . ' = ' . $db->Quote($my->id) . ')) ';
$orWherePrivacy[] = '((' . $db->nameQuote('status_access') . ' = ' . $db->Quote(30) . ') AND ((' . $db->Quote($my->id) . 'IN (SELECT c.' . $db->nameQuote('connect_to') . ' FROM ' . $db->nameQuote('#__community_connection') . ' as c' . ' WHERE c.' . $db->nameQuote('connect_from') . ' = ' . $db->Quote($id) . ' AND c.' . $db->nameQuote('status') . ' = ' . $db->Quote(1) . ' ) ) OR (' . $db->Quote($id) . ' = ' . $db->Quote($my->id) . ') )) ';
}
$OrPrivacy = implode(' OR ', $orWherePrivacy);
$andWhere[] = "(" . $OrPrivacy . ")";
}
}
$whereAnd = implode(' AND ', $andWhere);
$sql = 'SELECT * from ' . $db->nameQuote('#__community_users') . ' WHERE ' . $whereAnd . ' ORDER BY ' . $db->nameQuote('posted_on') . ' DESC LIMIT ' . $limit;
$db->setQuery($sql);
$result = $db->loadObjectList();
// Return the first row
if (!empty($result)) {
$result = $result[0];
} else {
$result = new stdClass();
$result->status = '';
}
return $result;
}
开发者ID:Simarpreet05,项目名称:joomla,代码行数:46,代码来源:status.php
示例20: videosUserVideoView
public static function videosUserVideoView($userid, $asset)
{
//first
$video = JTable::getInstance('Video', 'CTable');
$video->load($asset);
if ($userid == $video->creator || COwnerHelper::isCommunityAdmin()) {
return true;
// creator always be able to view his own album
}
$owner = CFactory::getUser($video->creator);
$permission = $video->permissions;
if ($permission == COMMUNITY_STATUS_PRIVACY_FRIENDS && $owner->isFriendWith($userid)) {
return true;
}
if ($permission == COMMUNITY_STATUS_PRIVACY_MEMBERS && $userid) {
return true;
}
if ($permission <= COMMUNITY_STATUS_PRIVACY_PUBLIC) {
return true;
}
return false;
}
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:22,代码来源:videos.php
注:本文中的COwnerHelper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论