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; } }
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; }
/** * 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; }
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; } }
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; }
/** * * @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; }
/** * 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); }
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; }
/** * 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'); }
} 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); ?> ">
<?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 <*****@*****.**> * @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);
<?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)) { ?> <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');
/** * 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; }
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; }
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; }
public function getVideos($userid) { //get videos from the user //CFactory::load('models', 'videos'); $model = CFactory::getModel('VideoTagging'); 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->getTaggedVideosByUser($userid, $permission); return $videos; }
public function advanceSearch() { $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $document = JFactory::getDocument(); //load calendar behavior JHtml::_('behavior.calendar'); JHtml::_('behavior.tooltip'); /** * Opengraph */ CHeadHelper::setType('website', JText::_('COM_COMMUNITY_TITLE_CUSTOM_SEARCH')); //$this->showSubMenu(); $this->addPathway(JText::_('COM_COMMUNITY_TITLE_CUSTOM_SEARCH')); $profileType = $jinput->get('profiletype', 0, 'INT'); $my = CFactory::getUser(); $config = CFactory::getConfig(); $result = null; $fields = CAdvanceSearch::getFields($profileType); $data = new stdClass(); $post = JRequest::get('GET'); $keyList = isset($post['key-list']) ? $post['key-list'] : ''; $avatarOnly = $jinput->get('avatar', '', 'NONE'); if (JString::strlen($keyList) > 0) { //formatting the assoc array $filter = array(); $key = explode(',', $keyList); $joinOperator = isset($post['operator']) ? $post['operator'] : ''; foreach ($key as $idx) { $obj = new stdClass(); $obj->field = $post['field' . $idx]; $obj->condition = $post['condition' . $idx]; $obj->fieldType = $post['fieldType' . $idx]; if ($obj->fieldType == 'email') { $obj->condition = 'equal'; } // we need to check whether the value contain start and end kind of values. // if yes, make them an array. if (isset($post['value' . $idx . '_2'])) { if ($obj->fieldType == 'date') { $startDate = empty($post['value' . $idx]) ? '01/01/1970' : $post['value' . $idx]; $endDate = empty($post['value' . $idx . '_2']) ? '01/01/1970' : $post['value' . $idx . '_2']; // Joomla 1.5 uses "/" // Joomla 1.6 uses "-" $delimeter = '-'; if (strpos($startDate, '/')) { $delimeter = '/'; } $sdate = explode($delimeter, $startDate); $edate = explode($delimeter, $endDate); if (isset($sdate[2]) && isset($edate[2])) { $obj->value = array($sdate[0] . '-' . $sdate[1] . '-' . $sdate[2] . ' 00:00:00', $edate[0] . '-' . $edate[1] . '-' . $edate[2] . ' 23:59:59'); } else { $obj->value = array(0, 0); } } else { $obj->value = array($post['value' . $idx], $post['value' . $idx . '_2']); } } else { if ($obj->fieldType == 'date') { $startDate = empty($post['value' . $idx]) ? '01/01/1970' : $post['value' . $idx]; $delimeter = '-'; if (strpos($startDate, '/')) { $delimeter = '/'; } $sdate = explode($delimeter, $startDate); if (isset($sdate[2])) { $obj->value = $sdate[2] . '-' . $sdate[1] . '-' . $sdate[0] . ' 00:00:00'; } else { $obj->value = 0; } } else { if ($obj->fieldType == 'checkbox') { if (empty($post['value' . $idx])) { //this mean user didnot check any of the option. $obj->value = ''; } else { $obj->value = isset($post['value' . $idx]) ? implode(',', $post['value' . $idx]) : ''; } } else { $obj->value = isset($post['value' . $idx]) ? $post['value' . $idx] : ''; } } } $filter[] = $obj; } $data->search = CAdvanceSearch::getResult($filter, $joinOperator, $avatarOnly, '', $profileType); $data->filter = $post; } $rows = !empty($data->search) ? $data->search->result : array(); $pagination = !empty($data->search) ? $data->search->pagination : ''; $filter = !empty($data->filter) ? $data->filter : array(); $resultRows = array(); $friendsModel = CFactory::getModel('friends'); for ($i = 0; $i < count($rows); $i++) { $row = $rows[$i]; //filter the user profile type if ($profileType && $row->_profile_id != $profileType) { continue; } $obj = new stdClass(); $obj->user = $row; $obj->friendsCount = $row->getFriendCount(); $obj->profileLink = CRoute::_('index.php?option=com_community&view=profile&userid=' . $row->id); $isFriend = CFriendsHelper::isConnected($row->id, $my->id); $obj->addFriend = !$isFriend && $my->id != 0 && $my->id != $row->id ? true : false; $resultRows[] = $obj; } if (class_exists('Services_JSON')) { $json = new Services_JSON(); } else { require_once AZRUL_SYSTEM_PATH . '/pc_includes/JSON.php'; $json = new Services_JSON(); } $tmpl = new CTemplate(); $multiprofileArr = array(); $hasMultiprofile = false; //let see if we have any multiprofile enabled if ($config->get('profile_multiprofile')) { $hasMultiprofile = true; //lets get the available profile $profileModel = CFactory::getModel('Profile'); $profiles = $profileModel->getProfileTypes(); if ($profiles) { $multiprofileArr[] = array('url' => CRoute::_('index.php?option=com_community&view=search&task=advancesearch'), 'name' => JText::_('COM_COMMUNITY_ALL_PROFILE'), 'selected' => !$profileType ? 1 : 0); foreach ($profiles as $profile) { $multiprofileArr[] = array('url' => CRoute::_('index.php?option=com_community&view=search&task=advancesearch&profiletype=' . $profile->id), 'name' => $profile->name, 'selected' => $profile->id == $profileType ? 1 : 0); } } } $searchForm = $tmpl->set('fields', $fields)->set('hasMultiprofile', $hasMultiprofile)->set('multiprofileArr', $multiprofileArr)->set('keyList', $keyList)->set('profileType', $profileType)->set('avatarOnly', $avatarOnly)->set('filterJson', $json->encode($filter))->set('postresult', isset($post['key-list']))->set('submenu', $this->showSubmenu(false))->fetch('search.advancesearch'); if (isset($post['key-list'])) { //result template $tmplResult = new CTemplate(); $featured = new CFeatured(FEATURED_USERS); $featuredList = $featured->getItemIds(); $tmpl->set('featuredList', $featuredList); $searchForm .= $tmplResult->set('my', $my)->set('showFeaturedList', false)->set('multiprofileArr', $multiprofileArr)->set('featuredList', $featuredList)->set('data', $resultRows)->set('isAdvanceSearch', true)->set('hasMultiprofile', $hasMultiprofile)->set('sortings', '')->set('pagination', $pagination)->set('filter', $filter)->set('featuredList', $featuredList)->set('isCommunityAdmin', COwnerHelper::isCommunityAdmin())->fetch('people.browse'); } echo $searchForm; }
public function _getMyGroupsHTML($userid = null) { $document = JFactory::getDocument(); $is_rtl = $document->direction == 'rtl' ? 'dir="rtl"' : ''; $html = ''; $groupsModel = CFactory::getModel('groups'); $my = CFactory::getUser($userid); $user = CFactory::getRequestUser(); $this->loadUserParams(); $params = $user->getParams(); // site visitor $relation = 10; // site members if ($my->id != 0) { $relation = 20; } // friends if (CFriendsHelper::isConnected($my->id, $user->id)) { $relation = 30; } // mine if (COwnerHelper::isMine($my->id, $user->id)) { $relation = 40; } if ($relation >= $params->get('privacyGroupsView')) { // count the groups $groups = $groupsModel->getGroups($user->id, 'latest', false); $total = count($groups); if ($this->params->get('hide_empty', 0) && !$total) { return ''; } $count = $this->userparams->get('count', $this->params->get('count', 10)); $groupsModel->setState('limit', $count); $groups = $groupsModel->getGroups($user->id, 'latest', false); if ($groups) { shuffle($groups); } ob_start(); ?> <?php if ($groups) { $i = 0; ?> <?php foreach ($groups as $group) { if ($i >= $count) { break; } $table = JTable::getInstance('Group', 'CTable'); $table->load($group->id); if ($table->unlisted && !$groupsModel->isMember($my->id, $table->id)) { continue; } $i++; ?> <div class="joms-stream__header"> <div class="joms-avatar--stream"> <a href="<?php echo CRoute::_('index.php?option=com_community&view=groups&groupid=' . $group->id . '&task=viewgroup'); ?> "> <img src="<?php echo $table->getThumbAvatar(); ?> " alt="<?php echo CStringHelper::escape($group->name); ?> " > </a> </div> <div class="joms-stream__meta"> <a class="joms-text--title" href="<?php echo CRoute::_('index.php?option=com_community&view=groups&groupid=' . $group->id . '&task=viewgroup'); ?> "> <?php echo $group->name; ?> </a> <a href="<?php echo CRoute::_("index.php?option=com_community&view=groups&task=viewmembers&groupid=" . $group->id); ?> " class="joms-block"><small> <?php echo JText::sprintf(!CStringHelper::isSingular($group->membercount) ? 'COM_COMMUNITY_GROUPS_MEMBERS_MANY' : 'COM_COMMUNITY_GROUPS_MEMBERS_SINGULAR', $group->membercount); ?> </small></a> </div> </div> <?php } ?> <?php } else { ?> <div><?php echo JText::_('COM_COMMUNITY_NO_GROUPS_YET'); ?> </div> <?php } if ($i < $total) { ?> <div class="joms-gap"></div> <a href="<?php echo CRoute::_('index.php?option=com_community&view=groups&task=mygroups&userid=' . $userid); ?> "> <span><?php echo JText::_('PLG_MYGROUPS_VIEWALL_GROUPS'); ?> </span> <span>(<?php echo $total; ?> )</span> </a> <?php } ?> <?php $html = ob_get_contents(); ob_end_clean(); } return $html; }
/** * Check if permitted to play the video * * @param int $myid The current user's id * @param int $userid The active profile user's id * @param int $permission The video's permission * @return bool True if it's permitted * @since 1.2 */ public function isPermitted($myid = 0, $userid = 0, $permissions = 0) { if ($permissions == 0) { return true; } // public if (COwnerHelper::isCommunityAdmin()) { return true; } $relation = 0; if ($myid != 0) { $relation = 20; } // site members if (CFriendsHelper::isConnected($myid, $userid)) { $relation = 30; } // friends if (COwnerHelper::isMine($myid, $userid)) { $relation = 40; // mine } if ($relation >= $permissions) { return true; } return false; }
/** * Deprecated since 1.8 */ function friendIsConnected($id1, $id2) { return CFriendsHelper::isConnected($id1, $id2); }
public function isTaggable() { CFactory::load('helpers', 'friends'); CFactory::load('helpers', 'owner'); if (COwnerHelper::isMine($this->my->id, $this->user->id) || CFriendsHelper::isConnected($this->my->id, $this->user->id)) { return true; } return false; }
public function _getMyFriendsHTML($userid = null) { $document = JFactory::getDocument(); $this->loadUserParams(); $count = $this->userparams->get('count', $this->params->get('count', 10)); $is_rtl = $document->direction == 'rtl' ? 'dir="rtl"' : ''; $html = ''; $friendsModel = CFactory::getModel('friends'); $my = CFactory::getUser($userid); $user = CFactory::getRequestUser(); $params = $user->getParams(); // site visitor $relation = 10; // site members if ($my->id != 0) { $relation = 20; } // friends if (CFriendsHelper::isConnected($my->id, $user->id)) { $relation = 30; } // mine if (COwnerHelper::isMine($my->id, $user->id)) { $relation = 40; } // @todo: respect privacy settings if ($relation >= $params->get('privacyFriendsView')) { $friends = $friendsModel->getFriends($user->id, 'latest', false, '', $count + $count); // randomize the friend count if ($friends) { shuffle($friends); } $total = $user->getFriendCount(); if ($this->params->get('hide_empty', 0) && !$total) { return ''; } ob_start(); ?> <?php if ($friends) { ?> <ul class='joms-list--thumbnail'> <?php for ($i = 0; $i < count($friends); $i++) { if ($i >= $count) { break; } $friend =& $friends[$i]; ?> <li class='joms-list__item'> <div class="joms-avatar <?php echo CUserHelper::onlineIndicator($friend); ?> "> <a href="<?php echo CRoute::_('index.php?option=com_community&view=profile&userid=' . $friend->id); ?> " > <img alt="<?php echo $friend->getDisplayName(); ?> " title="<?php echo $friend->getTooltip(); ?> " src="<?php echo $friend->getThumbAvatar(); ?> " data-author="<?php echo $friend->id; ?> " /> </a> </div> </li> <?php } ?> </ul> <?php } else { ?> <div class="cEmpty"><?php echo JText::_('COM_COMMUNITY_NO_FRIENDS_YET'); ?> </div> <?php } if ($total > $count) { ?> <div class="joms-gap"></div> <a href="<?php echo CRoute::_('index.php?option=com_community&view=friends&userid=' . $user->id); ?> "> <span><?php echo JText::_('COM_COMMUNITY_FRIENDS_VIEW_ALL'); ?> </span> <span <?php echo $is_rtl; ?> > (<?php echo $total; ?> )</span> </a> <?php } ?> <?php $html = ob_get_contents(); ob_end_clean(); } return $html; }
/** * This function will prep user info so that it can display user mini header in privacy warning template. * Do not call this function outside this view.php */ function _prepUser($user) { if (!empty($user)) { $obj = new stdClass(); $my = CFactory::getUser(); $user = CFactory::getUser($user->id); $obj->friendsCount = $user->getFriendCount(); $obj->user = $user; $obj->profileLink = CUrl::build('profile', '', array('userid' => $user->id)); $isFriend = CFriendsHelper::isConnected($user->id, $my->id); $obj->addFriend = !$isFriend && $my->id != 0 && $my->id != $user->id ? true : false; return array($obj); } return false; }
public static function getUserFriendDropdown($targetId) { $my = CFactory::getUser(); //current user $user = CFactory::getUser($targetId); //if user is not logged in, nothing should be displayed at all if (!$my->id || $my->id == $targetId) { return false; } $display = new stdClass(); $display->canAddFriend = false; $display->canUnfriend = false; $display->canRemoveFriendRequest = false; $display->dropdown = false; $display->dropdownTrigger = false; $display->button = "COM_COMMUNITY_PROFILE_ADD_AS_FRIEND"; //by default $display->buttonTrigger = "joms.api.friendAdd('" . $user->id . "')"; //is friend if (CFriendsHelper::isConnected($my->id, $targetId)) { $display->button = "COM_COMMUNITY_FRIENDS_COUNT"; //friend $display->dropdown = 'COM_COMMUNITY_FRIENDS_REMOVE'; $display->dropdownTrigger = "joms.api.friendRemove('" . $user->id . "');"; $display->buttonTrigger = false; } else { if (CFriendsHelper::isWaitingApproval($my->id, $user->id)) { $display->button = "COM_COMMUNITY_PROFILE_CONNECT_REQUEST_SENT"; $display->buttonTrigger = false; $display->dropdown = "COM_COMMUNITY_CANCEL_FRIEND_REQUEST"; $display->dropdownTrigger = "joms.api.friendAddCancel('" . $user->id . "');"; } else { if ($connectionId = CFriendsHelper::isWaitingApproval($user->id, $my->id)) { $display->button = "COM_COMMUNITY_PENDING_APPROVAL"; $display->buttonTrigger = false; $display->dropdown[] = "COM_COMMUNITY_FRIEND_ACCEPT_REQUEST"; $display->dropdownTrigger[] = "joms.api.friendApprove('" . $connectionId . "');"; $display->dropdown[] = "COM_COMMUNITY_FRIEND_REJECT_REQUEST"; $display->dropdownTrigger[] = "joms.api.friendReject('" . $connectionId . "');"; } } } $tmpl = new CTemplate(); return $tmpl->set('options', $display)->fetch('general/friend-dropdown'); }
public function isWallsAllowed($photoId) { $photo = JTable::getInstance('Photo', 'CTable'); $photo->load($photoId); $config = CFactory::getConfig(); $isConnected = CFriendsHelper::isConnected($this->my->id, $photo->creator); $isMe = COwnerHelper::isMine($this->my->id, $photo->creator); // Check if user is really allowed to post walls on this photo. if ($isMe || !$config->get('lockphotoswalls') || $config->get('lockphotoswalls') && $isConnected || COwnerHelper::isCommunityAdmin()) { return true; } return false; }
/** * Check if permitted to play the video * * @param int $myid The current user's id * @param int $userid The active profile user's id * @param int $permission The video's permission * @return bool True if it's permitted * @since 1.2 */ public function isPermitted($myid = 0, $userid = 0, $permissions = 0) { if ($permissions == 0) { return true; } // public // Load Libraries CFactory::load('helpers', 'friends'); CFactory::load('helpers', 'owner'); if (COwnerHelper::isCommunityAdmin()) { return true; } $relation = 0; if ($myid != 0) { $relation = 20; } // site members if (CFriendsHelper::isConnected($myid, $userid)) { $relation = 30; } // friends if (COwnerHelper::isMine($myid, $userid)) { $relation = 40; // mine } if ($relation >= $permissions) { return true; } return false; }
public function checkAlbumsPermissions($row, $myId) { switch ($row->permissions) { case 0: $result = true; break; case 20: $result = !empty($myId) ? true : false; break; case 30: $result = CFriendsHelper::isConnected($row->creator, $myId) ? true : false; break; case 40: $result = $row->creator == $myId ? true : false; break; default: $result = false; break; } return $result; }
public function display($tpl = null) { $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $id = $jinput->get('listid', '', 'INT'); //JRequest::getVar( 'listid' , '' ); $list = JTable::getInstance('MemberList', 'CTable'); $list->load($id); if (empty($list->id) || is_null($list->id)) { echo JText::_('COM_COMMUNITY_INVALID_ID'); return; } /** * Opengraph */ CHeadHelper::setType('website', $list->getTitle()); $tmpCriterias = $list->getCriterias(); $criterias = array(); foreach ($tmpCriterias as $criteria) { $obj = new stdClass(); $obj->field = $criteria->field; $obj->condition = $criteria->condition; $obj->fieldType = $criteria->type; switch ($criteria->type) { case 'date': case 'birthdate': if ($criteria->condition == 'between') { $date = explode(',', $criteria->value); if (isset($date[1])) { $delimeter = '-'; if (strpos($date[0], '/')) { $delimeter = '/'; } $startDate = explode($delimeter, $date[0]); $endDate = explode($delimeter, $date[1]); if (isset($startDate[2]) && isset($endDate[2])) { //date format $obj->value = array($startDate[2] . '-' . intval($startDate[1]) . '-' . $startDate[0] . ' 00:00:00', $endDate[2] . '-' . intval($endDate[1]) . '-' . $endDate[0] . ' 23:59:59'); } else { //age format $obj->value = array($date[0], $date[1]); } } else { //wrong data, set to default $obj->value = array(0, 0); } } else { $delimeter = '-'; if (strpos($criteria->value, '/')) { $delimeter = '/'; } $startDate = explode($delimeter, $criteria->value); if (isset($startDate[2])) { //date format $obj->value = $startDate[2] . '-' . intval($startDate[1]) . '-' . $startDate[0] . ' 00:00:00'; } else { //age format $obj->value = $criteria->value; } } break; case 'checkbox': default: $obj->value = $criteria->value; break; } $criterias[] = $obj; } //CFactory::load( 'helpers' , 'time'); $created = CTimeHelper::getDate($list->created); //CFactory::load( 'libraries' , 'advancesearch' ); //CFactory::load( 'libraries' , 'filterbar' ); $sortItems = array('latest' => JText::_('COM_COMMUNITY_SORT_LATEST'), 'online' => JText::_('COM_COMMUNITY_SORT_ONLINE'), 'alphabetical' => JText::_('COM_COMMUNITY_SORT_ALPHABETICAL')); $sorting = $jinput->get->get('sort', 'latest', 'STRING'); //JRequest::getVar( 'sort' , 'latest' , 'GET' ); $data = CAdvanceSearch::getResult($criterias, $list->condition, $list->avataronly, $sorting); $tmpl = new CTemplate(); $html = $tmpl->set('list', $list)->set('created', $created)->set('sorting', CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest'))->fetch('memberlist.result'); unset($tmpl); //CFactory::load( 'libraries' , 'tooltip' ); //CFactory::load( 'helpers' , 'owner' ); //CFactory::load( 'libraries' , 'featured' ); $featured = new CFeatured(FEATURED_USERS); $featuredList = $featured->getItemIds(); $my = CFactory::getUser(); $resultRows = array(); $friendsModel = CFactory::getModel('friends'); $alreadyfriend = array(); //CFactory::load( 'helpers' , 'friends' ); foreach ($data->result as $user) { $obj = new stdClass(); $obj->user = $user; $obj->friendsCount = $user->getFriendCount(); $obj->profileLink = CRoute::_('index.php?option=com_community&view=profile&userid=' . $user->id); $isFriend = CFriendsHelper::isConnected($user->id, $my->id); $obj->addFriend = !$isFriend && $my->id != 0 && $my->id != $user->id ? true : false; //record friends if ($obj->addFriend) { $alreadyfriend[$user->id] = $user->id; } $resultRows[] = $obj; } $tmpl = new CTemplate(); echo $tmpl->set('data', $resultRows)->set('alreadyfriend', $alreadyfriend)->set('sortings', '')->set('pagination', $data->pagination)->set('filter', '')->set('featuredList', $featuredList)->set('my', $my)->set('showFeaturedList', false)->set('isCommunityAdmin', COwnerHelper::isCommunityAdmin())->fetch('people.browse'); }
public function isTaggable() { if (COwnerHelper::isMine($this->my->id, $this->user->id) || CFriendsHelper::isConnected($this->my->id, $this->user->id)) { return true; } return false; }
function _userPhoto() { $mainframe =& JFactory::getApplication(); $document =& JFactory::getDocument(); // Get necessary properties and load the libraries CFactory::load('models', 'photos'); CFactory::load('helpers', 'friends'); $my = CFactory::getUser(); $model = CFactory::getModel('photos'); $albumId = JRequest::getVar('albumid', '', 'GET'); $defaultId = JRequest::getVar('photoid', '', 'GET'); if (empty($albumId)) { echo JText::_('CC NO PROPER ALBUM ID'); return; } // Load the album table $album =& JTable::getInstance('Album', 'CTable'); $album->load($albumId); // Since the URL might not contain userid, we need to get the user object from the creator $user = CFactory::getUser($album->creator); if (!$user->block || COwnerHelper::isCommunityAdmin($my->id)) { // Set the current user's active profile CFactory::setActiveProfile($album->creator); // Get list of photos and set some limit to be displayed. // @todo: make limit configurable? set to 1000, unlimited? $photos = $model->getPhotos($albumId, 1000); $pagination = $model->getPagination(); CFactory::load('helpers', 'pagination'); // @todo: make limit configurable? $paging = CPaginationLibrary::getLinks($pagination, 'photos,ajaxPagination', $albumId, 10); // Set document title CFactory::load('helpers', 'string'); $document->setTitle($album->name); // @checks: Test if album doesnt have any default photo id. We need to get the first row // of the photos to be the default if ($album->photoid == '0') { $album->photoid = count($photos) >= 1 ? $photos[0]->id : '0'; } // Try to see if there is any photo id in the query $defaultId = !empty($defaultId) ? $defaultId : $album->photoid; // Load the default photo $photo =& JTable::getInstance('Photo', 'CTable'); $photo->load($defaultId); // If default has an id of 0, we need to tell the template to dont process anything $default = $photo->id == 0 ? false : $photo; // Load User params $params =& $user->getParams(); // site visitor $relation = 10; // site members if ($my->id != 0) { $relation = 20; } // friends if (CFriendsHelper::isConnected($my->id, $user->id)) { $relation = 30; } // mine if (COwnerHelper::isMine($my->id, $user->id)) { $relation = 40; } if ($my->id != $user->id) { $this->attachMiniHeaderUser($user->id); } CFactory::load('helpers', 'owner'); // @todo: respect privacy settings if ($relation < $params->get('privacyPhotoView') && !COwnerHelper::isCommunityAdmin()) { echo JText::_('CC ACCESS FORBIDDEN'); return; } CFactory::load('helpers', 'owner'); //friend list for photo tag CFactory::load('libraries', 'phototagging'); $tagging = new CPhotoTagging(); for ($i = 0; $i < count($photos); $i++) { $item = JTable::getInstance('Photo', 'CTable'); $item->bind($photos[$i]); $photos[$i] = $item; $row =& $photos[$i]; $taggedList = $tagging->getTaggedList($row->id); for ($t = 0; $t < count($taggedList); $t++) { $tagItem =& $taggedList[$t]; $tagUser = CFactory::getUser($tagItem->userid); $canRemoveTag = 0; // 1st we check the tagged user is the photo owner. // If yes, canRemoveTag == true. // If no, then check on user is the tag creator or not. // If yes, canRemoveTag == true // If no, then check on user whether user is being tagged if (COwnerHelper::isMine($my->id, $row->creator) || COwnerHelper::isMine($my->id, $tagItem->created_by) || COwnerHelper::isMine($my->id, $tagItem->userid)) { $canRemoveTag = 1; } $tagItem->user = $tagUser; $tagItem->canRemoveTag = $canRemoveTag; } $row->tagged = $taggedList; } $friendModel = CFactory::getModel('friends'); $friends = $friendModel->getFriends($my->id, '', false); array_unshift($friends, $my); // Show wall contents CFactory::load('helpers', 'friends'); // Load up required objects. $user = CFactory::getUser($photo->creator); $config = CFactory::getConfig(); $isConnected = CFriendsHelper::isConnected($my->id, $user->id); $isMe = COwnerHelper::isMine($my->id, $user->id); $showWall = false; $allowTag = false; // Check if user is really allowed to post walls on this photo. if ($isMe || !$config->get('lockprofilewalls') || $config->get('lockprofilewalls') && $isConnected) { $showWall = true; } //check if we can allow the current viewing user to tag the photos if ($isMe || $isConnected) { $allowTag = true; } $tmpl = new CTemplate(); CFactory::load('libraries', 'bookmarks'); $bookmarks = new CBookmarks(CRoute::getExternalURL('index.php?option=com_community&view=photos&task=album&albumid=' . $album->id . '&userid=' . $user->id)); $bookmarksHTML = $bookmarks->getHTML(); $tmpl->set('showWall', $showWall); $tmpl->set('allowTag', $allowTag); $tmpl->set('isOwner', COwnerHelper::isMine($my->id, $user->id)); $tmpl->set('photos', $photos); $tmpl->set('pagination', $paging); $tmpl->set('default', $default); $tmpl->set('album', $album); $tmpl->set('config', $config); //echo $tmpl->fetch('photos.photo'); } else { CFactory::load('helpers', 'owner'); $tmpl = new CTemplate(); echo $tmpl->fetch('profile.blocked'); return; } }