예제 #1
0
 public function getProfileURL($userid, $task = '', $xhtml = true)
 {
     if ($userid) {
         $user = ES::user($userid);
         // When simple urls are enabled, we just hardcode the url
         $config = ES::config();
         $jConfig = ES::jConfig();
         if (!ES::isSh404Installed() && $config->get('users.simpleUrl') && $jConfig->getValue('sef')) {
             $url = rtrim(JURI::root(), '/') . '/' . $user->getAlias(false);
             return $url;
         }
         // If it's not configured for simple urls, just set the alias
         $alias = $user->getAlias();
     } else {
         $alias = $userid;
     }
     $options = array('id' => $alias);
     if ($task) {
         $options['layout'] = $task;
     }
     $url = FRoute::profile($options, $xhtml);
     return $url;
 }
예제 #2
0
 /**
  * Processes the install by uploading
  *
  * @since	1.0
  * @access	public
  * @param	null
  * @return	null
  *
  * @author	Mark Lee <*****@*****.**>
  **/
 public function installFromUpload()
 {
     // Check for request forgeries.
     FD::checkToken();
     $package = $this->input->files->get('package');
     // Test for empty packages.
     if (!isset($package['tmp_name']) || !$package['tmp_name']) {
         $this->view->setMessage('COM_EASYSOCIAL_APPS_PLEASE_UPLOAD_INSTALLER', SOCIAL_MSG_ERROR);
         return $this->view->install();
     }
     $source = $package['tmp_name'];
     $jConfig = ES::config('joomla');
     // Construct the destination path
     $destination = $jConfig->getValue('tmp_path') . '/' . $package['name'];
     // Get the installer library
     $installer = ES::get('Installer');
     // Now try to upload the installer
     $state = $installer->upload($source, $destination);
     if (!$state) {
         $this->view->setMessage('COM_EASYSOCIAL_APPS_UNABLE_TO_COPY_UPLOADED_FILE', SOCIAL_MSG_ERROR);
         return $this->view->install();
     }
     // Unpack the archive.
     $path = $installer->extract($destination);
     // When something went wrong with the installation, just display the error
     if ($path === false) {
         $error = ES::get('Errors')->getErrors('installer.extract');
         $this->info->set($error, SOCIAL_MSG_ERROR);
         $this->app->redirect('index.php?option=com_easysocial&view=applications&layout=error');
         return $this->app->close();
     }
     return $this->installFromDirectory($path);
 }