Example #1
0
 *
 * @package   hubzero-cms
 * @author    Ilya Shunko <*****@*****.**>
 * @copyright Copyright 2005-2015 HUBzero Foundation, LLC.
 * @license   http://opensource.org/licenses/MIT MIT
 */
// No direct access
defined('_HZEXEC_') or die;
$this->css()->js('spin.min.js')->js('autosubmit.js');
?>

<header id="content-header">
	<h2>Payment confirmation</h2>
</header>

<section class="section">
	<?php 
$view = new \Hubzero\Component\View(array('name' => 'shared', 'layout' => 'messages'));
$errors = $this->getError();
$view->setError($this->getError());
$view->display();
if (empty($errors)) {
    ?>
		<p>
			Please click the button below to proceed with payment.
		</p>
		<?php 
    print_r($this->paymentCode);
}
?>
</section>
Example #2
0
 /**
  * View a resource
  *
  * @return     void
  */
 public function viewTask()
 {
     // Incoming
     $id = Request::getInt('id', 0);
     // Rsource ID (primary method of identifying a resource)
     $alias = Request::getVar('alias', '');
     // Alternate method of identifying a resource
     $fsize = Request::getVar('fsize', '');
     // A parameter to see file size without formatting
     // XSS fix. Revision gets pumped all over and dumped in URLs via plugins, easier to fix at the input instead of risking missing an output. See ticket 1416
     $revision = htmlentities(Request::getVar('rev', ''));
     // Get svk revision of a tool
     $tab = Request::getVar('active', 'about');
     // The active tab (section)
     // Ensure we have an ID or alias to work with
     if (!$id && !$alias) {
         App::redirect(Route::url('index.php?option=' . $this->_option));
         return;
     }
     // Load the resource
     include_once dirname(dirname(__DIR__)) . DS . 'models' . DS . 'resource.php';
     $this->model = Models\Resource::getInstance($alias ? $alias : $id, $revision);
     // Make sure we got a result from the database
     if (!$this->model->exists() || $this->model->deleted()) {
         App::abort(404, Lang::txt('COM_RESOURCES_RESOURCE_NOT_FOUND'));
         return;
     }
     // Make sure the resource is published and standalone
     if (!$this->model->resource->standalone) {
         App::abort(403, Lang::txt('COM_RESOURCES_ALERTNOTAUTH'));
         return;
     }
     // Is the visitor authorized to view this resource?
     if (!$this->model->access('view')) {
         App::abort(403, Lang::txt('COM_RESOURCES_ALERTNOTAUTH'));
         return;
     }
     // // Make sure they have access to view this resource
     //if ($this->checkGroupAccess($this->model->resource))
     //{
     //	App::abort(403, \Lang::txt('COM_RESOURCES_ALERTNOTAUTH_GROUP', $this->model->resource->group_owner, Route::url('index.php?option=com_groups&cn=' . $this->model->resource->group_owner)));
     //	return;
     //}
     // Initiate a resource helper class
     $helper = new Helper($this->model->resource->id, $this->database);
     // Build the pathway
     if ($this->model->inGroup()) {
         // Alter the pathway to reflect a group owned resource
         $group = \Hubzero\User\Group::getInstance($this->model->resource->group_owner);
         if ($group) {
             Pathway::clear();
             Pathway::append('Groups', Route::url('index.php?option=com_groups'));
             Pathway::append(stripslashes($group->get('description')), Route::url('index.php?option=com_groups&cn=' . $this->model->resource->group_owner));
             Pathway::append('Resources', Route::url('index.php?option=com_groups&cn=' . $this->model->resource->group_owner . '&active=resources'));
             Pathway::append(stripslashes($this->model->type->type), Route::url('index.php?option=com_groups&cn=' . $this->model->resource->group_owner . '&active=resources&area=' . $this->model->type->alias));
         } else {
             Pathway::append(stripslashes($this->model->type->type), Route::url('index.php?option=' . $this->_option . '&type=' . $this->model->type->alias));
         }
     } else {
         Pathway::append(stripslashes($this->model->type->type), Route::url('index.php?option=' . $this->_option . '&type=' . $this->model->type->alias));
     }
     // Tool development version requested
     if (User::isGuest() && $revision == 'dev') {
         App::abort(403, Lang::txt('COM_RESOURCES_ALERTNOTAUTH'));
         return;
     }
     // Access check for tools
     if ($this->model->isTool()) {
         // if (development revision
         //   or (specific revision that is NOT published))
         if ($revision == 'dev' or !$revision && $this->model->resource->published != 1) {
             // Check if the user has access to the tool
             $objT = new \Components\Tools\Tables\Tool($this->database);
             $toolid = $objT->getToolId($this->model->resource->alias);
             if (!$this->_checkToolaccess($toolid)) {
                 // Denied, punk! How do you like them apples?!
                 App::abort(403, Lang::txt('COM_RESOURCES_ALERTNOTAUTH'));
                 return;
             }
         }
     }
     // Whew! Finally passed all the checks
     // Let's get down to business...
     // Get contribtool params
     $tconfig = \Component::params('com_tools');
     $sections = array();
     $cats = array();
     // We need to do this here because we need some stats info to pass to the body
     if (!isset($this->model->thistool) || !$this->model->thistool) {
         // Trigger the functions that return the areas we'll be using
         $cats = Event::trigger('resources.onResourcesAreas', array($this->model));
     } elseif (isset($this->model->revision) && $this->model->revision) {
         $cats = Event::trigger('resources.onResourcesAreas', array($this->model));
         $cts = array();
         foreach ($cats as $cat) {
             if (empty($cat)) {
                 $cts[] = $cat;
                 continue;
             }
             foreach ($cat as $name => $title) {
                 if ($name == 'about' || $name == 'versions' || $name == 'supportingdocs') {
                     $cts[] = $cat;
                 }
             }
         }
         $cats = $cts;
     }
     // Get the sections
     $sections = Event::trigger('resources.onResources', array($this->model, $this->_option, array($tab), 'all'));
     $available = array('play');
     foreach ($cats as $cat) {
         $name = key($cat);
         if ($name != '') {
             $available[] = $name;
         }
     }
     if ($tab != 'about' && !in_array($tab, $available)) {
         $tab = 'about';
     }
     // Display different main text if "playing" a resource
     if ($this->_task == 'play') {
         $activechild = NULL;
         if (is_object($this->activechild)) {
             $activechild = $this->activechild;
         }
         $view = new \Hubzero\Component\View(array('base_path' => $this->_base_path, 'name' => 'view', 'layout' => 'play'));
         $view->option = $this->_option;
         $view->config = $this->config;
         $view->tconfig = $tconfig;
         $view->database = $this->database;
         $view->resource = $this->model->resource;
         $view->helper = $helper;
         $view->resid = $this->resid;
         $view->activechild = $activechild;
         $view->no_html = 0;
         $view->fsize = 0;
         if ($this->getError()) {
             foreach ($this->getErrors() as $error) {
                 $view->setError($error);
             }
         }
         $body = $view->loadTemplate();
         $cats[] = array('play' => Lang::txt('COM_RESOURCES_PLAY'));
         $sections[] = array('html' => $body, 'metadata' => '', 'area' => 'play');
         $tab = 'play';
     } elseif ($this->_task == 'watch') {
         //test to make sure HUBpresenter is ready to go
         $pre = $this->preWatch();
         //get the errors
         $errors = $pre['errors'];
         //get the manifest
         $manifest = $pre['manifest'];
         //get the content path
         $content_folder = $pre['content_folder'];
         //if we have no errors
         if (count($errors) > 0) {
             // Instantiate a new view
             $this->view = new \Hubzero\Component\View(array('name' => 'view', 'layout' => 'watch_error'));
             $this->view->errors = $errors;
             $body = $this->view->loadTemplate();
         } else {
             // Instantiate a new view
             $view = new \Hubzero\Component\View(array('base_path' => $this->_base_path, 'name' => 'view', 'layout' => 'watch'));
             $view->config = $this->config;
             $view->tconfig = $tconfig;
             $view->database = $this->database;
             $view->manifest = $manifest;
             $view->content_folder = $content_folder;
             $view->pid = $id;
             $view->resid = Request::getVar('resid', '');
             $view->doc = Document::getRoot();
             // Output HTML
             if ($this->getError()) {
                 foreach ($this->getErrors() as $error) {
                     $view->setError($error);
                 }
             }
             $body = $view->loadTemplate();
         }
         $cats[] = array('watch' => Lang::txt('Watch Presentation'));
         $sections[] = array('html' => $body, 'metadata' => '', 'area' => 'watch');
         $tab = 'watch';
     }
     // Write title
     Document::setTitle(Lang::txt(strtoupper($this->_option)) . ': ' . stripslashes($this->model->resource->title));
     if ($canonical = $this->model->attribs->get('canonical', '')) {
         if (!preg_match('/^(https?:|mailto:|ftp:|gopher:|news:|file:|rss:)/i', $canonical)) {
             $canonical = rtrim(Request::base(), '/') . '/' . ltrim($canonical, '/');
         }
         Document::addHeadLink($canonical, 'canonical');
     }
     Pathway::append(stripslashes($this->model->resource->title), Route::url('index.php?option=' . $this->_option . '&id=' . $this->model->resource->id));
     // Normalize the title
     // This is so we can determine the type of resource template to display
     // For example, Learning Modules => learningmodules
     $type_alias = $this->model->type->alias ? $this->model->type->alias : $this->model->type->normalize($this->model->type->type);
     // Determine the layout we're using
     $layout = 'default';
     if ($type_alias && (is_file(PATH_CORE . DS . 'templates' . DS . App::get('template')->template . DS . 'html' . DS . $this->_option . DS . 'view' . DS . $type_alias . '.php') || is_file(dirname(__DIR__) . DS . 'views' . DS . 'view' . DS . 'tmpl' . DS . $type_alias . '.php'))) {
         $layout = $type_alias;
     }
     // Instantiate a new view
     $this->view->setLayout($layout);
     if ($this->model->isTool()) {
         $this->view->thistool = $this->model->thistool;
         $this->view->curtool = $this->model->curtool;
         $this->view->alltools = $this->model->alltools;
         $this->view->revision = $this->model->revision;
     }
     $this->view->model = $this->model;
     $this->view->tconfig = $tconfig;
     $this->view->option = $this->_option;
     $this->view->fsize = $fsize;
     $this->view->cats = $cats;
     $this->view->tab = $tab;
     $this->view->sections = $sections;
     $this->view->database = $this->database;
     $this->view->helper = $helper;
     foreach ($this->getErrors() as $error) {
         $this->view->setError($error);
     }
     // Output HTML
     $this->view->setName('view')->display();
 }