123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- <?php
- require_once('include/config.php');
- require_once('include/db.php');
- require_once('include/comment.php');
- $dir = @$_GET['dir'];
- $file = @$_GET['file'];
- if (empty($dir) || empty($file)) {
- die('Niepoprawne żądanie');
- }
- $mode = @$_GET['mode'];
- $dirinfo = get_dir_info($dir);
- if (!$dirinfo) {
- die('Nie ma katalogu');
- }
- $images = get_dir_images($dir, $mode);
- $found = false;
- $prev = null;
- $next = null;
- $fileinfo = null;
- foreach ($images as $image) { // finding prev and next
- if (!$found) { // find current and previous one
- if ($image['path'] == $file) { // the current one
- $fileinfo = $image;
- $found = true;
- continue;
- }
- $prev = $image;
- } else {
- $next = $image;
- break;
- }
- }
- if (!$fileinfo) {
- die('File not found');
- }
- $dirhtml = urlencode($dirinfo['path']);
- $filehtml = urlencode($fileinfo['path']);
- if ($mode) {
- $modehtml = '&mode=' . urlencode($mode);
- } else {
- $modehtml = '';
- };
- $content = '<div class="full-image-div"><a class="gora" href="dir.php?dir='.$dirhtml.$modehtml.'"></a><a id="poprz" ';
- if ($prev) {
- $prevhtml = urlencode($prev['path']);
- $content .= 'href="image.php?file='.$prevhtml.'&dir='.$dirhtml.$modehtml.'"';
- } else {
- $content .= 'style="display:none;"';
- }
- $content .= '></a><div><a id="imagelink"';
- if ($next) {
- $nexthtml = urlencode($next['path']);
- $content .= ' href="image.php?file='.$nexthtml.'&dir='.$dirhtml.$modehtml.'"';
- }
- $content .= '><img id="image" src="'.$config['imagepath'] . $dirhtml.'/'.$filehtml.'" class="pelny"/></a><a id="nast" ';
- if ($next) {
- $content .= 'href="image.php?file='.$nexthtml.'&dir='.$dirhtml.$modehtml.'"';
- } else {
- $content .= 'style="display:none;"';
- }
- $content .= '></a>';
- $dirname = htmlspecialchars($dirinfo['name']);
- if ($mode == 'viewcomments') {
- $dirname .= ' (tylko komentarze)';
- }
- $comments_data = get_comments($fileinfo['id'], 'image');
- $comments = generate_comment_field($comments_data, 'image', $fileinfo['id']);
- ?><!DOCTYPE html>
- <html>
- <head>
- <title>Obrazki: <?=$dirname?></title>
- <link rel="stylesheet" href="style.css?<?=$time?>" type="text/css">
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <script type="text/javascript">
- const imageUrlPrefix = '<?=$config['imagepath']?>';
- const scriptUrlPrefix = '<?=$config['basepath']?>';
- const mode = '<?=$mode?>';
- </script>
- <script type="text/javascript" src="https://k4be.pl/jquery/jquery-3.6.3.min.js"></script>
- <script type="text/javascript" src="image.js?<?=$time?>"></script>
- <script type="text/javascript" src="comment.js?<?=$time?>"></script>
- </head>
- <body>
- <h1>Obrazki: <?=$dirname?></h1>
- <div id="image-frame">
- <?=$content?>
- </div>
- <div id="comments">
- <?=$comments?>
- </div>
- <a class="k4" href="http://k4be.pl/"></a>
- </body>
- </html>
|