2020-04-18 00:51:33 +02:00
|
|
|
<?php
|
|
|
|
|
2023-01-29 17:36:21 +01:00
|
|
|
use EesyPHP\Check;
|
|
|
|
use EesyPHP\Log;
|
2023-01-31 00:30:04 +01:00
|
|
|
use EesyPHP\Tpl;
|
2023-01-29 17:36:21 +01:00
|
|
|
|
2020-04-18 00:51:33 +02:00
|
|
|
function get_item_from_url($id, $fatal=false) {
|
2023-01-29 17:36:21 +01:00
|
|
|
if (!Check :: id($id))
|
|
|
|
Log :: fatal(_('Invalid element identifier.'));
|
2020-04-18 00:51:33 +02:00
|
|
|
|
2022-04-24 17:43:44 +02:00
|
|
|
$item = get_item($id);
|
|
|
|
if(!is_array($item)) {
|
2024-01-23 19:23:10 +01:00
|
|
|
$error = sprintf(_("Item #%s not found."), $id);
|
2022-04-24 17:43:44 +02:00
|
|
|
if ($fatal)
|
2023-01-29 17:36:21 +01:00
|
|
|
Log :: fatal($error);
|
2023-01-31 00:30:04 +01:00
|
|
|
Tpl :: add_error($error);
|
2022-04-24 17:43:44 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return $item;
|
2020-04-18 00:51:33 +02:00
|
|
|
}
|
2023-01-29 11:51:41 +01:00
|
|
|
|
|
|
|
# vim: tabstop=2 shiftwidth=2 softtabstop=2 expandtab
|