24 lines
489 B
PHP
24 lines
489 B
PHP
<?php
|
|
|
|
use EesyPHP\Check;
|
|
use EesyPHP\Log;
|
|
use EesyPHP\Tpl;
|
|
|
|
use EesyPHPExample\Db;
|
|
|
|
function get_item_from_url($id, $fatal=false) {
|
|
if (!Check :: id($id))
|
|
Log :: fatal(_('Invalid element identifier.'));
|
|
|
|
$item = Db :: 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
|