Merge branch '0.9' into develop

This commit is contained in:
slawkens 2023-08-15 22:06:18 +02:00
commit 14c8160020
2 changed files with 60 additions and 51 deletions

View File

@ -1387,39 +1387,48 @@ function getChangelogWhere($v)
return 'unknown';
}
function getPlayerNameByAccount($id)
function getPlayerNameByAccountId($id)
{
global $vowels, $ots, $db;
if(is_numeric($id))
{
$player = new OTS_Player();
$player->load($id);
if($player->isLoaded())
return $player->getName();
else
{
$playerQuery = $db->query('SELECT `id` FROM `players` WHERE `account_id` = ' . $id . ' ORDER BY `lastlogin` DESC LIMIT 1;')->fetch();
global $db;
$tmp = "*Error*";
/*
$acco = new OTS_Account();
$acco->load($id);
if(!$acco->isLoaded())
return "Unknown name";
if (!is_numeric($id)) {
return '';
}
foreach($acco->getPlayersList() as $p)
{
$player= new OTS_Player();
$player->find($p);*/
$player->load($playerQuery['id']);
//echo 'id gracza = ' . $p . '<br/>';
if($player->isLoaded())
$tmp = $player->getName();
// break;
//}
$account = new OTS_Account();
$account->load($id);
if ($account->isLoaded()) {
$query = $db->query('SELECT `name` FROM `players` WHERE `account_id` = ' . $id . ' ORDER BY `lastlogin` DESC LIMIT 1;');
return $tmp;
if (!$query || !$query->rowCount()) {
return '';
}
return $query->fetch(PDO::FETCH_ASSOC)['name'];
}
return '';
}
function getPlayerNameByAccount($account) {
if (is_numeric($account)) {
return getPlayerNameByAccountId($account);
}
return '';
}
function getPlayerNameById($id)
{
if (!is_numeric($id)) {
return '';
}
$player = new OTS_Player();
$player->load($id);
if ($player->isLoaded()) {
return $player->getName();
}
return '';
@ -1427,13 +1436,13 @@ function getPlayerNameByAccount($id)
function echo_success($message)
{
echo '<div class="col-12 success mb-2">' . $message . '</div>';
echo '<div class="col-12 alert alert-success mb-2">' . $message . '</div>';
}
function echo_error($message)
{
global $error;
echo '<div class="col-12 error mb-2">' . $message . '</div>';
echo '<div class="col-12 alert alert-error mb-2">' . $message . '</div>';
$error = true;
}

View File

@ -5,27 +5,27 @@
<div style="text-align:center"><h2>Ranking for {{ skillName }}{% if vocation is not null %} ({{ vocation }}){% endif %} on {{ config.lua.serverName }}</h2></div><br/>
<table border="0" cellpadding="4" cellspacing="1" width="100%">
<tr>
<td>Filters</td>
<td>
<label for="vocationFilter">Choose a Skill</label>
<select onchange="location = this.value;" aria-label="skillFilter" id="skillFilter">
{% set i = 0 %}
{% for link, name in types %}
<option value="{{ getLink('highscores') }}/{{ link }}{% if vocation is defined %}/{{ vocation }}{% endif %}" class="size_xs">{{ name }}</option>
{% endfor %}
</select>
</td>
<td>
<label for="vocationFilter">Choose a vocation</label>
<select onchange="location = this.value;" aria-label="vocationFilter" id="vocationFilter">
<option value="{{ getLink('highscores') }}/{{ list }}" class="size_xs">[ALL]</option>
{% set i = 0 %}
{% for i in 1..config.vocations_amount %}
<option value="{{ getLink('highscores') }}/{{ list }}/{{ config.vocations[i]|lower }}" class="size_xs">{{ config.vocations[i]}}</option>
{% endfor %}
</select>
</td>
</tr>
<td>Filters</td>
<td>
<label for="vocationFilter">Choose a Skill</label>
<select onchange="location = this.value;" aria-label="skillFilter" id="skillFilter">
{% set i = 0 %}
{% for link, name in types %}
<option value="{{ getLink('highscores') }}/{{ link }}{% if vocation is defined %}/{{ vocation }}{% endif %}" class="size_xs">{{ name }}</option>
{% endfor %}
</select>
</td>
<td>
<label for="vocationFilter">Choose a vocation</label>
<select onchange="location = this.value;" aria-label="vocationFilter" id="vocationFilter">
<option value="{{ getLink('highscores') }}/{{ list }}" class="size_xs">[ALL]</option>
{% set i = 0 %}
{% for i in 1..config.vocations_amount %}
<option value="{{ getLink('highscores') }}/{{ list }}/{{ config.vocations[i]|lower }}" class="size_xs">{{ config.vocations[i]}}</option>
{% endfor %}
</select>
</td>
</tr>
</table>
<table border="0" cellpadding="4" cellspacing="1" width="100%">
<tr bgcolor="{{ config.vdarkborder }}">