From 3694396758422010a712bf4d4520e3cff8941a84 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Tue, 24 Dec 2019 12:38:46 -0500 Subject: [PATCH 1/4] Rename wrong desc form value name in mod/events - Addresses https://github.com/friendica/friendica/issues/8000#issuecomment-568783457 --- mod/events.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mod/events.php b/mod/events.php index 5a5a22d31..5e129aaf6 100644 --- a/mod/events.php +++ b/mod/events.php @@ -437,7 +437,7 @@ function events_content(App $a) if (!empty($_REQUEST['nofinish'])) {$orig_event['nofinish'] = $_REQUEST['nofinish'];} if (!empty($_REQUEST['adjust'])) {$orig_event['adjust'] = $_REQUEST['adjust'];} if (!empty($_REQUEST['summary'])) {$orig_event['summary'] = $_REQUEST['summary'];} - if (!empty($_REQUEST['description'])) {$orig_event['description'] = $_REQUEST['description'];} + if (!empty($_REQUEST['desc'])) {$orig_event['desc'] = $_REQUEST['desc'];} if (!empty($_REQUEST['location'])) {$orig_event['location'] = $_REQUEST['location'];} if (!empty($_REQUEST['start'])) {$orig_event['start'] = $_REQUEST['start'];} if (!empty($_REQUEST['finish'])) {$orig_event['finish'] = $_REQUEST['finish'];} @@ -445,9 +445,9 @@ function events_content(App $a) $n_checked = (!empty($orig_event['nofinish']) ? ' checked="checked" ' : ''); $a_checked = (!empty($orig_event['adjust']) ? ' checked="checked" ' : ''); - $t_orig = !empty($orig_event) ? $orig_event['summary'] : ''; - $d_orig = !empty($orig_event) ? $orig_event['desc'] : ''; - $l_orig = !empty($orig_event) ? $orig_event['location'] : ''; + $t_orig = $orig_event['summary'] ?? ''; + $d_orig = $orig_event['desc'] ?? ''; + $l_orig = $orig_event['location'] ?? ''; $eid = !empty($orig_event) ? $orig_event['id'] : 0; $cid = !empty($orig_event) ? $orig_event['cid'] : 0; $uri = !empty($orig_event) ? $orig_event['uri'] : ''; From b4704b720503d0b5055ce16ac5ce2e854a1a293f Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Tue, 24 Dec 2019 12:45:30 -0500 Subject: [PATCH 2/4] Protect potentially missing array keys in mod/profiles - Addresses https://github.com/friendica/friendica/issues/8000#issuecomment-568784029 - Addresses https://github.com/friendica/friendica/issues/8000#issuecomment-568785161 --- mod/profiles.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/mod/profiles.php b/mod/profiles.php index 72bcac49f..d3a6c3e38 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -207,7 +207,7 @@ function profiles_post(App $a) { return; } - $dob = $_POST['dob'] ? Strings::escapeHtml(trim($_POST['dob'])) : '0000-00-00'; + $dob = !empty($_POST['dob']) ? Strings::escapeHtml(trim($_POST['dob'])) : '0000-00-00'; $y = substr($dob, 0, 4); if ((! ctype_digit($y)) || ($y < 1900)) { @@ -238,17 +238,17 @@ function profiles_post(App $a) { $namechanged = true; } - $pdesc = Strings::escapeTags(trim($_POST['pdesc'])); - $gender = Strings::escapeTags(trim($_POST['gender'])); - $address = Strings::escapeTags(trim($_POST['address'])); - $locality = Strings::escapeTags(trim($_POST['locality'])); - $region = Strings::escapeTags(trim($_POST['region'])); - $postal_code = Strings::escapeTags(trim($_POST['postal_code'])); - $country_name = Strings::escapeTags(trim($_POST['country_name'])); - $pub_keywords = profile_clean_keywords(Strings::escapeTags(trim($_POST['pub_keywords']))); - $prv_keywords = profile_clean_keywords(Strings::escapeTags(trim($_POST['prv_keywords']))); - $marital = Strings::escapeTags(trim($_POST['marital'])); - $howlong = Strings::escapeTags(trim($_POST['howlong'])); + $pdesc = Strings::escapeTags(trim($_POST['pdesc'] ?? '')); + $gender = Strings::escapeTags(trim($_POST['gender'] ?? '')); + $address = Strings::escapeTags(trim($_POST['address'] ?? '')); + $locality = Strings::escapeTags(trim($_POST['locality'] ?? '')); + $region = Strings::escapeTags(trim($_POST['region'] ?? '')); + $postal_code = Strings::escapeTags(trim($_POST['postal_code'] ?? '')); + $country_name = Strings::escapeTags(trim($_POST['country_name'] ?? '')); + $pub_keywords = profile_clean_keywords(Strings::escapeTags(trim($_POST['pub_keywords'] ?? ''))); + $prv_keywords = profile_clean_keywords(Strings::escapeTags(trim($_POST['prv_keywords'] ?? ''))); + $marital = Strings::escapeTags(trim($_POST['marital'] ?? '')); + $howlong = Strings::escapeTags(trim($_POST['howlong'] ?? '')); $with = (!empty($_POST['with']) ? Strings::escapeTags(trim($_POST['with'])) : ''); @@ -338,7 +338,7 @@ function profiles_post(App $a) { $hide_friends = (($_POST['hide-friends'] == 1) ? 1: 0); - PConfig::set(local_user(), 'system', 'detailled_profile', (($_POST['detailed_profile'] == 1) ? 1: 0)); + PConfig::set(local_user(), 'system', 'detailled_profile', !empty($_POST['detailed_profile']) ? 1: 0); $changes = []; if ($is_default) { From 66e9f0e0da788519344625a539c0f3dd3fc50179 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Tue, 24 Dec 2019 15:19:08 -0500 Subject: [PATCH 3/4] Remove unused albumname input in album drop modal - Addresses https://github.com/friendica/friendica/issues/8000#issuecomment-568798634 --- mod/photos.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/mod/photos.php b/mod/photos.php index 2f3e7d311..1d7ce7b3d 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -1035,14 +1035,10 @@ function photos_content(App $a) if ($cmd === 'drop') { $drop_url = $a->query_string; - $extra_inputs = [ - ['name' => 'albumname', 'value' => $_POST['albumname']], - ]; - return Renderer::replaceMacros(Renderer::getMarkupTemplate('confirm.tpl'), [ '$method' => 'post', '$message' => L10n::t('Do you really want to delete this photo album and all its photos?'), - '$extra_inputs' => $extra_inputs, + '$extra_inputs' => [], '$confirm' => L10n::t('Delete Album'), '$confirm_url' => $drop_url, '$confirm_name' => 'dropalbum', From 17c252f3c770e32291ae3667d53dcd750d6f334a Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Tue, 24 Dec 2019 15:37:35 -0500 Subject: [PATCH 4/4] Ensure pubkey key is present in APContact::getByUrl result - Addresses https://github.com/friendica/friendica/issues/8000#issuecomment-568799866 --- src/Model/APContact.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Model/APContact.php b/src/Model/APContact.php index e3c3a0a12..c53503448 100644 --- a/src/Model/APContact.php +++ b/src/Model/APContact.php @@ -192,6 +192,7 @@ class APContact extends BaseObject $apcontact['addr'] = ''; } + $apcontact['pubkey'] = null; if (!empty($compacted['w3id:publicKey'])) { $apcontact['pubkey'] = trim(JsonLD::fetchElement($compacted['w3id:publicKey'], 'w3id:publicKeyPem', '@value')); }