From 06dcaaa821d6229568709e53d104233081c4d3e9 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 2 Feb 2016 17:14:07 -0800 Subject: [PATCH 1/3] some zcard cleanup - still eneds a lot more work --- include/identity.php | 47 ++++++++++++++++------- include/oembed.php | 12 ++++-- version.inc | 2 +- view/tpl/zcard.tpl | 89 +++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 130 insertions(+), 20 deletions(-) diff --git a/include/identity.php b/include/identity.php index 037cf5061..76ada577e 100644 --- a/include/identity.php +++ b/include/identity.php @@ -1786,11 +1786,42 @@ function get_zcard($channel,$observer_hash = '',$args = array()) { logger('get_zcard'); + $maxwidth = (($args['width']) ? intval($args['width']) : 0); + $maxheight = (($args['height']) ? intval($args['height']) : 0); + + + if(($maxwidth > 1200) || ($maxwidth < 1)) + $maxwidth = 1200; + + if($maxwidth <= 425) { + $width = 425; + $size = 'hz_small'; + $cover_size = PHOTO_RES_COVER_425; + $pphoto = array('type' => $channel['xchan_photo_mimetype'], 'width' => 80 , 'height' => 80, 'href' => $channel['xchan_photo_m']); + } + elseif($maxwidth <= 850) { + $width = 850; + $size = 'hz_medium'; + $cover_size = PHOTO_RES_COVER_850; + $pphoto = array('type' => $channel['xchan_photo_mimetype'], 'width' => 160 , 'height' => 160, 'href' => $channel['xchan_photo_l']); + } + elseif($maxwidth <= 1200) { + $width = 1200; + $size = 'hz_large'; + $cover_size = PHOTO_RES_COVER_1200; + $pphoto = array('type' => $channel['xchan_photo_mimetype'], 'width' => 300 , 'height' => 300, 'href' => $channel['xchan_photo_l']); + } + +// $scale = (float) $maxwidth / $width; +// $translate = intval(($scale / 1.0) * 100); + + $channel['channel_addr'] = $channel['channel_address'] . '@' . get_app()->get_hostname(); + $zcard = array('chan' => $channel); $r = q("select height, width, resource_id, scale, type from photo where uid = %d and scale = %d and photo_usage = %d", intval($channel['channel_id']), - intval(PHOTO_RES_COVER_1200), + intval($cover_size), intval(PHOTO_COVER) ); @@ -1799,22 +1830,10 @@ function get_zcard($channel,$observer_hash = '',$args = array()) { $cover['href'] = z_root() . '/photo/' . $r[0]['resource_id'] . '-' . $r[0]['scale']; } - $pphoto = array('type' => $channel['xchan_photo_mimetype'], - 'width' => 300 , 'height' => 300, 'href' => $channel['xchan_photo_l']); - - $maxwidth = (($args['width']) ? intval($args['width']) : 0); - $maxheight = (($args['height']) ? intval($args['height']) : 0); - - $zcard = array('chan' => $channel); - if(($maxwidth > 1200) || ($maxwidth < 1)) - $maxwidth = 1200; - $scale = (float) $maxwidth / 1200; - - $translate = intval(($scale / 1.0) * 100); - $o .= replace_macros(get_markup_template('zcard.tpl'),array( '$scale' => $scale, '$translate' => $translate, + '$size' => $size, '$cover' => $cover, '$pphoto' => $pphoto, '$zcard' => $zcard diff --git a/include/oembed.php b/include/oembed.php index ff52545ee..7c577b6c2 100755 --- a/include/oembed.php +++ b/include/oembed.php @@ -217,10 +217,16 @@ function oembed_format_object($j){ } function oembed_iframe($src,$width,$height) { - if(! $width || strstr($width,'%')) + $scroll = ' scrolling="no" '; + if(! $width || strstr($width,'%')) { $width = '640'; - if(! $height || strstr($height,'%')) + $scroll = ' scrolling="auto" '; + } + if(! $height || strstr($height,'%')) { $height = '300'; + $scroll = ' scrolling="auto" '; + } + // try and leave some room for the description line. $height = intval($height) + 80; $width = intval($width) + 40; @@ -229,7 +235,7 @@ function oembed_iframe($src,$width,$height) { // Make sure any children are sandboxed within their own iframe. - return ''; } diff --git a/version.inc b/version.inc index fa80bc80a..1d1ae17f2 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2016-02-01.1296H +2016-02-02.1297H diff --git a/view/tpl/zcard.tpl b/view/tpl/zcard.tpl index 68f1058a5..b73b1011c 100644 --- a/view/tpl/zcard.tpl +++ b/view/tpl/zcard.tpl @@ -1,7 +1,49 @@ -
+
{{$zcard.chan.xchan_name}}
{{$zcard.chan.xchan_name}}
{{$zcard.chan.channel_addr}}
-
{{$zcard.chan.xchan_name}}
+
{{$zcard.chan.xchan_name}}
From a7ed50ecd4b4defbc1d5fdf0bb4fd7d65d08a0fd Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 2 Feb 2016 19:39:47 -0800 Subject: [PATCH 2/3] more zcard tweaks --- include/identity.php | 4 ++++ mod/channel.php | 6 ++---- mod/oep.php | 2 ++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/include/identity.php b/include/identity.php index 76ada577e..4f58d7dc5 100644 --- a/include/identity.php +++ b/include/identity.php @@ -1829,6 +1829,10 @@ function get_zcard($channel,$observer_hash = '',$args = array()) { $cover = $r[0]; $cover['href'] = z_root() . '/photo/' . $r[0]['resource_id'] . '-' . $r[0]['scale']; } + else { + // @fixme remove this when we have a fallback cover photo and use that instead. + return; + } $o .= replace_macros(get_markup_template('zcard.tpl'),array( '$scale' => $scale, diff --git a/mod/channel.php b/mod/channel.php index f88a5bf45..dcccb16b6 100644 --- a/mod/channel.php +++ b/mod/channel.php @@ -157,10 +157,8 @@ function channel_content(&$a, $update = 0, $load = false) { $simple_update = (($update) ? " AND item_unseen = 1 " : ''); - if($mid) { - $a->page['htmlhead'] .= "\r\n" . '' . "\r\n"; - } - + $a->page['htmlhead'] .= "\r\n" . '' . "\r\n"; + if($update && $_SESSION['loadtime']) $simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) "; if($load) diff --git a/mod/oep.php b/mod/oep.php index 8d959c3e2..3855a1b4a 100644 --- a/mod/oep.php +++ b/mod/oep.php @@ -32,6 +32,8 @@ function oep_init(&$a) { $arr = oep_display_reply($_REQUEST); elseif(fnmatch('*/channel/*mid=*',$url)) $arr = oep_mid_reply($_REQUEST); + elseif(fnmatch('*/channel*',$url)) + $arr = oep_profile_reply($_REQUEST); elseif(fnmatch('*/profile/*',$url)) $arr = oep_profile_reply($_REQUEST); From 006efbd906980fca8c0c377fa2b0a4054c2849f4 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 3 Feb 2016 15:44:36 -0800 Subject: [PATCH 3/3] change view_storage from perms_public to perms_specific in the social_private role --- include/permissions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/permissions.php b/include/permissions.php index 8071af686..8c36f9744 100644 --- a/include/permissions.php +++ b/include/permissions.php @@ -626,7 +626,7 @@ function get_role_perms($role) { $ret['channel_w_mail'] = PERMS_SPECIFIC; $ret['channel_w_chat'] = PERMS_SPECIFIC; $ret['channel_a_delegate'] = PERMS_SPECIFIC; - $ret['channel_r_storage'] = PERMS_PUBLIC; + $ret['channel_r_storage'] = PERMS_SPECIFIC; $ret['channel_w_storage'] = PERMS_SPECIFIC; $ret['channel_r_pages'] = PERMS_PUBLIC; $ret['channel_w_pages'] = PERMS_SPECIFIC;