1<?php 2 3use App\Repository\DatabaseStatusRepository; 4use App\Repository\PackageRepository; 5use App\Repository\PhpInfoRepository; 6use App\Repository\ReasonRepository; 7 8// Application bootstrap 9require_once '../../include/prepend.php'; 10 11// Authentication 12require_once __DIR__.'/../../include/auth.php'; 13 14if (!$logged_in) { 15 response_header("Bugs admin suite"); 16 response_footer("Please login"); 17 exit; 18} 19 20$action = $_GET['action'] ?? 'list_lists'; 21 22switch ($action) { 23 case 'phpinfo': 24 echo $template->render('pages/admin/phpinfo.php', [ 25 'action' => $action, 26 'info' => $container->get(PhpInfoRepository::class)->getInfo(), 27 ]); 28 break; 29 30 case 'list_responses': 31 echo $template->render('pages/admin/quick_responses.php', [ 32 'action' => $action, 33 'responses' => $container->get(ReasonRepository::class)->findAll(), 34 ]); 35 break; 36 37 case 'mysql': 38 echo $template->render('pages/admin/database_status.php', [ 39 'action' => $action, 40 'mysqlVersion' => $container->get(DatabaseStatusRepository::class)->getMysqlVersion(), 41 'numberOfRowsPerTable' => $container->get(DatabaseStatusRepository::class)->getNumberOfRowsInTables(), 42 'statusPerTable' => $container->get(DatabaseStatusRepository::class)->getStatusOfTables(), 43 ]); 44 break; 45 46 case 'list_lists': 47 default: 48 echo $template->render('pages/admin/mailing_lists.php', [ 49 'action' => $action, 50 'lists' => $container->get(PackageRepository::class)->findLists(), 51 ]); 52 break; 53} 54