From 5abbfd3f19b6b77ea8d6dd418afcb84775716f21 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Mon, 29 Apr 2019 23:21:17 +0200 Subject: Add initial threaded comment support --- include/items.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/items.php b/include/items.php index c08deb3a0..7a5c2c3c3 100755 --- a/include/items.php +++ b/include/items.php @@ -1875,9 +1875,12 @@ function item_store($arr, $allow_exec = false, $deliver = true) { // is the new message multi-level threaded? // even though we don't support it now, preserve the info // and re-attach to the conversation parent. + + // @FIXME when we'll start threaded comments support, + // now this respected on mid / parent_mid level (MK) if($r[0]['mid'] != $r[0]['parent_mid']) { - $arr['parent_mid'] = $r[0]['parent_mid']; + //$arr['parent_mid'] = $r[0]['parent_mid']; $z = q("SELECT * FROM item WHERE mid = '%s' AND parent_mid = '%s' AND uid = %d ORDER BY id ASC LIMIT 1", dbesc($r[0]['parent_mid']), @@ -4278,7 +4281,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C if($arr['mid']) $sql_options .= " and parent_mid = '" . dbesc($arr['mid']) . "' "; - $sql_extra = " AND item.parent IN ( SELECT parent FROM item WHERE item_thread_top = 1 $sql_options $item_normal ) "; + $sql_extra = " AND item.parent IN ( SELECT parent FROM item WHERE $item_uids and item_thread_top = 1 $sql_options $item_normal ) "; if($arr['since_id']) $sql_extra .= " and item.id > " . $since_id . " "; -- cgit v1.2.3 From 39da3459c7e4fd0a9e3ac428baed994688a095bd Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Mon, 29 Apr 2019 21:19:26 +0000 Subject: Add 'reply on comment' feature (cherry picked from commit 80ca2023aa67ef7c0c43414acaf135e5748044b2) --- include/features.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include') diff --git a/include/features.php b/include/features.php index d021f9394..b0d02c141 100644 --- a/include/features.php +++ b/include/features.php @@ -167,6 +167,14 @@ function get_features($filtered = true, $level = (-1)) { t('Ability to mark special posts with a star indicator'), false, get_config('feature_lock','star_posts'), + ], + + [ + 'reply_to', + t('Reply on comment'), + t('Ability to reply on selected comment'), + false, + get_config('feature_lock','reply_to'), ] ], -- cgit v1.2.3 From 8847838c43e1909cabcc57dd7d21319345b7d9b4 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 1 May 2019 15:40:06 +0200 Subject: address xmlify/unxmlify performance issue --- include/text.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/text.php b/include/text.php index 41603f6e4..276264162 100644 --- a/include/text.php +++ b/include/text.php @@ -409,7 +409,8 @@ function autoname($len) { * @return string Escaped text. */ function xmlify($str) { - $buffer = ''; + + //$buffer = ''; if(is_array($str)) { @@ -418,7 +419,7 @@ function xmlify($str) { btlogger('xmlify called with array: ' . print_r($str,true), LOGGER_NORMAL, LOG_WARNING); } - +/* $len = mb_strlen($str); for($x = 0; $x < $len; $x ++) { $char = mb_substr($str,$x,1); @@ -452,6 +453,11 @@ function xmlify($str) { $buffer = trim($buffer); return($buffer); +*/ + $buffer = htmlspecialchars($str, ENT_QUOTES, "UTF-8"); + $buffer = trim($buffer); + return $buffer; + } /** @@ -464,9 +470,13 @@ function xmlify($str) { * @return string */ function unxmlify($s) { +/* $ret = str_replace('&', '&', $s); $ret = str_replace(array('<', '>', '"', '''), array('<', '>', '"', "'"), $ret); + return $ret; +*/ + $ret = htmlspecialchars_decode($s, ENT_QUOTES); return $ret; } -- cgit v1.2.3 From 0d003e7450b6845e2fe0563c9bb04d67e7b7e360 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Wed, 1 May 2019 15:45:12 +0200 Subject: Preserve parent_mid with threaded comments --- include/items.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'include') diff --git a/include/items.php b/include/items.php index 7a5c2c3c3..95b696034 100755 --- a/include/items.php +++ b/include/items.php @@ -1875,12 +1875,9 @@ function item_store($arr, $allow_exec = false, $deliver = true) { // is the new message multi-level threaded? // even though we don't support it now, preserve the info // and re-attach to the conversation parent. - - // @FIXME when we'll start threaded comments support, - // now this respected on mid / parent_mid level (MK) if($r[0]['mid'] != $r[0]['parent_mid']) { - //$arr['parent_mid'] = $r[0]['parent_mid']; + $arr['parent_mid'] = $r[0]['parent_mid']; $z = q("SELECT * FROM item WHERE mid = '%s' AND parent_mid = '%s' AND uid = %d ORDER BY id ASC LIMIT 1", dbesc($r[0]['parent_mid']), -- cgit v1.2.3 From 6672299f8ac973e92950f2134d5f7a5ec81825f3 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 2 May 2019 10:11:08 +0200 Subject: calendar merge: use b64 encoded mid for plink --- include/event.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/event.php b/include/event.php index cfca00a3c..01122abed 100644 --- a/include/event.php +++ b/include/event.php @@ -1185,7 +1185,7 @@ function event_store_item($arr, $event) { // otherwise we'll fallback to /display/$message_id if($wall) - $item_arr['plink'] = z_root() . '/channel/' . $z[0]['channel_address'] . '/?f=&mid=' . urlencode($item_arr['mid']); + $item_arr['plink'] = z_root() . '/channel/' . $z[0]['channel_address'] . '/?f=&mid=' . gen_link_id($item_arr['mid']); else $item_arr['plink'] = z_root() . '/display/' . gen_link_id($item_arr['mid']); -- cgit v1.2.3