type != 9) PageBuilder::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); if ($_SERVER["REQUEST_METHOD"] == "POST") { $Name = $_POST["Name"] ?? ""; $Description = $_POST["Description"] ?? ""; $PlayerCount = $_POST["PlayerCount"] ?? 10; $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" && !in_array($PlaceTemplate, $TemplatePlaceIDs) && $PlaceTemplate != "custom") { $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($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"] > 30000000) { $Error = "Place File cannot be larger than 30 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); libxml_use_internal_errors(true); $SimpleXML = simplexml_load_string($PlaceXML); if ($SimpleXML === false) { 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; } } } } } if (!$Error) { db::run( "UPDATE assets SET name = :Name, description = :Description, comments = :CommentsAllowed, publicDomain = :PublicDomain, MaxPlayers = :MaxPlayers, 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, ":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); } redirect(encode_asset_name($Name) . "-place?id={$PlaceID}"); } } $TemplatePlaces = db::run("SELECT id, name, approved, TemplateOrder FROM assets WHERE id IN (" . implode(",", $TemplatePlaceIDs) . ") ORDER BY TemplateOrder"); PageBuilder::$Config["title"] = "Configures Place"; PageBuilder::BuildHeader(); ?>

Configure Place

Basic Settings

Gear Permissions

$GearEnabled) { ?>
>

Other Permissions

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

Place Templates

fetch(PDO::FETCH_OBJ)) { ?>
<?=Polygon::FilterText($TemplatePlace->name)?>

name)?>

Create from Place File">

Create from Place File