From ef84e6f782a93e578a0705e8738c702332569bc3 Mon Sep 17 00:00:00 2001 From: ruan Date: Sat, 22 Sep 2018 15:14:27 +0200 Subject: [PATCH] Use undashed UUIDs for URL parameters --- check.php | 1 + history.php | 2 +- inc/page.php | 7 ++++++- info.php | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/check.php b/check.php index e2f442e..f58773b 100644 --- a/check.php +++ b/check.php @@ -42,6 +42,7 @@ class Check { $this->println(str_replace("{name}", $name, $page->t("error.name.unseen"))); return; } + $uuid = $page->uuid_undashify($uuid); $href = "history.php?uuid=$uuid"; if ($type !== null) { diff --git a/history.php b/history.php index df0f20d..b675389 100644 --- a/history.php +++ b/history.php @@ -75,7 +75,7 @@ isset($_GET['uuid']) && is_string($_GET['uuid']) or die($page->t("error.missing- $staffhistory = (isset($_GET['staffhistory']) && $_GET['staffhistory'] === "1"); -$uuid = $_GET['uuid']; +$uuid = $page->uuid_dashify($_GET['uuid']); $name = $page->get_name($uuid); $name !== null or die(str_replace("{name}", $name, $page->t("error.name.unseen"))); diff --git a/inc/page.php b/inc/page.php index 8c9c54b..ed69dfe 100644 --- a/inc/page.php +++ b/inc/page.php @@ -214,7 +214,7 @@ class Page { } } - $uuid = str_replace("-", "", $uuid); + $uuid = $this->uuid_undashify($uuid); $src = str_replace('{name}', $name, str_replace('{uuid}', $uuid, $avatar_source)); if (in_array($name, $this->settings->console_aliases) || $name === $this->settings->console_name) { $src = $this->settings->console_image; @@ -430,6 +430,11 @@ class Page { return $newstr; } + function uuid_undashify($str) { + if (strlen($str) !== 36) return $str; + return str_replace('-', '', $str); + } + function print_title() { $title = $this->title; $name = $this->settings->name; diff --git a/info.php b/info.php index fd766bc..3aec79f 100644 --- a/info.php +++ b/info.php @@ -39,6 +39,7 @@ abstract class Info { } function history_link($player_name, $uuid, $args = "") { + $uuid = $this->page->uuid_undashify($uuid); return "$player_name"; }