CoreFiles by mySites.guru
page.php87 lines, 1,841 bytes, from Joomla_3.4.0-Stable-Full_Package.zip
Raw History Compare with 3.3.6
md5
b0b1d75cecf898f9313c663fde30c24c
sha1
49e6c4d5b047f9ef2cb536b3a796a4a605a4f00b
sha256
14949160c15e4bbfb4b2ed84363a1cfa1c157fa8aaa02cc1263617ef3fd3be43
<?php
/**
 * @package     Joomla.Libraries
 * @subpackage  Error
 *
 * @copyright   Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('JPATH_PLATFORM') or die;

/**
 * Displays the custom error page when an uncaught exception occurs.
 *
 * @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());
			}

			$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)
		{
			// Try to set a 500 header if they haven't already been sent
			if (!headers_sent())
			{
				header('HTTP/1.1 500 Internal Server Error');
			}

			exit('Error displaying the error page: ' . $e->getMessage() . ': ' . $error->getMessage());
		}
	}
}

The same content is in 6 releases, Joomla 3.4.0-beta3 to 3.4.1. See them all, or every version of this file.