1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <?php
- require_once('include/config.php');
- require_once('include/db.php');
- $dir = @$_GET['dir'];
- $file = @$_GET['file'];
- if (empty($dir) || empty($file)) {
- die('Niepoprawne żądanie');
- }
- $dirinfo = get_dir_info($dir);
- if (!$dirinfo) {
- die('Nie ma katalogu');
- }
- $images = get_dir_images($dir);
- $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']);
- $content = '<div><a class="gora" href="dir.php?dir='.$dirhtml.'"></a><a id="poprz" ';
- if ($prev) {
- $prevhtml = urlencode($prev['path']);
- $content .= 'href="image.php?file='.$prevhtml.'&dir='.$dirhtml.'"';
- } 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.'"';
- }
- $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.'"';
- } else {
- $content .= 'style="display:none;"';
- }
- $content .= '></a>';
- $dirname = htmlspecialchars($dirinfo['name']);
- ?><!DOCTYPE html>
- <html>
- <head>
- <title>Obrazki: <?=$dirname?></title>
- <link rel="stylesheet" href="/obrazki/style.css" type="text/css">
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <script type="text/javascript" src="https://k4be.pl/jquery/jquery-3.6.3.min.js"></script>
- <script type="text/javascript" src="obrazki.js"></script>
- </head>
- <body>
- <h1>Obrazki: <?=$dirname?></h1>
- <?=$content?>
- <a class="k4" href="http://k4be.pl/"></a>
- </body>
- </html>
|