Esempio n. 1
0
 /**
  * Responsible to display the generic login form via ajax
  *
  * @since	1.0
  * @access	public
  */
 public function form($tpl = null)
 {
     // If user is already logged in, they should not see this page.
     if (!$this->my->guest) {
         $this->setMessage(JText::_('COM_EASYSOCIAL_LOGIN_ALREADY_LOGGED_IN'), SOCIAL_MSG_ERROR);
         return $this->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 = FRoute::getMenuLink($loginMenu);
     }
     $return = base64_encode($return);
     // Only display registration form when registrations are enabled.
     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);
         }
     }
     $this->set('return', $return);
     $this->set('facebook', $facebook);
     $contents = parent::display('site/login/dialog.login');
     return $this->ajax->resolve($contents);
 }
if (!FD::exists()) {
    FD::language()->loadSite();
    echo JText::_('COM_EASYSOCIAL_FOUNDRY_DEPENDENCY_MISSING');
    return;
}
$my = FD::user();
// If the user is not logged in, don't show the menu
if ($my->guest) {
    return;
}
// Load up the module engine
$modules = FD::modules('mod_easysocial_menu');
// We need these packages
$modules->loadComponentScripts();
$modules->loadComponentStylesheets();
$modules->addDependency('css');
$modules->loadScript('script.js');
// Get the layout to use.
$layout = $params->get('layout', 'default');
$suffix = $params->get('suffix', '');
// Determines if EasyBlog exists
$eblogFile = JPATH_ROOT . '/administrator/components/com_easyblog/includes/easyblog.php';
$eblogExists = JFile::exists($eblogFile);
if ($eblogExists) {
    require_once $eblogFile;
}
// Get the logout return value
$logoutMenu = FD::config()->get('general.site.logout');
$logoutReturn = FRoute::getMenuLink($logoutMenu);
$logoutReturn = base64_encode($logoutReturn);
require JModuleHelper::getLayoutPath('mod_easysocial_menu', $layout);
Esempio n. 3
0
 /**
  * Renders the HTML block for the notification bar.
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function render($options = array())
 {
     $theme = FD::themes();
     // Default options
     $newConversations = false;
     $newRequests = false;
     $newNotifications = false;
     $facebook = false;
     // Display counter related stuffs for logged in user and user that has access to the community
     if ($this->my->id && $this->my->hasCommunityAccess()) {
         // Get a list of new conversations
         $newConversations = $this->my->getTotalNewConversations();
         // Get total pending request count
         $newRequests = $this->my->getTotalFriendRequests();
         // Get new system notifications
         $model = FD::model('Notifications');
         $notificationOptions = array('unread' => true, 'target' => array('id' => $this->my->id, 'type' => SOCIAL_TYPE_USER));
         $newNotifications = $model->getCount($notificationOptions);
     }
     // Only render facebook codes if user is not logged in
     if ($this->my->guest) {
         $facebook = FD::oauth('Facebook');
     }
     // Get login redirection url
     $loginMenu = $this->config->get('general.site.login');
     $loginReturn = base64_encode(JRequest::getURI());
     if ($loginMenu != 'null') {
         $loginReturn = FRoute::getMenuLink($loginMenu);
         $loginReturn = base64_encode($loginReturn);
     }
     // Get logout redirection url
     $logoutMenu = $this->config->get('general.site.logout');
     $logoutReturn = FRoute::getMenuLink($logoutMenu);
     $logoutReturn = base64_encode($logoutReturn);
     // Determines if there's any force display options passed in arguments
     $forceOption = isset($options['forceoption']) ? $options['forceoption'] : false;
     // Default this two is enabled.
     $friends = isset($options['friends']) ? $options['friends'] : true;
     $notifications = isset($options['notifications']) ? $options['notifications'] : true;
     // Get other options from arguments
     $toolbar = isset($options['toolbar']) ? $options['toolbar'] : false;
     $dashboard = isset($options['dashboard']) ? $options['dashboard'] : false;
     $conversations = isset($options['conversations']) ? $options['conversations'] : false;
     $search = isset($options['search']) ? $options['search'] : false;
     $login = isset($options['login']) ? $options['login'] : false;
     $profile = isset($options['profile']) ? $options['profile'] : false;
     // Get template settings
     $template = $theme->getConfig();
     // If the user is guests, ensure that the theme is configured to display toolbar to the guest
     if ($this->my->guest && !$template->get('toolbar_guests')) {
         $toolbar = false;
     }
     // Should we enforce the arguments that is passed in?
     if (!$forceOption) {
         $dashboard = $template->get('toolbar_dashboard') || $dashboard;
         $conversations = $this->config->get('conversations.enabled') || $conversations;
         $search = $template->get('toolbar_search') || $search;
         $login = $template->get('toolbar_login') || $login;
         $profile = $template->get('toolbar_account') || $profile;
         $toolbar = $template->get('toolbar') || $toolbar;
         if ($this->my->guest && !$template->get('toolbar_guests')) {
             $toolbar = false;
         }
     }
     // If toolbar has been disabled altogether skip this
     if (!$toolbar) {
         return;
     }
     // If the user doesn't have access to the community we need to enforce specific options here
     if (!$this->my->hasCommunityAccess()) {
         $friends = false;
         $conversations = false;
         $notifications = false;
         $dashboard = false;
         $search = false;
     }
     // Get the current request variables
     $view = $this->input->get('view', '', 'cmd');
     $layout = $this->input->get('layout', '', 'cmd');
     $userId = $this->input->get('id', 0, 'int');
     $theme->set('newConversations', $newConversations);
     $theme->set('newRequests', $newRequests);
     $theme->set('newNotifications', $newNotifications);
     $theme->set('facebook', $facebook);
     $theme->set('userId', $userId);
     $theme->set('view', $view);
     $theme->set('layout', $layout);
     $theme->set('login', $login);
     $theme->set('profile', $profile);
     $theme->set('search', $search);
     $theme->set('dashboard', $dashboard);
     $theme->set('friends', $friends);
     $theme->set('conversations', $conversations);
     $theme->set('notifications', $notifications);
     $theme->set('toolbar', $toolbar);
     $theme->set('loginReturn', $loginReturn);
     $theme->set('logoutReturn', $logoutReturn);
     $output = $theme->output('site/toolbar/default');
     return $output;
 }
Esempio n. 4
0
 /**
  * Displays some information once the user registration is completed.
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function completed()
 {
     // If user is already logged in, redirect them to their dashboard automatically.
     $user = FD::user();
     if ($user->id) {
         $config = FD::config();
         $loginMenu = $config->get('general.site.login');
         if ($loginMenu == 'null') {
             $url = FRoute::dashboard(array(), false);
         } else {
             $url = FRoute::getMenuLink($loginMenu);
         }
         return $this->redirect($url);
     }
     $userId = $this->input->get('userid', 0, 'int');
     $user = FD::user($userId);
     // Get the profile type.
     $id = $this->input->get('id', 0, 'int');
     $profile = FD::table('Profile');
     $profile->load($id);
     $oauth = $this->input->get('oauth', 0, 'int');
     // Get the registration type
     $type = $profile->getRegistrationType(false, $oauth);
     $this->set('user', $user);
     $this->set('type', $type);
     $this->set('profile', $profile);
     echo parent::display('site/registration/default.complete');
 }
Esempio n. 5
0
    ?>
<div id="fd" class="es mod-es-login style-vertical module-social<?php 
    echo $suffix;
    ?>
">
	<form action="<?php 
    echo JRoute::_('index.php');
    ?>
" id="es-mod-login-signout-form" method="post">
		<div class="text-center">
			<a href="javascript:void(0);" onclick="document.getElementById( 'es-mod-login-signout-form' ).submit();" class="btn btn-primary">
				<?php 
    echo JText::_('MOD_EASYSOCIAL_LOGIN_SIGN_OUT');
    ?>
			</a>
		</div>

		<input type="hidden" name="option" value="com_easysocial" />
		<input type="hidden" name="controller" value="account" />
		<input type="hidden" name="task" value="logout" />
		<input type="hidden" name="return" value="<?php 
    echo base64_encode(FRoute::getMenuLink(FD::config()->get('general.site.logout')));
    ?>
" />
		<?php 
    echo $modules->html('form.token');
    ?>
	</form>
</div>
<?php 
}
Esempio n. 6
0
 /**
  * Displays the guest view for the dashboard
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function displayGuest()
 {
     // Determine if the current request is for "tags"
     $hashtag = $this->input->get('tag', '');
     $hashtagAlias = $hashtag;
     if ($this->config->get('stream.rss.enabled')) {
         $this->addRss(FRoute::dashboard(array(), false));
     }
     // Default stream filter
     $filter = 'everyone';
     if (!empty($hashtag)) {
         $filter = 'hashtag';
     }
     // Get the layout to use.
     $stream = FD::stream();
     $stream->getPublicStream($this->config->get('stream.pagination.pagelimit', 10), 0, $hashtag);
     // Get any callback urls.
     $return = FD::getCallback();
     // Try to get the login return url
     if (!$return) {
         $return = FRoute::getMenuLink($this->config->get('general.site.login'));
     }
     // If return value is empty, always redirect back to the dashboard
     if (!$return) {
         $return = FRoute::dashboard(array(), false);
     }
     // In guests view, there shouldn't be an app id
     $appId = $this->input->get('appId', '', 'default');
     if ($appId) {
         return JError::raiseError(404, JText::_('COM_EASYSOCIAL_PAGE_IS_NOT_AVAILABLE'));
     }
     // Ensure that the return url is always encoded correctly.
     $return = base64_encode($return);
     $facebook = FD::oauth('Facebook');
     $fields = false;
     if ($this->config->get('registrations.enabled')) {
         $fieldsModel = FD::model('Fields');
         $profileId = $this->config->get('registrations.mini.profile', 'default');
         if ($profileId === 'default') {
             $profileId = FD::model('Profiles')->getDefaultProfile()->id;
         }
         $options = array('visible' => SOCIAL_PROFILES_VIEW_MINI_REGISTRATION, 'profile_id' => $profileId);
         // Get a list of custom 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('rssLink', $this->rssLink);
     $this->set('fields', $fields);
     $this->set('filter', $filter);
     $this->set('facebook', $facebook);
     $this->set('hashtag', $hashtag);
     $this->set('hashtagAlias', $hashtagAlias);
     $this->set('stream', $stream);
     $this->set('return', $return);
     echo parent::display('site/dashboard/default.guests');
 }
Esempio n. 7
0
 /**
  * Responsible to log the user out from the system.
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function logout()
 {
     $logoutMenu = $this->config->get('general.site.logout');
     // Default redirection url
     $redirect = FRoute::login(array(), false);
     if ($loginMenu != 'null') {
         $redirect = FRoute::getMenuLink($logoutMenu);
     }
     // If the user is not logged in on the first place
     if ($this->my->guest) {
         return $this->redirect($redirect);
     }
     // Perform the log out.
     $error = $this->app->logout();
     // Get the return URL
     return $this->redirect($redirect);
 }