/** * This method should handle any login logic and report back to the subject * * @access public * @param array holds the user data * @param array extra options * @return boolean True on success * @since 1.5 */ function onLoginUser($user, $options) { CFactory::load('helpers', 'user'); $id = cGetUserId($user['username']); CFactory::setActiveProfile($id); return true; }
/** * View all sent emails */ public function sent() { CFactory::setActiveProfile(); $model = $this->getModel('inbox'); $msg = $model->getSent(); $modMsg = array(); $view = $this->getView('inbox'); // Add small avatar to each image $avatarModel = $this->getModel('avatar'); if (!empty($msg)) { foreach ($msg as $key => $val) { if (is_array($val->to)) { // multiuser $tmpNameArr = array(); $tmpAvatar = array(); //avatar foreach ($val->to as $toId) { $user = CFactory::getUser($toId); $tmpAvatar[] = $user->getThumbAvatar(); $tmpNameArr[] = $user->getDisplayName(); } $msg[$key]->smallAvatar = $tmpAvatar; $msg[$key]->to_name = $tmpNameArr; } } } $data = new stdClass(); $data->msg = $msg; $my = CFactory::getUser(); $newFilter['user_id'] = $my->id; if ($my->id == 0) { return $this->blockUnregister(); } $data->inbox = $model->countUnRead($newFilter); $data->pagination = $model->getPagination(); $this->_icon = 'sent'; echo $view->get('sent', $data); }
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; } }
public function _groupVideo() { $mainframe = JFactory::getApplication(); $document = JFactory::getDocument(); // Get necessary properties and load the libraries CFactory::load('models', 'videos'); $my = CFactory::getUser(); $model = CFactory::getModel('videos'); $videoId = JRequest::getVar('videoid', '', 'GET'); $groupId = JRequest::getVar('groupid', '', 'GET'); $video = JTable::getInstance('Video', 'CTable'); $video->load($videoId); $video->loadExtra(); CFactory::load('helpers', 'owner'); $user = CFactory::getUser($video->creator); $blocked = $user->isBlocked(); if ($blocked && !COwnerHelper::isCommunityAdmin()) { $tmpl = new CTemplate(); echo $tmpl->fetch('profile.blocked'); return; } if (empty($videoId)) { $url = CRoute::_('index.php?option=com_community&view=videos', false); $mainframe->redirect($url, JText::_('COM_COMMUNITY_VIDEOS_ID_ERROR'), 'warning'); } CFactory::load('helpers', 'group'); // Check permission if (!CGroupHelper::allowViewMedia($groupId)) { // Set document title $document->setTitle(JText::_('COM_COMMUNITY_RESTRICTED_ACCESS')); $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_RESTRICTED_ACCESS', 'notice')); echo JText::_('COM_COMMUNITY_GROUPS_VIDEO_MEMBER_PERMISSION'); } else { // Get extra properties $video->player = $video->getViewHTML($video->getWidth(), $video->getHeight()); $video->hit(); // Get reporting html $reportHTML = ''; CFactory::load('libraries', 'reporting'); $report = new CReportingLibrary(); $reportHTML = $report->getReportingHTML(JText::_('COM_COMMUNITY_VIDEOS_REPORT_VIDEOS'), 'videos,reportVideo', array($video->id)); // Set pathway $pathway =& $mainframe->getPathway(); $pathway->addItem('Video', CRoute::_('index.php?option=com_community&view=videos')); $pathway->addItem($video->title, ''); // Set the current user's active profile CFactory::setActiveProfile($video->creator); // Set document title $document->setTitle($video->title); CFactory::load('libraries', 'bookmarks'); $bookmarks = new CBookmarks($video->permalink); $bookmarksHTML = $bookmarks->getHTML(); $tmpl = new CTemplate(); // Get the walls CFactory::load('libraries', 'wall'); $wallContent = CWallLibrary::getWallContents('videos', $video->id, COwnerHelper::isCommunityAdmin() || $my->id == $video->creator && $my->id != 0, 10, 0); $wallForm = ''; $viewAllLink = false; if (JRequest::getVar('task', '', 'REQUEST') != 'app') { $viewAllLink = CRoute::_('index.php?option=com_community&view=videos&task=app&videoid=' . $video->id . '&app=walls'); } $wallForm = CWallLibrary::getWallInputForm($video->id, 'videos,ajaxSaveWall', 'videos,ajaxRemoveWall', $viewAllLink); $redirectUrl = CRoute::getURI(false); $tmpl->set('redirectUrl', $redirectUrl); $tmpl->set('wallForm', $wallForm); $tmpl->set('wallContent', $wallContent); $tmpl->set('bookmarksHTML', $bookmarksHTML); $tmpl->set('reportHTML', $reportHTML); $tmpl->set('video', $video); echo $tmpl->fetch('videos.video'); } }
/** * Upload a new user video. */ public function linkVideo() { CFactory::setActiveProfile(); $my = CFactory::getUser(); $config = CFactory::getConfig(); if ($my->id == 0) { return $this->blockUnregister(); } if (!$config->get('enableprofilevideo')) { echo JText::_('COM_COMMUNITY_VIDEOS_PROFILE_VIDEO_DISABLE'); return; } $view = $this->getView('profile'); echo $view->get(__FUNCTION__); }
/** * Edits a user details * * @access public * @param array An associative array to display the editing of the fields */ function editDetails(&$data) { $mainframe =& JFactory::getApplication(); // access check CFactory::setActiveProfile(); if (!$this->accessAllowed('registered')) { return; } $my = CFactory::getUser(); $config = CFactory::getConfig(); $pathway =& $mainframe->getPathway(); $pathway->addItem(JText::_($my->getDisplayName()), CRoute::_('index.php?option=com_community&view=profile&userid=' . $my->id)); $pathway->addItem(JText::_('CC EDIT DETAILS'), ''); $document =& JFactory::getDocument(); $document->setTitle(JText::_('CC EDIT DETAILS')); $js = 'assets/validate-1.5'; $js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js'; CAssets::attach($js, 'js'); $this->showSubmenu(); $connectModel = CFactory::getModel('Connect'); $associated = $connectModel->isAssociated($my->id); CFactory::load('helpers', 'owner'); CFactory::load('libraries', 'facebook'); $fbHtml = ''; if ($config->get('fbconnectkey') && $config->get('fbconnectsecret')) { CFactory::load('libraries', 'facebook'); $facebook = new CFacebook(); $fbHtml = $facebook->getLoginHTML(); } // If FIELD_GIVENNAME & FIELD_FAMILYNAME is in use CFactory::load('helpers', 'user'); $isUseFirstLastName = CUserHelper::isUseFirstLastName(); $jConfig =& JFactory::getConfig(); CFactory::load('libraries', 'apps'); $app =& CAppPlugins::getInstance(); $appFields = $app->triggerEvent('onFormDisplay', array('jsform-profile-editdetails')); $beforeFormDisplay = CFormElement::renderElements($appFields, 'before'); $afterFormDisplay = CFormElement::renderElements($appFields, 'after'); $tmpl = new CTemplate(); $tmpl->set('beforeFormDisplay', $beforeFormDisplay); $tmpl->set('afterFormDisplay', $afterFormDisplay); $tmpl->set('fbHtml', $fbHtml); $tmpl->set('jConfig', $jConfig); $tmpl->set('params', $data->params); $tmpl->set('user', $my); $tmpl->set('config', $config); $tmpl->set('associated', $associated); $tmpl->set('isAdmin', COwnerHelper::isCommunityAdmin()); $tmpl->set('offsetList', $data->offsetList); $tmpl->set('isUseFirstLastName', $isUseFirstLastName); echo $tmpl->fetch('profile.edit.details'); }
/** * This method should handle any login logic and report back to the subject * * @access public * @param array holds the user data * @param array extra options * @return boolean True on success * @since 1.5 */ public function onLoginUser($user, $options) { $id = CUserHelper::getUserId($user['username']); CFactory::setActiveProfile($id); return true; }
/** * Method to display video * @return void */ public function video() { $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $document = JFactory::getDocument(); $config = CFactory::getConfig(); $my = CFactory::getUser(); $requestUser = CFactory::getRequestUser(); $videoId = $jinput->get('videoid', '', 'INT'); $task = $jinput->getCmd('task'); // Get show video location map by default $videoMapsDefault = $config->get('videosmapdefault'); // Load window library CWindow::load(); $video = JTable::getInstance('Video', 'CTable'); if (empty($videoId)) { if ($jinput->get('videoid', '', 'INT')) { $videoId = $jinput->get('videoid', '', 'INT'); } else { $url = CRoute::_('index.php?option=com_community&view=videos', false); $mainframe->redirect($url, JText::_('COM_COMMUNITY_VIDEOS_ID_ERROR'), 'warning'); } } if (!$video->load($videoId)) { $url = CRoute::_('index.php?option=com_community&view=videos', false); $mainframe->redirect($url, JText::_('COM_COMMUNITY_VIDEOS_NOT_AVAILABLE'), 'warning'); } if ($video->groupid) { JRequest::setVar('groupid', $video->groupid); } elseif ($video->eventid) { JRequest::setVar('eventid', $video->eventid); } // Setting up the sub menu if (COwnerHelper::isCommunityAdmin() || $my->id == $video->creator && $my->id != 0) { $this->addSubmenuItem('', JText::_('COM_COMMUNITY_VIDEOS_FETCH_THUMBNAIL'), "joms.api.videoFetchThumbnail('" . $video->id . "');", true); // Only add the set as profile video for video owner if ($my->id == $video->creator && $config->get('enableprofilevideo')) { $this->addSubmenuItem('', JText::_('COM_COMMUNITY_VIDEOS_SET_AS_PROFILE'), "joms.api.videoLinkToProfile('" . $video->id . "');", true); } $redirectUrl = CRoute::getURI(false); $this->addSubmenuItem('', JText::_('COM_COMMUNITY_EDIT'), "joms.api.videoEdit('" . $video->id . "');", true); $this->addSubmenuItem('', JText::_('COM_COMMUNITY_DELETE'), "joms.api.videoRemove('" . $video->id . "');", true); } $this->_addSubmenu(); // Show the mini header when viewing other's photos if ($video->creator_type == VIDEO_USER_TYPE && $my->id != $video->creator) { // $this->attachMiniHeaderUser($video->creator); } // Check permission $user = CFactory::getUser($video->creator); $blocked = $user->isBlocked(); if ($blocked && !COwnerHelper::isCommunityAdmin()) { $tmpl = new CTemplate(); echo $tmpl->fetch('profile.blocked'); return; } $sorted = $jinput->get('sort', 'latest', 'STRING'); $limit = $jinput->get('limitstart', 6, 'INT'); $permissions = $my->id == 0 ? 0 : 20; $cat_id = $jinput->get('cat_id', '', 'INT'); $model = CFactory::getModel('videos'); /* We get groupid from video table instead user input */ $groupId = $video->groupid; if ($video->creator_type == VIDEO_GROUP_TYPE) { if (!CGroupHelper::allowViewMedia($groupId)) { /** * Opengraph */ CHeadHelper::setType('website', JText::_('COM_COMMUNITY_RESTRICTED_ACCESS')); $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_RESTRICTED_ACCESS', 'notice')); echo JText::_('COM_COMMUNITY_GROUPS_VIDEO_MEMBER_PERMISSION'); return; } $group = JTable::getInstance('Group', 'CTable'); $group->load($groupId); // Set pathway $pathway = $mainframe->getPathway(); $pathway->addItem(JText::_('COM_COMMUNITY_GROUPS'), CRoute::_('index.php?option=com_community&view=groups')); $pathway->addItem($group->name, CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $groupId)); $pathway->addItem(JText::_('COM_COMMUNITY_VIDEOS'), CRoute::_('index.php?option=com_community&view=videos&task=display&groupid=' . $groupId)); $pathway->addItem($video->getTitle(), ''); $otherVideos = $model->getGroupVideos($groupId, $cat_id, $limit); } else { if (!$this->isPermitted($my->id, $video->creator, $video->permissions)) { /** * Opengraph */ CHeadHelper::setType('website', JText::_('COM_COMMUNITY_RESTRICTED_ACCESS')); $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_RESTRICTED_ACCESS', 'notice')); switch ($video->permissions) { case '40': $this->noAccess(JText::_('COM_COMMUNITY_VIDEOS_OWNER_ONLY', 'notice')); break; case '30': $owner = CFactory::getUser($video->creator); $this->noAccess(JText::sprintf('COM_COMMUNITY_VIDEOS_FRIEND_PERMISSION_MESSAGE', $owner->getDisplayName())); break; default: $this->noAccess(); break; } return; } // Set pathway $pathway = $mainframe->getPathway(); $pathway->addItem('Video', CRoute::_('index.php?option=com_community&view=videos')); $pathway->addItem($video->getTitle(), ''); $filters = array('status' => 'ready', 'category_id' => $cat_id, 'creator' => $user->id, 'permissions' => $permissions, 'or_group_privacy' => 0, 'sorting' => $sorted, 'limit' => $limit); $otherVideos = $model->getVideos($filters); } // Set the current user's active profile CFactory::setActiveProfile($video->creator); // Hit counter + 1 $video->hit(); // Get reporting html $reportHTML = ''; $report = new CReportingLibrary(); if ($user->id != $my->id) { $reportHTML = $report->getReportingHTML(JText::_('COM_COMMUNITY_VIDEOS_REPORT_VIDEOS'), 'videos,reportVideo', array($video->id)); } // Get bookmark html $bookmarks = new CBookmarks($video->getPermalink()); $bookmarksHTML = $bookmarks->getHTML(); // Get the walls $wallContent = CWallLibrary::getWallContents('videos', $video->id, COwnerHelper::isCommunityAdmin() || $my->id == $video->creator && $my->id != 0, $config->get('stream_default_comments'), 0, 'wall/content', 'videos,video'); $wallCount = CWallLibrary::getWallCount('videos', $video->id); $viewAllLink = CRoute::_('index.php?option=com_community&view=videos&task=app&videoid=' . $video->id . '&app=walls'); $wallViewAll = ''; if ($wallCount > $config->get('stream_default_comments')) { $wallViewAll = CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount); } $wallForm = ''; if ($this->isPermitted($my->id, $video->creator, PRIVACY_FRIENDS) || !$config->get('lockvideoswalls')) { $wallForm = CWallLibrary::getWallInputForm($video->id, 'videos,ajaxSaveWall', 'videos,ajaxRemoveWall', $viewAllLink); } $redirectUrl = CRoute::getURI(false); // Get like information. $like = new CLike(); $likeCount = $like->getLikeCount('videos', $video->id); $likeLiked = $like->userLiked('videos', $video->id, $my->id) === COMMUNITY_LIKE; $tmpl = new CTemplate(); if ($video->creator_type == VIDEO_GROUP_TYPE) { $group = JTable::getInstance('Group', 'CTable'); $group->load($groupId); $document = JFactory::getDocument(); $document->addHeadLink($group->getThumbAvatar(), 'image_src', 'rel'); } if ($video->location !== '' && $videoMapsDefault) { $zoomableMap = CMapping::drawZoomableMap($video->location, 220, 150, $video->longitude, $video->latitude); } else { $zoomableMap = ""; } //friend list for video tag $tagging = new CVideoTagging(); $taggedList = $tagging->getTaggedList($video->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 video 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, $video->creator) || COwnerHelper::isMine($my->id, $tagItem->created_by) || COwnerHelper::isMine($my->id, $tagItem->userid)) { $canRemoveTag = 1; } $tagItem->user = $tagUser; $tagItem->canRemoveTag = $canRemoveTag; } if ($video->type == "file") { $storage = CStorage::getStorage($video->storage); $video->path = $storage->getURI($video->path); } $config = CFactory::getConfig(); $canSearch = 1; if ($my->id == 0 && !$config->get('enableguestsearchvideos')) { $canSearch = 0; } CHeadHelper::addOpengraph('og:image', JUri::root() . $video->thumb, true); CHeadHelper::setType('website', $video->title); $video->tagged = $taggedList; echo $tmpl->setMetaTags('video', $video)->set('user', $user)->set('zoomableMap', $zoomableMap)->set('likeCount', $likeCount)->set('canSearch', $canSearch)->set('likeLiked', $likeLiked)->set('redirectUrl', $redirectUrl)->set('wallContent', $wallContent)->set('wallForm', $wallForm)->set('wallCount', $wallCount)->set('wallViewAll', $wallViewAll)->set('bookmarksHTML', $bookmarksHTML)->set('reportHTML', $reportHTML)->set('video', $video)->set('otherVideos', $otherVideos)->set('videoMapsDefault', $videoMapsDefault)->set('wallCount', $wallCount)->set('isGroup', $groupId ? true : false)->set('groupId', $groupId ? $groupId : null)->set('submenu', $this->showSubmenu(false))->fetch('videos/single'); }
/** * Edits a user details * * @access public * @param array An associative array to display the editing of the fields */ public function editDetails(&$data) { $mainframe = JFactory::getApplication(); // access check CFactory::setActiveProfile(); if (!$this->accessAllowed('registered')) { return; } $my = CFactory::getUser(); $config = CFactory::getConfig(); $userParams = $my->getParams(); $pathway = $mainframe->getPathway(); $pathway->addItem(JText::_($my->getDisplayName()), CRoute::_('index.php?option=com_community&view=profile&userid=' . $my->id)); $pathway->addItem(JText::_('COM_COMMUNITY_EDIT_DETAILS'), ''); /** * Opengraph */ CHeadHelper::setType('website', JText::_('COM_COMMUNITY_EDIT_DETAILS')); // $js = 'assets/validate-1.5.min.js'; // CFactory::attach($js, 'js'); $this->showSubmenu(); $connectModel = CFactory::getModel('Connect'); $associated = $connectModel->isAssociated($my->id); $fbHtml = ''; if ($config->get('fbconnectkey') && $config->get('fbconnectsecret') && !$config->get('usejfbc')) { //CFactory::load( 'libraries' , 'facebook' ); $facebook = new CFacebook(); $fbHtml = $facebook->getLoginHTML(); } if ($config->get('usejfbc')) { if (class_exists('JFBCFactory')) { $providers = JFBCFactory::getAllProviders(); foreach ($providers as $p) { $fbHtml .= $p->loginButton(); } } } // If FIELD_GIVENNAME & FIELD_FAMILYNAME is in use $isUseFirstLastName = CUserHelper::isUseFirstLastName(); $jConfig = JFactory::getConfig(); //CFactory::load( 'libraries' , 'apps' ); $app = CAppPlugins::getInstance(); $appFields = $app->triggerEvent('onFormDisplay', array('jsform-profile-editdetails')); $beforeFormDisplay = CFormElement::renderElements($appFields, 'before'); $afterFormDisplay = CFormElement::renderElements($appFields, 'after'); $tmpl = new CTemplate(); echo $tmpl->set('beforeFormDisplay', $beforeFormDisplay)->set('afterFormDisplay', $afterFormDisplay)->set('fbHtml', $fbHtml)->set('fbPostStatus', $userParams->get('postFacebookStatus'))->set('jConfig', $jConfig)->set('params', $data->params)->set('user', $my)->set('config', $config)->set('associated', $associated)->set('isAdmin', COwnerHelper::isCommunityAdmin())->set('offsetList', $data->offsetList)->set('isUseFirstLastName', $isUseFirstLastName)->fetch('profile.edit.details'); }
/** * Method to display video * **/ public function video() { $mainframe =& JFactory::getApplication(); $document = JFactory::getDocument(); $config = CFactory::getConfig(); $my = CFactory::getUser(); $videoId = JRequest::getVar('videoid', '', 'GET'); $groupId = JRequest::getVar('groupid', '', 'GET'); // Get show video location map by default $videoMapsDefault = $config->get('videosmapdefault'); // Load window library CFactory::load('libraries', 'window'); // Load necessary window css / javascript headers. CWindow::load(); // Load the video table // Load string helper CFactory::load('helpers', 'string'); $video =& JTable::getInstance('Video', 'CTable'); if (empty($videoId)) { $url = CRoute::_('index.php?option=com_community&view=videos', false); $mainframe->redirect($url, JText::_('COM_COMMUNITY_VIDEOS_ID_ERROR'), 'warning'); } if (!$video->load($videoId)) { $url = CRoute::_('index.php?option=com_community&view=videos', false); $mainframe->redirect($url, JText::_('COM_COMMUNITY_VIDEOS_NOT_AVAILABLE'), 'warning'); } // Setting up the sub menu CFactory::load('helpers', 'owner'); if (COwnerHelper::isCommunityAdmin() || $my->id == $video->creator && $my->id != 0) { $this->addSubmenuItem('', JText::_('COM_COMMUNITY_VIDEOS_FETCH_THUMBNAIL'), 'joms.videos.fetchThumbnail(\'' . $video->id . '\')', true); // Only add the set as profile video for video owner if ($my->id == $video->creator) { $this->addSubmenuItem('', JText::_('COM_COMMUNITY_VIDEOS_SET_AS_PROFILE'), 'joms.videos.linkConfirmProfileVideo(\'' . $video->id . '\')', true); } $redirectUrl = CRoute::getURI(false); $this->addSubmenuItem('', JText::_('COM_COMMUNITY_EDIT'), 'joms.videos.showEditWindow(\'' . $video->id . '\',\'' . $redirectUrl . '\');', true); $this->addSubmenuItem('', JText::_('COM_COMMUNITY_DELETE'), 'joms.videos.deleteVideo(\'' . $video->id . '\')', true); } $this->_addSubmenu(); $this->showSubmenu(); // Show the mini header when viewing other's photos if ($video->creator_type == VIDEO_USER_TYPE && $my->id != $video->creator) { $this->attachMiniHeaderUser($video->creator); } // Check permission $user = CFactory::getUser($video->creator); $blocked = $user->isBlocked(); if ($blocked && !COwnerHelper::isCommunityAdmin()) { $tmpl = new CTemplate(); echo $tmpl->fetch('profile.blocked'); return; } $sorted = JRequest::getVar('sort', 'latest'); $limit = JRequest::getVar('limitstart', 6); $permissions = $my->id == 0 ? 0 : 20; $cat_id = JRequest::getVar('cat_id', ''); $model = CFactory::getModel('videos'); if ($video->creator_type == VIDEO_GROUP_TYPE) { CFactory::load('helpers', 'group'); if (!CGroupHelper::allowViewMedia($groupId)) { $document->setTitle(JText::_('COM_COMMUNITY_RESTRICTED_ACCESS')); $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_RESTRICTED_ACCESS', 'notice')); echo JText::_('COM_COMMUNITY_GROUPS_VIDEO_MEMBER_PERMISSION'); return; } $group =& JTable::getInstance('Group', 'CTable'); $group->load($groupId); // Set pathway $pathway =& $mainframe->getPathway(); $pathway->addItem(JText::_('COM_COMMUNITY_GROUPS'), CRoute::_('index.php?option=com_community&view=groups')); $pathway->addItem($group->name, CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $groupId)); $pathway->addItem(JText::_('COM_COMMUNITY_VIDEOS'), CRoute::_('index.php?option=com_community&view=videos&groupid=' . $groupId)); $pathway->addItem($video->getTitle(), ''); $otherVideos = $model->getGroupVideos($groupId, $cat_id, $limit); } else { if (!$this->isPermitted($my->id, $video->creator, $video->permissions)) { $document->setTitle(JText::_('COM_COMMUNITY_RESTRICTED_ACCESS')); $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_RESTRICTED_ACCESS', 'notice')); switch ($video->permissions) { case '40': $this->noAccess(JText::_('COM_COMMUNITY_VIDEOS_OWNER_ONLY', 'notice')); break; case '30': $owner = CFactory::getUser($video->creator); $this->noAccess(JText::sprintf('COM_COMMUNITY_VIDEOS_FRIEND_PERMISSION_MESSAGE', $owner->getDisplayName())); break; default: $this->noAccess(); break; } return; } // Set pathway $pathway =& $mainframe->getPathway(); $pathway->addItem('Video', CRoute::_('index.php?option=com_community&view=videos')); $pathway->addItem($video->getTitle(), ''); $filters = array('status' => 'ready', 'category_id' => $cat_id, 'creator' => $user->id, 'permissions' => $permissions, 'or_group_privacy' => 0, 'sorting' => $sorted, 'limit' => $limit); $otherVideos = $model->getVideos($filters); } //var_dump($otherVideos); // Set the current user's active profile CFactory::setActiveProfile($video->creator); // Hit counter + 1 $video->hit(); // Get reporting html $reportHTML = ''; CFactory::load('libraries', 'reporting'); $report = new CReportingLibrary(); $reportHTML = $report->getReportingHTML(JText::_('COM_COMMUNITY_VIDEOS_REPORT_VIDEOS'), 'videos,reportVideo', array($video->id)); // Get bookmark html CFactory::load('libraries', 'bookmarks'); $bookmarks = new CBookmarks($video->getPermalink()); $bookmarksHTML = $bookmarks->getHTML(); // Get the walls CFactory::load('libraries', 'wall'); $wallContent = CWallLibrary::getWallContents('videos', $video->id, COwnerHelper::isCommunityAdmin() || $my->id == $video->creator && $my->id != 0, 10, 0); $wallCount = CWallLibrary::getWallCount('videos', $video->id); $viewAllLink = false; if (JRequest::getVar('task', '', 'REQUEST') != 'app') { $viewAllLink = CRoute::_('index.php?option=com_community&view=videos&task=app&videoid=' . $video->id . '&app=walls'); } $wallContent .= CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount); $wallForm = ''; if ($this->isPermitted($my->id, $video->creator, PRIVACY_FRIENDS) || !$config->get('lockvideoswalls')) { $wallForm = CWallLibrary::getWallInputForm($video->id, 'videos,ajaxSaveWall', 'videos,ajaxRemoveWall', $viewAllLink); } $redirectUrl = CRoute::getURI(false); // Get like CFactory::load('libraries', 'like'); $likes = new CLike(); $likesHTML = $likes->getHTML('videos', $video->id, $my->id); $tmpl = new CTemplate(); if ($video->creator_type == VIDEO_GROUP_TYPE) { $group =& JTable::getInstance('Group', 'CTable'); $group->load($groupId); $document = JFactory::getDocument(); $document->addHeadLink($group->getThumbAvatar(), 'image_src', 'rel'); } if ($video->location !== '' && $videoMapsDefault == 1) { CFactory::load('libraries', 'mapping'); $zoomableMap = CMapping::drawZoomableMap($video->location, 220, 150); } else { $zoomableMap = ""; } echo $tmpl->setMetaTags('video', $video)->set('user', $user)->set('zoomableMap', $zoomableMap)->set('likesHTML', $likesHTML)->set('redirectUrl', $redirectUrl)->set('wallForm', $wallForm)->set('wallContent', $wallContent)->set('bookmarksHTML', $bookmarksHTML)->set('reportHTML', $reportHTML)->set('video', $video)->set('otherVideos', $otherVideos)->fetch('videos.video'); }