X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=inline;f=mod%2Fpoke.php;h=91f33c0def2fd43a2991fb1aef40b41109f0f9da;hb=d581318c7cfd78a94abe1aa5b2578be297601df0;hp=a9dfc73f4e1f0f97e898da67e29581ce4144508f;hpb=ecea7425f8ad11ace4af39d476919e3203bff44f;p=friendica.git diff --git a/mod/poke.php b/mod/poke.php index a9dfc73f4e..91f33c0def 100644 --- a/mod/poke.php +++ b/mod/poke.php @@ -24,19 +24,20 @@ use Friendica\Model\Item; require_once 'include/security.php'; require_once 'include/items.php'; -function poke_init(App $a) { - +function poke_init(App $a) +{ if (!local_user()) { return; } $uid = local_user(); - $verb = notags(trim($_GET['verb'])); - if (!$verb) { + if (empty($_GET['verb'])) { return; } + $verb = notags(trim($_GET['verb'])); + $verbs = get_poke_verbs(); if (!array_key_exists($verb, $verbs)) { @@ -99,7 +100,7 @@ function poke_init(App $a) { $arr['guid'] = System::createGUID(32); $arr['uid'] = $uid; $arr['uri'] = $uri; - $arr['parent-uri'] = ($parent_uri ? $parent_uri : $uri); + $arr['parent-uri'] = (!empty($parent_uri) ? $parent_uri : $uri); $arr['wall'] = 1; $arr['contact-id'] = $poster['id']; $arr['owner-name'] = $poster['name']; @@ -121,7 +122,7 @@ function poke_init(App $a) { $arr['origin'] = 1; $arr['body'] = '[url=' . $poster['url'] . ']' . $poster['name'] . '[/url]' . ' ' . L10n::t($verbs[$verb][0]) . ' ' . '[url=' . $target['url'] . ']' . $target['name'] . '[/url]'; - $arr['object'] = '' . ACTIVITY_OBJ_PERSON . '' . $target['name'] . '' . System::baseUrl() . '/contact/' . $target['id'] . ''; + $arr['object'] = '' . ACTIVITY_OBJ_PERSON . '' . $target['name'] . '' . $target['url'] . ''; $arr['object'] .= '' . xmlify('' . "\n"); $arr['object'] .= xmlify('' . "\n"); @@ -137,10 +138,8 @@ function poke_init(App $a) { return; } - - -function poke_content(App $a) { - +function poke_content(App $a) +{ if (!local_user()) { notice(L10n::t('Permission denied.') . EOL); return; @@ -149,17 +148,17 @@ function poke_content(App $a) { $name = ''; $id = ''; - if (intval($_GET['c'])) { - $r = q("SELECT `id`,`name` FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", - intval($_GET['c']), - intval(local_user()) - ); - if (DBA::isResult($r)) { - $name = $item['name']; - $id = $item['id']; - } + if (empty($_GET['c'])) { + return; + } + + $contact = DBA::selectFirst('contact', ['id', 'name'], ['id' => $_GET['c'], 'uid' => local_user()]); + if (!DBA::isResult($contact)) { + return; } + $name = $contact['name']; + $id = $contact['id']; $base = System::baseUrl();