- md5
- 74948b27ef01a21a40a1b8fd8503cd05
- sha1
- 1d4876165a018d101bfd931d10d6816cfc8b95ef
- sha256
- bdf90e50ffbccc0591563e9a8951ea95b1ebb598894862963e31e47ab2920616
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
<?php
/**
* @package Joomla.Libraries
* @subpackage Error
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('JPATH_BASE') or die;
/**
* Displays the custom error page when an uncaught exception occurs.
*
* @package Joomla.Libraries
* @subpackage Error
* @since 3.0
*/
class JErrorPage
{
/**
* Render the error page based on an exception.
*
* @param Exception $error The exception for which to render the error page.
*
* @return void
*
* @since 3.0
*/
public static function render(Exception $error)
{
try
{
$app = JFactory::getApplication();
$document = JDocument::getInstance('error');
if (!$document)
{
// We're probably in an CLI environment
exit($error->getMessage());
$app->close(0);
}
$config = JFactory::getConfig();
// Get the current template from the application
$template = $app->getTemplate();
// Push the error object into the document
$document->setError($error);
if (ob_get_contents())
{
ob_end_clean();
}
$document->setTitle(JText::_('Error') . ': ' . $error->getCode());
$data = $document->render(
false,
array('template' => $template,
'directory' => JPATH_THEMES,
'debug' => $config->get('debug'))
);
// Failsafe to get the error displayed.
if (empty($data))
{
exit($error->getMessage());
}
else
{
// Do not allow cache
$app->allowCache(false);
$app->setBody($data);
echo $app->toString();
}
}
catch (Exception $e)
{
exit('Error displaying the error page: ' . $e->getMessage());
}
}
}
The same content is in 2 releases, Joomla 3.2.0 to 3.2.1. See them all, or every version of this file.