utilize more usermoderationmanager
This commit is contained in:
parent
4b666200c1
commit
fd6924abb3
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
use Alphaland\Users\Activation;
|
use Alphaland\Users\Activation;
|
||||||
use Alphaland\Users\TwoFactor;
|
use Alphaland\Users\TwoFactor;
|
||||||
|
use Alphaland\Moderation\UserModerationManager;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -136,11 +137,10 @@ try
|
||||||
}
|
}
|
||||||
|
|
||||||
$activated = Activation::IsUserActivated($GLOBALS['user']->id);
|
$activated = Activation::IsUserActivated($GLOBALS['user']->id);
|
||||||
|
|
||||||
$twofactor = TwoFactor::IsSession2FAUnlocked();
|
$twofactor = TwoFactor::IsSession2FAUnlocked();
|
||||||
|
$banned = UserModerationManager::IsBanned($GLOBALS['user']->id);
|
||||||
|
|
||||||
$maintenance = checkIfUnderMaintenance();
|
$maintenance = checkIfUnderMaintenance();
|
||||||
$banned = checkIfBanned($GLOBALS['user']->id);
|
|
||||||
|
|
||||||
//step 1, check if under maintenance
|
//step 1, check if under maintenance
|
||||||
if ($maintenance) { //maintenance redirect
|
if ($maintenance) { //maintenance redirect
|
||||||
|
|
|
||||||
|
|
@ -6846,19 +6846,6 @@ function RCCHeaderEnvironment($nodie=false) //authenticates if the accesskey hea
|
||||||
return false;
|
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()
|
function isUnderMaintenance()
|
||||||
{
|
{
|
||||||
$checkMaintenance = $GLOBALS['pdo']->prepare("SELECT * FROM websettings WHERE maintenance = 1");
|
$checkMaintenance = $GLOBALS['pdo']->prepare("SELECT * FROM websettings WHERE maintenance = 1");
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
<?php
|
<?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 = $pdo->prepare("SELECT * FROM user_bans WHERE uid = :id AND valid = 1");
|
||||||
$banInfo->bindParam(":id", $user->id, PDO::PARAM_INT);
|
$banInfo->bindParam(":id", $user->id, PDO::PARAM_INT);
|
||||||
|
|
@ -105,5 +107,5 @@ if (checkIfBanned($user->id))
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//not banned
|
//not banned
|
||||||
redirect("/404");
|
redirect("/");
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue