2011-10-11 13:02:57 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2012-06-12 18:42:45 +00:00
|
|
|
* @package PatchTester
|
|
|
|
* @copyright Copyright (C) 2011 Ian MacLennan, Inc. All rights reserved.
|
|
|
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
2011-10-11 13:02:57 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
// No direct access
|
|
|
|
defined('_JEXEC') or die;
|
|
|
|
|
|
|
|
jimport('joomla.application.component.view');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* View class for a list of pull requests.
|
|
|
|
*
|
2012-06-12 18:42:45 +00:00
|
|
|
* @package PatchTester
|
2011-10-11 13:02:57 +00:00
|
|
|
*/
|
2012-09-09 01:53:44 +00:00
|
|
|
class PatchtesterViewPulls extends JViewLegacy
|
2011-10-11 13:02:57 +00:00
|
|
|
{
|
|
|
|
protected $items;
|
|
|
|
protected $state;
|
2012-09-09 01:53:44 +00:00
|
|
|
protected $pagination;
|
2011-10-11 13:02:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Display the view
|
|
|
|
*/
|
|
|
|
public function display($tpl = null)
|
|
|
|
{
|
2012-06-12 20:38:14 +00:00
|
|
|
//@TODO: move the check
|
|
|
|
$checkErrs = array();
|
|
|
|
|
2012-06-12 20:38:53 +00:00
|
|
|
if(false == extension_loaded ('openssl'))
|
2012-06-12 20:38:14 +00:00
|
|
|
$checkErrs[] = 'The OpenSSL extension must be installed and enabled in your php.ini';
|
|
|
|
|
2012-06-12 20:38:53 +00:00
|
|
|
if(false == in_array('https', stream_get_wrappers()))
|
2012-06-12 20:38:14 +00:00
|
|
|
$checkErrs[] = 'https wrappers must be enabled';
|
|
|
|
|
|
|
|
if (count($checkErrs))
|
|
|
|
{
|
|
|
|
$application = JFactory::getApplication();
|
|
|
|
|
|
|
|
$application->enqueueMessage(
|
|
|
|
'Your system does not meet the requirements to run the PullTester extension:'
|
|
|
|
, 'error');
|
|
|
|
|
|
|
|
foreach ($checkErrs as $error)
|
|
|
|
{
|
|
|
|
$application->enqueueMessage($error, 'error');
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2012-06-12 18:42:45 +00:00
|
|
|
$this->state = $this->get('State');
|
|
|
|
$this->items = $this->get('Items');
|
|
|
|
$this->patches = $this->get('AppliedPatches');
|
2012-09-09 01:53:44 +00:00
|
|
|
$this->pagination = $this->get('Pagination');
|
2011-10-11 13:02:57 +00:00
|
|
|
|
|
|
|
// Check for errors.
|
2012-09-09 01:53:44 +00:00
|
|
|
$errors = $this->get('Errors');
|
|
|
|
|
|
|
|
if (count($errors))
|
2012-06-12 18:42:45 +00:00
|
|
|
{
|
2012-09-09 01:53:44 +00:00
|
|
|
var_dump($errors);
|
|
|
|
var_dump($this->pagination);
|
|
|
|
// JError::raiseError(500, implode("\n", $errors));
|
|
|
|
// return false;
|
2011-10-11 13:02:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$this->addToolbar();
|
2012-06-12 20:38:14 +00:00
|
|
|
|
2011-10-11 13:02:57 +00:00
|
|
|
parent::display($tpl);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add the page title and toolbar.
|
|
|
|
*/
|
|
|
|
protected function addToolbar()
|
|
|
|
{
|
2011-10-15 22:02:31 +00:00
|
|
|
JToolBarHelper::title('Joomla! Patch Tester', 'patchtester');
|
2011-10-11 13:02:57 +00:00
|
|
|
JToolBarHelper::preferences('com_patchtester');
|
2011-10-15 22:02:31 +00:00
|
|
|
|
|
|
|
JFactory::getDocument()->addStyleDeclaration(
|
|
|
|
'.icon-48-patchtester {background-image: url(components/com_patchtester/assets/images/icon-48-patchtester.png);}'
|
|
|
|
);
|
2011-10-11 13:02:57 +00:00
|
|
|
}
|
|
|
|
}
|