/** * Returns the php version of the source item. * * @since 1.0 * @access public * @param null * @return string The absolute URI for previewing an item. */ public function getPreviewURI() { if ($this->storage != 'joomla') { $storage = FD::storage($this->storage); $path = $this->getStoragePath(true); $path = $path . '/' . $this->hash; return $storage->getPermalink($path); } // We need to fix the path for groups! $type = $this->type; if ($type == 'group') { $type = 'groups'; } if ($type == 'event') { $type = 'events'; } $uri = FRoute::raw('index.php?option=com_easysocial&view=' . $type . '&layout=preview&fileid=' . $this->id . '&tmpl=component'); return $uri; }
/** * Displays the first step of user signing up with oauth * * @since 1.0 * @access public */ public function oauth() { // If user is already logged in here, they shouldn't be allowed on this page. if (!$this->my->guest) { $this->setMessage(JText::_('COM_EASYSOCIAL_OAUTH_YOU_ARE_ALREADY_LOGGED_IN'), SOCIAL_MSG_ERROR); FD::info()->set($this->getMessage()); $this->redirect(FRoute::dashboard(array(), false)); } // Get allowed clients $allowedClients = array_keys((array) $this->config->get('oauth')); // Get the current client. $oauthClient = $this->input->get('client', '', 'word'); if (!in_array($oauthClient, $allowedClients)) { FD::info()->set(false, JText::sprintf('COM_EASYSOCIAL_OAUTH_INVALID_OAUTH_CLIENT_PROVIDED', $oauthClient), SOCIAL_MSG_ERROR); return $this->redirect(FRoute::login(array(), false)); } // Get the oauth client object. $client = FD::oauth($oauthClient); // Add page title $title = JText::sprintf('COM_EASYSOCIAL_OAUTH_PAGE_TITLE', ucfirst($oauthClient)); $this->page->title($title); // Add breadcrumbs $this->page->breadcrumb($title); // Check configuration if the registration mode is set to simplified or normal. $registrationType = $this->config->get('oauth.' . $oauthClient . '.registration.type'); if ($registrationType == 'simplified') { $createUrl = FRoute::raw('index.php?option=com_easysocial&controller=registration&task=oauthSignup&client=' . $oauthClient); } else { $createUrl = FRoute::registration(array('layout' => 'oauthSelectProfile', 'client' => $oauthClient)); } // Check if import avatar option is enabled $importAvatar = $this->config->get('oauth.' . $oauthClient . '.registration.avatar'); // Check if import cover option is enabled $importCover = $this->config->get('oauth.' . $oauthClient . '.registration.cover'); // Get user's meta try { $meta = $client->getUserMeta(); } catch (Exception $e) { $app = JFactory::getApplication(); // Use dashboard here instead of login because api error calls might come from after user have successfully logged in $url = FRoute::dashboard(array(), false); $message = (object) array('message' => JText::sprintf('COM_EASYSOCIAL_OAUTH_FACEBOOK_ERROR_MESSAGE', $e->getMessage()), 'type' => SOCIAL_MSG_ERROR); FD::info()->set($message); $app->redirect($url); $app->close(); } $this->set('meta', $meta); $this->set('createUrl', $createUrl); $this->set('clientType', $oauthClient); $this->set('importAvatar', $importAvatar); $this->set('importCover', $importCover); parent::display('site/registration/oauth'); }