]> git.mxchange.org Git - friendica-addons.git/commitdiff
Merge pull request #486 from MrPetovan/task/fix-scrutinizer-issues
authorMichael Vogel <icarus@dabo.de>
Wed, 10 Jan 2018 23:26:43 +0000 (00:26 +0100)
committerGitHub <noreply@github.com>
Wed, 10 Jan 2018 23:26:43 +0000 (00:26 +0100)
Replace dba::select(limit => 1) by dba::selectFirst()

buffer/buffer.php
diaspora/diaspora.php
ifttt/ifttt.php
libertree/libertree.php
pumpio/pumpio.php
statusnet/statusnet.php
tumblr/tumblr.php
twitter/twitter.php
windowsphonepush/windowsphonepush.php
wppost/wppost.php

index 97373f301488487ad4a5f753d1bb5ef18eb31a83..932789da5704117b5fb6005b265338ef51fb269b 100644 (file)
@@ -239,18 +239,21 @@ function buffer_post_local(&$a,&$b) {
 
 function buffer_send(App $a, &$b)
 {
-       if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))
+       if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) {
                return;
+       }
 
-       if(! strstr($b['postopts'],'buffer'))
+       if(! strstr($b['postopts'],'buffer')) {
                return;
+       }
 
-       if($b['parent'] != $b['id'])
+       if($b['parent'] != $b['id']) {
                return;
+       }
 
        // Dont't post if the post doesn't belong to us.
        // This is a check for forum postings
-       $self = dba::select('contact', array('id'), array('uid' => $b['uid'], 'self' => true), array('limit' => 1));
+       $self = dba::selectFirst('contact', ['id'], ['uid' => $b['uid'], 'self' => true]);
        if ($b['contact-id'] != $self['id']) {
                return;
        }
index 04ed24ca84b42d12d5f3dfed190a3e3fecaacdf3..db4cc46e9d55df9d52c088dda6302bf626661e8d 100644 (file)
@@ -275,18 +275,21 @@ function diaspora_send(&$a,&$b) {
 
        logger('diaspora_send: invoked');
 
-       if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))
+       if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) {
                return;
+       }
 
-       if(! strstr($b['postopts'],'diaspora'))
+       if(! strstr($b['postopts'],'diaspora')) {
                return;
+       }
 
-       if($b['parent'] != $b['id'])
+       if($b['parent'] != $b['id']) {
                return;
+       }
 
        // Dont't post if the post doesn't belong to us.
        // This is a check for forum postings
-       $self = dba::select('contact', array('id'), array('uid' => $b['uid'], 'self' => true), array('limit' => 1));
+       $self = dba::selectFirst('contact', ['id'], ['uid' => $b['uid'], 'self' => true]);
        if ($b['contact-id'] != $self['id']) {
                return;
        }
index 384b955c0b182c7350671a63203fd867d8f660d6..199aace430630b53d3626d6fc0f0c556cc236cf1 100644 (file)
@@ -97,7 +97,7 @@ function ifttt_post(App $a)
 
        $nickname = $a->argv[1];
 
-       $user = dba::select('user', ['uid'], ['nickname' => $nickname], ['limit' => 1]);
+       $user = dba::selectFirst('user', ['uid'], ['nickname' => $nickname]);
        if (!DBM::is_result($user)) {
                logger('User ' . $nickname . ' not found.', LOGGER_DEBUG);
                return;
index 95def07a0b01dfd5dd0119bc74cf0e5f671f7ebf..f5a157ec84b32f350f55b1451b57b8020b474c42 100644 (file)
@@ -155,18 +155,21 @@ function libertree_send(&$a,&$b) {
 
        logger('libertree_send: invoked');
 
-       if ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))
+       if ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) {
                return;
+       }
 
-       if (! strstr($b['postopts'],'libertree'))
+       if (! strstr($b['postopts'],'libertree')) {
                return;
+       }
 
-       if ($b['parent'] != $b['id'])
+       if ($b['parent'] != $b['id']) {
                return;
+       }
 
        // Dont't post if the post doesn't belong to us.
        // This is a check for forum postings
-       $self = dba::select('contact', array('id'), array('uid' => $b['uid'], 'self' => true), array('limit' => 1));
+       $self = dba::selectFirst('contact', ['id'], ['uid' => $b['uid'], 'self' => true]);
        if ($b['contact-id'] != $self['id']) {
                return;
        }
index f5bf6496a01321992741988dccb2da64fdf8ac7f..3f6f8a87040da7da5f5e39b42b3619d4c19f3fb3 100644 (file)
@@ -413,12 +413,13 @@ function pumpio_send(&$a,&$b) {
 
                logger("pumpio_send: receiver ".print_r($receiver, true));
 
-               if (!count($receiver) && ($b['private'] || !strstr($b['postopts'],'pumpio')))
+               if (!count($receiver) && ($b['private'] || !strstr($b['postopts'],'pumpio'))) {
                        return;
+               }
 
                // Dont't post if the post doesn't belong to us.
                // This is a check for forum postings
-               $self = dba::select('contact', array('id'), array('uid' => $b['uid'], 'self' => true), array('limit' => 1));
+               $self = dba::selectFirst('contact', ['id'], ['uid' => $b['uid'], 'self' => true]);
                if ($b['contact-id'] != $self['id']) {
                        return;
                }
index 659ddaef2a59a13840a6022bd9dcaac0cdb3fadb..34bbf20cc6d08a3eb8703f1439fd170b1ce84388 100644 (file)
@@ -568,19 +568,21 @@ function statusnet_post_hook(App $a, &$b)
                $nicknameplain = "@" . $nick;
 
                logger("statusnet_post_hook: comparing " . $nickname . " and " . $nicknameplain . " with " . $b["body"], LOGGER_DEBUG);
-               if ((strpos($b["body"], $nickname) === false) && (strpos($b["body"], $nicknameplain) === false))
+               if ((strpos($b["body"], $nickname) === false) && (strpos($b["body"], $nicknameplain) === false)) {
                        $b["body"] = $nickname . " " . $b["body"];
+               }
 
                logger("statusnet_post_hook: parent found " . print_r($orig_post, true), LOGGER_DEBUG);
        } else {
                $iscomment = false;
 
-               if ($b['private'] || !strstr($b['postopts'], 'statusnet'))
+               if ($b['private'] || !strstr($b['postopts'], 'statusnet')) {
                        return;
+               }
 
                // Dont't post if the post doesn't belong to us.
                // This is a check for forum postings
-               $self = dba::select('contact', array('id'), array('uid' => $b['uid'], 'self' => true), array('limit' => 1));
+               $self = dba::selectFirst('contact', ['id'], ['uid' => $b['uid'], 'self' => true]);
                if ($b['contact-id'] != $self['id']) {
                        return;
                }
index 77d98aca704493fa05dbf5ba28627f018a2c0866..78c12a5f64d0936ad635573d2dacb111aba87342 100644 (file)
@@ -316,18 +316,21 @@ function tumblr_post_local(&$a, &$b) {
 
 function tumblr_send(&$a,&$b) {
 
-       if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))
+       if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) {
                return;
+       }
 
-       if(! strstr($b['postopts'],'tumblr'))
+       if(! strstr($b['postopts'],'tumblr')) {
                return;
+       }
 
-       if($b['parent'] != $b['id'])
+       if($b['parent'] != $b['id']) {
                return;
+       }
 
        // Dont't post if the post doesn't belong to us.
        // This is a check for forum postings
-       $self = dba::select('contact', array('id'), array('uid' => $b['uid'], 'self' => true), array('limit' => 1));
+       $self = dba::selectFirst('contact', ['id'], ['uid' => $b['uid'], 'self' => true]);
        if ($b['contact-id'] != $self['id']) {
                return;
        }
index 43aee0fef502193b2734e97bda444966a714dba1..ccfdeb1fbf9cf04d458b167e9ae2e890c2f51a98 100644 (file)
@@ -468,7 +468,7 @@ function twitter_post_hook(App $a, &$b)
 
                // Dont't post if the post doesn't belong to us.
                // This is a check for forum postings
-               $self = dba::select('contact', array('id'), array('uid' => $b['uid'], 'self' => true), array('limit' => 1));
+               $self = dba::selectFirst('contact', ['id'], ['uid' => $b['uid'], 'self' => true]);
                if ($b['contact-id'] != $self['id']) {
                        return;
                }
index baa4c656e3beace9c1b015cfb223fd70edd4ea69..ca615205f081a7dc0d967c2fd7a1ac15ac5f053e 100644 (file)
@@ -458,7 +458,7 @@ function windowsphonepush_login(App $a)
        $user_id = User::authenticate($_SERVER['PHP_AUTH_USER'], trim($_SERVER['PHP_AUTH_PW']));
 
        if ($user_id) {
-               $record = dba::select('user', [], ['uid' => $user_id], ['limit' => 1]);
+               $record = dba::selectFirst('user', [], ['uid' => $user_id]);
        } else {
                logger('API_login failure: ' . print_r($_SERVER, true), LOGGER_DEBUG);
                header('WWW-Authenticate: Basic realm="Friendica"');
index ea26ae45340a7070de9e0d4fdb0bf772fecd96fb..323fcef0caa805f8281cf5470904edfbcd231fca 100644 (file)
@@ -191,18 +191,21 @@ function wppost_post_local(&$a, &$b) {
 
 function wppost_send(&$a,&$b) {
 
-       if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))
+       if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) {
                return;
+       }
 
-       if(! strstr($b['postopts'],'wppost'))
+       if(! strstr($b['postopts'],'wppost')) {
                return;
+       }
 
-       if($b['parent'] != $b['id'])
+       if($b['parent'] != $b['id']) {
                return;
+       }
 
        // Dont't post if the post doesn't belong to us.
        // This is a check for forum postings
-       $self = dba::select('contact', array('id'), array('uid' => $b['uid'], 'self' => true), array('limit' => 1));
+       $self = dba::selectFirst('contact', ['id'], ['uid' => $b['uid'], 'self' => true]);
        if ($b['contact-id'] != $self['id']) {
                return;
        }