From 033a9181ae71493c8e04e0636a14e7bb20954fdd Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Tue, 21 Oct 2025 17:28:15 +0200 Subject: [PATCH] =?UTF-8?q?Profiler/Localization=20=20*=20TCs=20guild=20an?= =?UTF-8?q?d=20arena=5Fteam=20tables=20as=20encoded=20as=20utf8mb4=5Fgener?= =?UTF-8?q?al=5Fci,=20=20=20=20which=20is=20not=20accent-aware.=20So=20we?= =?UTF-8?q?=20have=20to=20get=20all=20results=20and=20filter=20=20=20=20fo?= =?UTF-8?q?r=20the=20correct=20one=20in=20php.=20=20*=20fixes=20an=20issue?= =?UTF-8?q?=20where=20direcly=20accessing=20a=20guild/arena-team=20whith?= =?UTF-8?q?=20a=20name=20=20=20=20simiar=20to=20an=20already=20known=20gui?= =?UTF-8?q?ld/team=20would=20lookup=20the=20wrong=20subject=20=20=20=20on?= =?UTF-8?q?=20the=20server=20and=20then=20fail=20to=20create=20a=20local?= =?UTF-8?q?=20stub=20with=20already=20existing=20key.=20=20=20=20(Sh=C3=A2?= =?UTF-8?q?d=C3=B3w=20vs=20Shadow)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- endpoints/arena-team/arena-team.php | 4 +++- endpoints/guild/guild.php | 4 +++- endpoints/profile/profile.php | 6 ++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/endpoints/arena-team/arena-team.php b/endpoints/arena-team/arena-team.php index 2ade7851..2d50aa08 100644 --- a/endpoints/arena-team/arena-team.php +++ b/endpoints/arena-team/arena-team.php @@ -57,8 +57,10 @@ class ArenateamBaseResponse extends TemplateResponse } // 2) not yet synced but exists on realm (wont work if we get passed an urlized name, but there is nothing we can do about it) - else if ($subject = DB::Characters($this->realmId)->selectRow('SELECT at.`arenaTeamId` AS "realmGUID", at.`name`, at.`type` FROM arena_team at WHERE at.`name` = ?', Util::ucFirst($this->subjectName))) + $subjects = DB::Characters($this->realmId)->select('SELECT at.`arenaTeamId` AS "realmGUID", at.`name`, at.`type` FROM arena_team at WHERE at.`name` = ?', $this->subjectName); + if ($subject = array_filter($subjects, fn($x) => Util::lower($x['name']) == Util::lower($this->subjectName))) { + $subject = $subject[0]; $subject['realm'] = $this->realmId; $subject['cuFlags'] = PROFILER_CU_NEEDS_RESYNC; $subject['nameUrl'] = Profiler::urlize($subject['name']); diff --git a/endpoints/guild/guild.php b/endpoints/guild/guild.php index f4ec2335..fa247e40 100644 --- a/endpoints/guild/guild.php +++ b/endpoints/guild/guild.php @@ -57,8 +57,10 @@ class GuildBaseResponse extends TemplateResponse } // 2) not yet synced but exists on realm (wont work if we get passed an urlized name, but there is nothing we can do about it) - else if ($subject = DB::Characters($this->realmId)->selectRow('SELECT `guildid` AS "realmGUID", `name` FROM guild WHERE `name` = ?', Util::ucFirst($this->subjectName))) + $subjects = DB::Characters($this->realmId)->select('SELECT `guildid` AS "realmGUID", `name` FROM guild WHERE `name` = ?', $this->subjectName); + if ($subject = array_filter($subjects, fn($x) => Util::lower($x['name']) == Util::lower($this->subjectName))) { + $subject = $subject[0]; $subject['realm'] = $this->realmId; $subject['cuFlags'] = PROFILER_CU_NEEDS_RESYNC; $subject['nameUrl'] = Profiler::urlize($subject['name']); diff --git a/endpoints/profile/profile.php b/endpoints/profile/profile.php index 958ffaae..39484228 100644 --- a/endpoints/profile/profile.php +++ b/endpoints/profile/profile.php @@ -82,15 +82,17 @@ class ProfileBaseResponse extends TemplateResponse $this->notFound(); // 2) not yet synced but exists on realm (and not a gm character) - if ($subject = DB::Characters($this->realmId)->selectRow( + $subjects = DB::Characters($this->realmId)->select( 'SELECT c.`guid` AS "realmGUID", c.`name`, c.`race`, c.`class`, c.`level`, c.`gender`, c.`at_login`, g.`guildid` AS "guildGUID", IFNULL(g.`name`, "") AS "guildName", IFNULL(gm.`rank`, 0) AS "guildRank" FROM characters c LEFT JOIN guild_member gm ON gm.`guid` = c.`guid` LEFT JOIN guild g ON g.`guildid` = gm.`guildid` WHERE c.`name` = ? AND `level` <= ?d AND (`extra_flags` & ?d) = 0', Util::ucFirst($this->subjectName), MAX_LEVEL, Profiler::CHAR_GMFLAGS - )) + ); + if ($subject = array_filter($subjects, fn($x) => Util::lower($x['name']) == Util::lower($this->subjectName))) { + $subject = $subject[0]; $subject['realm'] = $this->realmId; $subject['cuFlags'] = PROFILER_CU_NEEDS_RESYNC;