Closes https://gitea.subcultureofone.org/greg/tkr/issues/45 Reviewed-on: https://gitea.subcultureofone.org/greg/tkr/pulls/50 Co-authored-by: Greg Sarjeant <greg@subcultureofone.org> Co-committed-by: Greg Sarjeant <greg@subcultureofone.org>
29 lines
988 B
PHP
29 lines
988 B
PHP
<?php
|
|
|
|
class TickController extends Controller{
|
|
public function index(int $id){
|
|
global $app;
|
|
|
|
Log::debug("Fetching tick with ID: {$id}");
|
|
|
|
try {
|
|
$tickModel = new TickModel($app['db'], $app['config']);
|
|
$vars = $tickModel->get($id);
|
|
|
|
if (empty($vars) || !isset($vars['tick'])) {
|
|
Log::warning("Tick not found for ID: {$id}");
|
|
http_response_code(404);
|
|
echo '<h1>404 - Tick Not Found</h1>';
|
|
return;
|
|
}
|
|
|
|
Log::info("Successfully loaded tick {$id}: " . substr($vars['tick'], 0, 50) . (strlen($vars['tick']) > 50 ? '...' : ''));
|
|
$this->render('tick.php', $vars);
|
|
|
|
} catch (Exception $e) {
|
|
Log::error("Failed to load tick {$id}: " . $e->getMessage());
|
|
http_response_code(500);
|
|
echo '<h1>500 - Internal Server Error</h1>';
|
|
}
|
|
}
|
|
} |