]> git.mxchange.org Git - friendica-addons.git/blobdiff - ifttt/ifttt.php
Merge pull request #1187 from tobiasd/20211010-regenlng
[friendica-addons.git] / ifttt / ifttt.php
index e534b7054768f2f8550e6f4cc9768b61b8548684..2b1bdd799337c7ea7569a4ce31355415e23d990d 100644 (file)
@@ -57,7 +57,7 @@ function ifttt_settings(App $a, &$s)
        $s .= '<div id="ifttt-configuration-wrapper">';
        $s .= '<p>' . DI::l10n()->t('Create an account at <a href="http://www.ifttt.com">IFTTT</a>. Create three Facebook recipes that are connected with <a href="https://ifttt.com/maker">Maker</a> (In the form "if Facebook then Maker") with the following parameters:') . '</p>';
        $s .= '<h4>URL</h4>';
-       $s .= '<p>' . DI::baseUrl()->get() . '/ifttt/' . $a->user['nickname'] . '</p>';
+       $s .= '<p>' . DI::baseUrl()->get() . '/ifttt/' . $a->getLoggedInUserNickname() . '</p>';
        $s .= '<h4>Method</h4>';
        $s .= '<p>POST</p>';
        $s .= '<h4>Content Type</h4>';
@@ -88,11 +88,11 @@ function ifttt_settings_post()
 
 function ifttt_post(App $a)
 {
-       if ($a->argc != 2) {
+       if (DI::args()->getArgc() != 2) {
                return;
        }
 
-       $nickname = $a->argv[1];
+       $nickname = DI::args()->getArgv()[1];
 
        $user = DBA::selectFirst('user', ['uid'], ['nickname' => $nickname]);
        if (!DBA::isResult($user)) {
@@ -169,12 +169,6 @@ function ifttt_message($uid, $item)
        //$post['date'] = $item['date'];
        //$post['uri'] = $item['url'];
 
-       if (!empty($item['url']) && strstr($item['url'], 'facebook.com')) {
-               $hash = hash('ripemd128', $item['url']);
-               $post['extid'] = Protocol::FACEBOOK;
-               $post['message_id'] = Item::newURI($uid, Protocol::FACEBOOK . ':' . $hash);
-       }
-
        if ($item['type'] == 'link') {
                $link = $item['link'];
                $data = PageInfo::queryUrl($item['link']);
@@ -197,5 +191,5 @@ function ifttt_message($uid, $item)
                $link = hash('ripemd128', $item['msg']);
        }
 
-       Post\Delayed::add($link, $post, PRIORITY_MEDIUM, true);
+       Post\Delayed::add($link, $post, PRIORITY_MEDIUM, Post\Delayed::UNPREPARED);
 }