forked from xziino/ff14-mitigator
Commit 8217f68 rief auth_start_href() in report-form.php und login.php auf, ohne die Funktion zu definieren. Generiert auth/start.php?return= mit dem aktuellen Request-URI als Return-Pfad. In index.php statt config.php da config.php skip-worktree hat. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
27 lines
959 B
PHP
27 lines
959 B
PHP
<?php
|
|
require_once __DIR__ . '/config.php';
|
|
session_start_safe();
|
|
|
|
function auth_start_href(): string {
|
|
$return = $_SERVER['REQUEST_URI'] ?? '/';
|
|
return 'auth/start.php?return=' . urlencode($return);
|
|
}
|
|
|
|
$authenticated = !empty($_SESSION['access_token'])
|
|
&& ($_SESSION['token_expires'] ?? 0) > time();
|
|
|
|
$tokenExpired = !empty($_SESSION['access_token'])
|
|
&& ($_SESSION['token_expires'] ?? 0) <= time();
|
|
|
|
$error = $_GET['error'] ?? null;
|
|
$errorMessages = [
|
|
'access_denied' => 'Access denied — you declined the FFLogs authorization.',
|
|
'token_failed' => 'Could not retrieve access token from FFLogs. Please try again.',
|
|
'missing_code' => 'Authorization code missing in callback.',
|
|
];
|
|
$errorText = $error ? ($errorMessages[$error] ?? 'Unknown error: ' . htmlspecialchars($error)) : null;
|
|
$tokenDebug = $_SESSION['token_debug'] ?? null;
|
|
unset($_SESSION['token_debug']);
|
|
|
|
require __DIR__ . '/templates/page.php';
|