47 lines
1.8 KiB
PHP
47 lines
1.8 KiB
PHP
<?php
|
|
/*
|
|
simple-gitv - a simple, libre web-based Git project viewer
|
|
Copyright (C) 2020
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU Affero General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU Affero General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
// only include license link if license file found
|
|
$license = get_license(list_files($git_dir));
|
|
if (!empty($license)) {
|
|
$license_path = "$project/blob/$branch/$license";
|
|
$current = strip_trailing_slash($url) === $license_path ? " class=\"current\"" : "";
|
|
}
|
|
echo "\t\t<div id=\"menu\">\n";
|
|
echo "\t\t\t<ul>\n";
|
|
|
|
// code link
|
|
echo "\t\t\t\t<li><a href=\"/$project\"" . (($page_type === "repo" || $page_type === "tree" || $page_type === "blob" && empty($current)) ? " class=\"current\"" : "") . ">Code</a></li>\n";
|
|
|
|
// commits link
|
|
echo "\t\t\t\t<li><a href=\"/$project/commits\"" . (($page_type === "commits" || $page_type === "commit") ? " class=\"current\"" : "") . ">Commits</a></li>\n";
|
|
|
|
// tags link
|
|
echo "\t\t\t\t<li><a href=\"/$project/tags\"" . (($page_type === "tags" || $page_type === "tag") ? " class=\"current\"" : "") . ">Tags</a></li>\n";
|
|
|
|
// license link (if project has a license)
|
|
if (!empty($license)) {
|
|
echo
|
|
"\t\t\t\t<li><a href=\"/$license_path\"$current>License</a></li>\n";
|
|
}
|
|
|
|
echo "\t\t\t</ul>\n";
|
|
echo "\t\t</div>\n";
|
|
echo "\t\t<br/>\n\n";
|