aboutsummaryrefslogtreecommitdiffstats
path: root/mod/item.php
diff options
context:
space:
mode:
authorFabio Comuni <fabrix.xm@gmail.com>2012-01-06 09:10:21 +0100
committerFabio Comuni <fabrix.xm@gmail.com>2012-01-06 09:10:21 +0100
commita9670cbb7d2cab644ee9d499aade98164f92631a (patch)
treef136b6448ecd23ec7c987bf26b8d49be25a8aca5 /mod/item.php
parent93563370c96848948d28ed39e13284ebaf7f430a (diff)
parent53878625f6ecc014283cefbd84f92b6f1294b8a3 (diff)
downloadvolse-hubzilla-a9670cbb7d2cab644ee9d499aade98164f92631a.tar.gz
volse-hubzilla-a9670cbb7d2cab644ee9d499aade98164f92631a.tar.bz2
volse-hubzilla-a9670cbb7d2cab644ee9d499aade98164f92631a.zip
Merge remote-tracking branch 'friendica/master'
Diffstat (limited to 'mod/item.php')
-rw-r--r--mod/item.php32
1 files changed, 21 insertions, 11 deletions
diff --git a/mod/item.php b/mod/item.php
index ece92f0f3..d4d337584 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -54,6 +54,8 @@ function item_post(&$a) {
$parid = 0;
$r = false;
+ $preview = ((x($_POST,'preview')) ? intval($_POST['preview']) : 0);
+
if($parent || $parent_uri) {
if(! x($_POST,'type'))
@@ -280,7 +282,7 @@ function item_post(&$a) {
$match = null;
- if(preg_match_all("/\[img\](.*?)\[\/img\]/",$body,$match)) {
+ if((! $preview) && preg_match_all("/\[img\](.*?)\[\/img\]/",$body,$match)) {
$images = $match[1];
if(count($images)) {
foreach($images as $image) {
@@ -323,7 +325,7 @@ function item_post(&$a) {
$match = false;
- if(preg_match_all("/\[attachment\](.*?)\[\/attachment\]/",$body,$match)) {
+ if((! $preview) && preg_match_all("/\[attachment\](.*?)\[\/attachment\]/",$body,$match)) {
$attaches = $match[1];
if(count($attaches)) {
foreach($attaches as $attach) {
@@ -351,13 +353,6 @@ function item_post(&$a) {
$bookmark = 0;
if(preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism",$body,$match,PREG_SET_ORDER)) {
$bookmark = 1;
-// foreach($match as $mtch) {
-// $body = str_replace(
-// '[bookmark=' . $mtch[1] . ']' . $mtch[2] . '[/bookmark]',
-// '[url=' . $mtch[1] . ']' . $mtch[2] . '[/url]',
-// $body
-// );
-// }
}
$body = bb_translate_video($body);
@@ -588,6 +583,17 @@ function item_post(&$a) {
else
$datarray['guid'] = get_guid();
+ // preview mode - prepare the body for display and send it via json
+
+ if($preview) {
+ $b = prepare_body($datarray,true);
+ require_once('include/conversation.php');
+ $o = conversation(&$a,array(array_merge($datarray,$contact_record)),'search',false);
+ $json = array('preview' => $o);
+ echo json_encode($json);
+ killme();
+ }
+
call_hooks('post_local',$datarray);
@@ -691,7 +697,9 @@ function item_post(&$a) {
'link' => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id,
'source_name' => $datarray['author-name'],
'source_link' => $datarray['author-link'],
- 'source_photo' => $datarray['author-avatar']
+ 'source_photo' => $datarray['author-avatar'],
+ 'verb' => ACTIVITY_POST,
+ 'otype' => 'item'
));
}
@@ -731,7 +739,9 @@ function item_post(&$a) {
'link' => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id,
'source_name' => $datarray['author-name'],
'source_link' => $datarray['author-link'],
- 'source_photo' => $datarray['author-avatar']
+ 'source_photo' => $datarray['author-avatar'],
+ 'verb' => ACTIVITY_POST,
+ 'otype' => 'item'
));
}
}