Merge branch '0.8.x' of git@gitorious.org:+laconica-developers/laconica/dev into 0.8.x
This commit is contained in:
commit
d04ab14a5a
|
@ -45,6 +45,12 @@ require_once INSTALLDIR.'/actions/attachment.php';
|
|||
|
||||
class Attachment_thumbnailAction extends AttachmentAction
|
||||
{
|
||||
|
||||
function handle($args)
|
||||
{
|
||||
$this->showPage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show page, a template method.
|
||||
*
|
||||
|
@ -74,45 +80,5 @@ class Attachment_thumbnailAction extends AttachmentAction
|
|||
$this->element('img', array('src' => $file_thumbnail->url, 'alt' => 'Thumbnail'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Last-modified date for page
|
||||
*
|
||||
* When was the content of this page last modified? Based on notice,
|
||||
* profile, avatar.
|
||||
*
|
||||
* @return int last-modified date as unix timestamp
|
||||
*/
|
||||
/*
|
||||
function lastModified()
|
||||
{
|
||||
return max(strtotime($this->notice->created),
|
||||
strtotime($this->profile->modified),
|
||||
($this->avatar) ? strtotime($this->avatar->modified) : 0);
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* An entity tag for this page
|
||||
*
|
||||
* Shows the ETag for the page, based on the notice ID and timestamps
|
||||
* for the notice, profile, and avatar. It's weak, since we change
|
||||
* the date text "one hour ago", etc.
|
||||
*
|
||||
* @return string etag
|
||||
*/
|
||||
/*
|
||||
function etag()
|
||||
{
|
||||
$avtime = ($this->avatar) ?
|
||||
strtotime($this->avatar->modified) : 0;
|
||||
|
||||
return 'W/"' . implode(':', array($this->arg('action'),
|
||||
common_language(),
|
||||
$this->notice->id,
|
||||
strtotime($this->notice->created),
|
||||
strtotime($this->profile->modified),
|
||||
$avtime)) . '"';
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
|
2
js/jquery.joverlay.min.js
vendored
2
js/jquery.joverlay.min.js
vendored
|
@ -4,4 +4,4 @@
|
|||
* Requires: jQuery 1.3+
|
||||
* Packer from http://dean.edwards.name/packer/
|
||||
*/
|
||||
(function($){var g=$.browser.msie&&$.browser.version==6.0;var h=null;var i=null;$.fn.jOverlay=function(b){if($('#jOverlay').length){$.closeOverlay()}i=null;if(h!==null){clearTimeout(h)}var b=$.extend({},$.fn.jOverlay.options,b);function center(a){if(b.center){$.center(a)}}var c=this.is('*')?this:'#jOverlayContent';var d=g?'absolute':'fixed';var e=/([^\/\\]+)\.(png|gif|jpeg|jpg|bmp)$/i.test(b.url);var f=b.imgLoading?"<img id='jOverlayLoading' src='"+b.imgLoading+"' style='position:"+d+"; z-index:"+(b.zIndex+9)+";'/>":'';$('body').prepend(f+"<div id='jOverlay' />"+"<div id='jOverlayContent' style='position:"+d+"; z-index:"+(b.zIndex+5)+"; display:none;'/>");$('#jOverlayLoading').load(function(){center(this)});if(g){$('select').hide();$('#jOverlayContent select').show()}$('#jOverlay').css({backgroundColor:b.color,position:d,top:'0px',left:'0px',filter:'alpha(opacity='+(b.opacity*100)+')',opacity:b.opacity,zIndex:b.zIndex,width:!g?'100%':$(window).width()+'px',height:!g?'100%':$(document).height()+'px'}).show();if(this.is('*')){i=this.prev();$('#jOverlayContent').html(this.show().attr('display',b.autoHide?'none':this.css('display')));if(!e){center('#jOverlayContent');$('#jOverlayContent').show();if(!b.url&&$.isFunction(b.success)){b.success(this)}}}if(e){$('<img/>').load(function(){var a=$.resize(this.width,this.height);$(this).css({width:a.width,height:a.height});$(c).html(this);center('#jOverlayContent');$('#jOverlayLoading').fadeOut(500);$('#jOverlayContent').show();if($.isFunction(b.success)){b.success(this)}}).error(function(){alert('Image ('+b.url+') not found.');$.closeOverlay()}).attr({'src':b.url,'alt':b.url})}if(b.url&&!e){$.ajax({type:b.method,data:b.data,url:b.url,success:function(a){$('#jOverlayLoading').fadeOut(500);$(c).html(a).show();center('#jOverlayContent');if($.isFunction(b.success)){b.success(a)}},error:function(){alert('URL ('+b.url+') not found.');$.closeOverlay()}})}if(g){$(window).scroll(function(){center('#jOverlayContent')});$(window).resize(function(){$('#jOverlay').css({width:$(window).width()+'px',height:$(document).height()+'px'});center('#jOverlayContent')})}$(document).keydown(function(a){if(a.keyCode==27){$.closeOverlay()}});if(b.bgClickToClose){$('#jOverlay').click($.closeOverlay)}if(Number(b.timeout)>0){jOverlayTimer=setTimeout($.closeOverlay,Number(b.timeout))}$('#jOverlayContent').css(b.css||{})};$.resize=function(a,b){var x=$(window).width()-150;var y=$(window).height()-150;if(a>x){b=b*(x/a);a=x;if(b>y){a=a*(y/b);b=y}}else if(b>y){a=a*(y/b);b=y;if(a>x){b=b*(x/a);a=x}}return{width:a,height:b}};$.center=function(a){var a=$(a);var b=a.width();a.css({width:b+'px',marginLeft:'-'+(b/2)+'px',marginTop:'-'+a.height()/2+'px',height:'auto',top:!g?'50%':$(window).scrollTop()+($(window).height()/2)+'px',left:'50%'})};$.fn.jOverlay.options={method:'GET',data:'',url:'',color:'#000',opacity:'0.6',zIndex:9999,center:true,imgLoading:'',bgClickToClose:true,success:null,timeout:0,autoHide:true,css:{}};$.closeOverlay=function(){if(g){$("select").show()}if(i!==null){if(i!==null){var a=$('#jOverlayContent').children();i.after(a.css('display',a.attr('display')));a.removeAttr('display')}}$('#jOverlayLoading, #jOverlayContent, #jOverlay').remove()}})(jQuery);
|
||||
(function($){var g=$.browser.msie&&$.browser.version==6.0;var h=null;var i=null;$.fn.jOverlay=function(b){if($('#jOverlay').length){$.closeOverlay()}i=null;if(h!==null){clearTimeout(h)}var b=$.extend({},$.fn.jOverlay.options,b);function center(a){if(b.center){$.center(a)}}var c=this.is('*')?this:'#jOverlayContent';var d=g?'absolute':'fixed';var e=/([^\/\\]+)\.(png|gif|jpeg|jpg|bmp)$/i.test(b.url);var f=b.imgLoading?"<img id='jOverlayLoading' src='"+b.imgLoading+"' style='position:"+d+"; z-index:"+(b.zIndex+9)+";'/>":'';$('body').prepend(f+"<div id='jOverlay' />"+"<div id='jOverlayContent' style='position:"+d+"; z-index:"+(b.zIndex+5)+"; display:none;'/>");$('#jOverlayLoading').load(function(){center(this)});if(g){$('select').hide();$('#jOverlayContent select').show()}$('#jOverlay').css({backgroundColor:b.color,position:d,top:'0px',left:'0px',filter:'alpha(opacity='+(b.opacity*100)+')',opacity:b.opacity,zIndex:b.zIndex,width:!g?'100%':$(window).width()+'px',height:!g?'100%':$(document).height()+'px'}).show();if(this.is('*')){i=this.prev();$('#jOverlayContent').html(this.show().attr('display',b.autoHide?'none':this.css('display')));if(!e){center('#jOverlayContent');$('#jOverlayContent').show();if(!b.url&&$.isFunction(b.success)){b.success(this)}}}if(e){$('<img/>').load(function(){var a=$.resize(this.width,this.height);$(this).css({width:a.width,height:a.height});$(c).html(this);center('#jOverlayContent');$('#jOverlayLoading').fadeOut(500);$('#jOverlayContent').show();if($.isFunction(b.success)){b.success(this)}}).error(function(){alert('Image ('+b.url+') not found.');$.closeOverlay()}).attr({'src':b.url,'alt':b.url})}if(b.url&&!e){$.ajax({type:b.method,data:b.data,url:b.url,success:function(a){$('#jOverlayLoading').fadeOut(500);$(c).html(a).show();center('#jOverlayContent');if($.isFunction(b.success)){b.success(a)}},error:function(){alert('URL ('+b.url+') not found.');$.closeOverlay()}})}if(g){$(window).scroll(function(){center('#jOverlayContent')});$(window).resize(function(){$('#jOverlay').css({width:$(window).width()+'px',height:$(document).height()+'px'});center('#jOverlayContent')})}$(document).keydown(function(a){if(a.keyCode==27){$.closeOverlay()}});if(b.bgClickToClose){$('#jOverlay').click($.closeOverlay)}if(Number(b.timeout)>0){jOverlayTimer=setTimeout($.closeOverlay,Number(b.timeout))}$('#jOverlayContent').css(b.css||{})};$.resize=function(a,b){var x=$(window).width()-150;var y=$(window).height()-150;if(a>x){b=b*(x/a);a=x;if(b>y){a=a*(y/b);b=y}}else if(b>y){a=a*(y/b);b=y;if(a>x){b=b*(x/a);a=x}}return{width:a,height:b}};$.center=function(a){var a=$(a);var b=a.width();a.css({width:b+'px',marginLeft:'-'+(b/2)+'px',marginTop:'-'+a.height()/2+'px',height:'auto',top:!g?'50%':$(window).scrollTop()+($(window).height()/2)+'px',left:'50%'})};$.fn.jOverlay.options={method:'GET',data:'',url:'',color:'#000',opacity:'0.6',zIndex:9999,center:true,imgLoading:'',bgClickToClose:true,success:null,timeout:0,autoHide:true,css:{}};$.closeOverlay=function(){if(g){$("select").show()}if(i!==null){if(i!==null){var a=$('#jOverlayContent').children();i.after(a.css('display',a.attr('display')));a.removeAttr('display')}}$('#jOverlayLoading, #jOverlayContent, #jOverlay').remove()}})(jQuery);
|
||||
|
|
|
@ -272,7 +272,7 @@ function NoticeAttachments() {
|
|||
color : '#000',
|
||||
opacity : '0.6',
|
||||
zIndex : 99,
|
||||
center : true,
|
||||
center : false,
|
||||
imgLoading : $('address .url')[0].href+'theme/base/images/illustrations/illu_progress_loading-01.gif',
|
||||
bgClickToClose : true,
|
||||
success : function() {
|
||||
|
@ -281,7 +281,7 @@ function NoticeAttachments() {
|
|||
},
|
||||
timeout : 0,
|
||||
autoHide : true,
|
||||
css : {'max-width':'502px'}
|
||||
css : {'max-width':'502px', 'top':'22.5%', 'left':'32.5%'}
|
||||
};
|
||||
|
||||
$('#content .notice a.attachment').click(function() {
|
||||
|
@ -298,7 +298,7 @@ function NoticeAttachments() {
|
|||
|
||||
if (anchor.children('img').length == 0) {
|
||||
t = setTimeout(function() {
|
||||
$.get($('address .url')[0].href+'/attachment/' + (anchor.attr('id').substring('attachment'.length + 1)) + '/thumbnail', null, function(data) {
|
||||
$.get($('address .url')[0].href+'attachment/' + (anchor.attr('id').substring('attachment'.length + 1)) + '/thumbnail', null, function(data) {
|
||||
anchor.append(data);
|
||||
});
|
||||
}, 500);
|
||||
|
|
|
@ -108,7 +108,9 @@ class ProfileAction extends OwnerDesignAction
|
|||
|
||||
$this->element('h2', null, _('Subscriptions'));
|
||||
|
||||
if ($profile) {
|
||||
$cnt = 0;
|
||||
|
||||
if (!empty($profile)) {
|
||||
$pml = new ProfileMiniList($profile, $this);
|
||||
$cnt = $pml->show();
|
||||
if ($cnt == 0) {
|
||||
|
@ -137,7 +139,9 @@ class ProfileAction extends OwnerDesignAction
|
|||
|
||||
$this->element('h2', null, _('Subscribers'));
|
||||
|
||||
if ($profile) {
|
||||
$cnt = 0;
|
||||
|
||||
if (!empty($profile)) {
|
||||
$pml = new ProfileMiniList($profile, $this);
|
||||
$cnt = $pml->show();
|
||||
if ($cnt == 0) {
|
||||
|
|
|
@ -47,6 +47,7 @@ define('PROFILES_PER_MINILIST', 27);
|
|||
|
||||
class ProfileMiniList extends ProfileList
|
||||
{
|
||||
|
||||
function startList()
|
||||
{
|
||||
$this->out->elementStart('ul', 'entities users xoxo');
|
||||
|
@ -56,6 +57,23 @@ class ProfileMiniList extends ProfileList
|
|||
{
|
||||
return new ProfileMiniListItem($profile, $this->action);
|
||||
}
|
||||
|
||||
function showProfiles()
|
||||
{
|
||||
$cnt = 0;
|
||||
|
||||
while ($this->profile->fetch()) {
|
||||
$cnt++;
|
||||
if ($cnt > PROFILES_PER_MINILIST) {
|
||||
break;
|
||||
}
|
||||
$pli = $this->newListItem($this->profile);
|
||||
$pli->show();
|
||||
}
|
||||
|
||||
return $cnt;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class ProfileMiniListItem extends ProfileListItem
|
||||
|
|
|
@ -66,7 +66,7 @@ class FBConnectauthAction extends Action
|
|||
// User is already logged in. Does she already have a linked Facebook acct?
|
||||
$flink = Foreign_link::getByForeignID($this->fbuid, FACEBOOK_CONNECT_SERVICE);
|
||||
|
||||
if ($flink) {
|
||||
if (!empty($flink)) {
|
||||
|
||||
// User already has a linked Facebook account and shouldn't be here
|
||||
common_debug('There is already a local user (' . $flink->user_id .
|
||||
|
@ -337,7 +337,7 @@ class FBConnectauthAction extends Action
|
|||
if ($flink) {
|
||||
$user = $flink->getUser();
|
||||
|
||||
if ($user) {
|
||||
if (!empty($user)) {
|
||||
|
||||
common_debug("Logged in Facebook user $flink->foreign_id as user $user->id ($user->nickname)");
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ position:relative;
|
|||
margin-left:18px;
|
||||
}
|
||||
|
||||
#nav_fb .fb_profile_pic_rendered img {
|
||||
#nav_fb #fbc_profile-pic {
|
||||
position:absolute;
|
||||
top:-3px;
|
||||
left:-18px;
|
||||
|
@ -21,7 +21,7 @@ border:1px solid #3B5998;
|
|||
padding:1px;
|
||||
}
|
||||
|
||||
#nav_fb img {
|
||||
#nav_fb #fb_favicon {
|
||||
position:absolute;
|
||||
top:-13px;
|
||||
left:-25px;
|
||||
|
|
|
@ -70,7 +70,7 @@ class FBConnectPlugin extends Plugin
|
|||
function onStartShowHTML($action)
|
||||
{
|
||||
|
||||
if ($this->requiresFB($action)) {
|
||||
if ($this->reqFbScripts($action)) {
|
||||
|
||||
// XXX: Horrible hack to make Safari, FF2, and Chrome work with
|
||||
// Facebook Connect. These browser cannot use Facebook's
|
||||
|
@ -106,7 +106,7 @@ class FBConnectPlugin extends Plugin
|
|||
|
||||
function onStartShowHeader($action)
|
||||
{
|
||||
if ($this->requiresFB($action)) {
|
||||
if ($this->reqFbScripts($action)) {
|
||||
|
||||
$apikey = common_config('facebook', 'apikey');
|
||||
$plugin_path = common_path('plugins/FBConnect');
|
||||
|
@ -145,7 +145,7 @@ class FBConnectPlugin extends Plugin
|
|||
|
||||
function onEndShowFooter($action)
|
||||
{
|
||||
if ($this->requiresFB($action)) {
|
||||
if ($this->reqFbScripts($action)) {
|
||||
|
||||
$action->element('script',
|
||||
array('type' => 'text/javascript',
|
||||
|
@ -157,7 +157,7 @@ class FBConnectPlugin extends Plugin
|
|||
function onEndShowLaconicaStyles($action)
|
||||
{
|
||||
|
||||
if ($this->requiresFB($action)) {
|
||||
if ($this->reqFbScripts($action)) {
|
||||
|
||||
$action->element('link', array('rel' => 'stylesheet',
|
||||
'type' => 'text/css',
|
||||
|
@ -175,7 +175,7 @@ class FBConnectPlugin extends Plugin
|
|||
* @return boolean true
|
||||
*/
|
||||
|
||||
function requiresFB($action) {
|
||||
function reqFbScripts($action) {
|
||||
|
||||
// If you're logged in w/FB Connect, you always need the FB stuff
|
||||
|
||||
|
@ -220,7 +220,7 @@ class FBConnectPlugin extends Plugin
|
|||
try {
|
||||
|
||||
$facebook = getFacebook();
|
||||
$fbuid = getFacebook()->get_loggedin_user();
|
||||
$fbuid = getFacebook()->get_loggedin_user();
|
||||
|
||||
} catch (Exception $e) {
|
||||
common_log(LOG_WARNING,
|
||||
|
@ -248,15 +248,24 @@ class FBConnectPlugin extends Plugin
|
|||
|
||||
if (!empty($fbuid)) {
|
||||
|
||||
$action->elementStart('li', array('id' => 'nav_fb'));
|
||||
$action->elementStart('fb:profile-pic', array('uid' => $fbuid,
|
||||
'linked' => 'false',
|
||||
'width' => 16,
|
||||
'height' => 16));
|
||||
$action->elementEnd('fb:profile-pic');
|
||||
/* Default FB silhouette pic for FB users who haven't
|
||||
uploaded a profile pic yet. */
|
||||
|
||||
$iconurl = common_path('/plugins/FBConnect/fbfavicon.ico');
|
||||
$action->element('img', array('src' => $iconurl));
|
||||
$silhouetteUrl =
|
||||
'http://static.ak.fbcdn.net/pics/q_silhouette.gif';
|
||||
|
||||
$url = $this->getProfilePicURL($fbuid);
|
||||
|
||||
$action->elementStart('li', array('id' => 'nav_fb'));
|
||||
|
||||
$action->element('img', array('id' => 'fbc_profile-pic',
|
||||
'src' => (!empty($url)) ? $url : $silhouetteUrl,
|
||||
'alt' => 'Facebook Connect User',
|
||||
'width' => '16'), '');
|
||||
|
||||
$iconurl = common_path('plugins/FBConnect/fbfavicon.ico');
|
||||
$action->element('img', array('id' => 'fb_favicon',
|
||||
'src' => $iconurl));
|
||||
|
||||
$action->elementEnd('li');
|
||||
|
||||
|
@ -320,7 +329,7 @@ class FBConnectPlugin extends Plugin
|
|||
|
||||
function onStartShowLocalNavBlock($action)
|
||||
{
|
||||
$action_name = get_class($action);
|
||||
$action_name = get_class($action);
|
||||
|
||||
$login_actions = array('LoginAction', 'RegisterAction',
|
||||
'OpenidloginAction', 'FBConnectLoginAction');
|
||||
|
@ -361,4 +370,28 @@ class FBConnectPlugin extends Plugin
|
|||
return true;
|
||||
}
|
||||
|
||||
function getProfilePicURL($fbuid)
|
||||
{
|
||||
|
||||
$facebook = getFacebook();
|
||||
$url = null;
|
||||
|
||||
try {
|
||||
|
||||
$fqry = 'SELECT pic_square FROM user WHERE uid = %s';
|
||||
|
||||
$result = $facebook->api_client->fql_query(sprintf($fqry, $fbuid));
|
||||
|
||||
if (!empty($result)) {
|
||||
$url = $result[0]['pic_square'];
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
common_log(LOG_WARNING, "Facebook client failure requesting profile pic!");
|
||||
}
|
||||
|
||||
return $url;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1030,6 +1030,10 @@ border-radius:7px;
|
|||
#jOverlayContent #content img {
|
||||
max-width:480px;
|
||||
}
|
||||
#jOverlayLoading {
|
||||
top:22.5%;
|
||||
left:40%;
|
||||
}
|
||||
#attachment_view #oembed_info {
|
||||
margin-top:11px;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user