prepare("SELECT * FROM assets WHERE id = :i"); $q->bindParam(":i", $id, PDO::PARAM_INT); $q->execute(); if($q->rowCount() > 0) { //item parameters $iteminfo = getAssetInfo($id); $itemname = cleanOutput($iteminfo->Name); $itemdescription = cleanOutput($iteminfo->Description); $itemprice = $iteminfo->PriceInAlphabux; $itemtypeint = $iteminfo->AssetTypeId; $types = assetTypeArray(); $itemtype = $types[$itemtypeint]; $itemrender = getAssetRender($id); //... //only allow shirts, pants and t shirts to be modified by the end user if ($itemtypeint == 2 or $itemtypeint == 11 or $itemtypeint == 12 or $user->isOwner()) { //handle onsale checkbox $onsalestatus = ""; if ($iteminfo->IsForSale == 0) { $onsalestatus = ""; } else { $onsalestatus = "checked"; } //... if (isset($_POST['Submit'])) { //price check parameters $minimumprice = 0; $pricealert = ""; if ($itemtypeint == 2) { $minimumprice = 2; //tshirt $pricealert = "Price too low, must be atleast 2 Alphabux"; } elseif ($itemtypeint == 11) { $minimumprice = 5; //shirt $pricealert = "Price too low, must be atleast 5 Alphabux"; } elseif ($itemtypeint == 12) { $minimumprice = 5; //pants $pricealert = "Price too low, must be atleast 5 Alphabux"; } //... if (strlen($_POST['item_name']) < 3) { $alert = ""; } /* elseif(strlen($_POST['item_description']) < 3) { $alert = ""; } */ elseif(strlen($_POST['item_price']) < 1) { $alert = ""; } elseif(strlen($_POST['item_name']) > 50) { $alert = ""; } elseif(strlen($_POST['item_description']) > 1000) { $alert = ""; } elseif(strlen($_POST['item_price']) > 8) { $alert = ""; } elseif($_POST['item_price'] < $minimumprice) { $alert = ""; } else { if ($user->IsStaff()) { UserModerationManager::LogAction("Configure Item ".$id); } //update item name $c = $pdo->prepare("UPDATE assets SET Name = :n, Updated = UNIX_TIMESTAMP() WHERE id = :i"); $c->bindParam(":n", $_POST['item_name'], PDO::PARAM_STR); //item name $c->bindParam(":i", $id, PDO::PARAM_INT); //catalog id $c->execute(); // ... //update item description $c = $pdo->prepare("UPDATE assets SET Description = :n, Updated = UNIX_TIMESTAMP() WHERE id = :i"); $c->bindParam(":n", $_POST['item_description'], PDO::PARAM_STR); //item description $c->bindParam(":i", $id, PDO::PARAM_INT); //catalog id $c->execute(); // ... //update item price $c = $pdo->prepare("UPDATE assets SET PriceInAlphabux = :n, Updated = UNIX_TIMESTAMP() WHERE id = :i"); $c->bindParam(":n", $_POST['item_price'], PDO::PARAM_INT); //item price $c->bindParam(":i", $id, PDO::PARAM_INT); //catalog id $c->execute(); // ... if (isset($_POST['onsale_checkbox'])) { if ($user->IsStaff()) { UserModerationManager::LogAction("Configure Item Onsale ".$id); } //update onsale $onsale = 1; $c = $pdo->prepare("UPDATE assets SET IsForSale = :n, Updated = UNIX_TIMESTAMP() WHERE id = :i"); $c->bindParam(":n", $onsale, PDO::PARAM_INT); //item name $c->bindParam(":i", $id, PDO::PARAM_INT); //catalog id $c->execute(); // ... } else { UserModerationManager::LogAction("Configure Item Offsale ".$id); //update onsale $onsale = 0; $c = $pdo->prepare("UPDATE assets SET IsForSale = :n, Updated = UNIX_TIMESTAMP() WHERE id = :i"); $c->bindParam(":n", $onsale, PDO::PARAM_INT); //item name $c->bindParam(":i", $id, PDO::PARAM_INT); //catalog id $c->execute(); // ... } WebContextManager::Redirect("config?id={$id}"); } } elseif (isset($_POST['RegenItem'])) //for admin regen stuff { if ($user->IsStaff()) { $script = ""; $scripttype = ""; UserModerationManager::LogAction("Render Item ".$id); if ($itemtypeint == 8) { //Hat if (!Render::RenderHat($id)) { $alert = ""; } else { $alert = ""; } } elseif ($itemtypeint == 2) { //T Shirt if (!Render::RenderTShirt($id)) { $alert = ""; } else { $alert = ""; } } elseif ($itemtypeint == 4) { //Mesh if (!Render::RenderMesh($id)) { $alert = ""; } else { $alert = ""; } } elseif ($itemtypeint == 11) { //Shirt if (!Render::RenderShirt($id)) { $alert = ""; } else { $alert = ""; } } elseif ($itemtypeint == 12) { //Pants if (!Render::RenderPants($id)) { $alert = ""; } else { $alert = ""; } } elseif ($itemtypeint == 18) { //Faces if (!Render::RenderFace($id)) { $alert = ""; } else { $alert = ""; } } elseif ($itemtypeint == 19) { //Gears if (!Render::RenderGear($id)) { $alert = ""; } else { $alert = ""; } } elseif ($itemtypeint == 17) { //Heads if (!Render::RenderHead($id)) { $alert = ""; } else { $alert = ""; } } elseif ($itemtypeint == 32) { //Packages if (!Render::RenderPackage($id)) { $alert = ""; } else { $alert = ""; } } elseif ($itemtypeint == 10) { //Models if (!Render::RenderModel($id)) { $alert = ""; } else { $alert = ""; } } } else { $alert = ""; } } elseif (isset($_POST['ModerateItem'])) //for mods { if ($user->IsStaff()) { $moderation = moderateAsset($id); if ($moderation !== TRUE) { $alert = ""; } else { WebContextManager::Redirect("/catalog/view?id=".$id); } } } } else { //not a modifiable asset (to the end user) WebContextManager::Redirect("/"); } } else { //catalog item doesnt exist WebContextManager::Redirect("/"); } } else { //no url parameter WebContextManager::Redirect("/"); } $moderatebutton = ''; $regenbutton = ''; if ($user->IsStaff()) { $regenbutton = ''; $moderatebutton = ''; } $body = <<
{$alert}
Configure {$itemname}

{$moderatebutton} {$regenbutton}
EOT; pageHandler(); $ph->body = $body; $ph->output();