From fc804751a2967db0d46385bb89248228b2b5d8bf Mon Sep 17 00:00:00 2001 From: jeroenpraat Date: Fri, 4 Sep 2015 12:39:47 +0200 Subject: Fix for PHP Fatal error: Function name must be a string in /var/www/hubzilla/include/items.php on line 3325 Please review if this is correct? --- include/items.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index 9807831e3..91afad0e6 100755 --- a/include/items.php +++ b/include/items.php @@ -3322,7 +3322,7 @@ function start_delivery_chain($channel, $item, $item_id, $parent) { dbesc($title), dbesc($body), intval($item_wall), - $intval($item_origin), + intval($item_origin), intval($item_id) ); -- cgit v1.2.3 From 6711ceb662a997d4f44743266a792ec762790d05 Mon Sep 17 00:00:00 2001 From: Habeas Codice Date: Mon, 7 Sep 2015 16:28:42 -0700 Subject: fix postgres zotfeed --- include/items.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index 01b4a3460..981f52d7a 100755 --- a/include/items.php +++ b/include/items.php @@ -4588,10 +4588,12 @@ function zot_feed($uid,$observer_hash,$arr) { $items = array(); - /** @FIXME fix this part for PostgreSQL */ + /** @FIXME re-unite these SQL statements. There is no need for them to be separate. The mySQL is convoluted with misuse of group by. As it stands, there is a slight difference where the postgres version doesn't remove the duplicate parents up to 100. In practice this doesn't matter. It could be made to match behavior by adding "distinct on (parent) " to the front of the selection list, at a not-worth-it performance penalty (page temp results to disk). duplicates are still ignored in the in() clause, you just get less than 100 parents if there are many children. */ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { - return array(); + $groupby = ''; + } else { + $groupby = 'GROUP BY parent'; } if(is_sys_channel($uid)) { @@ -4599,7 +4601,7 @@ function zot_feed($uid,$observer_hash,$arr) { WHERE uid != %d AND item_private = 0 AND item_restrict = 0 AND uid in (" . stream_perms_api_uids(PERMS_PUBLIC,10,1) . ") AND (item_flags & %d) > 0 - $sql_extra GROUP BY parent ORDER BY created ASC $limit", + $sql_extra $groupby ORDER BY created ASC $limit", intval($uid), intval(ITEM_WALL) ); @@ -4608,7 +4610,7 @@ function zot_feed($uid,$observer_hash,$arr) { $r = q("SELECT parent, created, postopts from item WHERE uid = %d AND item_restrict = 0 AND (item_flags & %d) > 0 - $sql_extra GROUP BY parent ORDER BY created ASC $limit", + $sql_extra $groupby ORDER BY created ASC $limit", intval($uid), intval(ITEM_WALL) ); -- cgit v1.2.3 From f13a8f725c393961b4e3cfa79f1eff348f3893f3 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 8 Sep 2015 19:14:29 -0700 Subject: export TERM_FILE when mirroring --- include/items.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index 5d38b0982..4c21d55a1 100755 --- a/include/items.php +++ b/include/items.php @@ -1309,7 +1309,7 @@ function encode_item($item,$mirror = false) { $x['comment_scope'] = $c_scope; if($item['term']) - $x['tags'] = encode_item_terms($item['term']); + $x['tags'] = encode_item_terms($item['term'],$mirror); if($item['diaspora_meta']) { $z = json_decode($item['diaspora_meta'],true); @@ -1401,11 +1401,16 @@ function encode_item_xchan($xchan) { return $ret; } -function encode_item_terms($terms) { +function encode_item_terms($terms,$mirror = false) { $ret = array(); $allowed_export_terms = array( TERM_UNKNOWN, TERM_HASHTAG, TERM_MENTION, TERM_CATEGORY, TERM_BOOKMARK ); + if($mirror) { + $allowed_export_terms[] = TERM_PCATEGORY; + $allowed_export_terms[] = TERM_FILE; + } + if($terms) { foreach($terms as $term) { if(in_array($term['type'],$allowed_export_terms)) -- cgit v1.2.3 From 0a051ff2cd13eb33ecffc3c4e34a1a56a3fcf29a Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 8 Sep 2015 22:46:34 -0700 Subject: preserve code blocks on item import if channel has code rights. When importing the channel itself, turn code access off unless this is the admin. --- include/items.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index 4c21d55a1..28fd8502b 100755 --- a/include/items.php +++ b/include/items.php @@ -833,10 +833,13 @@ function title_is_body($title, $body) { } -function get_item_elements($x) { +function get_item_elements($x,$allow_code = false) { $arr = array(); - $arr['body'] = (($x['body']) ? htmlspecialchars($x['body'],ENT_COMPAT,'UTF-8',false) : ''); + if($allow_code) + $arr['body'] = $x['body']; + else + $arr['body'] = (($x['body']) ? htmlspecialchars($x['body'],ENT_COMPAT,'UTF-8',false) : ''); $key = get_config('system','pubkey'); @@ -4731,6 +4734,12 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C if($arr['wall']) $sql_options .= " and item_wall = 1 "; + + if($arr['item_id']) + $sql_options .= " and parent = " . intval($arr['item_id']) . " "; + + 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 ) "; @@ -4857,11 +4866,15 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C require_once('include/security.php'); $sql_extra .= item_permissions_sql($channel['channel_id'],$observer_hash); + if($arr['pages']) $item_restrict = " AND item_type = " . ITEM_TYPE_WEBPAGE . " "; else $item_restrict = " AND item_type = 0 "; + if($arr['item_type'] === '*') + $item_restrict = ''; + if ($arr['nouveau'] && ($client_mode & CLIENT_MODE_LOAD) && $channel) { // "New Item View" - show all items unthreaded in reverse created date order -- cgit v1.2.3