diff --git a/ratioed/RatioedPanel.php b/ratioed/RatioedPanel.php index bd9b44dc..19f6dd44 100644 --- a/ratioed/RatioedPanel.php +++ b/ratioed/RatioedPanel.php @@ -24,7 +24,6 @@ class RatioedPanel extends Active return Renderer::replaceMacros($template, array('$config' => DI::baseUrl() . '/settings/addon')); } - $action = $this->parameters['action'] ?? ''; $uid = $this->parameters['uid'] ?? 0; $user = []; @@ -32,31 +31,10 @@ class RatioedPanel extends Active $user = User::getById($uid, ['username', 'blocked']); if (!$user) { $this->systemMessages->addNotice($this->t('User not found')); - $this->baseUrl->redirect('moderation/users'); + $this->baseUrl->redirect('ratioed'); } } - switch ($action) { - case 'delete': - if ($this->session->getLocalUserId() != $uid) { - self::checkFormSecurityTokenRedirectOnError('moderation/users/active', 'moderation_users_active', 't'); - // delete user - User::remove($uid); - - $this->systemMessages->addNotice($this->t('User "%s" deleted', $user['username'])); - } else { - $this->systemMessages->addNotice($this->t('You can\'t remove yourself')); - } - - $this->baseUrl->redirect('moderation/users/active'); - break; - case 'block': - self::checkFormSecurityTokenRedirectOnError('moderation/users/active', 'moderation_users_active', 't'); - User::block($uid); - $this->systemMessages->addNotice($this->t('User "%s" blocked', $user['username'])); - $this->baseUrl->redirect('moderation/users/active'); - break; - } $pager = new Pager($this->l10n, $this->args->getQueryString(), 100); $valid_orders = [ @@ -69,9 +47,9 @@ class RatioedPanel extends Active ]; $order = 'last-item'; - $order_direction = '-'; - if (!empty($request['o'])) { - $new_order = $request['o']; + $order_direction = '+'; + if (!empty($_REQUEST['o'])) { + $new_order = $_REQUEST['o']; if ($new_order[0] === '-') { $order_direction = '-'; $new_order = substr($new_order, 1); @@ -175,8 +153,10 @@ class RatioedPanel extends Active $user['ratioed'] = (float)($user['ratio']) >= 2.0; } else { + $user['reactions'] = 0; if ($user['comments'] == 0) { - $user['ratio'] = '0'; + $user['comments'] = 0; + $user['ratio'] = 0; $user['ratioed'] = false; } else { diff --git a/ratioed/ratioed.php b/ratioed/ratioed.php index 8ae0d48c..581ef89b 100644 --- a/ratioed/ratioed.php +++ b/ratioed/ratioed.php @@ -2,7 +2,7 @@ /** * Name: Ratioed * Description: Additional moderation user table with statistics about user behaviour - * Version: 0.1 + * Version: 0.2 * Author: Matthew Exon */ diff --git a/ratioed/templates/ratioed.tpl b/ratioed/templates/ratioed.tpl index 0d81b0d7..24ae20b8 100644 --- a/ratioed/templates/ratioed.tpl +++ b/ratioed/templates/ratioed.tpl @@ -2,26 +2,21 @@
-

{{$title}} - {{$page}} ({{$count}})

-

- {{$h_newuser}} -

+

+ {{$title}} - {{$page}} ({{$count}}) + +

- + {{foreach $th_users as $k=>$th}} - {{if $k < 2 || $order_users == $th.1 || ($k==5 && !in_array($order_users,[$th_users.2.1, $th_users.3.1, $th_users.4.1])) }} + {{if $k < 2 || $order_users == $th.1 || ($k==4 && !in_array($order_users,[$th_users.2.1, $th_users.3.1, $th_users.5.1])) }} {{foreach $users as $u}} - + @@ -63,11 +49,7 @@ {{/if}} - {{if $order_users == $th_users.4.1}} - - {{/if}} - - {{if !in_array($order_users,[$th_users.2.1, $th_users.3.1, $th_users.4.1]) }} + {{if $order_users == $th_users.5.1}} @@ -151,14 +137,6 @@ {{/foreach}}
-
- - -
-
- + {{if $order_users == $th.1}} {{if $order_direction_users == "+"}} ↓ @@ -42,16 +37,7 @@
- {{if $u.is_deletable}} -
- - -
- {{else}} -   - {{/if}} -
{{$u.name}} {{$u.email}}{{$u.login_date}}{{$u.lastitem_date}}
- {{$pager nofilter}}