$page = $_GET['page'];
$name_filter = $_GET['search'];
$category_filter = $_GET['cat'];
$token = time();
$_SESSION['token'] = $token;
$items = $Market->getMarketItems($page, $name_filter, $category_filter);
if (is_array($items)) {
echo '<ul class="items">';
foreach ($items as $thisItem) {
$itemData = $Items->ItemInfo($thisItem['item']);
$price = $Market->showStyledPrice($thisItem['price_type'], $thisItem['price']);
$itemDb = $Market->getItemInfo($itemData['type'], $itemData['id'], $thisItem['sticklevel']);
$seller = $thisItem['seller'];
if (0 < $itemDb['exc']) {
$level = '+'.$itemData['level'].'';
} else {
$level = '';
}
if ($itemData['level']) {
$itemData['level'] = ' +'.$itemData['level'];
} else {
$itemData['level'] = null;
}
if ($itemData['luck']) {
$luck = '<br><font color=#9aadd5>'.$itemData['luck'].'</font>';
} else {
$luck = '';
}
if ($itemData['skill']) {
$skill = '<br><font color=#9aadd5>'.$itemData['skill'].'</font>';
} else {
$skill = '';
}
if ($itemData['opt']) {
$option = '<font color=#9aadd5>'.$itemData['opt'].'</font>';
} else {
$option = '';
}
if ($itemData['exl']) {
$exl = '<font color=#4d668d>'.str_replace('^^', '<br>', $itemData['exl']).'</font>';
} else {
$exl = '';
}
if ($itemData['ancsetopt']) {
$ancsetopt = '<font color=#9aadd5>'.str_replace('^^', '<br>', $itemData['ancsetopt']).'</font>';
} else {
$ancsetopt = '';
}
$exl = str_replace("'", "\\'", $exl);
echo "\r\n <li class=\"item\">\r\n <div id=\"hover\"></div>\r\n <span onmouseover=\"Tip('<center><img src=".$itemData['thumb'].'><br /><font color=yellow><br>'.lang('market_txt_100', true).' '.$itemData['sn2'].$itemData['sn'].'</font><br><font color=white><br>'.lang('market_txt_101', true).' '.$itemData['dur'].'</font><br><font color=#FF99CC>'.$itemData['jog'].'</font><font color=FFCC00>'.$itemData['harm'].'</font><br>'.$option.' '.$luck.' '.$skill.' '.$exl.' <br>'.$ancsetopt.'<br><font color=#4d668d>'.$itemData['socket'].'</font><br><br><span class=itemTooltipClassReq>'.$itemInfo['classReq']."</span></center>', TITLEFONTCOLOR, '".$itemData['color']."',TITLE,'".addslashes($itemData['name']).$itemData['level']."',TITLEBGCOLOR,'".$itemData['anco']."')\" onmouseout=\"UnTip()\">\r\n <img id=\"icon\" class=\"q4\" src=\"".$itemData['thumb']."\">\r\n </span>\r\n <div id=\"middle\"> \r\n <span style=\"color:".$itemData['color'].';background-color:'.$itemData['anco'].'; padding: 2px 2px 2px 2px;">'.$itemData['name'].' '.$level.'</span> | '.$price;
if (mconfig('hide_author')) {
echo '<p>'.sprintf(lang('market_txt_198', true), date($config['time_date_format'], strtotime($thisItem['start_date']))).'</p>';
} else {
echo '<p>'.sprintf(lang('market_txt_189', true), $thisItem['seller'], date($config['time_date_format'], strtotime($thisItem['start_date']))).'</p>';
}
echo "\r\n </div>\r\n <form name=\"item\" method=\"post\">\r\n <input type=\"hidden\" name=\"".Encode('id').'" value="'.Encode($thisItem['id'])."\">\r\n <input type=\"hidden\" name=\"token\" value=\"".$token.'">';
if ($_SESSION['username'] === $seller) {
echo '<input type="submit" name="buyitem" value="'.lang('market_txt_190', true)."\" onclick=\"javascript:if(!confirm('".lang('market_txt_200', true)."')){ return false; }\"/ class=\"simple_button purchase_button\">";
} else {
echo '<input type="submit" name="buyitem" value="'.lang('market_txt_191', true)."\" onclick=\"javascript:if(!confirm('".lang('market_txt_199', true)."')){ return false; }\"/ class=\"simple_button purchase_button\">";
}
echo "\r\n </form>\r\n <div class=\"clear\"></div>\r\n </li>";
}
echo '</ul>';
} else {
message('info', lang('market_txt_192', true));
}