-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanifest.php
executable file
·36 lines (29 loc) · 1005 Bytes
/
manifest.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
<?php
// Add the correct Content-Type for the cache manifest
header('Content-Type: text/cache-manifest');
// Write the first line
echo "CACHE MANIFEST\n";
// Initialize the $hashes string
$hashes = "";
$dir = new RecursiveDirectoryIterator(".");
// Iterate through all the files/folders in the current directory
foreach(new RecursiveIteratorIterator($dir) as $file) {
$info = pathinfo($file);
// If the object is a file
// and it's not called manifest.php (this file),
// and it's not the admin
// and it's not a dotfile, add it to the list
if ($file->IsFile()
&& $file != "./manifest.php"
&& $file != "admin"
&& substr($file->getFilename(), 0, 1) != ".")
{
// Replace spaces with %20 or it will break
echo str_replace(' ', '%20', $file) . "\n";
// Add this file's hash to the $hashes string
$hashes .= md5_file($file);
}
}
// Hash the $hashes string and output
echo "# Hash: " . md5($hashes) . "\n";
?>