Merge pull request #490 from fermionic/diaspora-profile-updates-broken

-- Fix Diaspora profile update avatar bugs
This commit is contained in:
friendica 2012-09-19 19:52:50 -07:00
commit cd109b5adf
9 changed files with 60 additions and 38 deletions

View file

@ -198,10 +198,6 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
$a = get_app();
// Move all spaces out of the tags
$Text = preg_replace("/\[(\w*)\](\s*)/ism", '$2[$1]', $Text);
$Text = preg_replace("/(\s*)\[\/(\w*)\]/ism", '[/$2]$1', $Text);
// Hide all [noparse] contained bbtags by spacefying them
// POSSIBLE BUG --> Will the 'preg' functions crash if there's an embedded image?
@ -210,6 +206,10 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
$Text = preg_replace_callback("/\[pre\](.*?)\[\/pre\]/ism", 'bb_spacefy',$Text);
// Move all spaces out of the tags
$Text = preg_replace("/\[(\w*)\](\s*)/ism", '$2[$1]', $Text);
$Text = preg_replace("/(\s*)\[\/(\w*)\]/ism", '[/$2]$1', $Text);
// Extract the private images which use data url's since preg has issues with
// large data sizes. Stash them away while we do bbcode conversion, and then put them back
// in after we've done all the regex matching. We cannot use any preg functions to do this.

View file

@ -2061,11 +2061,20 @@ function diaspora_profile($importer,$xml,$msg) {
$image_url = unxmlify($xml->image_url);
$birthday = unxmlify($xml->birthday);
$r = q("SELECT DISTINCT ( `resource-id` ) FROM `photo` WHERE `uid` = %d AND `contact-id` = %d AND `album` = 'Contact Photos' ",
$handle_parts = explode("@", $diaspora_handle);
if($name === '') {
$name = $handle_parts[0];
}
if(strpos($image_url, $handle_parts[1]) === false) {
$image_url = "http://" . $handle_parts[1] . $image_url;
}
/* $r = q("SELECT DISTINCT ( `resource-id` ) FROM `photo` WHERE `uid` = %d AND `contact-id` = %d AND `album` = 'Contact Photos' ",
intval($importer['uid']),
intval($contact['id'])
);
$oldphotos = ((count($r)) ? $r : null);
$oldphotos = ((count($r)) ? $r : null);*/
require_once('include/Photo.php');
@ -2098,7 +2107,7 @@ function diaspora_profile($importer,$xml,$msg) {
intval($importer['uid'])
);
if($r) {
/* if($r) {
if($oldphotos) {
foreach($oldphotos as $ph) {
q("DELETE FROM `photo` WHERE `uid` = %d AND `contact-id` = %d AND `album` = 'Contact Photos' AND `resource-id` = '%s' ",
@ -2108,7 +2117,7 @@ function diaspora_profile($importer,$xml,$msg) {
);
}
}
}
} */
return;

View file

@ -275,7 +275,7 @@ function onepoll_run($argv, $argc){
openssl_private_decrypt(hex2bin($mailconf[0]['pass']),$password,$x[0]['prvkey']);
$mbox = email_connect($mailbox,$mailconf[0]['user'],$password);
unset($password);
logger("Mail: Connect");
logger("Mail: Connect to " . $mailconf[0]['user']);
if($mbox) {
q("UPDATE `mailacct` SET `last_check` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1",
dbesc(datetime_convert()),
@ -289,7 +289,7 @@ function onepoll_run($argv, $argc){
$msgs = email_poll($mbox,$contact['addr']);
if(count($msgs)) {
logger("Mail: Parsing ".count($msgs)." mails.", LOGGER_DEBUG);
logger("Mail: Parsing ".count($msgs)." mails for ".$mailconf[0]['user'], LOGGER_DEBUG);
foreach($msgs as $msg_uid) {
logger("Mail: Parsing mail ".$msg_uid, LOGGER_DATA);
@ -339,15 +339,15 @@ function onepoll_run($argv, $argc){
case 0:
break;
case 1:
logger("Mail: Deleting ".$msg_uid);
logger("Mail: Deleting ".$msg_uid." for ".$mailconf[0]['user']);
imap_delete($mbox, $msg_uid, FT_UID);
break;
case 2:
logger("Mail: Mark as seen ".$msg_uid);
logger("Mail: Mark as seen ".$msg_uid." for ".$mailconf[0]['user']);
imap_setflag_full($mbox, $msg_uid, "\\Seen", ST_UID);
break;
case 3:
logger("Mail: Moving ".$msg_uid." to ".$mailconf[0]['movetofolder']);
logger("Mail: Moving ".$msg_uid." to ".$mailconf[0]['movetofolder']." for ".$mailconf[0]['user']);
imap_setflag_full($mbox, $msg_uid, "\\Seen", ST_UID);
if ($mailconf[0]['movetofolder'] != "")
imap_mail_move($mbox, $msg_uid, $mailconf[0]['movetofolder'], FT_UID);
@ -377,12 +377,12 @@ function onepoll_run($argv, $argc){
$r = email_get_msg($mbox,$msg_uid, $reply);
if(! $r) {
logger("Mail: can't fetch msg ".$msg_uid);
logger("Mail: can't fetch msg ".$msg_uid." for ".$mailconf[0]['user']);
continue;
}
$datarray['body'] = escape_tags($r['body']);
logger("Mail: Importing ".$msg_uid);
logger("Mail: Importing ".$msg_uid." for ".$mailconf[0]['user']);
// some mailing lists have the original author as 'from' - add this sender info to msg body.
// todo: adding a gravatar for the original author would be cool
@ -423,15 +423,15 @@ function onepoll_run($argv, $argc){
case 0:
break;
case 1:
logger("Mail: Deleting ".$msg_uid);
logger("Mail: Deleting ".$msg_uid." for ".$mailconf[0]['user']);
imap_delete($mbox, $msg_uid, FT_UID);
break;
case 2:
logger("Mail: Mark as seen ".$msg_uid);
logger("Mail: Mark as seen ".$msg_uid." for ".$mailconf[0]['user']);
imap_setflag_full($mbox, $msg_uid, "\\Seen", ST_UID);
break;
case 3:
logger("Mail: Moving ".$msg_uid." to ".$mailconf[0]['movetofolder']);
logger("Mail: Moving ".$msg_uid." to ".$mailconf[0]['movetofolder']." for ".$mailconf[0]['user']);
imap_setflag_full($mbox, $msg_uid, "\\Seen", ST_UID);
if ($mailconf[0]['movetofolder'] != "")
imap_mail_move($mbox, $msg_uid, $mailconf[0]['movetofolder'], FT_UID);

View file

@ -5,8 +5,6 @@
<script type="text/javascript">
tinyMCE.init({ mode : "none"});
</script>-->
<script type="text/javascript" src="$baseurl/js/jquery.js" ></script>
<script type="text/javascript">var $j = jQuery.noConflict();</script>
<script type="text/javascript" src="$baseurl/view/theme/frost/js/jquery.divgrow-1.3.1.min.js" ></script>
<script type="text/javascript" src="$baseurl/js/jquery.textinputs.js" ></script>
<script type="text/javascript" src="$baseurl/view/theme/frost-mobile/js/fk.autocomplete.min.js" ></script>
@ -16,5 +14,4 @@
<script type="text/javascript" src="$baseurl/view/theme/frost-mobile/js/acl.min.js" ></script>
<script type="text/javascript" src="$baseurl/js/webtoolkit.base64.min.js" ></script>
<script type="text/javascript" src="$baseurl/view/theme/frost-mobile/js/theme.min.js"></script>
<script type="text/javascript" src="$baseurl/view/theme/frost-mobile/js/main.min.js" ></script>

View file

@ -27,4 +27,7 @@
var updateInterval = $update_interval;
var localUser = {{ if $local_user }}$local_user{{ else }}false{{ endif }};
</script>
<script type="text/javascript" src="$baseurl/js/jquery.js" ></script>
<script type="text/javascript">var $j = jQuery.noConflict();</script>
<script type="text/javascript" src="$baseurl/view/theme/frost-mobile/js/main.min.js" ></script>

View file

@ -315,6 +315,22 @@
prev = ident;
});
var bimgs = $j(".wall-item-body > img").not(function() { return this.complete; });
var bimgcount = bimgs.length;
if (bimgcount) {
bimgs.load(function() {
bimgcount--;
if (! bimgcount) {
collapseHeight();
}
});
} else {
collapseHeight();
}
// reset vars for inserting individual items
/*prev = 'live-' + src;
@ -349,22 +365,6 @@
}
/* autocomplete @nicknames */
$j(".comment-edit-form textarea").contact_autocomplete(baseurl+"/acl");
var bimgs = $j(".wall-item-body > img").not(function() { return this.complete; });
var bimgcount = bimgs.length;
if (bimgcount) {
bimgs.load(function() {
bimgcount--;
if (! bimgcount) {
collapseHeight();
}
});
} else {
collapseHeight();
}
});
}

File diff suppressed because one or more lines are too long

View file

@ -1361,6 +1361,13 @@ input#dfrn-url {
-webkit-border-radius: 7px;
}
.wall-item-content img.smiley {
display: inline;
margin: auto;
border-radius: 0;
-webkit-border-radius: 0;
}
.comment .wall-item-content img {
max-width: 280px;
}
@ -3398,6 +3405,7 @@ aside input[type='text'] {
text-decoration: none;
}
.field .onoff .off {
border-color:#666666;
padding-left: 40px;
background-position: left center;

View file

@ -1316,6 +1316,11 @@ input#dfrn-url {
max-width: 100%;
}
.wall-item-content img.smiley {
display: inline;
margin: auto;
}
.divgrow-showmore {
display: block;
clear: both;