Example #1
0
 /**
  * Processes .view and .language from the javascript calls.
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function getResource()
 {
     $resources = JRequest::getVar('resource');
     if ($resources) {
         // Load language files
         $lang = FD::language();
         $lang->loadSite();
         $lang->loadAdmin();
         foreach ($resources as &$resource) {
             $resource = (object) $resource;
             $result = false;
             if ($resource->type == 'view') {
                 $result = $this->getView($resource->name);
             }
             if ($resource->type == 'language') {
                 $result = $this->getLanguage($resource->name);
             }
             if ($result !== false) {
                 $resource->content = $result;
             }
         }
     }
     header('Content-type: text/x-json; UTF-8');
     echo json_encode($resources);
     exit;
 }
Example #2
0
 public function display($tpl = null)
 {
     $auth = JRequest::getString('auth');
     // Get the current logged in user's information
     $model = FD::model('Users');
     $id = $model->getUserIdFromAuth($auth);
     $userId = JRequest::getInt('userid');
     // If user id is not passed in, return logged in user
     if (!$userId) {
         $userId = $id;
     }
     // If we still can't find user's details, throw an error
     if (!$userId) {
         $this->set('code', 403);
         $this->set('message', JText::_('Invalid user id provided.'));
         return parent::display();
     }
     $me = FD::user($id);
     $user = FD::user($userId);
     $this->set('id', $userId);
     $this->set('isself', $id == $userId);
     $this->set('isfriend', $user->isFriends($id));
     $this->set('isfollower', $user->isFollowed($id));
     $this->set('username', $user->username);
     $this->set('friend_count', $user->getTotalFriends());
     $this->set('follower_count', $user->getTotalFollowing());
     $this->set('badges', $user->getTotalBadges());
     $this->set('points', $user->getPoints());
     $this->set('avatar_thumb', $user->getAvatar());
     $birthday = $user->getFieldValue('BIRTHDAY');
     if (!empty($birthday)) {
         $this->set('age', $birthday->value->toAge());
     }
     $gender = $user->getFieldValue('GENDER');
     $this->set('gender', !empty($gender) ? $gender->data : 0);
     // Prepare DISPLAY custom fields
     FD::language()->loadAdmin();
     // FD::apps()->loadAllLanguages();
     $steps = FD::model('steps')->getSteps($user->profile_id, SOCIAL_TYPE_PROFILES, SOCIAL_PROFILES_VIEW_DISPLAY);
     $fields = FD::model('fields')->getCustomFields(array('profile_id' => $user->profile_id, 'data' => true, 'dataId' => $user->id, 'dataType' => SOCIAL_TYPE_USER, 'visible' => SOCIAL_PROFILES_VIEW_DISPLAY));
     $library = FD::fields();
     $args = array(&$user);
     $library->trigger('onGetValue', SOCIAL_FIELDS_GROUP_USER, $fields, $args);
     // Get the step mapping first
     $profileSteps = array();
     foreach ($steps as $step) {
         $profileSteps[$step->id] = JText::_($step->title);
     }
     $profileFields = array();
     foreach ($fields as $field) {
         $value = (string) $field->value;
         if (!empty($value)) {
             $data = array('group_id' => $field->step_id, 'group_name' => $profileSteps[$field->step_id], 'field_id' => $field->id, 'field_name' => JText::_($field->title), 'field_value' => (string) $field->value);
             $profileFields[] = $data;
         }
     }
     $this->set('more_info', $profileFields);
     $this->set('code', 200);
     parent::display();
 }
Example #3
0
 protected function getInput()
 {
     FD::language()->loadAdmin();
     FD::language()->loadSite();
     FD::page()->start();
     JFactory::getDocument()->addStylesheet(rtrim(JURI::root(), '/') . '/administrator/components/com_easysocial/themes/default/styles/style.css');
     $theme = FD::themes();
     $label = (string) $this->element['label'];
     $name = (string) $this->name;
     if ($this->value) {
         $category = FD::table('EventCategory');
         $category->load($this->value);
         $label = $category->get('title');
     }
     $theme->set('name', $name);
     $theme->set('id', $this->id);
     $theme->set('value', $this->value);
     $theme->set('label', $label);
     $output = $theme->output('admin/jfields/eventcategory');
     // We do not want to process stylesheets on Joomla 2.5 and below.
     $options = array();
     if (FD::version()->getVersion() < 3) {
         $options['processStylesheets'] = false;
     }
     FD::page()->end($options);
     return $output;
 }
Example #4
0
 /**
  * Processes .view and .language from the javascript calls.
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function getResource()
 {
     $resources = JRequest::getVar('resource');
     if ($resources) {
         // Load language support for front end and back end.
         $lang = FD::language();
         $lang->loadSite();
         $lang->loadAdmin();
         foreach ($resources as &$resource) {
             $resource = (object) $resource;
             // Get the current method.
             $method = 'get' . ucfirst($resource->type);
             if (!method_exists($this, $method)) {
                 continue;
             }
             // Pass the resource over.
             $result = self::$method($resource->name);
             if ($result !== false) {
                 $resource->content = $result;
             }
         }
     }
     header('Content-type: text/x-json; UTF-8');
     echo FD::json()->encode($resources);
     exit;
 }
Example #5
0
 /**
  * Main method to display the privacy view.
  *
  * @since	1.0
  * @access	public
  * @return	null
  *
  * @author	Sam <*****@*****.**>
  */
 public function display($tpl = null)
 {
     $this->setHeading('COM_EASYSOCIAL_HEADING_PRIVACY');
     $this->setDescription('COM_EASYSOCIAL_DESCRIPTION_PRIVACY');
     $state = JRequest::getInt('state', 1);
     JToolbarHelper::divider();
     JToolbarHelper::publishList('publish');
     JToolbarHelper::unpublishList('unpublish');
     JToolbarHelper::divider();
     JToolbarHelper::deleteList('', 'delete', JText::_('COM_EASYSOCIAL_TOOLBAR_TITLE_BUTTON_DELETE'));
     $model = FD::model('Privacy', array('initState' => true));
     $limit = $model->getState('limit');
     $ordering = $model->getState('ordering');
     $direction = $model->getState('direction');
     $search = $model->getState('search');
     $privacy = $model->getList();
     // Get pagination
     $pagination = $model->getPagination();
     $this->set('ordering', $ordering);
     $this->set('direction', $direction);
     $this->set('limit', $limit);
     $this->set('search', $search);
     $this->set('pagination', $pagination);
     $this->set('privacy', $privacy);
     $this->set('state', $state);
     FD::language()->loadSite();
     FD::apps()->loadAllLanguages();
     echo parent::display('admin/privacy/default');
 }
Example #6
0
 /**
  * Method to get the field input markup.
  *
  * @return  string	The field input markup.
  * @since   1.6
  */
 protected function getInput()
 {
     // Load the language file.
     FD::language()->loadAdmin();
     // Render the headers
     FD::page()->start();
     // Attach dialog's css file.
     JFactory::getDocument()->addStylesheet(rtrim(JURI::root(), '/') . '/administrator/components/com_easysocial/themes/default/styles/style.css');
     $theme = FD::themes();
     $label = (string) $this->element['label'];
     $name = (string) $this->name;
     $title = JText::_('COM_EASYSOCIAL_JFIELD_SELECT_BADGE');
     if ($this->value) {
         $badge = FD::table('Badge');
         $badge->load($this->value);
         $title = $badge->get('title');
     }
     $theme->set('name', $name);
     $theme->set('id', $this->id);
     $theme->set('value', $this->value);
     $theme->set('label', $label);
     $theme->set('title', $title);
     $output = $theme->output('admin/jfields/badge');
     // We do not want to process stylesheets on Joomla 2.5 and below.
     $options = array();
     if (FD::version()->getVersion() < 3) {
         $options['processStylesheets'] = false;
     }
     FD::page()->end($options);
     return $output;
 }
Example #7
0
 protected function getInput()
 {
     FD::language()->loadAdmin();
     FD::language()->loadSite();
     FD::page()->start();
     JFactory::getDocument()->addStylesheet(rtrim(JURI::root(), '/') . '/administrator/components/com_easysocial/themes/default/styles/style.css');
     $theme = FD::themes();
     $label = (string) $this->element['label'];
     $name = (string) $this->name;
     $title = JText::_('COM_EASYSOCIAL_JFIELD_SELECT_EVENT');
     if ($this->value) {
         $id = explode(':', $this->value);
         $id = $id[0];
         $group = FD::group($id);
         $title = $group->getName();
     }
     $theme->set('name', $name);
     $theme->set('id', $this->id);
     $theme->set('value', $this->value);
     $theme->set('label', $label);
     $theme->set('title', $title);
     $output = $theme->output('admin/jfields/event');
     // We do not want to process stylesheets on Joomla 2.5 and below.
     $options = array();
     if (FD::version()->getVersion() < 3) {
         $options['processStylesheets'] = false;
     }
     FD::page()->end($options);
     return $output;
 }
Example #8
0
 /**
  * Displays the registration request
  *
  * @since   1.3
  * @access  public
  * @param   string
  * @return
  */
 public function request()
 {
     $id = $this->input->getInt('id');
     $table = JTable::getInstance('Module');
     $table->load($id);
     FD::language()->load('mod_easysocial_registration_requester', JPATH_SITE);
     $params = FD::registry($table->params);
     $profileId = $params->get('profile_id');
     // If there's no profile id, then we automatically assign the default profile id
     if (empty($profileId)) {
         $profileModel = FD::model('profiles');
         $defaultProfile = $profileModel->getDefaultProfile();
         $profileId = $defaultProfile->id;
     }
     $fieldsModel = FD::model('fields');
     $options = array('visible' => SOCIAL_PROFILES_VIEW_MINI_REGISTRATION, 'profile_id' => $profileId);
     $fields = $fieldsModel->getCustomFields($options);
     if (!empty($fields)) {
         FD::language()->loadAdmin();
         $fieldsLib = FD::fields();
         $session = JFactory::getSession();
         $registration = FD::table('Registration');
         $registration->load($session->getId());
         $data = $registration->getValues();
         $args = array(&$data, &$registration);
         $fieldsLib->trigger('onRegisterMini', SOCIAL_FIELDS_GROUP_USER, $fields, $args);
     }
     $theme = FD::themes();
     $theme->set('params', $params);
     $theme->set('config', FD::config());
     $theme->set('fields', $fields);
     $output = $theme->output('site/registration/dialog.request');
     return $this->ajax->resolve($output);
 }
Example #9
0
 protected function getInput()
 {
     // Load the language file.
     FD::language()->loadAdmin();
     // Render the headers
     FD::page()->start();
     $theme = FD::themes();
     $label = (string) $this->element['label'];
     $name = (string) $this->name;
     $title = JText::_('COM_EASYSOCIAL_JFIELD_SELECT_PROFILE');
     if ($this->value) {
         $profile = FD::table('Profile');
         $profile->load($this->value);
         $title = $profile->get('title');
     }
     $theme->set('name', $name);
     $theme->set('id', $this->id);
     $theme->set('value', $this->value);
     $theme->set('label', $label);
     $theme->set('title', $title);
     $output = $theme->output('admin/jfields/profile');
     // We do not want to process stylesheets on Joomla 2.5 and below.
     $options = array();
     if (FD::version()->getVersion() < 3) {
         $options['processStylesheets'] = false;
     }
     FD::page()->end($options);
     return $output;
 }
Example #10
0
 /**
  * Default user listings page.
  *
  * @since	1.0
  * @access	public
  * @param	null
  * @return	null
  */
 public function display($tpl = null)
 {
     $this->setHeading('COM_EASYSOCIAL_HEADING_ALBUMS');
     $this->setDescription('COM_EASYSOCIAL_DESCRIPTION_ALBUMS');
     // Get the model
     $model = FD::model('Albums', array('initState' => true));
     // Get filter states.
     $ordering = JRequest::getVar('ordering', $model->getState('ordering'));
     $direction = JRequest::getVar('direction', $model->getState('direction'));
     $limit = $model->getState('limit');
     $published = $model->getState('published');
     $search = JRequest::getVar('search', $model->getState('search'));
     // Add Joomla buttons
     JToolbarHelper::deleteList();
     // Get albums
     $albums = $model->getDataWithState();
     // Load frontend language files
     FD::language()->loadSite();
     // Get pagination from model
     $pagination = $model->getPagination();
     $callback = JRequest::getVar('callback', '');
     $this->set('ordering', $ordering);
     $this->set('limit', $limit);
     $this->set('direction', $direction);
     $this->set('callback', $callback);
     $this->set('search', $search);
     $this->set('published', $published);
     $this->set('pagination', $pagination);
     $this->set('albums', $albums);
     echo parent::display('admin/albums/default');
 }
Example #11
0
 /**
  * Responsible to display the generic login form.
  *
  * @since	1.0
  * @access	public
  */
 public function display($tpl = null)
 {
     $my = FD::user();
     // If user is already logged in, they should not see this page.
     if ($my->id > 0) {
         return $this->redirect(FRoute::dashboard(array(), false));
     }
     // Add page title
     FD::page()->title(JText::_('COM_EASYSOCIAL_LOGIN_PAGE_TITLE'));
     // Add breadcrumb
     FD::page()->breadcrumb(JText::_('COM_EASYSOCIAL_LOGIN_PAGE_BREADCRUMB'));
     // Facebook codes.
     $facebook = FD::oauth('Facebook');
     $config = FD::config();
     $loginMenu = $config->get('general.site.login');
     // Get any callback urls.
     $return = FD::getCallback();
     // If return value is empty, always redirect back to the dashboard
     if (!$return) {
         // Determine if there's a login redirection
         $urlFromCaller = FD::input()->getVar('return', '');
         if ($urlFromCaller) {
             $return = $urlFromCaller;
         } else {
             if ($loginMenu != 'null') {
                 $return = FRoute::getMenuLink($loginMenu);
             } else {
                 $return = FRoute::dashboard(array(), false);
             }
             $return = base64_encode($return);
         }
     } else {
         $return = base64_encode($return);
     }
     if ($config->get('registrations.enabled')) {
         $profileId = $config->get('registrations.mini.profile', 'default');
         if ($profileId === 'default') {
             $profileId = Foundry::model('profiles')->getDefaultProfile()->id;
         }
         $options = array('visible' => SOCIAL_PROFILES_VIEW_MINI_REGISTRATION, 'profile_id' => $profileId);
         $fieldsModel = Foundry::model('fields');
         $fields = $fieldsModel->getCustomFields($options);
         if (!empty($fields)) {
             FD::language()->loadAdmin();
             $fieldsLib = FD::fields();
             $session = JFactory::getSession();
             $registration = FD::table('Registration');
             $registration->load($session->getId());
             $data = $registration->getValues();
             $args = array(&$data, &$registration);
             $fieldsLib->trigger('onRegisterMini', SOCIAL_FIELDS_GROUP_USER, $fields, $args);
             $this->set('fields', $fields);
         }
     }
     $this->set('return', $return);
     $this->set('facebook', $facebook);
     return parent::display('site/login/default');
 }
Example #12
0
 /**
  * The notification class is always a singleton object.
  *
  * @since	1.0
  * @access	public
  */
 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         // Just to be sure that the language files on the front end is loaded
         FD::language()->loadSite();
         self::$instance = new self();
     }
     return self::$instance;
 }
Example #13
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'));
 }
Example #14
0
 /**
  * Previews an email
  *
  * @since	1.0
  * @access	public
  */
 public function preview()
 {
     // Get the id.
     $id = JRequest::getInt('id');
     $mail = FD::table('Mailer');
     $mail->load($id);
     // Load front end language file
     FD::language()->loadSite();
     echo $mail->preview();
     exit;
 }
Example #15
0
 /**
  * Renders the comment count for Komento
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return	
  */
 public function getCount(EasyBlogPost $post)
 {
     if (!$this->exists()) {
         return;
     }
     FD::language()->load('com_easysocial', JPATH_ROOT);
     $url = $post->getPermalink();
     $comments = FD::comments($post->id, 'blog', SOCIAL_APPS_GROUP_USER, $url);
     $count = $comments->getCount();
     return $count;
 }
Example #16
0
 /**
  * Retrieves the terms and conditions for the app
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function getTnc()
 {
     // User's need to be logged in
     FD::requireLogin();
     // Load back end language files
     FD::language()->loadAdmin();
     $ajax = FD::ajax();
     $theme = FD::themes();
     $output = $theme->output('site/apps/dialog.install');
     return $ajax->resolve($output);
 }
Example #17
0
 /**
  * Responsible to display the generic login form via ajax
  *
  * @since	1.0
  * @access	public
  */
 public function form($tpl = null)
 {
     $ajax = FD::ajax();
     $my = FD::user();
     // If user is already logged in, they should not see this page.
     if ($my->id > 0) {
         $this->setMessage(JText::_('COM_EASYSOCIAL_LOGIN_ALREADY_LOGGED_IN'), SOCIAL_MSG_ERROR);
         return $ajax->reject($this->getMessage());
     }
     // Facebook codes.
     $facebook = FD::oauth('Facebook');
     // Get any callback urls.
     $return = FD::getCallback();
     // If return value is empty, always redirect back to the dashboard
     if (!$return) {
         $return = FRoute::dashboard(array(), false);
     }
     // Determine if there's a login redirection
     $config = FD::config();
     $loginMenu = $config->get('general.site.login');
     if ($loginMenu != 'null') {
         $return = FD::get('toolbar')->getRedirectionUrl($loginMenu);
     }
     $return = base64_encode($return);
     $this->set('return', $return);
     $this->set('facebook', $facebook);
     if ($config->get('registrations.enabled')) {
         $profileId = $config->get('registrations.mini.profile', 'default');
         if ($profileId === 'default') {
             $profileId = Foundry::model('profiles')->getDefaultProfile()->id;
         }
         $options = array('visible' => SOCIAL_PROFILES_VIEW_MINI_REGISTRATION, 'profile_id' => $profileId);
         $fieldsModel = FD::model('Fields');
         $fields = $fieldsModel->getCustomFields($options);
         if (!empty($fields)) {
             FD::language()->loadAdmin();
             $fieldsLib = FD::fields();
             $session = JFactory::getSession();
             $registration = FD::table('Registration');
             $registration->load($session->getId());
             $data = $registration->getValues();
             $args = array(&$data, &$registration);
             $fieldsLib->trigger('onRegisterMini', SOCIAL_FIELDS_GROUP_USER, $fields, $args);
             $this->set('fields', $fields);
         }
     }
     $contents = parent::display('site/login/dialog.login');
     return $ajax->resolve($contents);
 }
Example #18
0
 /**
  * Displays the popbox of a user when hovering over the name or avatar.
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function popboxUnfollow()
 {
     // Load front end's language file
     FD::language()->loadSite();
     $ajax = FD::ajax();
     $id = JRequest::getInt('id');
     if (!$id) {
         // Throw some errors.
         return $ajax->reject($this->getMessage());
     }
     $user = FD::user($id);
     $theme = FD::themes();
     $theme->set('user', $user);
     $contents = $theme->output('site/profile/popbox.unfollow');
     return $ajax->resolve($contents);
 }
Example #19
0
 /**
  * Main method to display the points view.
  *
  * @since	1.0
  * @access	public
  * @return	null
  *
  * @author	Mark Lee <*****@*****.**>
  */
 public function display($tpl = null)
 {
     // Check access
     if (!$this->authorise('easysocial.access.points')) {
         $this->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error');
     }
     // Add heading here.
     $this->setHeading(JText::_('COM_EASYSOCIAL_HEADING_POINTS'));
     // Set page icon
     $this->setIcon('ies-starburst');
     // Add description here.
     $this->setDescription(JText::_('COM_EASYSOCIAL_DESCRIPTION_POINTS'));
     // Add Joomla buttons here
     JToolbarHelper::publishList();
     JToolbarHelper::unpublishList();
     JToolbarHelper::divider();
     JToolbarHelper::deleteList();
     $model = FD::model('Points', array('initState' => true));
     $state = $model->getState('published');
     $extension = $model->getState('filter');
     $limit = $model->getState('limit');
     $ordering = $model->getState('ordering');
     $direction = $model->getState('direction');
     $search = $model->getState('search');
     // Load a list of extensions so that users can filter them.
     $extensions = $model->getExtensions();
     // Load the language files for each available extension
     $langlib = FD::language();
     foreach ($extensions as $e) {
         $langlib->load($e, JPATH_ROOT);
         $langlib->load($e, JPATH_ADMINISTRATOR);
     }
     $points = $model->getItems();
     // Get pagination
     $pagination = $model->getPagination();
     $this->set('ordering', $ordering);
     $this->set('direction', $direction);
     $this->set('limit', $limit);
     $this->set('selectedExtension', $extension);
     $this->set('search', $search);
     $this->set('pagination', $pagination);
     $this->set('extensions', $extensions);
     $this->set('extension', $extension);
     $this->set('points', $points);
     $this->set('state', $state);
     echo parent::display('admin/points/default');
 }
Example #20
0
 public function popbox()
 {
     // Load front end's language file
     FD::language()->loadSite();
     $ids = JRequest::getVar('ids', '');
     $ajax = FD::ajax();
     if (!$ids) {
         // Throw some errors.
         return $ajax->reject($this->getMessage());
     }
     $ids = explode('|', $ids);
     $users = FD::user($ids);
     $theme = FD::get('Themes');
     $theme->set('users', $users);
     $html = $theme->output('site/users/popbox.users');
     return $ajax->resolve($html);
 }
Example #21
0
 /**
  * Returns the lapsed time since NOW
  *
  * @since	1.0
  * @access	public
  * @param	null
  * @return	string	The lapsed time.
  */
 public function toLapsed()
 {
     // Load front end language strings as well since this lib requires it.
     FD::language()->loadSite();
     $now = FD::date();
     $time = $now->date->toUnix(true) - $this->date->toUnix(true);
     $tokens = array(31536000 => 'COM_EASYSOCIAL_LAPSED_YEARS_COUNT', 2592000 => 'COM_EASYSOCIAL_LAPSED_MONTHS_COUNT', 604800 => 'COM_EASYSOCIAL_LAPSED_WEEKS_COUNT', 86400 => 'COM_EASYSOCIAL_LAPSED_DAYS_COUNT', 3600 => 'COM_EASYSOCIAL_LAPSED_HOURS_COUNT', 60 => 'COM_EASYSOCIAL_LAPSED_MINUTES_COUNT', 1 => 'COM_EASYSOCIAL_LAPSED_SECONDS_COUNT');
     if ($time == 0) {
         return JText::_('COM_EASYSOCIAL_LAPSED_NOW');
     }
     foreach ($tokens as $unit => $key) {
         if ($time < $unit) {
             continue;
         }
         $units = floor($time / $unit);
         $text = FD::string()->computeNoun($key, $units);
         $text = JText::sprintf($text, $units);
         return $text;
     }
 }
Example #22
0
 /**
  * Main method to display the points view.
  *
  * @since	1.0
  * @access	public
  * @return	null
  *
  * @author	Mark Lee <*****@*****.**>
  */
 public function display($tpl = null)
 {
     $this->setHeading('COM_EASYSOCIAL_HEADING_POINTS');
     $this->setDescription('COM_EASYSOCIAL_DESCRIPTION_POINTS');
     // Add Joomla buttons here
     JToolbarHelper::publishList();
     JToolbarHelper::unpublishList();
     JToolbarHelper::divider();
     JToolbarHelper::deleteList();
     $model = FD::model('Points', array('initState' => true));
     $state = $model->getState('published');
     $extension = $model->getState('filter');
     $limit = $model->getState('limit');
     $ordering = $model->getState('ordering');
     $direction = $model->getState('direction');
     $search = $model->getState('search');
     // Load a list of extensions so that users can filter them.
     $extensions = $model->getExtensions();
     // Load the language files for each available extension
     $langlib = FD::language();
     foreach ($extensions as $e) {
         $langlib->load($e, JPATH_ROOT);
         $langlib->load($e, JPATH_ADMINISTRATOR);
     }
     $points = $model->getItems();
     // Get pagination
     $pagination = $model->getPagination();
     $this->set('ordering', $ordering);
     $this->set('direction', $direction);
     $this->set('limit', $limit);
     $this->set('selectedExtension', $extension);
     $this->set('search', $search);
     $this->set('pagination', $pagination);
     $this->set('extensions', $extensions);
     $this->set('extension', $extension);
     $this->set('points', $points);
     $this->set('state', $state);
     echo parent::display('admin/points/default');
 }
Example #23
0
 /**
  * Default user listings page.
  *
  * @since	1.0
  * @access	public
  * @param	null
  * @return	null
  */
 public function display($tpl = null)
 {
     // Disallow access
     if (!$this->authorise('easysocial.access.albums')) {
         $this->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error');
     }
     // Set page heading
     $this->setHeading(JText::_('COM_EASYSOCIAL_HEADING_ALBUMS'));
     // Set page icon
     $this->setIcon('ies-pictures');
     // Set page description
     $this->setDescription(JText::_('COM_EASYSOCIAL_DESCRIPTION_ALBUMS'));
     // Get the model
     $model = FD::model('Albums', array('initState' => true));
     // Get filter states.
     $ordering = JRequest::getVar('ordering', $model->getState('ordering'));
     $direction = JRequest::getVar('direction', $model->getState('direction'));
     $limit = $model->getState('limit');
     $published = $model->getState('published');
     $search = JRequest::getVar('search', $model->getState('search'));
     // Add Joomla buttons
     JToolbarHelper::deleteList();
     // Get albums
     $albums = $model->getDataWithState();
     // Load frontend language files
     FD::language()->loadSite();
     // Get pagination from model
     $pagination = $model->getPagination();
     $callback = JRequest::getVar('callback', '');
     $this->set('ordering', $ordering);
     $this->set('limit', $limit);
     $this->set('direction', $direction);
     $this->set('callback', $callback);
     $this->set('search', $search);
     $this->set('published', $published);
     $this->set('pagination', $pagination);
     $this->set('albums', $albums);
     echo parent::display('admin/albums/default');
 }
Example #24
0
 /**
  * Returns an ajax chain.
  *
  * @since	1.0
  * @access	public
  * @param	string	The verb that we have performed.
  */
 public function share($uid = null, $element = null, $group = SOCIAL_APPS_GROUP_USER, $streamId = 0)
 {
     // Load ajax lib
     $ajax = FD::ajax();
     // Determine if there's any errors on the form.
     $error = $this->getError();
     if ($error) {
         return $ajax->reject($error);
     }
     // Set the message
     $share = FD::get('Repost', $uid, $element, $group);
     $cnt = $share->getCount();
     $cntPluralize = FD::language()->pluralize($cnt, true)->getString();
     $text = JText::sprintf('COM_EASYSOCIAL_REPOST' . $cntPluralize, $cnt);
     //$text = $share->getHTML();
     $isHidden = $cnt > 0 ? false : true;
     $streamHTML = '';
     if ($streamId) {
         $stream = FD::stream();
         $stream->getItem($streamId);
         $streamHTML = $stream->html();
     }
     return $ajax->resolve($text, $isHidden, $cnt, $streamHTML);
 }
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
defined('_JEXEC') or die('Unauthorized Access');
// Include main engine
$file = JPATH_ROOT . '/administrator/components/com_easysocial/includes/foundry.php';
$easyblog = JPATH_ROOT . '/administrator/components/com_easyblog/easyblog.php';
jimport('joomla.filesystem.file');
if (!JFile::exists($file) || !JFile::exists($easyblog)) {
    return;
}
// Include the engine file.
require_once $file;
// Check if Foundry exists
if (!FD::exists()) {
    FD::language()->loadSite();
    echo JText::_('COM_EASYSOCIAL_FOUNDRY_DEPENDENCY_MISSING');
    return;
}
// Include EasyBlog's library
require_once JPATH_ROOT . '/administrator/components/com_easyblog/includes/easyblog.php';
$my = ES::user();
// Load up the module engine
$modules = ES::modules('mod_easysocial_easyblog_posts');
$model = EB::model('Blog');
// Get the module options
$total = (int) $params->get('total', 5);
$sorting = $params->get('sorting', 'latest');
// Let's load the list of posts now
$posts = $model->getBlogsBy('latest', '', $sorting, $total);
// We need to format the blog post accordingly.
Example #26
0
 /**
  * Performs various clean ups when a user is deleted
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function onUserBeforeDelete($user)
 {
     // Include main file.
     jimport('joomla.filesystem.file');
     $path = JPATH_ROOT . '/administrator/components/com_easysocial/includes/foundry.php';
     if (!JFile::exists($path)) {
         return false;
     }
     // Include the foundry engine
     require_once $path;
     // Check if Foundry exists
     if (!FD::exists()) {
         FD::language()->loadSite();
         echo JText::_('COM_EASYSOCIAL_FOUNDRY_DEPENDENCY_MISSING');
         return;
     }
     $model = FD::model('Users');
     $state = $model->delete($user['id']);
     // Internal Trigger for onUserBeforeDelete
     $dispatcher = FD::dispatcher();
     $args = array(&$user);
     $dispatcher->trigger(SOCIAL_APPS_GROUP_USER, __FUNCTION__, $args);
     return true;
 }
Example #27
0
 /**
  * Truncates a string at a centrain length and add a more link
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public static function truncater($text, $maxLength)
 {
     // Load site's language file
     FD::language()->loadSite();
     $theme = FD::themes();
     $length = JString::strlen($text);
     $uid = uniqid();
     $theme->set('uid', $uid);
     $theme->set('length', $length);
     $theme->set('text', $text);
     $theme->set('max', $maxLength);
     $output = $theme->output('admin/html/string.truncater');
     return $output;
 }
Example #28
0
 /**
  * Function to return HTML of 1 comments block
  *
  * @since	1.0
  * @access	public
  * @param	array	$options	Various options to manipulate the comments
  *
  * @return	string	Html block of the comments
  */
 public function getHtml($options = array())
 {
     // Ensure that language file is loaded
     FD::language()->loadSite();
     // Construct mandatory options
     $options['uid'] = $this->uid;
     $options['element'] = $this->getElement();
     $options['hideEmpty'] = isset($options['hideEmpty']) ? $options['hideEmpty'] : false;
     $options['hideForm'] = isset($options['hideForm']) ? $options['hideForm'] : false;
     $options['deleteable'] = isset($options['deleteable']) ? $options['deleteable'] : false;
     if ($this->stream_id) {
         $options['stream_id'] = $this->stream_id;
     }
     // Super admins should always be able to delete comments
     $my = FD::user();
     if ($my->isSiteAdmin()) {
         $options['deleteable'] = true;
     }
     // Check view mode (with childs or not)
     if (empty($options['fullview'])) {
         $options['parentid'] = 0;
     }
     $model = FD::model('comments');
     // Get the total comments first
     $total = $model->getCommentCount($options);
     // Construct bounderies
     if (!isset($options['limit'])) {
         $options['limit'] = FD::config()->get('comments.limit', 5);
     }
     $options['start'] = max($total - $options['limit'], 0);
     // Construct ordering
     $options['order'] = 'created';
     $options['direction'] = 'asc';
     // Check if it is coming from a permalink
     $commentid = JRequest::getInt('commentid', 0);
     if ($commentid !== 0) {
         $options['commentid'] = $commentid;
         // If permalink is detected, then no limit is required
         $options['limit'] = 0;
     }
     $comments = array();
     $count = 0;
     if ($total) {
         $comments = $model->getComments($options);
         $count = count($comments);
     }
     // @trigger: onPrepareComments
     $dispatcher = FD::dispatcher();
     $args = array(&$comments);
     $dispatcher->trigger($this->group, 'onPrepareComments', $args);
     // Check for permalink
     if (!empty($options['url'])) {
         $this->options['url'] = $options['url'];
     }
     // Check for stream id
     if (!empty($options['streamid'])) {
         $this->options['streamid'] = $options['streamid'];
     } else {
         if ($this->stream_id) {
             $this->options['streamid'] = $this->stream_id;
         }
     }
     $themes = FD::themes();
     $themes->set('deleteable', $options['deleteable']);
     $themes->set('hideEmpty', $options['hideEmpty']);
     $themes->set('hideForm', $options['hideForm']);
     $themes->set('my', FD::user());
     $themes->set('element', $this->element);
     $themes->set('group', $this->group);
     $themes->set('verb', $this->verb);
     $themes->set('uid', $this->uid);
     $themes->set('total', $total);
     $themes->set('count', $count);
     $themes->set('comments', $comments);
     if (!empty($this->options['url'])) {
         $themes->set('url', $this->options['url']);
     }
     if (!empty($this->options['streamid'])) {
         $themes->set('streamid', $this->options['streamid']);
     }
     if (isset($this->options['hideForm'])) {
         $themes->set('hideForm', $this->options['hideForm']);
     }
     $html = $themes->output('site/comments/frame');
     return $html;
 }
Example #29
0
 /**
  * Displays user's points history
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function history()
 {
     $this->checkFeature();
     // Check for user profile completeness
     FD::checkCompleteProfile();
     $id = JRequest::getInt('userid');
     if (!$id) {
         $id = null;
     }
     $user = FD::user($id);
     // If the user id is not provided, we need to display some error message.
     if (!$user->id) {
         FD::info()->set(JText::_('COM_EASYSOCIAL_POINTS_INVALID_USER_ID_PROVIDED'), SOCIAL_MSG_ERROR);
         return $this->redirect(FRoute::dashboard(array(), false));
     }
     // If the user blocked, we need to display some error message.
     if ($user->isBlock()) {
         FD::info()->set(JText::sprintf('COM_EASYSOCIAL_POINTS_USER_NOT_EXIST', $user->getName()), SOCIAL_MSG_ERROR);
         return $this->redirect(FRoute::dashboard(array(), false));
     }
     if (!JFactory::getUser()->guest && JFactory::getUser()->id != $user->id) {
         if (FD::user()->isBlockedBy($user->id)) {
             return JError::raiseError(404, JText::_('COM_EASYSOCIAL_POINTS_USER_NOT_EXIST'));
         }
     }
     // Language should be loaded for the back end.
     FD::language()->loadAdmin();
     // Set the page title
     FD::page()->title(JText::sprintf('COM_EASYSOCIAL_PAGE_TITLE_POINTS_USER_HISTORY', $user->getName()));
     // Set the page breadcrumb
     FD::page()->breadcrumb(JText::_('COM_EASYSOCIAL_PAGE_TITLE_POINTS'), FRoute::points());
     FD::page()->breadcrumb(JText::sprintf('COM_EASYSOCIAL_PAGE_TITLE_POINTS_USER_HISTORY', $user->getName()));
     $my = FD::user();
     $privacy = $my->getPrivacy();
     // Let's test if the current viewer is allowed to view this profile.
     if ($my->id != $user->id) {
         if (!$privacy->validate('profiles.view', $user->id, SOCIAL_TYPE_USER)) {
             $this->set('user', $user);
             parent::display('site/profile/restricted');
             return;
         }
     }
     $config = FD::config();
     $options = array('limit' => $config->get('points.history.limit'));
     $model = FD::model('Points');
     // Get a list of histories for the user's points achievements.
     $histories = $model->getHistory($user->id, $options);
     $pagination = $model->getPagination();
     $this->set('pagination', $pagination);
     $this->set('histories', $histories);
     $this->set('user', $user);
     parent::display('site/points/default.history');
 }
Example #30
0
 /**
  * Retrieve additional information for a specific user
  *
  * @since	1.3
  * @access	public
  * @param	string
  * @return
  */
 public function getInfo()
 {
     // Check for request forgeries
     FD::checkToken();
     $view = $this->getCurrentView();
     $id = $this->input->get('id', 0, 'int');
     $user = FD::user($id);
     if (empty($user) || empty($user->id) || $user->isBlock()) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_USERS_NO_SUCH_USER'), SOCIAL_MSG_ERROR);
         return $view->call(__FUNCTION__);
     }
     $my = FD::user();
     $privacy = $my->getPrivacy();
     // @privacy: Let's test if the current viewer is allowed to view this profile.
     if ($my->id != $user->id && !$privacy->validate('profiles.view', $user->id, SOCIAL_TYPE_USER)) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_PROFILE_PRIVACY_NOT_ALLOWED'), SOCIAL_MSG_ERROR);
         return $view->call(__FUNCTION__);
     }
     FD::language()->loadAdmin();
     $index = JRequest::getInt('index');
     $profile = $user->getProfile();
     $sequence = $profile->getSequenceFromIndex($index, SOCIAL_PROFILES_VIEW_DISPLAY);
     $step = FD::table('FieldStep');
     $state = $step->load(array('uid' => $profile->id, 'type' => SOCIAL_TYPE_PROFILES, 'sequence' => $sequence, 'visible_display' => 1));
     if (!$state) {
         $view->setMessage(JText::sprintf('COM_EASYSOCIAL_PROFILE_USER_NOT_EXIST', $user->getName()), SOCIAL_MSG_ERROR);
         return $view->call(__FUNCTION__);
     }
     $fields = FD::model('Fields')->getCustomFields(array('step_id' => $step->id, 'data' => true, 'dataId' => $user->id, 'dataType' => SOCIAL_TYPE_USER, 'visible' => SOCIAL_PROFILES_VIEW_DISPLAY));
     $fieldsLib = FD::fields();
     if (!empty($fields)) {
         $args = array($user);
         $fieldsLib->trigger('onDisplay', SOCIAL_FIELDS_GROUP_USER, $fields, $args);
     }
     return $view->call(__FUNCTION__, $fields);
 }