From bc6d384ca91bf754c10ead1d787bf1452c20e9d4 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 18 Dec 2018 10:43:06 +0100 Subject: make mod channel deal with b64 encoded mid\s ; --- Zotlabs/Module/Channel.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php index 12d87885f..5fdefd805 100644 --- a/Zotlabs/Module/Channel.php +++ b/Zotlabs/Module/Channel.php @@ -124,6 +124,11 @@ class Channel extends Controller { $mid = ((x($_REQUEST,'mid')) ? $_REQUEST['mid'] : ''); + if(strpos($mid,'b64.') === 0) + $decoded = @base64url_decode(substr($mid,4)); + if($decoded) + $mid = $decoded; + $datequery = ((x($_GET,'dend') && is_a_date_arg($_GET['dend'])) ? notags($_GET['dend']) : ''); $datequery2 = ((x($_GET,'dbegin') && is_a_date_arg($_GET['dbegin'])) ? notags($_GET['dbegin']) : ''); @@ -375,6 +380,9 @@ class Channel extends Controller { if((! $update) && (! $load)) { + if($decoded) + $mid = 'b64.' . base64url_encode($mid); + // This is ugly, but we can't pass the profile_uid through the session to the ajax updater, // because browser prefetching might change it on us. We have to deliver it with the page. -- cgit v1.2.3 From 339c9cceeca1e9b54aa320aea48d164d1cc22e36 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 19 Dec 2018 10:05:18 +0100 Subject: check if we deal with an array before sizeof() --- Zotlabs/Module/Linkinfo.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Linkinfo.php b/Zotlabs/Module/Linkinfo.php index 7c7dc0e88..8b7defa39 100644 --- a/Zotlabs/Module/Linkinfo.php +++ b/Zotlabs/Module/Linkinfo.php @@ -138,8 +138,8 @@ class Linkinfo extends \Zotlabs\Web\Controller { } $image = ""; - - if(sizeof($siteinfo["images"]) > 0){ + + if(is_array($siteinfo["images"]) && (sizeof($siteinfo["images"]) > 0)){ /* Execute below code only if image is present in siteinfo */ $total_images = 0; @@ -161,7 +161,7 @@ class Linkinfo extends \Zotlabs\Web\Controller { $total_images ++; if($max_images && $max_images >= $total_images) break; - } + } } if(strlen($text)) { -- cgit v1.2.3 From 774dd6d5e333ac1988f1f3d830627cd7af68908e Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 19 Dec 2018 11:08:28 +0100 Subject: use count() instead of sizeof() --- Zotlabs/Module/Linkinfo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Linkinfo.php b/Zotlabs/Module/Linkinfo.php index 8b7defa39..32b4c0281 100644 --- a/Zotlabs/Module/Linkinfo.php +++ b/Zotlabs/Module/Linkinfo.php @@ -139,7 +139,7 @@ class Linkinfo extends \Zotlabs\Web\Controller { $image = ""; - if(is_array($siteinfo["images"]) && (sizeof($siteinfo["images"]) > 0)){ + if(is_array($siteinfo["images"]) && count($siteinfo["images"])){ /* Execute below code only if image is present in siteinfo */ $total_images = 0; -- cgit v1.2.3 From ec769bc9f948956a8093c675a14970461c5d8304 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 20 Dec 2018 19:45:11 +0100 Subject: missing observer check --- Zotlabs/Module/Like.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Like.php b/Zotlabs/Module/Like.php index d19154eb4..0455c5265 100644 --- a/Zotlabs/Module/Like.php +++ b/Zotlabs/Module/Like.php @@ -251,6 +251,9 @@ class Like extends \Zotlabs\Web\Controller { } } else { + + if(! $observer) + killme(); // this is used to like an item or comment -- cgit v1.2.3 From e34853e19ea10bde7a4dc2e585da3c26d7032bdb Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 21 Dec 2018 12:51:19 +0100 Subject: do not add timestamp to the photo src. caching is handled in mod photo now. --- Zotlabs/Module/Photos.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Photos.php b/Zotlabs/Module/Photos.php index b87c586da..3833d5088 100644 --- a/Zotlabs/Module/Photos.php +++ b/Zotlabs/Module/Photos.php @@ -988,7 +988,7 @@ class Photos extends \Zotlabs\Web\Controller { $photo = array( 'href' => z_root() . '/photo/' . $hires['resource_id'] . '-' . $hires['imgscale'] . '.' . $phototypes[$hires['mimetype']], 'title'=> t('View Full Size'), - 'src' => z_root() . '/photo/' . $lores['resource_id'] . '-' . $lores['imgscale'] . '.' . $phototypes[$lores['mimetype']] . '?f=&_u=' . datetime_convert('','','','ymdhis') + 'src' => z_root() . '/photo/' . $lores['resource_id'] . '-' . $lores['imgscale'] . '.' . $phototypes[$lores['mimetype']] ); if($nextlink) -- cgit v1.2.3 From 37d7d18bb7b1e3bcadbb11c43a761d6953c2dc55 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Mon, 24 Dec 2018 09:22:58 +0100 Subject: Faster image processing with photo cache addon --- Zotlabs/Module/Photo.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Photo.php b/Zotlabs/Module/Photo.php index e236cc5f4..96a4e1f40 100644 --- a/Zotlabs/Module/Photo.php +++ b/Zotlabs/Module/Photo.php @@ -159,14 +159,15 @@ class Photo extends \Zotlabs\Web\Controller { // Validate cache $cache = array( 'resid' => $photo, - 'url' => htmlspecialchars_decode($r[0]['display_path']) + 'status' => false ); if($cache_mode['on']) call_hooks('cache_url_hook', $cache); - if($cache['url'] != '') { - if(strpos(z_root(),'https:') !== false && strpos($cache['url'],'https:') === false) - $cache['url'] = z_root() . '/sslify/' . $filename . '?f=&url=' . urlencode($cache['url']); - header("Location: " . $cache['url']); + if(! $cache['status']) { + $url = htmlspecialchars_decode($r[0]['display_path']); + if(strpos(z_root(),'https:') !== false && strpos($url,'https:') === false) + $url = z_root() . '/sslify/' . $filename . '?f=&url=' . urlencode($url); + header("Location: " . $url); killme(); } } -- cgit v1.2.3 From b0339b848fc28aabee6cdc1b971330afc8e5ca89 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 2 Jan 2019 17:53:28 +0100 Subject: fix preg_match(): Delimiter must not be alphanumeric or backslash warning --- Zotlabs/Module/Pconfig.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Pconfig.php b/Zotlabs/Module/Pconfig.php index f31d5fdf6..06b94b34f 100644 --- a/Zotlabs/Module/Pconfig.php +++ b/Zotlabs/Module/Pconfig.php @@ -24,7 +24,7 @@ class Pconfig extends \Zotlabs\Web\Controller { $aj = intval($_POST['aj']); // Do not store "serialized" data received in the $_POST - if (preg_match('|^a:[0-9]+:{.*}$|s',$v) || preg_match('O:8:"stdClass":[0-9]+:{.*}$|s',$v)) { + if (preg_match('|^a:[0-9]+:{.*}$|s',$v) || preg_match('|O:8:"stdClass":[0-9]+:{.*}$|s',$v)) { return; } -- cgit v1.2.3 From 01f4ce96f1fe835db774acffb65b2553e1b44c0a Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 10 Jan 2019 13:35:27 +0100 Subject: do not count removed channels --- Zotlabs/Module/New_channel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/New_channel.php b/Zotlabs/Module/New_channel.php index 73cdf4c8c..98aa480fe 100644 --- a/Zotlabs/Module/New_channel.php +++ b/Zotlabs/Module/New_channel.php @@ -134,7 +134,7 @@ class New_channel extends \Zotlabs\Web\Controller { $default_role = ''; $aid = get_account_id(); if($aid) { - $r = q("select count(channel_id) as total from channel where channel_account_id = %d", + $r = q("select count(channel_id) as total from channel where channel_account_id = %d and channel_removed = 0", intval($aid) ); if($r && (! intval($r[0]['total']))) { -- cgit v1.2.3 From dba9c2fbb01c3d9de1d25aeb7c86a9be0e5031cf Mon Sep 17 00:00:00 2001 From: "DM42.Net (Matt Dent)" Date: Sun, 13 Jan 2019 14:34:04 -0500 Subject: Add pgrp_extras hook & display --- Zotlabs/Module/Group.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Group.php b/Zotlabs/Module/Group.php index c8ccaa2cb..6f3d09662 100644 --- a/Zotlabs/Module/Group.php +++ b/Zotlabs/Module/Group.php @@ -127,6 +127,10 @@ class Group extends Controller { $i++; } + $hookinfo = [ 'pgrp_extras' => '', 'group'=>$argv(1) ]; + call_hooks ('privacygroup_extras',$hookinfo); + $pgrp_extras = $hookinfo['pgrp_extras']; + $tpl = get_markup_template('privacy_groups.tpl'); $o = replace_macros($tpl, [ '$title' => t('Privacy Groups'), @@ -136,6 +140,7 @@ class Group extends Controller { // new group form '$gname' => array('groupname',t('Privacy group name')), '$public' => array('public',t('Members are visible to other channels'), false), + '$pgrp_extras' => $pgrp_extras, '$form_security_token' => get_form_security_token("group_edit"), '$submit' => t('Submit'), -- cgit v1.2.3 From e43331b7a2c0136a9c576b4cc0391f66d469b4cd Mon Sep 17 00:00:00 2001 From: "DM42.Net (Matt Dent)" Date: Sun, 13 Jan 2019 15:43:25 -0500 Subject: Add privacygroup_extras_post/drop hooks --- Zotlabs/Module/Group.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Group.php b/Zotlabs/Module/Group.php index 6f3d09662..8c5e4f943 100644 --- a/Zotlabs/Module/Group.php +++ b/Zotlabs/Module/Group.php @@ -75,6 +75,10 @@ class Group extends Controller { ); if($r) info( t('Privacy group updated.') . EOL ); + + $hookinfo = [ 'pgrp_extras' => '', 'group'=>$group['id'] ]; + call_hooks ('privacygroup_extras_post',$hookinfo); + build_sync_packet(local_channel(),null,true); } @@ -171,8 +175,11 @@ class Group extends Controller { ); if($r) $result = group_rmv(local_channel(),$r[0]['gname']); - if($result) + if($result) { + $hookinfo = [ 'pgrp_extras' => '', 'group'=>$argv(2) ]; + call_hooks ('privacygroup_extras_drop',$hookinfo); info( t('Privacy group removed.') . EOL); + } else notice( t('Unable to remove privacy group.') . EOL); } -- cgit v1.2.3 From f5e571ba40a7d3b98158af61b1ab649980bb8e27 Mon Sep 17 00:00:00 2001 From: "DM42.Net (Matt Dent)" Date: Sun, 13 Jan 2019 20:04:12 -0500 Subject: Remove stray $ --- Zotlabs/Module/Group.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Group.php b/Zotlabs/Module/Group.php index 8c5e4f943..3dcf903ad 100644 --- a/Zotlabs/Module/Group.php +++ b/Zotlabs/Module/Group.php @@ -131,7 +131,7 @@ class Group extends Controller { $i++; } - $hookinfo = [ 'pgrp_extras' => '', 'group'=>$argv(1) ]; + $hookinfo = [ 'pgrp_extras' => '', 'group'=>argv(1) ]; call_hooks ('privacygroup_extras',$hookinfo); $pgrp_extras = $hookinfo['pgrp_extras']; -- cgit v1.2.3