X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=mod%2Fnotice.php;h=c2d85db166bcc7145dc1f25d765b8b25a3471b4d;hb=2503660f97c3f9588f1965c23b98d0c78109ee0b;hp=19cf53189a1476dfb9795026ab9b23139ad0160f;hpb=b202e02fbf09859c06ed21cc3b6bec1530ccf1f1;p=friendica.git diff --git a/mod/notice.php b/mod/notice.php index 19cf53189a..c2d85db166 100644 --- a/mod/notice.php +++ b/mod/notice.php @@ -1,20 +1,26 @@ 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 (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); +/** + * @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\DBM; +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(L10n::t('Item not found.') . EOL); } + + return; +}