index.php 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. <?php
  2. require('functions.php');
  3. ?>
  4. <!DOCTYPE html>
  5. <html lang="de">
  6. <head>
  7. <meta charset="utf-8">
  8. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  9. <meta name="viewport" content="width=device-width, initial-scale=1">
  10. <title>WebVideoViewer</title>
  11. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" integrity="sha512-dTfge/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ==" crossorigin="anonymous">
  12. <style>
  13. h1 {
  14. font-size: 8vw;
  15. }
  16. #logo {
  17. margin: 0 auto;
  18. text-align: center;
  19. }
  20. #logo > img {
  21. width: 100%;
  22. }
  23. .col-sm-3 > div > a > img {
  24. width: 100%;
  25. }
  26. .col-sm-3 {
  27. padding-bottom: 15px;
  28. min-height: 500px;
  29. }
  30. .col-sm-3.episode {
  31. min-height: 50px;
  32. }
  33. .col-sm-3.episode > div > a > img {
  34. min-height: 50px;
  35. max-height: 170px;
  36. }
  37. .col-sm-3.folder-up-episode img {
  38. max-height: 225px;
  39. }
  40. .image-zoom {
  41. overflow: hidden;
  42. }
  43. .image-zoom img {
  44. -webkit-transition: all 1s ease; /* Safari and Chrome */
  45. -moz-transition: all 1s ease; /* Firefox */
  46. -ms-transition: all 1s ease; /* IE 9 */
  47. -o-transition: all 1s ease; /* Opera */
  48. transition: all 1s ease;
  49. }
  50. .image-zoom:hover img {
  51. -webkit-transform:scale(1.15); /* Safari and Chrome */
  52. -moz-transform:scale(1.15); /* Firefox */
  53. -ms-transform:scale(1.15); /* IE 9 */
  54. -o-transform:scale(1.15); /* Opera */
  55. transform:scale(1.15);
  56. }
  57. .episode-title {
  58. padding-top: 15px;
  59. }
  60. @media only screen and (max-width : 480px) {
  61. .col-sm-3 {
  62. text-align: center;
  63. }
  64. }
  65. </style>
  66. </head>
  67. <body>
  68. <div id="logo">
  69. <img src="moeflix.png" alt="moeflix">
  70. </div>
  71. <div class="container-fluid">
  72. <?php
  73. $CONFIG = array(
  74. "paths" => array(
  75. "/media/Serien",
  76. "/media/Filme"
  77. )
  78. );
  79. if(!isset($_GET['path']) || !$_GET['path']) {
  80. foreach($CONFIG['paths'] as $path) {
  81. $folderName = split('/', $path);
  82. echo "<h1>" . $folderName[sizeof($folderName) - 1] . "</h1>";
  83. $list = scandir($path);
  84. $list = array_diff($list, array('.', '..'));
  85. echo "<div class=\"row\">";
  86. foreach($list as $object) {
  87. $name = str_split($object, sizeof($object));
  88. if($name[0] == "." && $name[1] != ".") {
  89. continue;
  90. }
  91. echo "<div class=\"col-sm-3\"><div class=\"image-zoom\">";
  92. echo "<a href=\"?path=" . $path . "/" . $object . "\">" . "<img class=\"img-responsive\" src=\"" . getImageByName($path . "/" . $object) . "\" alt=\"" . $object . "\">" . "</a>";
  93. echo "</div></div>";
  94. }
  95. echo "</div>";
  96. }
  97. } else {
  98. $_GET['path'] = str_replace('/..', '', $_GET['path']);
  99. $_GET['path'] = str_replace('../', '', $_GET['path']);
  100. $_GET['path'] = str_replace('..', '', $_GET['path']);
  101. echo "<h1>" . $_GET['path'] . "</h1>";
  102. if(is_dir($_GET['path'])) {
  103. $list = scandir($_GET['path']);
  104. $list = array_diff($list, array('.', 'queue.hbq'));
  105. echo "<div class=\"row\">";
  106. foreach($list as $object) {
  107. $name = explode('.', $object);
  108. if($name[sizeof($name) - 1] == "srt") {
  109. continue;
  110. }
  111. $name = str_split($object, sizeof($object));
  112. if($name[0] == "." && $name[1] != ".") {
  113. continue;
  114. }
  115. if($object == "..") {
  116. if(in_array($_GET['path'], $CONFIG['paths'])) {
  117. echo "<div class=\"col-sm-3\"><div class=\"image-zoom\">";
  118. echo "<a href=\"?path=\"><img src=\"folder_up.png\" alt=\"folder up\"></a>";
  119. echo "</div></div>";
  120. } else {
  121. $paths = explode('/', $_GET['path']);
  122. $season = $paths[sizeof($paths) - 1];
  123. $paths = array_diff($paths, array($paths[sizeof($paths) - 1]));
  124. $pathv = "";
  125. foreach($paths as $key => $path) {
  126. if($key == sizeof($paths) - 1) {
  127. $pathv .= $path;
  128. } else {
  129. $pathv .= $path . "/";
  130. }
  131. }
  132. if(preg_match_all("/(S[0-9]+)/", $season, $output)) {
  133. echo "<div class=\"col-sm-3 episode folder-up-episode\"><div class=\"image-zoom\">";
  134. echo "<a href=\"?path=" . $pathv . "\"><img src=\"folder_up.png\" alt=\"folder up\"></a>";
  135. echo "</div></div>";
  136. } else {
  137. echo "<div class=\"col-sm-3\"><div class=\"image-zoom\">";
  138. echo "<a href=\"?path=" . $pathv . "\"><img src=\"folder_up.png\" alt=\"folder up\"></a>";
  139. echo "</div></div>";
  140. }
  141. }
  142. } else {
  143. if(preg_match_all("/([a-zA-Z0-9.*]+)-[S|s]([0-9]+)[E|e]([0-9]+)-([a-zA-Z0-9.-]+)\.([a-zA-Z0-9\(\).*\w]+)/", $object, $output)) {
  144. echo "<div class=\"col-sm-3 episode\"><div class=\"image-zoom\">";
  145. echo "<a href=\"?path=" . $_GET['path'] . "/" . $object . "\">" . "<img class=\"img-responsive\" src=\"" . getImageByName($_GET['path'] . "/" . $object) . "\" alt=\"" . $object . "\">";
  146. echo "<div class=\"episode-title\">" . (string) $output[3][0] . " - " . str_replace('.', ' ', $output[4][0]) . "</div>";
  147. } else {
  148. echo "<div class=\"col-sm-3\"><div class=\"image-zoom\">";
  149. echo "<a href=\"?path=" . $_GET['path'] . "/" . $object . "\">" . "<img class=\"img-responsive\" src=\"" . getImageByName($_GET['path'] . "/" . $object) . "\" alt=\"" . $object . "\">";
  150. }
  151. echo "</a></div></div>";
  152. }
  153. }
  154. echo "</div>";
  155. } else {
  156. $paths = explode('/', $_GET['path']);
  157. $paths = array_diff($paths, array($paths[sizeof($paths) - 1]));
  158. $pathv = "";
  159. foreach($paths as $key => $path) {
  160. if($key == sizeof($paths) - 1) {
  161. $pathv .= $path;
  162. } else {
  163. $pathv .= $path . "/";
  164. }
  165. }
  166. $mime = explode(';', finfo_file(finfo_open(FILEINFO_MIME), $_GET['path']));
  167. echo "<a href=\"?path=" . $pathv . "\">Back</a> | <a href=\"readfile.php?file=" . $_GET['path'] . "\">Download</a><br>";
  168. echo "<video width=\"auto\" height=\"auto\" controls>";
  169. echo "<source src=\"readfile.php?file=" . $_GET['path'] . "\" type=\"" . $mime[0] . "\">";
  170. echo "Your browser does not support the video tag.";
  171. echo "</video>";
  172. }
  173. }
  174. ?>
  175. </div>
  176. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
  177. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js" integrity="sha512-K1qjQ+NcF2TYO/eI3M6v8EiNYZfA95pQumfvcVrTHtwQVDG+aHRqLi/ETn2uB+1JqwYqVG3LIvdm9lj6imS/pQ==" crossorigin="anonymous"></script>
  178. </body>
  179. </html>