eesyphp/example/includes/url-helpers.php
2024-01-23 19:23:10 +01:00

23 lines
459 B
PHP

<?php
use EesyPHP\Check;
use EesyPHP\Log;
use EesyPHP\Tpl;
function get_item_from_url($id, $fatal=false) {
if (!Check :: id($id))
Log :: fatal(_('Invalid element identifier.'));
$item = get_item($id);
if(!is_array($item)) {
$error = sprintf(_("Item #%s not found."), $id);
if ($fatal)
Log :: fatal($error);
Tpl :: add_error($error);
return false;
}
return $item;
}
# vim: tabstop=2 shiftwidth=2 softtabstop=2 expandtab