aboutsummaryrefslogtreecommitdiffstats
path: root/include/conversation.php
diff options
context:
space:
mode:
authorThomas Willingham <founder@kakste.com>2012-04-02 00:29:27 +0100
committerThomas Willingham <founder@kakste.com>2012-04-02 00:29:27 +0100
commit210586eaed18afc4d9ff613ee8f1ea0acdec621a (patch)
tree49c8e91f210815eeccd6925457664f39380f0a82 /include/conversation.php
parent8406803473773404b18b95c709da0b8f5da59d3c (diff)
parent23dc376364b7d8f8e27e3493fe3edbf5cf768a35 (diff)
downloadvolse-hubzilla-210586eaed18afc4d9ff613ee8f1ea0acdec621a.tar.gz
volse-hubzilla-210586eaed18afc4d9ff613ee8f1ea0acdec621a.tar.bz2
volse-hubzilla-210586eaed18afc4d9ff613ee8f1ea0acdec621a.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'include/conversation.php')
-rwxr-xr-xinclude/conversation.php63
1 files changed, 41 insertions, 22 deletions
diff --git a/include/conversation.php b/include/conversation.php
index 5de4fcb51..5a922b2b5 100755
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -94,9 +94,9 @@ function localize_item(&$item){
}
- $A = '[url=' . $Alink . ']' . $Aname . '[/url]';
- $B = '[url=' . $Blink . ']' . $Bname . '[/url]';
- if ($Bphoto!="") $Bphoto = '[url=' . $Blink . '][img]' . $Bphoto . '[/img][/url]';
+ $A = '[url=' . zrl($Alink) . ']' . $Aname . '[/url]';
+ $B = '[url=' . zrl($Blink) . ']' . $Bname . '[/url]';
+ if ($Bphoto!="") $Bphoto = '[url=' . zrl($Blink) . '][img]' . $Bphoto . '[/img][/url]';
$item['body'] = sprintf( t('%1$s is now friends with %2$s'), $A, $B)."\n\n\n".$Bphoto;
@@ -108,8 +108,8 @@ function localize_item(&$item){
if(count($r)==0) return;
$obj=$r[0];
- $author = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]';
- $objauthor = '[url=' . $obj['author-link'] . ']' . $obj['author-name'] . '[/url]';
+ $author = '[url=' . zrl($item['author-link']) . ']' . $item['author-name'] . '[/url]';
+ $objauthor = '[url=' . zrl($obj['author-link']) . ']' . $obj['author-name'] . '[/url]';
switch($obj['verb']){
case ACTIVITY_POST:
@@ -158,14 +158,21 @@ function localize_item(&$item){
$target = $r[0];
$Bname = $target['author-name'];
$Blink = $target['author-link'];
- $A = '[url=' . $Alink . ']' . $Aname . '[/url]';
- $B = '[url=' . $Blink . ']' . $Bname . '[/url]';
+ $A = '[url=' . zrl($Alink) . ']' . $Aname . '[/url]';
+ $B = '[url=' . zrl($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";
}
}
}
+ $matches = null;
+ if(preg_match_all('/@\[url=(.*?)\]/is',$item['body'],$matches,PREG_SET_ORDER)) {
+ foreach($matches as $mtch) {
+ if(! strpos($mtch[1],'zrl='))
+ $item['body'] = str_replace($mtch[0],'@[url=' . zrl($mtch[1]). ']',$item['body']);
+ }
+ }
}
@@ -243,7 +250,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
$threads = array();
$threadsid = -1;
- if(count($items)) {
+ if($items && count($items)) {
if($mode === 'network-new' || $mode === 'search' || $mode === 'community') {
@@ -276,13 +283,16 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
if($item['author-link'] && (! $item['author-name']))
$profile_name = $item['author-link'];
+
+
$sp = false;
$profile_link = best_link_url($item,$sp);
- if($sp)
- $sparkle = ' sparkle';
if($profile_link === 'mailbox')
$profile_link = '';
-
+ if($sp)
+ $sparkle = ' sparkle';
+ else
+ $profile_link = zrl($profile_link);
$normalised = normalise_link((strlen($item['author-link'])) ? $item['author-link'] : $item['url']);
if(($normalised != 'mailbox') && (x($a->contacts[$normalised])))
@@ -484,7 +494,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
// This will have been stored in $a->page_contact by our calling page.
// Put this person on the left of the wall-to-wall notice.
- $owner_url = $a->page_contact['url'];
+ $owner_url = zrl($a->page_contact['url']);
$owner_photo = $a->page_contact['thumb'];
$owner_name = $a->page_contact['name'];
$template = $wallwall;
@@ -501,10 +511,12 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
$commentww = 'ww';
// If it is our contact, use a friendly redirect link
if((link_compare($item['owner-link'],$item['url']))
- && ($item['network'] === 'dfrn')) {
+ && ($item['network'] === NETWORK_DFRN)) {
$owner_url = $redirect_url;
$osparkle = ' sparkle';
}
+ else
+ $owner_url = zrl($owner_url);
}
}
@@ -520,9 +532,12 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
if ($shareable) $likebuttons['share'] = array( t('Share this'), t('share'));
}
+ $qc = $qcomment = null;
- $qc = ((local_user()) ? get_pconfig(local_user(),'qcomment','words') : null);
- $qcomment = (($qc) ? explode("\n",$qc) : null);
+ if(in_array('qcomment',$a->plugins)) {
+ $qc = ((local_user()) ? get_pconfig(local_user(),'qcomment','words') : null);
+ $qcomment = (($qc) ? explode("\n",$qc) : null);
+ }
if(($show_comment_box) || (($show_comment_box == false) && ($override_comment_box == false) && ($item['last-child']))) {
$comment = replace_macros($cmnt_tpl,array(
@@ -580,7 +595,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
'classtagger' => "",
);
}
- $filer = t("file as");
+ $filer = t("save to folder");
}
@@ -596,14 +611,14 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
if($item['author-link'] && (! $item['author-name']))
$profile_name = $item['author-link'];
-
$sp = false;
$profile_link = best_link_url($item,$sp);
- if($sp)
- $sparkle = ' sparkle';
-
if($profile_link === 'mailbox')
$profile_link = '';
+ if($sp)
+ $sparkle = ' sparkle';
+ else
+ $profile_link = zrl($profile_link);
$normalised = normalise_link((strlen($item['author-link'])) ? $item['author-link'] : $item['url']);
if(($normalised != 'mailbox') && (x($a->contacts,$normalised)))
@@ -767,8 +782,10 @@ function item_photo_menu($item){
$photos_link = $profile_link . "?url=photos";
$profile_link = $profile_link . "?url=profile";
$pm_url = $a->get_baseurl($ssl_state) . '/message/new/' . $cid;
+ $zurl = '';
}
else {
+ $profile_link = zrl($profile_link);
if(local_user() && local_user() == $item['uid'] && link_compare($item['url'],$item['author-link'])) {
$cid = $item['contact-id'];
}
@@ -795,7 +812,7 @@ function item_photo_menu($item){
$menu = Array(
t("View status") => $status_link,
t("View profile") => $profile_link,
- t("View photos") => $photos_link,
+ t("View photos") => $photos_link,
t("View recent") => $posts_link,
t("Edit contact") => $contact_url,
t("Send PM") => $pm_url,
@@ -828,6 +845,8 @@ function like_puller($a,$item,&$arr,$mode) {
$url = $a->get_baseurl(true) . '/redir/' . $item['contact-id'];
$sparkle = ' class="sparkle" ';
}
+ else
+ $url = zrl($url);
if(! ((isset($arr[$item['parent'] . '-l'])) && (is_array($arr[$item['parent'] . '-l']))))
$arr[$item['parent'] . '-l'] = array();
if(! isset($arr[$item['parent']]))
@@ -896,7 +915,7 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
'$vidurl' => t("Please enter a video link/URL:"),
'$audurl' => t("Please enter an audio link/URL:"),
'$term' => t('Tag term:'),
- '$fileas' => t('File as:'),
+ '$fileas' => t('Save to Folder:'),
'$whereareu' => t('Where are you right now?')
));