/** * 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(); }
/** * 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'); }
/** * Displays the application in a main canvas layout which is the full width of the component. * Example: * index.php?option=com_easysocial&view=apps&layout=canvas&id=[id]&appView=[appView] * * @since 1.0 * @access public * @param null * @return null * */ public function canvas() { // Check for user profile completeness FD::checkCompleteProfile(); // Get the unique id of the item that is being viewed $uid = $this->input->get('uid', null, 'int'); $type = $this->input->get('type', SOCIAL_TYPE_USER, 'word'); // Determines if the type is accessible if (!$this->allowed($uid, $type)) { return; } // Get the current app id. $id = $this->input->get('id', 0, 'int'); // Get the current app. $app = FD::table('App'); $state = $app->load($id); // Default redirection url $redirect = FRoute::dashboard(array(), false); // Check if the user has access to this app if (!$app->accessible($uid, $type) && $type == SOCIAL_TYPE_USER) { $this->info->set(null, JText::_('COM_EASYSOCIAL_APPS_CANVAS_APP_IS_NOT_INSTALLED'), SOCIAL_MSG_ERROR); return $this->redirect($redirect); } // If id is not provided, we need to throw some errors here. if (!$id || !$state) { $this->setMessage(JText::_('COM_EASYSOCIAL_APPS_INVALID_ID_PROVIDED'), SOCIAL_MSG_ERROR); $info->set($this->getMessage()); return $this->redirect($redirect); } // Try to load the app's css. $app->loadCss(); // Check if the app provides any custom view $appView = $this->input->get('customView', 'canvas', 'default'); // We need to set the breadcrumb for the cluster type if ($type == 'group') { $group = FD::group($uid); $this->page->breadcrumb($group->getName()); } // Set the breadcrumbs with the app's title $this->page->breadcrumb($app->get('title')); // Load the library. $lib = FD::apps(); $contents = $lib->renderView(SOCIAL_APPS_VIEW_TYPE_CANVAS, $appView, $app, array('uid' => $uid)); $this->set('uid', $uid); $this->set('contents', $contents); $template = 'site/apps/default.canvas.' . strtolower($type); echo parent::display($template); }
/** * Default display method for leader board * * @since 1.0 * @access public * @param string * @return */ function display($tpl = null) { // Check for user profile completeness FD::checkCompleteProfile(); $config = FD::config(); $limit = $config->get('layout.leaderboard.limit'); $model = FD::model('Leaderboard'); // Should we exclude admin here $excludeAdmin = !$config->get('leaderboard.listings.admin'); $options = array('ordering' => 'points', 'limit' => $limit, 'excludeAdmin' => $excludeAdmin); $users = $model->getLadder($options, false); // Set the page title FD::page()->title(JText::_('COM_EASYSOCIAL_PAGE_TITLE_LEADERBOARD')); $this->set('users', $users); echo parent::display('site/leaderboard/default'); }
/** * Displays the application in a main canvas layout which is the full width of the component. * Example: * index.php?option=com_easysocial&view=apps&layout=canvas&id=[id]&appView=[appView] * * @since 1.0 * @access public * @param null * @return null * */ public function canvas() { // Check for user profile completeness FD::checkCompleteProfile(); // Get the current logged in user. $my = FD::user(); // Get the unique id of the item that is being viewed $uid = JRequest::getInt('uid', null); $type = JRequest::getWord('type', SOCIAL_TYPE_USER); // Determines if the type is accessible if (!$this->allowed($uid, $type)) { return; } // Get config object. $config = FD::config(); // Get the current app id. $id = JRequest::getInt('id'); // Get the current app. $app = FD::table('App'); $state = $app->load($id); // Check if the user has access to this app if (!$app->accessible($uid, $type) && $type == SOCIAL_TYPE_USER) { FD::info()->set(null, JText::_('COM_EASYSOCIAL_APPS_CANVAS_APP_IS_NOT_INSTALLED'), SOCIAL_MSG_ERROR); return $this->redirect(FRoute::dashboard(array(), false)); } // Load info $info = FD::info(); // If id is not provided, we need to throw some errors here. if (!$id || !$state) { $this->setMessage(JText::_('COM_EASYSOCIAL_APPS_INVALID_ID_PROVIDED'), SOCIAL_MSG_ERROR); $info->set($this->getMessage()); return $this->redirect(FRoute::dashboard(array(), false)); } // Try to load the app's css. $app->loadCss(); // Check if the app provides any custom view $appView = JRequest::getVar('customView', 'canvas'); // Load the library. $lib = FD::apps(); $contents = $lib->renderView(SOCIAL_APPS_VIEW_TYPE_CANVAS, $appView, $app, array('uid' => $uid)); $this->set('uid', $uid); $this->set('contents', $contents); $template = 'site/apps/default.canvas.' . strtolower($type); echo parent::display($template); }
/** * Displays a list of notifications a user has. * * @since 1.0 * @access public */ public function display($tpl = null) { // 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(); // Set the page title FD::page()->title(JText::_('COM_EASYSOCIAL_PAGE_TITLE_ALL_NOTIFICATIONS')); // Set breadcrumbs FD::page()->breadcrumb(JText::_('COM_EASYSOCIAL_PAGE_TITLE_ALL_NOTIFICATIONS')); $config = FD::config(); $paginationLimit = $config->get('notifications.general.pagination'); // Get notifications model. $options = array('target_id' => $user->id, 'target_type' => SOCIAL_TYPE_USER, 'group' => SOCIAL_NOTIFICATION_GROUP_ITEMS, 'limit' => $paginationLimit); $lib = FD::notification(); $items = $lib->getItems($options); $this->set('items', $items); $this->set('startlimit', $paginationLimit); parent::display('site/notifications/default'); }
/** * Default method to display a list of friends a user has. * * @since 1.0 * @access public * @param null * @return null */ public function display($tpl = null) { if (!$this->isEnabled()) { return $this->redirect(FRoute::dashboard(array(), false)); } // Check if there's an id. $id = JRequest::getInt('userid', null); // Get the user. $user = FD::user($id); $my = FD::user(); $privacy = FD::privacy($my->id); // Let's test if the current viewer is allowed to view this profile. if ($my->id != $user->id) { if (!$privacy->validate('followers.view', $user->id)) { return $this->restricted($user); } } if ($user->isViewer()) { // Only registered users allowed to view their own followers FD::requireLogin(); } // If user is not found, we need to redirect back to the dashboard page if (!$user->id) { return $this->redirect(FRoute::dashboard(array(), false)); } // Check for user profile completeness FD::checkCompleteProfile(); // Get current active filter. $active = JRequest::getWord('filter', 'followers'); // Get the list of followers for this current user. $model = FD::model('Followers'); $title = JText::_('COM_EASYSOCIAL_PAGE_TITLE_FOLLOWERS'); $limit = FD::themes()->getConfig()->get('followersLimit', 20); $options['limit'] = $limit; if ($active == 'followers') { $users = $model->getFollowers($user->id, $options); } if ($active == 'following') { $users = $model->getFollowing($user->id, $options); $title = JText::_('COM_EASYSOCIAL_PAGE_TITLE_FOLLOWING'); } if ($active == 'suggest') { $users = $model->getSuggestions($user->id, $options); $title = JText::_('COM_EASYSOCIAL_PAGE_TITLE_PEOPLE_TO_FOLLOW'); } // Get the pagination $pagination = $model->getPagination(); $filterFollowers = FRoute::followers(array(), false); $filterFollowing = FRoute::followers(array('filter' => 'following'), false); $filterSuggest = FRoute::followers(array('filter' => 'suggest'), false); if (!$user->isViewer()) { $title = $user->getName() . ' - ' . $title; $filterFollowers = FRoute::followers(array('userid' => $user->getAlias()), false); $filterSuggest = FRoute::followers(array('userid' => $user->getAlias(), 'filter' => 'suggest'), false); } FD::page()->title($title); // Set the breadcrumb FD::page()->breadcrumb($title); // Get total followers and following $totalFollowers = $model->getTotalFollowers($user->id); $totalFollowing = $model->getTotalFollowing($user->id); $totalSuggest = $model->getTotalSuggestions($user->id); // var_dump($totalSuggest); $this->set('pagination', $pagination); $this->set('user', $user); $this->set('active', $active); $this->set('filterFollowers', $filterFollowers); $this->Set('filterFollowing', $filterFollowing); $this->Set('filterSuggest', $filterSuggest); $this->set('totalFollowers', $totalFollowers); $this->set('totalFollowing', $totalFollowing); $this->set('totalSuggest', $totalSuggest); $this->set('currentUser', $user); $this->set('users', $users); $this->set('privacy', $privacy); // Load theme files. return parent::display('site/followers/default'); }
/** * Displays the advanced search form * * @since 1.0 * @access public */ public function advanced($tpl = null) { // Check for user profile completeness FD::checkCompleteProfile(); // Set the page title FD::page()->title(JText::_('COM_EASYSOCIAL_PAGE_TITLE_ADVANCED_SEARCH')); // Set the page breadcrumb FD::page()->breadcrumb(JText::_('COM_EASYSOCIAL_PAGE_TITLE_ADVANCED_SEARCH')); // Get current logged in user. $my = FD::user(); $config = FD::config(); // What is this? - this is advanced search filter id. $fid = JRequest::getInt('fid', 0); // Get filters $model = FD::model('Search'); $filters = $model->getFilters($my->id); // Load up advanced search library $library = FD::get('AdvancedSearch'); // default values // Get values from posted data $match = JRequest::getVar('matchType', 'all'); $avatarOnly = JRequest::getInt('avatarOnly', 0); $sort = JRequest::getVar('sort', $config->get('users.advancedsearch.sorting', 'default')); // Get values from posted data $values = array(); $values['criterias'] = JRequest::getVar('criterias'); $values['datakeys'] = JRequest::getVar('datakeys'); $values['operators'] = JRequest::getVar('operators'); $values['conditions'] = JRequest::getVar('conditions'); $values['match'] = $match; $values['avatarOnly'] = $avatarOnly; $values['sort'] = $sort; // echo '<pre>';print_r( $values );echo '</pre>';exit; // Default values $results = null; $total = 0; $nextlimit = null; $criteriaHTML = ''; if ($fid && empty($values['criterias'])) { // we need to load the data from db and do the search based on the saved filter. $filter = FD::table('SearchFilter'); $filter->load($fid); // data saved as json format. so we need to decode it. $dataFilter = FD::json()->decode($filter->filter); // override with the one from db. $values['criterias'] = isset($dataFilter->{'criterias[]'}) ? $dataFilter->{'criterias[]'} : ''; $values['datakeys'] = isset($dataFilter->{'datakeys[]'}) ? $dataFilter->{'datakeys[]'} : ''; $values['operators'] = isset($dataFilter->{'operators[]'}) ? $dataFilter->{'operators[]'} : ''; $values['conditions'] = isset($dataFilter->{'conditions[]'}) ? $dataFilter->{'conditions[]'} : ''; // we need check if the item passed in is array or not. if not, make it an array. if (!is_array($values['criterias'])) { $values['criterias'] = array($values['criterias']); } if (!is_array($values['datakeys'])) { $values['datakeys'] = array($values['datakeys']); } if (!is_array($values['operators'])) { $values['operators'] = array($values['operators']); } if (!is_array($values['conditions'])) { $values['conditions'] = array($values['conditions']); } $values['match'] = isset($dataFilter->matchType) ? $dataFilter->matchType : 'all'; $values['avatarOnly'] = isset($dataFilter->avatarOnly) ? true : false; $values['sort'] = isset($dataFilter->sort) ? $dataFilter->sort : $config->get('users.advancedsearch.sorting', 'default'); $match = $values['match']; $avatarOnly = $values['avatarOnly']; $sort = $values['sort']; } $displayOptions = array(); // If there are criterias, we know the user is making a post request to search if ($values['criterias']) { $results = $library->search($values); $displayOptions = $library->getDisplayOptions(); $total = $library->getTotal(); $nextlimit = $library->getNextLimit(); } // Get search criteria output $criteriaHTML = $library->getCriteriaHTML(array(), $values); if (!$criteriaHTML) { $criteriaHTML = $library->getCriteriaHTML(array()); } $this->set('criteriaHTML', $criteriaHTML); $this->set('match', $match); $this->set('avatarOnly', $avatarOnly); $this->set('sort', $sort); $this->set('results', $results); $this->set('total', $total); $this->set('nextlimit', $nextlimit); $this->set('filters', $filters); $this->set('fid', $fid); $this->set('displayOptions', $displayOptions); echo parent::display('site/advancedsearch/user/default'); }
/** * Displays a list of badges the user has achieved * * @since 1.0 * @access public * @param string * @return */ public function achievements() { // Check for user profile completeness FD::checkCompleteProfile(); $config = FD::config(); if (!$config->get('badges.enabled')) { return $this->redirect(FRoute::dashboard(array(), false)); } // Get the current user id that should be displayed $userId = JRequest::getInt('userid', null); $user = FD::user($userId); // If user is not found, we need to redirect back to the dashboard page if (!$user->id) { return $this->redirect(FRoute::dashboard(array(), false)); } $title = JText::_('COM_EASYSOCIAL_PAGE_TITLE_ACHIEVEMENTS'); if (!$user->isViewer()) { $title = JText::sprintf('COM_EASYSOCIAL_PAGE_TITLE_ACHIEVEMENTS_USER', $user->getName()); // Let's test if the current viewer is allowed to view this user's achievements. $my = FD::user(); $privacy = $my->getPrivacy(); $allowed = $privacy->validate('achievements.view', $user->id, SOCIAL_TYPE_USER); if (!$allowed) { $this->set('user', $user); parent::display('site/badges/restricted'); return; } } // Set the page title FD::page()->title($title); // Set the page breadcrumb FD::page()->breadcrumb(JText::_('COM_EASYSOCIAL_PAGE_TITLE_ACHIEVEMENTS'), FRoute::badges(array('userid' => $userId, 'layout' => 'achievements'))); // Load admin translations FD::language()->loadAdmin(); // @TODO: Check for privacy $model = FD::model('badges'); $badges = $model->getBadges($user->id); $totalBadges = count($badges); $this->set('totalBadges', $totalBadges); $this->set('badges', $badges); $this->set('user', $user); parent::display('site/badges/achievements'); }
/** * Displays the category item page. * * @author Jason Rey <*****@*****.**> * @since 1.3 * @access public */ public function category() { // Check if events is enabled. $this->checkFeature(); FD::checkCompleteProfile(); // Get the current category $id = $this->input->get('id', 0, 'int'); // Pagination for the stream $startlimit = $this->input->get('limitstart', 0, 'int'); $category = FD::table('EventCategory'); $state = $category->load($id); if (!$state) { FD::info()->set(false, JText::_('COM_EASYSOCIAL_EVENTS_INVALID_CATEGORY_ID'), SOCIAL_MSG_ERROR); return $this->redirect(FRoute::events()); } FD::language()->loadAdmin(); FD::page()->title($category->get('title')); // Add breadcrumbs FD::page()->breadcrumb(JText::_('COM_EASYSOCIAL_PAGE_TITLE_EVENTS'), FRoute::events()); FD::page()->breadcrumb($category->get('title')); $model = FD::model('Events'); $categoryModel = FD::model('EventCategories'); $events = $model->getEvents(array('state' => SOCIAL_STATE_PUBLISHED, 'sort' => 'random', 'category' => $category->id, 'featured' => false, 'limit' => 5, 'limitstart' => 0, 'type' => array(SOCIAL_EVENT_TYPE_PUBLIC, SOCIAL_EVENT_TYPE_PRIVATE))); $featuredEvents = $model->getEvents(array('state' => SOCIAL_STATE_PUBLISHED, 'sort' => 'random', 'category' => $category->id, 'featured' => true, 'limit' => 5, 'limitstart' => 0, 'type' => array(SOCIAL_EVENT_TYPE_PUBLIC, SOCIAL_EVENT_TYPE_PRIVATE))); $randomGuests = $categoryModel->getRandomCategoryGuests($category->id); $randomAlbums = $categoryModel->getRandomCategoryAlbums($category->id); $stats = $categoryModel->getCreationStats($category->id); $totalEvents = $model->getTotalEvents(array('state' => SOCIAL_STATE_PUBLISHED, 'category' => $category->id, 'type' => array(SOCIAL_EVENT_TYPE_PUBLIC, SOCIAL_EVENT_TYPE_PRIVATE))); $totalAlbums = $categoryModel->getTotalAlbums($category->id); $stream = FD::stream(); $stream->get(array('clusterCategory' => $category->id, 'clusterType' => SOCIAL_TYPE_EVENT, 'startlimit' => $startlimit)); $this->set('events', $events); $this->set('featuredEvents', $featuredEvents); $this->set('randomGuests', $randomGuests); $this->set('randomAlbums', $randomAlbums); $this->set('totalEvents', $totalEvents); $this->set('totalAlbums', $totalAlbums); $this->set('stats', $stats); $this->set('stream', $stream); $this->set('category', $category); return parent::display('site/events/category'); }
/** * Edit privacy form * * @since 1.0 * @access public * @param string * @return */ public function editPrivacy() { // User needs to be logged in FD::requireLogin(); // Check for user profile completeness FD::checkCompleteProfile(); // Get the current logged in user. $my = FD::user(); // Get user's privacy $privacyLib = FD::privacy($my->id); $result = $privacyLib->getData(); // Set page title FD::page()->title(JText::_('COM_EASYSOCIAL_PAGE_TITLE_PRIVACY_SETTINGS')); // Set the page breadcrumb FD::page()->breadcrumb(JText::_('COM_EASYSOCIAL_PAGE_TITLE_PROFILE'), FRoute::profile()); FD::page()->breadcrumb(JText::_('COM_EASYSOCIAL_PAGE_TITLE_PRIVACY_SETTINGS')); $privacy = array(); // Update the privacy data with proper properties. foreach ($result as $group => $items) { // We do not want to show field privacy rules here because it does not make sense for user to set a default value // Most of the fields only have 1 and it is set in Edit Profile page if ($group === 'field') { continue; } foreach ($items as &$item) { $rule = strtoupper(JString::str_ireplace('.', '_', $item->rule)); $groupKey = strtoupper($group); $item->groupKey = $groupKey; $item->label = JText::_('COM_EASYSOCIAL_PRIVACY_LABEL_' . $groupKey . '_' . $rule); $item->tips = JText::_('COM_EASYSOCIAL_PRIVACY_TIPS_' . $groupKey . '_' . $rule); } $privacy[$group] = $items; } // Get a list of blocked users for this user $model = FD::model('Blocks'); $blocked = $model->getBlockedUsers($this->my->id); $this->set('blocked', $blocked); $this->set('privacy', $privacy); parent::display('site/profile/default.edit.privacy'); }
/** * Displays the list form. * * @since 1.0 * @access public */ public function listForm() { // Ensure that user is logged in. FD::requireLogin(); // Check for user profile completeness FD::checkCompleteProfile(); FD::info()->set($this->getMessage()); // Check if friends list is enabled $config = FD::config(); if (!$config->get('friends.list.enabled')) { FD::info()->set(false, JText::_('COM_EASYSOCIAL_FRIENDS_LIST_DISABLED'), SOCIAL_MSG_ERROR); $this->redirect(FRoute::friends(array(), false)); $this->close(); } // Get current logged in user. $my = FD::user(); // Get the list id. $id = JRequest::getInt('id', 0); $list = FD::table('List'); $list->load($id); // Check if this list is being edited. if ($id && !$list->id) { FD::info()->set(false, JText::_('COM_EASYSOCIAL_FRIENDS_INVALID_LIST_ID_PROVIDED'), SOCIAL_MSG_ERROR); $this->redirect(FRoute::friends(array(), false)); $this->close(); } // Set the page title if ($list->id) { FD::page()->title(JText::_('COM_EASYSOCIAL_PAGE_TITLE_FRIENDS_EDIT_LIST_FORM')); } else { FD::page()->title(JText::_('COM_EASYSOCIAL_PAGE_TITLE_FRIENDS_LIST_FORM')); } // Get list of users from this list. $result = $list->getMembers(); $members = array(); if ($result) { $members = FD::user($result); } $this->set('members', $members); $this->set('list', $list); $this->set('id', $id); // Load theme files. echo parent::display('site/friends/form.list'); }
public function form() { // Check for user profile completeness FD::checkCompleteProfile(); // Unauthorized users should not be allowed to access this page. FD::requireLogin(); $my = FD::user(); $id = JRequest::getInt('id', 0); $filter = FD::table('StreamFilter'); $filter->load($id); $model = FD::model('Stream'); $items = $model->getFilters($my->id); $this->set('filter', $filter); $this->set('items', $items); // Set page title if ($filter->id) { FD::page()->title(JText::sprintf('COM_EASYSOCIAL_STREAM_FILTER_EDIT_FILTER', $filter->title)); } else { FD::page()->title(JText::_('COM_EASYSOCIAL_STREAM_FILTER_CREATE_NEW_FILTER')); } // Set the page breadcrumb FD::page()->breadcrumb(JText::_('COM_EASYSOCIAL_PAGE_TITLE_DASHBOARD'), FRoute::dashboard()); FD::page()->breadcrumb(JText::_('Filter')); echo parent::display('site/stream/filter.form'); }
/** * Displays information from groups within a particular category * * @since 1.2 * @access public * @param string * @return */ public function category() { // Check if this feature is enabled. $this->checkFeature(); // Check for user profile completeness FD::checkCompleteProfile(); // Get the category id from the query $id = JRequest::getInt('id'); $category = FD::table('GroupCategory'); $category->load($id); // Check if the category is valid if (!$id || !$category->id) { return JError::raise(E_ERROR, 404, JText::_('COM_EASYSOCIAL_GROUPS_INVALID_GROUP_ID')); } // Load backend language file FD::language()->loadAdmin(); // Set the page title to this category FD::page()->title($category->get('title')); // Set the breadcrumbs FD::page()->breadcrumb(JText::_('COM_EASYSOCIAL_PAGE_TITLE_GROUPS'), FRoute::groups()); FD::page()->breadcrumb($category->get('title')); // Get recent 10 groups from this category $options = array('sort' => 'random', 'category' => $category->id); $model = FD::model('Groups'); $groups = $model->getGroups($options); // Get random members from this category $randomMembers = $model->getRandomCategoryMembers($category->id, SOCIAL_CLUSTER_CATEGORY_MEMBERS_LIMIT); // Get group creation stats for this category $stats = $model->getCreationStats($category->id); // Get total groups within a category $totalGroups = $model->getTotalGroups(array('category_id' => $category->id)); // Get total albums within a category $totalAlbums = $model->getTotalAlbums(array('category_id' => $category->id)); // Get the stream for this group $stream = FD::stream(); $stream->get(array('clusterCategory' => $category->id, 'clusterType' => SOCIAL_TYPE_GROUP)); // Get random albums for groups in this category $randomAlbums = $model->getRandomAlbums(array('category_id' => $category->id, 'core' => false)); $this->set('randomAlbums', $randomAlbums); $this->set('stream', $stream); $this->set('totalGroups', $totalGroups); $this->set('stats', $stats); $this->set('randomMembers', $randomMembers); $this->set('groups', $groups); $this->set('category', $category); $this->set('totalAlbums', $totalAlbums); parent::display('site/groups/category.item'); }
/** * When a conversation is marked as read. * * @since 1.0 * @access public * @param null */ public function read() { // Prevent unauthorized access. FD::requireLogin(); // Check for user profile completeness FD::checkCompleteProfile(); // Get the conversation id $id = $this->input->get('id', 0, 'int'); $conversation = FD::table('Conversation'); $loaded = $conversation->load($id); // Check if the conversation id provided is valid. if (!$id || !$loaded) { $this->info->set(JText::_('COM_EASYSOCIAL_CONVERSATIONS_ERROR_INVALID_ID'), SOCIAL_MSG_ERROR); $url = FRoute::conversations(array(), false); return $this->redirect($url); } // Check if the user has access to read this discussion. if (!$conversation->isReadable($this->my->id)) { $this->info->set(JText::_('COM_EASYSOCIAL_CONVERSATIONS_NOT_ALLOWED_TO_READ'), SOCIAL_MSG_ERROR); $url = FRoute::conversations(array(), false); return $this->redirect($url); } // Retrieve conversations model. $model = FD::model('Conversations'); // Always reset the limistart to 0 so that when the page refresh, system will not get the 'previous' saved limitstart. $model->setState('limitstart', 0); // Get list of files in this conversation $filesModel = FD::model('Files'); // Get a list of all the message ids from this conversation. $files = $filesModel->getFiles($model->getMessageIds($conversation->id), SOCIAL_TYPE_CONVERSATIONS); // Get a list of participants for this particular conversation except myself. $participants = $model->getParticipants($conversation->id); // this flag is to indicate if there is only one participant and the participant is a ESAD. $isESADuser = false; if (count($participants) == 2) { foreach ($participants as $pUser) { if ($pUser->id != $this->my->id && !$pUser->hasCommunityAccess()) { $isESADuser = true; } } } // Fetch a list of messages for this particular conversation $messages = $model->setLimit($this->themeConfig->get('messages_limit'))->getMessages($conversation->id, $this->my->id); // Beautify the names $participantNames = FD::string()->namesToStream($participants, false, 3, false); $title = JText::sprintf('COM_EASYSOCIAL_PAGE_TITLE_CONVERSATIONS_READ', $participantNames); // Set title FD::page()->title($title); // Set breadcrumbs FD::page()->breadcrumb(JText::_('COM_EASYSOCIAL_PAGE_TITLE_CONVERSATIONS_INBOX'), FRoute::conversations()); FD::page()->breadcrumb($title); // @trigger: onPrepareConversations $dispatcher = FD::dispatcher(); $args = array(&$messages); $dispatcher->trigger(SOCIAL_TYPE_USER, 'onPrepareConversations', $args); // Get pagination $pagination = $model->getPagination(); // Determine if load previous messages should appear. $loadPrevious = $pagination->total > $pagination->limit; // Mark conversation as read because the viewer is already reading the conversation. $conversation->markAsRead($this->my->id); // Get total number of messages sent today $totalSentDaily = $model->getTotalSentDaily($this->my->id); // @points: conversation.read // Assign points when user reads a conversation $points = FD::points(); $points->assign('conversation.read', 'com_easysocial', $this->my->id); $this->set('files', $files); $this->set('totalSentDaily', $totalSentDaily); $this->set('loadPrevious', $loadPrevious); $this->set('conversation', $conversation); $this->set('participants', $participants); $this->set('messages', $messages); $this->set('pagination', $pagination); $this->set('isESADuser', $isESADuser); echo parent::display('site/conversations/read'); }
/** * Default method to display the registration page. * * @since 1.0 * @access public * @author Mark Lee <*****@*****.**> */ function item($tpl = null) { $this->checkFeature(); // Check for user profile completeness FD::checkCompleteProfile(); $id = JRequest::getInt('id'); $point = FD::table('Points'); $point->load($id); if (!$id || !$point->id) { FD::info()->set(null, JText::_('The points id provided is not a valid id.'), SOCIAL_MSG_ERROR); return $this->redirect(FRoute::dashboard(array(), false)); } $point->loadLanguage(); // Load language file. JFactory::getLanguage()->load('com_easysocial', JPATH_ROOT . '/administrator'); // Set the page title FD::page()->title($point->get('title')); // Set the page breadcrumb FD::page()->breadcrumb(JText::_('COM_EASYSOCIAL_PAGE_TITLE_POINTS'), FRoute::points()); FD::page()->breadcrumb($point->get('title')); // Get list of point achievers. $achievers = $point->getAchievers(); $this->set('achievers', $achievers); $this->set('point', $point); parent::display('site/points/default.item'); }
/** * Responsible to output the activity log for a user * * @access public * @return null */ public function display($tpl = null) { // Unauthorized users should not be allowed to access this page. FD::requireLogin(); // Check for user profile completeness FD::checkCompleteProfile(); // Get the necessary attributes from the request $filterType = $this->input->get('type', 'all', 'default'); $active = $filterType; $context = SOCIAL_STREAM_CONTEXT_TYPE_ALL; // Default title $title = JText::sprintf('COM_EASYSOCIAL_ACTIVITY_ITEM_TITLE', ucfirst($filterType)); if ($filterType == 'all') { $title = JText::_('COM_EASYSOCIAL_ACTIVITY_YOUR_LOGS'); } if ($filterType == 'hidden') { $title = JText::_('COM_EASYSOCIAL_ACTIVITY_YOUR_HIDDEN_ACTIVITIES'); } if ($filterType == 'hiddenapp') { $title = JText::_('COM_EASYSOCIAL_ACTIVITY_YOUR_HIDDEN_APPS'); } if ($filterType == 'hiddenactor') { $title = JText::_('COM_EASYSOCIAL_ACTIVITY_YOUR_HIDDEN_ACTORS'); } // Set the page title $this->page->title($title); // Set the page breadcrumb $this->page->breadcrumb($title); if ($filterType != 'all' && $filterType != 'hidden' && $filterType != 'hiddenapp' && $filterType != 'hiddenactor') { $context = $filterType; $filterType = 'all'; } // Load up activities model $model = FD::model('Activities'); if ($filterType == 'hiddenapp') { $activities = $model->getHiddenApps($this->my->id); $nextLimit = $model->getNextLimit('0'); } else { if ($filterType == 'hiddenactor') { $activities = $model->getHiddenActors($this->my->id); $nextLimit = $model->getNextLimit('0'); } else { // Retrieve user activities. $stream = FD::stream(); $options = array('uId' => $this->my->id, 'context' => $context, 'filter' => $filterType); $activities = $stream->getActivityLogs($options); $nextLimit = $stream->getActivityNextLimit(); } } // Get a list of apps $result = $model->getApps(); $apps = array(); foreach ($result as $app) { if (!$app->hasActivityLog()) { continue; } $app->favicon = ''; $app->image = $app->getIcon(); $favicon = $app->getFavIcon(); if ($favicon) { $app->favicon = $favicon; } // Load the app's css $app->loadCss(); $apps[] = $app; } $this->set('active', $active); $this->set('title', $title); $this->set('apps', $apps); $this->set('activities', $activities); $this->set('nextlimit', $nextLimit); $this->set('filtertype', $filterType); echo parent::display('site/activities/default'); }
/** * Displays the photo form * * @since 1.0 * @access public */ public function form() { // Only logged in users are allowed to modify photos. FD::requireLogin(); // Check for user profile completeness FD::checkCompleteProfile(); // Check if photos is enabled $this->checkFeature(); // Get current user $my = FD::user(); // Get photo $id = JRequest::getInt('id', null); // Load the photo table $table = FD::table('Photo'); $table->load($id); // If id is not given or photo does not exist if (!$id || !$table->id) { return $this->deleted($lib); } // Load up the library photo library $lib = FD::photo($table->uid, $table->type, $table); // Check if the person is allowed to edit the photo if (!$lib->editable()) { return $this->restricted($lib); } // Set the page title. $title = $lib->getPageTitle($this->getLayout()); FD::page()->title($title); // Set the breadcrumbs $lib->setBreadcrumbs($this->getLayout()); // Render options $options = array('size' => 'large', 'showForm' => true, 'layout' => 'form'); // Render item $output = $lib->renderItem($options); return $this->output($lib, $output); }
/** * Responsible to output the dashboard layout for the current logged in user. * * @since 1.0 * @access public * @param string The name of the template file to parse; automatically searches through the template paths. * @return null * @author Mark Lee <*****@*****.**> */ public function display($tpl = null) { // If the user is not logged in, display the dashboard's unity layout. if ($this->my->guest) { return $this->displayGuest(); } // Check for user profile completeness FD::checkCompleteProfile(); // Default page title $title = $this->my->getName() . ' - ' . JText::_('COM_EASYSOCIAL_PAGE_TITLE_DASHBOARD'); // Set the page breadcrumb FD::page()->breadcrumb(JText::_('COM_EASYSOCIAL_PAGE_TITLE_DASHBOARD')); // Get list of apps $model = FD::model('Apps'); $options = array('view' => 'dashboard', 'uid' => $this->my->id, 'key' => SOCIAL_TYPE_USER); $apps = $model->getApps($options); // Load css for apps $model->loadAppCss($options); // Check if there is an app id in the current request as we need to show the app's content. $appId = $this->input->get('appId', 0, 'default'); $contents = ''; $isAppView = false; // If the user is viewing output from a particular app if ($appId) { $appId = (int) $appId; if (!$appId) { return JError::raiseError(404, JText::_('COM_EASYSOCIAL_PAGE_IS_NOT_AVAILABLE')); } // Load the application. $app = FD::table('App'); $app->load($appId); if (!$app->id) { return JError::raiseError(404, JText::_('COM_EASYSOCIAL_APP_NOT_FOUND')); } // Check if the user has access to this app if (!$app->accessible($this->my->id)) { FD::info()->set(null, JText::_('COM_EASYSOCIAL_DASHBOARD_APP_IS_NOT_INSTALLED'), SOCIAL_MSG_ERROR); return $this->redirect(FRoute::dashboard(array(), false)); } $app->loadCss(); // Generate the page title $title = $this->my->getName() . ' - ' . $app->get('title'); // Load the library. $lib = FD::apps(); $contents = $lib->renderView(SOCIAL_APPS_VIEW_TYPE_EMBED, 'dashboard', $app, array('userId' => $this->my->id)); $isAppView = true; } // Get the limit start $startlimit = $this->input->get('limitstart', 0, 'int'); // Determine the start page for the user. $start = $this->config->get('users.dashboard.start'); // Check if there is any stream filtering or not. $filter = $this->input->get('type', $start, 'word'); if (!$filter) { $filter = $start; } // The filter 'all' is taken from the menu item the setting. all == user & friend, which mean in this case, is the 'me' filter. if ($filter == 'all') { $filter = 'me'; } $listId = $this->input->get('listId', 0, 'int'); $fid = ''; // Used in conjunction with type=appFilter $filterId = ''; // Determine if the current request is for "tags" $hashtag = $this->input->get('tag', '', 'default'); $hashtagAlias = $hashtag; if (!empty($hashtag)) { $filter = 'hashtag'; } // Retrieve user's groups $groupModel = FD::model('Groups'); $groups = $groupModel->getUserGroups($this->my->id); // Retrieve user's events $eventModel = FD::model('Events'); $events = $eventModel->getEvents(array('creator_uid' => $this->my->id, 'creator_type' => SOCIAL_TYPE_USER, 'ongoing' => true, 'upcoming' => true, 'ordering' => 'start', 'limit' => 5)); // Retrieve user's status $story = FD::get('Story', SOCIAL_TYPE_USER); $story->setTarget($this->my->id); // Retrieve user's stream $stream = FD::stream(); $stream->story = $story; // Determines if we should be rendering the group streams $groupId = false; $eventId = false; $tags = array(); // Filter by specific list item if ($filter == 'list' && !empty($listId)) { $list = FD::table('List'); $list->load($listId); $title = $this->my->getName() . ' - ' . $list->get('title'); // Get list of users from this list. $friends = $list->getMembers(); if ($friends) { $stream->get(array('listId' => $listId, 'startlimit' => $startlimit)); } else { $stream->filter = 'list'; } } // Filter by specific #hashtag if ($filter == 'hashtag') { $tag = $this->input->get('tag', '', 'default'); $hashtag = $tag; $title = $this->my->getName() . ' - #' . $tag; $stream->get(array('tag' => $tag, 'startlimit' => $startlimit)); $tags = array($tag); } // Filter by everyone if ($filter == 'everyone') { $stream->get(array('guest' => true, 'ignoreUser' => true, 'startlimit' => $startlimit)); } // Filter by following if ($filter == 'following') { // Set the page title $title = $this->my->getName() . ' - ' . JText::_('COM_EASYSOCIAL_DASHBOARD_FEED_FOLLLOW'); $stream->get(array('context' => SOCIAL_STREAM_CONTEXT_TYPE_ALL, 'type' => 'follow', 'startlimit' => $startlimit)); } // Filter by bookmarks if ($filter == 'bookmarks') { // Set the page title $title = $this->my->getName() . ' - ' . JText::_('COM_EASYSOCIAL_DASHBOARD_FEED_DASHBOARD_BOOKMARKS'); $stream->get(array('guest' => true, 'type' => 'bookmarks', 'startlimit' => $startlimit)); } // Filter by sticky if ($filter == 'sticky') { // Set the page title $title = $this->my->getName() . ' - ' . JText::_('COM_EASYSOCIAL_DASHBOARD_FEED_DASHBOARD_STICKY'); $stream->get(array('userId' => $this->my->id, 'type' => 'sticky', 'startlimit' => $startlimit)); } // Filter by apps if ($filter == 'appFilter') { $appType = $this->input->get('filterid', '', 'string'); $filterId = $appType; $stream->get(array('context' => $appType, 'startlimit' => $startlimit)); $stream->filter = 'custom'; } // Filter by custom filters if ($filter == 'filter') { $fid = $this->input->get('filterid', 0, 'int'); $sfilter = FD::table('StreamFilter'); $sfilter->load($fid); // Set the page title $title = $this->my->getName() . ' - ' . $sfilter->title; if ($sfilter->id) { $hashtags = $sfilter->getHashTag(); $tags = explode(',', $hashtags); if ($tags) { $stream->get(array('context' => SOCIAL_STREAM_CONTEXT_TYPE_ALL, 'tag' => $tags, 'startlimit' => $startlimit)); } } $stream->filter = 'custom'; } // Stream filter form if ($filter == 'filterForm') { // Set the page title $title = $this->my->getName() . ' - ' . JText::_('COM_EASYSOCIAL_PAGE_TITLE_FILTER_FORM'); $id = $this->input->get('id', 0, 'int'); // Load up the theme lib so we can output the contents $theme = FD::themes(); $filter = FD::table('StreamFilter'); $filter->load($id); $theme->set('filter', $filter); $contents = $theme->output('site/stream/form.edit'); } // Filter by groups if ($filter == 'group') { $id = $this->input->get('groupId', 0, 'int'); $group = FD::group($id); $groupId = $group->id; // Check if the user is a member of the group if (!$group->isMember()) { $this->setMessage(JText::_('COM_EASYSOCIAL_STREAM_GROUPS_NO_PERMISSIONS'), SOCIAL_MSG_ERROR); FD::info()->set($this->getMessage()); return $this->redirect(FRoute::dashboard(array(), false)); } // When posting stories into the stream, it should be made to the group $story = FD::get('Story', SOCIAL_TYPE_GROUP); $story->setCluster($group->id, SOCIAL_TYPE_GROUP); $story->showPrivacy(false); $stream->story = $story; //lets get the sticky posts 1st $stickies = $stream->getStickies(array('clusterId' => $group->id, 'clusterType' => SOCIAL_TYPE_GROUP, 'limit' => 0)); if ($stickies) { $stream->stickies = $stickies; } $stream->get(array('clusterId' => $group->id, 'clusterType' => SOCIAL_TYPE_GROUP, 'nosticky' => true, 'startlimit' => $startlimit)); } if ($filter == 'event') { $id = $this->input->get('eventId', 0, 'int'); $event = FD::event($id); $eventId = $event->id; // Check if the user is a member of the group if (!$event->getGuest()->isGuest()) { $this->setMessage(JText::_('COM_EASYSOCIAL_STREAM_GROUPS_NO_PERMISSIONS'), SOCIAL_MSG_ERROR); $this->info->set($this->getMessage()); return $this->redirect(FRoute::dashboard(array(), false)); } // When posting stories into the stream, it should be made to the group $story = FD::get('Story', SOCIAL_TYPE_EVENT); $story->setCluster($event->id, SOCIAL_TYPE_EVENT); $story->showPrivacy(false); $stream->story = $story; //lets get the sticky posts 1st $stickies = $stream->getStickies(array('clusterId' => $event->id, 'clusterType' => SOCIAL_TYPE_EVENT, 'limit' => 0)); if ($stickies) { $stream->stickies = $stickies; } $stream->get(array('clusterId' => $event->id, 'clusterType' => SOCIAL_TYPE_EVENT, 'nosticky' => true, 'startlimit' => $startlimit)); } if ($filter == 'me') { $stream->get(array('startlimit' => $startlimit)); } // Set the page title. FD::page()->title($title); // Set hashtags $story->setHashtags($tags); // Retrieve lists model $listsModel = FD::model('Lists'); // Only fetch x amount of list to be shown by default. $limit = $this->config->get('lists.display.limit'); // Get the friend's list. $lists = $listsModel->setLimit($limit)->getLists(array('user_id' => $this->my->id, 'showEmpty' => $this->config->get('friends.list.showEmpty'))); // Get stream filter list $model = FD::model('Stream'); $filterList = $model->getFilters($this->my->id); // Add RSS feed for dashboard $feedOptions = array('filter' => $filter); if ($hashtag) { $feedOptions['tag'] = $hashtag; } else { if ($filter == 'filter') { $feedOptions['filterid'] = $fid . ':' . $sfilter->alias; } else { if ($filter == 'list') { $feedOptions['listId'] = $listId; } else { $id = $this->input->get('id', 0, 'int'); if ($id) { $feedOptions['id'] = $id; } } } } if ($this->config->get('stream.rss.enabled')) { $this->addRss(FRoute::dashboard($feedOptions, false)); } // Get a list of application filters $appFilters = $model->getAppFilters(SOCIAL_TYPE_USER); $this->set('rssLink', $this->rssLink); $this->set('title', $title); $this->set('eventId', $eventId); $this->set('events', $events); $this->set('filterId', $filterId); $this->set('appFilters', $appFilters); $this->set('groupId', $groupId); $this->set('groups', $groups); $this->set('hashtag', $hashtag); $this->set('hashtagAlias', $hashtagAlias); $this->set('listId', $listId); $this->set('filter', $filter); $this->set('isAppView', $isAppView); $this->set('apps', $apps); $this->set('lists', $lists); $this->set('appId', $appId); $this->set('contents', $contents); $this->set('user', $this->my); $this->set('stream', $stream); $this->set('filterList', $filterList); $this->set('fid', $fid); echo parent::display('site/dashboard/default'); }
/** * Displays a list of users on the site from dating search module * * @access public * @param string The name of the template file to parse; automatically searches through the template paths. * @return null */ public function search($tpl = null) { // Check for user profile completeness FD::checkCompleteProfile(); // Retrieve the users model $model = FD::model('Users'); $my = FD::user(); $config = FD::config(); $admin = $config->get('users.listings.admin') ? true : false; $options = array('includeAdmin' => $admin); $limit = FD::themes()->getConfig()->get('userslimit'); $options['limit'] = $limit; // Default title $title = JText::_('COM_EASYSOCIAL_PAGE_TITLE_USERS'); $post = JRequest::get('POSTS'); // echo '<pre>';print_r( $post );echo '</pre>'; // Get values from posted data $values = array(); $values['criterias'] = JRequest::getVar('criterias'); $values['datakeys'] = JRequest::getVar('datakeys'); $values['operators'] = JRequest::getVar('operators'); $values['conditions'] = JRequest::getVar('conditions'); // echo '<pre>';print_r( $values );echo '</pre>'; $searchOptions = array(); // lets do some clean up here. for ($i = 0; $i < count($values['criterias']); $i++) { $criteria = $values['criterias'][$i]; $condition = $values['conditions'][$i]; $datakey = $values['datakeys'][$i]; $operator = $values['operators'][$i]; if (trim($condition)) { $searchOptions['criterias'][] = $criteria; $searchOptions['datakeys'][] = $datakey; $searchOptions['operators'][] = $operator; $field = explode('|', $criteria); $fieldCode = $field[0]; $fieldType = $field[1]; if ($fieldType == 'birthday') { // currently the value from form is in age format. we need to convert it into date time. $ages = explode('|', $condition); if (!isset($ages[1])) { // this happen when start has value and end has no value $ages[1] = $ages[0]; } if ($ages[1] && !$ages[0]) { //this happen when start is empty and end has value $ages[0] = $ages[1]; } $startdate = ''; $enddate = ''; $currentTimeStamp = FD::date()->toUnix(); if ($ages[0] == $ages[1]) { $start = strtotime('-' . $ages[0] . ' years', $currentTimeStamp); $year = FD::date($start)->toFormat('Y'); $startdate = $year . '-01-01 00:00:01'; $enddate = FD::date($start)->toFormat('Y-m-d') . ' 23:59:59'; } else { if ($ages[0]) { $start = strtotime('-' . $ages[0] . ' years', $currentTimeStamp); $year = FD::date($start)->toFormat('Y'); $enddate = $year . '-12-31 23:59:59'; } if ($ages[1]) { $end = strtotime('-' . $ages[1] . ' years', $currentTimeStamp); $year = FD::date($end)->toFormat('Y'); $startdate = $year . '-01-01 00:00:01'; } } $condition = $startdate . '|' . $enddate; } $searchOptions['conditions'][] = $condition; } } $pagination = null; $result = null; $users = array(); if ($searchOptions) { $searchOptions['match'] = 'all'; $searchOptions['avatarOnly'] = false; // Retrieve the users $result = $model->getUsersByFilter('0', $options, $searchOptions); // $result = array(); $pagination = $model->getPagination(); $pagination->setVar('Itemid', FRoute::getItemId('users')); $pagination->setVar('view', 'users'); $pagination->setVar('layout', 'search'); $pagination->setVar('filter', 'search'); for ($i = 0; $i < count($values['criterias']); $i++) { $criteria = $values['criterias'][$i]; $condition = $values['conditions'][$i]; $datakey = $values['datakeys'][$i]; $operator = $values['operators'][$i]; $field = explode('|', $criteria); $fieldCode = $field[0]; $fieldType = $field[1]; $pagination->setVar('criterias[' . $i . ']', $criteria); $pagination->setVar('datakeys[' . $i . ']', $datakey); $pagination->setVar('operators[' . $i . ']', $operator); $pagination->setVar('conditions[' . $i . ']', $condition); } if ($result) { foreach ($result as $obj) { $users[] = FD::user($obj->id); } } } // Set the page title FD::page()->title($title); // Set the page breadcrumb FD::page()->breadcrumb($title); $filter = 'search'; $sort = ''; $this->set('issearch', true); $this->set('profiles', ''); $this->set('activeProfile', ''); $this->set('profile', ''); $this->set('activeTitle', $title); $this->set('pagination', $pagination); $this->set('filter', $filter); $this->set('sort', $sort); $this->set('users', $users); $this->set('fid', ''); $this->set('searchFilters', ''); $this->set('searchFilter', ''); echo parent::display('site/users/default'); }
/** * Edit privacy form * * @since 1.0 * @access public * @param string * @return */ public function editPrivacy() { // User needs to be logged in FD::requireLogin(); // Check for user profile completeness FD::checkCompleteProfile(); // Get user's privacy $privacyLib = FD::privacy($this->my->id); $result = $privacyLib->getData(); // Set page title $this->page->title('COM_EASYSOCIAL_PAGE_TITLE_PRIVACY_SETTINGS'); // Set the page breadcrumb $this->page->breadcrumb('COM_EASYSOCIAL_PAGE_TITLE_PROFILE', FRoute::profile()); $this->page->breadcrumb('COM_EASYSOCIAL_PAGE_TITLE_PRIVACY_SETTINGS'); $privacy = array(); // Update the privacy data with proper properties. foreach ($result as $group => $items) { // We do not want to show field privacy rules here because it does not make sense for user to set a default value // Most of the fields only have 1 and it is set in Edit Profile page if ($group === 'field') { continue; } // Only display such privacy rules if photos is enabled if (($group == 'albums' || $group == 'photos') && !$this->config->get('photos.enabled')) { continue; } // Do not display badges / achievements in privacy if badges is disabled if ($group == 'achievements' && !$this->config->get('badges.enabled')) { continue; } // Do not display followers privacy item if ($group == 'followers' && !$this->config->get('followers.enabled')) { continue; } foreach ($items as &$item) { // Conversations rule should only appear if it is enabled. if ($group == 'profiles' && $item->rule == 'post.message' && !$this->config->get('conversations.enabled')) { unset($item); } $rule = JString::str_ireplace('.', '_', $item->rule); $rule = strtoupper($rule); $groupKey = strtoupper($group); // Determines if this has custom $item->hasCustom = $item->custom ? true : false; // If the rule is a custom rule, we need to set the ids $item->customIds = array(); $item->customUsers = array(); if ($item->hasCustom) { foreach ($item->custom as $friend) { $item->customIds[] = $friend->user_id; $user = FD::user($friend->user_id); $item->customUsers[] = $user; } } // Try to find an app element that is related to the privacy type $app = ES::table('App'); $appExists = $app->load(array('element' => $item->type)); if ($appExists) { $app->loadLanguage(); } // Go through each options to get the selected item $item->selected = ''; foreach ($item->options as $option => $value) { if ($value) { $item->selected = $option; } // We need to remove "Everyone" if the site lockdown is enabled if ($this->config->get('general.site.lockdown.enabled') && $option == SOCIAL_PRIVACY_0) { unset($item->options[$option]); } } $item->groupKey = $groupKey; $item->label = JText::_('COM_EASYSOCIAL_PRIVACY_LABEL_' . $groupKey . '_' . $rule); $item->tips = JText::_('COM_EASYSOCIAL_PRIVACY_TIPS_' . $groupKey . '_' . $rule); } $privacy[$group] = $items; } // Get a list of blocked users for this user $blockModel = FD::model('Blocks'); $blocked = $blockModel->getBlockedUsers($this->my->id); $this->set('blocked', $blocked); $this->set('privacy', $privacy); parent::display('site/profile/default.edit.privacy'); }
/** * Renders the album's form * * @since 1.0 * @access public */ public function form() { // Check for user profile completeness FD::checkCompleteProfile(); // Check if photos is enabled $this->checkFeature(); // Only allow registered users to upload photos FD::requireLogin(); // Get the current user $my = FD::user(); // Get album id $id = JRequest::getInt('id', null); // Load album library $uid = JRequest::getInt('uid'); $type = JRequest::getWord('type', SOCIAL_TYPE_USER); if ($type == SOCIAL_TYPE_USER && !$uid) { $uid = $my->id; } $lib = Foundry::albums($uid, $type, $id); // If we are creating an album if (!$lib->data->id) { // Set the ownership of the album $lib->data->uid = $lib->uid; $lib->data->type = $lib->type; // Check if we have exceeded album creation limit. if ($lib->exceededLimits()) { return $this->output($lib->getExceededHTML(), $lib->data); } } // Set the page title $title = $lib->getPageTitle($this->getLayout()); FD::page()->title($title); // Set the breadcrumbs $lib->setBreadcrumbs($this->getLayout()); // Determines if the current user can edit this album if ($lib->data->id && !$lib->editable($lib->data)) { return $this->restricted($lib->data->uid, $lib->data->type); } // Render options $options = array('viewer' => $my->id, 'layout' => 'form', 'showStats' => false, 'showResponse' => false, 'showTags' => false, 'photoItem' => array('openInPopup' => false)); // Render item $output = $lib->renderItem($options); return $this->output($lib->uid, $lib->type, $output, $lib->data); }
/** * Responsible to output the single stream layout. * * @access public * @return null */ public function display($tpl = null) { // Unauthorized users should not be allowed to access this page. FD::requireLogin(); // Check for user profile completeness FD::checkCompleteProfile(); $config = FD::config(); // Get the current logged in user. $user = FD::user(); $filterType = JRequest::getVar('type', 'all'); $context = SOCIAL_STREAM_CONTEXT_TYPE_ALL; $active = $filterType; switch ($filterType) { case 'all': $title = JText::_('COM_EASYSOCIAL_ACTIVITY_YOUR_LOGS'); break; case 'hidden': $title = JText::_('COM_EASYSOCIAL_ACTIVITY_YOUR_HIDDEN_ACTIVITIES'); break; case 'hiddenapp': $title = JText::_('COM_EASYSOCIAL_ACTIVITY_YOUR_HIDDEN_APPS'); break; case 'hiddenactor': $title = JText::_('COM_EASYSOCIAL_ACTIVITY_YOUR_HIDDEN_ACTORS'); break; default: $title = JText::sprintf('COM_EASYSOCIAL_ACTIVITY_ITEM_TITLE', ucfirst($filterType)); break; } // Set the page title FD::page()->title($title); // Set the page breadcrumb FD::page()->breadcrumb($title); if ($filterType != 'all' && $filterType != 'hidden' && $filterType != 'hiddenapp' && $filterType != 'hiddenactor') { $context = $filterType; $filterType = 'all'; } // Load up activities model $model = FD::model('Activities'); if ($filterType == 'hiddenapp') { $activities = $model->getHiddenApps($user->id); $nextLimit = $model->getNextLimit('0'); } else { if ($filterType == 'hiddenactor') { $activities = $model->getHiddenActors($user->id); $nextLimit = $model->getNextLimit('0'); } else { // Retrieve user activities. $stream = FD::stream(); $options = array('uId' => $user->id, 'context' => $context, 'filter' => $filterType); $activities = $stream->getActivityLogs($options); $nextLimit = $stream->getActivityNextLimit(); } } // Get a list of apps $tmpApps = $model->getApps(); $apps = array(); foreach ($tmpApps as $app) { if ($app->hasActivityLog()) { $app->favicon = ''; $app->image = $app->getIcon(); $favicon = $app->getFavIcon(); if ($favicon) { $app->favicon = $favicon; } // Load app's css $app->loadCss(); $apps[] = $app; } } $this->set('active', $active); $this->set('title', $title); $this->set('apps', $apps); $this->set('user', $user); $this->set('activities', $activities); $this->set('nextlimit', $nextLimit); $this->set('filtertype', $filterType); echo parent::display('site/activities/default'); }