Files
aowow/pages/compare.php
Sarjuuk 732226b44a BaseType:
- dropped property "names" and changed getField to return localized Fields if specified. Dropped stupid getNameFieldName() in the process as it was now obsolete.
 - made property "matches" private. Access through getMatches() that will execute the query _only_ when needed (which is basically always anyway (so much for optimization))

SpellList: parsing
 - ""fixed"" behavior of the amount-switch $l when used on russian text. It has 3 options instead of 2, no idea what the last one is for though
 - fixed extra leading whitespace occuring when parsing formulas

Lang:
 - removed offset from getMagicShools(), apparently it is unneeded :o

Util:
 - changed the output of formatTime() in the long version to be more correct in layout
 - initialized values in parseTime() to prevent empty strings returned by formatTime()
 - added asBin() and asHex() - helper to improve display of bitmasks (Spells are coming!)
 - update Spell-Effects/Auras and added misc strings to display different MiscValue-content

Filter:
 - removed escapes from $_POST-handler. If the input is erronous it should be corrected/ignored/noted by the $_GET-handler

Smarty:
 - added optinal parameter to saveCache(), loadCache() to better handle filter variables

Search:
 - changed $maxResults to 10 for OpenSearches in an effort to lower execution time and appied limits to all queries
 - changed result calculation for OpenSearch. It should now stick to it's limit of 10 results for the list
 - simplified WorldEvent search

global.js:
 - backported function to parse title-tag of dfn-elements into mouseover-tooltips
 - shortened document.getElementByTagName(x) calls to gE(document, x)
2013-04-26 17:02:35 +02:00

92 lines
2.8 KiB
PHP

<?php
if (!defined('AOWOW_REVISION'))
die('invalid access');
$pageData = array(
'items' => null,
'summary' => '[]'
);
$compareString = '';
// prefer $_GET over $_COOKIE
if (!empty($_GET['compare']))
$compareString = $_GET['compare'];
else if (!empty($_COOKIE['compare_groups']))
$compareString = urldecode($_COOKIE['compare_groups']);
if ($compareString)
{
$sets = explode(";", $compareString);
$items = [];
foreach ($sets as $set)
{
$itemsting = explode(":", $set);
$outString = [];
foreach ($itemsting as $substring)
{
$params = explode(".", $substring);
$items[] = (int)$params[0];
while (sizeof($params) < 7)
$params[] = 0;
$outString[] = $params;
// MATCH() AGAINST() for integers would be nice...
$res = DB::Aowow()->SelectRow(
"SELECT id FROM ?_itemset WHERE
item1 = ? OR item2 = ? OR item3 = ? OR item4 = ? OR item5 = ? OR
item6 = ? OR item7 = ? OR item8 = ? OR item9 = ? OR item10 = ?",
(int)$params[0], (int)$params[0], (int)$params[0], (int)$params[0], (int)$params[0], (int)$params[0], (int)$params[0], (int)$params[0], (int)$params[0], (int)$params[0]
);
if ($res)
$piecesAssoc[(int)$params[0]] = $res['id'];
}
$outSet[] = $outString;
}
$pageData['summary'] = json_encode($outSet, JSON_NUMERIC_CHECK);
$iList = new ItemList(array(['i.entry', $items]));
$data = $iList->getListviewData(ITEMINFO_SUBITEMS | ITEMINFO_JSON);
foreach ($data as $id => $item)
{
while ($iList->id != $id)
$iList->iterate();
$pageData['items'][] = [
$id,
Util::jsEscape($iList->getField('name', true)),
$iList->getField('Quality'),
$iList->getField('icon'),
json_encode($item, JSON_NUMERIC_CHECK)
];
}
}
$page = array(
'title' => Lang::$compare['compare'],
'tab' => 1,
'reqCSS' => array(
array('path' => 'template/css/Summary.css', 'condition' => false),
array('path' => 'template/css/Summary_ie6.css', 'condition' => 'lte IE 6'),
),
'reqJS' => array(
array('path' => 'template/js/Draggable.js'),
array('path' => 'template/js/filters.js'),
array('path' => 'template/js/Summary.js'),
array('path' => 'template/js/swfobject.js'),
array('path' => '?data=weight-presets.gems.enchants.itemsets'),
),
);
$smarty->updatePageVars($page);
$smarty->assign('lvData', $pageData);
$smarty->assign('lang', array_merge(Lang::$main, Lang::$compare));
$smarty->assign('mysql', DB::Aowow()->getStatistics());
$smarty->display('compare.tpl');
?>