Several more warnings ... (#5340)

* Some more warnings removed

* Even more warnings ...

* Will it ever end? ;-)

* Avoid warning in dbstructure

* Origin and OStatus ...

* There are more warnings solved ... yeah!

* And again ...

* We are not done yet

* And more ...

* And some new places ...

* And more in the feeds

* Avoid some more

* And some backend stuff

* Notifications cleared

* Some more stuff

* and again ...

* It's getting fewer ...

* Some warnings had been hidden in the notifications

* Fix the fix

* And another missing one ...

* We need the owner here, not the user

* Forgotten user

* And more ...

* And some more warnings disappeared ...

* Some more frontend warnings

* Some backend warnings removed

* Fixed sidebar for "vier"

* And more ...

* Some more ...

* And something for "remote self"

* Am I stuck in an endless loop?

* Fix: Clear tag and file field on update

* Preset page content
This commit is contained in:
Michael Vogel 2018-07-10 14:27:56 +02:00 committed by Hypolite Petovan
parent 32ef5623ab
commit 0360f7197a
48 changed files with 415 additions and 267 deletions

View file

@ -475,34 +475,34 @@ class Contact extends BaseObject
$profile = $default;
}
if (($profile["photo"] == "") && isset($default["photo"])) {
if (empty($profile["photo"]) && isset($default["photo"])) {
$profile["photo"] = $default["photo"];
}
if (($profile["name"] == "") && isset($default["name"])) {
if (empty($profile["name"]) && isset($default["name"])) {
$profile["name"] = $default["name"];
}
if (($profile["network"] == "") && isset($default["network"])) {
if (empty($profile["network"]) && isset($default["network"])) {
$profile["network"] = $default["network"];
}
if (($profile["thumb"] == "") && isset($profile["photo"])) {
if (empty($profile["thumb"]) && isset($profile["photo"])) {
$profile["thumb"] = $profile["photo"];
}
if (($profile["micro"] == "") && isset($profile["thumb"])) {
if (empty($profile["micro"]) && isset($profile["thumb"])) {
$profile["micro"] = $profile["thumb"];
}
if ((($profile["addr"] == "") || ($profile["name"] == "")) && ($profile["gid"] != 0)
if ((empty($profile["addr"]) || empty($profile["name"])) && (defaults($profile, "gid", 0) != 0)
&& in_array($profile["network"], [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS])
) {
Worker::add(PRIORITY_LOW, "UpdateGContact", $profile["gid"]);
}
// Show contact details of Diaspora contacts only if connected
if (($profile["cid"] == 0) && ($profile["network"] == NETWORK_DIASPORA)) {
if ((defaults($profile, "cid", 0) == 0) && (defaults($profile, "network", "") == NETWORK_DIASPORA)) {
$profile["location"] = "";
$profile["about"] = "";
$profile["gender"] = "";
@ -596,7 +596,7 @@ class Contact extends BaseObject
$uid = local_user();
}
if ($contact['uid'] != $uid) {
if (empty($contact['uid']) || ($contact['uid'] != $uid)) {
if ($uid == 0) {
$profile_link = self::magicLink($contact['url']);
$menu = ['profile' => [L10n::t('View Profile'), $profile_link, true]];
@ -1533,8 +1533,12 @@ class Contact extends BaseObject
$contact_record = [
'id' => dba::lastInsertId(),
'network' => NETWORK_OSTATUS
'network' => NETWORK_OSTATUS,
'name' => $name,
'url' => $url,
'photo' => $photo
];
Contact::updateAvatar($photo, $importer["uid"], $contact_record["id"], true);
/// @TODO Encapsulate this into a function/method

View file

@ -787,11 +787,11 @@ class GContact
// Bugfix: We had an error in the storing of keywords which lead to the "0"
// This value is still transmitted via poco.
if ($contact["keywords"] == "0") {
if (!empty($contact["keywords"]) && ($contact["keywords"] == "0")) {
unset($contact["keywords"]);
}
if ($public_contact[0]["keywords"] == "0") {
if (!empty($public_contact[0]["keywords"]) && ($public_contact[0]["keywords"] == "0")) {
$public_contact[0]["keywords"] = "";
}
@ -996,7 +996,7 @@ class GContact
$statistics = json_decode($result["body"]);
if (is_object($statistics->config)) {
if (!empty($statistics->config)) {
if ($statistics->config->instance_with_ssl) {
$server = "https://";
} else {
@ -1006,8 +1006,7 @@ class GContact
$server .= $statistics->config->instance_address;
$hostname = $statistics->config->instance_address;
} else {
/// @TODO is_object() above means here no object, still $statistics is being used as object
} elseif (!empty($statistics)) {
if ($statistics->instance_with_ssl) {
$server = "https://";
} else {
@ -1019,7 +1018,7 @@ class GContact
$hostname = $statistics->instance_address;
}
if (is_object($statistics->users)) {
if (!empty($statistics->users)) {
foreach ($statistics->users as $nick => $user) {
$profile_url = $server."/".$user->nickname;
@ -1027,9 +1026,13 @@ class GContact
"name" => $user->fullname,
"addr" => $user->nickname."@".$hostname,
"nick" => $user->nickname,
"about" => $user->bio,
"network" => NETWORK_OSTATUS,
"photo" => System::baseUrl()."/images/person-175.jpg"];
if (isset($user->bio)) {
$contact["about"] = $user->bio;
}
self::getId($contact);
}
}

View file

@ -726,21 +726,21 @@ class Item extends BaseObject
$author_owner_fields = ['author-name', 'author-avatar', 'author-link', 'owner-name', 'owner-avatar', 'owner-link'];
foreach ($author_owner_fields as $field) {
if (isset($fields[$field])) {
if (array_key_exists($field, $fields)) {
$fields[$field] = null;
}
}
if (array_key_exists('tag', $fields)) {
$tags = $fields['tag'];
unset($fields['tag']);
$fields['tag'] = null;
} else {
$tags = '';
}
if (array_key_exists('file', $fields)) {
$files = $fields['file'];
unset($fields['file']);
$fields['file'] = null;
} else {
$files = '';
}
@ -1329,12 +1329,7 @@ class Item extends BaseObject
if ($item['network'] == NETWORK_PHANTOM) {
logger('Missing network. Called by: '.System::callstack(), LOGGER_DEBUG);
$contact = Contact::getDetailsByURL($item['author-link'], $item['uid']);
if (!empty($contact['network'])) {
$item['network'] = $contact["network"];
} else {
$item['network'] = NETWORK_DFRN;
}
$item['network'] = NETWORK_DFRN;
logger("Set network to " . $item["network"] . " for " . $item["uri"], LOGGER_DEBUG);
}
@ -1505,7 +1500,11 @@ class Item extends BaseObject
put_item_in_cache($item);
if ($notify) {
$item['edit'] = false;
$item['parent'] = $parent_id;
Addon::callHooks('post_local', $item);
unset($item['edit']);
unset($item['parent']);
} else {
Addon::callHooks('post_remote', $item);
}
@ -1896,6 +1895,8 @@ class Item extends BaseObject
return;
}
$origin = $item['origin'];
unset($item['id']);
unset($item['parent']);
unset($item['mention']);
@ -1918,7 +1919,7 @@ class Item extends BaseObject
$parents = self::select(['uid', 'origin'], ["`uri` = ? AND `uid` != 0", $item['parent-uri']]);
while ($parent = dba::fetch($parents)) {
$users[$parent['uid']] = $parent['uid'];
if ($parent['origin'] && !$item['origin']) {
if ($parent['origin'] && !$origin) {
$origin_uid = $parent['uid'];
}
}
@ -2449,7 +2450,7 @@ class Item extends BaseObject
}
// Prevent the forwarding of posts that are forwarded
if ($datarray["extid"] == NETWORK_DFRN) {
if (!empty($datarray["extid"]) && ($datarray["extid"] == NETWORK_DFRN)) {
logger('Already forwarded', LOGGER_DEBUG);
return false;
}
@ -2940,6 +2941,7 @@ class Item extends BaseObject
'type' => 'activity',
'wall' => $item['wall'],
'origin' => 1,
'network' => NETWORK_DFRN,
'gravity' => GRAVITY_ACTIVITY,
'parent' => $item['id'],
'parent-uri' => $item['uri'],

View file

@ -40,11 +40,11 @@ class Profile
{
$location = '';
if ($profile['locality']) {
if (!empty($profile['locality'])) {
$location .= $profile['locality'];
}
if ($profile['region'] && ($profile['locality'] != $profile['region'])) {
if (!empty($profile['region']) && (defaults($profile, 'locality', '') != $profile['region'])) {
if ($location) {
$location .= ', ';
}
@ -52,7 +52,7 @@ class Profile
$location .= $profile['region'];
}
if ($profile['country-name']) {
if (!empty($profile['country-name'])) {
if ($location) {
$location .= ', ';
}
@ -307,6 +307,8 @@ class Profile
$connect = false;
}
$profile_url = '';
// Is the local user already connected to that user?
if ($connect && local_user()) {
if (isset($profile['url'])) {
@ -437,9 +439,9 @@ class Profile
'fullname' => $profile['name'],
'firstname' => $firstname,
'lastname' => $lastname,
'photo300' => $profile['contact_photo'],
'photo100' => $profile['contact_thumb'],
'photo50' => $profile['contact_micro'],
'photo300' => defaults($profile, 'contact_photo', ''),
'photo100' => defaults($profile, 'contact_thumb', ''),
'photo50' => defaults($profile, 'contact_micro', ''),
];
} else {
$diaspora = false;
@ -497,7 +499,7 @@ class Profile
$p['photo'] = proxy_url($p['photo'], false, PROXY_SIZE_SMALL);
}
$p['url'] = Contact::magicLink($p['url']);
$p['url'] = Contact::magicLink(defaults($p, 'url', $profile_url));
$tpl = get_markup_template('profile_vcard.tpl');
$o .= replace_macros($tpl, [