From 7c16a25fc9e2b9490da9120ed4d58e186a1e3917 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Thu, 20 Aug 2020 09:21:44 -0400 Subject: [PATCH 1/5] Account for $nav_bg not being set in frio/php/default - Address https://github.com/friendica/friendica/issues/8877#issuecomment-677319560 --- view/theme/frio/php/default.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/theme/frio/php/default.php b/view/theme/frio/php/default.php index ca661c2830..949417ccf2 100644 --- a/view/theme/frio/php/default.php +++ b/view/theme/frio/php/default.php @@ -71,7 +71,7 @@ $is_singleuser_class = $is_singleuser ? "is-singleuser" : "is-not-singleuser"; } } - $nav_bg = $nav_bg ?: DI::pConfig()->get($uid, 'frio', 'nav_bg', DI::config()->get('frio', 'nav_bg', '#708fa0')); + $nav_bg = $nav_bg ?? DI::pConfig()->get($uid, 'frio', 'nav_bg', DI::config()->get('frio', 'nav_bg', '#708fa0')); echo ''; ?> From ac90387d82a3484a0c120a3a986084fce6699e76 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Thu, 20 Aug 2020 09:23:00 -0400 Subject: [PATCH 2/5] Fix wrong contact array key reference in Search\Acl - Addresses https://github.com/friendica/friendica/issues/8877#issuecomment-672189155 --- src/Module/Search/Acl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Module/Search/Acl.php b/src/Module/Search/Acl.php index eb6dc6f859..e8b6f357d9 100644 --- a/src/Module/Search/Acl.php +++ b/src/Module/Search/Acl.php @@ -350,7 +350,7 @@ class Acl extends BaseModule 'type' => 'c', 'photo' => Contact::getMicro($contact), 'name' => htmlspecialchars($contact['name']), - 'id' => intval($contact['cid']), + 'id' => intval($contact['id']), 'network' => $contact['network'], 'link' => $contact['url'], 'nick' => htmlentities(($contact['nick'] ?? '') ?: $contact['addr']), From 40d12b85c4913820deed517ad78a54d7ed1899f8 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Thu, 20 Aug 2020 09:30:50 -0400 Subject: [PATCH 3/5] Loop on expected fields instead of existing fields in Settings\UserExport - We don't delete fields, so there can be more fields in the database than in the DB structure - Address https://github.com/friendica/friendica/issues/8877#issuecomment-663875895 --- src/Module/Settings/UserExport.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/Module/Settings/UserExport.php b/src/Module/Settings/UserExport.php index 0eaa72ffe6..132505371e 100644 --- a/src/Module/Settings/UserExport.php +++ b/src/Module/Settings/UserExport.php @@ -114,14 +114,11 @@ class UserExport extends BaseSettings $rows = DBA::p($query); while ($row = DBA::fetch($rows)) { $p = []; - foreach ($row as $k => $v) { - switch ($dbStructure[$table]['fields'][$k]['type']) { - case 'datetime': - $p[$k] = $v ?? DBA::NULL_DATETIME; - break; - default: - $p[$k] = $v; - break; + foreach ($dbStructure[$table]['fields'] as $column => $field) { + if ($field['type'] == 'datetime') { + $p[$column] = $v ?? DBA::NULL_DATETIME; + } else { + $p[$column] = $v; } } $result[] = $p; From b4d59c25a88c2d8d2769b947d9938c0f25d7e605 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Thu, 20 Aug 2020 09:32:20 -0400 Subject: [PATCH 4/5] Return early if $a->user is absent in BaseModule - Address https://github.com/friendica/friendica/issues/8877#issuecomment-660266026 --- src/BaseModule.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/BaseModule.php b/src/BaseModule.php index ce7774bfd0..a9f67f2375 100644 --- a/src/BaseModule.php +++ b/src/BaseModule.php @@ -140,6 +140,10 @@ abstract class BaseModule return false; } + if (empty($a->user)) { + return false; + } + $sec_hash = hash('whirlpool', $a->user['guid'] . $a->user['prvkey'] . session_id() . $x[0] . $typename); return ($sec_hash == $x[1]); From 78f6ea94bb355b260c935e17fd2f5b2e84ccbcb7 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Thu, 20 Aug 2020 09:34:37 -0400 Subject: [PATCH 5/5] Check for parent existence in Protocol\DFRN - Address https://github.com/friendica/friendica/issues/8877#issuecomment-660263687 --- src/Protocol/DFRN.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Protocol/DFRN.php b/src/Protocol/DFRN.php index 064f1f3aca..b09c1bea0f 100644 --- a/src/Protocol/DFRN.php +++ b/src/Protocol/DFRN.php @@ -963,10 +963,12 @@ class DFRN if ($item['gravity'] != GRAVITY_PARENT) { $parent_item = (($item['thr-parent']) ? $item['thr-parent'] : $item['parent-uri']); $parent = Item::selectFirst(['guid', 'plink'], ['uri' => $parent_item, 'uid' => $item['uid']]); - $attributes = ["ref" => $parent_item, "type" => "text/html", - "href" => $parent['plink'], - "dfrn:diaspora_guid" => $parent['guid']]; - XML::addElement($doc, $entry, "thr:in-reply-to", "", $attributes); + if (DBA::isResult($parent)) { + $attributes = ["ref" => $parent_item, "type" => "text/html", + "href" => $parent['plink'], + "dfrn:diaspora_guid" => $parent['guid']]; + XML::addElement($doc, $entry, "thr:in-reply-to", "", $attributes); + } } // Add conversation data. This is used for OStatus