Switch PHP views to Twig and add 2FA/UI enhancements

Migrate many view templates from raw PHP to Twig and modernize UI/UX for 2FA and settings. Controllers updated to provide avatar data and two-factor info (ProfileController, UserController) and SettingsController now includes timezone lists, notification preset selection, cron path, cached update state and rollback availability. ErrorHandler now attempts to render error pages via a new Core\TwigService with a safe fallback to raw PHP views. TwoFactorService generation silences deprecated warnings during QR code creation. Numerous .php view files were removed and replaced with .twig equivalents (2fa setup/verify/backup-codes and many auth, dashboard, domains, errors, layout, users, tags, tld-registry, etc.), and core/TwigService was added. These changes move the app toward a Twig-based templating system, improve 2FA flows, surface avatar images in lists/profiles, and make error rendering more robust.
This commit is contained in:
Hosteroid
2026-03-03 18:21:32 +02:00
parent cd4e3e6bcc
commit 4818172bc6
73 changed files with 9948 additions and 10686 deletions

View File

@@ -6,6 +6,15 @@ abstract class Controller
{
protected function view(string $view, array $data = []): void
{
$twigPath = __DIR__ . "/../app/Views/$view.twig";
if (file_exists($twigPath)) {
$twig = TwigService::getInstance();
echo $twig->render("$view.twig", $data);
return;
}
// Fallback to legacy PHP view during migration
extract($data);
$viewPath = __DIR__ . "/../app/Views/$view.php";
@@ -13,7 +22,7 @@ abstract class Controller
throw new \Exception("View not found: $view");
}
require_once $viewPath;
require $viewPath;
}
protected function json($data, int $status = 200): void