index.php 8.9 KB

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