run("SELECT * FROM assets WHERE TemplateOrder IS NOT NULL ORDER BY TemplateOrder")->fetchAll(); $PlayerCounts = range(1, 20); $Versions = [2010, 2011, 2012]; $Error = false; $PlaceInfo = Catalog::GetAssetInfo($PlaceID); if (!$PlaceInfo || $PlaceInfo->type != 9) PageBuilder::instance()->errorCode(404); if (!$IsAdmin && $PlaceInfo->creator != SESSION["user"]["id"]) redirect(encode_asset_name($PlaceInfo->name) . "-place?id={$PlaceID}"); Catalog::$GearAttributes = json_decode($PlaceInfo->gear_attributes, true); function IsTemplatePlace($PlaceID) { global $TemplatePlaces; foreach ($TemplatePlaces as $TemplatePlace) { if ($TemplatePlace["id"] == $PlaceID) return true; } return false; } if ($_SERVER["REQUEST_METHOD"] == "POST") { $Name = $_POST["Name"] ?? ""; $Description = $_POST["Description"] ?? ""; $PlayerCount = $_POST["PlayerCount"] ?? 10; $Access = $_POST["Access"] ?? "Everyone"; $Version = $_POST["Version"] ?? 2010; $PlaceTemplate = $_POST["PlaceTemplateSelection"] ?? "none"; $ChatType = $_POST["ChatType"] ?? "Classic"; $Copylocked = ($_POST["Copylocked"] ?? "") == "on"; $CommentsAllowed = ($_POST["CommentsAllowed"] ?? "") == "on"; $PlaceUpload = $_FILES["PlaceUpload"] ?? false; Catalog::ParseGearAttributes(); if (!strlen($Name)) { $Error = "Place Name is required"; } else if (strlen($Name) > 50) { $Error = "Place Name cannot be longer than 50 characters"; } else if (Polygon::IsExplicitlyFiltered($Name)) { $Error = "Place Name contains inappropriate text"; } else if (strlen($Description) > 1000) { $Error = "Place Description cannot be longer than 1000 characters"; } else if (Polygon::IsExplicitlyFiltered($Description)) { $Error = "Place Description contains inappropriate text"; } else if ($PlaceTemplate != "none" && $PlaceTemplate != "custom" && !IsTemplatePlace($PlaceTemplate)) { $Error = "Invalid Place Template selected"; } else if (!in_array((int)$PlayerCount, $PlayerCounts)) { $Error = "Maximum Visitor Count must be within 1 - 20 Players"; } else if (!in_array((int)$Version, $Versions)) { $Error = "Invalid Place Version selected"; } else if (!in_array($Access, ["Everyone", "Friends"])) { $Error = "Invalid access level selected"; } /* else if ($Access != "Friends" && $Version != "2011") { $Error = "2010 and 2012 places must be set to friends-only"; } */ else if (!in_array($ChatType, ["Classic", "Bubble", "Both"])) { $Error = "Invalid Chat Type selected"; } else if ($PlaceTemplate == "custom" && ($PlaceUpload === false || $PlaceUpload["size"] == 0)) { $Error = "No Place File has been selected for upload"; } else if ($PlaceTemplate == "custom" && $PlaceUpload["size"] > 32000000) { $Error = "Place File cannot be larger than 32 megabytes"; } else { if ($PlaceTemplate == "custom") { $PlaceXML = file_get_contents($PlaceUpload["tmp_name"]); $PlaceXML = str_ireplace("http://".$_SERVER['HTTP_HOST']."/asset/?id=", "%ASSETURL%", $PlaceXML); $PlaceXML = str_ireplace("http://".$_SERVER['HTTP_HOST']."/asset?id=", "%ASSETURL%", $PlaceXML); $PlaceXML = preg_replace("/rbxasset:\/\/..\/[^<]*/", "", $PlaceXML); libxml_use_internal_errors(true); $SimpleXML = simplexml_load_string($PlaceXML); if ($SimpleXML === false) { // temporary hack ini_set('memory_limit', '256M'); foreach (libxml_get_errors() as $XMLError) { // ignore "invalid xmlChar value" error // this can trigger false positives as some scripts may use binary xml characters if ($XMLError->code != 9) { $Error = "Place File is invalid, are you sure it is an older format place file?"; break; } } ini_set('memory_limit', '128M'); } } } if (!$Error) { Database::singleton()->run( "UPDATE assets SET name = :Name, description = :Description, comments = :CommentsAllowed, publicDomain = :PublicDomain, MaxPlayers = :MaxPlayers, Access = :Access, Version = :Version, ChatType = :ChatType, gear_attributes = :Gears, updated = UNIX_TIMESTAMP() WHERE id = :PlaceID", [ ":PlaceID" => $PlaceID, ":Name" => $Name, ":Description" => $Description, ":CommentsAllowed" => (int)$CommentsAllowed, ":PublicDomain" => (int)!$Copylocked, ":MaxPlayers" => $PlayerCount, ":Access" => $Access, ":Version" => $Version, ":ChatType" => $ChatType, ":Gears" => json_encode(Catalog::$GearAttributes) ] ); if ($PlaceTemplate != "none") { $PlaceLocation = Polygon::GetSharedResource("assets/{$PlaceID}"); unlink($PlaceLocation); if ($PlaceTemplate == "custom") { file_put_contents($PlaceLocation, $PlaceXML); Gzip::Compress($PlaceLocation); } else { copy(Polygon::GetSharedResource("assets/{$PlaceTemplate}"), $PlaceLocation); } Polygon::RequestRender("Place", $PlaceID); } if (SESSION["user"]["id"] != $PlaceInfo->creator && $PlaceInfo->creator != 1) { Users::LogStaffAction("[ Asset Modification ] Updated \"{$Name}\" [Place ID {$PlaceID}]"); } redirect("/" . encode_asset_name($Name) . "-place?id={$PlaceID}"); } } $pageBuilder = new PageBuilder(["title" => "Configure Place"]); $pageBuilder->buildHeader(); ?>

Configure Place

Basic Settings

Gear Permissions

$GearEnabled) { ?>
>

Other Permissions

publicDomain ? "" : " checked=\"checked\""?>>
comments ? " checked=\"checked\"" : ""?>>

Place Templates

"> " alt="" src="">

">

Update from Place File">

Update from Place File

buildFooter(); ?>