X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fconversation.php;h=5a84ca42a635be89c7c0752a34d1612dd3c07ca9;hb=ed8cdc7d8502b03ca9096b4d4a4c5fd9d149d08f;hp=c278ec2f18534edf629ccc7c951c55300d46615d;hpb=9b394dbe1e308a728b73fc86bd2a33941aac05b5;p=friendica.git diff --git a/include/conversation.php b/include/conversation.php index c278ec2f18..5a84ca42a6 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1,6 +1,7 @@ ".$tag["term"].""; + $prefix = "#"; + } elseif ($tag["type"] == TERM_MENTION) { + $mentions[] = "@".$tag["term"].""; + $prefix = "@"; + } + $tags[] = $prefix."".$tag["term"].""; + } + + /*foreach(explode(',',$item['tag']) as $tag){ $tag = trim($tag); if ($tag!="") { $t = bbcode($tag); @@ -533,7 +577,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { elseif($t[0] == '@') $mentions[] = $t; } - } + }*/ $sp = false; $profile_link = best_link_url($item,$sp); @@ -553,7 +597,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { $locate = array('location' => $item['location'], 'coord' => $item['coord'], 'html' => ''); call_hooks('render_location',$locate); - $location = ((strlen($locate['html'])) ? $locate['html'] : render_location_google($locate)); + $location = ((strlen($locate['html'])) ? $locate['html'] : render_location_dummy($locate)); localize_item($item); if($mode === 'network-new') @@ -576,7 +620,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { $likebuttons = false; $shareable = false; - $body = prepare_body($item,true); + $body = prepare_body($item,true, $preview); list($categories, $folders) = get_cats_and_terms($item); @@ -605,13 +649,14 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { $tmp_item = array( 'template' => $tpl, 'id' => (($preview) ? 'P0' : $item['item_id']), + 'network' => $item['item_network'], '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), 'name' => $profile_name_e, 'sparkle' => $sparkle, 'lock' => $lock, - 'thumb' => $profile_avatar, + 'thumb' => proxy_url($profile_avatar), 'title' => $item['title_e'], 'body' => $body_e, 'tags' => $tags_e, @@ -630,7 +675,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { 'indent' => '', 'owner_name' => $owner_name_e, 'owner_url' => $owner_url, - 'owner_photo' => $owner_photo, + 'owner_photo' => proxy_url($owner_photo), 'plink' => get_plink($item), 'edpost' => false, 'isstarred' => $isstarred, @@ -640,7 +685,8 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { 'like' => '', 'dislike' => '', 'comment' => '', - 'conv' => (($preview) ? '' : array('href'=> $a->get_baseurl($ssl_state) . '/display/' . $nickname . '/' . $item['id'], 'title'=> t('View in context'))), + //'conv' => (($preview) ? '' : array('href'=> $a->get_baseurl($ssl_state) . '/display/' . $nickname . '/' . $item['id'], 'title'=> t('View in context'))), + 'conv' => (($preview) ? '' : array('href'=> $a->get_baseurl($ssl_state) . '/display/'.$item['guid'], 'title'=> t('View in context'))), 'previewing' => $previewing, 'wait' => t('Please wait'), 'thread_level' => 1, @@ -650,10 +696,10 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { call_hooks('display_item', $arr); $threads[$threadsid]['id'] = $item['item_id']; + $threads[$threadsid]['network'] = $item['item_network']; $threads[$threadsid]['items'] = array($arr['output']); } - } else { @@ -672,6 +718,21 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { $threads = array(); foreach($items as $item) { + if($arr_blocked) { + $blocked = false; + foreach($arr_blocked as $b) { + + if($b && link_compare($item['author-link'],$b)) { + $blocked = true; + break; + } + } + if($blocked) + continue; + } + + + // Can we put this after the visibility check? like_puller($a,$item,$alike,'like'); like_puller($a,$item,$dlike,'dislike'); @@ -695,6 +756,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { } $threads = $conv->get_template_data($alike, $dlike); + if(!$threads) { logger('[ERROR] conversation : Failed to get template data.', LOGGER_DEBUG); $threads = array(); @@ -704,6 +766,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { $o = replace_macros($page_template, array( '$baseurl' => $a->get_baseurl($ssl_state), + '$return_path' => $a->query_string, '$live_update' => $live_update_div, '$remove' => t('remove'), '$mode' => $mode, @@ -793,7 +856,7 @@ function item_photo_menu($item){ if(($cid) && (! $item['self'])) { $poke_link = $a->get_baseurl($ssl_state) . '/poke/?f=&c=' . $cid; $contact_url = $a->get_baseurl($ssl_state) . '/contacts/' . $cid; - $posts_link = $a->get_baseurl($ssl_state) . '/network/?cid=' . $cid; + $posts_link = $a->get_baseurl($ssl_state) . '/network/0?nets=all&cid=' . $cid; $clean_url = normalise_link($item['author-link']); @@ -829,9 +892,9 @@ function item_photo_menu($item){ foreach($menu as $k=>$v){ if(strpos($v,'javascript:') === 0) { $v = substr($v,11); - $o .= "
  • $k
  • \n"; + $o .= "
  • $k
  • \n"; } - elseif ($v!="") $o .= "
  • $k
  • \n"; + elseif ($v!="") $o .= "
  • $k
  • \n"; } return $o; }} @@ -845,7 +908,7 @@ function like_puller($a,$item,&$arr,$mode) { if((activity_match($item['verb'],$verb)) && ($item['id'] != $item['parent'])) { $url = $item['author-link']; - if((local_user()) && (local_user() == $item['uid']) && ($item['network'] === 'dfrn') && (! $item['self']) && (link_compare($item['author-link'],$item['url']))) { + if((local_user()) && (local_user() == $item['uid']) && ($item['network'] === NETWORK_DFRN) && (! $item['self']) && (link_compare($item['author-link'],$item['url']))) { $url = $a->get_baseurl(true) . '/redir/' . $item['contact-id']; $sparkle = ' class="sparkle" '; } @@ -908,7 +971,7 @@ function format_like($cnt,$arr,$type,$id) { $str .= sprintf( t(', and %d other people'), $total - MAX_LIKERS ); } $str = (($type === 'like') ? sprintf( t('%s like this.'), $str) : sprintf( t('%s don\'t like this.'), $str)); - $o .= "\t" . ''; + $o .= "\t" . ''; } return $o; }} @@ -961,43 +1024,33 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) { '$whereareu' => t('Where are you right now?') )); - - $tpl = get_markup_template("jot.tpl"); - $jotplugins = ''; - $jotnets = ''; - - $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1); + call_hooks('jot_tool', $jotplugins); - $mail_enabled = false; - $pubmail_enabled = false; + // Private/public post links for the non-JS ACL form + $private_post = 1; + if($_REQUEST['public']) + $private_post = 0; - if(($x['is_owner']) && (! $mail_disabled)) { - $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1", - intval(local_user()) - ); - if(count($r)) { - $mail_enabled = true; - if(intval($r[0]['pubmail'])) - $pubmail_enabled = true; - } - } + $query_str = $a->query_string; + if(strpos($query_str, 'public=1') !== false) + $query_str = str_replace(array('?public=1', '&public=1'), array('', ''), $query_str); - if($mail_enabled) { - $selected = (($pubmail_enabled) ? ' checked="checked" ' : ''); - $jotnets .= '
    ' . t("Post to Email") . '
    '; - } + // I think $a->query_string may never have ? in it, but I could be wrong + // It looks like it's from the index.php?q=[etc] rewrite that the web + // server does, which converts any ? to &, e.g. suggest&ignore=61 for suggest?ignore=61 + if(strpos($query_str, '?') === false) + $public_post_link = '?public=1'; + else + $public_post_link = '&public=1'; - call_hooks('jot_tool', $jotplugins); - call_hooks('jot_networks', $jotnets); - if($notes_cid) - $jotnets .= ''; // $tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins)); + $tpl = get_markup_template("jot.tpl"); $o .= replace_macros($tpl,array( - '$return_path' => $a->query_string, + '$return_path' => $query_str, '$action' => $a->get_baseurl(true) . '/item', '$share' => (x($x,'button') ? $x['button'] : t('Share')), '$upload' => t('Upload photo'), @@ -1014,33 +1067,40 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) { '$shortsetloc' => t('set location'), '$noloc' => t('Clear browser location'), '$shortnoloc' => t('clear location'), - '$title' => "", + '$title' => $x['title'], '$placeholdertitle' => t('Set title'), - '$category' => "", + '$category' => $x['category'], '$placeholdercategory' => (feature_enabled(local_user(),'categories') ? t('Categories (comma-separated list)') : ''), '$wait' => t('Please wait'), '$permset' => t('Permission settings'), '$shortpermset' => t('permissions'), '$ptyp' => (($notes_cid) ? 'note' : 'wall'), - '$content' => '', - '$post_id' => '', + '$content' => $x['content'], + '$post_id' => $x['post_id'], '$baseurl' => $a->get_baseurl(true), '$defloc' => $x['default_location'], '$visitor' => $x['visitor'], '$pvisit' => (($notes_cid) ? 'none' : $x['visitor']), - '$emailcc' => t('CC: email addresses'), '$public' => t('Public post'), '$jotnets' => $jotnets, - '$emtitle' => t('Example: bob@example.com, mary@example.com'), '$lockstate' => $x['lockstate'], - '$acl' => $x['acl'], '$bang' => $x['bang'], '$profile_uid' => $x['profile_uid'], '$preview' => ((feature_enabled($x['profile_uid'],'preview')) ? t('Preview') : ''), '$jotplugins' => $jotplugins, + '$notes_cid' => $notes_cid, '$sourceapp' => t($a->sourcename), '$cancel' => t('Cancel'), - '$rand_num' => random_digits(12) + '$rand_num' => random_digits(12), + + // ACL permissions box + '$acl' => $x['acl'], + '$acl_data' => $x['acl_data'], + '$group_perms' => t('Post to Groups'), + '$contact_perms' => t('Post to Contacts'), + '$private' => t('Private post'), + '$is_private' => $private_post, + '$public_link' => $public_post_link, )); @@ -1169,14 +1229,10 @@ function find_thread_parent_index($arr,$x) { return false; } -function render_location_google($item) { - $location = (($item['location']) ? '' . $item['location'] . '' : ''); - $coord = (($item['coord']) ? '' . $item['coord'] . '' : ''); - if($coord) { - if($location) - $location .= '
    (' . $coord . ')'; - else - $location = '' . $coord . ''; - } - return $location; +function render_location_dummy($item) { + if ($item['location'] != "") + return $item['location']; + + if ($item['coord'] != "") + return $item['coord']; }