move sudo to addons

This commit is contained in:
zotlabs 2020-02-25 16:30:12 -08:00
parent 3be7f6fe08
commit ac87b4fc2b
4 changed files with 20 additions and 42 deletions

View file

@ -50,3 +50,6 @@ Announce
Announce and relay activities are supported on the inbound side but are not generated. Instead a new message is generated with an embedded rendering of the shared content as the message content. This message may (should) contain additional commentary in order to comply with the Fair Use provisions of copyright law.
Mastodon Custom Emojis
Mastodon Custom Emojis are only supported for post content. Display names and message titles are considered text only fields and embedded images (the mechanism behind custom emojis) are not supported in these locations.

View file

@ -2,12 +2,14 @@
namespace Zotlabs\Module\Admin;
use App;
use Zotlabs\Daemon\Master;
/**
* @brief Admin Module for Channels.
*
*/
class Channels {
/**
@ -118,13 +120,13 @@ class Channels {
$total = q("SELECT count(*) as total FROM channel where channel_removed = 0 and channel_system = 0");
if($total) {
\App::set_pager_total($total[0]['total']);
\App::set_pager_itemspage(100);
App::set_pager_total($total[0]['total']);
App::set_pager_itemspage(100);
}
$channels = q("SELECT * from channel where channel_removed = 0 and channel_system = 0 order by $key $dir limit %d offset %d ",
intval(\App::$pager['itemspage']),
intval(\App::$pager['start'])
intval(App::$pager['itemspage']),
intval(App::$pager['start'])
);
if($channels) {
@ -138,11 +140,18 @@ class Channels {
$channels[$x]['allowcode'] = true;
else
$channels[$x]['allowcode'] = false;
$channels[$x]['channel_link'] = z_root() . '/channel/' . $channels[$x]['channel_address'];
}
}
$t = get_markup_template('admin_channels.tpl');
$o = replace_macros($t, array(
logger('channels1: ' . print_r($channels,true));
call_hooks('admin_channels',$channels);
logger('channels2: ' . print_r($channels,true));
$o = replace_macros(get_markup_template('admin_channels.tpl'), [
// strings //
'$title' => t('Administration'),
'$page' => t('Channels'),
@ -169,7 +178,7 @@ class Channels {
// values //
'$baseurl' => z_root(),
'$channels' => $channels,
));
]);
$o .= paginate($a);
return $o;

View file

@ -1,34 +0,0 @@
<?php
namespace Zotlabs\Module;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Config;
class Sudo extends Controller {
function init() {
if ((argc() < 2) || (! intval(Config::Get('system','allow_sudo')))) {
http_status_exit(404,'Not found');
}
if (! is_site_admin()) {
http_status_exit(403,'Permission denied');
}
$c = channelx_by_nick(argv(1));
if ($c) {
$tmp = $_SESSION;
$_SESSION['delegate_push'] = $tmp;
$_SESSION['delegate_channel'] = $c['channel_id'];
$_SESSION['delegate'] = get_observer_hash();
$_SESSION['account_id'] = intval($c['channel_account_id']);
$_SESSION['sudo'] = 1;
change_channel($c['channel_id']);
goaway(z_root());
}
}
}

View file

@ -30,7 +30,7 @@
{{foreach $channels as $c}}
<tr>
<td class='channel_id'>{{$c.channel_id}}</td>
<td class='channel_name'><a href="channel/{{$c.channel_address}}">{{$c.channel_name}}</a></td>
<td class='channel_name'><a href="{{$c.channel_link}}">{{$c.channel_name}}</a></td>
<td class='channel_address'>{{$c.channel_address}}</td>
<td class="checkbox_bulkedit"><input type="checkbox" class="channels_ckbx" id="id_channel_{{$c.channel_id}}" name="channel[]" value="{{$c.channel_id}}"/></td>
<td class="tools">