Merge pull request #39 from dam-man/patch-2

Removed some deprecated Joomla Framework code.
This commit is contained in:
Jaz Parkyn 2017-01-13 10:56:15 +00:00 committed by GitHub
commit d4043a7253
1 changed files with 16 additions and 8 deletions

View File

@ -18,7 +18,7 @@ jimport('joomla.filesystem.archive');
*
* @since 1.0
*/
class JedcheckerControllerUploads extends JControllerLegacy
class JedcheckerControllerUploads extends JControllerlegacy
{
/**
* Constructor.
@ -39,9 +39,14 @@ class JedcheckerControllerUploads extends JControllerLegacy
*/
public function upload()
{
JRequest::checkToken() or die('Invalid Token');
$appl = JFactory::getApplication();
$file = JRequest::getVar('extension', '', 'files', 'array');
$appl = JFactory::getApplication();
$input = JFactory::getApplication()->input;
// Check the sent token by the form
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
// Gets the uploaded file from the sent form
$file = $input->files->get('extension', null, 'raw');
if ($file['tmp_name'])
{
@ -76,8 +81,9 @@ class JedcheckerControllerUploads extends JControllerLegacy
// Let us try to upload
if (!JFile::upload($file['tmp_name'], $file['filepath'], false, true))
{
// Error in upload
// Error in upload - redirect back with an error notice
JFactory::getApplication()->enqueueMessage(JText::_('COM_JEDCHECKER_ERROR_UNABLE_TO_UPLOAD_FILE'), 'error');
$this->setRedirect('index.php?option=com_jedchecker&view=uploads');
return false;
}
@ -97,8 +103,10 @@ class JedcheckerControllerUploads extends JControllerLegacy
*/
public function unzip()
{
JRequest::checkToken() or die('Invalid Token');
$appl = JFactory::getApplication();
$appl = JFactory::getApplication();
// Form check token
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
// If folder doesn't exist - create it!
if (!JFolder::exists($this->pathUnzipped))
@ -138,7 +146,7 @@ class JedcheckerControllerUploads extends JControllerLegacy
/**
* Recursively go through each folder and extract the archives
*
* @param string $start - the directory where we start the unzipping from
* @param string $start - the directory where we start the unzipping from
*
* @return void
*/