-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathload-scripts.php
More file actions
64 lines (44 loc) · 1.2 KB
/
load-scripts.php
File metadata and controls
64 lines (44 loc) · 1.2 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
$dir = __DIR__ . '/';
//echo $dir . "\n";
header("Etag: " . file_get_contents($dir . 'VERSION', 1));
header('Content-Type: application/javascript; charset=UTF-8');
$expires_offset = 31536000; // 1 year
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires_offset) . ' GMT');
header("Cache-Control: public, max-age=$expires_offset");
//print_r( $_GET );
if (!isset($_GET['load']) || $_GET['load'] == '') {
die('/* no money no load! */');
}
$load = $_GET['load'];
$load = explode(',', $load);
$dir2 = '';
$by_dir = 'javascript/';
if (isset($_GET['dir'])) {
$by_dir = $_GET['dir'];
}
foreach ($load as $v) {
// echo $v . "\n";
// nếu có trong thư mục mặc định của js echbaydotcom
if (is_file($dir . $by_dir . $v)) {
echo file_get_contents($dir . $by_dir . $v, 1);
} else {
// nếu chưa có dir2 -> tìm dir2
if ($dir2 == '') {
$get_dir = $dir;
for ($i = 0; $i < 10; $i++) {
$get_dir = dirname($get_dir);
// echo $get_dir . "\n";
if (is_file($get_dir . '/' . $v)) {
$dir2 = $get_dir . '/';
break;
}
}
}
// kiểm tra lại lần nữa
// if ( $dir2 != '' ) {
echo file_get_contents($dir2 . $v, 1);
// }
}
}
exit();