index.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
  3. if (!empty($_REQUEST['path'])) {
  4. $path = $_REQUEST['path'];
  5. if (is_readable($path) && !empty($_REQUEST['raw'])) {
  6. //print file_get_contents($path);
  7. exec (VESTA_CMD . "v-check-fs-permission {$user} {$path}", $content, $return_var);
  8. if ($return_var != 0) {
  9. print 'Error while opening file'; // todo: handle this more styled
  10. exit;
  11. }
  12. header('content-type: image/jpeg');
  13. print file_get_contents($path);
  14. exit;
  15. }
  16. }
  17. else {
  18. die('File not found');
  19. }
  20. ?>
  21. <!DOCTYPE html>
  22. <html>
  23. <head>
  24. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  25. <title>fotorama</title>
  26. <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
  27. <link href="//cdnjs.cloudflare.com/ajax/libs/fotorama/4.6.2/fotorama.css" rel="stylesheet">
  28. <script src="//cdnjs.cloudflare.com/ajax/libs/fotorama/4.6.2/fotorama.js"></script>
  29. </head>
  30. <body>
  31. <div style="background-color: #eee; /*display: inline-block; vertical-align: middle;*/ height: 100%; text-align: center; /*position: absolute; /*top: 50%; left: 50%; margin-top: -50px; margin-left: -50px; /*data-maxheight="100%" data-maxwidth="100%" */"
  32. class="fotoram" data-fit="scaledown" data-allowfullscreen="true" data-nav="false">
  33. <img src="/view/file/?path=<?=$path?>&raw=true" style="background: #3A6F9A; vertical-align: middle; /*max-height: 25px; max-width: 160px;*/" />
  34. </div>
  35. </body>
  36. </html>