aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorpafcu <pafcu@iki.fi>2014-10-21 00:02:08 +0300
committerpafcu <pafcu@iki.fi>2014-10-21 00:02:08 +0300
commit6fbd77069b8792b48cfbd45bd476b8acb5f98ed6 (patch)
tree7f1303769398dc0862a2941e64e7a42e4e39d10d /include
parent6ee514579f85927e60fa5ebd2b89f97cbfe6544d (diff)
parentc080c420ba4e9f216708b63fdddb5c03bbea72c9 (diff)
downloadvolse-hubzilla-6fbd77069b8792b48cfbd45bd476b8acb5f98ed6.tar.gz
volse-hubzilla-6fbd77069b8792b48cfbd45bd476b8acb5f98ed6.tar.bz2
volse-hubzilla-6fbd77069b8792b48cfbd45bd476b8acb5f98ed6.zip
Merge pull request #2 from friendica/master
Sync with upstream
Diffstat (limited to 'include')
-rw-r--r--include/ItemObject.php4
-rw-r--r--include/bb2diaspora.php13
-rw-r--r--include/conversation.php6
-rw-r--r--include/html2bbcode.php3
-rw-r--r--include/nav.php2
-rw-r--r--include/poller.php17
-rw-r--r--include/zot.php8
7 files changed, 42 insertions, 11 deletions
diff --git a/include/ItemObject.php b/include/ItemObject.php
index 7c75e35bd..90c036def 100644
--- a/include/ItemObject.php
+++ b/include/ItemObject.php
@@ -191,7 +191,8 @@ class Item extends BaseObject {
}
- $verified = (($item['item_flags'] & ITEM_VERIFIED) ? t('Message is verified') : '');
+ $verified = (($item['item_flags'] & ITEM_VERIFIED) ? t('Message signature validated') : '');
+ $forged = ((($item['sig']) && (! ($item['item_flags'] & ITEM_VERIFIED))) ? t('Message signature incorrect') : '');
$unverified = '' ; // (($this->is_wall_to_wall() && (! ($item['item_flags'] & ITEM_VERIFIED))) ? t('Message cannot be verified') : '');
@@ -269,6 +270,7 @@ class Item extends BaseObject {
'lock' => $lock,
'verified' => $verified,
'unverified' => $unverified,
+ 'forged' => $forged,
'location' => $location,
'indent' => $indent,
'owner_url' => $this->get_owner_url(),
diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php
index 76708143b..9a87de5b2 100644
--- a/include/bb2diaspora.php
+++ b/include/bb2diaspora.php
@@ -286,6 +286,19 @@ function bb2diaspora_itemwallwall(&$item) {
. '[url=' . $item['author']['xchan_url'] . ']' . $item['author']['xchan_name'] . '[/url]' . "\n\n"
. $item['body'];
}
+
+ // We have to do something similar for wall-to-wall comments. ITEM_WALL|ITEM_ORIGIN indicates that it was posted on this site.
+ // Regular matrix comments may have one of these bits set, but not both.
+
+ if(($item['mid'] != $item['parent_mid']) && ($item['author_xchan'] != $item['owner_xchan']) && ($item['item_flags'] & (ITEM_WALL|ITEM_ORIGIN)) && (is_array($item['author'])) && $item['author']['xchan_url'] && $item['author']['xchan_name'] && $item['author']['xchan_photo_m']) {
+ logger('bb2diaspora_itemwallwall: wall to wall comment',LOGGER_DEBUG);
+ // post will come across with the owner's identity. Throw a preamble onto the post to indicate the true author.
+ $item['body'] = "\n\n"
+ . '[img]' . $item['author']['xchan_photo_m'] . '[/img]'
+ . '[url=' . $item['author']['xchan_url'] . ']' . $item['author']['xchan_name'] . '[/url]' . "\n\n"
+ . $item['body'];
+ }
+
// $item['author'] might cause a surprise further down the line if it wasn't expected to be here.
if(! $author_exists)
diff --git a/include/conversation.php b/include/conversation.php
index 92ba18d13..b22b570a1 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -649,7 +649,10 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
$likebuttons = false;
$shareable = false;
- $verified = (($item['item_flags'] & ITEM_VERIFIED) ? t('Message is verified') : '');
+ $verified = (($item['item_flags'] & ITEM_VERIFIED) ? t('Message signature validated') : '');
+ $forged = ((($item['sig']) && (! ($item['item_flags'] & ITEM_VERIFIED))) ? t('Message signature incorrect') : '');
+
+
$unverified = '';
@@ -682,6 +685,7 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
'mentions' => $mentions,
'verified' => $verified,
'unverified' => $unverified,
+ 'forged' => $forged,
'txt_cats' => t('Categories:'),
'txt_folders' => t('Filed under:'),
'has_cats' => ((count($categories)) ? 'true' : ''),
diff --git a/include/html2bbcode.php b/include/html2bbcode.php
index df430e6c7..6d6e6333b 100644
--- a/include/html2bbcode.php
+++ b/include/html2bbcode.php
@@ -283,8 +283,9 @@ function html2bbcode($message)
array('[b]', '[/b]', '[i]', '[/i]'), $message);
// Handling Yahoo style of mails
- $message = str_replace('[hr][b]From:[/b]', '[quote][b]From:[/b]', $message);
+ // $message = str_replace('[hr][b]From:[/b]', '[quote][b]From:[/b]', $message);
+ $message = htmlspecialchars($message,ENT_COMPAT,'UTF-8',false);
return(trim($message));
}
diff --git a/include/nav.php b/include/nav.php
index ba817648b..f1f89db20 100644
--- a/include/nav.php
+++ b/include/nav.php
@@ -142,7 +142,7 @@ EOT;
sprintf( t('%s - click to logout'), $observer['xchan_addr']));
}
else {
- $nav['loginmenu'][] = Array('rmagic',t('Remote login'),'',t('Click to authenticate to your home hub'));
+ $nav['loginmenu'][] = Array('rmagic',t('Remote authentication'),'',t('Click to authenticate to your home hub'));
}
/**
diff --git a/include/poller.php b/include/poller.php
index 2febaeb32..61298b0ab 100644
--- a/include/poller.php
+++ b/include/poller.php
@@ -254,7 +254,7 @@ function poller_run($argv, $argc){
);
- $contacts = q("SELECT abook_id, abook_flags, abook_updated, abook_connected, abook_closeness, abook_channel
+ $contacts = q("SELECT abook_id, abook_flags, abook_updated, abook_connected, abook_closeness, abook_xchan, abook_channel
FROM abook LEFT JOIN account on abook_account = account_id where 1
$sql_extra
AND (( abook_flags & %d ) OR ( abook_flags = %d ))
@@ -310,12 +310,17 @@ function poller_run($argv, $argc){
// He's dead, Jim
if(strcmp(datetime_convert('UTC','UTC', 'now'),datetime_convert('UTC','UTC', $c . " + 30 day")) > 0) {
- $r = q("update abook set abook_flags = (abook_flags | %d) where abook_id = %d limit 1",
- intval(ABOOK_FLAG_ARCHIVED),
- intval($contact['abook_id'])
+ $n = q("select xchan_network from xchan where xchan_hash = '%s' limit 1",
+ dbesc($contact['abook_xchan'])
);
- $update = false;
- continue;
+ if($n && $n[0]['xchan_network'] == 'zot') {
+ $r = q("update abook set abook_flags = (abook_flags | %d) where abook_id = %d limit 1",
+ intval(ABOOK_FLAG_ARCHIVED),
+ intval($contact['abook_id'])
+ );
+ $update = false;
+ continue;
+ }
}
if($contact['abook_flags'] & ABOOK_FLAG_ARCHIVED) {
diff --git a/include/zot.php b/include/zot.php
index 869bca668..e96eae10d 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -1476,11 +1476,13 @@ function process_delivery($sender,$arr,$deliveries,$relay,$public = false) {
continue;
}
- $r = q("select id, edited from item where mid = '%s' and uid = %d limit 1",
+ $r = q("select id, edited, item_flags, mid, parent_mid from item where mid = '%s' and uid = %d limit 1",
dbesc($arr['mid']),
intval($channel['channel_id'])
);
if($r) {
+ // We already have this post.
+ // Maybe it has been edited?
$item_id = $r[0]['id'];
if($arr['edited'] > $r[0]['edited']) {
$arr['id'] = $r[0]['id'];
@@ -1492,6 +1494,10 @@ function process_delivery($sender,$arr,$deliveries,$relay,$public = false) {
}
else {
$result[] = array($d['hash'],'update ignored',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']);
+ // We need this line to ensure wall-to-wall comments are relayed (by falling through to the relay bit),
+ // and at the same time not relay any other relayable posts more than once, because to do so is very wasteful.
+ if(! ($r[0]['item_flags'] & ITEM_ORIGIN))
+ continue;
}
}
else {