eesyphp/includes/url-helpers.php
Benjamin Renard 6fdc5447f1 Some improvments from recent works on apps based on its "framework"
* Code cleaning and fix some small errors using Phpstan
* Configure pre-commit to run Phpstan before each commit
* Some little improvments and logging, mail, smarty & URL libs
* Add Sentry integration
* Add Webstat JS code inclusion
* Install Smarty dependency using composer

Breaking changes:
* Rename Event class as HookEvent to avoid conflict with PECL event
* URL with refresh GET parameter now automatically trigger redirection without it
 after page loading to avoid to keep it in URL
2023-01-29 11:51:41 +01:00

18 lines
404 B
PHP

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