forked from joomla/joomla-cms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror.php
More file actions
116 lines (106 loc) · 5.65 KB
/
error.php
File metadata and controls
116 lines (106 loc) · 5.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?php
/**
* @package Joomla.Site
* @subpackage Template.system
*
* @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
\defined('_JEXEC') or die;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Factory;
/** @var Joomla\CMS\Document\ErrorDocument $this */
if (!isset($this->error)) {
$this->error = new Exception(Text::_('JERROR_ALERTNOAUTHOR'));
$this->debug = false;
}
// Load template CSS file
$this->getWebAssetManager()->registerAndUseStyle('template.system.error', 'media/system/css/system-site-error.css');
if ($this->direction === 'rtl') {
$this->getWebAssetManager()->registerAndUseStyle('template.system.error_rtl', 'media/system/css/system-site-error_rtl.css');
}
// Set page title
$this->setTitle($this->error->getCode() . ' - ' . htmlspecialchars($this->error->getMessage(), ENT_QUOTES, 'UTF-8'));
// Get the error code
$errorCode = $this->error->getCode();
$app = Factory::getApplication();
$input = $app->getInput();
$sharedSessionsEnabled = (bool) $app->get('shared_session', '0');
$isPreviewComponent = $input->getCmd('tmpl') === 'component';
$isArticleNotFound = $this->error->getMessage() === Text::_('COM_CONTENT_ERROR_ARTICLE_NOT_FOUND');
$showSharedSessionsHint = $errorCode === 404 && !$sharedSessionsEnabled && $isPreviewComponent && $isArticleNotFound;
?>
<!DOCTYPE html>
<html lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>">
<head>
<jdoc:include type="metas" />
<jdoc:include type="styles" />
<jdoc:include type="scripts" />
</head>
<body>
<div class="error">
<div id="outline">
<div id="errorboxoutline">
<?php if ($this->countModules('error-' . $errorCode)) : ?>
<jdoc:include type="modules" name="error-<?php echo $errorCode; ?>" style="none" />
<?php else : ?>
<div id="errorboxheader"><?php echo $this->error->getCode(); ?> - <?php echo htmlspecialchars($this->error->getMessage(), ENT_QUOTES, 'UTF-8'); ?></div>
<div id="errorboxbody">
<p><strong><?php echo Text::_('JERROR_LAYOUT_NOT_ABLE_TO_VISIT'); ?></strong></p>
<ul>
<li><?php echo Text::_('JERROR_LAYOUT_AN_OUT_OF_DATE_BOOKMARK_FAVOURITE'); ?></li>
<li><?php echo Text::_('JERROR_LAYOUT_SEARCH_ENGINE_OUT_OF_DATE_LISTING'); ?></li>
<li><?php echo Text::_('JERROR_LAYOUT_MISTYPED_ADDRESS'); ?></li>
<li><?php echo Text::_('JERROR_LAYOUT_YOU_HAVE_NO_ACCESS_TO_THIS_PAGE'); ?></li>
<li><?php echo Text::_('JERROR_LAYOUT_REQUESTED_RESOURCE_WAS_NOT_FOUND'); ?></li>
<li><?php echo Text::_('JERROR_LAYOUT_ERROR_HAS_OCCURRED_WHILE_PROCESSING_YOUR_REQUEST'); ?></li>
</ul>
<?php if ($showSharedSessionsHint) : ?>
<p><strong><?php echo Text::_('JERROR_PREVIEW_SHARED_SESSIONS_HINT_TITLE'); ?></strong></p>
<p><?php echo Text::_('JERROR_PREVIEW_SHARED_SESSIONS_HINT_BODY'); ?></p>
<?php endif; ?>
<p><strong><?php echo Text::_('JERROR_LAYOUT_PLEASE_TRY_ONE_OF_THE_FOLLOWING_PAGES'); ?></strong></p>
<ul>
<li><a href="<?php echo Uri::root(true); ?>/index.php"><?php echo Text::_('JERROR_LAYOUT_HOME_PAGE'); ?></a></li>
</ul>
<p><?php echo Text::_('JERROR_LAYOUT_PLEASE_CONTACT_THE_SYSTEM_ADMINISTRATOR'); ?></p>
<?php endif; ?>
<div id="techinfo">
<p>
<?php echo htmlspecialchars($this->error->getMessage(), ENT_QUOTES, 'UTF-8'); ?>
<?php if ($this->debug) : ?>
<br><?php echo htmlspecialchars($this->error->getFile(), ENT_QUOTES, 'UTF-8');?>:<?php echo $this->error->getLine(); ?>
<?php endif; ?>
</p>
<?php if ($this->debug) : ?>
<div>
<?php echo $this->renderBacktrace(); ?>
<?php // Check if there are more Exceptions and render their data as well?>
<?php if ($this->error->getPrevious()) : ?>
<?php $loop = true; ?>
<?php // Reference $this->_error here and in the loop as setError() assigns errors to this property and we need this for the backtrace to work correctly?>
<?php // Make the first assignment to setError() outside the loop so the loop does not skip Exceptions?>
<?php $this->setError($this->_error->getPrevious()); ?>
<?php while ($loop === true) : ?>
<p><strong><?php echo Text::_('JERROR_LAYOUT_PREVIOUS_ERROR'); ?></strong></p>
<p>
<?php echo htmlspecialchars($this->_error->getMessage(), ENT_QUOTES, 'UTF-8'); ?>
<br><?php echo htmlspecialchars($this->_error->getFile(), ENT_QUOTES, 'UTF-8');?>:<?php echo $this->_error->getLine(); ?>
</p>
<?php echo $this->renderBacktrace(); ?>
<?php $loop = $this->setError($this->_error->getPrevious()); ?>
<?php endwhile; ?>
<?php // Reset the main error object to the base error?>
<?php $this->setError($this->error); ?>
<?php endif; ?>
</div>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
<jdoc:include type="modules" name="debug" style="none" />
</body>
</html>