This repository has been archived by the owner on Jul 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
preview.php
113 lines (105 loc) · 3.67 KB
/
preview.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
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php
include "api/internal.php";
$path = $_REQUEST["path"] ?? null;
?>
<html lang="zh-CN">
<head>
<!-- META -->
<meta charset="UTF-8"/>
<meta name="description" content="Preview file"/>
<meta name="author" content="JasonZYT"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<!-- TITLE -->
<title>Preview - <?php config->head->title ?></title>
<!-- ICON -->
<link rel="shortcut icon" href="<?php echo config->head->icon; ?>"/>
<link rel="bookmark" href="<?php echo config->head->icon; ?>"/>
<!-- LINK-CSS -->
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/css/font.css">
<link rel="stylesheet" href="assets/css/style.css">
</head>
<body>
<?php include "assets/svg/icon.svg"; ?>
<nav id="navbar" style="display:block;">
<div class="row">
<div class="container">
<div class="logo unit">
<span><?php echo config->textOnTopLeft; ?></span>
</div>
<ul class="nav-menu">
<?php
// Path on the top
if ($path != "") {
echo '<li><a href="/"><span class="i18n">Home</span><svg><use xlink:href="#AngleBracket-R" /></svg></a></li>';
} else {
echo '<li><a class="i18n" style="margin-top:0.15em;color:#000;">Home</a></li>';
}
$dirs = explode("/", $path);
$curDir = $dirs[count($dirs) - 1];
array_pop($dirs);
$path1 = "";
if ($curDir != "") {
foreach ($dirs as $d) {
if ($d == "") {
continue;
}
$path1 .= $d;
echo '<li><a href="/?dir=' . $path1 . '">' . $d . '<svg><use xlink:href="#AngleBracket-R"></use></svg></a></li>';
$path1 .= "/";
}
echo '<li><a style="margin-top:0.15em;color:#000;">' . $curDir . '</a></li>';
}
?>
</ul>
<div class="download">
<a href="download.php?path=<?php echo $path; ?>">
<svg>
<use xlink:href="#Download"/>
</svg>
<span class="i18n">Download</span>
</a>
</div>
</div>
</div>
</nav>
<section class="services-section spad">
<?php
$realPath = config->fileDirectory . $path;
if ($path == "" || !file_exists($realPath) || is_dir($realPath)) {
echo <<<EOT
<div class="not-found">
<svg><use xlink:href="#Warning"/></svg>
<span class="i18n">File <b>$path</b> NOT FOUND!</span>
</div>
EOT;
goto footer;
}
?>
<iframe src="https://www.xdocin.com/xdoc?_func=to&_format=html&_cache=1&_xdoc=<?php echo getFullHostName() . config->fileDirectory . $path; ?>&embedded=true"
style="width:100%;height:100%;"></iframe>
</section>
<?php
footer:
echo <<<EOT
<footer>
<p>
<a href="https://github.com/Jasonzyt/File-Web-Repository">File-Web-Repository</a> v2.0.0
</p>
<p>©2020-2022 All Rights Reserved.</p>
<p>Powered By JasonZYT</p>
<p id="hitokoto"></p>
<script src="https://v1.hitokoto.cn/?encode=js&select=%23hitokoto" defer=""></script>
</footer>
EOT;
?>
</body>
<script type="text/javascript" src="assets/js/i18n.js"></script>
<script>
<?php
if (isset($_COOKIE["lang"])) echo "langCode = '" . $_COOKIE["lang"] . "';";
?>
fullLang = <?php include "I18N.json"; ?>;
do_i18n();
</script>
</html>