index.php 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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. .col-sm-3 > div > a > img {
  14. width: 100%;
  15. }
  16. .col-sm-3 {
  17. padding-bottom: 15px;
  18. }
  19. .image-zoom {
  20. overflow: hidden;
  21. }
  22. .image-zoom img {
  23. -webkit-transition: all 1s ease; /* Safari and Chrome */
  24. -moz-transition: all 1s ease; /* Firefox */
  25. -ms-transition: all 1s ease; /* IE 9 */
  26. -o-transition: all 1s ease; /* Opera */
  27. transition: all 1s ease;
  28. }
  29. .image-zoom:hover img {
  30. -webkit-transform:scale(1.15); /* Safari and Chrome */
  31. -moz-transform:scale(1.15); /* Firefox */
  32. -ms-transform:scale(1.15); /* IE 9 */
  33. -o-transform:scale(1.15); /* Opera */
  34. transform:scale(1.15);
  35. }
  36. </style>
  37. </head>
  38. <body>
  39. <div class="container-fluid">
  40. <?php
  41. $CONFIG = array(
  42. "paths" => array(
  43. "/media/Serien",
  44. "/media/Filme"
  45. )
  46. );
  47. if(!isset($_GET['path']) || !$_GET['path']) {
  48. foreach($CONFIG['paths'] as $path) {
  49. $folderName = split('/', $path);
  50. echo "<h1>" . $folderName[sizeof($folderName) - 1] . "</h1>";
  51. $list = scandir($path);
  52. $list = array_diff($list, array('.', '..'));
  53. echo "<div class=\"row\">";
  54. foreach($list as $object) {
  55. echo "<div class=\"col-sm-3\"><div class=\"image-zoom\">";
  56. echo "<a href=\"?path=" . $path . "/" . $object . "\">" . "<img src=\"" . getImageByName($object) . "\" alt=\"" . $object . "\">" . "</a><br>";
  57. echo "</div></div>";
  58. }
  59. echo "</div>";
  60. }
  61. } else {
  62. $_GET['path'] = str_replace('/..', '', $_GET['path']);
  63. $_GET['path'] = str_replace('../', '', $_GET['path']);
  64. $_GET['path'] = str_replace('..', '', $_GET['path']);
  65. echo "<h1>" . $_GET['path'] . "</h1>";
  66. if(is_dir($_GET['path'])) {
  67. $list = scandir($_GET['path']);
  68. $list = array_diff($list, array('.'));
  69. foreach($list as $object) {
  70. if($object == "..") {
  71. if(in_array($_GET['path'], $CONFIG['paths'])) {
  72. echo "<a href=\"?path=\">Home</a><br>";
  73. } else {
  74. $paths = explode('/', $_GET['path']);
  75. $paths = array_diff($paths, array($paths[sizeof($paths) - 1]));
  76. $pathv = "";
  77. foreach($paths as $key => $path) {
  78. if($key == sizeof($paths) - 1) {
  79. $pathv .= $path;
  80. } else {
  81. $pathv .= $path . "/";
  82. }
  83. }
  84. echo "<a href=\"?path=" . $pathv . "\">" . $object . "</a><br>";
  85. }
  86. } else {
  87. echo "<a href=\"?path=" . $_GET['path'] . "/" . $object . "\">" . $object . "</a><br>";
  88. }
  89. }
  90. } else {
  91. $paths = explode('/', $_GET['path']);
  92. $paths = array_diff($paths, array($paths[sizeof($paths) - 1]));
  93. $pathv = "";
  94. foreach($paths as $key => $path) {
  95. if($key == sizeof($paths) - 1) {
  96. $pathv .= $path;
  97. } else {
  98. $pathv .= $path . "/";
  99. }
  100. }
  101. $mime = explode(';', finfo_file(finfo_open(FILEINFO_MIME), $_GET['path']));
  102. echo "<a href=\"?path=" . $pathv . "\">Back</a> | <a href=\"readfile.php?file=" . $_GET['path'] . "\">Download</a><br>";
  103. echo "<video width=\"auto\" height=\"auto\" controls>";
  104. echo "<source src=\"readfile.php?file=" . $_GET['path'] . "\" type=\"" . $mime[0] . "\">";
  105. echo "Your browser does not support the video tag.";
  106. echo "</video>";
  107. }
  108. }
  109. ?>
  110. </div>
  111. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
  112. <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>
  113. </body>
  114. </html>