This commit is contained in:
redmatrix 2015-10-29 15:11:58 -07:00
commit a1e28bb669
4 changed files with 6 additions and 10 deletions

View File

@ -309,9 +309,8 @@ function bb2diaspora_itembody($item, $force_update = false) {
$is_photo = (($item['obj_type'] == ACTIVITY_OBJ_PHOTO) ? true : false); $is_photo = (($item['obj_type'] == ACTIVITY_OBJ_PHOTO) ? true : false);
if($is_photo) { if($is_photo) {
$object = json_decode($item['object'],true); $object = json_decode($item['object'],true);
if($object['link'][2]) { if($object['bbcode']) {
$photo_bb = '[zrl=' . rawurldecode($object['id']) . ']' . '[zmg=' . $object['link'][2]['width'] . 'x' . $object['link'][2]['height'] . ']' . rawurldecode($object['link'][2]['href']) . '[/zmg]' . '[/zrl]'; $item['body'] = (($item['body']) ? $object['bbcode'] . "\r\n" . $item['body'] : $object['bbcode']);
$item['body'] = (($item['body']) ? $photo_bb . $item['body'] : $photo_bb);
} }
} }

View File

@ -593,16 +593,12 @@ function import_xchan_photo($photo,$xchan,$thing = false) {
if($photo) { if($photo) {
$filename = basename($photo); $filename = basename($photo);
$type = guess_image_type($photo);
if(! $type)
$type = 'image/jpeg';
$result = z_fetch_url($photo,true); $result = z_fetch_url($photo,true);
if($result['success']) { if($result['success']) {
$img_str = $result['body']; $img_str = $result['body'];
$type = guess_image_type($photo, $result['header']);
$h = explode("\n",$result['header']); $h = explode("\n",$result['header']);
if($h) { if($h) {

View File

@ -90,7 +90,6 @@ function editpost_content(&$a) {
$category .= ', '; $category .= ', ';
$category .= $cat['term']; $category .= $cat['term'];
} }
} }
if($itm[0]['attach']) { if($itm[0]['attach']) {

View File

@ -607,6 +607,7 @@ function item_post(&$a) {
if(preg_match_all('/(\[attachment\](.*?)\[\/attachment\])/',$body,$match)) { if(preg_match_all('/(\[attachment\](.*?)\[\/attachment\])/',$body,$match)) {
$attachments = array(); $attachments = array();
$i = 0;
foreach($match[2] as $mtch) { foreach($match[2] as $mtch) {
$attach_link = ''; $attach_link = '';
$hash = substr($mtch,0,strpos($mtch,',')); $hash = substr($mtch,0,strpos($mtch,','));
@ -626,7 +627,8 @@ function item_post(&$a) {
$attach_link = '[audio]' . z_root() . '/attach/' . $r['data']['hash'] . '/' . $r['data']['revision'] . (($ext) ? $ext : '') . '[/audio]'; $attach_link = '[audio]' . z_root() . '/attach/' . $r['data']['hash'] . '/' . $r['data']['revision'] . (($ext) ? $ext : '') . '[/audio]';
elseif(strpos($r['data']['filetype'],'video/') !== false) elseif(strpos($r['data']['filetype'],'video/') !== false)
$attach_link = '[video]' . z_root() . '/attach/' . $r['data']['hash'] . '/' . $r['data']['revision'] . (($ext) ? $ext : '') . '[/video]'; $attach_link = '[video]' . z_root() . '/attach/' . $r['data']['hash'] . '/' . $r['data']['revision'] . (($ext) ? $ext : '') . '[/video]';
$body = str_replace($match[1],$attach_link,$body); $body = str_replace($match[1][$i],$attach_link,$body);
$i++;
} }
} }