User dep impl update
This commit is contained in:
parent
ece63ed1cf
commit
a671625523
|
|
@ -12,7 +12,7 @@ namespace Alphaland\Users
|
||||||
use Alphaland\Web\WebContextManager;
|
use Alphaland\Web\WebContextManager;
|
||||||
use PDO;
|
use PDO;
|
||||||
|
|
||||||
class user
|
class User
|
||||||
{
|
{
|
||||||
public $id = -1;
|
public $id = -1;
|
||||||
public $name = "";
|
public $name = "";
|
||||||
|
|
@ -24,27 +24,27 @@ namespace Alphaland\Users
|
||||||
|
|
||||||
private const SecondsInDays = 86400;
|
private const SecondsInDays = 86400;
|
||||||
|
|
||||||
function __construct() {
|
public function __construct() {
|
||||||
if(isset($_COOKIE['token'])) {
|
if(isset($_COOKIE['token'])) {
|
||||||
$this->ValidateSession($_COOKIE['token']);
|
$this->ValidateSession($_COOKIE['token']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function isOwner() {
|
public function IsOwner() {
|
||||||
if ($this->rank == 3) {
|
if ($this->rank == 3) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isAdmin() {
|
public function IsAdmin() {
|
||||||
if($this->rank == 2 || $this->rank == 3) {
|
if($this->rank == 2 || $this->rank == 3) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isStaff() {
|
public function IsStaff() {
|
||||||
if($this->rank == 1 || $this->rank == 2 || $this->rank == 3) {
|
if($this->rank == 1 || $this->rank == 2 || $this->rank == 3) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -119,7 +119,7 @@ namespace Alphaland\Users
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function logout()
|
public function Logout()
|
||||||
{
|
{
|
||||||
if($this->logged_in) {
|
if($this->logged_in) {
|
||||||
$logout = $GLOBALS['pdo']->prepare("DELETE FROM sessions WHERE id = :id");
|
$logout = $GLOBALS['pdo']->prepare("DELETE FROM sessions WHERE id = :id");
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ namespace Alphaland\Web {
|
||||||
|
|
||||||
public static function CanBypassMaintenance()
|
public static function CanBypassMaintenance()
|
||||||
{
|
{
|
||||||
return $GLOBALS['user']->isStaff() || WebContextManager::IsCurrentIpAddressWhitelisted();
|
return $GLOBALS['user']->IsStaff() || WebContextManager::IsCurrentIpAddressWhitelisted();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function IsUnderMaintenance(bool $status = false)
|
public static function IsUnderMaintenance(bool $status = false)
|
||||||
|
|
|
||||||
|
|
@ -978,7 +978,7 @@ function userGroupsCount()
|
||||||
|
|
||||||
function createGroup($name, $description, $approval, $base64emblem)
|
function createGroup($name, $description, $approval, $base64emblem)
|
||||||
{
|
{
|
||||||
if (userGroupsCount() == 6 && !$GLOBALS['user']->isAdmin())
|
if (userGroupsCount() == 6 && !$GLOBALS['user']->IsAdmin())
|
||||||
{
|
{
|
||||||
return "Limited to 6 groups per player";
|
return "Limited to 6 groups per player";
|
||||||
}
|
}
|
||||||
|
|
@ -1728,7 +1728,7 @@ function isGroupOwner($groupid)
|
||||||
$owner->bindParam(":gid", $groupid, PDO::PARAM_INT);
|
$owner->bindParam(":gid", $groupid, PDO::PARAM_INT);
|
||||||
$owner->bindParam(":cid", $localplayer, PDO::PARAM_INT);
|
$owner->bindParam(":cid", $localplayer, PDO::PARAM_INT);
|
||||||
$owner->execute();
|
$owner->execute();
|
||||||
if ($owner->rowCount() > 0 || $GLOBALS['user']->isAdmin())
|
if ($owner->rowCount() > 0 || $GLOBALS['user']->IsAdmin())
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1815,7 +1815,7 @@ function wallViewPermission($groupid)
|
||||||
{
|
{
|
||||||
$role = groupRoleInfo($groupid, groupMemberInfo($groupid, $localplayer)->rank);
|
$role = groupRoleInfo($groupid, groupMemberInfo($groupid, $localplayer)->rank);
|
||||||
|
|
||||||
if ($role->AccessGroupWall == 1 || $GLOBALS['user']->isAdmin())
|
if ($role->AccessGroupWall == 1 || $GLOBALS['user']->IsAdmin())
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1831,7 +1831,7 @@ function wallPostPermission($groupid)
|
||||||
{
|
{
|
||||||
$role = groupRoleInfo($groupid, groupMemberInfo($groupid, $localplayer)->rank);
|
$role = groupRoleInfo($groupid, groupMemberInfo($groupid, $localplayer)->rank);
|
||||||
|
|
||||||
if ($role->PostGroupWall == 1 || $GLOBALS['user']->isAdmin())
|
if ($role->PostGroupWall == 1 || $GLOBALS['user']->IsAdmin())
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1847,7 +1847,7 @@ function wallDeletePermission($groupid)
|
||||||
{
|
{
|
||||||
$role = groupRoleInfo($groupid, groupMemberInfo($groupid, $localplayer)->rank);
|
$role = groupRoleInfo($groupid, groupMemberInfo($groupid, $localplayer)->rank);
|
||||||
|
|
||||||
if ($role->DeleteGroupWallPosts == 1 || $GLOBALS['user']->isAdmin())
|
if ($role->DeleteGroupWallPosts == 1 || $GLOBALS['user']->IsAdmin())
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1863,7 +1863,7 @@ function postShoutPermission($groupid)
|
||||||
{
|
{
|
||||||
$role = groupRoleInfo($groupid, groupMemberInfo($groupid, $localplayer)->rank);
|
$role = groupRoleInfo($groupid, groupMemberInfo($groupid, $localplayer)->rank);
|
||||||
|
|
||||||
if ($role->PostGroupShout == 1 || $GLOBALS['user']->isAdmin())
|
if ($role->PostGroupShout == 1 || $GLOBALS['user']->IsAdmin())
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1879,7 +1879,7 @@ function manageLowerRankPermission($groupid)
|
||||||
{
|
{
|
||||||
$role = groupRoleInfo($groupid, groupMemberInfo($groupid, $localplayer)->rank);
|
$role = groupRoleInfo($groupid, groupMemberInfo($groupid, $localplayer)->rank);
|
||||||
|
|
||||||
if ($role->ManageLowerRanks == 1 || $GLOBALS['user']->isAdmin())
|
if ($role->ManageLowerRanks == 1 || $GLOBALS['user']->IsAdmin())
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1895,7 +1895,7 @@ function kickLowerRankPermission($groupid)
|
||||||
{
|
{
|
||||||
$role = groupRoleInfo($groupid, groupMemberInfo($groupid, $localplayer)->rank);
|
$role = groupRoleInfo($groupid, groupMemberInfo($groupid, $localplayer)->rank);
|
||||||
|
|
||||||
if ($role->KickLowerRanks == 1 || $GLOBALS['user']->isAdmin())
|
if ($role->KickLowerRanks == 1 || $GLOBALS['user']->IsAdmin())
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1911,7 +1911,7 @@ function acceptJoinRequestPermission($groupid)
|
||||||
{
|
{
|
||||||
$role = groupRoleInfo($groupid, groupMemberInfo($groupid, $localplayer)->rank);
|
$role = groupRoleInfo($groupid, groupMemberInfo($groupid, $localplayer)->rank);
|
||||||
|
|
||||||
if ($role->AcceptJoinRequests == 1 || $GLOBALS['user']->isAdmin())
|
if ($role->AcceptJoinRequests == 1 || $GLOBALS['user']->IsAdmin())
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1927,7 +1927,7 @@ function viewAuditLogPermission($groupid)
|
||||||
{
|
{
|
||||||
$role = groupRoleInfo($groupid, groupMemberInfo($groupid, $localplayer)->rank);
|
$role = groupRoleInfo($groupid, groupMemberInfo($groupid, $localplayer)->rank);
|
||||||
|
|
||||||
if ($role->ViewAuditLog == 1 || $GLOBALS['user']->isAdmin())
|
if ($role->ViewAuditLog == 1 || $GLOBALS['user']->IsAdmin())
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1939,9 +1939,9 @@ function configPermission($groupid)
|
||||||
{
|
{
|
||||||
$localplayer = $GLOBALS['user']->id;
|
$localplayer = $GLOBALS['user']->id;
|
||||||
|
|
||||||
if (isGroupMember($localplayer, $groupid) || $GLOBALS['user']->isAdmin())
|
if (isGroupMember($localplayer, $groupid) || $GLOBALS['user']->IsAdmin())
|
||||||
{
|
{
|
||||||
if (manageLowerRankPermission($groupid) || kickLowerRankPermission($groupid) || acceptJoinRequestPermission($groupid) || viewAuditLogPermission($groupid) || $GLOBALS['user']->isAdmin())
|
if (manageLowerRankPermission($groupid) || kickLowerRankPermission($groupid) || acceptJoinRequestPermission($groupid) || viewAuditLogPermission($groupid) || $GLOBALS['user']->IsAdmin())
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1961,7 +1961,7 @@ function userAccessToGame($placeid, $userid)
|
||||||
$whitelist->bindParam(":pid", $placeid, PDO::PARAM_INT);
|
$whitelist->bindParam(":pid", $placeid, PDO::PARAM_INT);
|
||||||
$whitelist->bindParam(":uid", $userid, PDO::PARAM_INT);
|
$whitelist->bindParam(":uid", $userid, PDO::PARAM_INT);
|
||||||
$whitelist->execute();
|
$whitelist->execute();
|
||||||
if ($whitelist->rowCount() > 0 || $userid == getAssetInfo($placeid)->CreatorId || $GLOBALS['user']->isAdmin())
|
if ($whitelist->rowCount() > 0 || $userid == getAssetInfo($placeid)->CreatorId || $GLOBALS['user']->IsAdmin())
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -2842,7 +2842,7 @@ function userPlaying($userid)
|
||||||
|
|
||||||
function isUserInventoryPrivate($userid)
|
function isUserInventoryPrivate($userid)
|
||||||
{
|
{
|
||||||
if(userInfo($userid)->privateInventory && !$GLOBALS['user']->isAdmin())
|
if(userInfo($userid)->privateInventory && !$GLOBALS['user']->IsAdmin())
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -4254,14 +4254,14 @@ function isOwner($id, $userid=NULL)
|
||||||
|
|
||||||
//handle game assets
|
//handle game assets
|
||||||
if ($assettypeid == 9) {
|
if ($assettypeid == 9) {
|
||||||
if ($creatorid == $userid || $GLOBALS['user']->isOwner()) {
|
if ($creatorid == $userid || $GLOBALS['user']->IsOwner()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//others
|
//others
|
||||||
if ($creatorid == $userid || $GLOBALS['user']->isStaff()) {
|
if ($creatorid == $userid || $GLOBALS['user']->IsStaff()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -5233,7 +5233,7 @@ function getNav()
|
||||||
|
|
||||||
$modbutton = "";
|
$modbutton = "";
|
||||||
$pendingassetscount = 0;
|
$pendingassetscount = 0;
|
||||||
if ($GLOBALS['user']->isStaff())
|
if ($GLOBALS['user']->IsStaff())
|
||||||
{
|
{
|
||||||
$pendingassetscount = fetchPendingAssets()->rowCount();
|
$pendingassetscount = fetchPendingAssets()->rowCount();
|
||||||
|
|
||||||
|
|
@ -5315,7 +5315,7 @@ function getNav()
|
||||||
<a class="nav-link" href="/create/">Create</a>
|
<a class="nav-link" href="/create/">Create</a>
|
||||||
</li>
|
</li>
|
||||||
'.$modbutton.'
|
'.$modbutton.'
|
||||||
'.(($user->isAdmin())? '
|
'.(($user->IsAdmin())? '
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="https://crackpot.alphaland.cc">Admin</a>
|
<a class="nav-link" href="https://crackpot.alphaland.cc">Admin</a>
|
||||||
</li>':'').'
|
</li>':'').'
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ if(isset($_POST['submit_2fa'])) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($_POST['logout'])) {
|
if(isset($_POST['logout'])) {
|
||||||
$user->logout();
|
$user->Logout();
|
||||||
WebContextManager::Redirect("/");
|
WebContextManager::Redirect("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ header("Access-Control-Allow-Origin: https://www.alphaland.cc");
|
||||||
|
|
||||||
header("access-control-allow-credentials: true");
|
header("access-control-allow-credentials: true");
|
||||||
|
|
||||||
if(!$user->isStaff())
|
if(!$user->IsStaff())
|
||||||
{
|
{
|
||||||
WebContextManager::Redirect("/");
|
WebContextManager::Redirect("/");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
use Alphaland\Web\WebContextManager;
|
use Alphaland\Web\WebContextManager;
|
||||||
|
|
||||||
if(!$user->isStaff())
|
if(!$user->IsStaff())
|
||||||
{
|
{
|
||||||
WebContextManager::Redirect("/");
|
WebContextManager::Redirect("/");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
use Alphaland\Web\WebContextManager;
|
use Alphaland\Web\WebContextManager;
|
||||||
|
|
||||||
if(!$user->isStaff())
|
if(!$user->IsStaff())
|
||||||
{
|
{
|
||||||
WebContextManager::Redirect("/");
|
WebContextManager::Redirect("/");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ header("Access-Control-Allow-Origin: https://www.alphaland.cc");
|
||||||
header("access-control-allow-credentials: true");
|
header("access-control-allow-credentials: true");
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
if(!$user->isStaff())
|
if(!$user->IsStaff())
|
||||||
{
|
{
|
||||||
WebContextManager::Redirect("/");
|
WebContextManager::Redirect("/");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
use Alphaland\Web\WebContextManager;
|
use Alphaland\Web\WebContextManager;
|
||||||
|
|
||||||
if(!($user->isStaff()))
|
if(!($user->IsStaff()))
|
||||||
{
|
{
|
||||||
WebContextManager::Redirect("/");
|
WebContextManager::Redirect("/");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
use Alphaland\Web\WebContextManager;
|
use Alphaland\Web\WebContextManager;
|
||||||
|
|
||||||
if(!$user->isStaff())
|
if(!$user->IsStaff())
|
||||||
{
|
{
|
||||||
WebContextManager::Redirect("/");
|
WebContextManager::Redirect("/");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
use Alphaland\Web\WebContextManager;
|
use Alphaland\Web\WebContextManager;
|
||||||
|
|
||||||
if(!$user->isStaff())
|
if(!$user->IsStaff())
|
||||||
{
|
{
|
||||||
WebContextManager::Redirect("/");
|
WebContextManager::Redirect("/");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ header("Access-Control-Allow-Origin: https://www.alphaland.cc");
|
||||||
|
|
||||||
header("access-control-allow-credentials: true");
|
header("access-control-allow-credentials: true");
|
||||||
|
|
||||||
if(!$user->isStaff())
|
if(!$user->IsStaff())
|
||||||
{
|
{
|
||||||
WebContextManager::Redirect("/");
|
WebContextManager::Redirect("/");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ Alphaland 2021
|
||||||
|
|
||||||
use Alphaland\Web\WebContextManager;
|
use Alphaland\Web\WebContextManager;
|
||||||
|
|
||||||
if(!$user->isStaff())
|
if(!$user->IsStaff())
|
||||||
{
|
{
|
||||||
WebContextManager::Redirect("/");
|
WebContextManager::Redirect("/");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ header('Content-Type: application/json');
|
||||||
|
|
||||||
$id = (int)$_GET['id'];
|
$id = (int)$_GET['id'];
|
||||||
|
|
||||||
if(!$user->isStaff() || !$id) {
|
if(!$user->IsStaff() || !$id) {
|
||||||
WebContextManager::Redirect("/");
|
WebContextManager::Redirect("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ header('Content-Type: application/json');
|
||||||
|
|
||||||
$id = (int)$_GET['id'];
|
$id = (int)$_GET['id'];
|
||||||
|
|
||||||
if(!$user->isStaff() || !$id) {
|
if(!$user->IsStaff() || !$id) {
|
||||||
WebContextManager::Redirect("/");
|
WebContextManager::Redirect("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ header("Access-Control-Allow-Origin: https://www.alphaland.cc");
|
||||||
header("access-control-allow-credentials: true");
|
header("access-control-allow-credentials: true");
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
if(!$user->isStaff()) {
|
if(!$user->IsStaff()) {
|
||||||
WebContextManager::Redirect("/");
|
WebContextManager::Redirect("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
use Alphaland\Web\WebContextManager;
|
use Alphaland\Web\WebContextManager;
|
||||||
|
|
||||||
if(!$user->isStaff()) {
|
if(!$user->IsStaff()) {
|
||||||
WebContextManager::Redirect("/");
|
WebContextManager::Redirect("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
use Alphaland\Web\WebContextManager;
|
use Alphaland\Web\WebContextManager;
|
||||||
|
|
||||||
if(!$user->isStaff()) {
|
if(!$user->IsStaff()) {
|
||||||
WebContextManager::Redirect("/");
|
WebContextManager::Redirect("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ Alphaland 2021
|
||||||
use Alphaland\Moderation\UserModerationManager;
|
use Alphaland\Moderation\UserModerationManager;
|
||||||
use Alphaland\Web\WebContextManager;
|
use Alphaland\Web\WebContextManager;
|
||||||
|
|
||||||
if(!$user->isStaff()) {
|
if(!$user->IsStaff()) {
|
||||||
WebContextManager::Redirect("/");
|
WebContextManager::Redirect("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ header("Access-Control-Allow-Origin: https://www.alphaland.cc");
|
||||||
header("access-control-allow-credentials: true");
|
header("access-control-allow-credentials: true");
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
if(!$user->isStaff()) {
|
if(!$user->IsStaff()) {
|
||||||
WebContextManager::Redirect("/");
|
WebContextManager::Redirect("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
use Alphaland\Web\WebContextManager;
|
use Alphaland\Web\WebContextManager;
|
||||||
|
|
||||||
$body = '';
|
$body = '';
|
||||||
if(!($user->isStaff())) {
|
if(!($user->IsStaff())) {
|
||||||
WebContextManager::Redirect("/");
|
WebContextManager::Redirect("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ Alphaland 2021
|
||||||
use Alphaland\Moderation\UserModerationManager;
|
use Alphaland\Moderation\UserModerationManager;
|
||||||
use Alphaland\Web\WebContextManager;
|
use Alphaland\Web\WebContextManager;
|
||||||
|
|
||||||
if(!$user->isStaff()) {
|
if(!$user->IsStaff()) {
|
||||||
WebContextManager::Redirect("/");
|
WebContextManager::Redirect("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ if ($id)
|
||||||
{
|
{
|
||||||
if(isLoggedIn())
|
if(isLoggedIn())
|
||||||
{
|
{
|
||||||
if ($iteminfo->IsPublicDomain == true or $iteminfo->CreatorId == $user->id or $user->isOwner())
|
if ($iteminfo->IsPublicDomain == true or $iteminfo->CreatorId == $user->id or $user->IsOwner())
|
||||||
{
|
{
|
||||||
ReturnAsset($iteminfo->Hash, $iteminfo->AssetTypeId);
|
ReturnAsset($iteminfo->Hash, $iteminfo->AssetTypeId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ if (UserModerationManager::IsBanned($user->id))
|
||||||
|
|
||||||
if(isset($_POST['logout']))
|
if(isset($_POST['logout']))
|
||||||
{
|
{
|
||||||
$user->logout();
|
$user->Logout();
|
||||||
WebContextManager::Redirect("/");
|
WebContextManager::Redirect("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ if(isset($_GET['id']))
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($user->isStaff())
|
if ($user->IsStaff())
|
||||||
{
|
{
|
||||||
UserModerationManager::LogAction("Configure Item ".$id);
|
UserModerationManager::LogAction("Configure Item ".$id);
|
||||||
}
|
}
|
||||||
|
|
@ -133,7 +133,7 @@ if(isset($_GET['id']))
|
||||||
|
|
||||||
if (isset($_POST['onsale_checkbox']))
|
if (isset($_POST['onsale_checkbox']))
|
||||||
{
|
{
|
||||||
if ($user->isStaff())
|
if ($user->IsStaff())
|
||||||
{
|
{
|
||||||
UserModerationManager::LogAction("Configure Item Onsale ".$id);
|
UserModerationManager::LogAction("Configure Item Onsale ".$id);
|
||||||
}
|
}
|
||||||
|
|
@ -164,7 +164,7 @@ if(isset($_GET['id']))
|
||||||
}
|
}
|
||||||
elseif (isset($_POST['RegenItem'])) //for admin regen stuff
|
elseif (isset($_POST['RegenItem'])) //for admin regen stuff
|
||||||
{
|
{
|
||||||
if ($user->isStaff())
|
if ($user->IsStaff())
|
||||||
{
|
{
|
||||||
$script = "";
|
$script = "";
|
||||||
$scripttype = "";
|
$scripttype = "";
|
||||||
|
|
@ -298,7 +298,7 @@ if(isset($_GET['id']))
|
||||||
}
|
}
|
||||||
elseif (isset($_POST['ModerateItem'])) //for mods
|
elseif (isset($_POST['ModerateItem'])) //for mods
|
||||||
{
|
{
|
||||||
if ($user->isStaff())
|
if ($user->IsStaff())
|
||||||
{
|
{
|
||||||
$moderation = moderateAsset($id);
|
$moderation = moderateAsset($id);
|
||||||
|
|
||||||
|
|
@ -333,7 +333,7 @@ else
|
||||||
|
|
||||||
$moderatebutton = '';
|
$moderatebutton = '';
|
||||||
$regenbutton = '';
|
$regenbutton = '';
|
||||||
if ($user->isStaff())
|
if ($user->IsStaff())
|
||||||
{
|
{
|
||||||
$regenbutton = '<button type="Submit" name="RegenItem" class="btn btn-danger w-100 mb-2">Regen '.$itemtype.'</button>';
|
$regenbutton = '<button type="Submit" name="RegenItem" class="btn btn-danger w-100 mb-2">Regen '.$itemtype.'</button>';
|
||||||
$moderatebutton = '<button type="Submit" name="ModerateItem" class="btn btn-danger w-100 mb-2">Moderate '.$itemtype.'</button>';
|
$moderatebutton = '<button type="Submit" name="ModerateItem" class="btn btn-danger w-100 mb-2">Moderate '.$itemtype.'</button>';
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ if(isset($_GET['id']))
|
||||||
|
|
||||||
//only allow shirts, pants and t shirts to be modified by the end user (admins can regardless)
|
//only allow shirts, pants and t shirts to be modified by the end user (admins can regardless)
|
||||||
$configbutton_html = "";
|
$configbutton_html = "";
|
||||||
if ($itemtypeint == 2 or $itemtypeint == 11 or $itemtypeint == 12 or $user->isAdmin())
|
if ($itemtypeint == 2 or $itemtypeint == 11 or $itemtypeint == 12 or $user->IsAdmin())
|
||||||
{
|
{
|
||||||
if (isOwner($id) && !isAssetModerated($id)) //owner of the item or admin
|
if (isOwner($id) && !isAssetModerated($id)) //owner of the item or admin
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -238,7 +238,7 @@ function newPlace()
|
||||||
$description = $_POST['place_desc'];
|
$description = $_POST['place_desc'];
|
||||||
|
|
||||||
//how many games the user has
|
//how many games the user has
|
||||||
if (getAllGames($GLOBALS['user']->id)->rowCount() >= 6 && !$GLOBALS['user']->isAdmin())
|
if (getAllGames($GLOBALS['user']->id)->rowCount() >= 6 && !$GLOBALS['user']->IsAdmin())
|
||||||
{
|
{
|
||||||
return "Games limit reached";
|
return "Games limit reached";
|
||||||
}
|
}
|
||||||
|
|
@ -275,7 +275,7 @@ function newPBSPlace($placetype)
|
||||||
$description = $_POST['place_desc'];
|
$description = $_POST['place_desc'];
|
||||||
|
|
||||||
//how many games the user has
|
//how many games the user has
|
||||||
if (getAllGames($GLOBALS['user']->id)->rowCount() > 6 && !$GLOBALS['user']->isAdmin())
|
if (getAllGames($GLOBALS['user']->id)->rowCount() > 6 && !$GLOBALS['user']->IsAdmin())
|
||||||
{
|
{
|
||||||
return "Games limit reached";
|
return "Games limit reached";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ if(isset($_GET['id']))
|
||||||
|
|
||||||
if($q->rowCount() > 0)
|
if($q->rowCount() > 0)
|
||||||
{
|
{
|
||||||
if (isOwner($id) or $user->isAdmin()) //if the user is the owner of the game, or staff
|
if (isOwner($id) or $user->IsAdmin()) //if the user is the owner of the game, or staff
|
||||||
{
|
{
|
||||||
//item parameters
|
//item parameters
|
||||||
$gameinfo = getAssetInfo($id);
|
$gameinfo = getAssetInfo($id);
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
use Alphaland\Web\WebContextManager;
|
use Alphaland\Web\WebContextManager;
|
||||||
|
|
||||||
$user->logout();
|
$user->Logout();
|
||||||
WebContextManager::Redirect("/");
|
WebContextManager::Redirect("/");
|
||||||
|
|
@ -4,7 +4,7 @@ use Alphaland\Web\WebContextManager;
|
||||||
|
|
||||||
WebContextManager::ForceHttpsCloudflare();
|
WebContextManager::ForceHttpsCloudflare();
|
||||||
|
|
||||||
if(!($user->isOwner())) {
|
if(!($user->IsOwner())) {
|
||||||
die('bababooey');
|
die('bababooey');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@ use Alphaland\Web\WebContextManager;
|
||||||
WebContextManager::ForceHttpsCloudflare();
|
WebContextManager::ForceHttpsCloudflare();
|
||||||
|
|
||||||
//permissions
|
//permissions
|
||||||
if(!($user->isOwner())) {
|
if(!($user->IsOwner())) {
|
||||||
if ($user->isAdmin()) {
|
if ($user->IsAdmin()) {
|
||||||
WebContextManager::Redirect("/");
|
WebContextManager::Redirect("/");
|
||||||
}
|
}
|
||||||
die('bababooey');
|
die('bababooey');
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ use Alphaland\Web\WebContextManager;
|
||||||
|
|
||||||
WebContextManager::ForceHttpsCloudflare();
|
WebContextManager::ForceHttpsCloudflare();
|
||||||
|
|
||||||
if(!($user->isOwner())) {
|
if(!($user->IsOwner())) {
|
||||||
if ($user->isAdmin()) {
|
if ($user->IsAdmin()) {
|
||||||
WebContextManager::Redirect("/");
|
WebContextManager::Redirect("/");
|
||||||
}
|
}
|
||||||
die('bababooey');
|
die('bababooey');
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ use Alphaland\Web\WebContextManager;
|
||||||
|
|
||||||
WebContextManager::ForceHttpsCloudflare();
|
WebContextManager::ForceHttpsCloudflare();
|
||||||
|
|
||||||
if(!($user->isOwner())) {
|
if(!($user->IsOwner())) {
|
||||||
if ($user->isAdmin()) {
|
if ($user->IsAdmin()) {
|
||||||
WebContextManager::Redirect("/");
|
WebContextManager::Redirect("/");
|
||||||
}
|
}
|
||||||
die('bababooey');
|
die('bababooey');
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ use Alphaland\Web\WebContextManager;
|
||||||
|
|
||||||
WebContextManager::ForceHttpsCloudflare();
|
WebContextManager::ForceHttpsCloudflare();
|
||||||
|
|
||||||
if(!($user->isAdmin())) {
|
if(!($user->IsAdmin())) {
|
||||||
die('bababooey');
|
die('bababooey');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ use Alphaland\Web\WebContextManager;
|
||||||
|
|
||||||
WebContextManager::ForceHttpsCloudflare();
|
WebContextManager::ForceHttpsCloudflare();
|
||||||
|
|
||||||
if(!($user->isAdmin())) {
|
if(!($user->IsAdmin())) {
|
||||||
die('bababooey');
|
die('bababooey');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ WebContextManager::ForceHttpsCloudflare();
|
||||||
header("Access-Control-Allow-Origin: https://crackpot.alphaland.cc");
|
header("Access-Control-Allow-Origin: https://crackpot.alphaland.cc");
|
||||||
header("access-control-allow-credentials: true");
|
header("access-control-allow-credentials: true");
|
||||||
|
|
||||||
if(!($user->isAdmin())) {
|
if(!($user->IsAdmin())) {
|
||||||
die('bababooey');
|
die('bababooey');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ use Alphaland\Web\WebContextManager;
|
||||||
|
|
||||||
WebContextManager::ForceHttpsCloudflare();
|
WebContextManager::ForceHttpsCloudflare();
|
||||||
|
|
||||||
if(!($user->isOwner())) {
|
if(!($user->IsOwner())) {
|
||||||
if ($user->isAdmin()) {
|
if ($user->IsAdmin()) {
|
||||||
WebContextManager::Redirect("/");
|
WebContextManager::Redirect("/");
|
||||||
}
|
}
|
||||||
die('bababooey');
|
die('bababooey');
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ use Alphaland\Web\WebContextManager;
|
||||||
|
|
||||||
WebContextManager::ForceHttpsCloudflare();
|
WebContextManager::ForceHttpsCloudflare();
|
||||||
|
|
||||||
if(!($user->isAdmin())) {
|
if(!($user->IsAdmin())) {
|
||||||
die('bababooey');
|
die('bababooey');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ use Alphaland\Web\WebContextManager;
|
||||||
|
|
||||||
WebContextManager::ForceHttpsCloudflare();
|
WebContextManager::ForceHttpsCloudflare();
|
||||||
|
|
||||||
if(!($user->isAdmin())) {
|
if(!($user->IsAdmin())) {
|
||||||
die('bababooey');
|
die('bababooey');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ use Alphaland\Web\WebContextManager;
|
||||||
|
|
||||||
WebContextManager::ForceHttpsCloudflare();
|
WebContextManager::ForceHttpsCloudflare();
|
||||||
|
|
||||||
if(!($user->isAdmin())) {
|
if(!($user->IsAdmin())) {
|
||||||
die('bababooey');
|
die('bababooey');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ use Alphaland\Web\WebContextManager;
|
||||||
|
|
||||||
WebContextManager::ForceHttpsCloudflare();
|
WebContextManager::ForceHttpsCloudflare();
|
||||||
|
|
||||||
if(!($user->isAdmin())) {
|
if(!($user->IsAdmin())) {
|
||||||
die('bababooey');
|
die('bababooey');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ use Alphaland\Web\WebContextManager;
|
||||||
|
|
||||||
WebContextManager::ForceHttpsCloudflare();
|
WebContextManager::ForceHttpsCloudflare();
|
||||||
|
|
||||||
if(!($user->isOwner())) {
|
if(!($user->IsOwner())) {
|
||||||
if ($user->isAdmin()) {
|
if ($user->IsAdmin()) {
|
||||||
WebContextManager::Redirect("/");
|
WebContextManager::Redirect("/");
|
||||||
}
|
}
|
||||||
die('bababooey');
|
die('bababooey');
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ use Alphaland\Web\WebContextManager;
|
||||||
|
|
||||||
WebContextManager::ForceHttpsCloudflare();
|
WebContextManager::ForceHttpsCloudflare();
|
||||||
|
|
||||||
if(!($user->isAdmin())) {
|
if(!($user->IsAdmin())) {
|
||||||
die('bababooey');
|
die('bababooey');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ $userInfo = array(
|
||||||
"CreatorId" => $assetinfo->CreatorId,
|
"CreatorId" => $assetinfo->CreatorId,
|
||||||
"isPersonalServer" => boolval($assetinfo->isPersonalServer),
|
"isPersonalServer" => boolval($assetinfo->isPersonalServer),
|
||||||
"playPermission" => userAccessToGame($assetinfo->id, $user->id),
|
"playPermission" => userAccessToGame($assetinfo->id, $user->id),
|
||||||
"canManage" => boolval($assetinfo->CreatorId == $user->id || $user->isAdmin()),
|
"canManage" => boolval($assetinfo->CreatorId == $user->id || $user->IsAdmin()),
|
||||||
"CommentsEnabled" => boolval($assetinfo->IsCommentsEnabled),
|
"CommentsEnabled" => boolval($assetinfo->IsCommentsEnabled),
|
||||||
"PersonalServerWhitelist" => boolval($assetinfo->isGameWhitelisted),
|
"PersonalServerWhitelist" => boolval($assetinfo->isGameWhitelisted),
|
||||||
"MaxPlayers" => $assetinfo->MaxPlayers,
|
"MaxPlayers" => $assetinfo->MaxPlayers,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue