Пример #1
0
 /**
  * Displays the application output in the canvas.
  *
  * @since	1.0
  * @access	public
  * @param	int		The user id that is currently being viewed.
  */
 public function display($userId = null, $docType = null)
 {
     // Require user to be logged in
     FD::requireLogin();
     $id = JRequest::getVar('schedule_id');
     // Get the user that's being accessed.
     $user = FD::user($userId);
     $calendar = FD::table('Calendar');
     $calendar->load($id);
     if (!$calendar->id || !$id) {
         FD::info()->set(false, JText::_('APP_CALENDAR_CANVAS_INVALID_SCHEDULE_ID'), SOCIAL_MSG_ERROR);
         return $this->redirect(FD::profile(array('id' => $user->getAlias()), false));
     }
     $my = FD::user();
     $privacy = FD::privacy($my->id);
     $result = $privacy->validate('apps.calendar', $calendar->id, 'view', $user->id);
     if (!$result) {
         FD::info()->set(false, JText::_('APP_CALENDAR_NO_ACCESS'), SOCIAL_MSG_ERROR);
         JFactory::getApplication()->redirect(FRoute::dashboard());
     }
     FD::page()->title($calendar->title);
     // Render the comments and likes
     $likes = FD::likes();
     $likes->get($id, 'calendar', 'create', SOCIAL_APPS_GROUP_USER);
     // Apply comments on the stream
     $comments = FD::comments($id, 'calendar', 'create', SOCIAL_APPS_GROUP_USER, array('url' => FRoute::albums(array('layout' => 'item', 'id' => $id))));
     $params = $this->app->getParams();
     $this->set('params', $params);
     $this->set('likes', $likes);
     $this->set('comments', $comments);
     $this->set('calendar', $calendar);
     $this->set('user', $user);
     echo parent::display('canvas/item/default');
 }
Пример #2
0
 /**
  * Displays the dialog to allow user to crop avatar
  *
  * @since	1.2
  * @access	public
  * @param	string
  * @return
  */
 public function crop()
 {
     // Require the user to be logged in
     FD::requireLogin();
     // Load up the ajax library
     $ajax = FD::ajax();
     // Get the unique object.
     $uid = JRequest::getInt('uid');
     $type = JRequest::getCmd('type');
     // Get photo id
     $id = JRequest::getInt('id');
     $table = FD::table('Photo');
     $table->load($id);
     $redirectUrl = JRequest::getVar('redirectUrl', '');
     // Load up the library
     $lib = FD::photo($table->uid, $table->type, $table);
     if (!$table->id) {
         return $this->deleted($lib);
     }
     // Check if the user is really allowed to upload avatar
     if (!$lib->canUseAvatar()) {
         return $ajax->reject();
     }
     $redirect = JRequest::getInt('redirect', 1);
     $theme = FD::themes();
     $theme->set('uid', $uid);
     $theme->set('type', $type);
     $theme->set('redirectUrl', $redirectUrl);
     $theme->set('photo', $lib->data);
     $theme->set('redirect', $redirect);
     $output = $theme->output('site/avatar/crop');
     return $ajax->resolve($output);
 }
Пример #3
0
 /**
  * Filters the output of members
  *
  * @since	1.2
  * @access	public
  * @return
  */
 public function filterMembers()
 {
     // Check for request forgeriess
     FD::checkToken();
     // Ensure that the user is logged in.
     FD::requireLogin();
     // Load up ajax lib
     $ajax = FD::ajax();
     // Get the group
     $id = JRequest::getInt('id');
     $group = FD::group($id);
     // @TODO: Check whether the viewer can really view the contents
     // Get the current filter
     $filter = JRequest::getWord('filter');
     $options = array();
     if ($filter == 'admin') {
         $options['admin'] = true;
     }
     if ($filter == 'pending') {
         $options['state'] = SOCIAL_GROUPS_MEMBER_PENDING;
     }
     $model = FD::model('Groups');
     $users = $model->getMembers($group->id, $options);
     $pagination = $model->getPagination();
     // Load the contents
     $theme = FD::themes();
     $theme->set('pagination', $pagination);
     $theme->set('group', $group);
     $theme->set('users', $users);
     $contents = $theme->output('apps/group/members/groups/default.list');
     return $ajax->resolve($contents);
 }
Пример #4
0
 /**
  * Redirects a notification item to the intended location
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function route()
 {
     // The user needs to be logged in to access notifications
     FD::requireLogin();
     // Check for user profile completeness
     FD::checkCompleteProfile();
     $id = JRequest::getInt('id');
     $table = FD::table('Notification');
     $table->load($id);
     if (!$id || !$table->id) {
         FD::info()->set(JText::_('COM_EASYSOCIAL_NOTIFICATIONS_INVALID_ID_PROVIDED'), SOCIAL_MSG_ERROR);
         return $this->redirect(FRoute::dashboard(array(), false));
     }
     // Check if the user is allowed to view this notification item.
     $my = FD::user();
     if ($table->target_id != $my->id) {
         FD::info()->set(JText::_('COM_EASYSOCIAL_NOTIFICATIONS_NOT_ALLOWED'), SOCIAL_MSG_ERROR);
         return $this->redirect(FRoute::dashboard(array(), false));
     }
     // Mark the notification item as read
     $table->markAsRead();
     // Ensure that all & are replaced with &
     $url = str_ireplace('&', '&', $table->url);
     $this->redirect(FRoute::_($url, false));
     $this->close();
 }
Пример #5
0
 /**
  * Deletes a feed item
  *
  * @since	1.0
  * @access	public
  */
 public function delete()
 {
     // Check for request forgeries.
     FD::checkToken();
     // Ensure that the user is logged in.
     FD::requireLogin();
     // Get the ajax object.
     $ajax = FD::ajax();
     // Get current logged in user
     $my = FD::user();
     // Get app's id.
     $id = JRequest::getInt('id');
     // Get feed id.
     $feedId = JRequest::getInt('feedId');
     // Get feed table
     $feed = $this->getTable('Feed');
     $feed->load($feedId);
     if (!$feedId || !$feed->id) {
         return $ajax->reject(JText::_('APP_FEEDS_INVALID_ID_PROVIDED'));
     }
     // Ensure that the user is allowed to delete this feed.
     if ($feed->user_id != $my->id) {
         return $ajax->reject(JText::_('APP_FEEDS_NOT_ALLOWED_TO_DELETE'));
     }
     // Try to delete the feed now.
     $state = $feed->delete();
     if (!$state) {
         return $ajax->reject($feed->getError());
     }
     return $ajax->resolve();
 }
Пример #6
0
 /**
  * Delete's the location from the database.
  *
  * @since	1.0
  * @access	public
  */
 public function delete()
 {
     // Check for valid token
     FD::checkToken();
     // Guest users shouldn't be allowed to delete any location at all.
     FD::requireLogin();
     $my = FD::user();
     $id = JRequest::getInt('id');
     $view = FD::getInstance('View', 'Location', false);
     $location = FD::table('Location');
     $location->load($id);
     // If id is invalid throw errors.
     if (!$location->id) {
         $view->setErrors(JText::_('COM_EASYSOCIAL_LOCATION_INVALID_ID'));
     }
     // If user do not own item, throw errors.
     if ($my->id !== $location->user_id) {
         $view->setErrors(JText::_('COM_EASYSOCIAL_LOCATION_ERROR_YOU_ARE_NOT_OWNER'));
     }
     // Try to delete location.
     if (!$location->delete()) {
         $view->setErrors($location->getError());
     }
     return $view->delete();
 }
Пример #7
0
 /**
  * Displays the application output in the canvas.
  *
  * @since	1.0
  * @access	public
  * @param	int		The user id that is currently being viewed.
  */
 public function display($userId = null, $docType = null)
 {
     // Require user to be logged in
     FD::requireLogin();
     $model = $this->getModel('Calendar');
     $user = FD::user($userId);
     // Get the events for the calendar
     $result = $model->getItems($user->id);
     $schedules = array();
     if ($user->isViewer()) {
         $title = JText::_('APP_CALENDAR_CANVAS_TITLE_OWNER');
     } else {
         $title = JText::sprintf('APP_CALENDAR_CANVAS_TITLE_VIEWER', $user->getName());
     }
     // Set the page title
     FD::page()->title($title);
     if ($result) {
         foreach ($result as $row) {
             $table = FD::table('Calendar');
             $table->bind($row);
             $schedules[] = $table;
         }
     }
     // Determines if the current page is on RTL mode.
     $doc = JFactory::getDocument();
     $direction = $doc->getDirection();
     $isRTL = $direction == 'rtl' ? true : false;
     // Get application params
     $params = $this->app->getParams();
     $this->set('params', $params);
     $this->set('isRTL', $isRTL);
     $this->set('user', $user);
     $this->set('schedules', $schedules);
     echo parent::display('canvas/calendar/default');
 }
Пример #8
0
 /**
  * Redirects a notification item to the intended location
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function route()
 {
     // The user needs to be logged in to access notifications
     FD::requireLogin();
     // Get the notification id
     $id = $this->input->get('id', 0, 'int');
     $table = FD::table('Notification');
     $table->load($id);
     // Default redirection URL
     $redirect = FRoute::dashboard(array(), false);
     if (!$id || !$table->id) {
         $this->info->set(JText::_('COM_EASYSOCIAL_NOTIFICATIONS_INVALID_ID_PROVIDED'), SOCIAL_MSG_ERROR);
         return $this->redirect($redirect);
     }
     // Ensure that the viewer really owns this item
     if ($table->target_id != $this->my->id) {
         $this->info->set(JText::_('COM_EASYSOCIAL_NOTIFICATIONS_NOT_ALLOWED'), SOCIAL_MSG_ERROR);
         return $this->redirect($redirect);
     }
     // Mark the notification item as read
     $table->markAsRead();
     // Ensure that all & are replaced with &
     $url = str_ireplace('&', '&', $table->url);
     $redirect = FRoute::_($url, false);
     $this->redirect($redirect);
     $this->close();
 }
Пример #9
0
 /**
  * Deletes a file from the system.
  *
  * @since	1.0
  * @access	public
  * @param	null
  * @return	null
  */
 public function delete()
 {
     // Check for request forgeries
     FD::checkToken();
     // Only logged in users are allowed to delete anything
     FD::requireLogin();
     // Get the current view
     $view = $this->getCurrentView();
     // Get the current user
     $my = FD::user();
     // Get the uploader id
     $id = JRequest::getInt('id');
     $uploader = FD::table('Uploader');
     $uploader->load($id);
     // Check if the user is really permitted to delete the item
     if (!$id || !$uploader->id || $uploader->user_id != $my->id) {
         return $view->call(__FUNCTION__);
     }
     $state = $uploader->delete();
     // If deletion fails, silently log the error
     if (!$state) {
         FD::logError(__FILE__, __LINE__, JText::_('UPLOADER: Unable to delete the item [' . $uploader->id . '] because ' . $uploader->getError()));
     }
     return $view->call(__FUNCTION__);
 }
Пример #10
0
 /**
  * Unfollows a user
  *
  * @since	1.0
  * @access	public
  */
 public function unfollow()
 {
     // Check for valid tokens.
     FD::checkToken();
     // Check for valid user.
     FD::requireLogin();
     // Load friends model.
     $model = FD::model('Followers');
     // Load the view.
     $view = $this->getCurrentView();
     // Get the user id that we should load for.
     $userId = JRequest::getInt('id');
     // Get the current logged in user
     $my = FD::user();
     // Loads the followers record
     $follower = FD::table('Subscription');
     $follower->load(array('uid' => $userId, 'type' => 'user.user', 'user_id' => $my->id));
     if (!$follower->id || !$userId) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_FOLLOWERS_INVALID_ID'), SOCIAL_MSG_ERROR);
         return $view->call(__FUNCTION__);
     }
     // Delete the record
     $state = $follower->delete();
     $view->call(__FUNCTION__);
 }
Пример #11
0
 public function sidebarBottom()
 {
     FD::requireLogin();
     $params = $this->getParams();
     if (!$params->get('widget_dashboard', true)) {
         return;
     }
     $my = FD::user();
     $days = $params->get('widgets_dashboard_days', 14);
     $total = $params->get('widgets_dashboard_total', 5);
     $date = FD::date();
     $now = $date->toSql();
     $future = FD::date($date->toUnix() + $days * 24 * 60 * 60)->toSql();
     $options = array();
     $options['start-after'] = $now;
     $options['start-before'] = $future;
     $options['limit'] = $total;
     $options['state'] = SOCIAL_STATE_PUBLISHED;
     $options['ordering'] = 'start';
     $events = FD::model('Events')->getEvents($options);
     if (empty($events)) {
         return;
     }
     $theme = FD::themes();
     $theme->set('events', $events);
     $theme->set('app', $this->app);
     echo $theme->output('themes:/apps/user/events/widgets/dashboard/upcoming');
 }
Пример #12
0
 /**
  * Displays the application output in the canvas.
  *
  * @since    1.0
  * @access    public
  * @param    int        The user id that is currently being viewed.
  */
 public function display($eventId = null, $docType = null)
 {
     FD::requireLogin();
     $event = FD::event($eventId);
     // Check if the viewer is allowed here.
     if (!$event->canViewItem()) {
         return $this->redirect($event->getPermalink(false));
     }
     // Get app params
     $params = $this->app->getParams();
     $model = FD::model('Discussions');
     $options = array('limit' => $params->get('total', 10));
     $discussions = $model->getDiscussions($event->id, SOCIAL_TYPE_EVENT, $options);
     $pagination = $model->getPagination();
     $pagination->setVar('option', 'com_easysocial');
     $pagination->setVar('view', 'events');
     $pagination->setVar('layout', 'item');
     $pagination->setVar('id', $event->getAlias());
     $pagination->setVar('appId', $this->app->getAlias());
     $this->set('app', $this->app);
     $this->set('params', $params);
     $this->set('pagination', $pagination);
     $this->set('event', $event);
     $this->set('discussions', $discussions);
     echo parent::display('events/default');
 }
Пример #13
0
 /**
  * Displays the application output in the canvas.
  *
  * @since    1.0
  * @access    public
  * @param    int        The user id that is currently being viewed.
  */
 public function display($uid = null, $docType = null)
 {
     FD::requireLogin();
     $event = FD::event($uid);
     $editor = JFactory::getEditor();
     $this->set('editor', $editor);
     $this->set('event', $event);
     echo parent::display('canvas/form');
 }
Пример #14
0
 public function loadStoryForm()
 {
     FD::checkToken();
     FD::requireLogin();
     FD::language()->loadAdmin();
     $categoryid = FD::input()->getInt('id', 0);
     $category = FD::table('EventCategory');
     $category->load($categoryid);
     $db = FD::db();
     $sql = $db->sql();
     $sql->select('#__social_fields', 'a');
     $sql->column('a.*');
     $sql->column('d.element');
     $sql->leftjoin('#__social_fields_steps', 'b');
     $sql->on('a.step_id', 'b.id');
     $sql->leftjoin('#__social_clusters_categories', 'c');
     $sql->on('b.uid', 'c.id');
     $sql->leftjoin('#__social_apps', 'd');
     $sql->on('a.app_id', 'd.id');
     $sql->where('b.type', SOCIAL_TYPE_CLUSTERS);
     $sql->where('c.id', $category->id);
     $sql->where('d.group', SOCIAL_FIELDS_GROUP_EVENT);
     $sql->where('d.type', SOCIAL_APPS_TYPE_FIELDS);
     $sql->where('d.element', array('startend', 'title', 'description'), 'in');
     $db->setQuery($sql);
     $result = $db->loadObjectList();
     $theme = FD::themes();
     foreach ($result as $row) {
         $field = FD::table('Field');
         $field->bind($row);
         $params = $field->getParams();
         if ($row->element === 'startend') {
             $dateFormat = $params->get('date_format', 'DD-MM-YYYY');
             if ($params->get('allow_time', true)) {
                 $dateFormat .= ' ' . $params->get('time_format', 'hh:mm A');
             }
             if ($params->get('allow_timezone', true)) {
                 $theme->set('timezones', $this->getTimezones());
             }
             $theme->set('dateFormat', $dateFormat);
             $theme->set('allowTimezone', $params->get('allow_timezone', 1));
             $theme->set('allowTime', $params->get('allow_time', 1));
             $theme->set('yearfrom', $params->get('yearfrom'));
             $theme->set('yearto', $params->get('yearto'));
             $theme->set('disallowPast', $params->get('disallow_past', 0));
             $theme->set('minuteStepping', $params->get('minute_stepping', 15));
         }
         if ($row->element === 'title') {
             $theme->set('titlePlaceholder', $field->get('title'));
         }
         if ($row->element === 'description') {
             $theme->set('descriptionPlaceholder', $field->get('description'));
         }
     }
     FD::ajax()->resolve($theme->output('apps/user/events/story/panel.form'));
 }
Пример #15
0
 public function addFilter($filter)
 {
     $ajax = FD::ajax();
     FD::requireLogin();
     $theme = FD::themes();
     $theme->set('filter', $filter);
     $theme->set('fid', '');
     $content = $theme->output('site/advancedsearch/user/sidebar.filter.item');
     return $ajax->resolve($content, JText::_('COM_EASYSOCIAL_ADVANCED_SEARCH_FILTER_SAVED'));
 }
Пример #16
0
 /**
  * Display user photos on the side bar
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function sidebarBottom()
 {
     // Only logged in users are allowed here.
     FD::requireLogin();
     // Get the application params
     $params = $this->getParams();
     if (!$params->get('widgets_upcoming', true)) {
         return;
     }
     echo $this->getUpcomingSchedules();
 }
Пример #17
0
 /**
  * Displays the upload cover dialog
  *
  * @since	1.2
  * @access	public
  * @param	string
  * @return
  */
 public function uploadDialog()
 {
     // Only logged in users allowed
     FD::requireLogin();
     $uid = $this->input->get('uid', 0, 'int');
     $type = $this->input->get('type', '', 'cmd');
     $theme = FD::themes();
     $theme->set('uid', $uid);
     $theme->set('type', $type);
     $output = $theme->output('site/profile/cover.upload');
     return $this->ajax->resolve($output);
 }
Пример #18
0
 /**
  * Responsible to output JSON encoded data.
  *
  * @since	1.0
  * @access	public
  * @param	SocialTableConversation			$conversation	The conversation table.
  * @param	SocialTableConversationMessage	$messageTable	The message table.
  * @param	string							$token			If form contains an uploder, a token is necessary (optional).
  *
  * @return	json
  */
 public function delete()
 {
     // We know for the fact that guests can never access conversations.
     FD::requireLogin();
     $ajax = FD::getInstance('Ajax');
     // Try to see if there's any error message.
     $errors = $this->getErrors();
     if (!$errors) {
         return $ajax->success();
     }
     // @TODO: Error handling codes.
 }
Пример #19
0
 /**
  * Post processes after a user submits a story.
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function update($streamTable = '')
 {
     // Only logged in users allowed here
     FD::requireLogin();
     $ajax = FD::ajax();
     if ($this->hasErrors()) {
         return $ajax->reject($this->getMessage());
     }
     $stream = FD::stream();
     $stream->getItem($streamTable->uid);
     $output = $stream->html(false, '', array('contentOnly' => true));
     return $ajax->resolve($output, $streamTable->uid);
 }
Пример #20
0
 /**
  * Responsible to output the single stream layout.
  *
  * @access	public
  * @return	null
  *
  */
 public function display()
 {
     // Unauthorized users should not be allowed to access this page.
     FD::requireLogin();
     // Check for user profile completeness
     FD::checkCompleteProfile();
     // Get the current logged in user.
     $user = FD::user();
     // Get user's privacy
     $privacy = FD::get('Privacy')->getUserPrivacy($user->id);
     $this->set('user', $user);
     $this->set('privacy', $privacy);
     echo parent::display('site/privacy/default');
 }
Пример #21
0
 /**
  * Displays the revoke confirmation dialog.
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function confirmRevoke()
 {
     // Only required users allowed here.
     FD::requireLogin();
     $ajax = FD::ajax();
     // Get client and callback
     $client = JRequest::getWord('client');
     $callback = JRequest::getVar('callbackUrl');
     $theme = FD::themes();
     $theme->set('callback', $callback);
     $theme->set('client', $client);
     $contents = $theme->output('site/' . $client . '/revoke.dialog');
     return $ajax->resolve($contents);
 }
Пример #22
0
 /**
  * Filters the output of members
  *
  * @since    1.3
  * @access    public
  * @return
  */
 public function filterGuests()
 {
     // Check for request forgeriess
     FD::checkToken();
     // Ensure that the user is logged in.
     FD::requireLogin();
     // Get the event object
     $id = $this->input->get('id', 0, 'int');
     $event = FD::event($id);
     if (!$event || !$id) {
         return $this->ajax->reject();
     }
     // Check whether the viewer can really view the contents
     if (!$event->canViewItem()) {
         return $this->ajax->reject();
     }
     // Get the current filter
     $filter = $this->input->get('filter', '', 'word');
     $options = array();
     if ($filter == 'admin') {
         $options['admin'] = true;
     }
     if ($filter == 'going') {
         $options['state'] = SOCIAL_EVENT_GUEST_GOING;
     }
     if ($filter == 'maybe') {
         $options['state'] = SOCIAL_EVENT_GUEST_MAYBE;
     }
     if ($filter == 'notgoing') {
         $options['state'] = SOCIAL_EVENT_GUEST_NOT_GOING;
     }
     if ($filter == 'pending') {
         $options['state'] = SOCIAL_EVENT_GUEST_PENDING;
     }
     $model = FD::model('Events');
     $guests = $model->getGuests($event->id, $options);
     $pagination = $model->getPagination();
     $myGuest = $event->getGuest();
     // Load the contents
     $theme = FD::themes();
     $theme->set('pagination', $pagination);
     $theme->set('event', $event);
     $theme->set('guests', $guests);
     $theme->set('myGuest', $myGuest);
     $contents = $theme->output('apps/event/guests/events/default.list');
     return $this->ajax->resolve($contents, count($guests));
 }
Пример #23
0
 /**
  * Displays the application output in the canvas.
  *
  * @since    1.0
  * @access    public
  * @param    int        The user id that is currently being viewed.
  */
 public function display($uid = null, $docType = null)
 {
     FD::requireLogin();
     $event = FD::event($uid);
     if (!$event->canViewItem()) {
         return $this->redirect($event->getPermalink(false));
     }
     // Load up the app params
     $params = $this->app->getParams();
     // Get the discussion item
     $id = $this->input->get('discussionId', 0, 'int');
     $discussion = FD::table('Discussion');
     $discussion->load($id);
     // Get the author of the article
     $author = FD::user($discussion->created_by);
     // Get the url for the article
     $url = FRoute::apps(array('layout' => 'canvas', 'customView' => 'item', 'uid' => $event->getAlias(), 'type' => SOCIAL_TYPE_EVENT, 'id' => $this->app->getAlias(), 'discussionId' => $discussion->id), false);
     // Set the page title
     FD::page()->title($discussion->get('title'));
     // Increment the hits for this discussion item
     $discussion->addHit();
     // Get a list of other news
     $model = FD::model('Discussions');
     $replies = $model->getReplies($discussion->id, array('ordering' => 'created'));
     $participants = $model->getParticipants($discussion->id);
     // Get the answer
     $answer = false;
     if ($discussion->answer_id) {
         $answer = FD::table('Discussion');
         $answer->load($discussion->answer_id);
         $answer->author = FD::user($answer->created_by);
     }
     // Determines if we should allow file sharing
     $access = $event->getAccess();
     $files = $access->get('files.enabled', true);
     $this->set('app', $this->app);
     $this->set('files', $files);
     $this->set('params', $params);
     $this->set('answer', $answer);
     $this->set('participants', $participants);
     $this->set('discussion', $discussion);
     $this->set('event', $event);
     $this->set('replies', $replies);
     $this->set('author', $author);
     echo parent::display('canvas/item');
 }
Пример #24
0
 /**
  * Displays the apps on the site.
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function display($tpl = null)
 {
     // Check for user profile completeness
     FD::checkCompleteProfile();
     // Require user to be logged in
     FD::requireLogin();
     // Get current logged in user.
     $my = FD::user();
     // Get model.
     $model = FD::model('Apps');
     $sort = JRequest::getVar('sort', 'alphabetical');
     $order = JRequest::getWord('order', 'asc');
     $options = array('type' => SOCIAL_APPS_TYPE_APPS, 'installable' => true, 'sort' => $sort, 'order' => $order, 'group' => SOCIAL_APPS_GROUP_USER);
     $modelFunc = 'getApps';
     switch ($sort) {
         case 'recent':
             $options['sort'] = 'a.created';
             $options['order'] = 'desc';
             break;
         case 'alphabetical':
             $options['sort'] = 'a.title';
             $options['order'] = 'asc';
             break;
         case 'trending':
             // need a separate logic to get trending based on apps_map
             $modelFunc = 'getTrendingApps';
             break;
     }
     // Get the current filter
     $filter = JRequest::getWord('filter', 'browse');
     $title = JText::_('COM_EASYSOCIAL_PAGE_TITLE_BROWSE_APPS');
     if ($filter == 'mine') {
         $options['uid'] = $my->id;
         $options['key'] = SOCIAL_TYPE_USER;
         $title = JText::_('COM_EASYSOCIAL_PAGE_TITLE_YOUR_APPS');
     }
     // Set the page title
     FD::page()->title($title);
     // Try to fetch the apps now.
     $apps = $model->{$modelFunc}($options);
     $this->set('filter', $filter);
     $this->set('sort', $sort);
     $this->set('apps', $apps);
     parent::display('site/apps/default');
 }
Пример #25
0
 /**
  * Suggests a list of hash tags to the user
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function suggest()
 {
     // Check for valid tokens.
     FD::checkToken();
     // Only valid registered user has friends.
     FD::requireLogin();
     // Get current logged in user
     $my = FD::user();
     // Load the view.
     $view = $this->getCurrentView();
     // Properties
     $search = $this->input->get('search', '', 'default');
     // Get the stream model
     $model = FD::model('Hashtags');
     // Try to get the search result
     $result = $model->search($search);
     return $view->call(__FUNCTION__, $result);
 }
Пример #26
0
 public function remove()
 {
     // Check for valid token
     FD::checkToken();
     // Ensure that the user is logged in
     FD::requireLogin();
     $sId = JRequest::getVar('id');
     if (empty($sId)) {
         FD::getInstance('View', 'Subscriptions', false)->setErrors(JText::_('COM_EASYSOCIAL_ERROR_UNABLE_TO_LOCATE_ID'));
         return FD::getInstance('View', 'Subscriptions', false)->remove();
     }
     $state = FD::get('Subscriptions')->remove($sId);
     if (!$state) {
         FD::getInstance('View', 'Subscriptions', false)->setErrors(JText::_('COM_EASYSOCIAL_SUBSCRIPTION_FAILED_TO_UNSUBSCRIBE'));
         return FD::getInstance('View', 'Subscriptions', false)->remove();
     }
     return FD::getInstance('View', 'Subscriptions', false)->remove();
 }
Пример #27
0
 /**
  * Unblock a user
  *
  * @since	1.3
  * @access	public
  * @param	string
  * @return
  */
 public function unblock()
 {
     // Check for request forgeries
     FD::checkToken();
     // Ensure that the current user is logged in
     FD::requireLogin();
     // Get the current view
     $view = $this->getCurrentView();
     // Get the target id
     $target = $this->input->get('target', 0, 'int');
     if (!$target) {
         $view->setError(JText::_('COM_EASYSOCIAL_INVALID_USER_ID_PROVIDED'));
         return $view->call(__FUNCTION__, $target);
     }
     // Load up the block library
     $lib = FD::blocks();
     $lib->unblock($target);
     return $view->call(__FUNCTION__, $target);
 }
Пример #28
0
 public function getfriends($userid = '')
 {
     // Check for valid tokens.
     FD::checkToken();
     // Only valid registered user has friends.
     FD::requireLogin();
     $query = JRequest::getVar('q', '');
     $uId = JRequest::getVar('userid', '');
     $exclude = JRequest::getVar('exclude');
     $ajax = FD::ajax();
     if (!$query) {
         $ajax->reject(JText::_('Empty query'));
         return $ajax->send();
     }
     if (empty($userid)) {
         $userid = $uId;
     }
     $my = FD::user($userid);
     // Load friends model.
     $model = FD::model('Friends');
     // Determine what type of string we should search for.
     $config = FD::config();
     $type = $config->get('users.displayName');
     //check if we need to apply privacy or not.
     $options = array();
     if ($exclude) {
         $options['exclude'] = $exclude;
     }
     // Try to get the search result.
     $friends = $model->search($my->id, $query, $type, $options);
     $return = array();
     if ($friends) {
         foreach ($friends as $row) {
             $friend = new stdClass();
             $friend->id = $row->id;
             $friend->title = $row->getName();
             $return[] = $friend;
         }
     }
     return $ajax->resolve($return);
 }
Пример #29
0
 /**
  * Displays the application output in the canvas.
  *
  * @since    1.0
  * @access    public
  * @param    int        The user id that is currently being viewed.
  */
 public function display($uid = null, $docType = null)
 {
     FD::requireLogin();
     $event = FD::event($uid);
     // Check if the user is a member of the group
     if (!$event->getGuest()->isGuest() && !$this->my->isSiteAdmin()) {
         FD::info()->set(false, JText::_('COM_EASYSOCIAL_EVENTS_ONLY_GUEST_ARE_ALLOWED'), SOCIAL_MSG_ERROR);
         return $this->redirect($event->getPermalink(false));
     }
     // Set the page title
     FD::page()->title(JText::_('APP_EVENT_DISCUSSIONS_PAGE_TITLE_CREATE'));
     // Get the discussion item
     $discussion = FD::table('Discussion');
     // Determines if we should allow file sharing
     $access = $event->getAccess();
     $files = $access->get('files.enabled', true);
     $this->set('files', $files);
     $this->set('discussion', $discussion);
     $this->set('event', $event);
     echo parent::display('canvas/form');
 }
Пример #30
0
 /**
  * Displays the application output in the canvas.
  *
  * @since    1.0
  * @access    public
  * @param    int        The user id that is currently being viewed.
  */
 public function display($uid = null, $docType = null)
 {
     FD::requireLogin();
     $event = FD::event($uid);
     // Set the page title
     FD::page()->title(JText::_('APP_EVENT_DISCUSSIONS_PAGE_TITLE_EDIT'));
     // Get the discussion item
     $id = $this->input->get('discussionId', 0, 'int');
     $discussion = FD::table('Discussion');
     $discussion->load($id);
     if ($discussion->created_by != $this->my->id && !$event->getGuest()->isAdmin() && !$this->my->isSiteAdmin()) {
         return $this->redirect($event->getPermalink(false));
     }
     // Determines if we should allow file sharing
     $access = $event->getAccess();
     $files = $access->get('files.enabled', true);
     $this->set('files', $files);
     $this->set('discussion', $discussion);
     $this->set('event', $event);
     echo parent::display('canvas/form');
 }