usermoderationmanager logaction

This commit is contained in:
Astrologies 2021-12-01 21:08:35 -05:00
parent cfc7148b51
commit 7d51370742
5 changed files with 22 additions and 18 deletions

View File

@ -2,11 +2,21 @@
namespace Alphaland\Moderation {
use Alphaland\Users\User;
use Alphaland\Web\WebContextManager;
use PDO;
class UserModerationManager
{
public static function LogAction(string $action)
{
$localuser = $GLOBALS['user']->id;
$log = $GLOBALS['pdo']->prepare('INSERT INTO staff_actions(userid, action, whenOccurred) VALUES (:uid, :action, UNIX_TIMESTAMP())');
$log->bindParam(':uid', $localuser, PDO::PARAM_INT);
$log->bindParam(':action', $action, PDO::PARAM_STR);
$log->execute();
}
public static function IsBanned(int $userId)
{
$query = $GLOBALS['pdo']->prepare("SELECT * FROM `user_bans` WHERE `uid` = :i AND `valid` = 1");
@ -26,7 +36,7 @@ namespace Alphaland\Moderation {
$unban->bindParam(":u", $uid, PDO::PARAM_INT);
$unban->execute();
if ($unban->rowCount() > 0) {
logStaffAction("Unbanned User ".$uid);
UserModerationManager::LogAction("Unbanned User ".$uid);
return true;
}
}
@ -54,7 +64,7 @@ namespace Alphaland\Moderation {
$ban->execute();
if ($ban->rowCount() > 0) {
kickUserIfInGame($uid, "You've been banned from Alphaland, '".$reason."'");
logStaffAction("Banned User ".$uid);
UserModerationManager::LogAction("Banned User ".$uid);
//ban user from discord with bot
if($bantype == 2) { //perm ban

View File

@ -6832,14 +6832,4 @@ function isIPAssociatedWithAccount($ip)
return false;
}
function logStaffAction($action)
{
$localuser = $GLOBALS['user']->id;
$log = $GLOBALS['pdo']->prepare('INSERT INTO staff_actions(userid, action, whenOccurred) VALUES (:uid, :action, UNIX_TIMESTAMP())');
$log->bindParam(':uid', $localuser, PDO::PARAM_INT);
$log->bindParam(':action', $action, PDO::PARAM_STR);
$log->execute();
}
//end utility }

View File

@ -7,6 +7,7 @@ Alphaland 2021
//headers
use Alphaland\Moderation\UserModerationManager;
use Alphaland\Web\WebContextManager;
header("Access-Control-Allow-Origin: https://www.alphaland.cc");
@ -29,7 +30,7 @@ else
if (isThumbnailerAlive()) {
$approve = approveAsset($assetid);
if ($approve === true) {
logStaffAction("Approved Asset ".$assetid);
UserModerationManager::LogAction("Approved Asset ".$assetid);
$approve = "Approved Asset";
}
} else {

View File

@ -7,6 +7,7 @@ Alphaland 2021
//headers
use Alphaland\Moderation\UserModerationManager;
use Alphaland\Web\WebContextManager;
header("Access-Control-Allow-Origin: https://www.alphaland.cc");
@ -28,7 +29,7 @@ else
{
$moderate = moderateAsset($assetid);
if ($moderate === true) {
logStaffAction("Moderated Asset ".$assetid);
UserModerationManager::LogAction("Moderated Asset ".$assetid);
$moderate = "Moderated Asset";
}
header('Content-Type: application/json');

View File

@ -1,5 +1,7 @@
<?php
use Alphaland\Moderation\UserModerationManager;
use Alphaland\Users\User;
use Alphaland\Web\WebContextManager;
$body = '';
@ -104,7 +106,7 @@ if(isset($_GET['id']))
{
if ($user->isStaff())
{
logStaffAction("Configure Item ".$id);
UserModerationManager::LogAction("Configure Item ".$id);
}
//update item name
@ -132,7 +134,7 @@ if(isset($_GET['id']))
{
if ($user->isStaff())
{
logStaffAction("Configure Item Onsale ".$id);
UserModerationManager::LogAction("Configure Item Onsale ".$id);
}
//update onsale
@ -145,7 +147,7 @@ if(isset($_GET['id']))
}
else
{
logStaffAction("Configure Item Offsale ".$id);
UserModerationManager::LogAction("Configure Item Offsale ".$id);
//update onsale
$onsale = 0;
@ -166,7 +168,7 @@ if(isset($_GET['id']))
$script = "";
$scripttype = "";
logStaffAction("Render Item ".$id);
UserModerationManager::LogAction("Render Item ".$id);
if ($itemtypeint == 8)
{
//Hat