X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fnotice.php;h=1114b9a5a452ed4eec5a5a70048c4ab8755623c3;hb=291af19f25a036178ee5932b66e48ac485fa50ef;hp=9d8aeed700537f2b50ca00c3de7ac30daf74f319;hpb=eeec29c6be2429ea38ab258591200e0178886a25;p=friendica.git diff --git a/mod/notice.php b/mod/notice.php index 9d8aeed700..1114b9a5a4 100644 --- a/mod/notice.php +++ b/mod/notice.php @@ -1,20 +1,21 @@ friendika 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 (count($r)){ - $nick = $r[0]['nickname']; - $url = $a->get_baseurl()."/display/$nick/$id"; - goaway($url); - } else { - $a->error = 404; - notice( t('Item not found.') . EOL); - } - return; +/* identi.ca -> friendica items permanent-url compatibility */ +use Friendica\App; + +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 (dbm::is_result($r)) { + $nick = $r[0]['nickname']; + $url = App::get_baseurl() . "/display/$nick/$id"; + goaway($url); + } else { + $a->error = 404; + notice(t('Item not found.') . EOL); } + + return; +}