Merge branch 'master' of https://github.com/Astrologies/Alphaland-Website
This commit is contained in:
commit
3f1730c4f2
|
|
@ -7,6 +7,7 @@ Alphaland 2021
|
|||
//vars
|
||||
|
||||
use Alphaland\Web\WebContextManager;
|
||||
use Alphaland\Web\WebsiteSettings;
|
||||
|
||||
$thumbalive = false;
|
||||
$gamealive = false;
|
||||
|
|
@ -19,18 +20,14 @@ function checkThumb($override)
|
|||
{
|
||||
if (!$GLOBALS['thumbalive'] or $override) //to prevent flooding mysql calls
|
||||
{
|
||||
$GLOBALS['thumbalive'] = true;
|
||||
$set = $GLOBALS['pdo']->prepare("UPDATE websettings SET isThumbnailerAlive = 1");
|
||||
$set->execute();
|
||||
WebsiteSettings::UpdateSetting('isThumbnailerAlive', true);
|
||||
}
|
||||
}
|
||||
else //thumb arbiter offline
|
||||
{
|
||||
if ($GLOBALS['thumbalive'] or $override) //to prevent flooding mysql calls
|
||||
{
|
||||
$GLOBALS['thumbalive'] = false;
|
||||
$set = $GLOBALS['pdo']->prepare("UPDATE websettings SET isThumbnailerAlive = 0");
|
||||
$set->execute();
|
||||
WebsiteSettings::UpdateSetting('isThumbnailerAlive', false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -42,18 +39,14 @@ function checkGame($override)
|
|||
{
|
||||
if (!$GLOBALS['gamealive'] or $override) //to prevent flooding mysql calls
|
||||
{
|
||||
$GLOBALS['gamealive'] = true;
|
||||
$set = $GLOBALS['pdo']->prepare("UPDATE websettings SET IsGameServerAlive = 1");
|
||||
$set->execute();
|
||||
WebsiteSettings::UpdateSetting('IsGameServerAlive', true);
|
||||
}
|
||||
}
|
||||
else //gameserver arbiter offline
|
||||
{
|
||||
if ($GLOBALS['gamealive'] or $override) //to prevent flooding mysql calls
|
||||
{
|
||||
$GLOBALS['gamealive'] = false;
|
||||
$set = $GLOBALS['pdo']->prepare("UPDATE websettings SET IsGameServerAlive = 0");
|
||||
$set->execute();
|
||||
WebsiteSettings::UpdateSetting('IsGameServerAlive', false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ namespace Alphaland\Client {
|
|||
public static function ApplicationExists(string $applicationName)
|
||||
{
|
||||
// get the application
|
||||
$query = $GLOBALS['pdo']->prepare("SELECT COUNT(*) FROM `clientsettings_applications` WHERE `name` = :name");
|
||||
$query = $GLOBALS['pdo']->prepare("SELECT COUNT(*) FROM `clientsettings_applications` WHERE BINARY `name` = :name");
|
||||
$query->bindParam(':name', $applicationName, PDO::PARAM_STR);
|
||||
|
||||
$query->execute();
|
||||
|
|
@ -134,7 +134,7 @@ namespace Alphaland\Client {
|
|||
public static function ApplicationRequiresIpWhitelist(string $applicationName)
|
||||
{
|
||||
// get the application
|
||||
$query = $GLOBALS['pdo']->prepare("SELECT `requires_ip_whitelist` FROM `clientsettings_applications` WHERE `name` = :name");
|
||||
$query = $GLOBALS['pdo']->prepare("SELECT `requires_ip_whitelist` FROM `clientsettings_applications` WHERE BINARY `name` = :name");
|
||||
$query->bindParam(':name', $applicationName, PDO::PARAM_STR);
|
||||
|
||||
$query->execute();
|
||||
|
|
@ -154,7 +154,7 @@ namespace Alphaland\Client {
|
|||
public static function ApplicationRequiresRccServiceAuthentication(string $applicationName)
|
||||
{
|
||||
// get the application
|
||||
$query = $GLOBALS['pdo']->prepare("SELECT `requires_rcc_service_authentication` FROM `clientsettings_applications` WHERE `name` = :name");
|
||||
$query = $GLOBALS['pdo']->prepare("SELECT `requires_rcc_service_authentication` FROM `clientsettings_applications` WHERE BINARY `name` = :name");
|
||||
$query->bindParam(':name', $applicationName, PDO::PARAM_STR);
|
||||
|
||||
$query->execute();
|
||||
|
|
@ -173,7 +173,7 @@ namespace Alphaland\Client {
|
|||
public static function GetApplication(string $applicationName)
|
||||
{
|
||||
// get the application
|
||||
$query = $GLOBALS['pdo']->prepare("SELECT * FROM `clientsettings_applications` WHERE `name` = :name");
|
||||
$query = $GLOBALS['pdo']->prepare("SELECT * FROM `clientsettings_applications` WHERE BINARY `name` = :name");
|
||||
$query->bindParam(':name', $applicationName, PDO::PARAM_STR);
|
||||
|
||||
$query->execute();
|
||||
|
|
@ -193,7 +193,8 @@ namespace Alphaland\Client {
|
|||
$deps = array_map('trim', $deps);
|
||||
}
|
||||
}
|
||||
// return the application
|
||||
// special case here, because we want to make it return the dependencies as an array to prevent further processing down the line
|
||||
// the null coalesce to null is to prevent undefined index errors
|
||||
return array(
|
||||
'id' => $data['id'] ?? null,
|
||||
'name' => $data['name'] ?? null,
|
||||
|
|
@ -214,7 +215,11 @@ namespace Alphaland\Client {
|
|||
* @param bool $canBeFetchedFromClientsettingsService True if the ClientSettings Application can be fetched from the Clientsettings Service, false otherwise.
|
||||
* @param array $dependencies An array of ClientSettings Application Names that are dependencies of this ClientSettings Application.
|
||||
*/
|
||||
public static function CreateApplication(string $applicationName, bool $requiresIpWhitelist = false, bool $requiresRccServiceAuthentication = false, bool $canBeFetchedFromClientSettingsService = true, array $dependencies = [])
|
||||
public static function CreateApplication(string $applicationName,
|
||||
bool $requiresIpWhitelist = false,
|
||||
bool $requiresRccServiceAuthentication = false,
|
||||
bool $canBeFetchedFromClientSettingsService = true,
|
||||
array $dependencies = [])
|
||||
{
|
||||
// check if the application already exists
|
||||
if (self::ApplicationExists($applicationName)) {
|
||||
|
|
@ -249,7 +254,11 @@ namespace Alphaland\Client {
|
|||
* @param bool $canBeFetchedFromClientSettingsService The canBeFetchedFromClientSettingsService flag.
|
||||
* @param array $dependencies The dependencies.
|
||||
*/
|
||||
public static function UpdateApplication(string $applicationName, bool $requiresIpWhitelist = false, bool $requiresRccServiceAuthentication = false, bool $canBeFetchedFromClientSettingsService = true, array $dependencies = [])
|
||||
public static function UpdateApplication(string $applicationName,
|
||||
bool $requiresIpWhitelist = false,
|
||||
bool $requiresRccServiceAuthentication = false,
|
||||
bool $canBeFetchedFromClientSettingsService = true,
|
||||
array $dependencies = [])
|
||||
{
|
||||
// check if the application exists
|
||||
if (!self::ApplicationExists($applicationName)) {
|
||||
|
|
@ -260,7 +269,7 @@ namespace Alphaland\Client {
|
|||
$dependencies = implode(',', $dependencies);
|
||||
|
||||
// update the application
|
||||
$query = $GLOBALS['pdo']->prepare("UPDATE `clientsettings_applications` SET `requires_ip_whitelist` = :requires_ip_whitelist, `requires_rcc_service_authentication` = :requires_rcc_service_authentication, `can_be_fetched_from_clientsettings_service` = :can_be_fetched_from_clientsettings_service, `dependencies` = :dependencies WHERE `name` = :name");
|
||||
$query = $GLOBALS['pdo']->prepare("UPDATE `clientsettings_applications` SET `requires_ip_whitelist` = :requires_ip_whitelist, `requires_rcc_service_authentication` = :requires_rcc_service_authentication, `can_be_fetched_from_clientsettings_service` = :can_be_fetched_from_clientsettings_service, `dependencies` = :dependencies WHERE BINARY `name` = :name");
|
||||
$query->bindParam(':name', $applicationName, PDO::PARAM_STR);
|
||||
$query->bindParam(':requires_ip_whitelist', $requiresIpWhitelist, PDO::PARAM_BOOL);
|
||||
$query->bindParam(':requires_rcc_service_authentication', $requiresRccServiceAuthentication, PDO::PARAM_BOOL);
|
||||
|
|
@ -280,7 +289,11 @@ namespace Alphaland\Client {
|
|||
* @param bool $canBeFetchedFromClientSettingsService Whether the application can be fetched from the ClientSettings Service.
|
||||
* @param array $dependencies The dependencies of the application.
|
||||
*/
|
||||
public static function CreateOrUpdateApplication(string $applicationName, bool $requiresIpWhitelist = false, bool $requiresRccServiceAuthentication = false, bool $canBeFetchedFromClientSettingsService = true, array $dependencies = [])
|
||||
public static function CreateOrUpdateApplication(string $applicationName,
|
||||
bool $requiresIpWhitelist = false,
|
||||
bool $requiresRccServiceAuthentication = false,
|
||||
bool $canBeFetchedFromClientSettingsService = true,
|
||||
array $dependencies = [])
|
||||
{
|
||||
// check if the application exists
|
||||
if (self::ApplicationExists($applicationName)) {
|
||||
|
|
@ -299,7 +312,11 @@ namespace Alphaland\Client {
|
|||
* @param bool $canBeFetchedFromClientSettingsService Whether the application can be fetched from the ClientSettings Service.
|
||||
* @param array $dependencies The dependencies of the application.
|
||||
*/
|
||||
public static function GetOrCreateApplication(string $applicationName, bool $requiresIpWhitelist = false, bool $requiresRccServiceAuthentication = false, bool $canBeFetchedFromClientSettingsService = true, array $dependencies = [])
|
||||
public static function GetOrCreateApplication(string $applicationName,
|
||||
bool $requiresIpWhitelist = false,
|
||||
bool $requiresRccServiceAuthentication = false,
|
||||
bool $canBeFetchedFromClientSettingsService = true,
|
||||
array $dependencies = [])
|
||||
{
|
||||
// check if the application exists
|
||||
if (!self::ApplicationExists($applicationName)) {
|
||||
|
|
@ -320,7 +337,7 @@ namespace Alphaland\Client {
|
|||
public static function GetApplicationDependencies(string $applicationName): array
|
||||
{
|
||||
// get the application
|
||||
$query = $GLOBALS['pdo']->prepare("SELECT `dependencies` FROM `clientsettings_applications` WHERE `name` = :application");
|
||||
$query = $GLOBALS['pdo']->prepare("SELECT `dependencies` FROM `clientsettings_applications` WHERE BINARY `name` = :application");
|
||||
$query->bindParam(':application', $applicationName, PDO::PARAM_STR);
|
||||
|
||||
$query->execute();
|
||||
|
|
@ -344,7 +361,7 @@ namespace Alphaland\Client {
|
|||
}
|
||||
|
||||
// get the application
|
||||
$query = $GLOBALS['pdo']->prepare("SELECT `dependencies` FROM `clientsettings_applications` WHERE `name` = :application");
|
||||
$query = $GLOBALS['pdo']->prepare("SELECT `dependencies` FROM `clientsettings_applications` WHERE BINARY `name` = :application");
|
||||
$query->bindParam(':application', $applicationName, PDO::PARAM_STR);
|
||||
|
||||
$query->execute();
|
||||
|
|
@ -365,7 +382,7 @@ namespace Alphaland\Client {
|
|||
public static function ApplicationHasDependency(string $applicationName, string $dependencyName): bool
|
||||
{
|
||||
// with the dependencies containing $dependencyName, we can check if the application has the dependency
|
||||
$query = $GLOBALS['pdo']->prepare("SELECT COUNT(*) FROM `clientsettings_applications` WHERE `name` = :application AND `dependencies` LIKE :dependency");
|
||||
$query = $GLOBALS['pdo']->prepare("SELECT COUNT(*) FROM `clientsettings_applications` WHERE BINARY `name` = :application AND `dependencies` LIKE :dependency");
|
||||
$query->bindParam(':application', $applicationName, PDO::PARAM_STR);
|
||||
$query->bindParam(':dependency', '%' . $dependencyName . '%', PDO::PARAM_STR);
|
||||
|
||||
|
|
@ -398,7 +415,7 @@ namespace Alphaland\Client {
|
|||
public static function FetchCombinedApplicationDependencies(string $applicationName, bool $recursive = true)
|
||||
{
|
||||
// get the application
|
||||
$query = $GLOBALS['pdo']->prepare("SELECT `dependencies` FROM `clientsettings_applications` WHERE `name` = :application");
|
||||
$query = $GLOBALS['pdo']->prepare("SELECT `dependencies` FROM `clientsettings_applications` WHERE BINARY `name` = :application");
|
||||
$query->bindParam(':application', $applicationName, PDO::PARAM_STR);
|
||||
|
||||
$query->execute();
|
||||
|
|
@ -442,7 +459,7 @@ namespace Alphaland\Client {
|
|||
public static function DeleteApplicationAndSettings(string $applicationName)
|
||||
{
|
||||
// delete the application
|
||||
$query = $GLOBALS['pdo']->prepare("DELETE FROM `clientsettings_applications` WHERE `name` = :name");
|
||||
$query = $GLOBALS['pdo']->prepare("DELETE FROM `clientsettings_applications` WHERE BINARY `name` = :name");
|
||||
$query->bindParam(':name', $applicationName, PDO::PARAM_STR);
|
||||
|
||||
$query->execute();
|
||||
|
|
@ -461,7 +478,7 @@ namespace Alphaland\Client {
|
|||
public static function ApplicationCanBeFetchedFromClientSettingsService(string $applicationName)
|
||||
{
|
||||
// get the application
|
||||
$query = $GLOBALS['pdo']->prepare("SELECT `can_be_fetched_from_clientsettings_service` FROM `clientsettings_applications` WHERE `name` = :name");
|
||||
$query = $GLOBALS['pdo']->prepare("SELECT `can_be_fetched_from_clientsettings_service` FROM `clientsettings_applications` WHERE BINARY `name` = :name");
|
||||
$query->bindParam(':name', $applicationName, PDO::PARAM_STR);
|
||||
|
||||
$query->execute();
|
||||
|
|
@ -645,7 +662,7 @@ namespace Alphaland\Client {
|
|||
throw new Error("The application '$applicationName' does not exist.");
|
||||
}
|
||||
|
||||
$query = $GLOBALS['pdo']->prepare("UPDATE `clientsettings` SET `value` = :value, `kind` = :kind WHERE `application` = :application AND `name` = :name");
|
||||
$query = $GLOBALS['pdo']->prepare("UPDATE `clientsettings` SET `value` = :value, `kind` = :kind WHERE `application` = :application AND BINARY `name` = :name");
|
||||
$query->bindParam(':application', $applicationId, PDO::PARAM_INT);
|
||||
$query->bindParam(':name', $settingName, PDO::PARAM_STR);
|
||||
$query->bindParam(':value', $value, PDO::PARAM_STR);
|
||||
|
|
@ -724,7 +741,7 @@ namespace Alphaland\Client {
|
|||
}
|
||||
|
||||
// get the setting
|
||||
$query = $GLOBALS['pdo']->prepare("SELECT * FROM `clientsettings` WHERE `application` = :application AND `name` = :name");
|
||||
$query = $GLOBALS['pdo']->prepare("SELECT * FROM `clientsettings` WHERE `application` = :application AND BINARY `name` = :name");
|
||||
$query->bindParam(':application', $applicationId, PDO::PARAM_INT);
|
||||
$query->bindParam(':name', $name, PDO::PARAM_STR);
|
||||
|
||||
|
|
@ -844,7 +861,7 @@ namespace Alphaland\Client {
|
|||
}
|
||||
|
||||
// delete the setting
|
||||
$query = $GLOBALS['pdo']->prepare("DELETE FROM `clientsettings` WHERE `application` = :application AND `name` = :name");
|
||||
$query = $GLOBALS['pdo']->prepare("DELETE FROM `clientsettings` WHERE `application` = :application AND BINARY `name` = :name");
|
||||
$query->bindParam(':application', $applicationId, PDO::PARAM_INT);
|
||||
$query->bindParam(':name', $name, PDO::PARAM_STR);
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ namespace Alphaland\Games {
|
|||
|
||||
use Alphaland\Assets\Asset;
|
||||
use Alphaland\Grid\RccServiceHelper;
|
||||
use Alphaland\Web\WebsiteSettings;
|
||||
use Exception;
|
||||
use PDO;
|
||||
|
||||
|
|
@ -230,12 +231,7 @@ namespace Alphaland\Games {
|
|||
|
||||
public static function ArbiterOnline() //the main portion of this check is now a background script
|
||||
{
|
||||
$check = $GLOBALS['pdo']->prepare("SELECT COUNT(*) FROM websettings WHERE isGameServerAlive = 1");
|
||||
$check->execute();
|
||||
if ($check->fetchColumn() > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return WebsiteSettings::GetSetting("isGameServerAlive");
|
||||
}
|
||||
|
||||
public static function RemovePersonalBuildServerRank(int $placeid, int $userid)
|
||||
|
|
|
|||
|
|
@ -182,6 +182,9 @@ namespace Alphaland\Web {
|
|||
*/
|
||||
public static function IsIpInCidrRange(string $ip, string $cidr)
|
||||
{
|
||||
if (strpos($cidr, '/') === false)
|
||||
$cidr = "$cidr/32";
|
||||
|
||||
list($subnet, $bits) = explode('/', $cidr);
|
||||
if ($bits === null) {
|
||||
$bits = 32;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
namespace Alphaland\Web {
|
||||
|
||||
use PDO;
|
||||
use Alphaland\Web\IpHelper;
|
||||
|
||||
class WebContextManager
|
||||
{
|
||||
|
|
@ -14,9 +15,9 @@ namespace Alphaland\Web {
|
|||
public static function IsCurrentIpAddressWhitelisted()
|
||||
{
|
||||
$currentIp = WebContextManager::GetCurrentIPAddress();
|
||||
$ipWhitelist = explode(";", $GLOBALS['ws']->webservice_whitelist);
|
||||
$ipWhitelist = explode(";", WebsiteSettings::GetSetting("webservice_whitelist", "127.0.0.0/8;192.168.0.0/16;10.0.0.0/8"));
|
||||
|
||||
return in_array($currentIp, $ipWhitelist);
|
||||
return IpHelper::IsIpInCidrNetmaskOrRangeList($currentIp, $ipWhitelist);
|
||||
}
|
||||
|
||||
public static function CanBypassMaintenance()
|
||||
|
|
@ -26,13 +27,10 @@ namespace Alphaland\Web {
|
|||
|
||||
public static function IsUnderMaintenance(bool $status = false)
|
||||
{
|
||||
$query = $GLOBALS['pdo']->prepare("SELECT * FROM `websettings` WHERE `maintenance` = 1");
|
||||
$query->execute();
|
||||
$isUnderMaintenance = WebsiteSettings::GetSetting('maintenance');
|
||||
|
||||
if ($query->rowCount() > 0) {
|
||||
if ($status) {
|
||||
return true;
|
||||
}
|
||||
if ($isUnderMaintenance === true) {
|
||||
if ($status) return true;
|
||||
return !WebContextManager::CanBypassMaintenance();
|
||||
}
|
||||
return false;
|
||||
|
|
@ -56,13 +54,8 @@ namespace Alphaland\Web {
|
|||
|
||||
if (!empty($accesskey))
|
||||
{
|
||||
if(WebContextManager::IsCurrentIpAddressWhitelisted())
|
||||
{
|
||||
if($accesskey == $GLOBALS['ws']->webservice_key)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if(WebContextManager::IsCurrentIpAddressWhitelisted())
|
||||
return $accesskey == WebsiteSettings::GetSetting('webservice_key', null);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ namespace Alphaland\Web {
|
|||
|
||||
use PDO;
|
||||
|
||||
/* public static */ class WebsiteSettings
|
||||
class WebsiteSettings
|
||||
{
|
||||
// default return if no settings are found
|
||||
// because there may be a NULL value in the database
|
||||
|
|
@ -84,7 +84,7 @@ namespace Alphaland\Web {
|
|||
*/
|
||||
public static function GetSetting(string $name, $default = null)
|
||||
{
|
||||
$query = $GLOBALS['pdo']->prepare("SELECT `value`, `type` FROM `websettings` WHERE `name` = :name");
|
||||
$query = $GLOBALS['pdo']->prepare("SELECT `value`, `type` FROM `websettings_v2` WHERE `name` = :name");
|
||||
$query->bindParam(':name', $name);
|
||||
|
||||
if (!$query->execute()) {
|
||||
|
|
@ -99,24 +99,6 @@ namespace Alphaland\Web {
|
|||
return self::ConvertStringToValue($result['value'], $result['type']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets or sets the value of a website setting.
|
||||
*
|
||||
* @param string $name The name of the setting.
|
||||
* @param mixed $value The value of the setting.
|
||||
* @param string $type The type of the setting.
|
||||
*
|
||||
* @return mixed The value of the setting.
|
||||
*/
|
||||
public static function GetOrCreateSetting(string $name, $value = null, string $type = null)
|
||||
{
|
||||
if (!self::SettingExists($name)) {
|
||||
self::UpdateSetting($name, $value, $type);
|
||||
}
|
||||
|
||||
return self::GetSetting($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a website setting.
|
||||
*
|
||||
|
|
@ -151,9 +133,9 @@ namespace Alphaland\Web {
|
|||
$query = null;
|
||||
|
||||
if ($remote === self::DOES_NOT_EXIST) {
|
||||
$query = $GLOBALS['pdo']->prepare("INSERT INTO `websettings` (`name`, `value`, `type`) VALUES (:name, :value, :type)");
|
||||
$query = $GLOBALS['pdo']->prepare("INSERT INTO `websettings_v2` (`name`, `value`, `type`) VALUES (:name, :value, :type)");
|
||||
} else {
|
||||
$query = $GLOBALS['pdo']->prepare("UPDATE `websettings` SET `value` = :value, `type` = :type WHERE `name` = :name");
|
||||
$query = $GLOBALS['pdo']->prepare("UPDATE `websettings_v2` SET `value` = :value, `type` = :type WHERE `name` = :name");
|
||||
}
|
||||
|
||||
if (gettype($value) === 'NULL') {
|
||||
|
|
@ -179,7 +161,7 @@ namespace Alphaland\Web {
|
|||
*/
|
||||
public static function DeleteSetting(string $name): bool
|
||||
{
|
||||
$query = $GLOBALS['pdo']->prepare("DELETE FROM `websettings` WHERE `name` = :name");
|
||||
$query = $GLOBALS['pdo']->prepare("DELETE FROM `websettings_v2` WHERE `name` = :name");
|
||||
$query->bindParam(':name', $name);
|
||||
|
||||
return $query->execute();
|
||||
|
|
@ -192,7 +174,7 @@ namespace Alphaland\Web {
|
|||
*/
|
||||
public static function GetAllSettings(): array
|
||||
{
|
||||
$query = $GLOBALS['pdo']->prepare("SELECT `name`, `value`, `type` FROM `websettings`");
|
||||
$query = $GLOBALS['pdo']->prepare("SELECT `name`, `value`, `type` FROM `websettings_v2`");
|
||||
|
||||
if (!$query->execute()) {
|
||||
return [];
|
||||
|
|
@ -218,7 +200,7 @@ namespace Alphaland\Web {
|
|||
*/
|
||||
public static function SettingExists(string $name): bool
|
||||
{
|
||||
$query = $GLOBALS['pdo']->prepare("SELECT `name` FROM `websettings` WHERE `name` = :name");
|
||||
$query = $GLOBALS['pdo']->prepare("SELECT `name` FROM `websettings_v2` WHERE `name` = :name");
|
||||
$query->bindParam(':name', $name);
|
||||
|
||||
if (!$query->execute()) {
|
||||
|
|
@ -237,7 +219,7 @@ namespace Alphaland\Web {
|
|||
*/
|
||||
public static function DeleteAllSettings(): bool
|
||||
{
|
||||
$query = $GLOBALS['pdo']->prepare("DELETE FROM `websettings`");
|
||||
$query = $GLOBALS['pdo']->prepare("DELETE FROM `websettings_v2`");
|
||||
|
||||
return $query->execute();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ try
|
|||
$siteName = "Alphaland"; //site name
|
||||
$domain = "alphaland.cc";
|
||||
$url = "https://www.".$domain; //site URL
|
||||
$ws = $pdo->query("SELECT * FROM websettings WHERE id = 1")->fetch(PDO::FETCH_OBJ); //websettings
|
||||
//websettings
|
||||
$clientUserAgent = "Roblox/WinInet";
|
||||
$ROBLOXAssetAPI = "https://assetdelivery.roblox.com/v1/asset/?id=";
|
||||
$ROBLOXProductInfoAPI = "https://api.roblox.com/marketplace/productinfo?assetId=";
|
||||
|
|
@ -126,6 +126,9 @@ try
|
|||
include "C:/Webserver/nginx/Alphaland/globals/Dependencies/Administration/SignupKey.php";
|
||||
include "C:/Webserver/nginx/Alphaland/globals/Dependencies/Economy/EconomyHelper.php";
|
||||
include "C:/Webserver/nginx/Alphaland/globals/Dependencies/Groups/Group.php";
|
||||
include "C:/Webserver/nginx/Alphaland/globals/Dependencies/Web/WebsiteSettings.php";
|
||||
include "C:/Webserver/nginx/Alphaland/globals/Dependencies/Web/IpRange.php";
|
||||
include "C:/Webserver/nginx/Alphaland/globals/Dependencies/Client/ClientSettings.php";
|
||||
|
||||
//authenticator
|
||||
$authenticator = new PHPGangsta_GoogleAuthenticator();
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ use Alphaland\Games\Game;
|
|||
use Alphaland\Moderation\Filter;
|
||||
use Alphaland\Users\Render as UsersRender;
|
||||
use Alphaland\Web\WebContextManager;
|
||||
use Alphaland\Web\WebsiteSettings;
|
||||
|
||||
//safe generation utilities
|
||||
|
||||
|
|
@ -1495,14 +1496,7 @@ function rewardUserBadge($UserID, $BadgeID, $PlaceID)
|
|||
|
||||
function isThumbnailerAlive() //the main portion of this check is now a background script
|
||||
{
|
||||
$check = $GLOBALS['pdo']->prepare("SELECT * FROM websettings WHERE isThumbnailerAlive = 1");
|
||||
$check->execute();
|
||||
|
||||
if ($check->rowCount() > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return WebsiteSettings::GetSetting("isThumbnailerAlive");
|
||||
}
|
||||
|
||||
function verifyLuaValue($value) //mostly due to booleans, but maybe something will come up in the future
|
||||
|
|
@ -2382,22 +2376,18 @@ function userPlaceVisits($userid)
|
|||
|
||||
function enableMaintenance($custom)
|
||||
{
|
||||
if (!empty($custom)) {
|
||||
$setmaintenance = $GLOBALS['pdo']->prepare("UPDATE websettings SET maintenance = 1, maintenance_text = :t");
|
||||
$setmaintenance->bindParam(":t", $custom, PDO::PARAM_STR);
|
||||
$setmaintenance->execute();
|
||||
} else {
|
||||
$setmaintenance = $GLOBALS['pdo']->prepare("UPDATE websettings SET maintenance = 1");
|
||||
$setmaintenance->execute();
|
||||
}
|
||||
if (!empty($custom))
|
||||
WebsiteSettings::UpdateSetting("maintenance_text", $custom);
|
||||
|
||||
WebsiteSettings::UpdateSetting("maintenance", true);
|
||||
|
||||
soapCloseAllJobs($GLOBALS['gamesArbiter']);
|
||||
}
|
||||
|
||||
function disableMaintenance()
|
||||
{
|
||||
$setmaintenance = $GLOBALS['pdo']->prepare("UPDATE websettings SET maintenance = 0, maintenance_text = ''");
|
||||
$setmaintenance->execute();
|
||||
WebsiteSettings::UpdateSetting("maintenance", false);
|
||||
WebsiteSettings::UpdateSetting("maintenance_text", "");
|
||||
}
|
||||
|
||||
function setUserRank($rank, $userid)
|
||||
|
|
@ -2851,43 +2841,36 @@ function getNav()
|
|||
|
||||
function fetchAnnouncement()
|
||||
{
|
||||
$announcementquery = $GLOBALS['pdo']->prepare("SELECT * FROM websettings");
|
||||
$announcementquery->execute();
|
||||
$announcementquery = $announcementquery->fetch(PDO::FETCH_OBJ);
|
||||
$announcement = cleanOutput($announcementquery->announcement); //clean output
|
||||
if (empty($announcementquery->announcement))
|
||||
$announcement = WebsiteSettings::GetSetting("announcement");
|
||||
|
||||
if (empty($announcement)) return "";
|
||||
|
||||
$cleanAnnouncement = cleanOutput($announcement); //clean output
|
||||
|
||||
$announcement_color = WebsiteSettings::GetSetting("announcement_color");
|
||||
|
||||
$html = "";
|
||||
|
||||
switch ($announcement_color)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
else
|
||||
{
|
||||
$html = "";
|
||||
if ($announcementquery->announcement_color == "red")
|
||||
{
|
||||
$html = "<div style='margin:0 auto;Overflow:hidden;text-align: center' class='alert alert-danger' role='alert'>{$announcement}</div>";
|
||||
}
|
||||
elseif ($announcementquery->announcement_color == "blue")
|
||||
{
|
||||
$html = "<div style='margin:0 auto;Overflow:hidden;text-align: center' class='alert alert-primary' role='alert'>{$announcement}</div>";
|
||||
}
|
||||
elseif ($announcementquery->announcement_color == "green")
|
||||
{
|
||||
$html = "<div style='margin:0 auto;Overflow:hidden;text-align: center' class='alert alert-success' role='alert'>{$announcement}</div>";
|
||||
}
|
||||
return $html;
|
||||
case "red":
|
||||
$html = "<div style='margin:0 auto;Overflow:hidden;text-align: center' class='alert alert-danger' role='alert'>{$cleanAnnouncement}</div>";
|
||||
break;
|
||||
case "green":
|
||||
$html = "<div style='margin:0 auto;Overflow:hidden;text-align: center' class='alert alert-success' role='alert'>{$cleanAnnouncement}</div>";
|
||||
break;
|
||||
case "blue":
|
||||
default:
|
||||
$html = "<div style='margin:0 auto;Overflow:hidden;text-align: center' class='alert alert-primary' role='alert'>{$cleanAnnouncement}</div>";
|
||||
break;
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
function canRegister()
|
||||
{
|
||||
$check = $GLOBALS['pdo']->prepare("SELECT * FROM websettings WHERE registration = 1");
|
||||
$check->execute();
|
||||
|
||||
if($check->rowCount() > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return WebsiteSettings::GetSetting("registration", false);
|
||||
}
|
||||
|
||||
function adminPanelStats() {
|
||||
|
|
|
|||
|
|
@ -32,10 +32,6 @@ function ReturnAsset($hash, $assettypeid) //this determines which cdn to grab an
|
|||
ReturnAssetFromHash($hash);
|
||||
}
|
||||
}
|
||||
|
||||
$websettings = $pdo->prepare("SELECT * FROM websettings");
|
||||
$websettings->execute();
|
||||
$websettings = $websettings->fetch(PDO::FETCH_OBJ);
|
||||
|
||||
if ($id)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,8 +1,13 @@
|
|||
<?php
|
||||
|
||||
use Alphaland\Web\WebsiteSettings;
|
||||
|
||||
$alphalandVersion = WebsiteSettings::GetSetting("AlphalandVersion");
|
||||
$alphalandStudioVersion = WebsiteSettings::GetSetting("AlphalandStudioVersion");
|
||||
|
||||
if (isset($_POST['SubmitClient']))
|
||||
{
|
||||
$loc = $GLOBALS['setupHtmlPath'].$ws->AlphalandVersion."-AlphalandLauncher.exe";
|
||||
$loc = $GLOBALS['setupHtmlPath'].$alphalandVersion."-AlphalandLauncher.exe";
|
||||
header("Content-type: application/octet-stream");
|
||||
header("Content-Disposition: attachment; filename=AlphalandLauncher.exe");
|
||||
echo file_get_contents($loc);
|
||||
|
|
@ -10,7 +15,7 @@ if (isset($_POST['SubmitClient']))
|
|||
|
||||
if (isset($_POST['SubmitStudio']))
|
||||
{
|
||||
$loc = $GLOBALS['setupHtmlPath'].$ws->AlphalandStudioVersion."-AlphalandStudioLauncher.exe";
|
||||
$loc = $GLOBALS['setupHtmlPath'].$alphalandStudioVersion."-AlphalandStudioLauncher.exe";
|
||||
header("Content-type: application/octet-stream");
|
||||
header("Content-Disposition: attachment; filename=AlphalandStudioLauncher.exe");
|
||||
echo file_get_contents($loc);
|
||||
|
|
|
|||
|
|
@ -1,25 +1,12 @@
|
|||
<?php
|
||||
|
||||
use Alphaland\Web\WebContextManager;
|
||||
use Alphaland\Web\WebsiteSettings;
|
||||
|
||||
if (!WebContextManager::IsUnderMaintenance())
|
||||
{
|
||||
WebContextManager::Redirect("/");
|
||||
}
|
||||
|
||||
$websettings = $pdo->prepare("SELECT * FROM websettings");
|
||||
$websettings->execute();
|
||||
$websettings = $websettings->fetch(PDO::FETCH_OBJ);
|
||||
|
||||
$status = '';
|
||||
if (!empty($websettings->maintenance_text))
|
||||
{
|
||||
$status = $websettings->maintenance_text; //use custom text
|
||||
}
|
||||
else
|
||||
{
|
||||
$status = $websettings->default_maintenance_text; //default maintenance text
|
||||
}
|
||||
$maintenance_text = WebsiteSettings::GetSetting('maintenance_text') ?? WebsiteSettings::GetSetting("default_maintenance_text");
|
||||
|
||||
$body = <<<EOT
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
|
@ -54,8 +41,8 @@ body {
|
|||
</style>
|
||||
<div class="container" style="flex-direction: column!important;justify-content: center!important;display: flex!important;">
|
||||
<img style="max-width: 30rem;max-width: 30rem;margin-right: auto;margin-left: auto;" src="alphaland/cdn/imgs/alphaland-white-1024.png">
|
||||
<h1 style="text-align:center; ">{$status}</h1>
|
||||
<h1 style="text-align:center; ">{$maintenance_text}</h1>
|
||||
</div>
|
||||
EOT;
|
||||
|
||||
echo $body;
|
||||
echo $body;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Alphaland\Web\WebContextManager;
|
||||
use Alphaland\Web\WebsiteSettings;
|
||||
|
||||
WebContextManager::ForceHttpsCloudflare();
|
||||
|
||||
|
|
@ -15,9 +16,8 @@ if (isset($_POST['setannouncement']))
|
|||
{
|
||||
if (empty($_POST['setannouncement']))
|
||||
{
|
||||
//clear current announcement
|
||||
$setsecmd5 = $pdo->prepare('UPDATE websettings SET announcement = "", announcement_color = ""');
|
||||
$setsecmd5->execute();
|
||||
WebsiteSettings::UpdateSetting('announcement', "");
|
||||
WebsiteSettings::UpdateSetting('announcement_color', "");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -47,10 +47,8 @@ if (isset($_POST['setannouncement']))
|
|||
{
|
||||
$color = "red";
|
||||
}
|
||||
$setsecmd5 = $pdo->prepare("UPDATE websettings SET announcement = :m, announcement_color = :c");
|
||||
$setsecmd5->bindParam(":m", $_POST['setannouncement'], PDO::PARAM_STR);
|
||||
$setsecmd5->bindParam(":c", $color, PDO::PARAM_STR);
|
||||
$setsecmd5->execute();
|
||||
WebsiteSettings::UpdateSetting('announcement', $_POST['setannouncement']);
|
||||
WebsiteSettings::UpdateSetting('announcement_color', $color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Alphaland\Web\WebContextManager;
|
||||
use Alphaland\Web\WebsiteSettings;
|
||||
|
||||
WebContextManager::ForceHttpsCloudflare();
|
||||
|
||||
|
|
@ -119,9 +120,9 @@ if ($pass) {
|
|||
|
||||
$previousdeployversion = "";
|
||||
if ($deploytype == "client") {
|
||||
$previousdeployversion = $ws->AlphalandVersion;
|
||||
$previousdeployversion = WebsiteSettings::GetSetting("AlphalandVersion");
|
||||
} else if ($deploytype == "studio") {
|
||||
$previousdeployversion = $ws->AlphalandStudioVersion;
|
||||
$previousdeployversion = WebsiteSettings::GetSetting("AlphalandStudioVersion");
|
||||
}
|
||||
|
||||
//deploy type specific stuff
|
||||
|
|
@ -168,17 +169,13 @@ if ($pass) {
|
|||
|
||||
//update in db
|
||||
if ($deploytype == "client") {
|
||||
$updatewebsettings = $pdo->prepare("UPDATE websettings SET AlphalandVersion = :av, security_version = :sv, md5_hash = :mh, GameFileVersion = :gv");
|
||||
$updatewebsettings->bindParam(":av", $newgameversion, PDO::PARAM_STR);
|
||||
$updatewebsettings->bindParam(":sv", $gamesecurityversion, PDO::PARAM_STR);
|
||||
$updatewebsettings->bindParam(":mh", $gamemd5hash, PDO::PARAM_STR);
|
||||
$updatewebsettings->bindParam(":gv", $gamefileversion, PDO::PARAM_STR);
|
||||
$updatewebsettings->execute();
|
||||
WebsiteSettings::UpdateSetting("AlphalandVersion", $newgameversion);
|
||||
WebsiteSettings::UpdateSetting("security_version", $gamesecurityversion);
|
||||
WebsiteSettings::UpdateSetting("md5_hash", $gamemd5hash);
|
||||
WebsiteSettings::UpdateSetting("GameFileVersion", $gamefileversion);
|
||||
} else if ($deploytype == "studio") {
|
||||
$updatewebsettings = $pdo->prepare("UPDATE websettings SET AlphalandStudioVersion = :asv, StudioFileVersion = :sfv");
|
||||
$updatewebsettings->bindParam(":asv", $newgameversion, PDO::PARAM_STR);
|
||||
$updatewebsettings->bindParam(":sfv", $gamefileversion, PDO::PARAM_STR);
|
||||
$updatewebsettings->execute();
|
||||
WebsiteSettings::UpdateSetting("AlphalandStudioVersion", $newgameversion);
|
||||
WebsiteSettings::UpdateSetting("StudioFileVersion", $gamefileversion);
|
||||
}
|
||||
|
||||
//output the new version
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
<?php
|
||||
|
||||
use Alphaland\Web\WebContextManager;
|
||||
use Alphaland\Web\WebsiteSettings;
|
||||
|
||||
WebContextManager::ForceHttpsCloudflare();
|
||||
|
||||
if(!($user->IsOwner())) {
|
||||
if (!($user->IsOwner())) {
|
||||
if ($user->IsAdmin()) {
|
||||
WebContextManager::Redirect("/");
|
||||
}
|
||||
|
|
@ -13,11 +14,14 @@ if(!($user->IsOwner())) {
|
|||
|
||||
adminPanelStats();
|
||||
|
||||
$alert = '';
|
||||
|
||||
$body = <<<EOT
|
||||
$securityVersion = WebsiteSettings::GetSetting('security_version');
|
||||
$md5Hash = WebsiteSettings::GetSetting('md5_hash');
|
||||
$gameFileVersion = WebsiteSettings::GetSetting('GameFileVersion');
|
||||
$studioFileVersion = WebsiteSettings::GetSetting('StudioFileVersion');
|
||||
|
||||
|
||||
$body = <<<EOT
|
||||
<div class="container">
|
||||
{$alert}
|
||||
<h5>Network Security Key Generator<h5>
|
||||
<h6>MAKE SURE TO DEPLOY RCC WITH UPDATED KEY</h6>
|
||||
<div class="row">
|
||||
|
|
@ -30,7 +34,7 @@ $alert = '';
|
|||
<h6>Game Security Version</h6>
|
||||
<div class="row marg-bot-15">
|
||||
<div class="col-sm">
|
||||
<input style="width:100%!important;" type="text" autocomplete="off" id="newgamesecurityversion" value="{$ws->security_version}" class="form-control">
|
||||
<input style="width:100%!important;" type="text" autocomplete="off" id="newgamesecurityversion" value="{$securityVersion}" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<h6>Generated Security Key</h6>
|
||||
|
|
@ -75,19 +79,19 @@ $alert = '';
|
|||
<h6>Game Executable Security Version</h6>
|
||||
<div class="row marg-bot-15">
|
||||
<div class="col-sm">
|
||||
<input style="width:100%!important;" type="text" autocomplete="off" id="gamesecurityver" value="{$ws->security_version}" class="form-control">
|
||||
<input style="width:100%!important;" type="text" autocomplete="off" id="gamesecurityver" value="{$securityVersion}" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<h6>Game Executable MD5 Hash</h6>
|
||||
<div class="row marg-bot-15">
|
||||
<div class="col-sm">
|
||||
<input style="width:100%!important;" type="text" autocomplete="off" id="gamemd5" value="{$ws->md5_hash}" class="form-control">
|
||||
<input style="width:100%!important;" type="text" autocomplete="off" id="gamemd5" value="{$md5Hash}" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<h6>Game Executable Version (separated by '.')</h6>
|
||||
<div class="row marg-bot-15">
|
||||
<div class="col-sm">
|
||||
<input style="width:100%!important;" type="text" autocomplete="off" id="gamefilever" value="{$ws->GameFileVersion}" class="form-control">
|
||||
<input style="width:100%!important;" type="text" autocomplete="off" id="gamefilever" value="{$gameFileVersion}" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<h6>Game Launcher File Version (separated by ',') Ex:1, 2, 3, 4</h6>
|
||||
|
|
@ -132,7 +136,7 @@ $alert = '';
|
|||
<h6>Studio Executable Version (separated by '.')</h6>
|
||||
<div class="row marg-bot-15">
|
||||
<div class="col-sm">
|
||||
<input style="width:100%!important;" type="text" autocomplete="off" id="studiofilever" value="{$ws->StudioFileVersion}" class="form-control">
|
||||
<input style="width:100%!important;" type="text" autocomplete="off" id="studiofilever" value="{$studioFileVersion}" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<h6>Studio Launcher File Version (separated by ',')</h6>
|
||||
|
|
@ -202,8 +206,8 @@ $alert = '';
|
|||
EOT;
|
||||
|
||||
pageHandler();
|
||||
$ph->pagetitle = "";
|
||||
$ph->pagetitle = "";
|
||||
$ph->navbar = "";
|
||||
$ph->body = $body;
|
||||
$ph->footer = "";
|
||||
$ph->output();
|
||||
$ph->output();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Alphaland\Web\WebContextManager;
|
||||
use Alphaland\Web\WebsiteSettings;
|
||||
|
||||
WebContextManager::ForceHttpsCloudflare();
|
||||
|
||||
|
|
@ -17,15 +18,9 @@ adminPanelStats();
|
|||
$devmode = false;
|
||||
|
||||
////db queries
|
||||
$maintenancequery = $pdo->prepare("SELECT * FROM websettings WHERE maintenance = 1");
|
||||
$maintenancequery->execute();
|
||||
|
||||
$status = $pdo->prepare("SELECT * FROM websettings WHERE maintenance = 1");
|
||||
$status->execute();
|
||||
|
||||
$websettings = $pdo->prepare("SELECT * FROM websettings");
|
||||
$websettings->execute();
|
||||
$websettings = $websettings->fetch(PDO::FETCH_OBJ);
|
||||
$isUnderMaitenance = WebsiteSettings::GetSetting('maintenance');
|
||||
$rccKey = WebsiteSettings::GetSetting('webservice_key');
|
||||
$ipWhitelist = WebsiteSettings::GetSetting("webservice_whitelist");
|
||||
////end db queries
|
||||
|
||||
////Third party web queries
|
||||
|
|
@ -127,43 +122,31 @@ if (isset($_POST['clearcachesubmit']))
|
|||
if (isset($_POST['submitwskey']))
|
||||
{
|
||||
$key = genHash(16);
|
||||
$setwskey = $pdo->prepare("UPDATE websettings SET webservice_key = :k");
|
||||
$setwskey->bindParam(":k", $key, PDO::PARAM_STR);
|
||||
$setwskey->execute();
|
||||
WebsiteSettings::UpdateSetting("webservice_key", $key);
|
||||
WebContextManager::Redirect("configuration");
|
||||
}
|
||||
|
||||
if (isset($_POST['setwsipwhitelist']))
|
||||
{
|
||||
$setwsip = $pdo->prepare("UPDATE websettings SET webservice_whitelist = :w");
|
||||
$setwsip->bindParam(":w", $_POST['setwsipwhitelist'], PDO::PARAM_STR);
|
||||
$setwsip->execute();
|
||||
WebsiteSettings::UpdateSetting("webservice_whitelist", $_POST['setwsipwhitelist']);
|
||||
WebContextManager::Redirect("configuration");
|
||||
}
|
||||
|
||||
if (isset($_POST['cachingon']))
|
||||
{
|
||||
$setapprovals = $pdo->prepare("UPDATE websettings SET avatarCaching = 1");
|
||||
$setapprovals->execute();
|
||||
WebsiteSettings::UpdateSetting("avatarCaching", true);
|
||||
WebContextManager::Redirect("configuration");
|
||||
}
|
||||
|
||||
if (isset($_POST['cachingoff']))
|
||||
{
|
||||
$setapprovals = $pdo->prepare("UPDATE websettings SET avatarCaching = 0");
|
||||
$setapprovals->execute();
|
||||
WebsiteSettings::UpdateSetting("avatarCaching", false);
|
||||
WebContextManager::Redirect("configuration");
|
||||
}
|
||||
|
||||
$maintenancestatus = "";
|
||||
if ($maintenancequery->rowCount() > 0)
|
||||
{
|
||||
$maintenancestatus = '<b style="background-color:#c9c9c9;color:red;padding:2px;">OFF</b>';
|
||||
if ($isUnderMaitenance === true)
|
||||
$maintenancestatus = '<b style="background-color:#c9c9c9;color:green;padding:2px;">ON</b>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$maintenancestatus = '<b style="background-color:#c9c9c9;color:red;padding:2px;">OFF</b>';
|
||||
}
|
||||
|
||||
$developmentmodestatus = "";
|
||||
if ($devmode)
|
||||
|
|
@ -236,7 +219,7 @@ $body = <<<EOT
|
|||
<div class="col-sm">
|
||||
<div class="input-group mb-3">
|
||||
<form action="" method="post">
|
||||
<input type="text" name="setwskey" class="form-control" value="{$websettings->webservice_key}" autocomplete="off" disabled>
|
||||
<input type="text" name="setwskey" class="form-control" value="{$rccKey}" autocomplete="off" disabled>
|
||||
<div class="input-group-append">
|
||||
<button type="submit" name="submitwskey" class="btn btn-danger" type="button">Generate</button>
|
||||
</div>
|
||||
|
|
@ -262,7 +245,7 @@ $body = <<<EOT
|
|||
</div>
|
||||
</form>
|
||||
<div class="container text-center marg-bot-15">
|
||||
<h6>Current Backend Whitelisted IP's: <hr><b style="background-color:#c9c9c9;color:red;padding:2px;">{$websettings->webservice_whitelist}</b></h6>
|
||||
<h6>Current Backend Whitelisted IP's: <hr><b style="background-color:#c9c9c9;color:red;padding:2px;">{$ipWhitelist}</b></h6>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,14 @@
|
|||
<?php
|
||||
|
||||
// WARNING: This is deprecated over html_clientsettings/v1/GetSetting, please implement this new route into any clients
|
||||
// as this endpoint will be removed in the future.
|
||||
|
||||
header('Content-Type: application/json');
|
||||
header("Cache-Control: no-cache, no-store");
|
||||
header("Pragma: no-cache");
|
||||
header("Expires: -1");
|
||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s T") . " GMT");
|
||||
|
||||
$ws = $pdo->query("SELECT * FROM websettings WHERE id = 1")->fetch(PDO::FETCH_OBJ);
|
||||
|
||||
echo $ws->ClientAppSettings;
|
||||
|
|
@ -1,3 +1,7 @@
|
|||
<?php
|
||||
|
||||
echo '{"ExeVersion": "'.$ws->GameFileVersion.'", "ValidateInstalledExeVersion": "True", "ShowInstallSuccessPrompt": "True"}';
|
||||
use Alphaland\Web\WebsiteSettings;
|
||||
|
||||
$gameFileVersion = WebsiteSettings::GetSetting('GameFileVersion');
|
||||
|
||||
echo '{"ExeVersion": "' . $gameFileVersion . '", "ValidateInstalledExeVersion": "True", "ShowInstallSuccessPrompt": "True"}';
|
||||
|
|
|
|||
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
|
||||
use Alphaland\Client\ClientSettingsApplications;
|
||||
use Alphaland\Web\WebContextManager;
|
||||
|
||||
header("Content-Type: application/json; charset=UTF-8");
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
|
||||
header("Pragma: no-cache");
|
||||
header("Expires: -1");
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] !== 'GET')
|
||||
{
|
||||
die("{}");
|
||||
}
|
||||
|
||||
if (!isset($_GET['key']))
|
||||
{
|
||||
die("{}");
|
||||
}
|
||||
|
||||
$key = cleanInput($_GET['key']);
|
||||
|
||||
|
||||
if (!ClientSettingsApplications::ApplicationExists($key))
|
||||
{
|
||||
// echo back empty json
|
||||
die("{}");
|
||||
}
|
||||
|
||||
if (!ClientSettingsApplications::ApplicationCanBeFetchedFromClientSettingsService($key))
|
||||
{
|
||||
// echo back empty json
|
||||
die("{}");
|
||||
}
|
||||
|
||||
$requiresIpWhitelist = ClientSettingsApplications::ApplicationRequiresIpWhitelist($key);
|
||||
$requiresRccAuth = ClientSettingsApplications::ApplicationRequiresRccServiceAuthentication($key);
|
||||
|
||||
if ($requiresIpWhitelist && !WebContextManager::IsCurrentIpAddressWhitelisted())
|
||||
{
|
||||
http_response_code(403);
|
||||
die("{}");
|
||||
}
|
||||
|
||||
if ($requiresRccAuth && !WebContextManager::VerifyAccessKeyHeader())
|
||||
{
|
||||
http_response_code(403);
|
||||
die("{}");
|
||||
}
|
||||
|
||||
$settings = ClientSettingsApplications::FetchCombinedApplicationDependencies($key);
|
||||
|
||||
if (empty($settings))
|
||||
{
|
||||
die("{}");
|
||||
}
|
||||
|
||||
echo json_encode($settings);
|
||||
|
|
@ -1,3 +1,7 @@
|
|||
<?php
|
||||
|
||||
echo '{"ExeVersion": "'.$ws->GameFileVersion.'", "ValidateInstalledExeVersion": "True", "ShowInstallSuccessPrompt": "True"}';
|
||||
use Alphaland\Web\WebsiteSettings;
|
||||
|
||||
$gameFileVersion = WebsiteSettings::GetSetting('GameFileVersion');
|
||||
|
||||
echo '{"ExeVersion": "' . $gameFileVersion . '", "ValidateInstalledExeVersion": "True", "ShowInstallSuccessPrompt": "True"}';
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
<?php
|
||||
|
||||
echo $ws->AlphalandVersion;
|
||||
use Alphaland\Web\WebsiteSettings;
|
||||
|
||||
echo WebsiteSettings::GetSetting('AlphalandVersion');
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
<?php
|
||||
|
||||
echo $ws->AlphalandStudioVersion;
|
||||
use Alphaland\Web\WebsiteSettings;
|
||||
|
||||
echo WebsiteSettings::GetSetting('AlphalandStudioVersion');
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Alphaland\Web\WebContextManager;
|
||||
use Alphaland\Web\WebsiteSettings;
|
||||
|
||||
if (!WebContextManager::VerifyAccessKeyHeader())
|
||||
{
|
||||
|
|
@ -11,6 +12,6 @@ header('Content-Type: application/json');
|
|||
|
||||
echo json_encode(array(
|
||||
"data" => array(
|
||||
$ws->md5_hash
|
||||
WebsiteSettings::GetSetting("md5_hash"),
|
||||
)
|
||||
), JSON_UNESCAPED_SLASHES);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Alphaland\Web\WebContextManager;
|
||||
use Alphaland\Web\WebsiteSettings;
|
||||
|
||||
if (!WebContextManager::VerifyAccessKeyHeader())
|
||||
{
|
||||
|
|
@ -11,6 +12,6 @@ header('Content-Type: application/json');
|
|||
|
||||
echo json_encode(array(
|
||||
"data" => array(
|
||||
$ws->security_version
|
||||
WebsiteSettings::GetSetting("security_version"),
|
||||
)
|
||||
), JSON_UNESCAPED_SLASHES);
|
||||
Loading…
Reference in New Issue