Example #1
0
 function onProfileStatusUpdate(&$userid, &$old_status, &$new_status)
 {
     JPlugin::loadLanguage('plg_statustowall', JPATH_ADMINISTRATOR);
     $my =& CFactory::getUser();
     $user =& CFactory::getUser($userid);
     include_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'wall.php';
     CWallLibrary::saveWall($userid, JText::sprintf('STATUS UPDATE', $new_status), 'user', $my, $my->id == $user->id);
 }
Example #2
0
 public static function getActivityContentHTML($act)
 {
     // Ok, the activity could be an upload OR a wall comment. In the future, the content should
     // indicate which is which
     $html = '';
     $param = new CParameter($act->params);
     $action = $param->get('action', false);
     if ($action == 'events.create') {
         return CEvents::getEventSummary($act->cid, $param);
     } else {
         if ($action == 'event.join' || $action == 'event.attendence.attend') {
             return CEvents::getEventSummary($act->cid, $param);
         } else {
             if ($action == 'event.wall.create' || $action == 'events.wall.create') {
                 $wallid = $param->get('wallid', 0);
                 $html = CWallLibrary::getWallContentSummary($wallid);
                 return $html;
             }
         }
     }
     return $html;
 }
Example #3
0
 public function ajaxUpdateWall($wallId, $message, $editableFunc)
 {
     $filter = JFilterInput::getInstance();
     $wallId = $filter->clean($wallId, 'int');
     $editableFunc = $filter->clean($editableFunc, 'string');
     $wall =& JTable::getInstance('Wall', 'CTable');
     $wall->load($wallId);
     $objResponse = new JAXresponse();
     if (empty($message)) {
         $objResponse->addScriptCall('alert', JText::_('COM_COMMUNITY_EMPTY_MESSAGE'));
         return $objResponse->sendResponse();
     }
     CFactory::load('libraries', 'wall');
     $isEditable = CWall::isEditable($editableFunc, $wall->id);
     if (!$isEditable) {
         $response->addScriptCall('cWindowAddContent', JText::_('COM_COMMUNITY_NOT_ALLOWED_TO_EDIT'));
         return $objResponse->sendResponse();
     }
     CFactory::load('libraries', 'comment');
     // We don't want to touch the comments data.
     $comments = CComment::getRawCommentsData($wall->comment);
     $wall->comment = $message;
     $wall->comment .= $comments;
     $my = CFactory::getUser();
     $data = CWallLibrary::saveWall($wall->contentid, $wall->comment, $wall->type, $my, false, $editableFunc, 'wall.content', $wall->id);
     $objResponse = new JAXResponse();
     $objResponse->addScriptCall('joms.walls.update', $wall->id, $data->content);
     return $objResponse->sendResponse();
 }
Example #4
0
 /**
  * Fetches the wall content template and returns the wall data in HTML format
  *
  * @param    appType            The application type to load the walls from
  * @param    uniqueId        The unique id for the specific application
  * @param    isOwner            Boolean value if the current browser is owner of the specific app or profile
  * @param    limit            The limit to display the walls
  * @param    templateFile    The template file to use.
  * */
 public static function getWallContents($appType, $uniqueId, $isOwner, $limit = 0, $limitstart = 0, $templateFile = 'wall/content', $processFunc = '', $param = null, $banned = 0)
 {
     CError::assert($appType, '', '!empty', __FILE__, __LINE__);
     //CError::assert($uniqueId, '', '!empty', __FILE__, __LINE__);
     $config = CFactory::getConfig();
     $html = '<div class="joms-comment joms-js--comments joms-js--comments-' . $uniqueId . '" data-id="' . $uniqueId . '" data-type="' . $appType . '">';
     $model = CFactory::getModel('wall');
     if ($limit == 0) {
         $limit = 20000;
         // let there be no limit at all
     }
     if ($appType == 'albums' || $appType == 'photos' || $appType == 'videos') {
         $order = 'DESC';
         $walls = $model->getPost($appType, $uniqueId, $limit, $limitstart, $order);
         if (count($walls)) {
             $walls = array_reverse($walls);
         }
     } else {
         // Special 'discussions'
         $order = 'DESC';
         $walls = $model->getPost($appType, $uniqueId, $limit, $limitstart, $order);
     }
     // Special 'discussions'
     $discussionsTrigger = false;
     //$order = $config->get('group_discuss_order');
     if ($appType == 'discussions' && $order == 'DESC') {
         $walls = array_reverse($walls);
         $discussionsTrigger = true;
     }
     if ($walls) {
         //Process wall comments
         $wallComments = array();
         $comment = new CComment();
         for ($i = 0; $i < count($walls); $i++) {
             // Set comments
             $wall = $walls[$i];
             $wallComments[] = $wall->comment;
             if (CFactory::getUser($wall->post_by)->block) {
                 $wall->comment = JText::_('COM_COMMUNITY_CENSORED');
             } else {
                 $wall->comment = $comment->stripCommentData($wall->comment);
             }
             // Change '->created to lapse format if stream uses lapse format'
             if ($config->get('activitydateformat') == 'lapse') {
                 //$wall->date = CTimeHelper::timeLapse($wall->date);
             }
         }
         // Trigger the wall applications / plugins
         CWall::triggerWallComments($walls);
         for ($i = 0; $i < count($walls); $i++) {
             if ($banned == 1) {
                 $html .= CWallLibrary::_getWallHTML($walls[$i], $wallComments[$i], $appType, $isOwner, $processFunc, $templateFile, $banned);
             } else {
                 $html .= CWallLibrary::_getWallHTML($walls[$i], $wallComments[$i], $appType, $isOwner, $processFunc, $templateFile);
             }
         }
         // if ($appType == 'discussions') {
         //     $wallCount = CWallLibrary::getWallCount('discussions', $uniqueId);
         //     $limitStart = $limitstart + $limit;
         //     if ($wallCount > $limitStart) {
         //         $groupId = JRequest::getInt('groupid');
         //         $groupId = empty($groupId) ? $param : $groupId;
         //         if ($discussionsTrigger) {
         //             $html = CWallLibrary::_getOlderWallsHTML($groupId, $uniqueId, $limitStart) . $html;
         //         } else {
         //             $html .= CWallLibrary::_getOlderWallsHTML($groupId, $uniqueId, $limitStart);
         //         }
         //     }
         // }
     }
     $html .= '</div>';
     return $html;
 }
Example #5
0
 /**
  * Responsible for displaying the event page.
  **/
 function viewevent()
 {
     $mainframe = JFactory::getApplication();
     $document = JFactory::getDocument();
     $config = CFactory::getConfig();
     $my = CFactory::getUser();
     CFactory::load('libraries', 'tooltip');
     CFactory::load('libraries', 'wall');
     CFactory::load('libraries', 'window');
     CWindow::load();
     $eventid = JRequest::getInt('eventid', 0);
     $eventModel =& CFactory::getModel('events');
     $event =& JTable::getInstance('Event', 'CTable');
     CFactory::load('helpers', 'event');
     $handler = CEventHelper::getHandler($event);
     $event->load($eventid);
     if (!$handler->exists()) {
         $mainframe->enqueueMessage(JText::_('CC EVENTS NOT AVAILABLE'), 'error');
         return;
     }
     if (!$handler->browsable()) {
         echo JText::_('CC NOT ALLOWED TO ACCESS SECTION');
         return;
     }
     // @rule: Test if the group is unpublished, don't display it at all.
     if (!$event->published) {
         echo JText::_('CC EVENTS UNDER MODERATION');
         return;
     }
     $this->showSubmenu();
     $event->hit();
     // Basic page presentation
     if ($event->type == 'group') {
         $groupId = $event->contentid;
         $group =& JTable::getInstance('Group', 'CTable');
         $group->load($groupId);
         // Set pathway for group videos
         // Community > Groups > Group Name > Events
         $this->addPathway(JText::_('CC GROUPS'), CRoute::_('index.php?option=com_community&view=groups'));
         $this->addPathway($group->name, CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $groupId));
     }
     $this->addPathway(JText::_('CC EVENTS'), CRoute::_('index.php?option=com_community&view=events'));
     $this->addPathway(JText::sprintf('CC VIEW EVENTS TITLE', $event->title), '');
     // Permissions and privacies
     CFactory::load('helpers', 'owner');
     $isEventGuest = $event->isMember($my->id);
     $isMine = $my->id == $event->creator;
     $isAdmin = $event->isAdmin($my->id);
     $isCommunityAdmin = COwnerHelper::isCommunityAdmin();
     // Get Event Admins
     $eventAdmins = $event->getAdmins(12, CC_RANDOMIZE);
     $eventAdminsCount = $event->getAdminsCount();
     // Attach avatar of the admin
     for ($i = 0; $i < count($eventAdmins); $i++) {
         $row =& $eventAdmins[$i];
         $eventAdmins[$i] = CFactory::getUser($row->id);
     }
     // Get Attending Event Guests
     $eventMembers = $event->getMembers(COMMUNITY_EVENT_STATUS_ATTEND, 12, CC_RANDOMIZE);
     $eventMembersCount = $event->getMembersCount(COMMUNITY_EVENT_STATUS_ATTEND);
     // Get pending event guests
     $pendingMembers = $event->getMembers(COMMUNITY_EVENT_STATUS_INVITED, 12, CC_RANDOMIZE);
     $pendingMembersCount = $event->getMembersCount(COMMUNITY_EVENT_STATUS_INVITED);
     // Get blocked Event Guests
     $blockedMembers = $event->getMembers(COMMUNITY_EVENT_STATUS_BLOCKED, 12, CC_RANDOMIZE);
     $blockedMembersCount = $event->getMembersCount(COMMUNITY_EVENT_STATUS_BLOCKED);
     // Attach avatar of the admin
     // Pre-load multiple users at once
     $userids = array();
     foreach ($eventMembers as $uid) {
         $userids[] = $uid->id;
     }
     CFactory::loadUsers($userids);
     for ($i = 0; $i < count($eventMembers); $i++) {
         $row =& $eventMembers[$i];
         $eventMembers[$i] = CFactory::getUser($row->id);
     }
     // Pre-load multiple users at once
     $userids = array();
     foreach ($pendingMembers as $uid) {
         $userids[] = $uid->id;
     }
     CFactory::loadUsers($userids);
     for ($i = 0; $i < count($pendingMembers); $i++) {
         $row =& $pendingMembers[$i];
         $pendingMembers[$i] = CFactory::getUser($row->id);
     }
     // Pre-load multiple users at once
     $userids = array();
     foreach ($blockedMembers as $uid) {
         $userids[] = $uid->id;
     }
     CFactory::loadUsers($userids);
     for ($i = 0; $i < count($blockedMembers); $i++) {
         $row =& $blockedMembers[$i];
         $blockedMembers[$i] = CFactory::getUser($row->id);
     }
     $waitingApproval = $event->isPendingApproval($my->id);
     $waitingRespond = false;
     $myStatus = $event->getUserStatus($my->id);
     $hasResponded = $myStatus == COMMUNITY_EVENT_STATUS_ATTEND || $myStatus == COMMUNITY_EVENT_STATUS_WONTATTEND || $myStatus == COMMUNITY_EVENT_STATUS_MAYBE;
     // Get Bookmark HTML
     CFactory::load('libraries', 'bookmarks');
     $bookmarks = new CBookmarks(CRoute::getExternalURL('index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id));
     $bookmarksHTML = $bookmarks->getHTML();
     // Get Reporting HTML
     CFactory::load('libraries', 'reporting');
     $report = new CReportingLibrary();
     $reportHTML = $report->getReportingHTML(JText::_('CC REPORT EVENT'), 'events,reportEvent', array($event->id));
     // Get the Wall
     CFactory::load('libraries', 'wall');
     $wallContent = CWallLibrary::getWallContents('events', $event->id, $isAdmin, 10, 0, 'wall.content', 'events,events');
     $wallCount = CWallLibrary::getWallCount('events', $event->id);
     $viewAllLink = false;
     if (JRequest::getVar('task', '', 'REQUEST') != 'app') {
         $viewAllLink = CRoute::_('index.php?option=com_community&view=events&task=app&eventid=' . $event->id . '&app=walls');
     }
     $wallContent .= CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount);
     $wallForm = '';
     if (!$config->get('lockeventwalls') || $config->get('lockeventwalls') && $isEventGuest && !$waitingApproval && $hasResponded || $isCommunityAdmin) {
         $wallForm = CWallLibrary::getWallInputForm($event->id, 'events,ajaxSaveWall', 'events,ajaxRemoveWall');
     }
     // Construct the RVSP radio list
     $arr = array(JHTML::_('select.option', COMMUNITY_EVENT_STATUS_ATTEND, JText::_('CC EVENT ACTION ATTEND')), JHTML::_('select.option', COMMUNITY_EVENT_STATUS_WONTATTEND, JText::_('CC EVENT ACTION DECLINE')), JHTML::_('select.option', COMMUNITY_EVENT_STATUS_MAYBE, JText::_('CC EVENT ACTION UNSURE')));
     $status = $event->getMemberStatus($my->id);
     $radioList = JHTML::_('select.radiolist', $arr, 'status', '', 'value', 'text', $status, false);
     $unapprovedCount = $event->inviteRequestCount();
     //...
     $editEvent = JRequest::getVar('edit', false, 'GET');
     $editEvent = $editEvent == 1 ? true : false;
     // Am I invited in this event?
     $isInvited = false;
     $join = '';
     $friendsCount = 0;
     $isInvited = $eventModel->isInvitedMe(0, $my->id, $event->id);
     // If I was invited, I want to know my invitation informations
     if ($isInvited) {
         $invitor = CFactory::getUser($isInvited[0]->invited_by);
         $join = '<a href="' . CUrlHelper::userLink($invitor->id) . '">' . $invitor->getDisplayName() . '</a>';
         // Get users friends in this group
         $friendsCount = $eventModel->getFriendsCount($my->id, $event->id);
     }
     $friendsModel = CFactory::getModel('Friends');
     $tmpFriends = $friendsModel->getFriends($my->id, 'name', false);
     $friends = array();
     for ($i = 0; $i < count($tmpFriends); $i++) {
         $friend =& $tmpFriends[$i];
         if (!$event->isMember($friend->id)) {
             $friends[] = $friend;
         }
     }
     unset($tmpFriends);
     // Get like
     CFactory::load('libraries', 'like');
     $likes = new CLike();
     $likesHTML = $likes->getHTML('events', $event->id, $my->id);
     // Is this event is a past event?
     $now = new JDate();
     $isPastEvent = $event->getEndDate(false)->toMySQL() < $now->toMySQL(true) ? true : false;
     // Output to template
     $tmpl = new CTemplate();
     CFactory::load('libraries', 'invitation');
     $inviteHTML = CInvitation::getHTML($friends, 'events,inviteUsers', $event->id, CInvitation::SHOW_FRIENDS, CInvitation::HIDE_EMAIL);
     $tmpl->setMetaTags('event', $event);
     $tmpl->set('timezone', CTimeHelper::getTimezone($event->offset));
     $tmpl->set('handler', $handler);
     $tmpl->set('likesHTML', $likesHTML);
     $tmpl->set('inviteHTML', $inviteHTML);
     $tmpl->set('guestStatus', $event->getUserStatus($my->id));
     $tmpl->set('event', $event);
     $tmpl->set('radioList', $radioList);
     $tmpl->set('bookmarksHTML', $bookmarksHTML);
     $tmpl->set('reportHTML', $reportHTML);
     $tmpl->set('isEventGuest', $isEventGuest);
     $tmpl->set('isMine', $isMine);
     $tmpl->set('isAdmin', $isAdmin);
     $tmpl->set('isCommunityAdmin', $isCommunityAdmin);
     $tmpl->set('unapproved', $unapprovedCount);
     $tmpl->set('waitingApproval', $waitingApproval);
     $tmpl->set('wallForm', $wallForm);
     $tmpl->set('wallContent', $wallContent);
     $tmpl->set('eventAdmins', $eventAdmins);
     $tmpl->set('eventAdminsCount', $eventAdminsCount);
     $tmpl->set('eventMembers', $eventMembers);
     $tmpl->set('eventMembersCount', $eventMembersCount);
     $tmpl->set('blockedMembers', $blockedMembers);
     $tmpl->set('blockedMembersCount', $blockedMembersCount);
     $tmpl->set('pendingMembers', $pendingMembers);
     $tmpl->set('pendingMembersCount', $pendingMembersCount);
     $tmpl->set('editEvent', $editEvent);
     $tmpl->set('my', $my);
     $tmpl->set('memberStatus', $myStatus);
     $tmpl->set('waitingRespond', $waitingRespond);
     $tmpl->set('isInvited', $isInvited);
     $tmpl->set('join', $join);
     $tmpl->set('friendsCount', $friendsCount);
     $tmpl->set('isPastEvent', $isPastEvent);
     echo $tmpl->fetch('events.viewevent');
 }
Example #6
0
 function _getWallHTML($wall, $wallComments, $appType, $isOwner, $processFunc, $templateFile)
 {
     CFactory::load('helpers', 'url');
     CFactory::load('helpers', 'user');
     CFactory::load('helpers', 'videos');
     CFactory::load('libraries', 'comment');
     CFactory::load('helpers', 'owner');
     CFactory::load('helpers', 'time');
     $user = CFactory::getUser($wall->post_by);
     $date = CTimeHelper::getDate($wall->date);
     $config = CFactory::getConfig();
     // @rule: for site super administrators we want to allow them to view the remove link
     $isOwner = COwnerHelper::isCommunityAdmin() ? true : $isOwner;
     $isEditable = CWall::isEditable($processFunc, $wall->id);
     // Apply any post processing on the content
     $wall->comment = CWallLibrary::_processWallContent($wall->comment);
     $commentsHTML = '';
     $comment = new CComment();
     // If the wall post is a user wall post (in profile pages), we
     // add wall comment feature
     if ($appType == 'user' || $appType == 'groups' || $appType == 'events') {
         $commentsHTML = $comment->getHTML($wallComments, 'wall-cmt-' . $wall->id, CWall::canComment($wall->type, $wall->contentid));
     }
     $avatarHTML = CUserHelper::getThumb($wall->post_by, 'avatar');
     //var_dump($avatarHTML);exit;
     // @rule: We only allow editing of wall in 15 minutes
     $now = JFactory::getDate();
     $interval = CTimeHelper::timeIntervalDifference($wall->date, $now->toMySQL());
     $interval = COMMUNITY_WALLS_EDIT_INTERVAL - abs($interval);
     $editInterval = round($interval / 60);
     // Create new instance of the template
     $tmpl = new CTemplate();
     $tmpl->set('id', $wall->id);
     $tmpl->set('author', $user->getDisplayName());
     $tmpl->set('avatarHTML', $avatarHTML);
     $tmpl->set('authorLink', CUrlHelper::userLink($user->id));
     $tmpl->set('created', $date->toFormat(JText::_('DATE_FORMAT_LC2')));
     $tmpl->set('content', $wall->comment);
     $tmpl->set('commentsHTML', $commentsHTML);
     $tmpl->set('avatar', $user->getThumbAvatar());
     $tmpl->set('isMine', $isOwner);
     $tmpl->set('isEditable', $isEditable);
     $tmpl->set('editInterval', $editInterval);
     $tmpl->set('processFunc', $processFunc);
     $tmpl->set('config', $config);
     return $tmpl->fetch($templateFile);
 }
Example #7
0
 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');
     }
 }
Example #8
0
 /**
  * Responsible for displaying the event page.
  * */
 public function viewevent()
 {
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $document = JFactory::getDocument();
     $config = CFactory::getConfig();
     $my = CFactory::getUser();
     CWindow::load();
     $eventLib = new CEvents();
     $eventid = JRequest::getInt('eventid', 0);
     $eventModel = CFactory::getModel('events');
     $event = JTable::getInstance('Event', 'CTable');
     $handler = CEventHelper::getHandler($event);
     $event->load($eventid);
     if (empty($event->id)) {
         return JError::raiseWarning(404, JText::_('COM_COMMUNITY_EVENTS_NOT_AVAILABLE_ERROR'));
     }
     if ($event->unlisted && !$event->isMember($my->id) && !$event->getUserStatus($my->id) == 0) {
         $text = JText::_('COM_COMMUNITY_EVENTS_UNLISTED_ERROR');
         $text .= ' <a href="javascript:" onclick="joms.api.eventJoin(\'' . $event->id . '\');">Request Invitation</a>';
         return JError::raiseWarning(403, $text);
     }
     if (!$handler->exists()) {
         $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_EVENTS_NOT_AVAILABLE_ERROR'), 'error');
         return;
     }
     if (!$handler->browsable()) {
         echo JText::_('COM_COMMUNITY_NOT_ALLOWED_TO_ACCESS_SECTION');
         return;
     }
     // @rule: Test if the group is unpublished, don't display it at all.
     if (!$event->isPublished()) {
         echo JText::_('COM_COMMUNITY_EVENTS_UNDER_MODERATION');
         return;
     }
     //$this->showSubmenu();
     $event->hit();
     $isGroupAdmin = false;
     // Basic page presentation
     if ($event->type == 'group') {
         $groupId = $event->contentid;
         $group = JTable::getInstance('Group', 'CTable');
         $group->load($groupId);
         // Set pathway for group videos
         // Community > Groups > Group Name > Events
         $this->addPathway(JText::_('COM_COMMUNITY_GROUPS'), CRoute::_('index.php?option=com_community&view=groups'));
         $this->addPathway($group->name, CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $groupId));
         $groupEventDetails = new stdClass();
         $groupEventDetails->creator = CFactory::getUser($event->creator);
         $groupEventDetails->groupName = $group->name;
         $groupEventDetails->groupLink = CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id);
         $isGroupAdmin = $group->isAdmin($my->id);
     }
     $this->addPathway(JText::_('COM_COMMUNITY_EVENTS'), CRoute::_('index.php?option=com_community&view=events'));
     $this->addPathway($event->title);
     /**
      * Opengraph
      */
     CHeadHelper::setType('website', JText::sprintf('COM_COMMUNITY_EVENT_PAGE_TITLE', $event->title), null, array($event->getCover()));
     // Permissions and privacies
     $isEventGuest = $event->isMember($my->id);
     $isMine = $my->id == $event->creator;
     $isAdmin = $event->isAdmin($my->id) || $isGroupAdmin;
     $isCommunityAdmin = COwnerHelper::isCommunityAdmin();
     // Get Event Admins
     $eventAdmins = $event->getAdmins(12, CC_RANDOMIZE);
     $adminsInArray = array();
     // Attach avatar of the admin
     for ($i = 0; $i < count($eventAdmins); $i++) {
         $row = $eventAdmins[$i];
         $admin = CFactory::getUser($row->id);
         array_push($adminsInArray, '<a href="' . CUrlHelper::userLink($admin->id) . '">' . $admin->getDisplayName() . '</a>');
     }
     $adminsList = ltrim(implode(', ', $adminsInArray), ',');
     // Get Attending Event Guests
     $eventMembers = $event->getMembers(COMMUNITY_EVENT_STATUS_ATTEND, CFactory::getConfig()->get('event_sidebar_members_show_total', 12), CC_RANDOMIZE);
     $eventMembersCount = $event->getMembersCount(COMMUNITY_EVENT_STATUS_ATTEND);
     // Attach avatar of the admin
     // Pre-load multiple users at once
     $userids = array();
     foreach ($eventMembers as $uid) {
         $userids[] = $uid->id;
     }
     CFactory::loadUsers($userids);
     for ($i = 0; $i < count($eventMembers); $i++) {
         $row = $eventMembers[$i];
         $eventMembers[$i] = CFactory::getUser($row->id);
     }
     // Pre-load multiple users at once
     $waitingApproval = $event->isPendingApproval($my->id);
     $waitingRespond = false;
     $myStatus = $event->getUserStatus($my->id);
     $hasResponded = $myStatus == COMMUNITY_EVENT_STATUS_ATTEND || $myStatus == COMMUNITY_EVENT_STATUS_WONTATTEND || $myStatus == COMMUNITY_EVENT_STATUS_MAYBE;
     // Get Bookmark HTML
     $bookmarks = new CBookmarks(CRoute::getExternalURL('index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id));
     $bookmarksHTML = $bookmarks->getHTML();
     // Get the Wall
     $wallContent = CWallLibrary::getWallContents('events', $event->id, $isAdmin, $config->get('stream_default_comments'), 0, 'wall/content', 'events,events');
     $wallCount = CWallLibrary::getWallCount('events', $event->id);
     $viewAllLink = false;
     if ($jinput->request->get('task', '', 'STRING') != 'app') {
         $viewAllLink = CRoute::_('index.php?option=com_community&view=events&task=app&eventid=' . $event->id . '&app=walls');
     }
     $wallContent .= CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount);
     $wallForm = '';
     // Construct the RVSP radio list
     $arr = array(JHTML::_('select.option', COMMUNITY_EVENT_STATUS_ATTEND, JText::_('COM_COMMUNITY_EVENTS_YES')), JHTML::_('select.option', COMMUNITY_EVENT_STATUS_WONTATTEND, JText::_('COM_COMMUNITY_EVENTS_NO')), JHTML::_('select.option', COMMUNITY_EVENT_STATUS_MAYBE, JText::_('COM_COMMUNITY_EVENTS_MAYBE')));
     $status = $event->getMemberStatus($my->id);
     $radioList = JHTML::_('select.radiolist', $arr, 'status', '', 'value', 'text', $status, false);
     $unapprovedCount = $event->inviteRequestCount();
     //...
     $editEvent = $jinput->get->get('edit', false, 'NONE');
     $editEvent = $editEvent == 1 ? true : false;
     // Am I invited in this event?
     $isInvited = false;
     $join = '';
     $friendsCount = 0;
     $isInvited = $eventModel->isInvitedMe(0, $my->id, $event->id);
     // If I was invited, I want to know my invitation informations
     if ($isInvited) {
         $invitor = CFactory::getUser($isInvited[0]->invited_by);
         $join = '<a href="' . CUrlHelper::userLink($invitor->id) . '">' . $invitor->getDisplayName() . '</a>';
         // Get users friends in this group
         $friendsCount = $eventModel->getFriendsCount($my->id, $event->id);
     }
     // Get like
     $likes = new CLike();
     $isUserLiked = false;
     if ($isLikeEnabled = $likes->enabled('events')) {
         $isUserLiked = $likes->userLiked('events', $event->id, $my->id);
     }
     $totalLikes = $likes->getLikeCount('events', $event->id);
     // Is this event is a past event?
     $now = new JDate();
     $isPastEvent = $event->getEndDate(false)->toSql() < $now->toSql(true) ? true : false;
     // Get the formated date & time
     $format = $config->get('eventshowampm') ? JText::_('COM_COMMUNITY_EVENTS_TIME_FORMAT_12HR') : JText::_('COM_COMMUNITY_EVENTS_TIME_FORMAT_24HR');
     $startDate = $event->getStartDate(false);
     $endDate = $event->getEndDate(false);
     $allday = false;
     if ($startDate->format('%Y-%m-%d') == $endDate->format('%Y-%m-%d') && $startDate->format('%H:%M:%S') == '00:00:00' && $endDate->format('%H:%M:%S') == '23:59:59') {
         $format = JText::_('COM_COMMUNITY_EVENT_TIME_FORMAT_LC1');
         $allday = true;
     }
     $event->startdateHTML = CTimeHelper::getFormattedTime($event->startdate, $format);
     $event->enddateHTML = CTimeHelper::getFormattedTime($event->enddate, $format);
     if (!isset($event->params)) {
         $event->params = '';
     }
     $params = new CParameter($event->params);
     $event->defaultCover = $event->isDefaultCover();
     // Cover position.
     $event->coverPostion = $params->get('coverPosition', '');
     if (strpos($event->coverPostion, '%') === false) {
         $event->coverPostion = 0;
     }
     // Find cover album and photo.
     $event->coverAlbum = false;
     $event->coverPhoto = false;
     $album = JTable::getInstance('Album', 'CTable');
     $albumId = $album->isCoverExist('event', $event->id);
     if ($albumId) {
         $album->load($albumId);
         $event->coverAlbum = $albumId;
         $event->coverPhoto = $album->photoid;
     }
     $inviteHTML = CInvitation::getHTML(null, 'events,inviteUsers', $event->id, CInvitation::SHOW_FRIENDS, CInvitation::SHOW_EMAIL);
     $status = new CUserStatus($event->id, 'events');
     $tmpl = new CTemplate();
     $creator = new CUserStatusCreator('message');
     $creator->title = $isMine ? JText::_('COM_COMMUNITY_STATUS') : JText::_('COM_COMMUNITY_MESSAGE');
     $creator->html = $tmpl->fetch('status.message');
     $status->addCreator($creator);
     // Upgrade wall to stream @since 2.5
     $event->upgradeWallToStream();
     // Add custom stream
     $streamHTML = $eventLib->getStreamHTML($event);
     if ($event->getMemberStatus($my->id) == COMMUNITY_EVENT_STATUS_ATTEND) {
         $RSVPmessage = JText::_('COM_COMMUNITY_EVENTS_ATTENDING_EVENT_MESSAGE');
     } else {
         if ($event->getMemberStatus($my->id) == COMMUNITY_EVENT_STATUS_WONTATTEND) {
             $RSVPmessage = JText::_('COM_COMMUNITY_EVENTS_NOT_ATTENDING_EVENT_MESSAGE');
         } else {
             $RSVPmessage = JText::_('COM_COMMUNITY_EVENTS_NOT_RESPOND_RSVP_MESSAGE');
         }
     }
     // Get recurring event series
     $eventSeries = null;
     $seriesCount = 0;
     if ($event->isRecurring()) {
         $advance = array('expired' => false, 'return' => 'object', 'limit' => COMMUNITY_EVENT_SERIES_LIMIT, 'exclude' => $event->id, 'published' => 1);
         $tempseries = $eventModel->getEventChilds($event->parent, $advance);
         foreach ($tempseries as $series) {
             $table = JTable::getInstance('Event', 'CTable');
             $table->bind($series);
             $eventSeries[] = $table;
         }
         $seriesCount = $eventModel->getEventChildsCount($event->parent);
     }
     //pending request invitation guest
     $pendingRequestGuests = $event->getMembers(COMMUNITY_EVENT_STATUS_REQUESTINVITE, 0, false, false);
     // Pre-load multiple users at once
     $tempUserInfo = array();
     foreach ($pendingRequestGuests as $uid) {
         $tempUserInfo[] = CFactory::getUser($uid->id);
     }
     $pendingRequestGuests = $tempUserInfo;
     $featured = new CFeatured(FEATURED_EVENTS);
     $featuredList = $featured->getItemIds();
     // Get Attending Event Guests
     $maybeList = $event->getMembers(COMMUNITY_EVENT_STATUS_MAYBE, 12, CC_RANDOMIZE);
     $maybeCount = $event->getMembersCount(COMMUNITY_EVENT_STATUS_MAYBE);
     $tempUserInfo = array();
     foreach ($maybeList as $uid) {
         $tempUserInfo[] = CFactory::getUser($uid->id);
     }
     $maybeList = $tempUserInfo;
     $wontAttendList = $event->getMembers(COMMUNITY_EVENT_STATUS_WONTATTEND, 12, CC_RANDOMIZE);
     $wontAttendCount = $event->getMembersCount(COMMUNITY_EVENT_STATUS_WONTATTEND);
     $tempUserInfo = array();
     foreach ($wontAttendList as $uid) {
         $tempUserInfo[] = CFactory::getUser($uid->id);
     }
     $wontAttendList = $tempUserInfo;
     //gets all the albums related to this photo
     $photosModel = CFactory::getModel('photos');
     $albums = $photosModel->getEventAlbums($event->id);
     $totalPhotos = 0;
     foreach ($albums as $album) {
         $albumParams = new CParameter($album->params);
         $totalPhotos = $totalPhotos + $albumParams->get('count');
     }
     //get total videos
     $videosModel = CFactory::getModel('videos');
     $videos = $videosModel->getEventVideos($eventid);
     $totalVideos = count($videosModel->getEventVideos($eventid));
     // Output to template
     echo $tmpl->setMetaTags('event', $event)->set('status', $status)->set('albums', $albums)->set('videos', $videos)->set('pendingRequestGuests', $pendingRequestGuests)->set('streamHTML', $streamHTML)->set('timezone', CTimeHelper::getTimezone($event->offset))->set('handler', $handler)->set('isUserLiked', $isUserLiked)->set('totalLikes', $totalLikes)->set('inviteHTML', $inviteHTML)->set('guestStatus', $event->getUserStatus($my->id))->set('event', $event)->set('radioList', $radioList)->set('bookmarksHTML', $bookmarksHTML)->set('isLikeEnabled', $isLikeEnabled)->set('isEventGuest', $isEventGuest)->set('isMine', $isMine)->set('isAdmin', $isAdmin)->set('isCommunityAdmin', $isCommunityAdmin)->set('unapproved', $unapprovedCount)->set('waitingApproval', $waitingApproval)->set('wallContent', $wallContent)->set('eventMembers', $eventMembers)->set('eventMembersCount', $eventMembersCount)->set('editEvent', $editEvent)->set('my', $my)->set('creator', CFactory::getUser($event->creator))->set('memberStatus', $myStatus)->set('waitingRespond', $waitingRespond)->set('isInvited', $isInvited)->set('join', $join)->set('friendsCount', $friendsCount)->set('isPastEvent', $isPastEvent)->set('adminsList', $adminsList)->set('RSVPmessage', $RSVPmessage)->set('allday', $allday)->set('eventSeries', $eventSeries)->set('seriesCount', $seriesCount)->set('groupEventDetails', isset($groupEventDetails) ? $groupEventDetails : null)->set('featuredList', $featuredList)->set('photoPermission', $params->get('photopermission'))->set('videoPermission', $params->get('videopermission'))->set('showPhotos', $params->get('photopermission') != -1 && $config->get('enablephotos') && $config->get('eventphotos'))->set('showVideos', $params->get('videopermission') != -1 && $config->get('enablevideos') && $config->get('eventvideos'))->set('totalPhotos', $totalPhotos)->set('totalVideos', $totalVideos)->set('maybeList', $maybeList)->set('maybeCount', $maybeCount)->set('wontAttendList', $wontAttendList)->set('wontAttendCount', $wontAttendCount)->fetch('events/single');
 }
Example #9
0
 /**
  * Ajax function to save a new wall entry
  *
  * @param message	A message that is submitted by the user
  * @param uniqueId	The unique id for this group
  *
  **/
 public function ajaxSaveWall($message, $groupId)
 {
     $response = new JAXResponse();
     $my = CFactory::getUser();
     // Load necessary libraries
     CFactory::load('libraries', 'wall');
     CFactory::load('helpers', 'url');
     CFactory::load('libraries', 'activities');
     $groupModel = CFactory::getModel('groups');
     $group =& JTable::getInstance('Group', 'CTable');
     $group->load($groupId);
     $config = CFactory::getConfig();
     // @rule: If configuration is set for walls in group to be restricted to memebers only,
     // we need to respect this.
     if ($config->get('lockgroupwalls') && !$group->isMember($my->id)) {
         $response->addScriptCall('alert', JText::_('CC ACCESS FORBIDDEN'));
         return $response->sendResponse();
     }
     $message = strip_tags($message);
     // If the content is false, the message might be empty.
     if (empty($message)) {
         $response->addAlert(JText::_('CC EMPTY MESSAGE'));
     } else {
         $isAdmin = $groupModel->isAdmin($my->id, $group->id);
         // Save the wall content
         $wall = CWallLibrary::saveWall($groupId, $message, 'groups', $my, $isAdmin, 'groups,group');
         // Store event will update all stats count data
         $group->updateStats();
         $group->store();
         // @rule: only add the activities of the wall if the group is not private.
         if ($group->approvals == COMMUNITY_PUBLIC_GROUP) {
             $params = new JParameter('');
             $params->set('action', 'group.wall.create');
             $params->set('wallid', $wall->id);
             $params->set('group_url', 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $groupId);
             $act = new stdClass();
             $act->cmd = 'group.wall.create';
             $act->actor = $my->id;
             $act->target = 0;
             $act->title = JText::sprintf('CC ACTIVITIES WALL POST GROUP', '{group_url}', $group->name);
             $act->content = $message;
             $act->app = 'groups';
             $act->cid = $groupId;
             CActivityStream::add($act, $params->toString());
         }
         // @rule: Add user points
         CFactory::load('libraries', 'userpoints');
         CUserPoints::assignPoint('group.wall.create');
         // @rule: Send email notification to members
         $groupParams = $group->getParams();
         if ($groupParams->get('wallnotification') == '1') {
             $model =& $this->getModel('groups');
             $members = $model->getMembers($groupId, null);
             $admins = $model->getAdmins($groupId, null);
             $membersArray = array();
             foreach ($members as $row) {
                 if ($my->id != $row->id) {
                     $membersArray[] = $row->id;
                 }
             }
             foreach ($admins as $row) {
                 if ($my->id != $row->id) {
                     $membersArray[] = $row->id;
                 }
             }
             unset($members);
             unset($admins);
             // Add notification
             CFactory::load('libraries', 'notification');
             $params = new JParameter('');
             $params->set('url', 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $groupId);
             $params->set('group', $group->name);
             $params->set('message', $message);
             CNotificationLibrary::add('groups.wall.create', $my->id, $membersArray, JText::sprintf('CC NEW WALL POST NOTIFICATION EMAIL SUBJECT', $my->getDisplayName(), $group->name), '', 'groups.wall', $params);
         }
         $response->addScriptCall('joms.walls.insert', $wall->content);
     }
     return $response->sendResponse();
 }
Example #10
0
 /**
  * Ajax function to save a new wall entry
  *
  * @param message	A message that is submitted by the user
  * @param uniqueId	The unique id for this group
  * @deprecated since 2.4
  *
  **/
 public function ajaxSaveWall($message, $groupId)
 {
     $filter = JFilterInput::getInstance();
     $message = $filter->clean($message, 'string');
     $groupId = $filter->clean($groupId, 'int');
     $response = new JAXResponse();
     $my = CFactory::getUser();
     // Load necessary libraries
     CFactory::load('libraries', 'wall');
     CFactory::load('helpers', 'url');
     CFactory::load('libraries', 'activities');
     $groupModel = CFactory::getModel('groups');
     $group =& JTable::getInstance('Group', 'CTable');
     $group->load($groupId);
     $config = CFactory::getConfig();
     // @rule: If configuration is set for walls in group to be restricted to memebers only,
     // we need to respect this.
     if (!$my->authorise('community.save', 'groups.wall.' . $groupId, $group)) {
         $response->addScriptCall('alert', JText::_('COM_COMMUNITY_ACCESS_FORBIDDEN'));
         return $response->sendResponse();
     }
     $message = strip_tags($message);
     // If the content is false, the message might be empty.
     if (empty($message)) {
         $response->addAlert(JText::_('COM_COMMUNITY_EMPTY_MESSAGE'));
     } else {
         $isAdmin = $groupModel->isAdmin($my->id, $group->id);
         // @rule: Spam checks
         if ($config->get('antispam_akismet_walls')) {
             CFactory::load('libraries', 'spamfilter');
             $filter = CSpamFilter::getFilter();
             $filter->setAuthor($my->getDisplayName());
             $filter->setMessage($message);
             $filter->setEmail($my->email);
             $filter->setURL(CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $groupId));
             $filter->setType('message');
             $filter->setIP($_SERVER['REMOTE_ADDR']);
             if ($filter->isSpam()) {
                 $response->addAlert(JText::_('COM_COMMUNITY_WALLS_MARKED_SPAM'));
                 return $response->sendResponse();
             }
         }
         // Save the wall content
         $wall = CWallLibrary::saveWall($groupId, $message, 'groups', $my, $isAdmin, 'groups,group');
         // Store event will update all stats count data
         $group->updateStats();
         $group->store();
         // @rule: only add the activities of the wall if the group is not private.
         if ($group->approvals == COMMUNITY_PUBLIC_GROUP) {
             $params = new CParameter('');
             $params->set('action', 'group.wall.create');
             $params->set('wallid', $wall->id);
             $params->set('group_url', 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $groupId);
             $act = new stdClass();
             $act->cmd = 'group.wall.create';
             $act->actor = $my->id;
             $act->target = 0;
             $act->title = JText::sprintf('COM_COMMUNITY_GROUPS_WALL_POST_GROUP', '{group_url}', $group->name);
             $act->content = $message;
             $act->app = 'groups.wall';
             $act->cid = $wall->id;
             $act->groupid = $group->id;
             // Allow comments
             $act->comment_type = 'groups.wall';
             $act->comment_id = $wall->id;
             CActivityStream::add($act, $params->toString());
         }
         // @rule: Add user points
         CFactory::load('libraries', 'userpoints');
         CUserPoints::assignPoint('group.wall.create');
         // @rule: Send email notification to members
         $groupParams = $group->getParams();
         if ($groupParams->get('wallnotification') == '1') {
             $model =& $this->getModel('groups');
             $members = $model->getMembers($groupId, null);
             $admins = $model->getAdmins($groupId, null);
             $membersArray = array();
             foreach ($members as $row) {
                 if ($my->id != $row->id) {
                     $membersArray[] = $row->id;
                 }
             }
             foreach ($admins as $row) {
                 if ($my->id != $row->id) {
                     $membersArray[] = $row->id;
                 }
             }
             unset($members);
             unset($admins);
             // Add notification
             CFactory::load('libraries', 'notification');
             $params = new CParameter('');
             $params->set('url', 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $groupId);
             $params->set('group', $group->name);
             $params->set('message', $message);
             CNotificationLibrary::add('etype_groups_wall_create', $my->id, $membersArray, JText::sprintf('COM_COMMUNITY_NEW_WALL_POST_NOTIFICATION_EMAIL_SUBJECT', $my->getDisplayName(), $group->name), '', 'groups.wall', $params);
         }
         $response->addScriptCall('joms.walls.insert', $wall->content);
     }
     $this->cacheClean(array(COMMUNITY_CACHE_TAG_GROUPS, COMMUNITY_CACHE_TAG_ACTIVITIES));
     return $response->sendResponse();
 }
Example #11
0
 /**
  * Return the content of acitivity stream
  */
 public static function getActivityContentHTML($act)
 {
     $html = '';
     $my = CFactory::getUser();
     $config = CFactory::getConfig();
     $param = new CParameter($act->params);
     // Legacy issue. We could have either wall or video upload notice here
     $action = $param->get('action', 'upload');
     //CFactory::load( 'libraries' , 'wall' );
     // wall activity have either empty content (old) or $param action = 'wall'
     if ($action == 'wall') {
         // Only if the param wallid is specified that we could retrive the wall content
         $wallid = $param->get('wallid', false);
         if ($wallid) {
             $html = CWallLibrary::getWallContentSummary($wallid);
         }
     } elseif ($action == 'upload') {
         $video = $act->video;
         $url = $video->getViewUri();
         $template = 'activity.videos.upload';
         $tmpl = new CTemplate();
         $html = $tmpl->set('url', $url)->set('video', $video)->set('duration', CVideosHelper::toNiceHMS(CVideosHelper::formatDuration($video->getDuration())))->fetch('videos.activity.upload');
     }
     return $html;
 }
Example #12
0
 /**
  * Return the content of acitivity stream
  */
 public static function getActivityContentHTML($act)
 {
     $html = '';
     $my = CFactory::getUser();
     $config = CFactory::getConfig();
     $param = new CParameter($act->params);
     // Legacy issue. We could have either wall or video upload notice here
     $action = $param->get('action', 'upload');
     CFactory::load('libraries', 'wall');
     // wall activity have either empty content (old) or $param action = 'wall'
     if ($action == 'wall') {
         // Only if the param wallid is specified that we could retrive the wall content
         $wallid = $param->get('wallid', false);
         if ($wallid) {
             $html = CWallLibrary::getWallContentSummary($wallid);
         }
     } elseif ($action == 'upload') {
         CFactory::load('models', 'videos');
         $video = JTable::getInstance('Video', 'CTable');
         $video->load($act->cid);
         $url = $video->getViewUri();
         // Add tagging code
         /*
         $tagsHTML = '';
         if($config->get('tags_videos') && $config->get('tags_show_in_stream')){
         	CFactory::load('libraries', 'tags');
         	$tags = new CTags();
         	$tagsHTML = $tags->getHTML('videos', $video->id, false);
         }
         */
         $template = 'activity.videos.upload';
         $tmpl = new CTemplate();
         $html = $tmpl->set('url', $url)->set('video', $video)->set('duration', CVideosHelper::toNiceHMS(CVideosHelper::formatDuration($video->getDuration())))->fetch('videos.activity.upload');
     }
     return $html;
 }
Example #13
0
 public function ajaxUpdateWall($wallId, $message, $editableFunc)
 {
     $wall =& JTable::getInstance('Wall', 'CTable');
     $wall->load($wallId);
     $objResponse = new JAXresponse();
     if (empty($message)) {
         $objResponse->addScriptCall('alert', JText::_('CC EMPTY MESSAGE'));
         return $objResponse->sendResponse();
     }
     CFactory::load('libraries', 'wall');
     $isEditable = CWall::isEditable($editableFunc, $wall->id);
     if (!$isEditable) {
         $objResponse->addAssign('cWindowContent', 'innerHTML', JText::_('CC NOT ALLOWED TO EDIT'));
         return $objResponse->sendResponse();
     }
     CFactory::load('libraries', 'comment');
     // We don't want to touch the comments data.
     $comments = CComment::getRawCommentsData($wall->comment);
     $wall->comment = $message;
     $wall->comment .= $comments;
     $my = CFactory::getUser();
     $data = CWallLibrary::saveWall($wall->contentid, $wall->comment, $wall->type, $my, false, $editableFunc, 'wall.content', $wall->id);
     $objResponse = new JAXResponse();
     $objResponse->addScriptCall('joms.walls.update', $wall->id, $data->content);
     return $objResponse->sendResponse();
 }
Example #14
0
 /**
  * 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');
 }
Example #15
0
 /**
  * Search based on current config
  * @param $query
  * @param array $rules
  * @return array
  */
 public function searchFriend($query, $rules = array())
 {
     $config = CFactory::getConfig();
     $my = CFactory::getUser();
     $nameField = $config->getString('displayname');
     $data = array();
     $myFriends = $my->getFriendIds();
     $allowSelf = true;
     // to allow the own user in the list
     /*
      * type of rules,
      * public = friends only and whoever is in the id
      * private = only those who is in the id array
      */
     if (count($rules) > 1) {
         switch ($rules['case']) {
             case 'all-friends':
                 //return everyone, full list
                 // do nothing since everyone returned is in full list
                 $myFriends = $my->getFriendIds();
                 break;
             case 'private-message-tag':
                 // only return active participant in the conversation
                 $msgModel = CFactory::getModel('inbox');
                 $membersIds = $msgModel->getParticipantsID($rules['message_id'], $my->id);
                 $myFriends = $membersIds;
                 break;
             case 'video-comment-tag':
                 //this is a video and we should return a list of user who has been tagged in the video
                 $tagModel = CFactory::getModel('videotagging');
                 $taggedList = $tagModel->getTaggedList($rules['video_id']);
                 $membersIds = array();
                 foreach ($taggedList as $member) {
                     $membersIds[] = $member->userid;
                 }
                 //for commentors
                 $members = CWallLibrary::getWallUser($rules['video_id'], 'videos');
                 $membersIds = array_merge($membersIds, array_map('current', $members));
                 //we merge people who has been tagged in the video, commented and friends
                 $myFriends = array_merge($myFriends, $membersIds);
                 break;
             case 'photo-comment-tag':
                 $tagModel = CFactory::getModel('phototagging');
                 $taggedList = $tagModel->getTaggedList($rules['photo_id']);
                 $membersIds = array();
                 foreach ($taggedList as $member) {
                     $membersIds[] = $member->userid;
                 }
                 // this is a photo comment tagging rules, not the photo tagging rules, so, include user who has been tagged in photo and whoever commented
                 $members = CWallLibrary::getWallUser($rules['photo_id'], 'photos');
                 $membersIds = array_merge($membersIds, array_map('current', $members));
                 //in this case, we merge people who has been tagged in the photo, commented and friends
                 $myFriends = array_merge($myFriends, $membersIds);
                 break;
             case 'photo-tag':
                 $tagModel = CFactory::getModel('phototagging');
                 $taggedList = $tagModel->getTaggedList($rules['photo_id']);
                 $membersIds = array();
                 foreach ($taggedList as $member) {
                     $membersIds[] = $member->userid;
                 }
                 //in this case, we remove all the member id who already been tagged
                 $myFriends[] = $my->id;
                 $myFriends = array_diff(array_unique($myFriends), $membersIds);
                 break;
             case 'public-comment':
                 //we can get the poster as well
                 $table = JTable::getInstance('Activity', 'CTable');
                 $table->load($rules['activity_id']);
                 $wall = CWallLibrary::getWallUser($rules['activity_id']);
                 $memberIds = array_map('current', $wall);
                 $memberIds[] = $table->actor;
                 //in comment, only my friends or those who have commented can be tagged
                 $myFriends = array_unique(array_merge($memberIds, $myFriends));
                 $allowSelf = false;
                 break;
             case 'group':
                 $groupModel = CFactory::getModel('groups');
                 $approvedMembers = $groupModel->getMembers($rules['group_id'], 0, true, false, true);
                 $membersIds = array();
                 foreach ($approvedMembers as $member) {
                     $membersIds[] = $member->id;
                 }
                 //now, we need to know if this group is private or not
                 $group = JTable::getInstance('Group', 'CTable');
                 $group->load($rules['group_id']);
                 if ($group->approvals) {
                     // can only tag members
                     $myFriends = $membersIds;
                 } else {
                     // can tag friends and members of the group
                     $myFriends = array_unique(array_merge($membersIds, $myFriends));
                 }
                 $allowSelf = false;
                 break;
             case 'discussion':
                 //group discussion
                 // Load models
                 $discussion = JTable::getInstance('Discussion', 'CTable');
                 $discussion->load($rules['discussion_id']);
                 $groupModel = CFactory::getModel('groups');
                 $approvedMembers = $groupModel->getMembers($discussion->groupid, 0, true, false, true);
                 $membersIds = array();
                 foreach ($approvedMembers as $member) {
                     $membersIds[] = $member->id;
                 }
                 //now, we need to know if this group is private or not
                 $group = JTable::getInstance('Group', 'CTable');
                 $group->load($discussion->groupid);
                 if ($group->approvals) {
                     // can only tag members
                     $myFriends = $membersIds;
                 } else {
                     // can tag friends and members of the group
                     $myFriends = array_unique(array_merge($membersIds, $myFriends));
                 }
                 $allowSelf = false;
                 break;
             case 'event':
                 $event = JTable::getInstance('Event', 'CTable');
                 $event->load($rules['event_id']);
                 $eventMembers = $event->getMembers(COMMUNITY_EVENT_STATUS_ATTEND, 0, CC_RANDOMIZE);
                 $membersIds = array();
                 foreach ($eventMembers as $member) {
                     $membersIds[] = $member->id;
                 }
                 if ($event->permission == 1) {
                     // can only tag members
                     $myFriends = $membersIds;
                 } else {
                     $myFriends = array_unique(array_merge($membersIds, $myFriends));
                 }
                 $allowSelf = false;
                 break;
             case 'album':
                 //able to tag any friends.
                 //for commentors
                 $membersIds = array();
                 $members = CWallLibrary::getWallUser($rules['album_id'], 'albums');
                 $membersIds = array_merge($membersIds, array_map('current', $members));
                 //we merge people who has been tagged in the video, commented and friends
                 $myFriends = array_merge($myFriends, $membersIds);
                 break;
         }
     }
     if (isset($rules['case']) && $rules['case'] != '') {
         //we always make sure that we load our own friends only.
         $result = array();
         $friends = array_merge($my->getFriendIds(), array($my->id), $myFriends);
         // add our own id in the list as well
         if (!$allowSelf) {
             //remove self tagging if needed
             $friends = array_diff($friends, array($my->id));
         }
         $friends = array_unique($friends);
         foreach ($friends as $friend) {
             $usr = CFactory::getUser($friend);
             if (!$usr->isBlocked()) {
                 $result[] = $usr;
             }
         }
     }
     return $result;
 }
Example #16
0
 /**
  * Ajax function to save a new wall entry
  *
  * @param message	A message that is submitted by the user
  * @param uniqueId	The unique id for this group
  *
  **/
 public function ajaxSaveWall($message, $uniqueId)
 {
     if (!COwnerHelper::isRegisteredUser()) {
         return $this->ajaxBlockUnregister();
     }
     $response = new JAXResponse();
     $my = CFactory::getUser();
     $video = JTable::getInstance('Video', 'CTable');
     $video->load($uniqueId);
     // If the content is false, the message might be empty.
     if (empty($message)) {
         $response->addAlert(JText::_('CC EMPTY WALL MESSAGE'));
     } else {
         CFactory::load('libraries', 'wall');
         $wall = CWallLibrary::saveWall($uniqueId, $message, 'videos', $my, $my->id == $video->creator);
         // Add activity logging
         if ($video->isPublic()) {
             $url = $video->getViewUri(false);
             $params = new JParameter('');
             $params->set('videoid', $uniqueId);
             $params->set('action', 'wall');
             $params->set('wallid', $wall->id);
             $params->set('video_url', $url);
             $act = new stdClass();
             $act->cmd = 'videos.wall.create';
             $act->actor = $my->id;
             $act->target = 0;
             $act->title = JText::sprintf('CC ACTIVITIES WALL POST VIDEO', '{video_url}', $video->title);
             $act->app = 'videos';
             $act->cid = $uniqueId;
             $act->params = $params->toString();
             CFactory::load('libraries', 'activities');
             CActivityStream::add($act);
         }
         //add user points
         CFactory::load('libraries', 'userpoints');
         CUserPoints::assignPoint('videos.wall.create');
         $response->addScriptCall('joms.walls.insert', $wall->content);
     }
     return $response->sendResponse();
 }
Example #17
0
 public static function getActivityContentHTML($act)
 {
     // Ok, the activity could be an upload OR a wall comment. In the future, the content should
     // indicate which is which
     $html = '';
     $param = new CParameter($act->params);
     $action = $param->get('action', false);
     $config = CFactory::getConfig();
     $groupModel = CFactory::getModel('groups');
     if ($action == CGroupsAction::DISCUSSION_CREATE) {
         // Old discussion might not have 'action', and we can't display their
         // discussion summary
         $topicId = $param->get('topic_id', false);
         if ($topicId) {
             $group = JTable::getInstance('Group', 'CTable');
             $discussion = JTable::getInstance('Discussion', 'CTable');
             $group->load($act->cid);
             $discussion->load($topicId);
             $discussion->message = strip_tags($discussion->message);
             $topic = CStringHelper::escape($discussion->message);
             $tmpl = new CTemplate();
             $tmpl->set('comment', JString::substr($topic, 0, $config->getInt('streamcontentlength')));
             $html = $tmpl->fetch('activity.groups.discussion.create');
         }
         return $html;
     } else {
         if ($action == CGroupsAction::WALLPOST_CREATE) {
             // a new wall post for group
             // @since 1.8
             $group = JTable::getInstance('Group', 'CTable');
             $group->load($act->cid);
             $wallModel = CFactory::getModel('Wall');
             $wall = JTable::getInstance('Wall', 'CTable');
             $my = CFactory::getUser();
             // make sure the group is a public group or current use is
             // a member of the group
             if ($group->approvals == 0 || $group->isMember($my->id)) {
                 //CFactory::load( 'libraries' , 'comment' );
                 $wall->load($param->get('wallid'));
                 $comment = strip_tags($wall->comment, '<comment>');
                 $comment = CComment::stripCommentData($comment);
                 $tmpl = new CTemplate();
                 $tmpl->set('comment', JString::substr($comment, 0, $config->getInt('streamcontentlength')));
                 $html = $tmpl->fetch('activity.groups.wall.create');
             }
             return $html;
         } else {
             if ($action == CGroupsAction::DISCUSSION_REPLY) {
                 // @since 1.8
                 $group = JTable::getInstance('Group', 'CTable');
                 $group->load($act->cid);
                 $wallModel = CFactory::getModel('Wall');
                 $wall = JTable::getInstance('Wall', 'CTable');
                 $my = CFactory::getUser();
                 // make sure the group is a public group or current use is
                 // a member of the group
                 if ($group->approvals == 0 || $group->isMember($my->id)) {
                     $wallid = $param->get('wallid');
                     //CFactory::load( 'libraries' , 'wall' );
                     $html = CWallLibrary::getWallContentSummary($wallid);
                 }
                 return $html;
             } else {
                 if ($action == CGroupsAction::CREATE) {
                     $group = JTable::getInstance('Group', 'CTable');
                     $group->load($act->cid);
                     $tmpl = new CTemplate();
                     $tmpl->set('group', $group);
                     $html = $tmpl->fetch('activity.groups.create');
                 }
             }
         }
     }
     return $html;
 }
Example #18
0
    public function ajaxShowVideoFeatured($video_id)
    {
        $objResponse = new JAXResponse();
        $allowToView = true;
        //determine the view premission
        $my = CFactory::getUser();
        $video = JTable::getInstance('Video', 'CTable');
        if (!$video->load($video_id)) {
            $allowToView = false;
        }
        /* === Start Premission Checking === */
        $user = CFactory::getUser($video->creator);
        $blocked = $user->isBlocked();
        if ($blocked && !COwnerHelper::isCommunityAdmin()) {
            $allowToView = false;
        }
        if ($video->creator_type == VIDEO_GROUP_TYPE) {
            //CFactory::load( 'helpers' , 'group' );
            if (!CGroupHelper::allowViewMedia($video->groupid)) {
                $allowToView = false;
            }
        } else {
            if (!CPrivacy::isAccessAllowed($my->id, $video->creator, 'custom', $video->permissions)) {
                switch ($video->permissions) {
                    case '40':
                        $allowToView = false;
                        break;
                    case '30':
                        $allowToView = false;
                        $this->noAccess(JText::sprintf('COM_COMMUNITY_VIDEOS_FRIEND_PERMISSION_MESSAGE', $owner->getDisplayName()));
                        break;
                    default:
                        $allowToView = false;
                        break;
                }
            }
        }
        /* === End Permission Checking === */
        if ($allowToView) {
            // Hit counter + 1
            $video->hit();
            $notiHtml = '<div class="cVideo-Player video-player">
							' . $video->getPlayerHTML() . '
						</div>';
        } else {
            $notiHtml = JText::_('COM_COMMUNITY_VIDEO_UNABLE_VIEW');
        }
        // Get like
        //CFactory::load( 'libraries' , 'like' );
        $likes = new CLike();
        $likesHTML = $likes->getHTML('videos', $video->id, $my->id);
        // Get wall count
        //CFactory::load( 'libraries' , 'wall' );
        $wallCount = CWallLibrary::getWallCount('videos', $video->id);
        // Get video link
        $videoCommentLink = CRoute::_('index.php?option=com_community&view=videos&task=video&videoid=' . $video->id . '&groupid=' . $video->groupid . '&userid=' . $video->creator . '#comments');
        $videoLink = CRoute::_('index.php?option=com_community&view=videos&task=video&videoid=' . $video->id . '&groupid=' . $video->groupid . '&userid=' . $video->creator);
        $creatorName = $video->getCreatorName();
        $creatorLink = CRoute::_('index.php?option=com_community&view=profile&userid=' . $video->creator);
        $objResponse->addScriptCall('updatePlayer', $notiHtml, $video->title, $likesHTML, $video->getHits(), $wallCount, $videoLink, $videoCommentLink, $creatorName, $creatorLink);
        $objResponse->sendResponse();
    }
Example #19
0
 public function ajaxWallShowComments($uniqueId, $type = false)
 {
     $my = CFactory::getUser();
     $html = '';
     if ($type == 'albums') {
         $album = JTable::getInstance('Album', 'CTable');
         $album->load($uniqueId);
         $html = CWallLibrary::getWallContents($type, $album->id, COwnerHelper::isCommunityAdmin() || COwnerHelper::isMine($my->id, $album->creator), 0, 0);
     } else {
         if ($type == 'discussions') {
             $discussion = JTable::getInstance('Discussion', 'CTable');
             $discussion->load($uniqueId);
             $html = CWallLibrary::getWallContents($type, $discussion->id, $my->id == $discussion->creator, 0, 0, 'wall/content', 'groups,discussion');
         } else {
             if ($type == 'videos') {
                 $video = JTable::getInstance('Video', 'CTable');
                 $video->load($uniqueId);
                 $html = CWallLibrary::getWallContents($type, $video->id, COwnerHelper::isCommunityAdmin() || $my->id == $video->creator && $my->id != 0, 0, 0, 'wall/content', 'videos,video');
             } else {
                 if ($type == 'photos') {
                     $photo = JTable::getInstance('Photo', 'CTable');
                     $photo->load($uniqueId);
                     $html = CWallLibrary::getWallContents($type, $photo->id, COwnerHelper::isCommunityAdmin() || $my->id == $photo->creator, 0, 0, 'wall/content', 'photos,photo');
                 }
             }
         }
     }
     $json = array();
     $json['success'] = true;
     $json['html'] = $html;
     die(json_encode($json));
 }
Example #20
0
 /**
  * Ajax function to save a new wall entry
  * 	 
  * @param message	A message that is submitted by the user
  * @param uniqueId	The unique id for this group
  * 
  **/
 public function ajaxSaveWall($message, $uniqueId, $appId = null)
 {
     $filter = JFilterInput::getInstance();
     $message = $filter->clean($message, 'string');
     $uniqueId = $filter->clean($uniqueId, 'int');
     $appId = $filter->clean($appId, 'int');
     if (!COwnerHelper::isRegisteredUser()) {
         return $this->ajaxBlockUnregister();
     }
     $response = new JAXResponse();
     $my = CFactory::getUser();
     $config = CFactory::getConfig();
     $message = strip_tags($message);
     // Load libraries
     CFactory::load('models', 'photos');
     CFactory::load('libraries', 'wall');
     CFactory::load('helpers', 'url');
     CFactory::load('libraries', 'activities');
     CFactory::load('helpers', 'owner');
     CFactory::load('helpers', 'friends');
     CFactory::load('helpers', 'group');
     $photo =& JTable::getInstance('Photo', 'CTable');
     $photo->load($uniqueId);
     $album =& JTable::getInstance('Album', 'CTable');
     $album->load($photo->albumid);
     $handler = $this->_getHandler($album);
     if (!$handler->isWallsAllowed($photo->id)) {
         echo JText::_('COM_COMMUNITY_NOT_ALLOWED_TO_POST_COMMENT');
         return;
     }
     // If the content is false, the message might be empty.
     if (empty($message)) {
         $response->addAlert(JText::_('COM_COMMUNITY_WALL_EMPTY_MESSAGE'));
     } else {
         // @rule: Spam checks
         if ($config->get('antispam_akismet_walls')) {
             CFactory::load('libraries', 'spamfilter');
             $filter = CSpamFilter::getFilter();
             $filter->setAuthor($my->getDisplayName());
             $filter->setMessage($message);
             $filter->setEmail($my->email);
             $filter->setURL(CRoute::_('index.php?option=com_community&view=photos&task=photo&albumid=' . $photo->albumid) . '#photoid=' . $photo->id);
             $filter->setType('message');
             $filter->setIP($_SERVER['REMOTE_ADDR']);
             if ($filter->isSpam()) {
                 $response->addAlert(JText::_('COM_COMMUNITY_WALLS_MARKED_SPAM'));
                 return $response->sendResponse();
             }
         }
         $wall = CWallLibrary::saveWall($uniqueId, $message, 'photos', $my, $my->id == $photo->creator, 'photos,photo');
         $url = $photo->getPhotoURI();
         $param = new CParameter('');
         $param->set('photoid', $uniqueId);
         $param->set('action', 'wall');
         $param->set('wallid', $wall->id);
         $param->set('url', $url);
         // Get the album type
         $app = $album->type;
         // Add activity logging based on app's type
         $permission = $this->_getAppPremission($app, $album);
         if ($app == 'user' && $permission == '0' || $app == 'user' && $permission == PRIVACY_PUBLIC) {
             $group = JTable::getInstance('Group', 'CTable');
             $group->load($album->groupid);
             $event = null;
             $this->_addActivity('photos.wall.create', $my->id, 0, JText::sprintf('COM_COMMUNITY_ACTIVITIES_WALL_POST_PHOTO', $url, $photo->caption), $message, 'photos', $uniqueId, $group, $event, $param->toString());
         }
         // @rule: Send notification to the photo owner.
         if ($my->id !== $photo->creator) {
             // Add notification
             CFactory::load('libraries', 'notification');
             $params = new CParameter('');
             $params->set('url', $url);
             $params->set('message', $message);
             CNotificationLibrary::add('etype_photos_submit_wall', $my->id, $photo->creator, JText::sprintf('COM_COMMUNITY_PHOTO_WALL_EMAIL_SUBJECT', $my->getDisplayName()), '', 'photos.wall', $params);
         }
         //add user points
         CFactory::load('libraries', 'userpoints');
         CUserPoints::assignPoint('photos.wall.create');
         $response->addScriptCall('joms.walls.insert', $wall->content);
     }
     $this->cacheClean(array(COMMUNITY_CACHE_TAG_ACTIVITIES));
     return $response->sendResponse();
 }
Example #21
0
 /**
  * View method to display specific discussion from a group
  * @since 2.4
  * @access	public
  * @param	Object	Data object passed from controller
  */
 public function viewdiscussion()
 {
     $mainframe =& JFactory::getApplication();
     $document = JFactory::getDocument();
     $jconfig = JFactory::getConfig();
     $config = CFactory::getConfig();
     // Load window library
     CFactory::load('libraries', 'window');
     // Load necessary window css / javascript headers.
     CWindow::load();
     // Get necessary variables
     CFactory::load('models', 'groups');
     CFactory::load('models', 'discussions');
     $my = CFactory::getUser();
     $groupId = JRequest::getInt('groupid', '', 'GET');
     $topicId = JRequest::getInt('topicid', '', 'GET');
     // Load necessary library and objects
     $groupModel = CFactory::getModel('groups');
     $group =& JTable::getInstance('Group', 'CTable');
     $discussion =& JTable::getInstance('Discussion', 'CTable');
     $group->load($groupId);
     $discussion->load($topicId);
     $isBanned = $group->isBanned($my->id);
     $document->addCustomTag('<link rel="image_src" href="' . $group->getThumbAvatar() . '" />');
     // @rule: Test if the group is unpublished, don't display it at all.
     if (!$group->published) {
         $this->_redirectUnpublishGroup();
         return;
     }
     $feedLink = CRoute::_('index.php?option=com_community&view=groups&task=viewdiscussion&topicid=' . $topicId . '&format=feed');
     $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('COM_COMMUNITY_GROUPS_LATEST_FEED') . '"  href="' . $feedLink . '"/>';
     $document->addCustomTag($feed);
     CFactory::load('helpers', 'owner');
     if ($group->approvals == 1 && !$group->isMember($my->id) && !COwnerHelper::isCommunityAdmin()) {
         $this->noAccess(JText::_('COM_COMMUNITY_GROUPS_PRIVATE_NOTICE'));
         return;
     }
     // Execute discussion onDisplay filter
     $appsLib =& CAppPlugins::getInstance();
     $appsLib->loadApplications();
     $args = array();
     $args[] =& $discussion;
     $appsLib->triggerEvent('onDiscussionDisplay', $args);
     // Get the discussion creator info
     $creator = CFactory::getUser($discussion->creator);
     // Format the date accordingly.
     //$discussion->created	= CTimeHelper::getDate( $discussion->created );
     $dayinterval = ACTIVITY_INTERVAL_DAY;
     $timeFormat = $config->get('activitiestimeformat');
     $dayFormat = $config->get('activitiesdayformat');
     if ($config->get('activitydateformat') == COMMUNITY_DATE_FIXED) {
         $discussion->created = CTimeHelper::getDate($discussion->created)->toFormat(JText::_('DATE_FORMAT_LC2'), true);
     } else {
         $discussion->created = CTimeHelper::timeLapse(CTimeHelper::getDate($discussion->created));
     }
     // Set page title
     $document->setTitle(JText::sprintf('COM_COMMUNITY_GROUPS_DISCUSSION_TITTLE', $discussion->title));
     // Add pathways
     $this->_addGroupInPathway($group->id);
     $this->addPathway(JText::_('COM_COMMUNITY_GROUPS_DISCUSSION'), CRoute::_('index.php?option=com_community&view=groups&task=viewdiscussions&groupid=' . $group->id));
     $this->addPathway(JText::sprintf('COM_COMMUNITY_GROUPS_DISCUSSION_TITTLE', $discussion->title));
     CFactory::load('helpers', 'owner');
     $isGroupAdmin = $groupModel->isAdmin($my->id, $group->id);
     if ($my->id == $creator->id || $isGroupAdmin || COwnerHelper::isCommunityAdmin()) {
         $title = JText::_('COM_COMMUNITY_DELETE_DISCUSSION');
         $titleLock = $discussion->lock ? JText::_('COM_COMMUNITY_UNLOCK_DISCUSSION') : JText::_('COM_COMMUNITY_LOCK_DISCUSSION');
         $actionLock = $discussion->lock ? JText::_('COM_COMMUNITY_UNLOCK') : JText::_('COM_COMMUNITY_LOCK');
         $this->addSubmenuItem('', $actionLock, "joms.groups.lockTopic('" . $titleLock . "','" . $group->id . "','" . $discussion->id . "');", SUBMENU_RIGHT);
         $this->addSubmenuItem('', JText::_('COM_COMMUNITY_DELETE'), "joms.groups.removeTopic('" . $title . "','" . $group->id . "','" . $discussion->id . "');", SUBMENU_RIGHT);
         $this->addSubmenuItem('index.php?option=com_community&view=groups&task=editdiscussion&groupid=' . $group->id . '&topicid=' . $discussion->id, JText::_('COM_COMMUNITY_EDIT'), '', SUBMENU_RIGHT);
     }
     $this->showSubmenu();
     CFactory::load('libraries', 'wall');
     $wallContent = CWallLibrary::getWallContents('discussions', $discussion->id, $isGroupAdmin, $jconfig->get('list_limit'), 0, 'wall.content', 'groups,discussion');
     $wallCount = CWallLibrary::getWallCount('discussions', $discussion->id);
     $viewAllLink = CRoute::_('index.php?option=com_community&view=groups&task=discussapp&topicid=' . $discussion->id . '&app=walls');
     $wallContent .= CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount);
     // Test if the current browser is a member of the group
     $isMember = $group->isMember($my->id);
     $waitingApproval = false;
     // If I have tried to join this group, but not yet approved, display a notice
     if ($groupModel->isWaitingAuthorization($my->id, $group->id)) {
         $waitingApproval = true;
     }
     $wallForm = '';
     $config = CFactory::getConfig();
     // Only get the wall form if user is really allowed to see it.
     if (!$config->get('lockgroupwalls') || $config->get('lockgroupwalls') && $isMember && !$isBanned && !$waitingApproval || COwnerHelper::isCommunityAdmin()) {
         $outputLock = '<div class="warning">' . JText::_('COM_COMMUNITY_DISCUSSION_LOCKED_NOTICE') . '</div>';
         $outputUnLock = CWallLibrary::getWallInputForm($discussion->id, 'groups,ajaxSaveDiscussionWall', 'groups,ajaxRemoveReply');
         $wallForm = '<div class="wall-tittle">' . JText::_('COM_COMMUNITY_REPLIES') . '</div>';
         $wallForm .= $discussion->lock ? $outputLock : $outputUnLock;
     }
     if (empty($wallForm)) {
         //user must join in order to see this page
         $tmpl = new CTemplate();
         $wallForm = $tmpl->set('groupid', $groupId)->fetch('groups.joingroup');
         $outputLock = '<div class="warning">' . JText::_('COM_COMMUNITY_DISCUSSION_LOCKED_NOTICE') . '</div>';
         $outputUnLock = CWallLibrary::getWallInputForm($discussion->id, 'groups,ajaxSaveDiscussionWall', 'groups,ajaxRemoveReply');
         $wallForm2 = '<div class="wall-tittle">' . JText::_('COM_COMMUNITY_REPLIES') . '</div>';
         $wallForm2 .= $discussion->lock ? $outputLock : $outputUnLock;
         $wallForm = $wallForm . '<div style="display:none" class="reply-form">' . $wallForm2 . '</div>';
     }
     $config = CFactory::getConfig();
     // Get creator link
     $creatorLink = CRoute::_('index.php?option=com_community&view=profile&userid=' . $creator->id);
     // Get reporting html
     CFactory::load('libraries', 'reporting');
     $report = new CReportingLibrary();
     $reportHTML = $report->getReportingHTML(JText::_('COM_COMMUNITY_GROUPS_DISCUSSION_REPORT'), 'groups,reportDiscussion', array($discussion->id));
     CFactory::load('libraries', 'bookmarks');
     $bookmarks = new CBookmarks(CRoute::getExternalURL('index.php?option=com_community&view=groups&task=viewdiscussion&groupid=' . $group->id . '&topicid=' . $discussion->id));
     $bookmarksHTML = $bookmarks->getHTML();
     $tmpl = new CTemplate();
     echo $tmpl->set('bookmarksHTML', $bookmarksHTML)->set('discussion', $discussion)->set('creator', $creator)->set('wallContent', $wallContent)->set('wallForm', $wallForm)->set('creatorLink', $creatorLink)->set('reportHTML', $reportHTML)->set('groupid', $groupId)->fetch('groups.viewdiscussion');
 }
Example #22
0
 /**
  * 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');
 }
Example #23
0
        function _getWallHTML($userid, $limit, $limitstart, $allowPosting, $allowRemoval)
        {
            $config = CFactory::getConfig();
            $html = '';
            $viewAllLink = false;
            if (JRequest::getVar('task', '', 'REQUEST') != 'app') {
                $viewAllLink = CRoute::_('index.php?option=com_community&view=profile&userid=' . $userid . '&task=app&app=walls');
            }
            $wallCount = CWallLibrary::getWallCount('user', $userid);
            $wallModel = CFactory::getModel('wall');
            $wallsinput = "";
            if ($allowPosting) {
                $wallsinput = CWallLibrary::getWallInputForm($userid, 'plugins,walls,ajaxSaveWall', 'plugins,walls,ajaxRemoveWall', $viewAllLink);
            }
            $contents = CWallLibrary::getWallContents('user', $userid, $allowRemoval, $limit, $limitstart, 'wall.content', 'profile,profile');
            $contents .= CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount);
            $html .= $wallsinput;
            $html .= '<div id="wallContent" style="display: block; visibility: visible;">';
            if ($contents == '') {
                $html .= '
				<div id="wall-empty-container">
					<div class="icon-nopost">
			            <img src="' . JURI::base() . 'plugins/community/walls/favicon.png" alt="" />
			        </div>
			        <div class="content-nopost">' . JText::_('PLG_WALLS_NO_WALL_POST') . '
			        </div>
				</div>';
            } else {
                $html .= CStringHelper::replaceThumbnails($contents);
            }
            $html .= '</div>';
            // Add pagination links, only in full app view
            if (JRequest::getVar('task', '', 'REQUEST') == 'app') {
                jimport('joomla.html.pagination');
                $pagination = new JPagination($wallModel->getCount($userid, 'user'), $limitstart, $limit);
                $html .= '
				<!-- Pagination -->
				<div style="text-align: center;">
					' . $pagination->getPagesLinks() . '
				</div>
				<!-- End Pagination -->';
            }
            return $html;
        }
Example #24
0
 /**
  * Ajax function to save a new wall entry
  * 	 
  * @param message	A message that is submitted by the user
  * @param uniqueId	The unique id for this group
  * 
  **/
 public function ajaxSaveWall($message, $uniqueId, $appId = null)
 {
     if (!COwnerHelper::isRegisteredUser()) {
         return $this->ajaxBlockUnregister();
     }
     $response = new JAXResponse();
     $my = CFactory::getUser();
     $config = CFactory::getConfig();
     $message = strip_tags($message);
     // Load libraries
     CFactory::load('models', 'photos');
     CFactory::load('libraries', 'wall');
     CFactory::load('helpers', 'url');
     CFactory::load('libraries', 'activities');
     CFactory::load('helpers', 'owner');
     CFactory::load('helpers', 'friends');
     CFactory::load('helpers', 'group');
     $photo =& JTable::getInstance('Photo', 'CTable');
     $photo->load($uniqueId);
     $album =& JTable::getInstance('Album', 'CTable');
     $album->load($photo->albumid);
     $handler = $this->_getHandler($album);
     if (!$handler->isWallsAllowed($photo->id)) {
         echo JText::_('CC NOT ALLOWED TO POST COMMENT');
         return;
     }
     // If the content is false, the message might be empty.
     if (empty($message)) {
         $response->addAlert(JText::_('CC EMPTY WALL MESSAGE'));
     } else {
         $wall = CWallLibrary::saveWall($uniqueId, $message, 'photos', $my, $my->id == $photo->creator, 'photos,photo');
         $url = $handler->getPhotoURI($photo->albumid, $photo->id, false);
         $param = new JParameter('');
         $param->set('photoid', $uniqueId);
         $param->set('action', 'wall');
         $param->set('wallid', $wall->id);
         $param->set('url', $url);
         /** HTGMOD **/
         // trigger plugin event when a comment is posted to a photo
         CFactory::load('libraries', 'apps');
         $appsLib =& CAppPlugins::getInstance();
         $appsLib->loadApplications();
         $params = array();
         $params[] = $uniqueId;
         $params[] = $message;
         $appsLib->triggerEvent('onPhotoComment', $params);
         /** END HTGMOD **/
         // Get the album type
         $app = $album->type;
         // Add activity logging based on app's type
         switch ($app) {
             case 'user':
                 $user = CFactory::getUser($album->creator);
                 $params = $user->getParams();
                 $permission = $params->get('privacyPhotoView');
                 break;
             case 'event':
             case 'group':
                 CFactory::load('models', 'group');
                 $group =& JTable::getInstance('Group', 'CTable');
                 $group->load($album->groupid);
                 $permission = $group->approvals;
                 break;
         }
         if ($app == 'user' && $permission == '0' || $app == 'user' && $permission == PRIVACY_PUBLIC || $app == 'group' && $permission == COMMUNITY_PUBLIC_GROUP) {
             $this->_addActivity('photos.wall.create', $my->id, 0, JText::sprintf('CC ACTIVITIES WALL POST PHOTO', $url, $photo->caption), $message, 'photos', $uniqueId, $param->toString());
         }
         // @rule: Send notification to the photo owner.
         if ($my->id !== $photo->creator) {
             // Add notification
             CFactory::load('libraries', 'notification');
             $params = new JParameter('');
             $params->set('url', $handler->getPhotoURI($photo->albumid, $photo->id, false));
             $params->set('message', $message);
             CNotificationLibrary::add('photos.submit.wall', $my->id, $photo->creator, JText::sprintf('CC PHOTO WALL EMAIL SUBJECT', $my->getDisplayName()), '', 'photos.wall', $params);
         }
         //add user points
         CFactory::load('libraries', 'userpoints');
         CUserPoints::assignPoint('photos.wall.create');
         $response->addScriptCall('joms.walls.insert', $wall->content);
     }
     return $response->sendResponse();
 }
Example #25
0
 /**
  * Ajax function to save a new wall entry
  *
  * @param message    A message that is submitted by the user
  * @param uniqueId    The unique id for this group
  *
  * */
 public function ajaxSaveWall($message, $uniqueId, $appId = null, $photoId = 0)
 {
     $filter = JFilterInput::getInstance();
     $message = $filter->clean($message, 'string');
     $uniqueId = $filter->clean($uniqueId, 'int');
     $appId = $filter->clean($appId, 'int');
     $photoId = $filter->clean($photoId, 'int');
     if (!COwnerHelper::isRegisteredUser()) {
         return $this->ajaxBlockUnregister();
     }
     $json = array();
     $my = CFactory::getUser();
     $config = CFactory::getConfig();
     $message = strip_tags($message);
     $photo = JTable::getInstance('Photo', 'CTable');
     $photo->load($uniqueId);
     $album = JTable::getInstance('Album', 'CTable');
     $album->load($photo->albumid);
     $handler = $this->_getHandler($album);
     if (!$handler->isWallsAllowed($photo->id)) {
         echo JText::_('COM_COMMUNITY_NOT_ALLOWED_TO_POST_COMMENT');
         return;
     }
     // If the content is false, the message might be empty.
     if (empty($message) && $photoId == 0) {
         $json['error'] = JText::_('COM_COMMUNITY_WALL_EMPTY_MESSAGE');
     } else {
         // @rule: Spam checks
         if ($config->get('antispam_akismet_walls')) {
             $filter = CSpamFilter::getFilter();
             $filter->setAuthor($my->getDisplayName());
             $filter->setMessage($message);
             $filter->setEmail($my->email);
             $filter->setURL(CRoute::_('index.php?option=com_community&view=photos&task=photo&albumid=' . $photo->albumid) . '&photoid=' . $photo->id);
             $filter->setType('message');
             $filter->setIP($_SERVER['REMOTE_ADDR']);
             if ($filter->isSpam()) {
                 $json['error'] = JText::_('COM_COMMUNITY_WALLS_MARKED_SPAM');
                 die(json_encode($json));
             }
         }
         $wall = CWallLibrary::saveWall($uniqueId, $message, 'photos', $my, $my->id == $photo->creator, 'photos,photo', 'wall/content', 0, $photoId);
         $url = $photo->getRawPhotoURI();
         $param = new CParameter('');
         $param->set('photoid', $uniqueId);
         $param->set('action', 'wall');
         $param->set('wallid', $wall->id);
         $param->set('url', $url);
         // Get the album type
         $app = $album->type;
         // Add activity logging based on app's type
         $permission = $this->_getAppPremission($app, $album);
         /**
          * We don't need to check for permission to create activity
          * Activity will follow album privacy
          * @since 3.2
          */
         if ($app == 'user' || $app == 'group') {
             $group = JTable::getInstance('Group', 'CTable');
             $group->load($album->groupid);
             $event = null;
             $this->_addActivity('photos.wall.create', $my->id, 0, '', $message, 'photos.comment', $uniqueId, $group, $event, $param->toString(), $permission);
         }
         // Add notification
         $params = new CParameter('');
         $params->set('url', $photo->getRawPhotoURI());
         $params->set('message', CUserHelper::replaceAliasURL($message));
         $params->set('photo', JText::_('COM_COMMUNITY_SINGULAR_PHOTO'));
         $params->set('photo_url', $url);
         // @rule: Send notification to the photo owner.
         if ($my->id !== $photo->creator) {
             CNotificationLibrary::add('photos_submit_wall', $my->id, $photo->creator, JText::sprintf('COM_COMMUNITY_PHOTO_WALL_EMAIL_SUBJECT'), '', 'photos.wall', $params);
         } else {
             //for activity reply action
             //get relevent users in the activity
             $wallModel = CFactory::getModel('wall');
             $users = $wallModel->getAllPostUsers('photos', $photo->id, $photo->creator);
             if (!empty($users)) {
                 CNotificationLibrary::add('photos_reply_wall', $my->id, $users, JText::sprintf('COM_COMMUNITY_PHOTO_WALLREPLY_EMAIL_SUBJECT'), '', 'photos.wallreply', $params);
             }
         }
         //email and add notification if user are tagged
         $info = array('type' => 'image-comment', 'album_id' => $album->id, 'image_id' => $photo->id);
         CUserHelper::parseTaggedUserNotification($message, CFactory::getUser($photo->creator), $wall, $info);
         // Add user points
         CUserPoints::assignPoint('photos.wall.create');
         // Log user engagement
         CEngagement::log('photo.comment', $my->id);
         $json['success'] = true;
         $json['html'] = $wall->content;
     }
     $this->cacheClean(array(COMMUNITY_CACHE_TAG_ACTIVITIES));
     die(json_encode($json));
 }
Example #26
0
 /**
  * Ajax function to save a new wall entry
  *
  * @param message	A message that is submitted by the user
  * @param uniqueId	The unique id for this group
  *
  **/
 public function ajaxSaveWall($message, $uniqueId)
 {
     $response = new JAXResponse();
     $my = CFactory::getUser();
     $filter = JFilterInput::getInstance();
     $message = $filter->clean($message, 'string');
     $uniqueId = $filter->clean($uniqueId, 'int');
     // Load necessary libraries
     CFactory::load('libraries', 'wall');
     CFactory::load('helpers', 'url');
     CFactory::load('libraries', 'activities');
     $model =& $this->getModel('events');
     $event =& JTable::getInstance('Event', 'CTable');
     $event->load($uniqueId);
     $message = strip_tags($message);
     // Only those who response YES/NO/MAYBE can write on wall
     $eventMembers =& JTable::getInstance('EventMembers', 'CTable');
     $eventMembers->load($my->id, $uniqueId);
     $allowedStatus = array(COMMUNITY_EVENT_STATUS_ATTEND, COMMUNITY_EVENT_STATUS_WONTATTEND, COMMUNITY_EVENT_STATUS_MAYBE);
     CFactory::load('helpers', 'owner');
     $config = CFactory::getConfig();
     if (!in_array($eventMembers->status, $allowedStatus) && !COwnerHelper::isCommunityAdmin() && $config->get('lockeventwalls') || $my->id == 0) {
         // Should not even be here unless use try to manipulate ajax call
         JError::raiseError(500, 'PERMISSION DENIED');
     }
     // If the content is false, the message might be empty.
     if (empty($message)) {
         $response->addAlert(JText::_('COM_COMMUNITY_EMPTY_MESSAGE'));
     } else {
         $isAdmin = $event->isAdmin($my->id);
         // @rule: Spam checks
         if ($config->get('antispam_akismet_walls')) {
             CFactory::load('libraries', 'spamfilter');
             $filter = CSpamFilter::getFilter();
             $filter->setAuthor($my->getDisplayName());
             $filter->setMessage($message);
             $filter->setEmail($my->email);
             $filter->setURL(CRoute::_('index.php?option=com_community&view=events&task=viewevent&eventid=' . $uniqueId));
             $filter->setType('message');
             $filter->setIP($_SERVER['REMOTE_ADDR']);
             if ($filter->isSpam()) {
                 $response->addAlert(JText::_('COM_COMMUNITY_WALLS_MARKED_SPAM'));
                 return $response->sendResponse();
             }
         }
         // Save the wall content
         $wall = CWallLibrary::saveWall($uniqueId, $message, 'events', $my, $isAdmin, 'events,events');
         $event->addWallCount();
         CFactory::load('helpers', 'event');
         $handler = CEventHelper::getHandler($event);
         if ($handler->isPublic()) {
             $actor = $my->id;
             $target = 0;
             $content = $message;
             $cid = $uniqueId;
             $app = 'events';
             $act = $handler->getActivity('events.wall.create', $actor, $target, $content, $cid, $app);
             $act->eventid = $event->id;
             $params = new CParameter('');
             $params->set('event_url', $handler->getFormattedLink('index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id, false, true, false));
             $params->set('action', 'events.wall.create');
             $params->set('wallid', $wall->id);
             CFactory::load('libraries', 'activities');
             CActivityStream::add($act, $params->toString());
         }
         // @rule: Add user points
         CFactory::load('libraries', 'userpoints');
         CUserPoints::assignPoint('events.wall.create');
         $response->addScriptCall('joms.walls.insert', $wall->content);
     }
     $this->cacheClean(array(COMMUNITY_CACHE_TAG_EVENTS, COMMUNITY_CACHE_TAG_ACTIVITIES));
     return $response->sendResponse();
 }
Example #27
0
 /**
  * Application full view
  * */
 public function appFullView()
 {
     /**
      * Opengraph
      */
     // CHeadHelper::setType('website', JText::_('COM_COMMUNITY_PHOTOS_WALL_TITLE'));
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $applicationName = JString::strtolower($jinput->get->get('app', '', 'STRING'));
     if (empty($applicationName)) {
         JError::raiseError(500, JText::_('COM_COMMUNITY_APP_ID_REQUIRED'));
     }
     $output = '<div class="joms-page">';
     $output .= '<h3 class="joms-page__title">' . JText::_('COM_COMMUNITY_PHOTOS_WALL_TITLE') . '</h3>';
     if ($applicationName == 'walls') {
         //CFactory::load( 'libraries' , 'wall' );
         $limit = $jinput->request->get('limit', 5, 'INT');
         //JRequest::getVar( 'limit' , 5 , 'REQUEST' );
         $limitstart = $jinput->request->get('limitstart', 0, 'INT');
         //JRequest::getVar( 'limitstart', 0, 'REQUEST' );
         $albumId = JRequest::getInt('albumid', '');
         $my = CFactory::getUser();
         $album = JTable::getInstance('Album', 'CTable');
         $album->load($albumId);
         //CFactory::load( 'helpers' , 'owner' );
         //CFactory::load( 'helpers' , 'friends' );
         // Get the walls content
         $viewAllLink = false;
         $wallCount = false;
         if ($jinput->request->get('task', '') != 'app') {
             $viewAllLink = CRoute::_('index.php?option=com_community&view=photos&task=app&albumid=' . $album->id . '&app=walls');
             $wallCount = CWallLibrary::getWallCount('album', $album->id);
         }
         $output .= CWallLibrary::getWallContents('albums', $album->id, COwnerHelper::isCommunityAdmin() || COwnerHelper::isMine($my->id, $album->creator), $limit, $limitstart);
         if (CFriendsHelper::isConnected($my->id, $album->creator) || COwnerHelper::isCommunityAdmin()) {
             $output .= CWallLibrary::getWallInputForm($album->id, 'photos,ajaxAlbumSaveWall', 'photos,ajaxAlbumRemoveWall');
         }
         $output .= CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount);
         jimport('joomla.html.pagination');
         $wallModel = CFactory::getModel('wall');
         $pagination = new JPagination($wallModel->getCount($album->id, 'albums'), $limitstart, $limit);
         $output .= '<div class="cPagination">' . $pagination->getPagesLinks() . '</div>';
     } else {
         $model = CFactory::getModel('apps');
         $applications = CAppPlugins::getInstance();
         $applicationId = $model->getUserApplicationId($applicationName);
         $application = $applications->get($applicationName, $applicationId);
         if (is_callable(array($application, 'onAppDisplay'), true)) {
             // Get the parameters
             $manifest = CPluginHelper::getPluginPath('community', $applicationName) . '/' . $applicationName . '/' . $applicationName . '.xml';
             $params = new CParameter($model->getUserAppParams($applicationId), $manifest);
             $application->params = $params;
             $application->id = $applicationId;
             $output = $application->onAppDisplay($params);
         } else {
             JError::raiseError(500, JText::_('COM_COMMUNITY_APPS_NOT_FOUND'));
         }
     }
     $output .= '</div>';
     echo $output;
 }
Example #28
0
 /**
  * Responsible for displaying the event page.
  **/
 public function viewevent()
 {
     $mainframe = JFactory::getApplication();
     $document = JFactory::getDocument();
     $config = CFactory::getConfig();
     $my = CFactory::getUser();
     CFactory::load('libraries', 'tooltip');
     CFactory::load('libraries', 'wall');
     CFactory::load('libraries', 'window');
     CFactory::load('libraries', 'activities');
     CFactory::load('libraries', 'events');
     CWindow::load();
     $eventLib = new CEvents();
     $eventid = JRequest::getInt('eventid', 0);
     $eventModel =& CFactory::getModel('events');
     $event =& JTable::getInstance('Event', 'CTable');
     CFactory::load('helpers', 'event');
     $handler = CEventHelper::getHandler($event);
     $event->load($eventid);
     if (!$handler->exists()) {
         $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_EVENTS_NOT_AVAILABLE_ERROR'), 'error');
         return;
     }
     if (!$handler->browsable()) {
         echo JText::_('COM_COMMUNITY_NOT_ALLOWED_TO_ACCESS_SECTION');
         return;
     }
     // @rule: Test if the group is unpublished, don't display it at all.
     if (!$event->published) {
         echo JText::_('COM_COMMUNITY_EVENTS_UNDER_MODERATION');
         return;
     }
     $this->showSubmenu();
     $event->hit();
     // Basic page presentation
     if ($event->type == 'group') {
         $groupId = $event->contentid;
         $group =& JTable::getInstance('Group', 'CTable');
         $group->load($groupId);
         // Set pathway for group videos
         // Community > Groups > Group Name > Events
         $this->addPathway(JText::_('COM_COMMUNITY_GROUPS'), CRoute::_('index.php?option=com_community&view=groups'));
         $this->addPathway($group->name, CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $groupId));
     }
     $this->addPathway(JText::_('COM_COMMUNITY_EVENTS'), CRoute::_('index.php?option=com_community&view=events'));
     $this->addPathway($event->title);
     // Permissions and privacies
     CFactory::load('helpers', 'owner');
     $isEventGuest = $event->isMember($my->id);
     $isMine = $my->id == $event->creator;
     $isAdmin = $event->isAdmin($my->id);
     $isCommunityAdmin = COwnerHelper::isCommunityAdmin();
     // Get Event Admins
     $eventAdmins = $event->getAdmins(12, CC_RANDOMIZE);
     $adminsInArray = array();
     // Attach avatar of the admin
     for ($i = 0; $i < count($eventAdmins); $i++) {
         $row =& $eventAdmins[$i];
         $admin = CFactory::getUser($row->id);
         array_push($adminsInArray, '<a href="' . CUrlHelper::userLink($admin->id) . '">' . $admin->getDisplayName() . '</a>');
     }
     $adminsList = ltrim(implode(', ', $adminsInArray), ',');
     // Get Attending Event Guests
     $eventMembers = $event->getMembers(COMMUNITY_EVENT_STATUS_ATTEND, 12, CC_RANDOMIZE);
     $eventMembersCount = $event->getMembersCount(COMMUNITY_EVENT_STATUS_ATTEND);
     // Attach avatar of the admin
     // Pre-load multiple users at once
     $userids = array();
     foreach ($eventMembers as $uid) {
         $userids[] = $uid->id;
     }
     CFactory::loadUsers($userids);
     for ($i = 0; $i < count($eventMembers); $i++) {
         $row =& $eventMembers[$i];
         $eventMembers[$i] = CFactory::getUser($row->id);
     }
     // Pre-load multiple users at once
     $waitingApproval = $event->isPendingApproval($my->id);
     $waitingRespond = false;
     $myStatus = $event->getUserStatus($my->id);
     $hasResponded = $myStatus == COMMUNITY_EVENT_STATUS_ATTEND || $myStatus == COMMUNITY_EVENT_STATUS_WONTATTEND || $myStatus == COMMUNITY_EVENT_STATUS_MAYBE;
     // Get Bookmark HTML
     CFactory::load('libraries', 'bookmarks');
     $bookmarks = new CBookmarks(CRoute::getExternalURL('index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id));
     $bookmarksHTML = $bookmarks->getHTML();
     // Get Reporting HTML
     CFactory::load('libraries', 'reporting');
     $report = new CReportingLibrary();
     $reportHTML = $report->getReportingHTML(JText::_('COM_COMMUNITY_EVENTS_REPORT'), 'events,reportEvent', array($event->id));
     // Get the Wall
     CFactory::load('libraries', 'wall');
     $wallContent = CWallLibrary::getWallContents('events', $event->id, $isAdmin, 10, 0, 'wall.content', 'events,events');
     $wallCount = CWallLibrary::getWallCount('events', $event->id);
     $viewAllLink = false;
     if (JRequest::getVar('task', '', 'REQUEST') != 'app') {
         $viewAllLink = CRoute::_('index.php?option=com_community&view=events&task=app&eventid=' . $event->id . '&app=walls');
     }
     $wallContent .= CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount);
     $wallForm = '';
     /*if( !$config->get('lockeventwalls')
     			|| ($config->get('lockeventwalls') && ($isEventGuest) && !($waitingApproval) && $hasResponded) 
     			|| $isCommunityAdmin )
     		{
     			$wallForm	= CWallLibrary::getWallInputForm( $event->id , 'events,ajaxSaveWall', 'events,ajaxRemoveWall' );
     		}*/
     // Construct the RVSP radio list
     $arr = array(JHTML::_('select.option', COMMUNITY_EVENT_STATUS_ATTEND, JText::_('COM_COMMUNITY_EVENTS_YES')), JHTML::_('select.option', COMMUNITY_EVENT_STATUS_WONTATTEND, JText::_('COM_COMMUNITY_EVENTS_NO')), JHTML::_('select.option', COMMUNITY_EVENT_STATUS_MAYBE, JText::_('COM_COMMUNITY_EVENTS_MAYBE')));
     $status = $event->getMemberStatus($my->id);
     $radioList = JHTML::_('select.radiolist', $arr, 'status', '', 'value', 'text', $status, false);
     $unapprovedCount = $event->inviteRequestCount();
     //...
     $editEvent = JRequest::getVar('edit', false, 'GET');
     $editEvent = $editEvent == 1 ? true : false;
     // Am I invited in this event?
     $isInvited = false;
     $join = '';
     $friendsCount = 0;
     $isInvited = $eventModel->isInvitedMe(0, $my->id, $event->id);
     // If I was invited, I want to know my invitation informations
     if ($isInvited) {
         $invitor = CFactory::getUser($isInvited[0]->invited_by);
         $join = '<a href="' . CUrlHelper::userLink($invitor->id) . '">' . $invitor->getDisplayName() . '</a>';
         // Get users friends in this group
         $friendsCount = $eventModel->getFriendsCount($my->id, $event->id);
     }
     // Get like
     CFactory::load('libraries', 'like');
     $likes = new CLike();
     $likesHTML = $likes->getHTML('events', $event->id, $my->id);
     // Is this event is a past event?
     $now = new JDate();
     $isPastEvent = $event->getEndDate(false)->toMySQL() < $now->toMySQL(true) ? true : false;
     // Get the formated date & time
     $format = $config->get('eventshowampm') ? JText::_('COM_COMMUNITY_EVENTS_TIME_FORMAT_12HR') : JText::_('COM_COMMUNITY_EVENTS_TIME_FORMAT_24HR');
     $startDate = $event->getStartDate(false);
     $endDate = $event->getEndDate(false);
     $allday = false;
     if ($startDate->toFormat('%Y-%m-%d') == $endDate->toFormat('%Y-%m-%d') && $startDate->toFormat('%H:%M:%S') == '00:00:00' && $endDate->toFormat('%H:%M:%S') == '23:59:59') {
         $format = JText::_('COM_COMMUNITY_EVENT_TIME_FORMAT_LC1');
         $allday = true;
     }
     $event->startdateHTML = CTimeHelper::getFormattedTime($event->startdate, $format);
     $event->enddateHTML = CTimeHelper::getFormattedTime($event->enddate, $format);
     CFactory::load('libraries', 'invitation');
     $inviteHTML = CInvitation::getHTML(null, 'events,inviteUsers', $event->id, CInvitation::SHOW_FRIENDS, CInvitation::SHOW_EMAIL);
     CFactory::load('libraries', 'userstatus');
     $status = new CUserStatus($event->id, 'events');
     $tmpl = new CTemplate();
     $creator = new CUserStatusCreator('message');
     $creator->title = $isMine ? JText::_('COM_COMMUNITY_STATUS') : JText::_('COM_COMMUNITY_MESSAGE');
     $creator->html = $tmpl->fetch('status.message');
     $status->addCreator($creator);
     // Upgrade wall to stream @since 2.5
     $event->upgradeWallToStream();
     // Add custom stream
     $streamHTML = $eventLib->getStreamHTML($event);
     if ($event->getMemberStatus($my->id) == COMMUNITY_EVENT_STATUS_ATTEND) {
         $RSVPmessage = JText::_('COM_COMMUNITY_EVENTS_ATTENDING_EVENT_MESSAGE');
     } else {
         if ($event->getMemberStatus($my->id) == COMMUNITY_EVENT_STATUS_WONTATTEND) {
             $RSVPmessage = JText::_('COM_COMMUNITY_EVENTS_NOT_ATTENDING_EVENT_MESSAGE');
         } else {
             $RSVPmessage = JText::_('COM_COMMUNITY_EVENTS_NOT_RESPOND_RSVP_MESSAGE');
         }
     }
     // Output to template
     echo $tmpl->setMetaTags('event', $event)->set('status', $status)->set('streamHTML', $streamHTML)->set('timezone', CTimeHelper::getTimezone($event->offset))->set('handler', $handler)->set('likesHTML', $likesHTML)->set('inviteHTML', $inviteHTML)->set('guestStatus', $event->getUserStatus($my->id))->set('event', $event)->set('radioList', $radioList)->set('bookmarksHTML', $bookmarksHTML)->set('reportHTML', $reportHTML)->set('isEventGuest', $isEventGuest)->set('isMine', $isMine)->set('isAdmin', $isAdmin)->set('isCommunityAdmin', $isCommunityAdmin)->set('unapproved', $unapprovedCount)->set('waitingApproval', $waitingApproval)->set('wallContent', $wallContent)->set('eventMembers', $eventMembers)->set('eventMembersCount', $eventMembersCount)->set('editEvent', $editEvent)->set('my', $my)->set('memberStatus', $myStatus)->set('waitingRespond', $waitingRespond)->set('isInvited', $isInvited)->set('join', $join)->set('friendsCount', $friendsCount)->set('isPastEvent', $isPastEvent)->set('adminsList', $adminsList)->set('RSVPmessage', $RSVPmessage)->set('allday', $allday)->fetch('events.viewevent');
 }