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


PHP CFriendsHelper::isConnected方法代码示例

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


在下文中一共展示了CFriendsHelper::isConnected方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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

示例2: 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:Jougito,项目名称:DynWeb,代码行数:25,代码来源:privacy.php

示例3: 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

示例4: showMiniHeader

 public static function showMiniHeader($userId)
 {
     CMiniHeader::load();
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     JFactory::getLanguage()->load('com_community');
     $option = $jinput->get('option', '', 'STRING');
     //JRequest::getVar('option', '' , 'REQUEST');
     $my = CFactory::getUser();
     $config = CFactory::getConfig();
     if (!empty($userId)) {
         $user = CFactory::getUser($userId);
         $params = $user->getParams();
         //links information
         $photoEnabled = $config->get('enablephotos') ? true : false;
         $eventEnabled = $config->get('enableevents') ? true : false;
         $groupEnabled = $config->get('enablegroups') ? true : false;
         $videoEnabled = $config->get('enablevideos') ? true : false;
         //likes
         CFactory::load('libraries', 'like');
         $like = new Clike();
         $isLikeEnabled = $like->enabled('profile') && $params->get('profileLikes', 1) ? 1 : 0;
         $isUserLiked = $like->userLiked('profile', $user->id, $my->id);
         /* likes count */
         $likes = $like->getLikeCount('profile', $user->id);
         //profile
         $profileModel = CFactory::getModel('profile');
         $profile = $profileModel->getViewableProfile($user->id, $user->getProfileType());
         $profile = JArrayHelper::toObject($profile);
         $profile->largeAvatar = $user->getAvatar();
         $profile->defaultAvatar = $user->isDefaultAvatar();
         $profile->status = $user->getStatus();
         $profile->defaultCover = $user->isDefaultCover();
         $profile->cover = $user->getCover();
         $profile->coverPostion = $params->get('coverPosition', '');
         if (strpos($profile->coverPostion, '%') === false) {
             $profile->coverPostion = 0;
         }
         $groupmodel = CFactory::getModel('groups');
         $profile->_groups = $groupmodel->getGroupsCount($profile->id);
         $eventmodel = CFactory::getModel('events');
         $profile->_events = $eventmodel->getEventsCount($profile->id);
         $profile->_friends = $user->_friendcount;
         $videoModel = CFactory::getModel('Videos');
         $profile->_videos = $videoModel->getVideosCount($profile->id);
         $photosModel = CFactory::getModel('photos');
         $profile->_photos = $photosModel->getPhotosCount($profile->id);
         /* is featured */
         $modelFeatured = CFactory::getModel('Featured');
         $profile->featured = $modelFeatured->isExists(FEATURED_USERS, $profile->id);
         $sendMsg = CMessaging::getPopup($user->id);
         $tmpl = new CTemplate();
         $tmpl->set('my', $my)->set('user', $user)->set('isBlocked', $user->isBlocked())->set('isMine', COwnerHelper::isMine($my->id, $user->id))->set('sendMsg', $sendMsg)->set('config', $config)->set('isWaitingApproval', CFriendsHelper::isWaitingApproval($my->id, $user->id))->set('isLikeEnabled', $isLikeEnabled)->set('photoEnabled', $photoEnabled)->set('eventEnabled', $eventEnabled)->set('groupEnabled', $groupEnabled)->set('videoEnabled', $videoEnabled)->set('profile', $profile)->set('isUserLiked', $isUserLiked)->set('likes', $likes)->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:Jougito,项目名称:DynWeb,代码行数:57,代码来源:miniheader.php

示例5: activitiesCommentAdd

 public static function activitiesCommentAdd($userId, $assetId, $obj = NULL)
 {
     //$obj = func_get_arg(2);
     $params = func_get_args();
     $obj = !isset($params[2]) ? NULL : $params[2];
     $model = CFactory::getModel('activities');
     $result = false;
     $config = CFactory::getConfig();
     // Guest can never leave a comment
     if ($userId == 0) {
         return false;
     }
     // If global config allow all members to comment, allow it
     if ($config->get('allmemberactivitycomment') == '1') {
         return true;
     }
     $allow_comment = false;
     // if all activity comment is allowed, return true
     $config = CFactory::getConfig();
     if ($config->get('allmemberactivitycomment') == '1' && COwnerHelper::isRegisteredUser()) {
         $allow_comment = true;
     }
     if ($obj instanceof CTableEvent || $obj instanceof CTableGroup) {
         //event or group activities only
         if ($obj->isMember($userId)) {
             $allow_comment = true;
         }
     } else {
         if ($config->get('allmemberactivitycomment') == '1' && COwnerHelper::isRegisteredUser()) {
             // if all activity comment is allowed, return true
             $allow_comment = true;
         }
     }
     if (!isset($obj->params)) {
         $params = '{}';
     } else {
         $params = $obj->params;
     }
     $params = new CParameter($params);
     $commentPermission = $params->get('commentPermission', NULL);
     if ($commentPermission == false && !is_null($commentPermission)) {
         $allow_comment = false;
     }
     if ($allow_comment || CFriendsHelper::isConnected($assetId, $userId) || COwnerHelper::isCommunityAdmin()) {
         $result = true;
     }
     return $result;
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:48,代码来源:activities.php

示例6: block

 /**
  *
  * @param type $userId
  * @param type $type
  * @param type $redirect
  */
 public function block($userId, $type, $redirect = false)
 {
     $my = CFactory::getUser();
     $result = false;
     /* both of ids must not empty */
     if (empty($my->id) || empty($userId)) {
         $message = JText::_('COM_COMMUNITY_ERROR_BLOCK_USER');
     } else {
         /* You can't block yourself */
         if ($my->id != $userId) {
             /* Get model */
             $model = CFactory::getModel('Block');
             /* Do block */
             if ($model->blockUser($my->id, $userId, $type)) {
                 $result = true;
                 /* check if current user is friend with requested user */
                 $isFriend = CFriendsHelper::isConnected($userId, $my->id);
                 /* Remove user as friend if user is a friend */
                 if ($isFriend) {
                     $this->removeFriend($userId);
                 }
                 $message = JText::_('COM_COMMUNITY_USER_BLOCKED');
             } else {
                 $message = JText::_('COM_COMMUNITY_ERROR_BLOCK_USER');
             }
         } else {
             $message = JText::_('COM_COMMUNITY_ERROR_BLOCK_USER');
         }
     }
     if ($redirect) {
         $mainframe = JFactory::getApplication();
         $jinput = $mainframe->input;
         /* generate redirect url */
         $viewName = $jinput->get->get('view', '');
         $urlUserId = $viewName == 'friends' ? '' : "&userid=" . $userId;
         $url = CRoute::_("index.php?option=com_community&view=" . $viewName . $urlUserId, false);
         $mainframe->redirect($url, $message);
     }
     return $result;
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:46,代码来源:block.php

示例7: block

 /**
  * Block user(Ban)
  */
 public function block($userId)
 {
     $my = CFactory::getUser();
     $mainframe =& JFactory::getApplication();
     CFactory::load('helpers', 'friends');
     $isFriend = CFriendsHelper::isConnected($userId, $my->id);
     $viewName = JRequest::getVar('view', '', 'GET');
     $urlUserId = $viewName == 'friends' ? '' : "&userid=" . $userId;
     $url = CRoute::_("index.php?option=com_community&view=" . $viewName . $urlUserId, false);
     $message = empty($my->id) || empty($userId) ? JText::_('COM_COMMUNITY_ERROR_BLOCK_USER') : '';
     if (!empty($my->id) && !empty($userId) && $my->id != $userId) {
         $model = CFactory::getModel('block');
         if ($model->blockUser($my->id, $userId)) {
             // Remove user as friend if user is a friend
             if ($isFriend) {
                 $this->removeFriend($userId);
             }
             $message = JText::_('COM_COMMUNITY_USER_BLOCKED');
         } else {
             $message = JText::_('COM_COMMUNITY_ERROR_BLOCK_USER');
         }
     }
     $mainframe->redirect($url, $message);
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:27,代码来源:block.php

示例8: activitiesCommentAdd

 public static function activitiesCommentAdd($userId, $assetId)
 {
     $obj = func_get_arg(0);
     $model =& CFactory::getModel('activities');
     $result = false;
     $config = CFactory::getConfig();
     // Guest can never leave a comment
     if ($userId == 0) {
         return false;
     }
     // If global config allow all members to comment, allow it
     if ($config->get('allmemberactivitycomment') == '1') {
         return true;
     }
     $allow_comment = false;
     // if all activity comment is allowed, return true
     $config = CFactory::getConfig();
     if ($config->get('allmemberactivitycomment') == '1' && COwnerHelper::isRegisteredUser()) {
         $allow_comment = true;
     }
     if ($obj instanceof CTableEvent || $obj instanceof CTableGroup) {
         //event or group activities only
         if ($obj->isMember($userId)) {
             $allow_comment = true;
         }
     } else {
         if ($config->get('allmemberactivitycomment') == '1' && COwnerHelper::isRegisteredUser()) {
             // if all activity comment is allowed, return true
             $allow_comment = true;
         }
     }
     if ($allow_comment || CFriendsHelper::isConnected($assetId, $userId) || COwnerHelper::isCommunityAdmin()) {
         $result = true;
     }
     return $result;
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:36,代码来源:activities.php

示例9: friendsearch

 /**
  * Search list of friends
  *
  * if no $_GET['id'] is set, we're viewing our own friends
  */
 public function friendsearch($data)
 {
     require_once JPATH_COMPONENT . '/libraries/profile.php';
     require_once JPATH_COMPONENT . '/helpers/friends.php';
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     /**
      * Opengraph
      */
     CHeadHelper::setType('website', JText::_('COM_COMMUNITY_SEARCH_FRIENDS_TITLE'));
     $avatarOnly = $jinput->get('avatar', '', 'NONE');
     $this->addPathway(JText::_('COM_COMMUNITY_SEARCH_FRIENDS_TITLE'));
     $my = CFactory::getUser();
     $friendsModel = CFactory::getModel('friends');
     $resultRows = array();
     $id = JRequest::getInt('userid', null);
     if ($id == null) {
         $id = $my->id;
     }
     $user = CFactory::getUser($id);
     $isMine = $id == $my->id && $my->id != 0;
     $pagination = !empty($data) ? $data->pagination : '';
     $alreadyfriend = array();
     $tmpl = new CTemplate();
     for ($i = 0; $i < count($data->result); $i++) {
         $row = $data->result[$i];
         $user = CFactory::getUser($row->id);
         $row->profileLink = CRoute::_('index.php?option=com_community&view=profile&userid=' . $row->id);
         $row->friendsCount = $user->getFriendCount();
         $isFriend = CFriendsHelper::isConnected($row->id, $my->id);
         $row->user = $user;
         $row->addFriend = !$isFriend && $my->id != 0 && $my->id != $row->id ? true : false;
         if ($row->addFriend) {
             $alreadyfriend[$row->id] = $row->id;
         }
         $resultRows[] = $row;
     }
     $tmpl->set('alreadyfriend', $alreadyfriend);
     $tmpl->set('data', $resultRows);
     $tmpl->set('sortings', '');
     $tmpl->set('pagination', $pagination);
     $featured = new CFeatured(FEATURED_USERS);
     $featuredList = $featured->getItemIds();
     $tmpl->set('featuredList', $featuredList);
     //CFactory::load( 'helpers' , 'owner' );
     $tmpl->set('isCommunityAdmin', COwnerHelper::isCommunityAdmin());
     $tmpl->set('showFeaturedList', false);
     $tmpl->set('my', $my);
     $resultHTML = $tmpl->fetch('people.browse');
     unset($tmpl);
     $searchLinks = parent::getAppSearchLinks('people');
     if ($isMine) {
         $this->showSubmenu();
         /**
          * Opengraph
          */
         CHeadHelper::setType('website', JText::_('COM_COMMUNITY_FRIENDS_MY_FRIENDS'));
     } else {
         $this->addSubmenuItem('index.php?option=com_community&view=profile&userid=' . $user->id, JText::_('COM_COMMUNITY_PROFILE_BACK_TO_PROFILE'));
         $this->addSubmenuItem('index.php?option=com_community&view=friends&userid=' . $user->id, JText::_('COM_COMMUNITY_FRIENDS_VIEW_ALL'));
         $this->addSubmenuItem('index.php?option=com_community&view=friends&task=mutualFriends&userid=' . $user->id . '&filter=mutual', JText::_('COM_COMMUNITY_MUTUAL_FRIENDS'));
         $tmpl = new CTemplate();
         $tmpl->set('view', "friends");
         $tmpl->set('url', CRoute::_('index.php?option=com_community&view=friends&task=viewfriends'));
         $html = $tmpl->fetch('friendsearch.submenu');
         $this->addSubmenuItem('index.php?option=com_community&view=friends&task=viewfriends', JText::_('COM_COMMUNITY_SEARCH_FRIENDS'), 'joms.videos.toggleSearchSubmenu(this)', SUBMENU_LEFT, $html);
         return parent::showSubmenu($display);
         /**
          * Opengraph
          */
         CHeadHelper::setType('website', JText::sprintf('COM_COMMUNITY_FRIENDS_ALL_FRIENDS', $user->getDisplayName()));
     }
     $tmpl = new CTemplate();
     $tmpl->set('avatarOnly', $avatarOnly);
     $tmpl->set('results', $data->result);
     $tmpl->set('resultHTML', $resultHTML);
     $tmpl->set('query', $data->query);
     $tmpl->set('searchLinks', $searchLinks);
     echo $tmpl->fetch('friendsearch');
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:85,代码来源:view.html.php

示例10: array

} else {
    $users = array($this->act->actor);
    $user = CFactory::getUser($this->act->actor);
}
$truncateVal = 60;
$date = JFactory::getDate($act->created);
if ($config->get('activitydateformat') == "lapse") {
    $createdTime = CTimeHelper::timeLapse($date);
} else {
    $createdTime = $date->format($config->get('profileDateFormat'));
}
// Setup album table
$album = JTable::getInstance('Album', 'CTable');
$album->load($act->cid);
$this->set('album', $album);
if ($album->permissions == 30 && !CFriendsHelper::isConnected($my->id, $album->creator)) {
    return false;
}
$albumUrl = CRoute::_($album->getURI());
$isPhotoModal = $config->get('album_mode') == 1;
if ($isPhotoModal) {
    $albumUrl = 'javascript:" onclick="joms.api.photoOpen(\'' . $album->id . '\', \'\');';
}
?>

<div class="joms-stream__header">
    <div class= "joms-avatar--stream">
        <a href="<?php 
echo CUrlHelper::userLink($user->id);
?>
">
开发者ID:Jougito,项目名称:DynWeb,代码行数:31,代码来源:like.php

示例11: defined

<?php

/**
 * @copyright (C) 2013 iJoomla, Inc. - All rights reserved.
 * @license GNU General Public License, version 2 (http://www.gnu.org/licenses/gpl-2.0.html)
 * @author iJoomla.com <webmaster@ijoomla.com>
 * @url https://www.jomsocial.com/license-agreement
 * The PHP code portions are distributed under the GPL license. If not otherwise stated, all images, manuals, cascading style sheets, and included JavaScript *are NOT GPL, and are released under the IJOOMLA Proprietary Use License v1.0
 * More info at https://www.jomsocial.com/license-agreement
 */
defined('_JEXEC') or die;
$params = $user->getParams();
$config = CFactory::getConfig();
$my = CFactory::getUser();
$isMine = COwnerHelper::isMine($my->id, $user->id);
$isFriend = CFriendsHelper::isConnected($user->id, $my->id) && $user->id != $my->id;
$isWaitingApproval = CFriendsHelper::isWaitingApproval($my->id, $user->id);
$isWaitingResponse = CFriendsHelper::isWaitingApproval($user->id, $my->id);
$isBlocked = $user->isBlocked();
//links information
$photoEnabled = $config->get('enablephotos') ? true : false;
$eventEnabled = $config->get('enableevents') ? true : false;
$groupEnabled = $config->get('enablegroups') ? true : false;
$videoEnabled = $config->get('enablevideos') ? true : false;
//likes
CFactory::load('libraries', 'like');
$like = new Clike();
$isLikeEnabled = $like->enabled('profile') && $params->get('profileLikes', 1) ? 1 : 0;
$isUserLiked = $like->userLiked('profile', $user->id, $my->id);
/* likes count */
$likes = $like->getLikeCount('profile', $user->id);
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:31,代码来源:hovercard.php

示例12:

    <?php 
if ($enableReporting) {
    ?>
    <button class="joms-button--neutral joms-button--small" onclick="joms.api.photoReport('<?php 
    echo $photo->id;
    ?>
');"><?php 
    echo JText::_('COM_COMMUNITY_REPORT');
    ?>
</button>
    <?php 
}
?>

    <?php 
if (COwnerHelper::isMine($my->id, $album->creator) || CFriendsHelper::isConnected($my->id, $album->creator)) {
    ?>
    &nbsp;&nbsp; <button class="joms-button--neutral joms-button--small joms-js--btn-tag"><?php 
    echo JText::_('COM_COMMUNITY_TAG_THIS_PHOTO');
    ?>
</button>
    <?php 
}
?>

    <div class="joms-js--photo-tag-ct"></div>

    <div class="joms-gap"></div>
    <div>
        <h5 class="joms-text--title"><?php 
echo JText::_('COM_COMMUNITY_PHOTOS_ALBUM_DESC');
开发者ID:Jougito,项目名称:DynWeb,代码行数:31,代码来源:single.php

示例13: _showHeader

 /**
  * Show the main profile header
  */
 function _showHeader(&$data)
 {
     jimport('joomla.utilities.arrayhelper');
     $my =& JFactory::getUser();
     $userid = JRequest::getVar('userid', $my->id);
     $user = CFactory::getUser($userid);
     $userModel = CFactory::getModel('user');
     CFactory::load('libraries', 'messaging');
     CFactory::load('helpers', 'owner');
     // Get the admin controls HTML data
     $adminControlHTML = '';
     $tmpl = new CTemplate();
     $editStatus = '';
     $editLink = '';
     if (COwnerHelper::isMine($my->id, $user->id)) {
         $editStatus = '<input id="new-status" style="border:1px solid #cccccc;" type="text" value="" size="38" onkeyup="if(event.keyCode == 13) {cStatusAct()}"/>';
         $editLink = '<span id="profile-status-edit" onclick="cStatusAct()">[' . JText::_('CC EDIT') . ']</span>';
     }
     // get how many unread message
     $filter = array();
     $inboxModel = CFactory::getModel('inbox');
     $filter['user_id'] = $my->id;
     $unread = $inboxModel->countUnRead($filter);
     // get how many pending connection
     $friendModel = CFactory::getModel('friends');
     $pending = $friendModel->countPending($my->id);
     $tmpl->set('karmaImgUrl', CUserPoints::getPointsImage($user));
     $tmpl->set('editStatus', $editStatus);
     $tmpl->set('editLink', $editLink);
     $tmpl->set('isMine', COwnerHelper::isMine($my->id, $user->id));
     $profile = JArrayHelper::toObject($data->profile);
     $profile->largeAvatar = $user->getAvatar();
     $profile->status = $user->getStatus();
     CFactory::load('libraries', 'activities');
     $postedOn = new JDate($user->_posted_on);
     $postedOn = CActivityStream::_createdLapse($postedOn);
     $profile->posted_on = $user->_posted_on == '0000-00-00 00:00:00' ? '' : $postedOn;
     // Assign videoId
     $profile->profilevideo = $data->videoid;
     $addbuddy = "joms.friends.connect('{$profile->id}')";
     $sendMsg = CMessaging::getPopup($profile->id);
     $config = CFactory::getConfig();
     $lastLogin = JText::_('CC NEVER LOGGED IN');
     if ($user->lastvisitDate != '0000-00-00 00:00:00') {
         //$now =& JFactory::getDate();
         $userLastLogin = new JDate($user->lastvisitDate);
         CFactory::load('libraries', 'activities');
         $lastLogin = CActivityStream::_createdLapse($userLastLogin);
     }
     // @todo : beside checking the owner, maybe we want to check for a cookie,
     // say every few hours only the hit get increment by 1.
     if (!COwnerHelper::isMine($my->id, $user->id)) {
         $user->viewHit();
     }
     $tmpl->set('lastLogin', $lastLogin);
     $tmpl->setRef('user', $user);
     $tmpl->set('addBuddy', $addbuddy);
     $tmpl->set('sendMsg', $sendMsg);
     $tmpl->set('config', $config);
     // @rule: myblog integrations
     $showBlogLink = false;
     CFactory::load('libraries', 'myblog');
     $myblog =& CMyBlog::getInstance();
     if ($config->get('enablemyblogicon') && $myblog) {
         if ($myblog->userCanPost($user->id)) {
             $showBlogLink = true;
         }
         $tmpl->set('blogItemId', $myblog->getItemId());
     }
     $multiprofile =& JTable::getInstance('MultiProfile', 'CTable');
     $multiprofile->load($user->getProfileType());
     // Get like
     $likesHTML = '';
     if ($user->getParams()->get('profileLikes', true)) {
         CFactory::load('libraries', 'like');
         $likes = new CLike();
         $likesHTML = $my->id == 0 ? $likes->getHtmlPublic('profile', $user->id) : $likes->getHTML('profile', $user->id, $my->id);
     }
     $tmpl->set('multiprofile', $multiprofile);
     $tmpl->set('showBlogLink', $showBlogLink);
     $tmpl->set('isFriend', CFriendsHelper::isConnected($user->id, $my->id) && $user->id != $my->id);
     $tmpl->set('profile', $profile);
     $tmpl->set('unread', $unread);
     $tmpl->set('pending', $pending);
     $tmpl->set('registerDate', $user->registerDate);
     $tmpl->set('adminControlHTML', $adminControlHTML);
     $tmpl->set('likesHTML', $likesHTML);
     $html = $tmpl->fetch('profile.header');
     return $html;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:93,代码来源:view.html.php

示例14: onProfileDisplay

        function onProfileDisplay()
        {
            $mainframe =& JFactory::getApplication();
            JPlugin::loadLanguage('plg_walls', JPATH_ADMINISTRATOR);
            $document =& JFactory::getDocument();
            $my = CFactory::getUser();
            $config = CFactory::getConfig();
            // Load libraries
            CFactory::load('libraries', 'wall');
            CFactory::load('helpers', 'friends');
            $user = CFactory::getRequestUser();
            $friendModel = CFactory::getModel('friends');
            $avatarModel = CFactory::getModel('avatar');
            $isMe = $my->id == $user->id && $my->id != 0;
            $isGuest = $my->id == 0 ? true : false;
            $isConnected = CFriendsHelper::isConnected($my->id, $user->id);
            CFactory::load('helpers', 'owner');
            $isSuperAdmin = isCommunityAdmin();
            // @rule: Limit should follow Joomla's list limit
            $jConfig =& JFactory::getConfig();
            $limit = JRequest::getVar('limit', $jConfig->getValue('list_limit'), 'REQUEST');
            $limitstart = JRequest::getVar('limitstart', 0, 'REQUEST');
            if (JRequest::getVar('task', '', 'REQUEST') == 'app') {
                $cache =& JFactory::getCache('plgCommunityWalls_fullview');
            } else {
                $cache =& JFactory::getCache('plgCommunityWalls');
            }
            $caching = $this->params->get('cache', 1);
            if ($caching) {
                $caching = $mainframe->getCfg('caching');
            }
            $cache->setCaching($caching);
            $callback = array('plgCommunityWalls', '_getWallHTML');
            $allowPosting = ($isMe || !$config->get('lockprofilewalls') || $config->get('lockprofilewalls') && $isConnected || $isSuperAdmin) && !$isGuest;
            $allowRemoval = $isMe || $isSuperAdmin;
            $maxchar = $this->params->get('charlimit', 0);
            if (!empty($maxchar)) {
                $this->characterLimitScript($maxchar);
            }
            //$cache_id = JCacheCallback::_makeId(array('plgCommunityWalls', '_getWallHTML'), array($user->id, $limit, $limitstart , $allowPosting , $allowRemoval));
            //get cache id
            $callback_args = array($user->id, $limit, $limitstart, $allowPosting, $allowRemoval);
            $cache_id = md5(serialize(array($callback, $callback_args)));
            $javascript = <<<SHOWJS
\t\t\t\t\t\t\tfunction getCacheId()
\t\t\t\t\t\t \t{
\t\t\t\t\t\t\t\tvar cache_id = "'.{$cache_id}.'";
\t\t\t\t\t\t\t\treturn cache_id;
\t\t\t\t\t\t\t}
SHOWJS;
            $document->addScriptDeclaration($javascript);
            $content = $cache->call($callback, $user->id, $limit, $limitstart, $allowPosting, $allowRemoval);
            return $content;
        }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:54,代码来源:walls.php

示例15: getVideos

 public function getVideos($userid, $limitstart, $limit)
 {
     $photoType = PHOTOS_USER_TYPE;
     //privacy settings
     //CFactory::load('libraries', 'privacy');
     $permission = CPrivacy::getAccessLevel($this->_my->id, $userid);
     //get videos from the user
     //CFactory::load('models', 'videos');
     $model = CFactory::getModel('Videos');
     if ($this->_my->id == $userid || COwnerHelper::isCommunityAdmin()) {
         $permission = 40;
     } elseif (CFriendsHelper::isConnected($this->_my->id, $userid)) {
         $permission = 30;
     } elseif ($this->_my->id != 0) {
         $permission = 20;
     } else {
         $permission = 10;
     }
     $videos = $model->getUserTotalVideos($userid, $permission);
     return $videos;
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:21,代码来源:myvideos.php


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