Neues CMS Ishop fix?

11/14/2016 18:15 Lorrix#1
Ich benutze das CMS: [Only registered and activated users can see links. Click Here To Register...]

Das problem ist wenn man ein item kauft kommt es immer auf slot 3 des IS-Lagers und sagt direkt das Lagerhaus ist voll wie fix ich das?

hilfe waere nice.

<?php $is = new Itemshop(); if(isset($_GET["cat"]) AND $is->categoryExists($_GET["cat"]) == false) { Core::redirect(Links::getUrl("itemshop"), 0); die(); } $cat = isset($_GET["cat"]) ? $_GET["cat"] : $is->getFirstCategory(); ?> <?php if(isset($_GET["buy"]) AND $is->itemExists($_GET["buy"]) AND User::isLogged()) { //echo '<div class="box">'; $itemInfo = $is->getItemInfo($_GET["buy"]); if($is->discountEnabled()) { $discount_price = ($itemInfo["price"] / 100) * (100 - $is->getDiscountPercent()); $price = round($discount_price); } else { $price = $itemInfo["price"]; } if($is->isPremium($itemInfo["id"])) { $type = $itemInfo["socket1"]; // 1 = silver_expire ; 2 = gold_expire ; 3 = money_drop_rate_expire $days = $itemInfo["socket0"]; // how long premium ? (in days) if (User::getCoins($_SESSION["username"]) < $price) { echo Core::result(Language::getTranslation("isNotEnough Coins"), 2); } elseif($type == 1 AND User::getSilverPremium($_SESSION["username"], true) > date('Y-m-d H:i:s')) { echo Core::result(Language::getTranslation("isSilverAct ive").Core::makeNiceDate(User::getSilverPremium($_ SESSION["username"], true)), 2); } elseif($type == 2 AND User::getGoldPremium($_SESSION["username"], true) > date('Y-m-d H:i:s')) { echo Core::result(Language::getTranslation("isGoldActiv e").Core::makeNiceDate(User::getGoldPremium($_SESS ION["username"], true)), 2); } elseif($type == 3 AND User::getYangPremium($_SESSION["username"], true) > date('Y-m-d H:i:s')) { echo Core::result(Language::getTranslation("isYangActiv e").Core::makeNiceDate(User::getYangPremium($_SESS ION["username"], true)), 2); } elseif($type == 123 AND ( User::getYangPremium($_SESSION["username"], true) > date('Y-m-d H:i:s') OR User::getSilverPremium($_SESSION["username"], true) > date('Y-m-d H:i:s') OR User::getGoldPremium($_SESSION["username"], true) > date('Y-m-d H:i:s') )) { echo Core::result(Language::getTranslation("isActive"), 2); } else { if($type == 1) { $is->log($_SESSION["username"], $itemInfo["name"], $type, $days, $price); User::updateSilverPremium($_SESSION["username"], $days); User::removeCoins($_SESSION["username"], $price); echo Core::result(Language::getTranslation("isSilverSuc cess"), 1); } elseif($type == 2) { $is->log($_SESSION["username"], $itemInfo["name"], $type, $days, $price); User::updateGoldPremium($_SESSION["username"], $days); User::removeCoins($_SESSION["username"], $price); echo Core::result(Language::getTranslation("isGoldSucce ss"), 1); } elseif($type == 3) { $is->log($_SESSION["username"], $itemInfo["name"], $type, $days, $price); User::updateYangPremium($_SESSION["username"], $days); User::removeCoins($_SESSION["username"], $price); echo Core::result(Language::getTranslation("isYangSucce ss"), 1); } elseif($type == 123) { $is->log($_SESSION["username"], $itemInfo["name"], $type, $days, $price); User::updateSilverPremium($_SESSION["username"], $days); User::updateGoldPremium($_SESSION["username"], $days); User::updateYangPremium($_SESSION["username"], $days); User::removeCoins($_SESSION["username"], $price); echo Core::result(Language::getTranslation("isPremiumSu ccess"), 1); } } } else { if (User::getCoins($_SESSION["username"]) < $price) { echo Core::result(Language::getTranslation("isNotEnough Coins"), 2); } elseif (User::hasEmptyItemShopMall($_SESSION["username"]) == false) { echo Core::result(Language::getTranslation("isNotEmptyI temshopMall"), 2); } else { if ($itemInfo["can_change_amount"] == 1 AND $itemInfo["max_amount"] > 0) { if (isset($_POST["buy"])) { $quantity = $_POST["quantity"]; if (!ctype_digit($quantity)) { $result = Core::result(Language::getTranslation("isNotValidQ uantity"), 2); } elseif (!$is->validQuantity($_GET["buy"], $quantity)) { $result = Core::result(Language::getTranslation("isNotValidR ange") . $itemInfo["max_amount"], 2); } elseif (User::getCoins($_SESSION["username"]) < $price * $quantity) { $result = Core::result(Language::getTranslation("isNotEnough Coins"), 2); } else { if ($itemInfo['addon_type'] == 0) { $attrtype0 = 0; $attrtype1 = 0; $attrvalue0 = 0; $attrvalue1 = 0; } else { $attrtype0 = 72; $attrtype1 = 71; $skoda = mt_rand(8, 30); $poskozeni = mt_rand(-18, -1); $attrvalue0 = $skoda; $attrvalue1 = $poskozeni; } if ($itemInfo["time_limit"] > 0) { $socket0 = strtotime("+ " . $itemInfo['time_limit'] . " seconds"); } else { $socket0 = $itemInfo["socket0"]; } $socket1 = $itemInfo["socket1"]; $socket2 = $itemInfo["socket2"]; User::removeCoins($_SESSION["username"], $price * $quantity); $is->generateItem($_SESSION["username"], $quantity, $itemInfo["item_id"], $attrtype0, $attrvalue0, $attrtype1, $attrvalue1, $socket0, $socket1, $socket2); if (Core::itemshopLogEnabled()) { $is->log($_SESSION["username"], $itemInfo["name"], $itemInfo["item_id"], $quantity, $price * $quantity); } $result = Core::result(Language::getTranslation("isBuySucces s"), 1); Core::redirect(Links::getUrl("itemshop"), 2); } } if (isset($result)) { echo $result; } ?> <div class="box"> <h2><?= Language::getTranslation("isVerifyAmount") ?></h2> <form method="post" action="<?= Links::getUrl("itemshop") . "/cat/".$cat."/buy/" . $_GET['buy'] ?>"> <div class="form-group"> <input type="number" name="quantity" class="form-control" id="quantity" required> </div> <button type="submit" name="buy" class="btn btn-primary login-btn"><?= Language::getTranslation("isSubmit"); ?></button> </form> </div> <?php } else { if ($itemInfo['addon_type'] == 0) { $attrtype0 = 0; $attrtype1 = 0; $attrvalue0 = 0; $attrvalue1 = 0; } else { $attrtype0 = 72; $attrtype1 = 71; $skoda = mt_rand(8, 30); $poskozeni = mt_rand(-18, -1); $attrvalue0 = $skoda; $attrvalue1 = $poskozeni; } if ($itemInfo["time_limit"] > 0) { $socket0 = strtotime("+ " . $itemInfo['time_limit'] . " seconds"); } else { $socket0 = $itemInfo["socket0"]; } $socket1 = $itemInfo["socket1"]; $socket2 = $itemInfo["socket2"]; User::removeCoins($_SESSION["username"], $price); $is->generateItem($_SESSION["username"], $itemInfo["count"], $itemInfo["item_id"], $attrtype0, $attrvalue0, $attrtype1, $attrvalue1, $socket0, $socket1, $socket2); if (Core::itemshopLogEnabled()) { $is->log($_SESSION["username"], $itemInfo["name"], $itemInfo["item_id"], $itemInfo["count"], $price); } echo Core::result(Language::getTranslation("isBuySucces s"), 1); Core::redirect(Links::getUrl("itemshop"), 2); } } } } ?> <div class="box tournament-detail"> <div class="row"> <div class="col-xs-9"> <h2><?= Language::getTranslation("isTitle");?></h2> <div style="margin-top:50px;"> <?php if($is->numberOfCategories() > 0) { foreach ($is->categories() as $row) { if(isset($cat) AND $cat == $row["id"]) { echo ' <a href="' . Links::getUrl("itemshop") . '/cat/' . $row["id"] . '" class="btn btn-primary btn-lg" style="margin-bottom:5px;">' . $row["name"] . '</a>'; } else { echo ' <a href="' . Links::getUrl("itemshop") . '/cat/' . $row["id"] . '" class="btn btn-inverse btn-lg" style="margin-bottom:5px;">' . $row["name"] . '</a>'; } } } else { echo Core::result(Language::getTranslation("isZeroCateg ories"),4); } ?> <br /><br /> <?php if(User::isLogged()) { echo '<li class="list-group-item">' . Language::getTranslation("isYourCoins") . ' <span class="text-primary">' . User::getCoins($_SESSION["username"]) . '</span> ' . Language::getTranslation("isBuyCoins") . '</li>'; } ?> </div> </div> <div class="col-xs-3"> <img src="assets/images/shop.png" class="img-responsive center-block" alt=""> </div> </div> <?php if($is->discountEnabled()) { ?> <p class="countdown-info"><i class="fa fa-bell-o"></i> Discount <span class="label label-danger"><?= $is->getDiscountPercent() ?> %</span> on all items: <i class="fa fa-bell-o"></i> </p> <div id="discountdate" class="hidden"><?= $is->getDiscountUntil() ?></div> <div class="countdown"></div> <?php } ?> </div> <div class="box"> <?php if($is->numberOfItems($cat) > 0) { // Paginator $page = isset($_GET["pagination"]) ? (int)$_GET["pagination"] : 1; $totalCount = $is->numberOfItems($cat); $perPage = $is->itemsPerPage(); $paginator = new Paginator($page, $totalCount, $perPage); // Paginator // Validate page if (isset($_GET["pagination"]) AND (!ctype_digit($_GET["pagination"]) OR $_GET["pagination"] > ceil($totalCount / $perPage) OR $_GET["pagination"] < 1)) { Core::redirect(Links::getUrl("itemshop"), 0); die(); } // Validate page // Print all news and pagination links global $dbname; $is->printItems("SELECT * FROM " . $dbname . ".itemshop_items WHERE category_id = ? LIMIT ? OFFSET ?", array($cat, $perPage, $paginator->offset())); $paginator->printLinks("itemshop/cat/".$cat."/page/", "pagination"); // Print all news and pagination links } else { echo Core::result(Language::getTranslation("isZeroItems "), 4); } ?> </div>




public function generateItem($username, $count, $vnum, $attrtype0, $attrvalue0, $attrtype1, $attrvalue1, $socket0, $socket1, $socket2)
{
$dbplayer = Core::getPlayerDatabase();
//22
$query = Database::queryAlone("INSERT INTO ".$dbplayer.".item
(owner_id,window,pos,`count`,vnum,attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3,
attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6, socket0, socket1, socket2) VALUES
(?, 'MALL', 2, ?, ?, ?, ?, ?, ?, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ?, ?, ?)",
array(User::getAccountID($username), $count, $vnum, $attrtype0, $attrvalue0, $attrtype1, $attrvalue1, $socket0, $socket1, $socket2));
11/14/2016 20:10 iPeri /..#2
Direkt alles auf einen Blick!
Wer braucht schon eine anständige Formatierung, ich meine wir setzen bei PHP ja eher auf Funktionalität...
11/14/2016 20:59 Lorrix#3
Hier sind die 2 files: