1) ? intval(argv(1)) : 0); if(! $item_id) { \App::$error = 404; notice( t('Item not found.') . EOL); return; } $r = q("select uuid, mid from item where id = %d limit 1", intval($item_id) ); if (!$r) { notice( t('Item not found.') . EOL); return; } $identifier = $r[0]['uuid'] ?? ''; if (!$identifier) { if ($r[0]['mid']) { $identifier = 'b64.' . base64url_encode($r[0]['mid']); } } if (!$identifier) { notice( t('Item not found.') . EOL); return; } $old_argv = \App::$argv; $old_argc = \App::$argc; \App::$argv = ['display', $identifier]; \App::$argc = 2; $display = new Display(); $output = $display->get(); \App::$argv = $old_argv; \App::$argc = $old_argc; $separator = ' - '; $page_title = \App::$page['title']; if (substr($page_title, -strlen($separator)) === $separator) { $page_title = substr($page_title, 0, -strlen($separator)); } \App::$page['title'] = $page_title; return $output; } }