diff options
author | friendica <info@friendica.com> | 2014-04-10 18:06:09 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-04-10 18:06:09 -0700 |
commit | 9bb7811d741339404ea6b372363c805d41a84794 (patch) | |
tree | 350f0d8e086329a1d509a8797b0c09710a373e49 | |
parent | a49069db4e4c11c5aed147d59b86b5c01d797b3d (diff) | |
download | volse-hubzilla-9bb7811d741339404ea6b372363c805d41a84794.tar.gz volse-hubzilla-9bb7811d741339404ea6b372363c805d41a84794.tar.bz2 volse-hubzilla-9bb7811d741339404ea6b372363c805d41a84794.zip |
Discover page: when importing public items, alter the item so that it has the characteristics of one that was sourced by the sys channel instead of just being stored under the sys channel uid. This should allow comments and likes to flow upstream if permissions allow and may fix issue #398. Permission may still be denied by the original poster, but without this the comment/like is treated as a forgery and is blocked from transmission.
-rw-r--r-- | include/externals.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/externals.php b/include/externals.php index e7e9504a0..96644d68d 100644 --- a/include/externals.php +++ b/include/externals.php @@ -64,6 +64,25 @@ function externals_run($argv, $argc){ $results = process_delivery(array('hash' => 'undefined'), get_item_elements($message), array(array('hash' => $sys['xchan_hash'])), false, true); $total ++; + $z = q("select id from item where mid = '%s' and uid = %d limit 1", + dbesc($message['message_id']), + intval($sys['channel_id']) + ); + if($z) { + $flag_bits = ITEM_WALL|ITEM_ORIGIN|ITEM_UPLINK; + // preserve the source + + $r = q("update item set source_xchan = owner_xchan where id = %d limit 1", + intval($z[0]['id']) + ); + + $r = q("update item set item_flags = ( item_flags | %d ), owner_xchan = '%s' + where id = %d limit 1", + intval($flag_bits), + dbesc($sys['xchan_hash']), + intval($z[0]['id']) + ); + } } logger('externals: import_public_posts: ' . $total . ' messages imported', LOGGER_DEBUG); } |