summaryrefslogtreecommitdiffstats
path: root/web/html/404.php
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2016-10-17 15:34:21 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2016-10-17 15:34:21 +0200
commitfdd932ff8d5e5899cfeae9a8b29011fa2cf9d439 (patch)
tree07afb8664e18e4d4fb479525b16db6edf026b72b /web/html/404.php
parentb091fb77580d56dbdca6424f9065581945b8e815 (diff)
parentc3f464f50fb35ffb7825b90437bd912051a994ee (diff)
downloadaur-fdd932ff8d5e5899cfeae9a8b29011fa2cf9d439.tar.gz
aur-fdd932ff8d5e5899cfeae9a8b29011fa2cf9d439.tar.xz
Merge branch 'master' into maint
Diffstat (limited to 'web/html/404.php')
-rw-r--r--web/html/404.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/web/html/404.php b/web/html/404.php
index a47ae1e4..757c4855 100644
--- a/web/html/404.php
+++ b/web/html/404.php
@@ -2,12 +2,45 @@
set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
+$path = $_SERVER['PATH_INFO'];
+$tokens = explode('/', $path);
+
+if (preg_match('/^([a-z0-9][a-z0-9.+_-]*?)(\.git)?$/', $tokens[1], $matches)) {
+ $gitpkg = $matches[1];
+ if (pkg_from_name($gitpkg)) {
+ $gitcmd = 'git clone ' . sprintf(config_get('options', 'git_clone_uri_anon'), htmlspecialchars($gitpkg));
+ $gitlink = get_pkgbase_uri($gitpkg);
+ } else {
+ unset($gitpkg);
+ }
+} else {
+ unset($gitpkg);
+}
+
html_header( __("Page Not Found") );
?>
<div id="error-page" class="box 404">
<h2>404 - <?= __("Page Not Found") ?></h2>
<p><?= __("Sorry, the page you've requested does not exist.") ?></p>
+ <?php if (isset($gitpkg)): ?>
+ <ul>
+ <li>
+ <strong><?= __("Note") ?>:</strong>
+ <?= __("Git clone URLs are not meant to be opened in a browser.") ?>
+ </li>
+ <li>
+ <?= __("To clone the Git repository of %s, run %s.",
+ '<strong>' . htmlspecialchars($gitpkg) . '</strong>',
+ '<code>' . htmlspecialchars($gitcmd) . '</code>') ?>
+ </li>
+ <li>
+ <?= __("Click %shere%s to return to the %s details page.",
+ '<a href="' . htmlspecialchars($gitlink, ENT_QUOTES) . '">', '</a>',
+ '<strong>' . htmlspecialchars($gitpkg) . '</strong>') ?>
+ </li>
+ </ul>
+ <?php endif; ?>
</div>
<?php