dir.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. require_once('include/config.php');
  3. require_once('include/db.php');
  4. require_once('include/comment.php');
  5. $dir = @$_GET['dir'];
  6. if (empty($dir)) {
  7. die('Niepoprawne żądanie');
  8. }
  9. $mode = @$_GET['mode'];
  10. $dirinfo = get_dir_info($dir);
  11. if (!$dirinfo) {
  12. die('Nie ma katalogu');
  13. }
  14. $images = get_dir_images($dir, $mode);
  15. $content = '';
  16. foreach ($images as $image) {
  17. $path = rawurlencode($image['path']);
  18. $content .= '<a href="image.php?dir='.$dir.'&amp;file='.$path;
  19. if ($mode) {
  20. $content .= '&mode=' . urlencode($mode);
  21. }
  22. $content .= '"><img src="' . $config['thumbnailpath'] . urlencode($dir) . '/' . $config['thumbnailsize'] . '-' . $path . '" alt="Obrazek"/></a>';
  23. }
  24. if (!$images || count($images) == 0) {
  25. $content = 'Katalog jest pusty!';
  26. }
  27. $dirname = htmlspecialchars($dirinfo['name']);
  28. if ($mode == 'viewcomments') {
  29. $dirname .= ' (tylko komentarze)';
  30. }
  31. $comments_data = get_comments($dirinfo['id'], 'dir');
  32. $comments = generate_comment_field($comments_data, 'dir', $dirinfo['id']);
  33. $topcomment = '';
  34. if ($dirinfo['comment']) {
  35. $topcomment = '<h3>' . htmlspecialchars($dirinfo['comment']) . '</h3>';
  36. }
  37. $mode = json_encode($mode);
  38. ?><!DOCTYPE html>
  39. <html>
  40. <head>
  41. <title>Obrazki: <?=$dirname?></title>
  42. <link rel="stylesheet" href="style.css?<?=$time?>" type="text/css">
  43. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  44. <script type="text/javascript">
  45. const imageUrlPrefix = '<?=$config['imagepath']?>';
  46. const scriptUrlPrefix = '<?=$config['basepath']?>';
  47. const mode = '<?=$mode?>';
  48. </script>
  49. <script type="text/javascript" src="https://k4be.pl/jquery/jquery-3.6.3.min.js"></script>
  50. <script type="text/javascript" src="comment.js?<?=$time?>"></script>
  51. </head>
  52. <body>
  53. <h1>Obrazki: <?=$dirname?></h1>
  54. <div id="image-list">
  55. <a class="gora" href="."></a><h2>... wybierz dowolny obrazek, najlepiej pierwszy.</h2>
  56. <?=$topcomment?>
  57. <?=$content?>
  58. </div>
  59. <div id="comments">
  60. <?=$comments?>
  61. </div>
  62. <a class="k4" href="http://k4be.pl/"></a>
  63. </body>
  64. </html>