X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fnotice.php;h=133fd22fce242024001ac4015c193998411c9d6f;hb=9de0d354506fdb20929e68d10cf3680181d4382c;hp=a42d60dd401f344e4d564229711366c6452ce0e3;hpb=0c764684bb32a9432fd161e62db907efb78af1a5;p=friendica.git diff --git a/mod/notice.php b/mod/notice.php index a42d60dd40..133fd22fce 100644 --- a/mod/notice.php +++ b/mod/notice.php @@ -1,21 +1,26 @@ friendica items permanent-url compatibility */ +/** + * @file mod/notice.php + * GNU Social -> friendica items permanent-url compatibility + */ -if(! function_exists('notice_init')) { - 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); +use Friendica\App; +use Friendica\Core\L10n; +use Friendica\Core\System; +use Friendica\Database\DBA; - } - return; +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']; + $url = System::baseUrl() . "/display/$nick/$id"; + goaway($url); + } else { + $a->error = 404; + notice(L10n::t('Item not found.') . EOL); } + + return; }