X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fpoke.php;h=5161129b31c38f2c9dec070cd98f4b290a75e2fa;hb=1c6535c0b45c32ccbb0e2bd49e5bb7a6d5435d27;hp=45a577cda6bfd3764e9ac2d723112eea76df74f2;hpb=3c97a6703cd5a743fc9339f52996bcb1eb436ef0;p=friendica.git diff --git a/mod/poke.php b/mod/poke.php index 45a577cda6..5161129b31 100644 --- a/mod/poke.php +++ b/mod/poke.php @@ -4,11 +4,11 @@ * * Poke, prod, finger, or otherwise do unspeakable things to somebody - who must be a connection in your address book * This function can be invoked with the required arguments (verb and cid and private and possibly parent) silently via ajax or - * other web request. You must be logged in and connected to a profile. + * other web request. You must be logged in and connected to a profile. * If the required arguments aren't present, we'll display a simple form to choose a recipient and a verb. * parent is a special argument which let's you attach this activity as a comment to an existing conversation, which * may have started with somebody else poking (etc.) somebody, but this isn't necessary. This can be used in the more pokes - * plugin version to have entire conversations where Alice poked Bob, Bob fingered Alice, Alice hugged Bob, etc. + * plugin version to have entire conversations where Alice poked Bob, Bob fingered Alice, Alice hugged Bob, etc. * * private creates a private conversation with the recipient. Otherwise your profile's default post privacy is used. * @@ -19,27 +19,31 @@ require_once('include/bbcode.php'); require_once('include/items.php'); -function poke_init(&$a) { +function poke_init(App $a) { - if(! local_user()) + if (! local_user()) { return; + } $uid = local_user(); $verb = notags(trim($_GET['verb'])); - if(! $verb) + if (! $verb) { return; + } $verbs = get_poke_verbs(); - if(! array_key_exists($verb,$verbs)) + if (! array_key_exists($verb,$verbs)) { return; + } $activity = ACTIVITY_POKE . '#' . urlencode($verbs[$verb][0]); $contact_id = intval($_GET['cid']); - if(! $contact_id) + if (! $contact_id) { return; + } $parent = ((x($_GET,'parent')) ? intval($_GET['parent']) : 0); @@ -52,7 +56,7 @@ function poke_init(&$a) { intval($uid) ); - if(! count($r)) { + if (! dbm::is_result($r)) { logger('poke: no contact ' . $contact_id); return; } @@ -66,7 +70,7 @@ function poke_init(&$a) { intval($parent), intval($uid) ); - if(count($r)) { + if (dbm::is_result($r)) { $parent_uri = $r[0]['uri']; $private = $r[0]['private']; $allow_cid = $r[0]['allow_cid']; @@ -91,6 +95,7 @@ function poke_init(&$a) { $arr = array(); + $arr['guid'] = get_guid(32); $arr['uid'] = $uid; $arr['uri'] = $uri; $arr['parent-uri'] = (($parent_uri) ? $parent_uri : $uri); @@ -117,7 +122,7 @@ function poke_init(&$a) { $arr['origin'] = 1; $arr['body'] = '[url=' . $poster['url'] . ']' . $poster['name'] . '[/url]' . ' ' . t($verbs[$verb][0]) . ' ' . '[url=' . $target['url'] . ']' . $target['name'] . '[/url]'; - $arr['object'] = '' . ACTIVITY_OBJ_PERSON . '' . $target['name'] . '' . $a->get_baseurl() . '/contact/' . $target['id'] . ''; + $arr['object'] = '' . ACTIVITY_OBJ_PERSON . '' . $target['name'] . '' . App::get_baseurl() . '/contact/' . $target['id'] . ''; $arr['object'] .= '' . xmlify('' . "\n"); $arr['object'] .= xmlify('' . "\n"); @@ -126,26 +131,26 @@ function poke_init(&$a) { $item_id = item_store($arr); if($item_id) { //q("UPDATE `item` SET `plink` = '%s' WHERE `uid` = %d AND `id` = %d", - // dbesc($a->get_baseurl() . '/display/' . $poster['nickname'] . '/' . $item_id), + // dbesc(App::get_baseurl() . '/display/' . $poster['nickname'] . '/' . $item_id), // intval($uid), // intval($item_id) //); - proc_run('php',"include/notifier.php","tag","$item_id"); + proc_run(PRIORITY_HIGH, "include/notifier.php", "tag", $item_id); } call_hooks('post_local_end', $arr); - proc_run('php',"include/notifier.php","like","$post_id"); + proc_run(PRIORITY_HIGH, "include/notifier.php", "like", $post_id); return; } -function poke_content(&$a) { +function poke_content(App $a) { - if(! local_user()) { + if (! local_user()) { notice( t('Permission denied.') . EOL); return; } @@ -158,18 +163,18 @@ function poke_content(&$a) { intval($_GET['c']), intval(local_user()) ); - if(count($r)) { + if (dbm::is_result($r)) { $name = $r[0]['name']; $id = $r[0]['id']; } } - $base = $a->get_baseurl(); + $base = App::get_baseurl(); $head_tpl = get_markup_template('poke_head.tpl'); $a->page['htmlhead'] .= replace_macros($head_tpl,array( - '$baseurl' => $a->get_baseurl(true), + '$baseurl' => App::get_baseurl(true), '$base' => $base ));