dir.php 1.7 KB

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