mirror of
https://github.com/friendica/friendica
synced 2025-04-27 18:30:12 +00:00
[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:
parent
2234bb92ae
commit
d419d07f73
17 changed files with 89 additions and 81 deletions
|
@ -1365,6 +1365,7 @@ class Contact extends BaseObject
|
|||
$url = notags(trim($datarray['author-link']));
|
||||
$name = notags(trim($datarray['author-name']));
|
||||
$photo = notags(trim($datarray['author-avatar']));
|
||||
$nick = '';
|
||||
|
||||
if (is_object($item)) {
|
||||
$rawtag = $item->get_item_tags(NAMESPACE_ACTIVITY,'actor');
|
||||
|
@ -1398,20 +1399,16 @@ class Contact extends BaseObject
|
|||
intval(CONTACT_IS_FOLLOWER)
|
||||
);
|
||||
|
||||
$r = q("SELECT `id`, `network` FROM `contact` WHERE `uid` = %d AND `url` = '%s' AND `pending` = 1 LIMIT 1",
|
||||
intval($importer['uid']),
|
||||
dbesc($url)
|
||||
);
|
||||
if (DBM::is_result($r)) {
|
||||
$contact_record = $r[0];
|
||||
Contact::updateAvatar($photo, $importer["uid"], $contact_record["id"], true);
|
||||
}
|
||||
$contact_record = [
|
||||
'id' => dba::lastInsertId(),
|
||||
'network' => NETWORK_OSTATUS
|
||||
];
|
||||
Contact::updateAvatar($photo, $importer["uid"], $contact_record["id"], true);
|
||||
|
||||
/// @TODO Encapsulate this into a function/method
|
||||
$r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
|
||||
intval($importer['uid'])
|
||||
);
|
||||
if (DBM::is_result($r) && !in_array($r[0]['page-flags'], [PAGE_SOAPBOX, PAGE_FREELOVE, PAGE_COMMUNITY])) {
|
||||
$fields = ['uid', 'username', 'email', 'page-flags', 'notify-flags', 'language'];
|
||||
$user = dba::selectFirst('user', $fields, ['uid' => $importer['uid']]);
|
||||
if (DBM::is_result($user) && !in_array($user['page-flags'], [PAGE_SOAPBOX, PAGE_FREELOVE, PAGE_COMMUNITY])) {
|
||||
// create notification
|
||||
$hash = random_string();
|
||||
|
||||
|
@ -1423,16 +1420,16 @@ class Contact extends BaseObject
|
|||
|
||||
Group::addMember(User::getDefaultGroup($importer['uid'], $contact_record["network"]), $contact_record['id']);
|
||||
|
||||
if (($r[0]['notify-flags'] & NOTIFY_INTRO) &&
|
||||
in_array($r[0]['page-flags'], [PAGE_NORMAL])) {
|
||||
if (($user['notify-flags'] & NOTIFY_INTRO) &&
|
||||
in_array($user['page-flags'], [PAGE_NORMAL])) {
|
||||
|
||||
notification([
|
||||
'type' => NOTIFY_INTRO,
|
||||
'notify_flags' => $r[0]['notify-flags'],
|
||||
'language' => $r[0]['language'],
|
||||
'to_name' => $r[0]['username'],
|
||||
'to_email' => $r[0]['email'],
|
||||
'uid' => $r[0]['uid'],
|
||||
'notify_flags' => $user['notify-flags'],
|
||||
'language' => $user['language'],
|
||||
'to_name' => $user['username'],
|
||||
'to_email' => $user['email'],
|
||||
'uid' => $user['uid'],
|
||||
'link' => System::baseUrl() . '/notifications/intro',
|
||||
'source_name' => ((strlen(stripslashes($contact_record['name']))) ? stripslashes($contact_record['name']) : L10n::t('[Name Withheld]')),
|
||||
'source_link' => $contact_record['url'],
|
||||
|
@ -1442,13 +1439,12 @@ class Contact extends BaseObject
|
|||
]);
|
||||
|
||||
}
|
||||
} elseif (DBM::is_result($r) && in_array($r[0]['page-flags'], [PAGE_SOAPBOX, PAGE_FREELOVE, PAGE_COMMUNITY])) {
|
||||
} elseif (DBM::is_result($user) && in_array($user['page-flags'], [PAGE_SOAPBOX, PAGE_FREELOVE, PAGE_COMMUNITY])) {
|
||||
q("UPDATE `contact` SET `pending` = 0 WHERE `uid` = %d AND `url` = '%s' AND `pending` LIMIT 1",
|
||||
intval($importer['uid']),
|
||||
dbesc($url)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -665,6 +665,8 @@ class GContact
|
|||
{
|
||||
$gcontact_id = 0;
|
||||
$doprobing = false;
|
||||
$last_failure_str = '';
|
||||
$last_contact_str = '';
|
||||
|
||||
if (in_array($contact["network"], [NETWORK_PHANTOM])) {
|
||||
logger("Invalid network for contact url ".$contact["url"]." - Called by: ".System::callstack(), LOGGER_DEBUG);
|
||||
|
|
|
@ -251,9 +251,8 @@ class Item extends BaseObject
|
|||
$arr['network'] = trim(defaults($arr, 'network', NETWORK_PHANTOM));
|
||||
}
|
||||
|
||||
if ($notify) {
|
||||
$guid_prefix = "";
|
||||
} elseif ((trim($arr['guid']) == "") && (trim($arr['plink']) != "")) {
|
||||
$guid_prefix = '';
|
||||
if ((trim($arr['guid']) == "") && (trim($arr['plink']) != "")) {
|
||||
$arr['guid'] = self::guidFromUri($arr['plink']);
|
||||
} elseif ((trim($arr['guid']) == "") && (trim($arr['uri']) != "")) {
|
||||
$arr['guid'] = self::guidFromUri($arr['uri']);
|
||||
|
@ -521,6 +520,11 @@ class Item extends BaseObject
|
|||
|
||||
$arr['thr-parent'] = $arr['parent-uri'];
|
||||
|
||||
$notify_type = '';
|
||||
$allow_cid = '';
|
||||
$allow_gid = '';
|
||||
$deny_cid = '';
|
||||
$deny_gid = '';
|
||||
if ($arr['parent-uri'] === $arr['uri']) {
|
||||
$parent_id = 0;
|
||||
$parent_deleted = 0;
|
||||
|
|
|
@ -67,6 +67,7 @@ class Mail
|
|||
}
|
||||
}
|
||||
|
||||
$convuri = '';
|
||||
if (!$convid) {
|
||||
// create a new conversation
|
||||
$recip_host = substr($contact['url'], strpos($contact['url'], '://') + 3);
|
||||
|
|
|
@ -91,6 +91,9 @@ class Photo
|
|||
*/
|
||||
public static function importProfilePhoto($image_url, $uid, $cid, $quit_on_error = false)
|
||||
{
|
||||
$thumb = '';
|
||||
$micro = '';
|
||||
|
||||
$photo = dba::selectFirst(
|
||||
'photo', ['resource-id'], ['uid' => $uid, 'contact-id' => $cid, 'scale' => 4, 'album' => 'Contact Photos']
|
||||
);
|
||||
|
|
|
@ -565,8 +565,10 @@ class Profile
|
|||
Cache::set($cachekey, $r, CACHE_HOUR);
|
||||
}
|
||||
}
|
||||
|
||||
$total = 0;
|
||||
$classtoday = '';
|
||||
if (DBM::is_result($r)) {
|
||||
$total = 0;
|
||||
$now = strtotime('now');
|
||||
$cids = [];
|
||||
|
||||
|
|
|
@ -157,6 +157,8 @@ class User
|
|||
*/
|
||||
private static function getAuthenticationInfo($user_info)
|
||||
{
|
||||
$user = null;
|
||||
|
||||
if (is_object($user_info) || is_array($user_info)) {
|
||||
if (is_object($user_info)) {
|
||||
$user = (array) $user_info;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue