Merge branch 'dev' of https://framagit.org/hubzilla/core into xdev_merge

This commit is contained in:
zotlabs 2018-09-05 21:02:06 -07:00
commit c5bc4fe245
11 changed files with 67 additions and 40 deletions

View File

@ -109,7 +109,7 @@ class Admin extends \Zotlabs\Web\Controller {
// available channels, primary and clones // available channels, primary and clones
$channels = array(); $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) { if ($r) {
$channels['total'] = array('label' => t('Channels'), 'val' => $r[0]['total']); $channels['total'] = array('label' => t('Channels'), 'val' => $r[0]['total']);
$channels['main'] = array('label' => t('Primary'), 'val' => $r[0]['main']); $channels['main'] = array('label' => t('Primary'), 'val' => $r[0]['main']);

View File

@ -128,7 +128,7 @@ class Filestorage extends \Zotlabs\Web\Controller {
} }
} }
if(json_return) if($json_return)
json_return_and_die([ 'success' => true ]); json_return_and_die([ 'success' => true ]);
goaway(dirname($url)); goaway(dirname($url));

View File

@ -237,10 +237,12 @@ class Item extends \Zotlabs\Web\Controller {
if($parent) { if($parent) {
logger('mod_item: item_post parent=' . $parent); logger('mod_item: item_post parent=' . $parent);
$can_comment = false; $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) { if(! $can_comment) {
notice( t('Permission denied.') . EOL) ; notice( t('Permission denied.') . EOL) ;

View File

@ -7,9 +7,9 @@ class _1218 {
function run() { function run() {
if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { 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\")"); $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\")"); $r4 = q("create index \"hubloc_site_id\" on hubloc (\"hubloc_site_id\")");
$r = $r1 && $r2 && $r3 && $r4; $r = $r1 && $r2 && $r3 && $r4;

View File

@ -21,9 +21,9 @@ class Cover_photo {
return ''; return '';
// only show cover photos once per login session // 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'])) { 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)) { if(! array_key_exists('channels_visited',$_SESSION)) {
$_SESSION['channels_visited'] = []; $_SESSION['channels_visited'] = [];
@ -55,6 +55,7 @@ class Cover_photo {
$c = get_cover_photo($channel_id,'html'); $c = get_cover_photo($channel_id,'html');
if($c) { if($c) {
$c = str_replace('src=', 'data-src=', $c);
$photo_html = (($style) ? str_replace('alt=',' style="' . $style . '" alt=',$c) : $c); $photo_html = (($style) ? str_replace('alt=',' style="' . $style . '" alt=',$c) : $c);
$o = replace_macros(get_markup_template('cover_photo_widget.tpl'),array( $o = replace_macros(get_markup_template('cover_photo_widget.tpl'),array(
@ -62,6 +63,7 @@ class Cover_photo {
'$title' => $title, '$title' => $title,
'$subtitle' => $subtitle, '$subtitle' => $subtitle,
'$hovertitle' => t('Click to show more'), '$hovertitle' => t('Click to show more'),
'$hide_cover' => $hide_cover
)); ));
} }
return $o; return $o;

View File

@ -50,7 +50,7 @@ require_once('include/attach.php');
require_once('include/bbcode.php'); require_once('include/bbcode.php');
define ( 'PLATFORM_NAME', 'hubzilla' ); define ( 'PLATFORM_NAME', 'hubzilla' );
define ( 'STD_VERSION', '3.7.1' ); define ( 'STD_VERSION', '3.7.2' );
define ( 'ZOT_REVISION', '6.0a' ); define ( 'ZOT_REVISION', '6.0a' );

View File

@ -1809,12 +1809,27 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $
$arr['item_wall'] = 0; $arr['item_wall'] = 0;
} }
if((! perm_is_allowed($channel['channel_id'],$sender['hash'],$perm)) && (! $tag_delivery) && (! $local_public)) {
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']}"); logger("permission denied for delivery to channel {$channel['channel_id']} {$channel['channel_address']}");
$DR->update('permission denied'); $DR->update('permission denied');
$result[] = $DR->get(); $result[] = $DR->get();
continue; continue;
} }
}
if($arr['mid'] != $arr['parent_mid']) { if($arr['mid'] != $arr['parent_mid']) {

View File

@ -142,7 +142,6 @@ li:hover .group-edit-icon {
position: relative; position: relative;
width: 100%; width: 100%;
height: auto; height: auto;
cursor: pointer;
} }
#cover-photo-caption { #cover-photo-caption {

View File

@ -32,13 +32,9 @@ aside #region_1 {
border-right: 1px solid transparent; border-right: 1px solid transparent;
} }
aside #left_aside_wrapper { aside #left_aside_wrapper,
/*margin-bottom: 10px;*/
margin-bottom: $bottom_margin;
}
aside #right_aside_wrapper { aside #right_aside_wrapper {
/*margin-bottom: 10px;*/ margin-bottom: 10px;
margin-bottom: $bottom_margin;
} }
main { main {
@ -47,10 +43,6 @@ main {
max-width: $main_widthpx; max-width: $main_widthpx;
} }
main #region_2 {
margin-bottom: $bottom_margin;
}
#overlay { #overlay {
position: absolute; position: absolute;
top: 0; top: 0;

View File

@ -106,8 +106,6 @@ if(! $top_photo)
$top_photo = '2.3rem'; $top_photo = '2.3rem';
if(! $reply_photo) if(! $reply_photo)
$reply_photo = '2.3rem'; $reply_photo = '2.3rem';
if(! $bottom_margin)
$bottom_margin = '200px';
// Apply the settings // Apply the settings
if(file_exists('view/theme/redbasic/css/style.css')) { 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_top' => $pmenu_top,
'$pmenu_reply' => $pmenu_reply, '$pmenu_reply' => $pmenu_reply,
'$main_width' => $main_width, '$main_width' => $main_width,
'$aside_width' => $aside_width, '$aside_width' => $aside_width
'$bottom_margin' => $bottom_margin
); );
echo str_replace(array_keys($options), array_values($options), $x); echo str_replace(array_keys($options), array_values($options), $x);

View File

@ -2,16 +2,28 @@
var aside_padding_top; var aside_padding_top;
var section_padding_top; var section_padding_top;
var coverSlid = false; var coverSlid = false;
var hide_cover = Boolean({{$hide_cover}});
$(document).ready(function() { $(document).ready(function() {
if(! $('#cover-photo').length)
return;
aside_padding_top = parseInt($('aside').css('padding-top')); aside_padding_top = parseInt($('aside').css('padding-top'));
section_padding_top = parseInt($('section').css('padding-top')); section_padding_top = parseInt($('section').css('padding-top'));
$(document).on('click mouseup keyup', slideUpCover); $(document).on('click mouseup keyup', slideUpCover);
if($('#cover-photo').length && $(window).width() > 755) { if($(window).width() > 755) {
$('#cover-photo').removeClass('d-none');
datasrc2src('#cover-photo > img');
if(hide_cover) {
hideCover();
coverSlid = true;
}
if($(window).scrollTop() < $('#cover-photo').height()) { if($(window).scrollTop() < $('#cover-photo').height()) {
$('body').css('cursor', 'n-resize');
$('.navbar').removeClass('fixed-top'); $('.navbar').removeClass('fixed-top');
$('main').css('margin-top', - $('nav').outerHeight(true) + 'px'); $('main').css('margin-top', - $('nav').outerHeight(true) + 'px');
$('main').css('opacity', 0); $('main').css('opacity', 0);
@ -24,32 +36,34 @@
}); });
$(window).scroll(function () { $(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'); $('.navbar').addClass('fixed-top');
$('main').css('margin-top', ''); $('main').css('margin-top', '');
$('main').css('opacity', 1); $('main').css('opacity', 1);
coverSlid = true; 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) { if(coverSlid) {
$(window).scrollTop(Math.ceil($('#cover-photo').height())); $(window).scrollTop(Math.ceil($('#cover-photo').height()));
setTimeout(function(){ coverSlid = false; }, 1000); setTimeout(function(){ coverSlid = false; }, 1000);
} }
else { else {
if($(window).scrollTop() < $('#cover-photo').height()) { if($(window).scrollTop() < $('#cover-photo').height()) {
$('body').css('cursor', 'n-resize');
$('.navbar').removeClass('fixed-top'); $('.navbar').removeClass('fixed-top');
$('main').css('margin-top', - $('nav').outerHeight(true) + 'px'); $('main').css('margin-top', - $('nav').outerHeight(true) + 'px');
$('main').css('opacity', 0); $('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)); $('main').css('opacity', ($(window).scrollTop()/$('#cover-photo').height()).toFixed(1));
} }
}); });
$(window).resize(function () { $(window).resize(function () {
if($('#cover-photo').length && $(window).width() < 755) { if($(window).width() < 755) {
$('#cover-photo').remove(); $('#cover-photo').remove();
$('.navbar').addClass('fixed-top'); $('.navbar').addClass('fixed-top');
$('main').css('opacity', 1); $('main').css('opacity', 1);
@ -65,9 +79,16 @@
$('html, body').animate({scrollTop: Math.ceil($('#cover-photo').height()) + 'px' }, 'fast'); $('html, body').animate({scrollTop: Math.ceil($('#cover-photo').height()) + 'px' }, 'fast');
return; return;
} }
function hideCover() {
if(coverSlid) {
return;
}
window.scrollTo(0, Math.ceil($('#cover-photo').height()));
}
</script> </script>
<div id="cover-photo" title="{{$hovertitle}}"> <div class="d-none" id="cover-photo" title="{{$hovertitle}}">
{{$photo_html}} {{$photo_html}}
<div id="cover-photo-caption"> <div id="cover-photo-caption">
<h1>{{$title}}</h1> <h1>{{$title}}</h1>