utilize more usermoderationmanager

This commit is contained in:
Austin 2021-11-27 06:03:06 -05:00
parent 4b666200c1
commit fd6924abb3
3 changed files with 6 additions and 17 deletions

View File

@ -12,6 +12,7 @@
use Alphaland\Users\Activation;
use Alphaland\Users\TwoFactor;
use Alphaland\Moderation\UserModerationManager;
try
{
@ -136,11 +137,10 @@ try
}
$activated = Activation::IsUserActivated($GLOBALS['user']->id);
$twofactor = TwoFactor::IsSession2FAUnlocked();
$banned = UserModerationManager::IsBanned($GLOBALS['user']->id);
$maintenance = checkIfUnderMaintenance();
$banned = checkIfBanned($GLOBALS['user']->id);
//step 1, check if under maintenance
if ($maintenance) { //maintenance redirect

View File

@ -6846,19 +6846,6 @@ function RCCHeaderEnvironment($nodie=false) //authenticates if the accesskey hea
return false;
}
function checkIfBanned($uid)
{
$checkban = $GLOBALS['pdo']->prepare("SELECT * FROM user_bans WHERE uid = :i AND valid = 1");
$checkban->bindParam(":i", $uid, PDO::PARAM_INT);
$checkban->execute();
if ($checkban->rowCount() > 0)
{
return true;
}
return false;
}
function isUnderMaintenance()
{
$checkMaintenance = $GLOBALS['pdo']->prepare("SELECT * FROM websettings WHERE maintenance = 1");

View File

@ -1,6 +1,8 @@
<?php
if (checkIfBanned($user->id))
use Alphaland\Moderation\UserModerationManager;
if (UserModerationManager::IsBanned($user->id))
{
$banInfo = $pdo->prepare("SELECT * FROM user_bans WHERE uid = :id AND valid = 1");
$banInfo->bindParam(":id", $user->id, PDO::PARAM_INT);
@ -105,5 +107,5 @@ if (checkIfBanned($user->id))
else
{
//not banned
redirect("/404");
redirect("/");
}