public function blockUnregister() { $my = CFactory::getUser(); $config = CFactory::getConfig(); if ($my->id == 0) { $config = CFactory::getConfig(); $uri = CRoute::getURI(false); $uri = base64_encode($uri); $tmpl = new CTemplate(); $fbHtml = ''; if ($config->get('fbconnectkey') && $config->get('fbconnectsecret')) { CFactory::load('libraries', 'facebook'); $facebook = new CFacebook(FACEBOOK_LOGIN_NOT_REQUIRED); $fbHtml = $facebook->getButtonHTML(); } $tmpl->set('fbHtml', $fbHtml); $tmpl->set('return', $uri); $tmpl->set('config', $config); $html = $tmpl->fetch('guests.denied'); echo $html; return true; } return false; }
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'); } }
<div class="joms-textarea__loading"><img src="<?php echo JURI::root(true); ?> /components/com_community/assets/ajax-loader.gif" alt="loader" ></div> <div class="joms-textarea joms-textarea__attachment"> <button onclick="joms.view.comment.removeAttachment(this);">×</button> <div class="joms-textarea__attachment--loading"><img src="<?php echo JURI::root(true); ?> /components/com_community/assets/ajax-loader.gif" alt="loader"></div> <div class="joms-textarea__attachment--thumbnail"><img src="#" alt="attachment"></div> </div> </div> <svg viewBox="0 0 16 16" class="joms-icon joms-icon--add" onclick="joms.view.comment.addAttachment(this);"> <use xlink:href="<?php echo $isAjax ? '' : CRoute::getURI(); ?> #joms-icon-camera"></use> </svg> <span><input class="joms-button--comment joms-button--small joms-js--btn-send" type="submit" value="<?php echo JText::_('COM_COMMUNITY_SEND'); ?> "></span> </div> <script> joms_wall_remove_func = '<?php echo $ajaxRemoveFunc; ?> '; </script>
/** * Display the photo thumbnails from an album **/ public function album() { $document = JFactory::getDocument(); $mainframe = JFactory::getApplication(); $config = CFactory::getConfig(); $handler = $this->_getHandler(); $my = CFactory::getUser(); CFactory::load('libraries', 'activities'); // Get show photo location map by default $photoMapsDefault = $config->get('photosmapdefault'); $albumId = JRequest::getVar('albumid', '', 'GET'); $defaultId = JRequest::getVar('photo', '', 'GET'); $userId = JRequest::getVar('userid', '', 'GET'); $user = CFactory::getUser($userId); // Set pathway for group photos // Community > Groups > Group Name > Photos > Album Name $pathway =& $mainframe->getPathway(); $groupId = JRequest::getVar('groupid', '', 'GET'); if (!empty($groupId)) { $group =& JTable::getInstance('Group', 'CTable'); $group->load($groupId); $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_PHOTOS'), CRoute::_('index.php?option=com_community&view=photos&groupid=' . $groupId)); } else { $pathway->addItem(JText::_('COM_COMMUNITY_PHOTOS'), CRoute::_('index.php?option=com_community&view=photos')); $pathway->addItem(JText::sprintf('COM_COMMUNITY_PHOTOS_USER_PHOTOS_TITLE', $user->getDisplayName()), CRoute::_('index.php?option=com_community&view=photos&task=myphotos&userid=' . $userId)); } $handler->setMiniHeader(); if (empty($albumId)) { echo JText::_('COM_COMMUNITY_PHOTOS_NO_ALBUMID_ERROR'); return; } if (!$handler->isAlbumBrowsable($albumId)) { return; } $album =& JTable::getInstance('Album', 'CTable'); $album->load($albumId); //$photos = $handler->getAlbumPhotos( $album->id ); $photoPaginationLimit = intval($config->get('photopaginationlimit')); $photoThumbLimit = $photoPaginationLimit; $model = CFactory::getModel('photos'); $photos = $model->getPhotos($album->id, $photoThumbLimit, JRequest::getVar('limitstart', '0', 'GET')); $pagination = $model->getPagination(); $photo =& JTable::getInstance('Photo', 'CTable'); $photo->load($album->photoid); if ($album->photoid == '0') { $album->thumbnail = $photo->getThumbURI(); } else { $album->thumbnail = $photo->getImageURI(); } // Increment album's hit each time this page is loaded. $album->hit(); $otherAlbums = $model->_getOnlyAlbums($user->id, PHOTOS_USER_TYPE, 0, 20); $totalAlbums = count($otherAlbums); $showOtherAlbum = 6; $randomAlbum = array(); if (count($otherAlbums) > 0) { $randomId = $totalAlbums < $showOtherAlbum ? array_rand($otherAlbums, $totalAlbums) : array_rand($otherAlbums, $showOtherAlbum); $count = 0; for ($i = 0; $i < $totalAlbums; $i++) { $num = is_array($randomId) ? $randomId[$i] : $randomId; if ($otherAlbums[$num]->id != $album->id) { $count++; $randomAlbum[] = $otherAlbums[$num]; } if (count($randomAlbum) == $showOtherAlbum - 1) { break; } } } $js = 'assets/gallery'; $js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js'; CAssets::attach($js, 'js'); CFactory::load('helpers', 'string'); $document->setTitle(JText::sprintf('COM_COMMUNITY_PHOTOS_USER_PHOTOS_TITLE', $handler->getCreatorName()) . ' - ' . $album->name); $this->setTitle($album->name); $handler->setAlbumPathway(CStringHelper::escape($album->name)); $handler->setRSSHeader($albumId); // Set album thumbnail and description for social bookmarking sites linking $document->addHeadLink($album->getCoverThumbURI(), 'image_src', 'rel'); $document->setDescription(CStringHelper::escape($album->getDescription())); CFactory::load('libraries', 'phototagging'); $tagging = new CPhotoTagging(); $people = array(); $maxTime = $album->created; // Need to append the absolute path for the captions for ($i = 0; $i < count($photos); $i++) { $item =& JTable::getInstance('Photo', 'CTable'); $item->bind($photos[$i]); $photos[$i] = $item; $photo =& $photos[$i]; $photo->link = $handler->getPhotoURI($photo->id, $photo->albumid); $tags = $tagging->getTaggedList($photo->id); //Get last update $maxTime = $photo->created > $maxTime ? $photo->created : $maxTime; // Get the people in the tags foreach ($tags as $tag) { $people[] = $tag->userid; } } //Update lastUpdated $maxTime = new JDate($maxTime); $album->lastUpdated = CActivityStream::_createdLapse($maxTime, false); $people = array_unique($people); foreach ($people as &$person) { $person = CFactory::getUser($person); } CFactory::load('libraries', 'bookmarks'); $bookmarks = new CBookmarks($handler->getAlbumExternalURI($album->id)); // Get the walls CFactory::load('libraries', 'wall'); $wallContent = CWallLibrary::getWallContents('albums', $album->id, COwnerHelper::isCommunityAdmin() || $my->id == $album->creator && $my->id != 0, 10, 0); $wallCount = CWallLibrary::getWallCount('albums', $album->id); $viewAllLink = false; if (JRequest::getVar('task', '', 'REQUEST') != 'app') { $viewAllLink = CRoute::_('index.php?option=com_community&view=photos&task=app&albumid=' . $album->id . '&app=walls'); } $wallContent .= CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount); $wallForm = CWallLibrary::getWallInputForm($album->id, 'photos,ajaxAlbumSaveWall', 'photos,ajaxAlbumRemoveWall', $viewAllLink); $redirectUrl = CRoute::getURI(false); // Add tagging code // $tagsHTML = ''; // if($config->get('tags_photos')){ // CFactory::load('libraries', 'tags'); // $tags = new CTags(); // $tagsHTML = $tags->getHTML('albums', $album->id, $handler->isAlbumOwner( $album->id ) ); // } $this->showSubmenu(); $tmpl = new CTemplate(); if ($album->location != "") { CFactory::load('libraries', 'mapping'); $zoomableMap = CMapping::drawZoomableMap($album->location, 220, 150); } else { $zoomableMap = ""; } // Get the likes / dislikes item CFactory::load('libraries', 'like'); $like = new CLike(); $likesHTML = $like->getHTML('album', $album->id, $my->id); $owner = CFactory::getUser($album->creator); echo $tmpl->set('likesHTML', $likesHTML)->set('photosmapdefault', $photoMapsDefault)->set('my', $my)->set('bookmarksHTML', $bookmarks->getHTML())->set('isOwner', $handler->isAlbumOwner($album->id))->set('isAdmin', COwnerHelper::isCommunityAdmin())->set('owner', $owner)->set('photos', $photos)->set('people', $people)->set('album', $album)->set('otherAlbums', $randomAlbum)->set('likesHTML', $likesHTML)->set('wallForm', $wallForm)->set('wallContent', $wallContent)->set('zoomableMap', $zoomableMap)->set('pagination', $pagination)->fetch('photos.album'); }
/** * 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'); }
/** * Display the photo thumbnails from an album * */ public function album() { $document = JFactory::getDocument(); $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $config = CFactory::getConfig(); $handler = $this->_getHandler(); $my = CFactory::getUser(); //CFactory::load( 'libraries' , 'activities' ); // Get show photo location map by default $photoMapsDefault = $config->get('photosmapdefault'); $albumId = $jinput->get('albumid', 0, 'INT'); $album = JTable::getInstance('Album', 'CTable'); $album->load($albumId); $defaultId = $jinput->get('photoid', 0, 'INT'); $userId = $jinput->get('userid', 0, 'INT'); $limitstart = $jinput->get->get('limitstart', '0', 'INT'); if (empty($limitstart)) { $limitstart = $jinput->get->get('start', '0', 'INT'); } $user = CFactory::getUser($album->creator); // Set pathway for group photos // Community > Groups > Group Name > Photos > Album Name $pathway = $mainframe->getPathway(); if ($album->type == 'group') { if (!$my->authorise('community.view', 'photos.group.album.' . $album->groupid, $album)) { echo JText::_('COM_COMMUNITY_NOT_ALLOWED_TO_ACCESS_SECTION'); return; } } else { if (!$my->authorise('community.view', 'photos.user.album.' . $album->id)) { echo JText::_('COM_COMMUNITY_NOT_ALLOWED_TO_ACCESS_SECTION'); return; } } $groupId = $album->groupid; if ($groupId > 0) { $group = JTable::getInstance('Group', 'CTable'); $group->load($groupId); $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_PHOTOS'), CRoute::_('index.php?option=com_community&view=photos&groupid=' . $groupId)); } else { $pathway->addItem(JText::_('COM_COMMUNITY_PHOTOS'), CRoute::_('index.php?option=com_community&view=photos')); $pathway->addItem(JText::sprintf('COM_COMMUNITY_PHOTOS_USER_PHOTOS_TITLE', $user->getDisplayName()), CRoute::_('index.php?option=com_community&view=photos&task=myphotos&userid=' . $userId)); } $handler->setMiniHeader(); if (empty($albumId)) { echo JText::_('COM_COMMUNITY_PHOTOS_NO_ALBUMID_ERROR'); return; } if (is_null($album->id)) { echo JText::_('COM_COMMUNITY_ALBUM_DELETED'); return; } if (!$handler->isAlbumBrowsable($albumId)) { return; } //$photos = $handler->getAlbumPhotos( $album->id ); $photoPaginationLimit = intval($config->get('pagination')); $photoThumbLimit = $photoPaginationLimit; $model = CFactory::getModel('photos'); $photos = $model->getPhotos($album->id, $photoThumbLimit, $limitstart); $pagination = $model->getPagination(); $photo = JTable::getInstance('Photo', 'CTable'); $photo->load($album->photoid); if ($album->photoid == '0') { $album->thumbnail = $photo->getThumbURI(); } else { $album->thumbnail = $photo->getImageURI(); } // Increment album's hit each time this page is loaded. $album->hit(); if ($groupId > 0) { $otherAlbums = $model->getGroupAlbums($groupId); } else { $otherAlbums = $model->getAlbums($user->id); } $totalAlbums = count($otherAlbums); $showOtherAlbum = 6; $randomAlbum = array(); if (count($otherAlbums) > 0) { $randomId = $totalAlbums < $showOtherAlbum ? array_rand($otherAlbums, $totalAlbums) : array_rand($otherAlbums, $showOtherAlbum); $count = 0; for ($i = 0; $i < $totalAlbums; $i++) { $num = is_array($randomId) ? $randomId[$i] : $randomId; if ($otherAlbums[$num]->id != $album->id) { $count++; $randomAlbum[] = $otherAlbums[$num]; } if (count($randomAlbum) == $showOtherAlbum - 1) { break; } } } /* set head meta */ if (strtolower(trim(JText::sprintf('COM_COMMUNITY_PHOTOS_USER_PHOTOS_TITLE', $handler->getCreatorName()))) == strtolower(trim($album->name))) { /** * Opengraph */ CHeadHelper::setType('website', JText::sprintf('COM_COMMUNITY_PHOTOS_USER_PHOTOS_TITLE', $handler->getCreatorName()), CStringHelper::escape($album->getDescription())); } else { /** * Opengraph */ CHeadHelper::setType('website', JText::sprintf('COM_COMMUNITY_PHOTOS_USER_PHOTOS_TITLE', $handler->getCreatorName()) . ' - ' . $album->name, CStringHelper::escape($album->getDescription())); } $this->setTitle($album->name); $handler->setAlbumPathway(CStringHelper::escape($album->name)); $handler->setRSSHeader($albumId); // Set album thumbnail and description for social bookmarking sites linking $document->addHeadLink($album->getCoverThumbURI(), 'image_src', 'rel'); //$document->setDescription( CStringHelper::escape($album->getDescription()) ); //CFactory::load( 'libraries' , 'phototagging' ); $getTaggingUsers = new CPhotoTagging(); $people = array(); // @TODO temporary fix for undefined link $list = array(); foreach ($photos as $photo) { $photo->link = $handler->getPhotoURI($photo->id, $photo->albumid); CHeadHelper::addOpengraph('og:image', JUri::root(true) . '/' . $photo->image, true); $list[] = $photo; } $photos = $list; $albumParam = new Cparameter($album->params); $tagged = $albumParam->get('tagged'); if (!empty($tagged)) { $people = explode(',', $albumParam->get('tagged')); } //Update lastUpdated $lastUpdated = new JDate($album->lastupdated); $album->lastUpdated = CActivityStream::_createdLapse($lastUpdated, false); $people = array_unique($people); CFactory::loadUsers($people); foreach ($people as &$person) { $person = CFactory::getUser($person); } //CFactory::load( 'libraries' , 'bookmarks' ); $bookmarks = new CBookmarks($handler->getAlbumExternalURI($album->id)); // Get wall data. $wallCount = CWallLibrary::getWallCount('albums', $album->id); $viewAllLink = false; if ($jinput->request->get('task', '') != 'app') { $viewAllLink = CRoute::_('index.php?option=com_community&view=photos&task=app&albumid=' . $album->id . '&app=walls'); } $wallContent = CWallLibrary::getWallContents('albums', $album->id, COwnerHelper::isCommunityAdmin() || $my->id == $album->creator && $my->id != 0, $config->get('stream_default_comments'), 0, 'wall/content', 'photos,album'); $wallForm = CWallLibrary::getWallInputForm($album->id, 'photos,ajaxAlbumSaveWall', 'photos,ajaxAlbumRemoveWall', $viewAllLink); $viewAllLink = CRoute::_('index.php?option=com_community&view=photos&task=app&albumid=' . $album->id . '&app=walls'); $wallViewAll = ''; if ($wallCount > $config->get('stream_default_comments')) { $wallViewAll = CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount); } $redirectUrl = CRoute::getURI(false); $tmpl = new CTemplate(); if ($album->location != "") { $zoomableMap = CMapping::drawZoomableMap($album->location, 220, 150); } else { $zoomableMap = ""; } // Get the likes / dislikes item //CFactory::load( 'libraries' , 'like' ); $like = new CLike(); $likeCount = $like->getLikeCount('album', $album->id); $likeLiked = $like->userLiked('album', $album->id, $my->id) === COMMUNITY_LIKE; $owner = CFactory::getUser($album->creator); echo $tmpl->set('photosmapdefault', $photoMapsDefault)->set('my', $my)->set('bookmarksHTML', $bookmarks->getHTML())->set('isOwner', $handler->isAlbumOwner($album->id))->set('isAdmin', COwnerHelper::isCommunityAdmin())->set('owner', $owner)->set('photos', $photos)->set('people', $people)->set('album', $album)->set('groupId', $groupId)->set('otherAlbums', $randomAlbum)->set('likeCount', $likeCount)->set('likeLiked', $likeLiked)->set('wallContent', $wallContent)->set('wallForm', $wallForm)->set('wallCount', $wallCount)->set('wallViewAll', $wallViewAll)->set('zoomableMap', $zoomableMap)->set('pagination', $pagination)->set('photoId', $defaultId)->set('submenu', $this->showSubmenu(false))->fetch('photos/list'); }
public function browse($data = null) { //require_once (JPATH_COMPONENT . '/libraries/template.php'); $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $document = JFactory::getDocument(); $this->addPathway(JText::_('COM_COMMUNITY_GROUPS_MEMBERS'), ''); /** * Opengraph */ CHeadHelper::setType('website', JText::_('COM_COMMUNITY_GROUPS_MEMBERS')); $my = CFactory::getUser(); $view = CFactory::getView('search'); $searchModel = CFactory::getModel('search'); $userModel = CFactory::getModel('user'); $avatar = CFactory::getModel('avatar'); $friends = CFactory::getModel('friends'); $tmpl = new CTemplate(); $sorted = $jinput->get->get('sort', 'latest', 'STRING'); //JRequest::getVar( 'sort' , 'latest' , 'GET' ); $filter = JRequest::getWord('filter', 'all', 'GET'); $profiletype = $jinput->get('profiletype', 0, 'INT'); $rows = $searchModel->getPeople($sorted, $filter, $profiletype); $sortItems = array('online' => JText::_('COM_COMMUNITY_SORT_ONLINE'), 'latest' => JText::_('COM_COMMUNITY_SORT_LATEST'), 'alphabetical' => JText::_('COM_COMMUNITY_SORT_ALPHABETICAL')); $filterItems = array(); $config = CFactory::getConfig(); if ($config->get('alphabetfiltering')) { $filterItems = array('all' => JText::_('COM_COMMUNITY_JUMP_ALL'), 'abc' => JText::_('COM_COMMUNITY_JUMP_ABC'), 'def' => JText::_('COM_COMMUNITY_JUMP_DEF'), 'ghi' => JText::_('COM_COMMUNITY_JUMP_GHI'), 'jkl' => JText::_('COM_COMMUNITY_JUMP_JKL'), 'mno' => JText::_('COM_COMMUNITY_JUMP_MNO'), 'pqr' => JText::_('COM_COMMUNITY_JUMP_PQR'), 'stu' => JText::_('COM_COMMUNITY_JUMP_STU'), 'vwx' => JText::_('COM_COMMUNITY_JUMP_VWX'), 'yz' => JText::_('COM_COMMUNITY_JUMP_YZ'), 'others' => JText::_('COM_COMMUNITY_JUMP_OTHERS')); } $html = ''; $totalUser = $userModel->getMembersCount(); $resultRows = array(); $alreadyfriend = array(); // No need to pre-load multiple users at once since $searchModel->getPeople // already did for ($i = 0; $i < count($rows); $i++) { $row = $rows[$i]; $obj = clone $row; $user = CFactory::getUser($row->id); $obj->friendsCount = $user->getFriendCount(); $obj->user = $user; $obj->profileLink = CUrl::build('profile', '', array('userid' => $row->id)); $isFriend = CFriendsHelper::isConnected($row->id, $my->id); $connection = $friends->getFriendConnection($my->id, $row->id); $obj->isMyFriend = false; if (!empty($connection)) { if ($connection[0]->connect_from == $my->id) { $obj->isMyFriend = true; } } $obj->addFriend = !$isFriend && $my->id != $row->id ? true : false; if ($obj->addFriend) { $alreadyfriend[$row->id] = $row->id; } $resultRows[] = $obj; } $featuredList = $this->_cachedCall('getFeaturedMember', array(), '', array(COMMUNITY_CACHE_TAG_FEATURED)); $config = CFactory::getConfig(); if ($config->get('alphabetfiltering')) { $sortingsHTML = CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest'); $alphabetHTML = CFilterBar::getHTML(CRoute::getURI(), '', '', $filterItems, 'all'); } else { $sortingsHTML = CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest'); } $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=browse&filter=' . $filter . '&sort=' . $sorted), '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=browse&filter=' . $filter . '&sort=' . $sorted . '&profiletype=' . $profile->id), 'name' => $profile->name, 'selected' => $profile->id == $profiletype ? 1 : 0); } } } echo $tmpl->set('featuredList', $featuredList)->set('hasMultiprofile', $hasMultiprofile)->set('multiprofileArr', $multiprofileArr)->set('alreadyfriend', $alreadyfriend)->set('isCommunityAdmin', COwnerHelper::isCommunityAdmin())->set('data', $resultRows)->set('sortings', $sortingsHTML)->set('alphabet', $alphabetHTML)->set('my', $my)->set('submenu', $this->showSubmenu(false))->set('totalUser', $totalUser)->set('showFeaturedList', $config->get('show_featured'))->set('pagination', $searchModel->getPagination())->fetch('people.browse'); }
/** * 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'); }
function myinvites() { $mainframe =& JFactory::getApplication(); $userId = JRequest::getVar('userid', ''); // Load required filterbar library that will be used to display the filtering and sorting. CFactory::load('libraries', 'filterbar'); $document =& JFactory::getDocument(); $this->addPathway(JText::_('CC GROUPS'), CRoute::_('index.php?option=com_community&view=groups')); $this->addPathway(JText::_('CC GROUP PENDING INVITATIONS'), ''); $document->setTitle(JText::_('CC GROUP PENDING INVITATIONS')); $this->showSubmenu(); $feedLink = CRoute::_('index.php?option=com_community&view=groups&task=mygroups&userid=' . $userId . '&format=feed'); $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('CC SUBSCRIBE TO PENDING INVITATIONS FEED') . '" href="' . $feedLink . '"/>'; $mainframe->addCustomHeadTag($feed); $my = CFactory::getUser(); $model = CFactory::getModel('groups'); $discussionModel = CFactory::getModel('discussions'); $sorted = JRequest::getVar('sort', 'latest', 'GET'); $rows = $model->getGroupInvites($my->id); $pagination = $model->getPagination(count($rows)); $groups = array(); $ids = ''; if ($rows) { foreach ($rows as $row) { $table =& JTable::getInstance('Group', 'CTable'); $table->load($row->groupid); $groups[] = $table; $ids = empty($ids) ? $table->id : $ids . ',' . $table->id; } } $sortItems = array('latest' => JText::_('CC GROUP SORT LATEST'), 'alphabetical' => JText::_('CC SORT ALPHABETICAL'), 'mostdiscussed' => JText::_('CC GROUP SORT MOST DISCUSSED'), 'mostwall' => JText::_('CC GROUP SORT MOST WALL POST'), 'mostmembers' => JText::_('CC GROUP SORT MOST MEMBERS'), 'mostactive' => JText::_('CC GROUP SORT MOST ACTIVE')); $tmpl = new CTemplate(); $tmpl->set('groups', $groups); $tmpl->set('pagination', $pagination); $tmpl->set('count', $pagination->total); $tmpl->set('my', $my); $tmpl->set('sortings', CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest')); //echo $tmpl->fetch('groups.mygroups'); echo $tmpl->fetch('groups.myinvites'); }
/** * Display Upload video form for user * */ public function linkVideo() { if (!$this->accessAllowed('registered')) { echo JText::_('COM_COMMUNITY_MEMBERS_AREA'); return; } $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $document = JFactory::getDocument(); $config = CFactory::getConfig(); $my = CFactory::getUser(); $videoModel = CFactory::getModel('videos'); $pathway = $mainframe->getPathway(); $pathway->addItem(JText::_($my->getDisplayName()), CRoute::_('index.php?option=com_community&view=profile&userid=' . $my->id)); $pathway->addItem(JText::_('COM_COMMUNITY_VIDEOS_EDIT_PROFILE_VIDEO'), ''); // Load the toolbar //$this->showSubmenu(); /** * Opengraph */ CHeadHelper::setType('website', JText::_('COM_COMMUNITY_VIDEOS_EDIT_PROFILE_VIDEO')); $video = $this->_getCurrentProfileVideo(); $filters = array('creator' => $my->id, 'status' => 'ready', 'sorting' => $jinput->get('sort', 'latest', 'STRING')); $videos = $videoModel->getVideos($filters, true); $sortItems = array('latest' => JText::_('COM_COMMUNITY_VIDEOS_SORT_LATEST'), 'mostwalls' => JText::_('COM_COMMUNITY_VIDEOS_SORT_MOST_WALL_POST'), 'mostviews' => JText::_('COM_COMMUNITY_VIDEOS_SORT_POPULAR'), 'title' => JText::_('COM_COMMUNITY_VIDEOS_SORT_TITLE')); // Pagination $pagination = $videoModel->getPagination(); $redirectUrl = CRoute::getURI(false); $tmpl = new CTemplate(); echo $tmpl->set('my', $my)->set('video', $video)->set('sort', $jinput->get('sort', 'latest', 'STRING'))->set('videos', $videos)->set('sortings', CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest'))->set('pagination', $pagination)->set('videoThumbWidth', CVideoLibrary::thumbSize('width'))->set('videoThumbHeight', CVideoLibrary::thumbSize('height'))->set('redirectUrl', $redirectUrl)->set('submenu', $this->showSubmenu(false))->fetch('profile.linkvideo'); }
public function blockUnregister($uri = null) { $my = CFactory::getUser(); $config = CFactory::getConfig(); $usersConfig = JComponentHelper::getParams('com_users'); if ($my->id == 0) { $config = CFactory::getConfig(); if (empty($uri)) { $uri = CRoute::getURI(false); } $uri = base64_encode($uri); $tmpl = new CTemplate(); $fbHtml = ''; if ($config->get('fbconnectkey') && $config->get('fbconnectsecret') && !$config->get('usejfbc')) { $facebook = new CFacebook(); $fbHtml = $facebook->getLoginHTML(); } if ($config->get('usejfbc')) { if (class_exists('JFBCFactory')) { $providers = JFBCFactory::getAllProviders(); $fbHtml = ''; foreach ($providers as $p) { $fbHtml .= $p->loginButton(); } } } //hero image $heroImage = JURI::root() . 'components/com_community/assets/frontpage-image-default.jpg'; if (file_exists(COMMUNITY_PATH_ASSETS . 'frontpage-image.jpg')) { $heroImage = JURI::root() . 'components/com_community/assets/frontpage-image.jpg'; } else { if (file_exists(COMMUNITY_PATH_ASSETS . 'frontpage-image.png')) { $heroImage = JURI::root() . 'components/com_community/assets/frontpage-image.png'; } } $themeModel = CFactory::getModel('theme'); $settings = $themeModel->getSettings(); $tmpl->set('settings', $settings); $tmpl->set('heroImage', $heroImage); $tmpl->set('fbHtml', $fbHtml); $tmpl->set('return', $uri); $tmpl->set('allowUserRegister', $usersConfig->get('allowUserRegistration')); $tmpl->set('useractivation', $usersConfig->get('useractivation')); $html = $tmpl->fetch('guests.denied'); echo $html; return true; } return false; }
/** * DIsplay list of friends * * if no $_GET['id'] is set, we're viewing our own friends */ public function friends($data = null) { // Load window library CFactory::load('libraries', 'window'); // Load required filterbar library that will be used to display the filtering and sorting. CFactory::load('libraries', 'filterbar'); // Load necessary window css / javascript headers. CWindow::load(); $mainframe =& JFactory::getApplication(); $document = JFactory::getDocument(); $my = CFactory::getUser(); $id = JRequest::getInt('userid', null); if ($id == null) { $id = $my->id; } // Display mini header if user is viewing other user's friend if ($id != $my->id) { $this->attachMiniHeaderUser($id); } $feedLink = CRoute::_('index.php?option=com_community&view=friends&format=feed'); $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('COM_COMMUNITY_SUBSCRIBE_TO_FRIENDS_FEEDS') . '" href="' . $feedLink . '"/>'; $document->addCustomTag($feed); $friendsModel = CFactory::getModel('friends'); $user = CFactory::getUser($id); $params = $user->getParams(); CFactory::load('helpers', 'friends'); $people = CFactory::getModel('search'); $userModel = CFactory::getModel('user'); $avatar = CFactory::getModel('avatar'); $friends = CFactory::getModel('friends'); $sorted = JRequest::getVar('sort', 'latest', 'GET'); $filter = JRequest::getWord('filter', 'all', 'GET'); CFactory::load('helpers', 'friends'); $rows = $friends->getFriends($id, $sorted, true, $filter); $isMine = $id == $my->id && $my->id != 0; $document = JFactory::getDocument(); $this->addPathway(JText::_('COM_COMMUNITY_FRIENDS'), CRoute::_('index.php?option=com_community&view=friends')); if ($my->id == $id) { $this->addPathway(JText::_('COM_COMMUNITY_FRIENDS_MY_FRIENDS')); } else { $this->addPathway(JText::sprintf('COM_COMMUNITY_FRIENDS_ALL_FRIENDS', $user->getDisplayName())); } // Hide submenu if we are viewing other's friends if ($isMine) { $this->showSubmenu(); $document->setTitle(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); parent::showSubmenu(); $document->setTitle(JText::sprintf('COM_COMMUNITY_FRIENDS_ALL_FRIENDS', $user->getDisplayName())); } $sortItems = array('latest' => JText::_('COM_COMMUNITY_SORT_RECENT_FRIENDS'), 'online' => JText::_('COM_COMMUNITY_ONLINE'), 'name' => JText::_('COM_COMMUNITY_SORT_ALPHABETICAL')); $config = CFactory::getConfig(); $filterItems = array(); if ($config->get('alphabetfiltering')) { $filterItems = array('all' => JText::_('COM_COMMUNITY_JUMP_ALL'), 'abc' => JText::_('COM_COMMUNITY_JUMP_ABC'), 'def' => JText::_('COM_COMMUNITY_JUMP_DEF'), 'ghi' => JText::_('COM_COMMUNITY_JUMP_GHI'), 'jkl' => JText::_('COM_COMMUNITY_JUMP_JKL'), 'mno' => JText::_('COM_COMMUNITY_JUMP_MNO'), 'pqr' => JText::_('COM_COMMUNITY_JUMP_PQR'), 'stu' => JText::_('COM_COMMUNITY_JUMP_STU'), 'vwx' => JText::_('COM_COMMUNITY_JUMP_VWX'), 'yz' => JText::_('COM_COMMUNITY_JUMP_YZ'), 'others' => JText::_('COM_COMMUNITY_JUMP_OTHERS')); } // Check if friend is banned $blockModel = CFactory::getModel('block'); $resultRows = array(); // @todo: preload all friends foreach ($rows as $row) { $user = CFactory::getUser($row->id); $obj = clone $row; $obj->friendsCount = $user->getFriendCount(); $obj->profileLink = CUrlHelper::userLink($row->id); $obj->isFriend = true; $obj->isBlocked = $blockModel->getBlockStatus($user->id, $my->id); $resultRows[] = $obj; } unset($rows); // Should not show recently added filter to otehr people $sortingHTML = ''; if ($isMine) { $sortingHTML = CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest', $filterItems, 'all'); } $tmpl = new CTemplate(); $html = $tmpl->set('isMine', $isMine)->setRef('my', $my)->setRef('friends', $resultRows)->set('sortings', $sortingHTML)->set('config', CFactory::getConfig())->fetch('friends.list'); $html .= '<div class="pagination-container">'; $pagination = $friends->getPagination(); $html .= $pagination->getPagesLinks(); $html .= '</div>'; echo $html; }
public function display() { $id = JRequest::getVar('listid', ''); $list =& JTable::getInstance('MemberList', 'CTable'); $list->load($id); if (empty($list->id) || is_null($list->id)) { echo JText::_('CC INVALID ID'); return; } $document =& JFactory::getDocument(); $document->setTitle($list->getTitle()); $tmpCriterias = $list->getCriterias(); $criterias = array(); foreach ($list->getCriterias() as $criteria) { $obj = new stdClass(); $obj->field = $criteria->field; $obj->condition = $criteria->condition; $obj->fieldType = $criteria->type; switch ($criteria->type) { case 'date': if ($criteria->condition == 'between') { $date = explode(',', $criteria->value); $startDate = explode('/', $date[0]); $endDate = explode('/', $date[1]); $obj->value = array($startDate[2] . '-' . intval($startDate[1]) . '-' . $startDate[0] . ' 00:00:00', $endDate[2] . '-' . intval($endDate[1]) . '-' . $endDate[0] . ' 23:59:59'); } else { $startDate = explode('/', $criteria->value); $obj->value = $startDate[2] . '-' . intval($startDate[1]) . '-' . $startDate[0] . ' 00:00:00'; } 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::_('CC SORT LATEST'), 'online' => JText::_('CC SORT ONLINE'), 'alphabetical' => JText::_('CC SORT ALPHABETICAL')); $sorting = JRequest::getVar('sort', 'latest', 'GET'); $data = CAdvanceSearch::getResult($criterias, $list->condition, $list->avataronly, $sorting); $tmpl = new CTemplate(); $tmpl->set('list', $list); $tmpl->set('created', $created); $tmpl->set('sorting', CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest')); $html = $tmpl->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'); 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; $resultRows[] = $obj; } $tmpl = new CTemplate(); $tmpl->set('data', $resultRows); $tmpl->set('sortings', ''); $tmpl->set('pagination', $data->pagination); $tmpl->set('filter', ''); $tmpl->set('featuredList', $featuredList); $tmpl->set('my', $my); $tmpl->set('showFeaturedList', false); $tmpl->set('isCommunityAdmin', COwnerHelper::isCommunityAdmin()); $html .= $tmpl->fetch('people.browse'); echo $html; }
public function myinvites() { $mainframe =& JFactory::getApplication(); $userId = JRequest::getVar('userid', ''); $config = CFactory::getConfig(); // Load required filterbar library that will be used to display the filtering and sorting. CFactory::load('libraries', 'filterbar'); $document = JFactory::getDocument(); $this->addPathway(JText::_('COM_COMMUNITY_GROUPS'), CRoute::_('index.php?option=com_community&view=groups')); $this->addPathway(JText::_('COM_COMMUNITY_GROUPS_PENDING_INVITES'), ''); $document->setTitle(JText::_('COM_COMMUNITY_GROUPS_PENDING_INVITES')); $this->showSubmenu(); $feedLink = CRoute::_('index.php?option=com_community&view=groups&task=mygroups&userid=' . $userId . '&format=feed'); $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('COM_COMMUNITY_SUBSCRIBE_TO_PENDING_INVITATIONS_FEED') . '" href="' . $feedLink . '"/>'; $document->addCustomTag($feed); $my = CFactory::getUser(); $model = CFactory::getModel('groups'); $discussionModel = CFactory::getModel('discussions'); $sorted = JRequest::getVar('sort', 'latest', 'GET'); $rows = $model->getGroupInvites($my->id); $pagination = $model->getPagination(count($rows)); $groups = array(); $ids = ''; if ($rows) { foreach ($rows as $row) { $table =& JTable::getInstance('Group', 'CTable'); $table->load($row->groupid); $table->description = CStringHelper::clean(CStringHelper::truncate($table->description, $config->get('tips_desc_length'))); $groups[] = $table; $ids = empty($ids) ? $table->id : $ids . ',' . $table->id; } } $sortItems = array('latest' => JText::_('COM_COMMUNITY_GROUPS_SORT_LATEST'), 'alphabetical' => JText::_('COM_COMMUNITY_SORT_ALPHABETICAL'), 'mostactive' => JText::_('COM_COMMUNITY_GROUPS_SORT_MOST_ACTIVE')); $tmpl = new CTemplate(); echo $tmpl->set('groups', $groups)->set('pagination', $pagination)->set('count', $pagination->total)->set('my', $my)->set('sortings', CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest'))->fetch('groups.myinvites'); }
/** * DIsplay list of friends * * if no $_GET['id'] is set, we're viewing our own friends */ public function friends($data = null, $onlineFriendsOnly = false) { // Load necessary window css / javascript headers. CWindow::load(); $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $document = JFactory::getDocument(); $my = CFactory::getUser(); $userid = $jinput->get('userid', 0, 'INT'); $search = $jinput->get('search', false, 'STRING'); $searchQuery = $jinput->get('q', '', 'STRING'); $id = $userid ? $userid : $my->id; // Display mini header if user is viewing other user's friend if ($id != $my->id) { $this->attachMiniHeaderUser($id); } $feedLink = CRoute::_('index.php?option=com_community&view=friends&format=feed'); $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('COM_COMMUNITY_SUBSCRIBE_TO_FRIENDS_FEEDS') . '" href="' . $feedLink . '"/>'; $document->addCustomTag($feed); $user = CFactory::getUser($id); $params = $user->getParams(); $people = CFactory::getModel('search'); $userModel = CFactory::getModel('user'); $avatar = CFactory::getModel('avatar'); $friends = CFactory::getModel('friends'); $sorted = $jinput->get->get('sort', 'latest', 'STRING'); $filter = JRequest::getWord('filter', 'all', 'GET'); if ($searchQuery == '') { $rows = $friends->getFriends($id, $sorted, true, $filter); } else { $rows = $friends->getFriends($id, $sorted, true, 'friends', 0, $searchQuery); } $isMine = $id == $my->id && $my->id != 0; $document = JFactory::getDocument(); $this->addPathway(JText::_('COM_COMMUNITY_FRIENDS'), CRoute::_('index.php?option=com_community&view=friends')); if ($my->id == $id) { $this->addPathway(JText::_('COM_COMMUNITY_FRIENDS_MY_FRIENDS')); } else { $this->addPathway(JText::sprintf('COM_COMMUNITY_FRIENDS_ALL_FRIENDS', $user->getDisplayName())); } $featured = new CFeatured(FEATURED_USERS); $featuredList = $featured->getItemIds(); // Hide submenu if we are viewing other's friends if ($isMine) { $submenu = $this->showSubmenu(false); /** * 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); $submenu = parent::showSubmenu(false); /** * Opengraph */ CHeadHelper::setType('website', JText::sprintf('COM_COMMUNITY_FRIENDS_ALL_FRIENDS', $user->getDisplayName())); } $sortItems = array(); $config = CFactory::getConfig(); $filterItems = array(); if ($config->get('alphabetfiltering')) { $filterItems = array('all' => JText::_('COM_COMMUNITY_JUMP_ALL'), 'abc' => JText::_('COM_COMMUNITY_JUMP_ABC'), 'def' => JText::_('COM_COMMUNITY_JUMP_DEF'), 'ghi' => JText::_('COM_COMMUNITY_JUMP_GHI'), 'jkl' => JText::_('COM_COMMUNITY_JUMP_JKL'), 'mno' => JText::_('COM_COMMUNITY_JUMP_MNO'), 'pqr' => JText::_('COM_COMMUNITY_JUMP_PQR'), 'stu' => JText::_('COM_COMMUNITY_JUMP_STU'), 'vwx' => JText::_('COM_COMMUNITY_JUMP_VWX'), 'yz' => JText::_('COM_COMMUNITY_JUMP_YZ'), 'others' => JText::_('COM_COMMUNITY_JUMP_OTHERS')); } // Check if friend is banned $blockModel = CFactory::getModel('block'); $resultRows = array(); // @todo: preload all friends foreach ($rows as $row) { $user = CFactory::getUser($row->id); $obj = clone $row; $obj->friendsCount = $user->getFriendCount(); $obj->profileLink = CUrlHelper::userLink($row->id); $obj->isFriend = true; $obj->isBlocked = $blockModel->getBlockStatus($user->id, $my->id); //display online friends only. if ($onlineFriendsOnly && !$user->isOnline()) { continue; } //if this is a search, only apply to those with subset of search name if ($search) { // if( trim($searchQuery) != '' && strpos(strtolower($user->getDisplayName()), strtolower($searchQuery)) === false){ // continue; // } } $resultRows[] = $obj; } unset($rows); // Should not show recently added filter to otehr people $sortingHTML = ''; if ($isMine) { $sortingHTML = CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest', $filterItems, 'all'); } $pagination = $friends->getPagination(); $tmpl = new CTemplate(); $html = $tmpl->set('isMine', $isMine)->set('userid', $userid)->setRef('my', $my)->set('search', $search)->set('searchQuery', $searchQuery)->setRef('friends', $resultRows)->set('sortings', $sortingHTML)->set('config', CFactory::getConfig())->set('submenu', $submenu)->set('featuredList', $featuredList)->set('pagination', $pagination)->fetch('friends/list'); echo $html; }
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'); }
/** * Display Upload video form for user **/ function linkVideo() { if (!$this->accessAllowed('registered')) { echo JText::_('CC MEMBERS AREA'); return; } CFactory::load('libraries', 'filterbar'); CFactory::load('libraries', 'videos'); CFactory::load('helpers', 'videos'); $mainframe =& JFactory::getApplication(); $document =& JFactory::getDocument(); $config = CFactory::getConfig(); $my = CFactory::getUser(); $videoModel = CFactory::getModel('videos'); $pathway =& $mainframe->getPathway(); $pathway->addItem(JText::_($my->getDisplayName()), CRoute::_('index.php?option=com_community&view=profile&userid=' . $my->id)); $pathway->addItem(JText::_('CC EDIT PROFILE VIDEO'), ''); // Load the toolbar $this->showSubmenu(); $document->setTitle(JText::_('CC EDIT PROFILE VIDEO')); $video = $this->_getCurrentProfileVideo(); $filters = array('creator' => $my->id, 'status' => 'ready', 'sorting' => JRequest::getVar('sort', 'latest')); $videos = $videoModel->getVideos($filters, true); $sortItems = array('latest' => JText::_('CC VIDEO SORT LATEST'), 'mostwalls' => JText::_('CC VIDEO SORT MOST WALL POST'), 'mostviews' => JText::_('CC VIDEO SORT POPULAR'), 'title' => JText::_('CC VIDEO SORT TITLE')); // Pagination $pagination = $videoModel->getPagination(); $redirectUrl = CRoute::getURI(false); $tmpl = new CTemplate(); $tmpl->set('my', $my); $tmpl->set('video', $video); $tmpl->set('sort', JRequest::getVar('sort', 'latest')); $tmpl->set('videos', $videos); $tmpl->set('sortings', CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest')); $tmpl->set('pagination', $pagination); $tmpl->set('videoThumbWidth', CVideoLibrary::thumbSize('width')); $tmpl->set('videoThumbHeight', CVideoLibrary::thumbSize('height')); $tmpl->set('redirectUrl', $redirectUrl); echo $tmpl->fetch('profile.linkvideo'); }
function myinvites() { if (!$this->accessAllowed('registered')) { return; } $mainframe =& JFactory::getApplication(); $document =& JFactory::getDocument(); $config =& CFactory::getConfig(); $my = CFactory::getUser(); $userid = JRequest::getCmd('userid', null); $this->addPathway(JText::_('CC EVENTS'), CRoute::_('index.php?option=com_community&view=events')); $this->addPathway(JText::_('CC EVENT PENDING INVITATIONS'), ''); $document->setTitle(JText::_('CC EVENT PENDING INVITATIONS')); $this->showSubmenu(); $feedLink = CRoute::_('index.php?option=com_community&view=events&userid=' . $userid . '&format=feed'); $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('CC SUBSCRIBE TO PENDING INVITATIONS FEED') . '" href="' . $feedLink . '"/>'; $mainframe->addCustomHeadTag($feed); CFactory::load('libraries', 'filterbar'); CFactory::load('helpers', 'event'); CFactory::load('helpers', 'owner'); CFactory::load('models', 'events'); $sorted = JRequest::getVar('sort', 'startdate', 'GET'); $model = CFactory::getModel('events'); $pending = COMMUNITY_EVENT_STATUS_INVITED; // It is safe to pass 0 as the category id as the model itself checks for this value. $rows = $model->getEvents(null, $my->id, $sorted, null, true, false, $pending); $pagination = $model->getPagination(); $count = count($rows); $tmpl = new CTemplate(); $sortItems = array('latest' => JText::_('CC SORT EVENT CREATED'), 'startdate' => JText::_('CC SORT EVENT STARTDATE')); $events = array(); if ($rows) { foreach ($rows as $row) { $event =& JTable::getInstance('Event', 'CTable'); $event->bind($row); $events[] = $event; } unset($eventObjs); } $tmpl = new CTemplate(); $tmpl->set('events', $events); $tmpl->set('pagination', $pagination); $tmpl->set('config', $config); $tmpl->set('isCommunityAdmin', COwnerHelper::isCommunityAdmin()); $tmpl->set('sortings', CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'startdate')); $tmpl->set('my', $my); $tmpl->set('count', $count); echo $tmpl->fetch('events.myinvites'); }
public function blockUnregister($uri = null) { $my = CFactory::getUser(); $config = CFactory::getConfig(); $usersConfig = JComponentHelper::getParams('com_users'); if ($my->id == 0) { $config = CFactory::getConfig(); if (empty($uri)) { $uri = CRoute::getURI(false); } $uri = base64_encode($uri); $tmpl = new CTemplate(); $fbHtml = ''; if ($config->get('fbconnectkey') && $config->get('fbconnectsecret') && !$config->get('usejfbc')) { $facebook = new CFacebook(); $fbHtml = $facebook->getLoginHTML(); } if ($config->get('usejfbc')) { if (class_exists('JFBCFactory')) { $providers = JFBCFactory::getAllProviders(); $fbHtml = ''; foreach ($providers as $p) { $fbHtml .= $p->loginButton(); } } } $tmpl->set('fbHtml', $fbHtml); $tmpl->set('return', $uri); $tmpl->set('allowUserRegister', $usersConfig->get('allowUserRegistration')); $tmpl->set('useractivation', $usersConfig->get('useractivation')); $html = $tmpl->fetch('guests.denied'); echo $html; return true; } return false; }
/** * Return formatted comment given the wall item */ public static function formatComment($wall) { $config = CFactory::getConfig(); $my = CFactory::getUser(); $actModel = CFactory::getModel('activities'); $like = new CLike(); $likeCount = $like->getLikeCount('comment', $wall->id); $isLiked = $like->userLiked('comment', $wall->id, $my->id); $user = CFactory::getUser($wall->post_by); // Censor if the user is banned if ($user->block) { $wall->comment = $origComment = JText::_('COM_COMMUNITY_CENSORED'); } else { // strip out the comment data $CComment = new CComment(); $wall->comment = $CComment->stripCommentData($wall->comment); // Need to perform basic formatting here // 1. support nl to br, // 2. auto-link text $CTemplate = new CTemplate(); $wall->comment = $origComment = $CTemplate->escape($wall->comment); $wall->comment = CStringHelper::autoLink($wall->comment); } $commentsHTML = ''; $commentsHTML .= '<div class="cComment wall-coc-item" id="wall-' . $wall->id . '"><a href="' . CUrlHelper::userLink($user->id) . '"><img src="' . $user->getThumbAvatar() . '" alt="" class="wall-coc-avatar" /></a>'; $date = new JDate($wall->date); $commentsHTML .= '<a class="wall-coc-author" href="' . CUrlHelper::userLink($user->id) . '">' . $user->getDisplayName() . '</a> '; $commentsHTML .= $wall->comment; $commentsHTML .= '<span class="wall-coc-time">' . CTimeHelper::timeLapse($date); $cid = isset($wall->contentid) ? $wall->contentid : null; $activity = $actModel->getActivity($cid); $ownPost = $my->id == $wall->post_by; $allowRemove = $my->authorise('community.delete', 'walls', $wall); $canEdit = $config->get('wallediting') && $my->id == $wall->post_by || COwnerHelper::isCommunityAdmin(); // only poster can edit if ($allowRemove) { $commentsHTML .= ' <span class="wall-coc-remove-link">• <a href="#removeComment">' . JText::_('COM_COMMUNITY_WALL_REMOVE') . '</a></span>'; } $commentsHTML .= '</span>'; $commentsHTML .= '</div>'; $editHTML = ''; if ($config->get('wallediting') && $ownPost || COwnerHelper::isCommunityAdmin()) { $editHTML .= '<a href="javascript:" class="joms-button--edit">'; $editHTML .= '<svg viewBox="0 0 16 16" class="joms-icon"><use xlink:href="' . CRoute::getURI() . '#joms-icon-pencil"></use></svg>'; $editHTML .= '<span>' . JText::_('COM_COMMUNITY_EDIT') . '</span>'; $editHTML .= '</a>'; } $removeHTML = ''; if ($allowRemove) { $removeHTML .= '<a href="javascript:" class="joms-button--remove">'; $removeHTML .= '<svg viewBox="0 0 16 16" class="joms-icon"><use xlink:href="' . CRoute::getURI() . '#joms-icon-remove"></use></svg>'; $removeHTML .= '<span>' . JText::_('COM_COMMUNITY_WALL_REMOVE') . '</span>'; $removeHTML .= '</a>'; } $removeTagHTML = ''; if (CActivitiesHelper::hasTag($my->id, $wall->comment)) { $removeTagHTML = '<span><a data-action="remove-tag" data-id="' . $wall->id . '" href="javascript:">' . JText::_('COM_COMMUNITY_WALL_REMOVE_TAG') . '</a></span>'; } /* user deleted */ if ($user->guest == 1) { $userLink = '<span class="cStream-Author">' . $user->getDisplayName() . '</span> '; } else { $userLink = '<a class="cStream-Avatar cStream-Author cFloat-L" href="' . CUrlHelper::userLink($user->id) . '"> <img class="cAvatar" src="' . $user->getThumbAvatar() . '"> </a> '; } $params = $wall->params; $paramsHTML = ''; $image = (array) $params->get('image'); $photoThumbnail = false; if ($params->get('attached_photo_id') > 0) { $photo = JTable::getInstance('Photo', 'CTable'); $photo->load($params->get('attached_photo_id')); $photoThumbnail = $photo->getThumbURI(); $paramsHTML .= '<div style="padding: 5px 0"><img class="joms-stream-thumb" src="' . $photoThumbnail . '" /></div>'; } else { if ($params->get('title')) { $video = self::detectVideo($params->get('url')); if (is_object($video)) { $paramsHTML .= '<div class="joms-media--video joms-js--video"'; $paramsHTML .= ' data-type="' . $video->type . '"'; $paramsHTML .= ' data-id="' . $video->id . '"'; $paramsHTML .= ' data-path="' . ($video->type === 'file' ? JURI::root(true) . '/' : '') . $video->path . '"'; $paramsHTML .= ' style="margin-top:10px;">'; $paramsHTML .= '<div class="joms-media__thumbnail">'; $paramsHTML .= '<img src="' . $video->getThumbnail() . '">'; $paramsHTML .= '<a href="javascript:" class="mejs-overlay mejs-layer mejs-overlay-play joms-js--video-play joms-js--video-play-' . $wall->id . '">'; $paramsHTML .= '<div class="mejs-overlay-button"></div>'; $paramsHTML .= '</a>'; $paramsHTML .= '</div>'; $paramsHTML .= '<div class="joms-media__body">'; $paramsHTML .= '<h4 class="joms-media__title">' . JHTML::_('string.truncate', $video->title, 50, true, false) . '</h4>'; $paramsHTML .= '<p class="joms-media__desc">' . JHTML::_('string.truncate', $video->description, $config->getInt('streamcontentlength'), true, false) . '</p>'; $paramsHTML .= '</div>'; $paramsHTML .= '</div>'; } else { $paramsHTML .= '<div class="joms-gap"></div>'; $paramsHTML .= '<div class="joms-media--album joms-relative joms-js--comment-preview">'; if ($user->id == $my->id || COwnerHelper::isCommunityAdmin()) { $paramsHTML .= '<span class="joms-media__remove" data-action="remove-preview" onClick="joms.api.commentRemovePreview(\'' . $wall->id . '\');"><svg viewBox="0 0 16 16" class="joms-icon"><use xlink:href="#joms-icon-remove"></use></svg></span>'; } if ($params->get('image')) { $paramsHTML .= $params->get('link'); $paramsHTML .= '<div class="joms-media__thumbnail">'; $paramsHTML .= '<a href="' . $params->get('link') ? $params->get('link') : '#' . '">'; $paramsHTML .= '<img src="' . array_shift($image) . '" />'; $paramsHTML .= '</a>'; $paramsHTML .= '</div>'; } $url = $params->get('url') ? $params->get('url') : '#'; $paramsHTML .= '<div class="joms-media__body">'; $paramsHTML .= '<a href="' . $url . '">'; $paramsHTML .= '<h4 class="joms-media__title">' . $params->get('title') . '</h4>'; $paramsHTML .= '<p class="joms-media__desc reset-gap">' . CStringHelper::trim_words($params->get('description')) . '</p>'; if ($params->get('link')) { $paramsHTML .= '<span class="joms-text--light"><small>' . preg_replace('#^https?://#', '', $params->get('link')) . '</small></span>'; } $paramsHTML .= '</a></div></div>'; } } } if (!$params->get('title') && $params->get('url')) { $paramsHTML .= '<div class="joms-gap"></div>'; $paramsHTML .= '<div class="joms-media--album">'; $paramsHTML .= '<a href="' . $params->get('url') . '">'; $paramsHTML .= '<img class="joms-stream-thumb" src="' . $params->get('url') . '" />'; $paramsHTML .= '</a>'; $paramsHTML .= '</div>'; } $wall->comment = nl2br($wall->comment); $wall->comment = CUserHelper::replaceAliasURL($wall->comment); $wall->comment = CStringHelper::getEmoticon($wall->comment); $wall->comment = CStringHelper::converttagtolink($wall->comment); // convert to hashtag $template = new CTemplate(); $template->set('wall', $wall)->set('originalComment', $origComment)->set('date', $date)->set('isLiked', $isLiked)->set('likeCount', $likeCount)->set('canRemove', $allowRemove)->set('canEdit', $canEdit)->set('canRemove', $allowRemove)->set('user', $user)->set('photoThumbnail', $photoThumbnail)->set('paramsHTML', $paramsHTML); $commentsHTML = $template->fetch('stream/single-comment'); return $commentsHTML; }
<script type="text/javascript"> function clearInputs() { joms.jQuery('#username').val(''); joms.jQuery('#password').val(''); joms.jQuery('#username').focus(); } window.scrollTo(0, 1); </script> <form action="<?php echo CRoute::getURI() . 'screen=mobile'; ?> " method="post" name="login" id="form-login"> <div class="loginform"> <div class="loginform-label"><?php echo JText::_('COM_COMMUNITY_USERNAME'); ?> </div> <div class="loginform-input"> <input type="text" class="inputbox frontlogin" name="username" id="username" size="18" value="your username" onFocus="if(this.value==this.defaultValue) this.value='';" onBlur="if(this.value=='') this.value=this.defaultValue;"/> </div> <div class="clear"></div> <div class="loginform-label"><?php
<?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; ?> <div class="cLayout cGroups-Create"> <form method="post" action="<?php echo CRoute::getURI(); ?> " id="createGroup" name="jsform-groups-create" class="cForm community-form-validate"> <?php if ($isNew) { ?> <p> <?php echo JText::_('COM_COMMUNITY_GROUPS_CREATE_DESC'); ?> </p> <?php if ($groupCreationLimit != 0 && $groupCreated / $groupCreationLimit >= COMMUNITY_SHOW_LIMIT) { ?> <div class="hints"> <?php
function browse($data = null) { require_once JPATH_COMPONENT . DS . 'libraries' . DS . 'template.php'; $mainframe =& JFactory::getApplication(); $document =& JFactory::getDocument(); // Load required filterbar library that will be used to display the filtering and sorting. CFactory::load('libraries', 'filterbar'); $this->addPathway(JText::_('CC MEMBERS'), ''); $document->setTitle(JText::_('CC MEMBERS')); CFactory::load('helpers', 'friends'); CFactory::load('libraries', 'template'); CFactory::load('libraries', 'tooltip'); CFactory::load('helpers', 'owner'); CFactory::load('libraries', 'featured'); $my = CFactory::getUser(); $view = CFactory::getView('search'); $searchModel = CFactory::getModel('search'); $userModel = CFactory::getModel('user'); $avatar = CFactory::getModel('avatar'); $friends = CFactory::getModel('friends'); $tmpl = new CTemplate(); $sorted = JRequest::getVar('sort', 'latest', 'GET'); $filter = JRequest::getWord('filter', 'all', 'GET'); $rows = $searchModel->getPeople($sorted, $filter); $sortItems = array('latest' => JText::_('CC SORT LATEST'), 'online' => JText::_('CC SORT ONLINE'), 'alphabetical' => JText::_('CC SORT ALPHABETICAL')); $filterItems = array(); $config = CFactory::getConfig(); if ($config->get('alphabetfiltering')) { $filterItems = array('all' => JText::_('CC ALL'), 'abc' => JText::_('CC ABC'), 'def' => JText::_('CC DEF'), 'ghi' => JText::_('CC GHI'), 'jkl' => JText::_('CC JKL'), 'mno' => JText::_('CC MNO'), 'pqr' => JText::_('CC PQR'), 'stu' => JText::_('CC STU'), 'vwx' => JText::_('CC VWX'), 'yz' => JText::_('CC YZ'), 'others' => JText::_('CC OTHERS')); } $html = ''; $totalUser = $userModel->getMembersCount(); $resultRows = array(); // No need to pre-load multiple users at once since $searchModel->getPeople // already did for ($i = 0; $i < count($rows); $i++) { $row =& $rows[$i]; $obj = clone $row; $user = CFactory::getUser($row->id); $obj->friendsCount = $user->getFriendCount(); $obj->user = $user; $obj->profileLink = CUrl::build('profile', '', array('userid' => $row->id)); $isFriend = CFriendsHelper::isConnected($row->id, $my->id); $obj->addFriend = !$isFriend && $my->id != $row->id ? true : false; $resultRows[] = $obj; } $featured = new CFeatured(FEATURED_USERS); $featuredList = $featured->getItemIds(); $config = CFactory::getConfig(); if ($config->get('alphabetfiltering')) { $sortingsHTML = CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest', $filterItems, 'all'); } else { $sortingsHTML = CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest'); } $tmpl->set('featuredList', $featuredList); $tmpl->set('isCommunityAdmin', COwnerHelper::isCommunityAdmin()); $tmpl->set('featuredList', $featuredList); $tmpl->set('data', $resultRows); $tmpl->set('sortings', $sortingsHTML); $tmpl->set('my', $my); $tmpl->set('totalUser', $totalUser); $tmpl->set('showFeaturedList', true); $tmpl->set('pagination', $searchModel->getPagination()); echo $tmpl->fetch('people.browse'); }