Skip to content

Commit

Permalink
[434] Properly handle some search filters
Browse files Browse the repository at this point in the history
  • Loading branch information
Shadez committed Dec 30, 2010
1 parent 53eec3d commit 5aa4ef9
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 10 deletions.
15 changes: 10 additions & 5 deletions includes/classes/class.items.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* @package World of Warcraft Armory
* @version Release Candidate 1
* @revision 433
* @revision 434
* @copyright (c) 2009-2010 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
Expand Down Expand Up @@ -2582,13 +2582,18 @@ public function GenerateEnchantmentSpellData($spellID) {
* @access public
* @param string $key
* @param string $row = 'type'
* @param string $type = null
* @return int
**/
public function GetItemTypeInfo($key, $row = 'type') {
if($key == 'all' || ($row != 'type' && $row != 'subtype')) {
return false;
public function GetItemTypeInfo($key, $row = 'type', $type = null) {
if(($key == 'all' && $type == null) || (!in_array($row, array('type', 'subtype')))) {
return -1;
}
$info = $this->armory->aDB->selectCell("SELECT `%s` FROM `ARMORYDBPREFIX_item_sources` WHERE `key`='%s' LIMIT 1", $row, $key);
if(!$info) {
$info = $this->armory->aDB->selectCell("SELECT `%s` FROM `ARMORYDBPREFIX_item_sources` WHERE `key`='%s' LIMIT 1", $row, $type);
}
return $this->armory->aDB->selectCell("SELECT `%s` FROM `ARMORYDBPREFIX_item_sources` WHERE `key`='%s' LIMIT 1", $row, $key);
return $info;
}

/**
Expand Down
14 changes: 11 additions & 3 deletions includes/classes/class.search.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* @package World of Warcraft Armory
* @version Release Candidate 1
* @revision 433
* @revision 434
* @copyright (c) 2009-2010 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
Expand Down Expand Up @@ -832,8 +832,16 @@ private function HandleItemFilters($item_ids = null, $data = null) {
if($this->get_array['type'] != 'all') {
$type_info = Items::GetItemTypeInfo($this->get_array['type'], 'type');
}
if((isset($this->get_array['subTp'])) && $this->get_array['subTp'] != 'all') {
$subType_info = Items::GetItemTypeInfo($this->get_array['subTp'], 'subtype');
if((isset($this->get_array['subTp']))) {
if($this->get_array['subTp'] != 'all') {
$subType_info = Items::GetItemTypeInfo($this->get_array['subTp'], 'subtype');
}
elseif($this->get_array['subTp'] == 'all' && in_array($this->get_array['type'], array('mounts', 'minipets', 'misc', 'reagents'))) {
$subType_info = Items::GetItemTypeInfo($this->get_array['subTp'], 'subtype', $this->get_array['type']);
}
}
elseif(in_array($this->get_array['type'], array('mounts', 'minipets', 'misc', 'reagents'))) {
$subType_info = Items::GetItemTypeInfo('all', 'subtype', $this->get_array['type']);
}
if($type_info != -1 && $subType_info != -1) {
$sql .= sprintf(" (`item_template`.`class`='%d' AND `item_template`.`subclass`='%d') AND", $type_info, $subType_info);
Expand Down
4 changes: 2 additions & 2 deletions includes/revision_nr.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
define('ARMORY_REVISION', 433);
define('DB_VERSION', 'armory_r416');
define('ARMORY_REVISION', 434);
define('DB_VERSION', 'armory_r434');
define('CONFIG_VERSION', '2812201001');
?>
4 changes: 4 additions & 0 deletions sql/updates/armory_r434_armory_item_sources.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
UPDATE `armory_db_version` SET `version` = 'armory_r434';
UPDATE `armory_item_sources` SET `type` = '15', `subtype` = '4' WHERE `key` = 'misc' LIMIT 1 ;
INSERT IGNORE INTO `armory_item_sources` ( `key` , `parent` , `item` , `type` , `subtype` ) VALUES ('reagents', '0', '0', '15', '1');
INSERT IGNORE INTO `armory_item_sources` ( `key` , `parent` , `item` , `type` , `subtype` ) VALUES ('recipes', '0', '0', '9', '0');

0 comments on commit 5aa4ef9

Please sign in to comment.