provide the ability for rpost to post as another of your channels. This does not yet work, so the functionality has not been enabled.
This commit is contained in:
parent
32e71cf06b
commit
4901ef8faf
@ -1052,6 +1052,13 @@ function status_editor($a,$x,$popup=false) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(array_key_exists('channel_select',$x) && $x['channel_select']) {
|
||||||
|
require_once('include/identity.php');
|
||||||
|
$id_select = identity_selector();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$id_select = '';
|
||||||
|
|
||||||
|
|
||||||
$webpage = ((x($x,'webpage')) ? $x['webpage'] : '');
|
$webpage = ((x($x,'webpage')) ? $x['webpage'] : '');
|
||||||
|
|
||||||
@ -1098,6 +1105,8 @@ function status_editor($a,$x,$popup=false) {
|
|||||||
'$webpage' => $webpage,
|
'$webpage' => $webpage,
|
||||||
'$placeholdpagetitle' => ((x($x,'ptlabel')) ? $x['ptlabel'] : t('Page link title')),
|
'$placeholdpagetitle' => ((x($x,'ptlabel')) ? $x['ptlabel'] : t('Page link title')),
|
||||||
'$pagetitle' => (x($x,'pagetitle') ? $x['pagetitle'] : ''),
|
'$pagetitle' => (x($x,'pagetitle') ? $x['pagetitle'] : ''),
|
||||||
|
'$id_select' => $id_select,
|
||||||
|
'$id_seltext' => t('Post as'),
|
||||||
'$upload' => t('Upload photo'),
|
'$upload' => t('Upload photo'),
|
||||||
'$shortupload' => t('upload photo'),
|
'$shortupload' => t('upload photo'),
|
||||||
'$attach' => t('Attach file'),
|
'$attach' => t('Attach file'),
|
||||||
|
@ -1257,3 +1257,24 @@ function get_channel_by_nick($nick) {
|
|||||||
return(($r) ? $r[0] : false);
|
return(($r) ? $r[0] : false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function identity_selector() {
|
||||||
|
if(local_user()) {
|
||||||
|
$r = q("select channel.*, xchan.* from channel left join xchan on channel.channel_hash = xchan.xchan_hash where channel.channel_account_id = %d and not ( channel_pageflags & %d ) order by channel_name ",
|
||||||
|
intval(get_account_id()),
|
||||||
|
intval(PAGE_REMOVED)
|
||||||
|
);
|
||||||
|
if(count($r) > 1) {
|
||||||
|
$selected_channel = null;
|
||||||
|
$account = get_app()->get_account();
|
||||||
|
$o = replace_macros(get_markup_template('channel_id_select.tpl'),array(
|
||||||
|
'$channels' => $r,
|
||||||
|
'$selected' => local_user()
|
||||||
|
));
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
}
|
41
mod/item.php
41
mod/item.php
@ -169,6 +169,25 @@ function item_post(&$a) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$observer = $a->get_observer();
|
$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) {
|
if($parent) {
|
||||||
logger('mod_item: item_post parent=' . $parent);
|
logger('mod_item: item_post parent=' . $parent);
|
||||||
@ -219,34 +238,22 @@ function item_post(&$a) {
|
|||||||
$orig_post = $i[0];
|
$orig_post = $i[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
$channel = null;
|
|
||||||
|
|
||||||
if(local_user() && local_user() == $profile_uid) {
|
if(! $channel) {
|
||||||
$channel = $a->get_channel();
|
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];
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// posting as yourself but not necessarily to a channel you control
|
// 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",
|
$r = q("select * from channel left join account on channel_account_id = account_id where channel_id = %d LIMIT 1",
|
||||||
intval($profile_uid)
|
intval($profile_uid)
|
||||||
);
|
);
|
||||||
if(count($r))
|
if($r)
|
||||||
$channel = $r[0];
|
$channel = $r[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(! $channel) {
|
if(! $channel) {
|
||||||
logger("mod_item: no channel.");
|
logger("mod_item: no channel.");
|
||||||
if(x($_REQUEST,'return'))
|
if(x($_REQUEST,'return'))
|
||||||
|
@ -106,6 +106,7 @@ function rpost_content(&$a) {
|
|||||||
|| $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
|
|| $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
|
||||||
'acl' => populate_acl($channel, $false),
|
'acl' => populate_acl($channel, $false),
|
||||||
'bang' => '',
|
'bang' => '',
|
||||||
|
// 'channel_select' => true,
|
||||||
'visitor' => 'block',
|
'visitor' => 'block',
|
||||||
'profile_uid' => local_user(),
|
'profile_uid' => local_user(),
|
||||||
'title' => $_REQUEST['title'],
|
'title' => $_REQUEST['title'],
|
||||||
|
@ -1 +1 @@
|
|||||||
2014-04-04.637
|
2014-04-05.638
|
||||||
|
7
view/tpl/channel_id_select.tpl
Normal file
7
view/tpl/channel_id_select.tpl
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{{if $channels}}
|
||||||
|
<select name="dest_channel" id="dest-channel-select">
|
||||||
|
{{foreach $channels as $c}}
|
||||||
|
<option {{if $c.channel_id == $selected}}selected="selected"{{/if}} value="{{$c.channel_id}}">{{$c.channel_name}}</option>
|
||||||
|
{{/foreach}}
|
||||||
|
</select>
|
||||||
|
{{/if}}
|
@ -13,7 +13,11 @@
|
|||||||
<input type="hidden" name="preview" id="jot-preview" value="0" />
|
<input type="hidden" name="preview" id="jot-preview" value="0" />
|
||||||
{{$mimeselect}}
|
{{$mimeselect}}
|
||||||
{{$layoutselect}}
|
{{$layoutselect}}
|
||||||
|
{{if $id_select}}
|
||||||
|
<div class="channel-id-select-div">
|
||||||
|
<span class="channel-id-select-desc">{{$id_seltext}}</span> {{$id_select}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
<div id="jot-title-wrap">
|
<div id="jot-title-wrap">
|
||||||
<input name="title" id="jot-title" type="text" placeholder="{{$placeholdertitle}}" value="{{$title}}" class="jothidden" style="display:none">
|
<input name="title" id="jot-title" type="text" placeholder="{{$placeholdertitle}}" value="{{$title}}" class="jothidden" style="display:none">
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user