utilize more usermoderationmanager
This commit is contained in:
parent
4b666200c1
commit
fd6924abb3
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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("/");
|
||||
}
|
||||
Loading…
Reference in New Issue