diff --git a/system/pages/highscores.php b/system/pages/highscores.php index 269c8ce4..7290673e 100644 --- a/system/pages/highscores.php +++ b/system/pages/highscores.php @@ -23,7 +23,7 @@ if(config('account_country') && $settingHighscoresCountryBox) $list = $_GET['list'] ?? 'experience'; $page = $_GET['page'] ?? 1; -$vocation = $_GET['vocation'] ?? 'all'; +$vocation = urldecode($_GET['vocation'] ?? 'all'); if(!is_numeric($page) || $page < 1 || $page > PHP_INT_MAX) { $page = 1; diff --git a/system/routes.php b/system/routes.php index c49b16b1..13cee37f 100644 --- a/system/routes.php +++ b/system/routes.php @@ -39,10 +39,10 @@ return [ [['GET', 'POST'], 'guilds/{guild:string}', 'guilds/show.php'], - ['GET', 'highscores/{list:alphanum}/{vocation:alphanum}/{page:int}', 'highscores.php'], - ['GET', 'highscores/{list:alphanum}/{page:int}', 'highscores.php'], - ['GET', 'highscores/{list:alphanum}/{vocation:alphanum}', 'highscores.php'], - ['GET', 'highscores/{list:alphanum}', 'highscores.php'], + ['GET', 'highscores/{list:string}/{vocation:string}/{page:int}', 'highscores.php'], + ['GET', 'highscores/{list:string}/{page:int}', 'highscores.php'], + ['GET', 'highscores/{list:string}/{vocation:string}', 'highscores.php'], + ['GET', 'highscores/{list:string}', 'highscores.php'], /* '/^polls\/[0-9]+\/?$/' => array('subtopic' => 'polls', 'id' => '$1'), '/^spells\/[A-Za-z0-9-_%]+\/[A-Za-z0-9-_]+\/?$/' => array('subtopic' => 'spells', 'vocation' => '$1', 'order' => '$2'), diff --git a/system/templates/highscores.html.twig b/system/templates/highscores.html.twig index 938220e5..71d2d26c 100644 --- a/system/templates/highscores.html.twig +++ b/system/templates/highscores.html.twig @@ -9,9 +9,8 @@ <td> <label for="skillFilter">Choose a Skill</label> <select onchange="location = this.value;" id="skillFilter"> - {% set i = 0 %} {% for link, name in types %} - <option value="{{ getLink('highscores') }}/{{ link }}{% if vocation is not null %}/{{ vocation }}{% endif %}" class="size_xs" {% if list is not null and list == link %}selected{% endif %}>{{ name }}</option> + <option value="{{ getLink('highscores') }}/{{ link }}{% if vocation is not null %}/{{ vocation|lower|urlencode }}{% endif %}" class="size_xs" {% if list is not null and list == link %}selected{% endif %}>{{ name }}</option> {% endfor %} </select> </td> @@ -19,9 +18,8 @@ <label for="vocationFilter">Choose a vocation</label> <select onchange="location = this.value;" id="vocationFilter"> <option value="{{ getLink('highscores') }}/{{ list }}" class="size_xs">[ALL]</option> - {% set i = 0 %} {% for i in 0..config.vocations_amount %} - <option value="{{ getLink('highscores') }}/{{ list }}/{{ config.vocations[i]|lower }}" class="size_xs" {% if vocationId is not null and vocationId == i %}selected{% endif %}>{{ config.vocations[i]}}</option> + <option value="{{ getLink('highscores') }}/{{ list }}/{{ config.vocations[i]|lower|urlencode }}" class="size_xs" {% if vocationId is not null and vocationId == i %}selected{% endif %}>{{ config.vocations[i]}}</option> {% endfor %} </select> </td> @@ -105,7 +103,7 @@ <tr bgcolor="{{ config.lightborder }}"> <td> {% for link, name in types %} - <a href="{{ getLink('highscores') }}/{{ link }}{% if vocation is not null %}/{{ vocation }}{% endif %}" class="size_xs">{{ name }}</a><br/> + <a href="{{ getLink('highscores') }}/{{ link }}{% if vocation is not null %}/{{ vocation|urlencode }}{% endif %}" class="size_xs">{{ name }}</a><br/> {% endfor %} </td> </tr> @@ -120,7 +118,7 @@ <td> <a href="{{ getLink('highscores') }}/{{ list }}" class="size_xs">[ALL]</a><br/> {% for i in 0..config.vocations_amount %} - <a href="{{ getLink('highscores') }}/{{ list }}/{{ config.vocations[i]|lower }}" class="size_xs">{{ config.vocations[i]}}</a><br/> + <a href="{{ getLink('highscores') }}/{{ list }}/{{ config.vocations[i]|lower|urlencode }}" class="size_xs">{{ config.vocations[i]}}</a><br/> {% endfor %} </td> </tr>