creator != SESSION["user"]["id"]) PageBuilder::instance()->errorCode(404); if($item->type == 19) Catalog::$GearAttributes = json_decode($item->gear_attributes, true); $alert = false; $itemLocation = Polygon::GetSharedResource("assets/{$item->id}"); $ItemURL = encode_asset_name($item->name) . "-item?id={$item->id}"; if ($item->approved == 2 || !file_exists($itemLocation)) { $AssetData = "This asset is deleted."; } else if ($item->type == 10) { $AssetData = Gzip::Decompress($itemLocation); } else { $AssetData = file_get_contents($itemLocation); } if($_SERVER['REQUEST_METHOD'] == 'POST') { $name = $_POST['name'] ?? ""; $description = $_POST['description'] ?? ""; $comments = isset($_POST['comments']) && $_POST['comments'] == "on"; $sale = isset($_POST['sell']) && $_POST['sell'] == "on"; $sell_for_price = isset($_POST['sell-for-currency']) && $_POST['sell-for-currency'] == "on"; $price = $sell_for_price && isset($_POST['sell-price']) ? $_POST['sell-price'] : false; $file = $_FILES["file"] ?? false; Catalog::ParseGearAttributes(); if($sale && $sell_for_price && $price === "") $sell_for_price = $price = false; if(!strlen($name)) { $alert = ["text" => "Item name cannot be empty", "color" => "danger"]; } else if(Polygon::IsExplicitlyFiltered($name)) { $alert = ["text" => "The name contains inappropriate text", "color" => "danger"]; } else if(mb_strlen($name, "utf-8") > 50) { $alert = ["text" => "Item name cannot be any longer than 50 characters", "color" => "danger"]; } else if(strlen($description) > 1000) { $alert = ["text" => "Item description cannot be any longer than 1000 characters", "color" => "danger"]; } else if(Polygon::IsExplicitlyFiltered($description)) { $alert = ["text" => "The description contains inappropriate text", "color" => "danger"]; } else if($sale && $sell_for_price && !is_numeric($price)) { $alert = ["text" => "Item price is invalid", "color" => "danger"]; } else if($sale && $sell_for_price && $price < 0) { $alert = ["text" => "Item price cannot be less than zero", "color" => "danger"]; } else if($sale && $sell_for_price && $price > (2**31)) { $alert = ["text" => "Item price is too large", "color" => "danger"]; } else { $item->name = $name; $item->description = $description; $item->comments = $comments; if($item->type != 1) $item->sale = $sale; if(in_array($item->type, [2, 8, 11, 12, 17, 18, 19])) $item->price = $price; if($item->type == 10) $item->publicDomain = $item->sale; if($item->type == 19) $item->gear_attributes = json_encode(Catalog::$GearAttributes); if($file && $file["size"]) { if ($item->approved == 2) { $alert = ["text" => "You cannot update the asset data of deleted assets", "color" => "danger"]; } else if($isAdmin && !in_array($item->type, [1, 3, 10])) { copy($file["tmp_name"], $itemLocation); if($item->type == 10) Gzip::Compress($itemLocation); } else if($item->type == 3) { $image = new Upload($file); if(!$image->uploaded) { $alert = ["text" => "Failed to process image - please contact an admin", "color" => "danger"]; } else { $image->allowed = ['image/png', 'image/jpg', 'image/jpeg']; $image->image_convert = 'png'; Thumbnails::UploadAsset($image, $item->id, 420, 420); } } else if($item->type == 1) { $image = new Upload($file); if(!$image->uploaded) { $alert = ["text" => "Failed to process image - please contact an admin", "color" => "danger"]; } else { $image->allowed = ['image/png', 'image/jpg', 'image/jpeg']; $image->image_convert = 'png'; Image::Process($image, ["name" => $item->id, "resize" => false, "dir" => "assets/"]); Thumbnails::UploadAsset($image, $item->id, 420, 420, ["keepRatio" => true, "align" => "C"]); } } } Database::singleton()->run( "UPDATE assets SET name = :name, description = :description, comments = :comments, sale = :sale, price = :price, gear_attributes = :gear, updated = UNIX_TIMESTAMP() WHERE id = :id", [ ":name" => $item->name, ":description" => $item->description, ":comments" => $item->comments ? 1 : 0, ":sale" => $item->sale ? 1 : 0, ":price" => is_numeric($item->price) ? $item->price : 0, ":gear" => $item->gear_attributes, ":id" => $item->id ] ); if (SESSION["user"]["id"] != $item->creator && $item->creator != 1) { Users::LogStaffAction("[ Asset Modification ] Updated \"{$item->name}\" [" . Catalog::GetTypeByNum($item->type) . " ID {$item->id}]"); } $alert = ["text" => "Your changes to this item have been saved (".date('h:i:s A').")", "color" => "primary"]; } } $pageBuilder = new PageBuilder(["title" => "Configure ".Catalog::GetTypeByNum($item->type)]); $pageBuilder->buildHeader(); ?>

Configure type)?>

Back
px-2 py-1" role="alert">
<?=htmlspecialchars($item->name)?>
type, [1, 3, 10])) { ?>
Update asset data Download
Preview:
type == 1 || $item->type == 3) { ?>
Set thumbnail
type == 3) { ?>Note: thumbnail should be in a 1:1 aspect ratio, like an album cover
Turn comments on/off

Choose whether or not this item is open for comments.

comments?' checked="checked"':''?>>
type == 19) { ?>
>
>
>
>
>
>
>
>
>
type, [2, 8, 11, 12, 17, 18, 19])) { //clothing ?>
Sell this Item

Check the box below and enter a price if you want to sell this item in the catalog.

Uncheck the box to remove the item from the catalog.

sale?' checked="checked"':''?>>
sale?'':' style="display:none"'?>>
price?' checked="checked"':''?>>
price?' value="'.$item->price.'"':' disabled="disabled"'?>>
type, [13, 3, 5, 10])) { //decal ?>
Make Free

Choose whether or not this item is freely available.

sale?' checked="checked"':''?>>
Cancel
Back buildFooter(); ?>