From d377660b5a8800fdce33bbafcc166a8b2a6076d1 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 31 Aug 2018 20:26:31 +0200 Subject: update 1218: missing default value for pg --- Zotlabs/Update/_1218.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Zotlabs/Update/_1218.php b/Zotlabs/Update/_1218.php index 67d8b49a5..07c7dba20 100644 --- a/Zotlabs/Update/_1218.php +++ b/Zotlabs/Update/_1218.php @@ -7,9 +7,9 @@ class _1218 { function run() { if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { - $r1 = q("ALTER TABLE hubloc add hubloc_id_url text NOT NULL"); + $r1 = q("ALTER TABLE hubloc add hubloc_id_url text NOT NULL DEFAULT ''"); $r2 = q("create index \"hubloc_id_url\" on hubloc (\"hubloc_id_url\")"); - $r3 = q("ALTER TABLE hubloc add hubloc_site_id text NOT NULL"); + $r3 = q("ALTER TABLE hubloc add hubloc_site_id text NOT NULL DEFAULT ''"); $r4 = q("create index \"hubloc_site_id\" on hubloc (\"hubloc_site_id\")"); $r = $r1 && $r2 && $r3 && $r4; -- cgit v1.2.3 From 4376f8f030ea36fd5fed263efcee3a5276af0da1 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 1 Sep 2018 13:43:32 +0200 Subject: do not count sys channel in totals --- Zotlabs/Module/Admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zotlabs/Module/Admin.php b/Zotlabs/Module/Admin.php index 2df8dc25d..6edced9b5 100644 --- a/Zotlabs/Module/Admin.php +++ b/Zotlabs/Module/Admin.php @@ -109,7 +109,7 @@ class Admin extends \Zotlabs\Web\Controller { // available channels, primary and clones $channels = array(); - $r = q("SELECT COUNT(*) AS total, COUNT(CASE WHEN channel_primary = 1 THEN 1 ELSE NULL END) AS main, COUNT(CASE WHEN channel_primary = 0 THEN 1 ELSE NULL END) AS clones FROM channel WHERE channel_removed = 0"); + $r = q("SELECT COUNT(*) AS total, COUNT(CASE WHEN channel_primary = 1 THEN 1 ELSE NULL END) AS main, COUNT(CASE WHEN channel_primary = 0 THEN 1 ELSE NULL END) AS clones FROM channel WHERE channel_removed = 0 and channel_system = 0"); if ($r) { $channels['total'] = array('label' => t('Channels'), 'val' => $r[0]['total']); $channels['main'] = array('label' => t('Primary'), 'val' => $r[0]['main']); -- cgit v1.2.3 From e2824f925964fbfe160255de6e733b4c2de3cecb Mon Sep 17 00:00:00 2001 From: "M.Dent" Date: Sat, 1 Sep 2018 13:45:05 -0400 Subject: Fix: Authors unable to comment on posts they authored when under owned by others in certain circumstances. --- Zotlabs/Module/Item.php | 12 +++++++----- include/zot.php | 17 +++++++++++++++-- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index 640b4fa5c..a24d6da9c 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -29,7 +29,7 @@ use \Zotlabs\Lib as Zlib; class Item extends \Zotlabs\Web\Controller { function post() { - + // This will change. Figure out who the observer is and whether or not // they have permission to post here. Else ignore the post. @@ -237,10 +237,12 @@ class Item extends \Zotlabs\Web\Controller { if($parent) { logger('mod_item: item_post parent=' . $parent); $can_comment = false; - if((array_key_exists('owner',$parent_item)) && intval($parent_item['owner']['abook_self'])) - $can_comment = perm_is_allowed($profile_uid,$observer['xchan_hash'],'post_comments'); - else - $can_comment = can_comment_on_post($observer['xchan_hash'],$parent_item); + + $can_comment = can_comment_on_post($observer['xchan_hash'],$parent_item); + if (!$can_comment) { + if((array_key_exists('owner',$parent_item)) && intval($parent_item['owner']['abook_self'])==1 ) + $can_comment = perm_is_allowed($profile_uid,$observer['xchan_hash'],'post_comments'); + } if(! $can_comment) { notice( t('Permission denied.') . EOL) ; diff --git a/include/zot.php b/include/zot.php index 52102e147..3523dd2ec 100644 --- a/include/zot.php +++ b/include/zot.php @@ -1808,8 +1808,21 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $ else { $arr['item_wall'] = 0; } - - if((! perm_is_allowed($channel['channel_id'],$sender['hash'],$perm)) && (! $tag_delivery) && (! $local_public)) { + + $allowed = (perm_is_allowed($channel['channel_id'],$sender['hash'],$perm) && (! $tag_delivery) && (! $local_public)); + + if(! $allowed && $perm == 'post_comments') { +logger("Channel = ".intval($channel['channel_id'])); + $parent = q("select * from item where mid = '%s' and uid = %d limit 1", + dbesc($arr['parent_mid']), + intval($channel['channel_id']) + ); + if ($parent) { + $allowed = can_comment_on_post($d['hash'],$parent[0]); + } + } + + if (! $allowed) { logger("permission denied for delivery to channel {$channel['channel_id']} {$channel['channel_address']}"); $DR->update('permission denied'); $result[] = $DR->get(); -- cgit v1.2.3 From d66f58a550d61f17c46eca42cba84f45ae9c4628 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 1 Sep 2018 21:09:04 +0200 Subject: fix undefined constant warning --- Zotlabs/Module/Filestorage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zotlabs/Module/Filestorage.php b/Zotlabs/Module/Filestorage.php index cd9ab601d..23bd63f95 100644 --- a/Zotlabs/Module/Filestorage.php +++ b/Zotlabs/Module/Filestorage.php @@ -128,7 +128,7 @@ class Filestorage extends \Zotlabs\Web\Controller { } } - if(json_return) + if($json_return) json_return_and_die([ 'success' => true ]); goaway(dirname($url)); -- cgit v1.2.3 From 41ccb61c2e2f2123ae510a39ebd048a56832825e Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 3 Sep 2018 18:14:17 +0200 Subject: Revert "Fix: Authors unable to comment on posts they authored when under owned by others in certain circumstances." This reverts commit e2824f925964fbfe160255de6e733b4c2de3cecb. Reverting because it breaks forum mentions. --- Zotlabs/Module/Item.php | 12 +++++------- include/zot.php | 17 ++--------------- 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index a24d6da9c..640b4fa5c 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -29,7 +29,7 @@ use \Zotlabs\Lib as Zlib; class Item extends \Zotlabs\Web\Controller { function post() { - + // This will change. Figure out who the observer is and whether or not // they have permission to post here. Else ignore the post. @@ -237,12 +237,10 @@ class Item extends \Zotlabs\Web\Controller { if($parent) { logger('mod_item: item_post parent=' . $parent); $can_comment = false; - - $can_comment = can_comment_on_post($observer['xchan_hash'],$parent_item); - if (!$can_comment) { - if((array_key_exists('owner',$parent_item)) && intval($parent_item['owner']['abook_self'])==1 ) - $can_comment = perm_is_allowed($profile_uid,$observer['xchan_hash'],'post_comments'); - } + if((array_key_exists('owner',$parent_item)) && intval($parent_item['owner']['abook_self'])) + $can_comment = perm_is_allowed($profile_uid,$observer['xchan_hash'],'post_comments'); + else + $can_comment = can_comment_on_post($observer['xchan_hash'],$parent_item); if(! $can_comment) { notice( t('Permission denied.') . EOL) ; diff --git a/include/zot.php b/include/zot.php index 3523dd2ec..52102e147 100644 --- a/include/zot.php +++ b/include/zot.php @@ -1808,21 +1808,8 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $ else { $arr['item_wall'] = 0; } - - $allowed = (perm_is_allowed($channel['channel_id'],$sender['hash'],$perm) && (! $tag_delivery) && (! $local_public)); - - if(! $allowed && $perm == 'post_comments') { -logger("Channel = ".intval($channel['channel_id'])); - $parent = q("select * from item where mid = '%s' and uid = %d limit 1", - dbesc($arr['parent_mid']), - intval($channel['channel_id']) - ); - if ($parent) { - $allowed = can_comment_on_post($d['hash'],$parent[0]); - } - } - - if (! $allowed) { + + if((! perm_is_allowed($channel['channel_id'],$sender['hash'],$perm)) && (! $tag_delivery) && (! $local_public)) { logger("permission denied for delivery to channel {$channel['channel_id']} {$channel['channel_address']}"); $DR->update('permission denied'); $result[] = $DR->get(); -- cgit v1.2.3 From 9446e0348efa151ef7d75fa8206bb578633273dd Mon Sep 17 00:00:00 2001 From: "M.Dent" Date: Tue, 4 Sep 2018 07:54:24 -0400 Subject: Corrected resubmit of fixes to Authors unable to comment on posts they authored when owned by others. --- Zotlabs/Module/Item.php | 12 +++++++----- include/zot.php | 29 ++++++++++++++++++++++------- 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index 640b4fa5c..a24d6da9c 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -29,7 +29,7 @@ use \Zotlabs\Lib as Zlib; class Item extends \Zotlabs\Web\Controller { function post() { - + // This will change. Figure out who the observer is and whether or not // they have permission to post here. Else ignore the post. @@ -237,10 +237,12 @@ class Item extends \Zotlabs\Web\Controller { if($parent) { logger('mod_item: item_post parent=' . $parent); $can_comment = false; - if((array_key_exists('owner',$parent_item)) && intval($parent_item['owner']['abook_self'])) - $can_comment = perm_is_allowed($profile_uid,$observer['xchan_hash'],'post_comments'); - else - $can_comment = can_comment_on_post($observer['xchan_hash'],$parent_item); + + $can_comment = can_comment_on_post($observer['xchan_hash'],$parent_item); + if (!$can_comment) { + if((array_key_exists('owner',$parent_item)) && intval($parent_item['owner']['abook_self'])==1 ) + $can_comment = perm_is_allowed($profile_uid,$observer['xchan_hash'],'post_comments'); + } if(! $can_comment) { notice( t('Permission denied.') . EOL) ; diff --git a/include/zot.php b/include/zot.php index 52102e147..e8ac2df02 100644 --- a/include/zot.php +++ b/include/zot.php @@ -1808,13 +1808,28 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $ else { $arr['item_wall'] = 0; } - - if((! perm_is_allowed($channel['channel_id'],$sender['hash'],$perm)) && (! $tag_delivery) && (! $local_public)) { - logger("permission denied for delivery to channel {$channel['channel_id']} {$channel['channel_address']}"); - $DR->update('permission denied'); - $result[] = $DR->get(); - continue; - } + + + if ((! $tag_delivery) && (! $local_public)) { + $allowed = (perm_is_allowed($channel['channel_id'],$sender['hash'],$perm)); + + if((! $allowed) && $perm == 'post_comments') { + $parent = q("select * from item where mid = '%s' and uid = %d limit 1", + dbesc($arr['parent_mid']), + intval($channel['channel_id']) + ); + if ($parent) { + $allowed = can_comment_on_post($d['hash'],$parent[0]); + } + } + + if (! $allowed) { + logger("permission denied for delivery to channel {$channel['channel_id']} {$channel['channel_address']}"); + $DR->update('permission denied'); + $result[] = $DR->get(); + continue; + } + } if($arr['mid'] != $arr['parent_mid']) { -- cgit v1.2.3 From a821682c8c165077947781bca2064922884f6e7d Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 5 Sep 2018 12:17:32 +0200 Subject: instead of not displaying the cover-photo at all after first page load, load the page with the cover slided up. change pointer to n-resize if cover is not slid. --- Zotlabs/Widget/Cover_photo.php | 6 ++++-- view/css/widgets.css | 1 - view/tpl/cover_photo_widget.tpl | 30 +++++++++++++++++++++++++----- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/Zotlabs/Widget/Cover_photo.php b/Zotlabs/Widget/Cover_photo.php index af1ae5c7f..965566523 100644 --- a/Zotlabs/Widget/Cover_photo.php +++ b/Zotlabs/Widget/Cover_photo.php @@ -21,9 +21,9 @@ class Cover_photo { return ''; // only show cover photos once per login session - + $hide_cover = false; if(array_key_exists('channels_visited',$_SESSION) && is_array($_SESSION['channels_visited']) && in_array($channel_id,$_SESSION['channels_visited'])) { - return EMPTY_STR; + $hide_cover = true; } if(! array_key_exists('channels_visited',$_SESSION)) { $_SESSION['channels_visited'] = []; @@ -53,6 +53,7 @@ class Cover_photo { $subtitle = str_replace('@','@',$channel['xchan_addr']); $c = get_cover_photo($channel_id,'html'); + $c = str_replace('src=', 'data-src=', $c); if($c) { $photo_html = (($style) ? str_replace('alt=',' style="' . $style . '" alt=',$c) : $c); @@ -62,6 +63,7 @@ class Cover_photo { '$title' => $title, '$subtitle' => $subtitle, '$hovertitle' => t('Click to show more'), + '$hide_cover' => $hide_cover )); } return $o; diff --git a/view/css/widgets.css b/view/css/widgets.css index e330c38e1..995647d1c 100644 --- a/view/css/widgets.css +++ b/view/css/widgets.css @@ -142,7 +142,6 @@ li:hover .group-edit-icon { position: relative; width: 100%; height: auto; - cursor: pointer; } #cover-photo-caption { diff --git a/view/tpl/cover_photo_widget.tpl b/view/tpl/cover_photo_widget.tpl index 3aaad5ae5..ed708ffb5 100755 --- a/view/tpl/cover_photo_widget.tpl +++ b/view/tpl/cover_photo_widget.tpl @@ -2,16 +2,27 @@ var aside_padding_top; var section_padding_top; var coverSlid = false; + var hide_cover = Boolean({{$hide_cover}}); $(document).ready(function() { + if(! $('#cover-photo').length) + return; aside_padding_top = parseInt($('aside').css('padding-top')); section_padding_top = parseInt($('section').css('padding-top')); $(document).on('click mouseup keyup', slideUpCover); - if($('#cover-photo').length && $(window).width() > 755) { + if($(window).width() > 755) { + datasrc2src('#cover-photo > img'); + + if(hide_cover) { + hideCover(); + coverSlid = true; + } + if($(window).scrollTop() < $('#cover-photo').height()) { + $('body').css('cursor', 'n-resize'); $('.navbar').removeClass('fixed-top'); $('main').css('margin-top', - $('nav').outerHeight(true) + 'px'); $('main').css('opacity', 0); @@ -24,32 +35,34 @@ }); $(window).scroll(function () { - if($('#cover-photo').length && $(window).width() > 755 && $(window).scrollTop() >= $('#cover-photo').height()) { + if($(window).width() > 755 && $(window).scrollTop() >= $('#cover-photo').height()) { + $('body').css('cursor', ''); $('.navbar').addClass('fixed-top'); $('main').css('margin-top', ''); $('main').css('opacity', 1); coverSlid = true; } - else if ($('#cover-photo').length && $(window).width() > 755 && $(window).scrollTop() < $('#cover-photo').height()){ + else if ($(window).width() > 755 && $(window).scrollTop() < $('#cover-photo').height()){ if(coverSlid) { $(window).scrollTop(Math.ceil($('#cover-photo').height())); setTimeout(function(){ coverSlid = false; }, 1000); } else { if($(window).scrollTop() < $('#cover-photo').height()) { + $('body').css('cursor', 'n-resize'); $('.navbar').removeClass('fixed-top'); $('main').css('margin-top', - $('nav').outerHeight(true) + 'px'); $('main').css('opacity', 0); } } } - if($('#cover-photo').length && $('main').css('opacity') < 1) { + if($('main').css('opacity') < 1) { $('main').css('opacity', ($(window).scrollTop()/$('#cover-photo').height()).toFixed(1)); } }); $(window).resize(function () { - if($('#cover-photo').length && $(window).width() < 755) { + if($(window).width() < 755) { $('#cover-photo').remove(); $('.navbar').addClass('fixed-top'); $('main').css('opacity', 1); @@ -65,6 +78,13 @@ $('html, body').animate({scrollTop: Math.ceil($('#cover-photo').height()) + 'px' }, 'fast'); return; } + + function hideCover() { + if(coverSlid) { + return; + } + window.scrollTo(0, Math.ceil($('#cover-photo').height())); + }
-- cgit v1.2.3 From 75e8aa8aee9c735308ed36bef5648cdceff6351e Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 5 Sep 2018 12:19:52 +0200 Subject: bump version --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot.php b/boot.php index 6c56a7dc0..54c49cf6b 100755 --- a/boot.php +++ b/boot.php @@ -50,7 +50,7 @@ require_once('include/attach.php'); require_once('include/bbcode.php'); define ( 'PLATFORM_NAME', 'hubzilla' ); -define ( 'STD_VERSION', '3.7.1' ); +define ( 'STD_VERSION', '3.7.2' ); define ( 'ZOT_REVISION', '6.0a' ); -- cgit v1.2.3 From 1753e404668b272a284bc922d3102acf04a6d6d1 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 5 Sep 2018 12:32:53 +0200 Subject: Revert "Fix jumpy sidebars" This reverts commit 79eb6d39423c47c8c7809ed34cdc88effbb6e97e. --- view/theme/redbasic/css/style.css | 3 --- 1 file changed, 3 deletions(-) diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index 943b27637..82d0cf761 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -45,9 +45,6 @@ main { margin-left: auto; margin-right: auto; max-width: $main_widthpx; -} - -main #region_2 { margin-bottom: $bottom_margin; } -- cgit v1.2.3 From e494a76b33baae47aee671951cc4459a3f225c86 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 5 Sep 2018 12:34:30 +0200 Subject: revert "Add bottom margin on aside elements and main to allow for viewport footer." This reverts commit 1d7d604016e6728725c4b857cec85c3d5a050268. --- view/theme/redbasic/css/style.css | 8 +------- view/theme/redbasic/php/style.php | 6 +----- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index 82d0cf761..970e4bc89 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -33,19 +33,13 @@ aside #region_1 { } aside #left_aside_wrapper { - /*margin-bottom: 10px;*/ - margin-bottom: $bottom_margin; -} -aside #right_aside_wrapper { - /*margin-bottom: 10px;*/ - margin-bottom: $bottom_margin; + margin-bottom: 10px; } main { margin-left: auto; margin-right: auto; max-width: $main_widthpx; - margin-bottom: $bottom_margin; } #overlay { diff --git a/view/theme/redbasic/php/style.php b/view/theme/redbasic/php/style.php index 0631fa142..91cc0b85b 100644 --- a/view/theme/redbasic/php/style.php +++ b/view/theme/redbasic/php/style.php @@ -106,8 +106,6 @@ if(! $top_photo) $top_photo = '2.3rem'; if(! $reply_photo) $reply_photo = '2.3rem'; -if(! $bottom_margin) - $bottom_margin = '200px'; // Apply the settings if(file_exists('view/theme/redbasic/css/style.css')) { @@ -152,9 +150,7 @@ if(file_exists('view/theme/redbasic/css/style.css')) { '$pmenu_top' => $pmenu_top, '$pmenu_reply' => $pmenu_reply, '$main_width' => $main_width, - '$aside_width' => $aside_width, - '$bottom_margin' => $bottom_margin - + '$aside_width' => $aside_width ); echo str_replace(array_keys($options), array_values($options), $x); -- cgit v1.2.3 From 4f82428a207d426a5cace7c3749655b391e6c156 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 5 Sep 2018 14:31:34 +0200 Subject: hide cover photo by default and show it only if conditions are met --- view/theme/redbasic/css/style.css | 3 ++- view/tpl/cover_photo_widget.tpl | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index 970e4bc89..0a879cb71 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -32,7 +32,8 @@ aside #region_1 { border-right: 1px solid transparent; } -aside #left_aside_wrapper { +aside #left_aside_wrapper, +aside #right_aside_wrapper { margin-bottom: 10px; } diff --git a/view/tpl/cover_photo_widget.tpl b/view/tpl/cover_photo_widget.tpl index ed708ffb5..2de3c74be 100755 --- a/view/tpl/cover_photo_widget.tpl +++ b/view/tpl/cover_photo_widget.tpl @@ -14,6 +14,7 @@ $(document).on('click mouseup keyup', slideUpCover); if($(window).width() > 755) { + $('#cover-photo').removeClass('d-none'); datasrc2src('#cover-photo > img'); if(hide_cover) { @@ -87,7 +88,7 @@ } -
+
{{$photo_html}}

{{$title}}

-- cgit v1.2.3 From ea381d918021a33a73df40de95fd0c57f0edc5c2 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 5 Sep 2018 14:44:06 +0200 Subject: move str_replace inside if clause --- Zotlabs/Widget/Cover_photo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zotlabs/Widget/Cover_photo.php b/Zotlabs/Widget/Cover_photo.php index 965566523..955048992 100644 --- a/Zotlabs/Widget/Cover_photo.php +++ b/Zotlabs/Widget/Cover_photo.php @@ -53,9 +53,9 @@ class Cover_photo { $subtitle = str_replace('@','@',$channel['xchan_addr']); $c = get_cover_photo($channel_id,'html'); - $c = str_replace('src=', 'data-src=', $c); if($c) { + $c = str_replace('src=', 'data-src=', $c); $photo_html = (($style) ? str_replace('alt=',' style="' . $style . '" alt=',$c) : $c); $o = replace_macros(get_markup_template('cover_photo_widget.tpl'),array( -- cgit v1.2.3