[hellban] merge with user ext
This commit is contained in:
parent
4c1ceb5b02
commit
cff163591c
3 changed files with 6 additions and 44 deletions
|
@ -1,19 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Shimmie2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Name: [Beta] Hellban
|
|
||||||
*/
|
|
||||||
|
|
||||||
class HellBanInfo extends ExtensionInfo
|
|
||||||
{
|
|
||||||
public const KEY = "hellban";
|
|
||||||
|
|
||||||
public string $key = self::KEY;
|
|
||||||
public string $name = "Hellban";
|
|
||||||
public bool $beta = true;
|
|
||||||
public string $description = "Make some users only visible to themselves";
|
|
||||||
}
|
|
|
@ -1,25 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Shimmie2;
|
|
||||||
|
|
||||||
class HellBan extends Extension
|
|
||||||
{
|
|
||||||
public function onPageRequest(PageRequestEvent $event)
|
|
||||||
{
|
|
||||||
global $page, $user;
|
|
||||||
|
|
||||||
if ($user->can(Permissions::HELLBANNED)) {
|
|
||||||
$s = "";
|
|
||||||
} elseif ($user->can(Permissions::VIEW_HELLBANNED)) {
|
|
||||||
$s = "DIV.hb, TR.hb TD {border: 1px solid red !important;}";
|
|
||||||
} else {
|
|
||||||
$s = ".hb {display: none !important;}";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($s) {
|
|
||||||
$page->add_html_header("<style>$s</style>");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -164,6 +164,12 @@ class UserPage extends Extension
|
||||||
|
|
||||||
$this->show_user_info();
|
$this->show_user_info();
|
||||||
|
|
||||||
|
if ($user->can(Permissions::VIEW_HELLBANNED)) {
|
||||||
|
$page->add_html_header("<style>DIV.hb, TR.hb TD {border: 1px solid red !important;}</style>");
|
||||||
|
} else if(!$user->can(Permissions::HELLBANNED)) {
|
||||||
|
$page->add_html_header("<style>.hb {display: none !important;}</style>");
|
||||||
|
}
|
||||||
|
|
||||||
if ($event->page_matches("user_admin")) {
|
if ($event->page_matches("user_admin")) {
|
||||||
if ($event->get_arg(0) == "login") {
|
if ($event->get_arg(0) == "login") {
|
||||||
if (isset($_POST['user']) && isset($_POST['pass'])) {
|
if (isset($_POST['user']) && isset($_POST['pass'])) {
|
||||||
|
|
Reference in a new issue