当前位置: 首页>>代码示例>>PHP>>正文


PHP COwnerHelper类代码示例

本文整理汇总了PHP中COwnerHelper的典型用法代码示例。如果您正苦于以下问题:PHP COwnerHelper类的具体用法?PHP COwnerHelper怎么用?PHP COwnerHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了COwnerHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的COwnerHelper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。