aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Share.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2023-11-09 19:32:29 +0000
committerMario <mario@mariovavti.com>2023-11-09 19:32:29 +0000
commit85d8c1a97eec7fe40c6ea4b9ee895897d54a38c6 (patch)
treef4138164362d501f2713fd9a83d7d52e38c0e2ab /Zotlabs/Module/Share.php
parent547e6542ba7d396cc1c349577e2078fda098bee6 (diff)
downloadvolse-hubzilla-85d8c1a97eec7fe40c6ea4b9ee895897d54a38c6.tar.gz
volse-hubzilla-85d8c1a97eec7fe40c6ea4b9ee895897d54a38c6.tar.bz2
volse-hubzilla-85d8c1a97eec7fe40c6ea4b9ee895897d54a38c6.zip
some low level work on native repeats
Diffstat (limited to 'Zotlabs/Module/Share.php')
-rw-r--r--Zotlabs/Module/Share.php64
1 files changed, 35 insertions, 29 deletions
diff --git a/Zotlabs/Module/Share.php b/Zotlabs/Module/Share.php
index c0db9978e..716f7229b 100644
--- a/Zotlabs/Module/Share.php
+++ b/Zotlabs/Module/Share.php
@@ -14,47 +14,53 @@ require_once('include/bbcode.php');
class Share extends \Zotlabs\Web\Controller {
function init() {
-
- $post_id = ((argc() > 1) ? intval(argv(1)) : 0);
-
- if(! $post_id)
- killme();
-
- if(! local_channel()) {
+
+ if (!intval(argv(1))) {
killme();
}
- $observer = App::get_observer();
+ if (! local_channel()) {
+ killme();
+ }
+ $observer = App::get_observer();
$channel = App::get_channel();
+ $sys_channel = get_sys_channel();
$r = q("SELECT * from item left join xchan on author_xchan = xchan_hash WHERE id = %d LIMIT 1",
- intval($post_id)
+ intval(argv(1))
);
- if(! $r)
- killme();
-
+ if ($r[0]['uid'] === $sys_channel['channel_id']) {
+ $r = [copy_of_pubitem($channel, $r[0]['mid'])];
+ }
+
+ if(! $r) {
+ killme();
+ }
+ $item_id = $r[0]['id'];
- if(($r[0]['item_private']) && ($r[0]['xchan_network'] !== 'rss'))
+ if ($r[0]['item_private']) {
killme();
-
+ }
+
$sql_extra = item_permissions_sql($r[0]['uid']);
-
+
$r = q("select * from item where id = %d $sql_extra",
- intval($post_id)
+ intval($item_id)
);
+
if(! $r)
killme();
-
+
/** @FIXME we only share bbcode */
-
+
if($r[0]['mimetype'] !== 'text/bbcode')
killme();
-
- xchan_query($r);
-
+
+ xchan_query($r,true);
+
$arr = [];
$item = $r[0];
@@ -81,7 +87,7 @@ class Share extends \Zotlabs\Web\Controller {
$thread_owner = $r[0];
else
killme();
-
+
$r = q("select * from xchan where xchan_hash = '%s' limit 1",
dbesc($item['author_xchan'])
);
@@ -89,7 +95,7 @@ class Share extends \Zotlabs\Web\Controller {
$item_author = $r[0];
else
killme();
-
+
$arr['aid'] = $owner_aid;
$arr['uid'] = $owner_uid;
@@ -109,12 +115,12 @@ class Share extends \Zotlabs\Web\Controller {
$arr['obj_type'] = $item['obj_type'];
$arr['verb'] = ACTIVITY_SHARE;
- $post = item_store($arr);
+ $post = item_store($arr);
$post_id = $post['item_id'];
$arr['id'] = $post_id;
-
+
call_hooks('post_local_end', $arr);
info( t('Post repeated') . EOL);
@@ -128,10 +134,10 @@ class Share extends \Zotlabs\Web\Controller {
Libsync::build_sync_packet($channel['channel_id'], [ 'item' => [ encode_item($sync_item[0],true) ] ]);
}
- Master::Summon([ 'Notifier','like',$post_id ]);
-
+ Master::Summon([ 'Notifier', 'like', $post_id ]);
+
killme();
-
+
}
-
+
}