Also display README and README.TXT before directory listing.
This commit is contained in:
parent
3ba9bd8e75
commit
9ee4a4bf5a
3 changed files with 28 additions and 15 deletions
27
html/includes/readmes.php
Normal file
27
html/includes/readmes.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
$path = parse_url ('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], PHP_URL_PATH);
|
||||
if (is_dir ('/data/mirrors' . $path)) {
|
||||
if (file_exists ('/data/mirrors' . $path . 'README.md')) {
|
||||
require ('includes/Parsedown.php');
|
||||
$readme = file_get_contents ('/data/mirrors' . $path . 'README.md');
|
||||
$Parsedown = new Parsedown();
|
||||
$file = "README.md";
|
||||
} elseif (file_exists ('/data/mirrors' . $path . 'README')) {
|
||||
$readme = file_get_contents ('/data/mirrors' . $path . 'README');
|
||||
$file = "README";
|
||||
} elseif (file_exists ('/data/mirrors' . $path . 'README.TXT')) {
|
||||
$readme = file_get_contents ('/data/mirrors' . $path . 'README.TXT');
|
||||
$file = "README.TXT";
|
||||
}
|
||||
}
|
||||
if (isset ($file)) {
|
||||
?>
|
||||
<div class="box boxpadding">
|
||||
<div class="heading bold centre" id="headingtext">Content of directory's <?php print ($file); ?></div>
|
||||
<hr width="80%">
|
||||
<?php $file == "README.md" ? print ($Parsedown->text ($readme)) : print ('<pre>' . $readme . '</pre>'); ?>
|
||||
</div>
|
||||
<br>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue