0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; if (!$res) die("Include of main fails"); require_once __DIR__.'/../lib/bericht.lib.php'; if (!$user->hasRight('bericht', 'read')) accessforbidden(); $relpath = GETPOST('relpath', 'alpha'); // GETPOST 'alpha' wuerde Slashes behalten, aber Umlaute/Leerzeichen in Dateinamen // killen - deshalb den Rohwert nehmen und selbst absichern. if (isset($_GET['relpath'])) $relpath = $_GET['relpath']; $maxside = GETPOSTINT('w'); if ($maxside <= 0) $maxside = 260; if ($maxside > 800) $maxside = 800; if ($relpath === '' || strpos($relpath, "\0") !== false) { http_response_code(400); exit; } $full = bericht_resolve_data_path($relpath); if (!$full || !is_file($full)) { http_response_code(404); exit; } $thumb = bericht_attachment_thumb($full, $maxside); if ($thumb === null) { http_response_code(415); exit; } // Bedingtes GET: spart bei 40 Kacheln jede Menge Traffic $etag = '"'.md5($full.'|'.filemtime($full).'|'.$maxside).'"'; header('ETag: '.$etag); header('Cache-Control: private, max-age=86400'); if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && trim($_SERVER['HTTP_IF_NONE_MATCH']) === $etag) { http_response_code(304); exit; } header('Content-Type: image/jpeg'); header('Content-Length: '.strlen($thumb)); echo $thumb;