Skip to content

Commit

Permalink
[#31727] Migrate application classes from legacy JApplication to JApp…
Browse files Browse the repository at this point in the history
…licationWeb (Fix #1716)
  • Loading branch information
Michael Babker committed Sep 20, 2013
1 parent e766a79 commit d962a5a
Show file tree
Hide file tree
Showing 67 changed files with 3,599 additions and 1,315 deletions.
3 changes: 3 additions & 0 deletions administrator/components/com_admin/script.php
Expand Up @@ -927,6 +927,9 @@ public function deleteUnexistingFiles()
'administrator/components/com_newsfeeds/models/fields/ordering.php',
'administrator/components/com_plugins/models/fields/ordering.php',
'administrator/components/com_weblinks/models/fields/ordering.php',
'/administrator/includes/application.php',
'/includes/application.php',
'/libraries/legacy/application/helper.php',
);

// TODO There is an issue while deleting folders using the ftp mode
Expand Down
Expand Up @@ -37,7 +37,7 @@ public function display($tpl = null)

$document = JFactory::getDocument();
$document->setMimeEncoding($mimetype);
JResponse::setHeader('Content-disposition', 'attachment; filename="'.$basename.'.'.$filetype.'"; creation-date="'.JFactory::getDate()->toRFC822().'"', true);
JFactory::getApplication()->setHeader('Content-disposition', 'attachment; filename="'.$basename.'.'.$filetype.'"; creation-date="'.JFactory::getDate()->toRFC822().'"', true);
echo $content;
}
}
2 changes: 1 addition & 1 deletion administrator/components/com_config/config.php
Expand Up @@ -13,7 +13,7 @@
// Access checks are done internally because of different requirements for the two controllers.

// Tell the browser not to cache this page.
JResponse::setHeader('Expires', 'Mon, 26 Jul 1997 05:00:00 GMT', true);
JFactory::getApplication()->setHeader('Expires', 'Mon, 26 Jul 1997 05:00:00 GMT', true);

$controller = JControllerLegacy::getInstance('Config');
$controller->execute(JFactory::getApplication()->input->get('task'));
Expand Down
12 changes: 6 additions & 6 deletions administrator/components/com_config/controllers/application.php
Expand Up @@ -50,8 +50,8 @@ public function save()
// Check if the user is authorized to do this.
if (!JFactory::getUser()->authorise('core.admin'))
{
JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'));
return;
$this->setRedirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'));
$this->redirect();
}

// Set FTP credentials, if given.
Expand Down Expand Up @@ -135,8 +135,8 @@ public function cancel()
// Check if the user is authorized to do this.
if (!JFactory::getUser()->authorise('core.admin', 'com_config'))
{
JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'));
return;
$this->setRedirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'));
$this->redirect();
}

// Set FTP credentials, if given
Expand Down Expand Up @@ -164,8 +164,8 @@ public function removeroot()
// Check if the user is authorized to do this.
if (!JFactory::getUser()->authorise('core.admin'))
{
JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'));
return;
$this->setRedirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'));
$this->redirect();
}

// Initialise model.
Expand Down
4 changes: 2 additions & 2 deletions administrator/components/com_config/controllers/component.php
Expand Up @@ -79,8 +79,8 @@ public function save()
// Check if the user is authorized to do this.
if (!JFactory::getUser()->authorise('core.admin', $option))
{
JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'));
return;
$this->setRedirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'));
$this->redirect();
}

$returnUri = $this->input->post->get('return', null, 'base64');
Expand Down
Expand Up @@ -282,9 +282,10 @@ public static function sendResponse($data = null)
// Send the assigned error code if we are catching an exception.
if ($data instanceof Exception)
{
$app = JFactory::getApplication();
JLog::add($data->getMessage(), JLog::ERROR);
JResponse::setHeader('status', $data->getCode());
JResponse::sendHeaders();
$app->setHeader('status', $data->getCode());
$app->sendHeaders();
}

// Create the response object.
Expand Down
Expand Up @@ -21,7 +21,7 @@ class MediaViewImagesList extends JViewLegacy
public function display($tpl = null)
{
// Do not allow cache
JResponse::allowCache(false);
JFactory::getApplication()->allowCache(false);

$lang = JFactory::getLanguage();

Expand Down
Expand Up @@ -20,8 +20,10 @@ class MediaViewMediaList extends JViewLegacy
{
public function display($tpl = null)
{
$app = JFactory::getApplication();

// Do not allow cache
JResponse::allowCache(false);
$app->allowCache(false);

JHtml::_('behavior.framework', true);

Expand Down

0 comments on commit d962a5a

Please sign in to comment.