From 3c69284e15d76d880cbcfc03a46d450272f1ac99 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Sat, 8 Aug 2015 00:46:31 +0200 Subject: [PATCH] Misc * fixed some recuring errors from db-log (mostly missing checks) --- includes/community.class.php | 2 ++ includes/types/basetype.class.php | 2 +- includes/types/gameobject.class.php | 5 +++-- includes/types/item.class.php | 4 ++-- localization/locale_dede.php | 4 ++-- localization/locale_enus.php | 4 ++-- localization/locale_eses.php | 4 ++-- localization/locale_frfr.php | 2 +- localization/locale_ruru.php | 4 ++-- pages/achievement.php | 4 ++-- pages/compare.php | 5 +++-- pages/search.php | 4 ++-- pages/spell.php | 4 ++-- 13 files changed, 26 insertions(+), 22 deletions(-) diff --git a/includes/community.class.php b/includes/community.class.php index 77afd721..b25c90f6 100644 --- a/includes/community.class.php +++ b/includes/community.class.php @@ -121,6 +121,8 @@ class CommunityContent case TYPE_RACE: $obj = new CharRaceList($cnd); break; case TYPE_SKILL: $obj = new SkillList($cnd); break; case TYPE_CURRENCY: $obj = new CurrencyList($cnd); break; + case TYPE_EMOTE: $obj = new EmoteList($cnd); break; + case TYPE_ENCHANTMENT: $obj = new EnchantmentList($cnd); break; default: continue; } diff --git a/includes/types/basetype.class.php b/includes/types/basetype.class.php index 23f9bc1b..91b911e1 100644 --- a/includes/types/basetype.class.php +++ b/includes/types/basetype.class.php @@ -888,7 +888,7 @@ abstract class Filter protected function modularizeString(array $fields, $string = '') { - if (!$string) + if (!$string && !empty($this->fiData['v']['na'])) $string = $this->fiData['v']['na']; $qry = []; diff --git a/includes/types/gameobject.class.php b/includes/types/gameobject.class.php index f93681f5..f1a12331 100644 --- a/includes/types/gameobject.class.php +++ b/includes/types/gameobject.class.php @@ -92,8 +92,9 @@ class GameObjectList extends BaseType $x = ''; $x .= ''; - if ($_ = Lang::gameObject('type', $this->curTpl['typeCat'])) - $x .= ''; + if ($this->curTpl['typeCat']) + if ($_ = Lang::gameObject('type', $this->curTpl['typeCat'])) + $x .= ''; if (isset($this->curTpl['lockId'])) if ($locks = Lang::getLocks($this->curTpl['lockId'])) diff --git a/includes/types/item.class.php b/includes/types/item.class.php index 1999f18e..e82409ee 100644 --- a/includes/types/item.class.php +++ b/includes/types/item.class.php @@ -653,7 +653,7 @@ class ItemList extends BaseType $x .= ''.Util::localizedString($gemEnch, 'name').'
'; // activation conditions for meta gems - if ($gemEnch['conditionId']) + if (!empty($gemEnch['conditionId'])) { if ($gemCnd = DB::Aowow()->selectRow('SELECT * FROM ?_itemenchantmentcondition WHERE id = ?d', $gemEnch['conditionId'])) { @@ -1469,7 +1469,7 @@ class ItemList extends BaseType for ($i = 1; $i < 6; $i++) { $enchId = $data['enchantId'.$i]; - if ($enchId <= 0) + if ($enchId <= 0 || empty($this->rndEnchIds[$enchId])) continue; if ($data['allocationPct'.$i] > 0) // RandomSuffix: scaling Enchantment; enchId < 0 diff --git a/localization/locale_dede.php b/localization/locale_dede.php index 23d5d8ce..cdc052a6 100644 --- a/localization/locale_dede.php +++ b/localization/locale_dede.php @@ -51,7 +51,7 @@ $lang = array( 'or' => " oder ", 'back' => "Zurück", 'reputationTip' => "Rufpunkte", - 'byUserTimeAgo' => "Von %1s vor %s", + 'byUserTimeAgo' => 'Von %1$s vor %s', // filter 'extSearch' => "Erweiterte Suche", @@ -470,7 +470,7 @@ $lang = array( 'titleReward' => 'Euch wird der Titel "%s" verliehen', 'slain' => "getötet", 'reqNumCrt' => "Benötigt", - 'rfAvailable' => "Verfügbar auf Realm:", + 'rfAvailable' => "Verfügbar auf Realm: ", '_transfer' => 'Dieser Erfolg wird mit %s vertauscht, wenn Ihr zur %s wechselt.', ), 'chrClass' => array( diff --git a/localization/locale_enus.php b/localization/locale_enus.php index 6fb4f55f..17abbdf6 100644 --- a/localization/locale_enus.php +++ b/localization/locale_enus.php @@ -46,7 +46,7 @@ $lang = array( 'or' => " or ", 'back' => "Back", 'reputationTip' => "Reputation points", - 'byUserTimeAgo' => "By %1s %s ago", + 'byUserTimeAgo' => 'By %1$s %s ago', // filter 'extSearch' => "Extended search", @@ -465,7 +465,7 @@ $lang = array( 'titleReward' => 'You shall be granted the title "%s"', 'slain' => "slain", 'reqNumCrt' => "Requires", - 'rfAvailable' => "Available on realm:", + 'rfAvailable' => "Available on realm: ", '_transfer' => 'This achievement will be converted to %s if you transfer to %s.', ), 'chrClass' => array( diff --git a/localization/locale_eses.php b/localization/locale_eses.php index c8a3b2c4..0dfded68 100644 --- a/localization/locale_eses.php +++ b/localization/locale_eses.php @@ -51,7 +51,7 @@ $lang = array( 'or' => " o ", 'back' => "Arrière", 'reputationTip' => "Puntos de reputación", - 'byUserTimeAgo' => "Por %1s hace %s", + 'byUserTimeAgo' => 'Por %1$s hace %s', // filter 'extSearch' => "Extender búsqueda", @@ -469,7 +469,7 @@ $lang = array( 'titleReward' => 'Deberías obtener el título "%s"', 'slain' => "matado", 'reqNumCrt' => "Requiere", - 'rfAvailable' => "Disponible en reino:", + 'rfAvailable' => "Disponible en reino: ", '_transfer' => 'Este logro será convertido a %s si lo transfieres a la %s.', ), 'chrClass' => array( diff --git a/localization/locale_frfr.php b/localization/locale_frfr.php index 7953a2f2..9bd718b5 100644 --- a/localization/locale_frfr.php +++ b/localization/locale_frfr.php @@ -51,7 +51,7 @@ $lang = array( 'or' => " ou ", 'back' => "Redro", 'reputationTip' => "Points de réputation", - 'byUserTimeAgo' => "Par %1s il y a %s", + 'byUserTimeAgo' => 'Par %1$s il y a %s', // filter 'extSearch' => "Recherche avancée", diff --git a/localization/locale_ruru.php b/localization/locale_ruru.php index b251b6e4..163a2101 100644 --- a/localization/locale_ruru.php +++ b/localization/locale_ruru.php @@ -51,7 +51,7 @@ $lang = array( 'or' => " или ", 'back' => "Назад", 'reputationTip' => "Очки репутации", - 'byUserTimeAgo' => "От %1s %s назад", + 'byUserTimeAgo' => 'От %1s %s назад', // filter 'extSearch' => "Расширенный поиск", @@ -468,7 +468,7 @@ $lang = array( 'titleReward' => 'Наградное звание: "%s"', 'slain' => "убито", 'reqNumCrt' => "Требуется", - 'rfAvailable' => "[Available on realm]:", + 'rfAvailable' => "[Available on realm]: ", '_transfer' => 'Этот предмет превратится в %s, если вы перейдете за %s.', ), 'chrClass' => array( diff --git a/pages/achievement.php b/pages/achievement.php index 6e5a6d26..d5bc2efd 100644 --- a/pages/achievement.php +++ b/pages/achievement.php @@ -103,13 +103,13 @@ class AchievementPage extends GenericPage if ($this->subject->getField('flags') & 0x100 && DB::isConnectable(DB_AUTH)) { $avlb = []; - foreach (DB::Auth()->selectCol('SELECT id AS ARRAY_KEY, name FROM realmlist WHERE allowedSecurityLevel = 0 AND gamebuild = ?d', WOW_VERSION) AS $rId => $name) + foreach (DB::Auth()->selectCol('SELECT id AS ARRAY_KEY, name FROM realmlist WHERE allowedSecurityLevel = 0 AND gamebuild = ?d', WOW_BUILD) AS $rId => $name) { if (!DB::isConnectable(DB_CHARACTERS . $rId)) continue; if (!DB::Characters($rId)->selectCell('SELECT 1 FROM character_achievement WHERE achievement = ?d LIMIT 1', $this->typeId)) - $avlb[] = $name; + $avlb[] = Util::ucWords($name); } if ($avlb) diff --git a/pages/compare.php b/pages/compare.php index 0c047bb6..92a2a573 100644 --- a/pages/compare.php +++ b/pages/compare.php @@ -74,8 +74,9 @@ class ComparePage extends GenericPage if (empty($data[$itemId])) continue; - foreach ($data[$itemId]['subitems'] as &$si) - $si['enchantment'] = implode(', ', $si['enchantment']); + if (!empty($data[$itemId]['subitems'])) + foreach ($data[$itemId]['subitems'] as &$si) + $si['enchantment'] = implode(', ', $si['enchantment']); $this->cmpItems[] = [ $itemId, diff --git a/pages/search.php b/pages/search.php index d1ca8de8..2fb62fe4 100644 --- a/pages/search.php +++ b/pages/search.php @@ -100,6 +100,8 @@ class SearchPage extends GenericPage if (CFG_MAINTENANCE && !User::isInGroup(U_GROUP_EMPLOYEE) && !($this->searchMask & SEARCH_TYPE_REGULAR)) $this->notFound(); + parent::__construct($pageCall, $pageParam); // just to set g_user and g_locale + // fill include, exclude and ignore $this->tokenizeQuery(); @@ -109,8 +111,6 @@ class SearchPage extends GenericPage $this->mode = CACHE_TYPE_NONE; $this->notFound(); } - - parent::__construct($pageCall, $pageParam); // just to set g_user and g_locale } private function tokenizeQuery() diff --git a/pages/spell.php b/pages/spell.php index 88f31696..8e0d16dd 100644 --- a/pages/spell.php +++ b/pages/spell.php @@ -1022,7 +1022,7 @@ class SpellPage extends GenericPage SELECT IF(t1.ID > 200000, t2.ID, t1.ID) FROM npc_trainer t1 LEFT JOIN npc_trainer t2 ON t2.SpellID = -t1.ID - WHERE t1.SpellID IN (?a)', + WHERE t1.SpellID = ?d', $this->typeId ); } @@ -1667,7 +1667,7 @@ class SpellPage extends GenericPage $foo['name'] .= $_; break; case 33: // Open Lock - $_ = Lang::spell('lockType', $effMV); + $_ = $effMV ? Lang::spell('lockType', $effMV) : $effMV; if ($_ && User::isInGroup(U_GROUP_EMPLOYEE)) $_ = sprintf(Util::$dfnString, Lang::spell('_value').Lang::main('colon').$effMV, $_); else if (!$_)
'.$this->getField('name', true).'
'.$_.'
'.$_.'