X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fitem.php;h=7d36d7f70aca152a91646dcd4dda5065d51e63a5;hb=f4f3c8375f9696c55ef16a1b9d26052d26beded1;hp=6c1c06f99a901ea505dba9368252285ad821936e;hpb=1581e02f8f2dd6c4515cbb33f3cb85b8f66ec8e0;p=friendica.git diff --git a/mod/item.php b/mod/item.php index 6c1c06f99a..7d36d7f70a 100644 --- a/mod/item.php +++ b/mod/item.php @@ -306,6 +306,7 @@ function item_post(&$a) { $author = null; $self = false; + $contact_id = 0; if((local_user()) && (local_user() == $profile_uid)) { $self = true; @@ -314,9 +315,19 @@ function item_post(&$a) { ); } elseif(remote_user()) { - $r = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1", - intval(remote_user()) - ); + if(is_array($_SESSION['remote'])) { + foreach($_SESSION['remote'] as $v) { + if($v['uid'] == $profile_uid) { + $contact_id = $v['cid']; + break; + } + } + } + if($contact_id) { + $r = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1", + intval($contact_id) + ); + } } if(count($r)) { @@ -362,8 +373,8 @@ function item_post(&$a) { $match = null; - if((! $preview) && preg_match_all("/\[img\](.*?)\[\/img\]/",$body,$match)) { - $images = $match[1]; + if((! $preview) && preg_match_all("/\[img([\=0-9x]*?)\](.*?)\[\/img\]/",$body,$match)) { + $images = $match[2]; if(count($images)) { foreach($images as $image) { if(! stristr($image,$a->get_baseurl() . '/photo/')) @@ -608,7 +619,7 @@ function item_post(&$a) { if($preview) { require_once('include/conversation.php'); - $o = conversation($a,array(array_merge($contact_record,$datarray)),'search', false); + $o = conversation($a,array(array_merge($contact_record,$datarray)),'search', false, true); logger('preview: ' . $o); echo json_encode(array('preview' => $o)); killme();