public function main() { $url_data = WoW::GetUrlData('vault'); // Check session if ($url_data['action0'] != 'vault') { // Wrong URL parsing header('Location: ' . WoW::GetWoWPath() . '/wow/'); exit; } if (!WoW_Account::IsLoggedIn()) { header('Location: ' . WoW::GetWoWPath() . '/login/?ref=' . urlencode($_SERVER['REQUEST_URI'])); exit; } WoW_Template::SetTemplateTheme('wow'); switch ($url_data['action1']) { case 'character': switch ($url_data['action2']) { case 'auction': $auction_side = $url_data['action3']; if (!$auction_side || !in_array($auction_side, array('alliance', 'horde', 'neutral'))) { WoW::RedirectTo('wow/' . WoW_Locale::GetLocale() . '/vault/character/auction/' . WoW_Account::GetActiveCharacterInfo('faction_text')); } // Check active character if (WoW_Account::GetActiveCharacterInfo('guid') == 0) { WoW::RedirectTo(); } switch ($url_data['action4']) { default: WoW_Template::SetPageData('auction_side', $auction_side); WoW_Template::SetPageIndex('auction_lots'); WoW_Template::SetPageData('page', 'auction_lots'); break; case 'cancel': // Cancelling, adding, etc. requires core support! if (!isset($_POST['auc'])) { exit; } $auction_id = (int) $_POST['auc']; header('Content-type: text/plain'); echo WoW_Auction::CancelAuction($auction_id); exit; /* if(isset($_POST['auc'])) { $auction_id = (int) $_POST['auc']; // WoW REMOTE FEATURE } file_put_contents('cancel.txt', print_r($_POST, true)); exit; */ break; } break; default: WoW_Template::ErrorPage(404); break; } break; default: WoW_Template::ErrorPage(404); break; } WoW_Template::LoadTemplate('page_index'); }
private static function HandleSellingItems() { if (self::$selling_count <= 0 || !is_array(self::$myitems_storage)) { return false; } $item_ids = array(); $item_ids_guids = array(); $items_data = array(); foreach (self::$myitems_storage as $item) { $item_ids[] = $item['item_template']; $item_ids_guids[$item['itemguid']] = $item['item_template']; $items_data[$item['itemguid']] = $item; } $items = DB::World()->select("SELECT `entry`, `name`, `Quality`, `displayid` FROM `item_template` WHERE `entry` IN (%s)", $item_ids); if (!$items) { return false; } $items_storage = array(); $displayids = array(); foreach ($items as $item) { $items_storage[$item['entry']] = $item; $displayids[] = $item['displayid']; } $icons = DB::WoW()->select("SELECT `displayid`, `icon` FROM `DBPREFIX_icons` WHERE `displayid` IN (%s)", $displayids); if (!$icons) { return false; } $icons_storage = array(); foreach ($icons as $icon) { $icons_storage[$icon['displayid']] = $icon['icon']; } unset($icons); self::$items_storage = array(); self::$buyout_price = 0; foreach ($item_ids_guids as $item_guid => $item_id) { if (isset($items_storage[$item_id])) { $item = new WoW_Item(WoWConfig::$Realms[WoW_Account::GetActiveCharacterInfo('realmId')]['type']); $item->LoadFromDBByEntry($item_guid, $item_id); $auc_time = $items_data[$item_guid]['time']; $now = time(); $auction_time = 0; if ($now - $auc_time <= 48 * IN_HOURS) { $auction_time = 3; } elseif ($now - $auc_time <= 24 * IN_HOURS) { $auction_time = 2; } elseif ($now - $auc_time <= 12 * IN_HOURS) { $auction_time = 1; } self::$items_storage[] = array('auction_id' => $items_data[$item_guid]['id'], 'guid' => $item_guid, 'id' => $items_storage[$item_id]['entry'], 'quality' => $items_storage[$item_id]['Quality'], 'name' => WoW_Locale::GetLocaleId() == LOCALE_EN ? $items_storage[$item_id]['name'] : WoW_Items::GetItemName($item_id), 'icon' => $icons_storage[$items_storage[$item_id]['displayid']], 'price_raw' => $items_data[$item_guid]['startbid'], 'price' => WoW_Utils::GetMoneyFormat($items_data[$item_guid]['startbid']), 'buyout_raw' => $items_data[$item_guid]['buyoutprice'], 'buyout' => WoW_Utils::GetMoneyFormat($items_data[$item_guid]['buyoutprice']), 'lastbid' => $items_data[$item_guid]['lastbid'], 'count' => $item->GetStackCount(), 'time' => $auction_time); self::$buyout_price += $items_data[$item_guid]['buyoutprice']; } } unset($items, $items_storage, $displayids); return true; }
<th class="price" id="buyout-total"> <?php $total_price = WoW_Auction::GetBuyOutTotalPrice(); $money_format = WoW_Utils::GetMoneyFormat($total_price); echo sprintf('<span class="hide">%d</span><span class="icon-gold">%d</span> <span class="icon-silver">%d</span> <span class="icon-copper">%d</span>', $total_price, $money_format['gold'], $money_format['silver'], $money_format['copper']); ?> </th> <th> </th> </tr> </tfoot> <tbody> <?php $auction_items = WoW_Auction::GetSellingItems(); if (is_array($auction_items)) { $toggleStyle = 2; foreach ($auction_items as $item) { echo sprintf('<tr id="auction-%d" class="row%d"> <td class="item" data-raw="-4 %s"> <a href="%s/wow/' . WoW_Locale::GetLocale() . '/item/%d" data-item="t=true&i=%d&s=%d" class="icon-frame frame-36" style="background-image: url(\'http://eu.media.blizzard.com/wow/icons/36/%s.jpg\');"> </a> <a href="%s/wow/' . WoW_Locale::GetLocale() . '/item/%d" data-item="t=true&i=%d&s=%d" class="color-q%d"><strong>%s</strong></a><br /> <a href="%s">%s</a> <span class="png-fix" data-tooltip="%s"> <img src="%s/wow/static/images/character/auction/me.png" alt="" style="margin-bottom: -3px" /> </span> </td> <td class="quantity">%d</td> <td class="time" data-raw="%d">
// Try to catch some operations (login, logout, etc.) $locale_loaded = false; WoW::CatchOperations($locale_loaded); // locale from page controller $wow_locale_cms = isset($_COOKIE['wow_locale']) ? $_COOKIE['wow_locale'] : WoWConfig::$DefaultLocale; if (!isset($_COOKIE['wow_locale'])) { setcookie('wow_locale', $wow_locale_cms, strtotime('NEXT YEAR'), '/'); $_COOKIE['wow_locale'] = $wow_locale_cms; } $pController = new PageController(); if ($pController->GetLocale() != null && $pController->GetLocale() != $_COOKIE['wow_locale']) { //$_SESSION['wow_locale'] = $pController->GetLocale(); WoW_Locale::SetLocale($pController->GetLocale(), WoW_Locale::GetLocaleIDForLocale($pController->GetLocale()), true); } else { WoW_Locale::SetLocale($_COOKIE['wow_locale'], WoW_Locale::GetLocaleIDForLocale($_COOKIE['wow_locale'])); } // Initialize account (if user already logged in we need to re-build his info from session data) WoW_Account::Initialize(); if (isset($_COOKIE['wow_session']) && !WoW_Account::IsLoggedIn()) { WoW_Account::loadFromCookieSession(); } // Initialize auction handler WoW_Auction::InitAuction(); // TODO: this initialization should be moved in some other place. // Display wow revision (if required; do not remove). if (isset($_GET['_DISPLAYVERSION_'])) { die('WOW_REVISION: ' . WOW_REVISION); } // RunOnce define('__RUNONCE__', true); include INCLUDES_DIR . 'RunOnce.php';
<script type="text/javascript"> //<![CDATA[ $(function() { var active = new Table('#auctions-active', { column: 2, method: 'numeric' }); var sold = new Table('#auctions-sold', { column: 4, method: 'numeric', type: 'desc' }); var ended = new Table('#auctions-ended', { column: 4, method: 'numeric' }); }); //]]> </script> <div class="auction-house auctions"> <div id="auctions-active" class="table-section"> <?php if (WoW_Auction::GetSellingItemsCount() > 0) { WoW_Template::LoadTemplate('block_auction_my_lots'); } else { echo sprintf('<div class="table-bar bar-disabled"> <span class="toggler">%s</span> </div> <div class="empty-result"> %s </div>', WoW_Locale::GetString('template_auction_active_auctions'), WoW_Locale::GetString('template_auction_no_active_auctions')); } ?> </div> <div id="auctions-sold" class="table-section"> <div class="table-bar bar-disabled">
<span class="icon-silver"><?php echo $money['gold'] > 0 ? $money['silver'] : '--'; ?> </span> <span class="icon-copper"><?php echo $money['gold'] > 0 ? $money['copper'] : '--'; ?> </span> </span> <?php echo WoW_Locale::GetString('template_auction_earned'); ?> </li> <li> <span class="float-right"> <?php echo WoW_Auction::GetMailsCount(); ?> /50 (<?php echo WoW_Utils::GetPercent(50, WoW_Auction::GetMailsCount()); ?> %) </span> <?php echo WoW_Locale::GetString('template_auction_mailbox'); ?> </li> </ul> </div> </div>