]> git.mxchange.org Git - friendica.git/blobdiff - mod/poke.php
Better content detection for posts to Twitter
[friendica.git] / mod / poke.php
index ea0093e1dc9162b9a17ebf5fa8bf318bef619c26..ca02b6bee5105880b62a21ceff5216dec289d611 100644 (file)
@@ -1,7 +1,6 @@
-<?php /** @file */
+<?php
 
 /**
- *
  * 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.
  *
  * private creates a private conversation with the recipient. Otherwise your profile's default post privacy is used.
  *
+ * @file mod/poke.php
  */
 
+use Friendica\App;
+use Friendica\Core\System;
+
 require_once('include/security.php');
 require_once('include/bbcode.php');
 require_once('include/items.php');
 
-
 function poke_init(App $a) {
 
        if (! local_user()) {
@@ -63,7 +65,7 @@ function poke_init(App $a) {
 
        $target = $r[0];
 
-       if ($parent) {
+       if($parent) {
                $r = q("SELECT `uri`, `private`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`
                        FROM `item` WHERE `id` = %d AND `parent` = %d AND `uid` = %d LIMIT 1",
                        intval($parent),
@@ -122,16 +124,16 @@ function poke_init(App $a) {
        $arr['origin']        = 1;
        $arr['body']          = '[url=' . $poster['url'] . ']' . $poster['name'] . '[/url]' . ' ' . t($verbs[$verb][0]) . ' ' . '[url=' . $target['url'] . ']' . $target['name'] . '[/url]';
 
-       $arr['object'] = '<object><type>' . ACTIVITY_OBJ_PERSON . '</type><title>' . $target['name'] . '</title><id>' . App::get_baseurl() . '/contact/' . $target['id'] . '</id>';
+       $arr['object'] = '<object><type>' . ACTIVITY_OBJ_PERSON . '</type><title>' . $target['name'] . '</title><id>' . System::baseUrl() . '/contact/' . $target['id'] . '</id>';
        $arr['object'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $target['url'] . '" />' . "\n");
 
        $arr['object'] .= xmlify('<link rel="photo" type="image/jpeg" href="' . $target['photo'] . '" />' . "\n");
        $arr['object'] .= '</link></object>' . "\n";
 
        $item_id = item_store($arr);
-       if ($item_id) {
+       if($item_id) {
                //q("UPDATE `item` SET `plink` = '%s' WHERE `uid` = %d AND `id` = %d",
-               //      dbesc(App::get_baseurl() . '/display/' . $poster['nickname'] . '/' . $item_id),
+               //      dbesc(System::baseUrl() . '/display/' . $poster['nickname'] . '/' . $item_id),
                //      intval($uid),
                //      intval($item_id)
                //);
@@ -158,7 +160,7 @@ function poke_content(App $a) {
        $name = '';
        $id = '';
 
-       if (intval($_GET['c'])) {
+       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())
@@ -170,11 +172,11 @@ function poke_content(App $a) {
        }
 
 
-       $base = App::get_baseurl();
+       $base = System::baseUrl();
 
        $head_tpl = get_markup_template('poke_head.tpl');
        $a->page['htmlhead'] .= replace_macros($head_tpl,array(
-               '$baseurl' => App::get_baseurl(true),
+               '$baseurl' => System::baseUrl(true),
                '$base' => $base
        ));
 
@@ -185,11 +187,9 @@ function poke_content(App $a) {
        $verbs = get_poke_verbs();
 
        $shortlist = array();
-       foreach ($verbs as $k => $v) {
-               if ($v[1] !== 'NOTRANSLATION') {
+       foreach($verbs as $k => $v)
+               if($v[1] !== 'NOTRANSLATION')
                        $shortlist[] = array($k,$v[1]);
-               }
-       }
 
 
        $tpl = get_markup_template('poke_content.tpl');