X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fnotice.php;h=ff8bed1800afc0e7ba0d6da0f989f5bcbb1e5159;hb=ab60641e3ba731aca42ab510bdf9c2411db6aab4;hp=9d8aeed700537f2b50ca00c3de7ac30daf74f319;hpb=00c342e13d833fd215e5dc03a508e1abe660fe21;p=friendica.git diff --git a/mod/notice.php b/mod/notice.php index 9d8aeed700..ff8bed1800 100644 --- a/mod/notice.php +++ b/mod/notice.php @@ -1,20 +1,22 @@ 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; +use Friendica\Core\System; + +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 = System::baseUrl() . "/display/$nick/$id"; + goaway($url); + } else { + $a->error = 404; + notice(t('Item not found.') . EOL); } + + return; +}