Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Haakon Meland Eriksen 2016-02-04 06:01:15 +01:00
commit 8f810a3dcf
7 changed files with 139 additions and 25 deletions

View file

@ -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)
);
@ -1798,23 +1829,15 @@ 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;
}
$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

View file

@ -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 '<iframe height="' . $height . '" width="' . $width . '" src="' . $s . '" frameborder="no" >'
return '<iframe ' . $scroll . 'height="' . $height . '" width="' . $width . '" src="' . $s . '" frameborder="no" >'
. t('Embedded content') . '</iframe>';
}

View file

@ -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;

View file

@ -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" . '<link rel="alternate" type="application/json+oembed" href="' . z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . $a->query_string) . '" title="oembed" />' . "\r\n";
}
$a->page['htmlhead'] .= "\r\n" . '<link rel="alternate" type="application/json+oembed" href="' . z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . $a->query_string) . '" title="oembed" />' . "\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)

View file

@ -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);

View file

@ -1 +1 @@
2016-02-01.1296H
2016-02-02.1297H

View file

@ -1,7 +1,49 @@
<style>
{{if $size == 'hz_large'}}
.hz_card {
/* -moz-transform: translate(-{{$translate}}%, -{{$translate}}%) scale({{$scale}}, {{$scale}});
transform: translate(-{{$translate}}%, -{{$translate}}%) scale({{$scale}}, {{$scale}}); */
font-family: sans-serif, arial, freesans;
}
.hz_cover_photo {
max-width: 100%;
}
.hz_profile_photo {
position: relative;
top: -300px;
left: 30px;
background-color: white;
border: 1px solid #ddd;
border-radius: 5px;
-moz-border-radius: 5px;
padding: 10px;
width: 320px;
height: 320px;
}
.hz_name {
position: relative;
top: -100px;
left: 400px;
color: #fff;
font-size: 48px;
text-rendering: optimizelegibility;
text-shadow: 0 0 3px rgba(0, 0, 0, 0.8);
}
.hz_addr {
position: relative;
top: -110px;
left: 400px;
color: #fff;
font-size: 24px;
text-rendering: optimizelegibility;
text-shadow: 0 0 3px rgba(0, 0, 0, 0.8);
}
{{elseif $size == 'hz_medium'}}
.hz_card {
-moz-transform: translate(-{{$translate}}%, -{{$translate}}%) scale({{$scale}}, {{$scale}});
transform: translate(-{{$translate}}%, -{{$translate}}%) scale({{$scale}}, {{$scale}});
font-family: sans-serif, arial, freesans;
}
.hz_cover_photo {
max-width: 100%;
@ -38,13 +80,56 @@
text-shadow: 0 0 3px rgba(0, 0, 0, 0.8);
}
{{else}}
.hz_card {
/* -moz-transform: translate(-{{$translate}}%, -{{$translate}}%) scale({{$scale}}, {{$scale}});
transform: translate(-{{$translate}}%, -{{$translate}}%) scale({{$scale}}, {{$scale}}); */
font-family: sans-serif, arial, freesans;
}
.hz_cover_photo {
max-width: 100%;
}
.hz_profile_photo {
position: relative;
top: -75px;
left: 20px;
background-color: white;
border: 1px solid #ddd;
/* border-radius: 5px;
-moz-border-radius: 5px; */
padding: 3px;
width: 80px;
height: 80px;
}
.hz_name {
position: relative;
top: -40px;
left: 120px;
color: #fff;
font-size: 18px;
text-rendering: optimizelegibility;
text-shadow: 0 0 3px rgba(0, 0, 0, 0.8);
}
.hz_addr {
position: relative;
top: -40px;
left: 120px;
color: #fff;
font-size: 10px;
text-rendering: optimizelegibility;
text-shadow: 0 0 3px rgba(0, 0, 0, 0.8);
}
{{/if}}
</style>
<div class="hz_card">
<div class="hz_card {{$size}}">
<div class="hz_cover_photo"><img src="{{$cover.href}}" alt="{{$zcard.chan.xchan_name}}" />
<div class="hz_name">{{$zcard.chan.xchan_name}}</div>
<div class="hz_addr">{{$zcard.chan.channel_addr}}</div>
</div>
<div class="hz_profile_photo"><img style="width: 300px; height: 300px;" src="{{$pphoto.href}}" alt="{{$zcard.chan.xchan_name}}" /></div>
<div class="hz_profile_photo"><img style="width: {{$pphoto.width}}px; height: {{$pphoto.height}}px;" src="{{$pphoto.href}}" alt="{{$zcard.chan.xchan_name}}" /></div>
</div>