mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-11-24 08:03:46 +00:00
Merge pull request #486 from MrPetovan/task/fix-scrutinizer-issues
Replace dba::select(limit => 1) by dba::selectFirst()
This commit is contained in:
commit
4ee41c64a3
10 changed files with 46 additions and 28 deletions
|
@ -239,18 +239,21 @@ function buffer_post_local(&$a,&$b) {
|
||||||
|
|
||||||
function buffer_send(App $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;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(! strstr($b['postopts'],'buffer'))
|
if(! strstr($b['postopts'],'buffer')) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if($b['parent'] != $b['id'])
|
if($b['parent'] != $b['id']) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Dont't post if the post doesn't belong to us.
|
// Dont't post if the post doesn't belong to us.
|
||||||
// This is a check for forum postings
|
// 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']) {
|
if ($b['contact-id'] != $self['id']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -275,18 +275,21 @@ function diaspora_send(&$a,&$b) {
|
||||||
|
|
||||||
logger('diaspora_send: invoked');
|
logger('diaspora_send: invoked');
|
||||||
|
|
||||||
if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))
|
if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(! strstr($b['postopts'],'diaspora'))
|
if(! strstr($b['postopts'],'diaspora')) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if($b['parent'] != $b['id'])
|
if($b['parent'] != $b['id']) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Dont't post if the post doesn't belong to us.
|
// Dont't post if the post doesn't belong to us.
|
||||||
// This is a check for forum postings
|
// 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']) {
|
if ($b['contact-id'] != $self['id']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,7 @@ function ifttt_post(App $a)
|
||||||
|
|
||||||
$nickname = $a->argv[1];
|
$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)) {
|
if (!DBM::is_result($user)) {
|
||||||
logger('User ' . $nickname . ' not found.', LOGGER_DEBUG);
|
logger('User ' . $nickname . ' not found.', LOGGER_DEBUG);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -155,18 +155,21 @@ function libertree_send(&$a,&$b) {
|
||||||
|
|
||||||
logger('libertree_send: invoked');
|
logger('libertree_send: invoked');
|
||||||
|
|
||||||
if ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))
|
if ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (! strstr($b['postopts'],'libertree'))
|
if (! strstr($b['postopts'],'libertree')) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ($b['parent'] != $b['id'])
|
if ($b['parent'] != $b['id']) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Dont't post if the post doesn't belong to us.
|
// Dont't post if the post doesn't belong to us.
|
||||||
// This is a check for forum postings
|
// 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']) {
|
if ($b['contact-id'] != $self['id']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -413,12 +413,13 @@ function pumpio_send(&$a,&$b) {
|
||||||
|
|
||||||
logger("pumpio_send: receiver ".print_r($receiver, true));
|
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;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Dont't post if the post doesn't belong to us.
|
// Dont't post if the post doesn't belong to us.
|
||||||
// This is a check for forum postings
|
// 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']) {
|
if ($b['contact-id'] != $self['id']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -568,19 +568,21 @@ function statusnet_post_hook(App $a, &$b)
|
||||||
$nicknameplain = "@" . $nick;
|
$nicknameplain = "@" . $nick;
|
||||||
|
|
||||||
logger("statusnet_post_hook: comparing " . $nickname . " and " . $nicknameplain . " with " . $b["body"], LOGGER_DEBUG);
|
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"];
|
$b["body"] = $nickname . " " . $b["body"];
|
||||||
|
}
|
||||||
|
|
||||||
logger("statusnet_post_hook: parent found " . print_r($orig_post, true), LOGGER_DEBUG);
|
logger("statusnet_post_hook: parent found " . print_r($orig_post, true), LOGGER_DEBUG);
|
||||||
} else {
|
} else {
|
||||||
$iscomment = false;
|
$iscomment = false;
|
||||||
|
|
||||||
if ($b['private'] || !strstr($b['postopts'], 'statusnet'))
|
if ($b['private'] || !strstr($b['postopts'], 'statusnet')) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Dont't post if the post doesn't belong to us.
|
// Dont't post if the post doesn't belong to us.
|
||||||
// This is a check for forum postings
|
// 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']) {
|
if ($b['contact-id'] != $self['id']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -316,18 +316,21 @@ function tumblr_post_local(&$a, &$b) {
|
||||||
|
|
||||||
function tumblr_send(&$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;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(! strstr($b['postopts'],'tumblr'))
|
if(! strstr($b['postopts'],'tumblr')) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if($b['parent'] != $b['id'])
|
if($b['parent'] != $b['id']) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Dont't post if the post doesn't belong to us.
|
// Dont't post if the post doesn't belong to us.
|
||||||
// This is a check for forum postings
|
// 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']) {
|
if ($b['contact-id'] != $self['id']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -468,7 +468,7 @@ function twitter_post_hook(App $a, &$b)
|
||||||
|
|
||||||
// Dont't post if the post doesn't belong to us.
|
// Dont't post if the post doesn't belong to us.
|
||||||
// This is a check for forum postings
|
// 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']) {
|
if ($b['contact-id'] != $self['id']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -458,7 +458,7 @@ function windowsphonepush_login(App $a)
|
||||||
$user_id = User::authenticate($_SERVER['PHP_AUTH_USER'], trim($_SERVER['PHP_AUTH_PW']));
|
$user_id = User::authenticate($_SERVER['PHP_AUTH_USER'], trim($_SERVER['PHP_AUTH_PW']));
|
||||||
|
|
||||||
if ($user_id) {
|
if ($user_id) {
|
||||||
$record = dba::select('user', [], ['uid' => $user_id], ['limit' => 1]);
|
$record = dba::selectFirst('user', [], ['uid' => $user_id]);
|
||||||
} else {
|
} else {
|
||||||
logger('API_login failure: ' . print_r($_SERVER, true), LOGGER_DEBUG);
|
logger('API_login failure: ' . print_r($_SERVER, true), LOGGER_DEBUG);
|
||||||
header('WWW-Authenticate: Basic realm="Friendica"');
|
header('WWW-Authenticate: Basic realm="Friendica"');
|
||||||
|
|
|
@ -191,18 +191,21 @@ function wppost_post_local(&$a, &$b) {
|
||||||
|
|
||||||
function wppost_send(&$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;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(! strstr($b['postopts'],'wppost'))
|
if(! strstr($b['postopts'],'wppost')) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if($b['parent'] != $b['id'])
|
if($b['parent'] != $b['id']) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Dont't post if the post doesn't belong to us.
|
// Dont't post if the post doesn't belong to us.
|
||||||
// This is a check for forum postings
|
// 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']) {
|
if ($b['contact-id'] != $self['id']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue