31
2
mirror of https://github.com/joomla-extensions/jedchecker.git synced 2024-06-12 01:42:20 +00:00

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

View File

@ -18,7 +18,7 @@ jimport('joomla.filesystem.archive');
* *
* @since 1.0 * @since 1.0
*/ */
class JedcheckerControllerUploads extends JControllerLegacy class JedcheckerControllerUploads extends JControllerlegacy
{ {
/** /**
* Constructor. * Constructor.
@ -39,9 +39,14 @@ class JedcheckerControllerUploads extends JControllerLegacy
*/ */
public function upload() public function upload()
{ {
JRequest::checkToken() or die('Invalid Token'); $appl = JFactory::getApplication();
$appl = JFactory::getApplication(); $input = JFactory::getApplication()->input;
$file = JRequest::getVar('extension', '', 'files', 'array');
// 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']) if ($file['tmp_name'])
{ {
@ -76,8 +81,9 @@ class JedcheckerControllerUploads extends JControllerLegacy
// Let us try to upload // Let us try to upload
if (!JFile::upload($file['tmp_name'], $file['filepath'], false, true)) 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'); JFactory::getApplication()->enqueueMessage(JText::_('COM_JEDCHECKER_ERROR_UNABLE_TO_UPLOAD_FILE'), 'error');
$this->setRedirect('index.php?option=com_jedchecker&view=uploads');
return false; return false;
} }
@ -97,8 +103,10 @@ class JedcheckerControllerUploads extends JControllerLegacy
*/ */
public function unzip() 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 folder doesn't exist - create it!
if (!JFolder::exists($this->pathUnzipped)) if (!JFolder::exists($this->pathUnzipped))
@ -138,7 +146,7 @@ class JedcheckerControllerUploads extends JControllerLegacy
/** /**
* Recursively go through each folder and extract the archives * 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 * @return void
*/ */