1
0
Fork 0

Merge remote branch 'friendica/master' into blog-like

This commit is contained in:
Fabrixxm 2012-09-20 02:48:54 -04:00
commit 40f2ec189e
25 changed files with 501 additions and 340 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

@ -755,6 +755,8 @@ function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $pr
$item_result = $arr['output'];
if($firstcollapsed) {
$item_result['num_comments'] = sprintf( tt('%d comment','%d comments',$total_children),$total_children );
$item_result['hidden_comments_num'] = $total_children;
$item_result['hidden_comments_text'] = tt('comment', 'comments', $total_children);
$item_result['hide_text'] = t('show more');
}

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