[Scrutinizer] Fix undeclared variables in src/ (except Protocol/)

- Use dba::selectFirst to remove intermediate variables `$r`
- Remove unused variable `$url_recipients` in Worker\Dellivery
This commit is contained in:
Hypolite Petovan 2018-02-14 00:05:00 -05:00
parent 2234bb92ae
commit d419d07f73
17 changed files with 89 additions and 81 deletions

View file

@ -34,11 +34,12 @@ class Delivery {
$relocate = false;
$top_level = false;
$recipients = [];
$url_recipients = [];
$followup = false;
$normal_mode = true;
$item = null;
$recipients[] = $contact_id;
if ($cmd === 'mail') {
@ -182,16 +183,14 @@ class Delivery {
}
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `blocked` = 0 AND `pending` = 0",
intval($contact_id)
// We don't deliver our items to blocked or pending contacts, and not to ourselves either
$contact = dba::selectFirst('contact', [],
['id' => $contact_id, 'blocked' => false, 'pending' => false, 'self' => false]
);
if (DBM::is_result($r)) {
$contact = $r[0];
}
if ($contact['self']) {
if (!DBM::is_result($contact)) {
return;
}
$deliver_status = 0;
// Transmit via Diaspora if not possible via Friendica
@ -207,7 +206,7 @@ class Delivery {
logger('notifier: '.$target_item["guid"].' dfrndelivery: '.$contact['name']);
if ($mail) {
$item['body'] = Item::fixPrivatePhotos($item['body'],$owner['uid'],null,$message[0]['contact-id']);
$item['body'] = Item::fixPrivatePhotos($item['body'], $owner['uid'], null, $item['contact-id']);
$atom = DFRN::mail($item, $owner);
} elseif ($fsuggest) {
$atom = DFRN::fsuggest($item, $owner);

View file

@ -30,6 +30,8 @@ class DiscoverPoCo {
- check_profile: Update remote profile data
*/
$search = "";
$mode = 0;
if ($command == "dirsearch") {
$search = urldecode($param1);
$mode = 1;
@ -47,10 +49,7 @@ class DiscoverPoCo {
$mode = 7;
} elseif ($command == "check_profile") {
$mode = 8;
} elseif ($command == '') {
$search = "";
$mode = 0;
} else {
} elseif ($command !== "") {
logger("Unknown or missing parameter ".$command."\n");
return;
}

View file

@ -67,6 +67,7 @@ class Notifier {
$url_recipients = [];
$normal_mode = true;
$recipients_relocate = [];
if ($cmd === 'mail') {
$normal_mode = false;
@ -178,6 +179,10 @@ class Notifier {
// fill this in with a single salmon slap if applicable
$slap = '';
$followup = false;
$recipients_followup = [];
$conversants = [];
$sql_extra = '';
if (! ($mail || $fsuggest || $relocate)) {
$slap = OStatus::salmon($target_item, $owner);
@ -321,8 +326,6 @@ class Notifier {
Worker::add($a->queue['priority'], 'Notifier', 'uplink', $item_id);
}
$conversants = [];
foreach ($items as $item) {
$recipients[] = $item['contact-id'];
$conversants[] = $item['contact-id'];
@ -519,7 +522,7 @@ class Notifier {
// except for Diaspora batch jobs
// Don't deliver to folks who have already been delivered to
if (($rr['network'] !== NETWORK_DIASPORA) && (in_array($rr['id'],$conversants))) {
if (($rr['network'] !== NETWORK_DIASPORA) && (in_array($rr['id'], $conversants))) {
logger('notifier: already delivered id=' . $rr['id']);
continue;
}

View file

@ -153,6 +153,7 @@ class OnePoll
}
$importer = $r[0];
$url = '';
logger("poll: ({$contact['network']}-{$contact['id']}) IMPORTER: {$importer['name']}, CONTACT: {$contact['name']}");