$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) > 15000000) error("Model cannot be larger than 15 megabytes"); $xml = str_ireplace("http://www.roblox.com/asset/?id=", "%ASSETURL%", $xml); $xml = str_ireplace("http://www.roblox.com/asset?id=", "%ASSETURL%", $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($_SERVER['DOCUMENT_ROOT']."/asset/files/$modelId"); else $modelId = Catalog::CreateAsset([ "type" => 10, "creator" => SESSION["userId"], "name" => $name, "description" => $desc, "sale" => $free ? 1 : 0, "PublicDomain" => $free ? 1 : 0, "approved" => $isScript ? 1 : 0 ]); file_put_contents($_SERVER['DOCUMENT_ROOT']."/asset/files/$modelId", $xml); Gzip::Compress($_SERVER['DOCUMENT_ROOT']."/asset/files/$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 = db::run("SELECT * from assets WHERE creator = :uid AND type = 10 ORDER BY created DESC", [":uid" => $userid]); ?>
|
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. | |