X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fconversation.php;h=4eff0d088b70a77183bf5104ec3cc98aacb29a78;hb=803a7425eaff955bd0001b46ee7f22c5d80acb89;hp=78b3987a3452344d1e12de46b603d5b5d39c70f1;hpb=f6dd834284ccf8e69af8cefce45046a64460aa62;p=friendica.git
diff --git a/include/conversation.php b/include/conversation.php
old mode 100644
new mode 100755
index 78b3987a34..4eff0d088b
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -116,6 +116,34 @@ function localize_item(&$item){
$item['body'] = sprintf( t('%1$s tagged %2$s\'s %3$s with %4$s'), $author, $objauthor, $plink, $tag );
}
+ if ($item['verb']=== ACTIVITY_FAVORITE){
+
+ if ($item['object-type']== "")
+ return;
+
+ $Aname = $item['author-name'];
+ $Alink = $item['author-link'];
+
+ $xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">";
+
+ $obj = parse_xml_string($xmlhead.$item['object']);
+ if(strlen($obj->id)) {
+ $r = q("select * from item where uri = '%s' and uid = %d limit 1",
+ dbesc($obj->id),
+ intval($item['uid'])
+ );
+ if(count($r) && $r[0]['plink']) {
+ $target = $r[0];
+ $Bname = $target['author-name'];
+ $Blink = $target['author-link'];
+ $A = '[url=' . $Alink . ']' . $Aname . '[/url]';
+ $B = '[url=' . $Blink . ']' . $Bname . '[/url]';
+ $P = '[url=' . $target['plink'] . ']' . t('post/item') . '[/url]';
+ $item['body'] = sprintf( t('%1$s marked %2$s\'s %3$s as favorite'), $A, $B, $P)."\n";
+
+ }
+ }
+ }
}
@@ -129,13 +157,15 @@ function localize_item(&$item){
* that are based on unique features of the calling module.
*
*/
-function conversation(&$a, $items, $mode, $update) {
+function conversation(&$a, $items, $mode, $update, $preview = false) {
require_once('bbcode.php');
$profile_owner = 0;
$page_writeable = false;
+ $previewing = (($preview) ? ' preview ' : '');
+
if($mode === 'network') {
$profile_owner = local_user();
$page_writeable = true;
@@ -168,6 +198,10 @@ function conversation(&$a, $items, $mode, $update) {
load_contact_links(local_user());
+ $cb = array('items' => $items, 'mode' => $mode, 'update' => $update, 'preview' => $preview);
+ call_hooks('conversation_start',$cb);
+
+ $items = $cb['items'];
$cmnt_tpl = get_markup_template('comment_item.tpl');
$tpl = get_markup_template('wall_item.tpl');
@@ -211,8 +245,8 @@ function conversation(&$a, $items, $mode, $update) {
$profile_name = ((strlen($item['author-name'])) ? $item['author-name'] : $item['name']);
- if($author-link && (! $author-name))
- $profile-name = $author-link;
+ if($item['author-link'] && (! $item['author-name']))
+ $profile_name = $item['author-link'];
$sp = false;
$profile_link = best_link_url($item,$sp);
@@ -228,15 +262,10 @@ function conversation(&$a, $items, $mode, $update) {
else
$profile_avatar = ((strlen($item['author-avatar'])) ? $item['author-avatar'] : $item['thumb']);
- $location = (($item['location']) ? '' . $item['location'] . '' : '');
- $coord = (($item['coord']) ? '' . $item['coord'] . '' : '');
- if($coord) {
- if($location)
- $location .= '
(' . $coord . ')';
- else
- $location = '' . $coord . '';
- }
+ $locate = array('location' => $item['location'], 'coord' => $item['coord'], 'html' => '');
+ call_hooks('render_location',$locate);
+ $location = ((strlen($locate['html'])) ? $locate['html'] : render_location_google($locate));
localize_item($item);
if($mode === 'network-new')
@@ -261,7 +290,7 @@ function conversation(&$a, $items, $mode, $update) {
$body = prepare_body($item,true);
$tmp_item = replace_macros($tpl,array(
- '$id' => $item['item_id'],
+ '$id' => (($preview) ? 'P0' : $item['item_id']),
'$linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['author-link'])) ? $item['author-link'] : $item['url'])),
'$profile_url' => $profile_link,
'$item_photo_menu' => item_photo_menu($item),
@@ -287,14 +316,15 @@ function conversation(&$a, $items, $mode, $update) {
'$like' => '',
'$dislike' => '',
'$comment' => '',
- '$conv' => array('href'=> $a->get_baseurl() . '/display/' . $nickname . '/' . $item['id'], 'title'=> t('View in context')),
+ '$conv' => (($preview) ? '' : array('href'=> $a->get_baseurl() . '/display/' . $nickname . '/' . $item['id'], 'title'=> t('View in context'))),
+ '$previewing' => $previewing,
'$wait' => t('Please wait'),
));
$arr = array('item' => $item, 'output' => $tmp_item);
call_hooks('display_item', $arr);
- $threads[$threadsid]['id'] = $arr[$item['item_id']];
+ $threads[$threadsid]['id'] = $item['item_id'];
$threads[$threadsid]['html'] .= $arr['output'];
}
@@ -459,7 +489,7 @@ function conversation(&$a, $items, $mode, $update) {
}
$likebuttons = '';
- $shareable = ((($profile_owner == local_user()) && ($mode != 'display') && (! $item['private'])) ? true : false);
+ $shareable = ((($profile_owner == local_user()) && (! $item['private'])) ? true : false); //($mode != 'display') &&
if($page_writeable) {
if($toplevelpost) {
@@ -483,6 +513,7 @@ function conversation(&$a, $items, $mode, $update) {
'$myphoto' => $a->contact['thumb'],
'$comment' => t('Comment'),
'$submit' => t('Submit'),
+ '$preview' => t('Preview'),
'$ww' => (($mode === 'network') ? $commentww : '')
));
}
@@ -533,6 +564,10 @@ function conversation(&$a, $items, $mode, $update) {
$profile_name = (((strlen($item['author-name'])) && $diff_author) ? $item['author-name'] : $item['name']);
+ if($item['author-link'] && (! $item['author-name']))
+ $profile_name = $item['author-link'];
+
+
$sp = false;
$profile_link = best_link_url($item,$sp);
if($sp)
@@ -554,16 +589,10 @@ function conversation(&$a, $items, $mode, $update) {
$like = ((x($alike,$item['id'])) ? format_like($alike[$item['id']],$alike[$item['id'] . '-l'],'like',$item['id']) : '');
$dislike = ((x($dlike,$item['id'])) ? format_like($dlike[$item['id']],$dlike[$item['id'] . '-l'],'dislike',$item['id']) : '');
- $location = (($item['location']) ? '' . $item['location'] . '' : '');
- $coord = (($item['coord']) ? '' . $item['coord'] . '' : '');
- if($coord) {
- if($location)
- $location .= '
(' . $coord . ')';
- else
- $location = '' . $coord . '';
- }
+ $locate = array('location' => $item['location'], 'coord' => $item['coord'], 'html' => '');
+ call_hooks('render_location',$locate);
+
+ $location = ((strlen($locate['html'])) ? $locate['html'] : render_location_google($locate));
$indent = (($toplevelpost) ? '' : ' comment');
@@ -580,7 +609,6 @@ function conversation(&$a, $items, $mode, $update) {
if ($tag!="") $tags[] = bbcode($tag);
}
-
// Build the HTML
$body = prepare_body($item,true);
@@ -619,6 +647,7 @@ function conversation(&$a, $items, $mode, $update) {
'$like' => $like,
'$dislike' => $dislike,
'$comment' => $comment,
+ '$previewing' => $previewing,
'$wait' => t('Please wait'),
));
@@ -720,10 +749,12 @@ function item_photo_menu($item){
);
- $args = array($item, &$menu);
+ $args = array('item' => $item, 'menu' => $menu);
call_hooks('item_photo_menu', $args);
-
+
+ $menu = $args['menu'];
+
$o = "";
foreach($menu as $k=>$v){
if ($v!="") $o .= "