From 6e87291b3e6379f204e7f56b9076d811f477a74d Mon Sep 17 00:00:00 2001 From: Mike Macgirvin Date: Sun, 9 Jul 2023 18:28:02 +1000 Subject: [PATCH] not all hashtags were getting stored in term table --- Code/Lib/Activity.php | 13 ++++--------- Code/Module/Profile_photo.php | 1 + include/items.php | 3 ++- view/pdl/mod_profile.pdl | 3 +++ view/tpl/profile_photo.tpl | 1 + 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Code/Lib/Activity.php b/Code/Lib/Activity.php index af0fbfb01..a479ee8aa 100644 --- a/Code/Lib/Activity.php +++ b/Code/Lib/Activity.php @@ -447,12 +447,12 @@ class Activity { $ret = []; - if (array_key_exists('tag', $item) && is_array($item['tag'])) { $ptr = $item['tag']; if (!array_key_exists(0, $ptr)) { $ptr = [$ptr]; } + foreach ($ptr as $t) { if (!is_array($t)) { continue; @@ -471,13 +471,10 @@ class Activity if (!(array_key_exists('name', $t))) { continue; } - if (!(array_path_exists('icon/url', $t) || array_key_exists('href', $t))) { - continue; - } switch ($t['type']) { case 'Hashtag': - $ret[] = ['ttype' => TERM_HASHTAG, 'url' => $t['href'], 'term' => escape_tags((str_starts_with($t['name'], '#')) ? substr($t['name'], 1) : $t['name'])]; + $ret[] = ['ttype' => TERM_HASHTAG, 'url' => $t['id'] ?? $t['href'], 'term' => escape_tags((str_starts_with($t['name'], '#')) ? substr($t['name'], 1) : $t['name'])]; break; case 'Category': @@ -511,7 +508,7 @@ class Activity { $ret = []; - + logger('terms: ' . print_r($item['term'], true)); if (isset($item['term']) && is_array($item['term']) && $item['term']) { foreach ($item['term'] as $t) { switch ($t['ttype']) { @@ -3195,7 +3192,6 @@ class Activity $s['lon'] = floatval($location['longitude']); } } - if (is_array($act->obj) && !$response_activity) { $a = self::decode_taxonomy($act->obj); if ($a) { @@ -3223,7 +3219,6 @@ class Activity $s['iconfig'] = $a; } } - // Objects that might have media attachments which aren't already provided in the content element. // We'll check specific media objects separately. @@ -3510,7 +3505,7 @@ class Activity ]; Hook::call('decode_note', $hookinfo); - + logger('decode_note: ' . print_r($hookinfo['s'], true), LOGGER_DATA); return $hookinfo['s']; } diff --git a/Code/Module/Profile_photo.php b/Code/Module/Profile_photo.php index 126e74c52..d917c95c1 100644 --- a/Code/Module/Profile_photo.php +++ b/Code/Module/Profile_photo.php @@ -512,6 +512,7 @@ class Profile_photo extends Controller '$profiles' => $profiles, '$single' => ((count($profiles) == 1) ? true : false), '$profile0' => $profiles[0], + '$coverPhoto' => t('Change cover photo'), '$embedPhotos' => t('Use a photo from your albums'), '$embedPhotosModalTitle' => t('Use a photo from your albums'), '$embedPhotosModalCancel' => t('Cancel'), diff --git a/include/items.php b/include/items.php index 89cd12361..2f2c77148 100644 --- a/include/items.php +++ b/include/items.php @@ -1799,7 +1799,7 @@ function item_store($arr, $deliver = true) { $arr['comments_closed'] = $comments_closed; logger('item_store: ' . print_r($arr,true), LOGGER_DATA); - + logger('item_store_terms: ' . print_r($terms, true), LOGGER_DATA); create_table_from_array('item',$arr); // find the item we just created @@ -2154,6 +2154,7 @@ function item_store_update($arr, $deliver = true) { } logger('item_store_update: ' . print_r($arr,true), LOGGER_DATA); + logger('item_store_update_terms: ' . print_r($terms, true), LOGGER_DATA); $str = ''; foreach($arr as $k => $v) { diff --git a/view/pdl/mod_profile.pdl b/view/pdl/mod_profile.pdl index 7e15fc869..be5fb06d9 100644 --- a/view/pdl/mod_profile.pdl +++ b/view/pdl/mod_profile.pdl @@ -1,3 +1,6 @@ +[region=banner] +[widget=cover_photo][/widget] +[/region] [region=aside] [widget=fullprofile][/widget] [/region] diff --git a/view/tpl/profile_photo.tpl b/view/tpl/profile_photo.tpl index c473ec999..ac670b66b 100755 --- a/view/tpl/profile_photo.tpl +++ b/view/tpl/profile_photo.tpl @@ -1,3 +1,4 @@ +