run("SELECT type FROM assets WHERE id = :id AND creator = :uid", [":id" => $modelId, ":uid" => $userid]); if(!$query->rowCount()) error("You do not own this Model"); if($query->fetchColumn() != 10) error("Not a Model"); } else { if(!strlen($name)) error("Model Name cannot be empty"); if(strlen($name) > 50) error("Model Name cannot longer than 50 characters"); if(strlen($desc) > 1000) error("Model Description cannot longer than 1000 characters"); if(!strlen($desc)) $desc = "Model"; } // 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) > 16000000) error("Model cannot be larger than 16 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); $isScript = stripos($xml, 'class="Script" referent="RBX0"'); if($modelId) unlink(Polygon::GetSharedResource("assets/{$modelId}")); else $modelId = Catalog::CreateAsset([ "type" => 10, "creator" => SESSION["user"]["id"], "name" => $name, "description" => $desc, "sale" => (int)$free, "PublicDomain" => (int)$free, "approved" => (int)$isScript ]); file_put_contents(Polygon::GetSharedResource("assets/{$modelId}"), $xml); Gzip::Compress(Polygon::GetSharedResource("assets/{$modelId}")); if(!$postModelId && $isScript) { //put script image as thumbnail Image::RenderFromStaticImage("Script", $modelId); } elseif(!$isScript) { // user uploaded models are rendered as "usermodels" - this is just normal model rendering except there's no alpha // no roblox thumbnails had transparency up until like 2013 anyway so its not that big of a deal Polygon::RequestRender("UserModel", $modelId); } } $models = Database::singleton()->run("SELECT * from assets WHERE creator = :uid AND type = 10 ORDER BY created DESC", [":uid" => $userid]); ?> Save
rowCount()) { ?>

You are about to publish this Model to Project Polygon. Please choose how you would like to save your work:

Create a new Model on Project Polygon.
Choose this to create a brand new Model. Your existing Models will not be changed.
Update an existing Model on Project Polygon.
Choose this to make changes to a Model you have previously created. You will have the opportunity to select which Model you wish to update.
Keep playing and exit later.