aboutsummaryrefslogtreecommitdiffstats
path: root/mod/item.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-04-05 02:32:07 -0700
committerfriendica <info@friendica.com>2014-04-05 02:32:07 -0700
commit4901ef8faf743fd7fef97fc75a1c727804bf3df5 (patch)
treeed0c0f6450b81e9f4bcb1c1f2d3727653e4310f5 /mod/item.php
parent32e71cf06b7471923dec37b613da3a044f51f28d (diff)
downloadvolse-hubzilla-4901ef8faf743fd7fef97fc75a1c727804bf3df5.tar.gz
volse-hubzilla-4901ef8faf743fd7fef97fc75a1c727804bf3df5.tar.bz2
volse-hubzilla-4901ef8faf743fd7fef97fc75a1c727804bf3df5.zip
provide the ability for rpost to post as another of your channels. This does not yet work, so the functionality has not been enabled.
Diffstat (limited to 'mod/item.php')
-rw-r--r--mod/item.php41
1 files changed, 24 insertions, 17 deletions
diff --git a/mod/item.php b/mod/item.php
index c1feb5c96..86ed4fda8 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -169,6 +169,25 @@ function item_post(&$a) {
}
$observer = $a->get_observer();
+ $channel = null;
+
+ $dest_channel = ((array_key_exists('dest_channel',$_REQUEST) && intval($_REQUEST['dest_channel'])) ? intval($_REQUEST['dest_channel']) : 0);
+
+ if(local_user() && $dest_channel && $dest_channel != local_user()) {
+ // posting as another channel which you control
+ $account = $a->get_account();
+ $r = q("select * from channel left join account on channel_account_id = account_id where account_id = %d and channel_id = %d limit 1",
+ intval($account['account_id']),
+ intval($dest_channel)
+ );
+ if($r) {
+ $channel = $r[0];
+ $profile_uid = $dest_channel;
+ }
+ }
+
+
+
if($parent) {
logger('mod_item: item_post parent=' . $parent);
@@ -219,34 +238,22 @@ function item_post(&$a) {
$orig_post = $i[0];
}
- $channel = null;
- if(local_user() && local_user() == $profile_uid) {
- $channel = $a->get_channel();
- }
- else {
- $dest_channel = ((array_key_exists('dest_channel',$_REQUEST) && intval($_REQUEST['dest_channel'])) ? intval($_REQUEST['dest_channel']) : 0);
-
- if(local_user() && $dest_channel) {
- // posting as another channel which you control
- $account = $a->get_account();
- $r = q("select * from channel left join account on channel_account_id = account_id where account_d = %d and channel_id = %d limit 1",
- intval($account['account_id']),
- intval($dest_channel)
- );
- if($r)
- $channel = $r[0];
+ if(! $channel) {
+ if(local_user() && local_user() == $profile_uid) {
+ $channel = $a->get_channel();
}
else {
// posting as yourself but not necessarily to a channel you control
$r = q("select * from channel left join account on channel_account_id = account_id where channel_id = %d LIMIT 1",
intval($profile_uid)
);
- if(count($r))
+ if($r)
$channel = $r[0];
}
}
+
if(! $channel) {
logger("mod_item: no channel.");
if(x($_REQUEST,'return'))