index.php 8.7 KB

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