LuminaWebsite/bug_image.php
Maaxxs 5dabbccbd7 Gear planner, dashboard polish, images on bug reports
Gear planner:
- Personal gear sets (18 slots) with enchant, exceed, soul imprint and manastones,
  stat totals by source and side-by-side comparison of 2-4 sets
- Sets can be shown on the own profile page (read-only for other members)
- Admin catalog: import items from aion2hub.com (Global client), compare stored
  values with the source one by one or all at once, at most one request per second
- New permissions gear.view (all with dashboard access) and gear.manage

Dashboard:
- Role badges ordered like the member list (roster_order)
- Stronger hover effect on "Rangliste & Verlauf" / "Zum Lumishop", no more blue
  hover on secondary buttons
- "Anstehende Raids" box links to the raids page, next raids link to the raid
  and to the calendar day
- Raid attendance only knows present/absent (old "excused" entries count as unset)

Bug reports:
- Up to 5 images per report, pasting copied images with Ctrl+V (also for the gallery)
- Images are only served to the reporter and bugs.manage via bug_image.php

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-22 09:27:09 +02:00

32 lines
1.2 KiB
PHP

<?php
/**
* Liefert ein Bild einer Fehlermeldung aus - nur an den Melder selbst und an die Leitung
* (bugs.manage). Der Ordner assets/uploads/bugs/ ist direkt nicht abrufbar.
*/
require_once __DIR__ . '/includes/bootstrap.php';
require_once __DIR__ . '/includes/bugs.php';
require_login();
$stmt = db()->prepare(
'SELECT i.filename, b.user_id FROM bug_report_images i JOIN bug_reports b ON b.id = i.bug_id WHERE i.id = ?'
);
$stmt->execute([(int) ($_GET['id'] ?? 0)]);
$image = $stmt->fetch();
$me = current_user();
if (!$image || ((int) $image['user_id'] !== (int) $me['id'] && !user_has_permission('bugs.manage'))) {
show_not_found();
}
$path = BUG_UPLOAD_DIR . $image['filename'];
$types = ['png' => 'image/png', 'jpg' => 'image/jpeg', 'gif' => 'image/gif', 'webp' => 'image/webp'];
$type = $types[strtolower(pathinfo((string) $image['filename'], PATHINFO_EXTENSION))] ?? null;
if (strpos((string) $image['filename'], '/') !== false || $type === null || !is_file($path)) {
show_not_found();
}
session_write_close();
header('Content-Type: ' . $type);
header('Content-Length: ' . filesize($path));
header('Cache-Control: private, max-age=86400');
header('X-Content-Type-Options: nosniff');
readfile($path);