index.php 8.4 KB

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