removed duplicate code

This commit is contained in:
Igor Barkov [iwork] 2019-02-15 20:25:31 +02:00
parent 920c524f40
commit ad560090f3

View File

@ -89,6 +89,8 @@ if ($byingItemId) {
}
}
$classPrintControlName = "marketbuy";
if ($get === 'sale') {
$data = db::c()->query('SELECT `inventory`.*,
`magic`.`name` AS `magic_name`,
@ -101,6 +103,7 @@ if ($get === 'sale') {
0 AS `maxdur`
FROM `inventory` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE `setsale` = 0 AND `dressed` = 0 AND `present` = "?s" AND `owner` = ?i ORDER BY `update` DESC ', '', $_SESSION['uid']);
$classPrintControlName = "marketput";
}
elseif ($get === 'unsale') {
@ -115,6 +118,7 @@ elseif ($get === 'unsale') {
0 AS `maxdur`
FROM `inventory` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE `setsale` > 0 AND `dressed` = 0 AND `owner` = ?i ORDER BY `update` DESC', $_SESSION['uid']);
$classPrintControlName = "marketgetback";
}
else if (!empty($_POST['search'])) {
@ -187,37 +191,17 @@ MARKET;
<TD><!--Рюкзак-->
<TABLE BORDER=0 WIDTH=100% CELLSPACING="1" CELLPADDING="2" BGCOLOR="#A5A5A5">
<?php
if ($get === 'sale') {
foreach ($iteminfo as $ii) {
echo "<tr><td style='width: 150px; text-align: center;'>";
$ii->printImage();
$ii->printControls('marketput');
$ii->printControls($classPrintControlName);
echo "</td>";
echo "<td style='vertical-align: top;'>";
$ii->printInfo();
echo "</td></tr>";
}
} elseif ($get === 'unsale') {
foreach ($iteminfo as $ii) {
echo "<tr><td style='width: 150px; text-align: center;'>";
$ii->printImage();
$ii->printControls('marketgetback');
echo "</td>";
echo "<td style='vertical-align: top;'>";
$ii->printInfo();
echo "</td></tr>";
}
} else {
foreach ($iteminfo as $ii) {
echo "<tr><td style='width: 150px; text-align: center;'>";
$ii->printImage();
$ii->printControls('marketbuy');
echo "</td>";
echo "<td style='vertical-align: top;'>";
$ii->printInfo();
echo "</td></tr>";
}
}
?>
</TABLE>
</TD>