run("SELECT COUNT(*) FROM assets WHERE creator = :UserID AND type = 9", [":UserID" => SESSION["user"]["id"]])->fetchColumn(); $AllSlotsFilled = $PlaceCount >= SESSION["user"]["PlaceSlots"]; if ($_SERVER['REQUEST_METHOD'] == "POST") { if (!SESSION) error("You are not logged in"); $PlaceID = $_GET['PlaceID'] ?? false; $Name = $_GET['Name'] ?? ""; $Description = $_GET['Description'] ?? ""; $Uncopylocked = isset($_GET['PublicDomain']) && $_GET['PublicDomain'] == "true"; if($PlaceID) { $PlaceCheck = Database::singleton()->run( "SELECT type FROM assets WHERE id = :PlaceID AND creator = :UserID", [":PlaceID" => $PlaceID, ":UserID" => SESSION["user"]["id"]] ); if (!$PlaceCheck->rowCount()) error("You do not own this Place"); if ($PlaceCheck->fetchColumn() != 9) error("Not a Place"); } else { if ($AllSlotsFilled) error("You have used up all your place slots"); if (strlen($Name) == 0) error("Place Name cannot be empty"); if (strlen($Name) > 50) error("Place Name cannot longer than 50 characters"); if (strlen($Description) > 1000) error("Place Description cannot longer than 1000 characters"); } // the roblox client gzencodes the xml but fiddler automatically decodes it // so if we can't find xml then assume its gzencoded $xml = file_get_contents('php://input'); if (!stripos($xml, 'roblox')) $xml = gzdecode(file_get_contents('php://input')); try { @new SimpleXMLElement($xml); } catch(Exception $e) { error("Invalid XML"); } if (strlen($xml) > 32000000) error("Place cannot be larger than 32 megabytes"); // $xml = str_ireplace("http://www.roblox.com/asset/?id=", "%ROBLOXASSETURL%", $xml); // $xml = str_ireplace("http://www.roblox.com/asset?id=", "%ROBLOXASSETURL%", $xml); $xml = str_ireplace("http://".$_SERVER['HTTP_HOST']."/asset/?id=", "%ASSETURL%", $xml); $xml = str_ireplace("http://".$_SERVER['HTTP_HOST']."/asset?id=", "%ASSETURL%", $xml); $xml = preg_replace("/rbxasset:\/\/..\/[^<]*/", "", $xml); if ($PlaceID) { unlink(Polygon::GetSharedResource("assets/{$PlaceID}")); Database::singleton()->run("UPDATE assets SET updated = UNIX_TIMESTAMP() WHERE id = :PlaceID", [":PlaceID" => $PlaceID]); } else { $PlaceID = Catalog::CreateAsset([ "type" => 9, "creator" => SESSION["user"]["id"], "name" => $Name, "description" => $Description, "PublicDomain" => $Uncopylocked ? 1 : 0, "ServerRunning" => 0, "ActivePlayers" => 0, "MaxPlayers" => 10, // "Access" => "Friends", "Access" => "Everyone", "Visits" => 0, "Version" => 2010, "ChatType" => "Classic", "gear_attributes" => "{\"melee\":false,\"powerup\":false,\"ranged\":false,\"navigation\":false,\"explosive\":false,\"musical\":false,\"social\":false,\"transport\":false,\"building\":false}", "approved" => 1 ]); } file_put_contents(Polygon::GetSharedResource("assets/{$PlaceID}"), $xml); Gzip::Compress(Polygon::GetSharedResource("assets/{$PlaceID}")); Polygon::RequestRender("Place", $PlaceID); } $Places = Database::singleton()->run( "SELECT * from assets WHERE creator = :UserID AND type = 9 ORDER BY created DESC", [":UserID" => SESSION["user"]["id"]] ); ?>
|
You are about to publish this Place to Project Polygon. Please choose how you would like to save your work: |
|
|
Create a new Place on Project Polygon.
Choose this to create a brand new Place. Your existing Places will not be changed. |
|
| Update an existing Place on Project Polygon. Choose this to make changes to a Place you have previously created. You will have the opportunity to select which Place you wish to update. |
|
| Keep playing and exit later. | |