From c53f788cc85f83f00e1b5bec19efd54f1372a12b Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 17 Apr 2018 23:36:35 -0700 Subject: add alt_pager to mod_moderate, remove legacy $a parameter from all occurrences of alt_pager --- include/text.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/text.php b/include/text.php index bc44f22f3..e04b51610 100644 --- a/include/text.php +++ b/include/text.php @@ -531,7 +531,7 @@ function paginate(&$a) { } -function alt_pager(&$a, $i, $more = '', $less = '') { +function alt_pager($i, $more = '', $less = '') { if(! $more) $more = t('older'); -- cgit v1.2.3 From 2ec28a59932defdf6353f8ed72e3e67ef5a90f9a Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 18 Apr 2018 15:56:57 -0700 Subject: just provide the trending tags in public stream by default and simplify the query to improve load times; I intend to do additional work on this feature later --- include/taxonomy.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/taxonomy.php b/include/taxonomy.php index f65cdd941..e8d33986f 100644 --- a/include/taxonomy.php +++ b/include/taxonomy.php @@ -338,7 +338,7 @@ function pub_tagadelic($net,$site,$limit,$recent,$safemode,$type) { else { $sys = get_sys_channel(); $uids = " and item.uid = " . intval($sys['channel_id']) . " "; - $sql_extra = item_permissions_sql($sys['channel_id']); + $sql_extra = " and item_private = 0 "; } if($recent) -- cgit v1.2.3 From 85ccfb4bbcbd22ac234a8ac2a3d7ec2ec831ae29 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 18 Apr 2018 17:07:29 -0700 Subject: do not queue anything which lacks a destination url --- include/queue_fn.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/queue_fn.php b/include/queue_fn.php index 798ac36db..f05bac5b0 100644 --- a/include/queue_fn.php +++ b/include/queue_fn.php @@ -95,6 +95,12 @@ function queue_set_delivered($id,$channel = 0) { function queue_insert($arr) { + // do not queue anything with no destination + + if(! (array_key_exists('posturl',$arr) && trim($arr['posturl']))) { + return false; + } + $x = q("insert into outq ( outq_hash, outq_account, outq_channel, outq_driver, outq_posturl, outq_async, outq_priority, outq_created, outq_updated, outq_scheduled, outq_notify, outq_msg ) values ( '%s', %d, %d, '%s', '%s', %d, %d, '%s', '%s', '%s', '%s', '%s' )", -- cgit v1.2.3 From a2e0706d55ee02cf665f366616ef10ff624b3bcc Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 18 Apr 2018 17:26:05 -0700 Subject: relax restrictions to the design tools menu to allow those with write_pages permission; this doesn't fix the underlying modules though as there are some potential security issues at the moment. --- include/text.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/text.php b/include/text.php index e04b51610..55fc49560 100644 --- a/include/text.php +++ b/include/text.php @@ -2404,7 +2404,7 @@ function jindent($json) { */ function design_tools() { - $channel = App::get_channel(); + $channel = channelx_by_n(App::$profile['profile_uid']); $sys = false; if(App::$is_sys && is_site_admin()) { -- cgit v1.2.3 From a81011333fc113006fbf49b561915532f6cd2509 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 18 Apr 2018 19:41:09 -0700 Subject: follow activitypub by webfinger; requires addon update to all federation protocols --- include/follow.php | 8 ++++---- include/network.php | 9 +++++---- 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/follow.php b/include/follow.php index a63fe66ea..d803afa3f 100644 --- a/include/follow.php +++ b/include/follow.php @@ -150,9 +150,9 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false) // attempt network auto-discovery - $d = discover_by_webbie($url,$protocol); + $wf = discover_by_webbie($url,$protocol); - if((! $d) && ($is_http)) { + if((! $wf) && ($is_http)) { // try RSS discovery @@ -167,9 +167,9 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false) } } - if($d) { + if($wf || $d) { $r = q("select * from xchan where xchan_hash = '%s' or xchan_url = '%s' limit 1", - dbesc($url), + dbesc(($wf) ? $wf : $url), dbesc($url) ); } diff --git a/include/network.php b/include/network.php index 897fbccd6..c41d87af0 100644 --- a/include/network.php +++ b/include/network.php @@ -1192,9 +1192,10 @@ function discover_by_webbie($webbie, $protocol = '') { logger('webfinger: ' . print_r($x,true), LOGGER_DATA, LOG_INFO); $arr = [ - 'address' => $webbie, - 'protocol' => $protocol, - 'success' => false, + 'address' => $webbie, + 'protocol' => $protocol, + 'success' => false, + 'xchan' => '', 'webfinger' => $x ]; /** @@ -1207,7 +1208,7 @@ function discover_by_webbie($webbie, $protocol = '') { */ call_hooks('discover_channel_webfinger', $arr); if($arr['success']) - return true; + return $arr['xchan']; return false; } -- cgit v1.2.3 From 2254262cf0bc89fb671b71fafde795a6b596e17f Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 19 Apr 2018 17:43:50 -0700 Subject: code booboo may have degraded the performance of the Trending tag query more than necessary --- include/taxonomy.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/taxonomy.php b/include/taxonomy.php index e8d33986f..46d95458c 100644 --- a/include/taxonomy.php +++ b/include/taxonomy.php @@ -312,7 +312,8 @@ function article_tagadelic($uid, $count = 0, $authors = '', $owner = '', $flags function pubtagblock($net,$site,$limit,$recent = 0,$safemode = 1, $type = TERM_HASHTAG) { $o = ''; - $r = pub_tagadelic($net,$site,$limit,$since,$safemode,$type); + $r = pub_tagadelic($net,$site,$limit,$recent,$safemode,$type); + $link = z_root() . '/pubstream'; if($r) { -- cgit v1.2.3 From 636fb95e24ad802edf40c48164692409a243164b Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 19 Apr 2018 23:35:24 -0700 Subject: permissions php error applying bit compare operation on a (presumed) boolean --- include/permissions.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/permissions.php b/include/permissions.php index f97142fab..591fe7ce5 100644 --- a/include/permissions.php +++ b/include/permissions.php @@ -47,6 +47,9 @@ function get_all_perms($uid, $observer_xchan, $internal_use = true) { // First find out what the channel owner declared permissions to be. $channel_perm = \Zotlabs\Access\PermissionLimits::Get($uid,$perm_name); + if($channel_perm === false) { + $channel_perm = 0; + } if(! $channel_checked) { $r = q("select * from channel where channel_id = %d limit 1", -- cgit v1.2.3 From 8d0cbeab388b1a7f3eb426f71c97ff690496005d Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 19 Apr 2018 23:37:47 -0700 Subject: better fix to permisisons.php - just cast to int. That's exactly what we want. --- include/permissions.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'include') diff --git a/include/permissions.php b/include/permissions.php index 591fe7ce5..185d37b6a 100644 --- a/include/permissions.php +++ b/include/permissions.php @@ -46,10 +46,7 @@ function get_all_perms($uid, $observer_xchan, $internal_use = true) { // First find out what the channel owner declared permissions to be. - $channel_perm = \Zotlabs\Access\PermissionLimits::Get($uid,$perm_name); - if($channel_perm === false) { - $channel_perm = 0; - } + $channel_perm = intval(\Zotlabs\Access\PermissionLimits::Get($uid,$perm_name)); if(! $channel_checked) { $r = q("select * from channel where channel_id = %d limit 1", -- cgit v1.2.3 From 55dc6fbc1cae70e4f2b207c517c8c9155fda9662 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 22 Apr 2018 18:12:16 -0700 Subject: imagemagick preserves exif when scaling. GD does not. We do not want to preserve exif on thumbnails which we have rotated, as a browser reading the exif information could rotate them yet again. This checkin adds an abstract function to the generic photo driver which makes the behaviour consistent by stripping EXIF from imagick processed images. However, we will attempt to preserve any ICC colour profiles. See http://php.net/manual/en/imagick.stripimage.php --- include/photo/photo_driver.php | 1 + include/photo/photo_gd.php | 5 +++++ include/photo/photo_imagick.php | 13 +++++++++++++ include/photos.php | 4 ++++ 4 files changed, 23 insertions(+) (limited to 'include') diff --git a/include/photo/photo_driver.php b/include/photo/photo_driver.php index 22d2b776d..2e2f5a758 100644 --- a/include/photo/photo_driver.php +++ b/include/photo/photo_driver.php @@ -75,6 +75,7 @@ abstract class photo_driver { abstract function imageString(); + abstract function clearexif(); public function __construct($data, $type='') { $this->types = $this->supportedTypes(); diff --git a/include/photo/photo_gd.php b/include/photo/photo_gd.php index 24bdc204f..e98ac2827 100644 --- a/include/photo/photo_gd.php +++ b/include/photo/photo_gd.php @@ -35,6 +35,11 @@ class photo_gd extends photo_driver { } + public function clearexif() { + return; + } + + public function destroy() { if($this->is_valid()) { imagedestroy($this->image); diff --git a/include/photo/photo_imagick.php b/include/photo/photo_imagick.php index 32bb61342..89577e71e 100644 --- a/include/photo/photo_imagick.php +++ b/include/photo/photo_imagick.php @@ -96,6 +96,19 @@ class photo_imagick extends photo_driver { } + public function clearexif() { + + $profiles = $this->image->getImageProfiles("icc", true); + + $this->image->stripImage(); + + if(!empty($profiles)) { + $this->image->profileImage("icc", $profiles['icc']); + } + } + + + public function getImage() { if(!$this->is_valid()) return FALSE; diff --git a/include/photos.php b/include/photos.php index 321f7159c..9ae0e6874 100644 --- a/include/photos.php +++ b/include/photos.php @@ -211,6 +211,10 @@ function photo_upload($channel, $observer, $args) { $ph->orient($exif); } + + $ph->clearexif(); + + @unlink($src); $max_length = get_config('system','max_image_length'); -- cgit v1.2.3 From fedb5fbcf5bf2a5dcecc0ad6324775ccbedbf3d6 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 23 Apr 2018 10:47:35 +0200 Subject: update zot.php to fix php warning invalid argument supplied for foreach() - this is taken from pr #1085 which was against wrong branch --- include/zot.php | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'include') diff --git a/include/zot.php b/include/zot.php index c2b622277..0343f4464 100644 --- a/include/zot.php +++ b/include/zot.php @@ -3811,25 +3811,27 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) { foreach($x as $y) { // for each group, loop on members list we just received - foreach($members[$y['hash']] as $member) { - $found = false; - $z = q("select xchan from group_member where gid = %d and uid = %d and xchan = '%s' limit 1", - intval($y['id']), - intval($channel['channel_id']), - dbesc($member) - ); - if($z) - $found = true; - - // if somebody is in the group that wasn't before - add them - - if(! $found) { - q("INSERT INTO group_member (uid, gid, xchan) - VALUES( %d, %d, '%s' ) ", - intval($channel['channel_id']), + if(isset($y['hash']) && isset($members[$y['hash']])) { + foreach($members[$y['hash']] as $member) { + $found = false; + $z = q("select xchan from group_member where gid = %d and uid = %d and xchan = '%s' limit 1", intval($y['id']), + intval($channel['channel_id']), dbesc($member) ); + if($z) + $found = true; + + // if somebody is in the group that wasn't before - add them + + if(! $found) { + q("INSERT INTO group_member (uid, gid, xchan) + VALUES( %d, %d, '%s' ) ", + intval($channel['channel_id']), + intval($y['id']), + dbesc($member) + ); + } } } -- cgit v1.2.3 From 9ac67b44e42f433e34f60556e631b7573a83eb50 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 23 Apr 2018 11:37:39 +0200 Subject: strings update --- include/conversation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/conversation.php b/include/conversation.php index 30acd6329..97dd402fc 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -930,7 +930,7 @@ function thread_action_menu($item,$mode = '') { $menu[] = [ 'menu' => 'view_source', 'title' => t('View Source'), - 'icon' => 'eye', + 'icon' => 'code', 'action' => 'viewsrc(' . $item['id'] . '); return false;', 'href' => '#' ]; -- cgit v1.2.3