Skip to content

Commit

Permalink
error pages
Browse files Browse the repository at this point in the history
  • Loading branch information
mirekys committed Jun 7, 2021
1 parent 35ea942 commit ceb65fe
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 3 deletions.
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<description>Custom theme for the ownCloud@CESNET server.</description>
<licence>AGPL</licence>
<author>Miroslav Bauer @ CESNET</author>
<version>2.0.0a14</version>
<version>2.0.0a15</version>
<types>
<theme/>
</types>
Expand Down
6 changes: 5 additions & 1 deletion core/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ button.primary:focus,
}

.is-xsmall {
font-size: 0.65rem !important;
font-size: 0.75rem !important;
}

.message {
Expand All @@ -118,6 +118,10 @@ button.primary:focus,
color: white !important;
}

.message.is-danger .message-body {
border-color: #E60000 !important;
}

.hero-title {
font-size: 6rem !important;
}
21 changes: 21 additions & 0 deletions core/templates/403.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
// @codeCoverageIgnoreStart
if (!isset($_)) {//also provide standalone error page
require_once '../../lib/base.php';

$tmpl = new OC_Template('', '403', 'guest');
$tmpl->printPage();
exit;
}
// @codeCoverageIgnoreEnd
?>
<h1 class="title is-1"><?php p($l->t('Access forbidden')); ?></h1>
<ul class="message is-danger">
<li class='message-body'>
<br>
<p class='hint'><?php if (isset($_['file'])) {
p($_['file']);
}?></p>
</li>
</ul>
<a class="button" <?php print_unescaped(\OC_User::getLogoutAttribute()); ?>"><?php p($l->t('Return to login page')); ?></a>
25 changes: 25 additions & 0 deletions core/templates/404.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
/** @var $_ array */
/** @var $l \OCP\IL10N */
/** @var $theme OC_Theme */
// @codeCoverageIgnoreStart
if (!isset($_)) {//also provide standalone error page
require_once '../../lib/base.php';

$tmpl = new OC_Template('', '404', 'guest');
$tmpl->printPage();
exit;
}
// @codeCoverageIgnoreEnd
?>
<?php if (isset($_['content'])): ?>
<?php print_unescaped($_['content']) ?>
<?php else: ?>
<h1 class="title is-1"><?php p($l->t('File not found')); ?></h1>
<ul class="message is-danger">
<li class="message-body">
<p class="hint"><?php p($l->t('The specified document has not been found on the server.')); ?></p>
<p class="hint"><a href="<?php p(\OC::$server->getURLGenerator()->linkTo('', 'index.php')) ?>"><?php p($l->t('You can click here to return to %s.', [$theme->getName()])); ?></a></p>
</li>
</ul>
<?php endif; ?>
12 changes: 12 additions & 0 deletions core/templates/error.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<h1 class="title is-1">Error</h1>
<ul class="message is-danger">
<?php foreach ($_["errors"] as $error):?>
<li class='message-body'>
<?php p($error['error']) ?><br>
<?php if (isset($error['hint']) && $error['hint']): ?>
<p class='hint'><?php p($error['hint']) ?></p>
<?php endif;?>
</li>
<?php endforeach ?>
</ul>
<a class="button" <?php print_unescaped(\OC_User::getLogoutAttribute()); ?>"><?php p($l->t('Return to login page')); ?></a>
33 changes: 33 additions & 0 deletions core/templates/exception.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
/** @var array $_ */
/** @var \OCP\IL10N $l */

style('core', ['styles', 'header']);
?>
<h2 class="title is-1"><?php p($l->t('Internal Server Error')) ?></h2>
</div>
<p class="subtitle is-4"><?php p($l->t('The server encountered an internal error and was unable to complete your request.')) ?></p>
<p class="subtitle is-6"><?php p($l->t('Please contact the server administrator if this error reappears multiple times and include the technical details below in your report.')) ?></p>
<p><?php print_unescaped($l->t('More details can be found in the <a target="_blank" rel="noreferrer" href="%s">server log</a>.', [link_to_docs('admin-logfiles')])); ?></p>
<br>
<h2 class="title is-3"><strong><?php p($l->t('Technical details')) ?></strong></h2>
<div class="message is-danger">
<ul class="message-body">
<li><?php p($l->t('Remote Address: %s', $_['remoteAddr'])) ?></li>
<li><?php p($l->t('Request ID: %s', $_['requestID'])) ?></li>
<?php if ($_['debugMode']): ?>
<li><?php p($l->t('Type: %s', $_['errorClass'])) ?></li>
<li><?php p($l->t('Code: %s', $_['errorCode'])) ?></li>
<li><?php p($l->t('Message: %s', $_['errorMsg'])) ?></li>
<li><?php p($l->t('File: %s', $_['file'])) ?></li>
<li><?php p($l->t('Line: %s', $_['line'])) ?></li>
<?php endif; ?>
</ul>
</div>

<?php if ($_['debugMode']): ?>
<br />
<h2><strong><?php p($l->t('Trace')) ?></strong></h2>
<pre><?php p($_['trace']) ?></pre>
<?php endif; ?>
</span>
2 changes: 1 addition & 1 deletion core/templates/layout.guest.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class="button is-primary is-inverted">
</div>
<footer class="hero-foot" role="contentinfo">
<div class="content has-text-weight-light has-text-centered">
<p>
<p class="is-xsmall">
<?php print_unescaped($theme->getLongFooter()); ?>
</p>
</div>
Expand Down

0 comments on commit ceb65fe

Please sign in to comment.