X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fnotice.php;h=b40f0ee69cf5bfd9fef800f27c19181b1a5f011f;hb=b461a30d9e11b54a18086f3512eefafb68089a4b;hp=7fdf4493a4f5cf30a801f4c0008df1c8970d2fa9;hpb=6a8a36f12d00f35004fbb034972ca87dd1a3c4f5;p=friendica.git diff --git a/mod/notice.php b/mod/notice.php index 7fdf4493a4..b40f0ee69c 100644 --- a/mod/notice.php +++ b/mod/notice.php @@ -1,20 +1,25 @@ friendica items permanent-url compatibility */ - - function notice_init(&$a){ - $id = $a->argv[1]; - $r = q("SELECT user.nickname FROM user LEFT JOIN item ON item.uid=user.uid WHERE item.id=%d", - intval($id) - ); - if (dbm::is_result($r)){ - $nick = $r[0]['nickname']; - $url = $a->get_baseurl()."/display/$nick/$id"; - goaway($url); - } else { - $a->error = 404; - notice( t('Item not found.') . EOL); +/** + * @file mod/notice.php + * GNU Social -> friendica items permanent-url compatibility + */ - } - return; +use Friendica\App; +use Friendica\Core\L10n; +use Friendica\Core\System; +use Friendica\Database\DBA; +function notice_init(App $a) +{ + $id = $a->argv[1]; + $r = q("SELECT `user`.`nickname` FROM `user` LEFT JOIN `item` ON `item`.`uid` = `user`.`uid` WHERE `item`.`id` = %d", intval($id)); + if (DBA::isResult($r)) { + $nick = $r[0]['nickname']; + $a->internalRedirect('display/' . $nick . '/' . $id); + } else { + $a->error = 404; + notice(L10n::t('Item not found.') . EOL); } + + return; +}