forked from sputnikenmeister/autoindex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
39 lines (29 loc) · 996 Bytes
/
index.php
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
<?php
/*------------------------------------------------------------------------------
Execute
------------------------------------------------------------------------------*/
include_once 'libs/autoindex.php';
include_once 'libs/markdown.php';
$view = new View();
$view->load('standard');
/*----------------------------------------------------------------------------*/
// Allow anything:
$view->allow('%.%');
// Ignore OSX meta data:
$view->deny('%/\.(Apple|DS_)%');
$view->deny('%/(Network Trash Folder|Temporary Items)$%');
// Ignore hidden files:
$view->deny('%/\.%');
// Allow itself:
$view->allow('%/\.?autoindex(/|$)%');
// Add readme files:
$view->readme('%/readme(\.txt)?$%i');
$view->readme('%/readme\.md$%i', function($text) {
return Markdown($text);
});
$view->readme('%/readme\.html?$%i', function($text) {
return $text;
});
$view->execute()->display();
/*----------------------------------------------------------------------------*/
?>