diff options
author | Mario <mario@mariovavti.com> | 2021-09-08 07:43:40 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2021-09-08 07:43:40 +0000 |
commit | 4c5f0a05c75cc66113f589a3ffe6df351abb1273 (patch) | |
tree | 15148d08a99f8375992e554a90e6d4333286a7cc /Zotlabs/Module/Hq.php | |
parent | 952407363e245d41986cfb90e4ccf509bddc7322 (diff) | |
parent | 977a55eb8423745e4d88257b704d3e36f7337b9f (diff) | |
download | volse-hubzilla-4c5f0a05c75cc66113f589a3ffe6df351abb1273.tar.gz volse-hubzilla-4c5f0a05c75cc66113f589a3ffe6df351abb1273.tar.bz2 volse-hubzilla-4c5f0a05c75cc66113f589a3ffe6df351abb1273.zip |
Merge branch '6.2RC'6.2
Diffstat (limited to 'Zotlabs/Module/Hq.php')
-rw-r--r-- | Zotlabs/Module/Hq.php | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php index 8c126d154..929f2b758 100644 --- a/Zotlabs/Module/Hq.php +++ b/Zotlabs/Module/Hq.php @@ -23,15 +23,21 @@ class Hq extends \Zotlabs\Web\Controller { function get($update = 0, $load = false) { - if(!local_channel()) + if(!local_channel()) { return; + } if(argc() > 1 && argv(1) !== 'load') { - $item_hash = argv(1); + $item_hash = unpack_link_id(argv(1)); } if(isset($_REQUEST['mid'])) { - $item_hash = $_REQUEST['mid']; + $item_hash = unpack_link_id($_REQUEST['mid']); + } + + if($item_hash === false) { + notice(t('Malformed message id.') . EOL); + return; } $item_normal = item_normal(); @@ -41,22 +47,17 @@ class Hq extends \Zotlabs\Web\Controller { $r = q("SELECT mid FROM item WHERE uid = %d $item_normal AND mid = parent_mid + AND item_private IN (0, 1) ORDER BY created DESC LIMIT 1", intval(local_channel()) ); if($r[0]['mid']) { - $item_hash = 'b64.' . base64url_encode($r[0]['mid']); + $item_hash = $r[0]['mid']; } } if($item_hash) { - if(strpos($item_hash,'b64.') === 0) - $decoded = @base64url_decode(substr($item_hash,4)); - - if($decoded) - $item_hash = $decoded; - $target_item = null; $r = q("select id, uid, mid, parent_mid, thr_parent, verb, item_type, item_deleted, item_blocked from item where mid = '%s' limit 1", @@ -124,10 +125,9 @@ class Hq extends \Zotlabs\Web\Controller { if($target_item) { // if the target item is not a post (eg a like) we want to address its thread parent //$mid = ((($target_item['verb'] == ACTIVITY_LIKE) || ($target_item['verb'] == ACTIVITY_DISLIKE)) ? $target_item['thr_parent'] : $target_item['mid']); - $mid = $target_item['mid']; + // if we got a decoded hash we must encode it again before handing to javascript - if($decoded) - $mid = 'b64.' . base64url_encode($mid); + $mid = gen_link_id($target_item['mid']); } else { $mid = ''; |