Skip to content

Commit

Permalink
Merge branch '0.9' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
slawkens committed Jun 30, 2023
2 parents a3bfdc1 + 5aed9ee commit ac40922
Show file tree
Hide file tree
Showing 22 changed files with 78 additions and 38 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Cypress
on:
pull_request:
branches: [develop]
branches: [0.9]
push:
branches: [develop]
branches: [0.9]

jobs:
cypress:
Expand Down Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Checkout MyAAC
uses: actions/checkout@v3
with:
ref: develop
ref: 0.9

- name: Checkout TFS
uses: actions/checkout@v3
Expand Down
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## [0.9.0-alpha - x.x.2023]
## [0.9.0-alpha - 02.06.2023]

Minimum PHP version for this release is 7.2.5.

Expand Down Expand Up @@ -36,7 +36,6 @@ Minimum PHP version for this release is 7.2.5.
### Changed
* Composer is now used for external libraries like: Twig, PHPMailer, fast-route etc.
* mail support is disabled on fresh install, can be manually enabled by user
* don't show PHP errors on prod
* disable add php pages in admin panel for security. Option to disable plugins upload
* visitors counter shows now user browser, and also if its bot
* changes in required and optional PHP extensions
Expand Down
2 changes: 1 addition & 1 deletion system/libs/CreateCharacter.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public function doCreate($name, $sex, $vocation, $town, $account, &$errors)

if(empty($errors))
{
$number_of_players_on_account = $account->getPlayersList(false)->count();
$number_of_players_on_account = $account->getPlayersList(true)->count();
if($number_of_players_on_account >= config('characters_per_account'))
$errors[] = 'You have too many characters on your account <b>('.$number_of_players_on_account.'/'.config('characters_per_account').')</b>!';
}
Expand Down
2 changes: 1 addition & 1 deletion system/libs/pot/OTS_Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ public function getGuildAccess(OTS_Guild $guild)
$access = 0;

// finds ranks of all characters
foreach($this->getPlayersList() as $player)
foreach($this->getPlayersList(false) as $player)
{
$rank = $player->getRank();

Expand Down
2 changes: 1 addition & 1 deletion system/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
defined('MYAAC') or die('Direct access not allowed!');
$logged = false;
$logged_flags = 0;
$account_logged = new OTS_Account();

// stay-logged with sessions
$current_session = getSession('account');
if($current_session !== false)
{
$account_logged = new OTS_Account();
$account_logged->load($current_session);
if($account_logged->isLoaded() && $account_logged->getPassword() == getSession('password')
//&& (!isset($_SESSION['admin']) || admin())
Expand Down
25 changes: 16 additions & 9 deletions system/pages/account/change_comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,22 @@
if ($player->isLoaded()) {
$player_account = $player->getAccount();
if ($account_logged->getId() == $player_account->getId()) {
if ($player->isDeleted()) {
$errors[] = 'This character is deleted.';
$player = null;
}

if (isset($_POST['changecommentsave']) && $_POST['changecommentsave'] == 1) {
$player->setCustomField("hidden", $new_hideacc);
$player->setCustomField("comment", $new_comment);
$account_logged->logAction('Changed comment for character <b>' . $player->getName() . '</b>.');
$twig->display('success.html.twig', array(
'title' => 'Character Information Changed',
'description' => 'The character information has been changed.'
));
$show_form = false;
if(empty($errors)) {
$player->setCustomField("hidden", $new_hideacc);
$player->setCustomField("comment", $new_comment);
$account_logged->logAction('Changed comment for character <b>' . $player->getName() . '</b>.');
$twig->display('success.html.twig', array(
'title' => 'Character Information Changed',
'description' => 'The character information has been changed.'
));
$show_form = false;
}
}
} else {
$errors[] = 'Error. Character <b>' . $player_name . '</b> is not on your account.';
Expand All @@ -57,7 +64,7 @@
$twig->display('error_box.html.twig', array('errors' => $errors));
}

if(isset($player)) {
if(isset($player) && $player->isLoaded()) {
$twig->display('account.change_comment.html.twig', array(
'player' => $player
));
Expand Down
6 changes: 5 additions & 1 deletion system/pages/account/change_name.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@
if($player->isLoaded()) {
$player_account = $player->getAccount();
if($account_logged->getId() == $player_account->getId()) {
if ($player->isDeleted()) {
$errors[] = 'This character is deleted.';
}

if($player->isOnline()) {
$errors[] = 'This character is online.';
}
Expand Down Expand Up @@ -91,7 +95,7 @@
}
}
else {
$errors[] = 'Character <b>' . $player_name . '</b> is not on your account.';
$errors[] = 'Character is not on your account.';
}
}
else {
Expand Down
4 changes: 1 addition & 3 deletions system/pages/account/change_password.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,4 @@
));
setSession('password', $new_password);
}
}

?>
}
8 changes: 6 additions & 2 deletions system/pages/account/change_sex.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
$player_account = $player->getAccount();

if($account_logged->getId() == $player_account->getId()) {
if ($player->isDeleted()) {
$errors[] = 'This character is deleted.';
}

if($player->isOnline()) {
$errors[] = 'This character is online.';
}
Expand Down Expand Up @@ -71,7 +75,7 @@
}
}
else {
$errors[] = 'Character <b>'.$player_name.'</b> is not on your account.';
$errors[] = 'Character is not on your account.';
}
}
else {
Expand All @@ -85,7 +89,7 @@
$twig->display('error_box.html.twig', array('errors' => $errors));
}
$twig->display('account.change_sex.html.twig', array(
'players' => $account_logged->getPlayersList(),
'players' => $account_logged->getPlayersList(false),
'player_sex' => isset($player) ? $player->getSex() : -1,
'points' => $points
));
Expand Down
8 changes: 8 additions & 0 deletions system/pages/account/delete_character.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@
}
}

$ownerid = 'ownerid';
if($db->hasColumn('guilds', 'owner_id'))
$ownerid = 'owner_id';
$guild = $db->query('SELECT `name` FROM `guilds` WHERE `' . $ownerid . '` = '.$player->getId());
if($guild->rowCount() > 0) {
$errors[] = 'You cannot delete a character when they own a guild.';
}

if(empty($errors)) {
//dont show table "delete character" again
$show_form = false;
Expand Down
4 changes: 3 additions & 1 deletion system/pages/guilds/accept_invite.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
$errors[] = 'Character with name <b> ' . $name. ' </b> is not in your account.';
}else if ($player->getRank()->isLoaded()){
$errors[] = 'Character with name <b>'.$name.'</b> is already in guild. You must leave guild before you join other guild.';
} else if ($player->isDeleted()) {
$errors[] = "Character with name <b>$name</b> has been deleted.";
}
}
}
Expand Down Expand Up @@ -72,7 +74,7 @@
{
if(empty($errors)) {
$acc_invited = false;
$account_players = $account_logged->getPlayers();
$account_players = $account_logged->getPlayersList(false);
include(SYSTEM . 'libs/pot/InvitesDriver.php');
new InvitesDriver($guild);
$invited_list = $guild->listInvites();
Expand Down
8 changes: 5 additions & 3 deletions system/pages/guilds/create.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
$array_of_player_nig = array();
if(empty($guild_errors))
{
$account_players = $account_logged->getPlayers();
$account_players = $account_logged->getPlayersList(false);
foreach($account_players as $player)
{
$player_rank = $player->getRank();
Expand Down Expand Up @@ -73,6 +73,10 @@
}
}

if(empty($guild_errors) && $player->isDeleted()) {
$guild_errors[] = "Character <b>$name</b> has been deleted.";
}

if(empty($guild_errors))
{
$bad_char = true;
Expand Down Expand Up @@ -132,5 +136,3 @@
'players' => $array_of_player_nig
));
}

?>
2 changes: 2 additions & 0 deletions system/pages/guilds/invite.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@
$player->find($name);
if(!$player->isLoaded()) {
$errors[] = 'Player with name <b>' . $name . '</b> doesn\'t exist.';
} else if ($player->isDeleted()) {
$errors[] = "Character with name <b>$name</b> has been deleted.";
}
else
{
Expand Down
2 changes: 2 additions & 0 deletions system/pages/guilds/pass_leadership.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
$to_player->find($pass_to);
if(!$to_player->isLoaded()) {
$guild_errors2[] = 'Player with name <b>'.$pass_to.'</b> doesn\'t exist.';
} else if ($to_player->isDeleted()) {
$guild_errors2[] = "Character with name <b>$pass_to</b> has been deleted.";
}

if(empty($guild_errors2)) {
Expand Down
4 changes: 2 additions & 2 deletions system/pages/online.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@
}

if($db->hasTable('players_online')) // tfs 1.0
$playersOnline = $db->query('SELECT `accounts`.`country`, `players`.`name`, `level`, `vocation`' . $outfit . ', `' . $skull_time . '` as `skulltime`, `' . $skull_type . '` as `skull` FROM `accounts`, `players`, `players_online` WHERE `players`.`id` = `players_online`.`player_id` AND `accounts`.`id` = `players`.`account_id` ORDER BY ' . $order);
$playersOnline = $db->query('SELECT `accounts`.`country`, `players`.`name`, `players`.`level`, `players`.`vocation`' . $outfit . ', `' . $skull_time . '` as `skulltime`, `' . $skull_type . '` as `skull` FROM `accounts`, `players`, `players_online` WHERE `players`.`id` = `players_online`.`player_id` AND `accounts`.`id` = `players`.`account_id` ORDER BY ' . $order);
else
$playersOnline = $db->query('SELECT `accounts`.`country`, `players`.`name`, `level`, `vocation`' . $outfit . ', ' . $promotion . ' `' . $skull_time . '` as `skulltime`, `' . $skull_type . '` as `skull` FROM `accounts`, `players` WHERE `players`.`online` > 0 AND `accounts`.`id` = `players`.`account_id` ORDER BY ' . $order);
$playersOnline = $db->query('SELECT `accounts`.`country`, `players`.`name`, `players`.`level`, `players`.`vocation`' . $outfit . ', ' . $promotion . ' `' . $skull_time . '` as `skulltime`, `' . $skull_type . '` as `skull` FROM `accounts`, `players` WHERE `players`.`online` > 0 AND `accounts`.`id` = `players`.`account_id` ORDER BY ' . $order);

$players_data = array();
$players = 0;
Expand Down
4 changes: 2 additions & 2 deletions system/templates/account.change_name.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ To change a name of character select player and choose a new name.<br/>
<td class="LabelV" ><span>Character:</span></td>
<td style="width:90%;" >
<select name="player_id">
{% for player in account_logged.getPlayersList() %}
{% for player in account_logged.getPlayersList(false) %}
<option value="{{ player.getId() }}">{{ player.getName() }}</option>
{% endfor %}
</select>
Expand Down Expand Up @@ -74,4 +74,4 @@ To change a name of character select player and choose a new name.<br/>
</td>
</tr>
</table>
<script type="text/javascript" src="tools/check_name.js"></script>
<script type="text/javascript" src="tools/check_name.js"></script>
2 changes: 1 addition & 1 deletion system/templates/account.create_character.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Please choose a name{% if config.character_samples|length > 1 %}, vocation{% end
{% if config.character_towns|length > 1 %}, town{% endif %}
and sex for your character. <br/>
In any case the name must not violate the naming conventions stated in the <a href="?subtopic=rules" target="_blank" >{{ config.lua.serverName }} Rules</a>, or your character might get deleted or name locked.
{% if account_logged.getPlayersList(false)|length >= config.characters_per_account %}
{% if account_logged.getPlayersList(true)|length >= config.characters_per_account %}
<b><span style="color: red"> You have maximum number of characters per account on your account. Delete one before you make new.</span></b>
{% endif %}
<br/><br/>
Expand Down
11 changes: 10 additions & 1 deletion system/templates/account.management.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,16 @@
{% for player in players %}
{% set i = i + 1 %}
<tr bgcolor="{{ getStyle(i) }}">
<td><a href="{{ getLink('characters/' ~ player.getName()|urlencode) }}">{{ player.getName() }}</a></td><td>{{ player.getLevel() }}</td><td>{{ player.getVocationName() }}</td><td>{{ config.towns[player.getTownId()] }}</td><td>{% if player.getLastLogin() > 0 %}{{ player.getLastLogin|date('d F Y (H:i)') }}{% else %}Never.{% endif %}</td><td>{% if player.isOnline() %}<span style="color: green">ONLINE</span>{% else %}<span style="color: red">Offline</span>{% endif %}</td><td>{% if player.isHidden() %}Hidden{% else %}Visible{% endif %}</td><td>[<a href="{{ getLink('account/character/comment/' ~ player.getName|urlencode) }}" >Edit</a>]</td>
<td>
<a href="{{ getLink('characters/' ~ player.getName()|urlencode) }}">{{ player.getName() }}</a>
</td>
<td>{{ player.getLevel() }}</td>
<td>{{ player.getVocationName() }}</td>
<td>{{ config.towns[player.getTownId()] }}</td>
<td>{% if player.getLastLogin() > 0 %}{{ player.getLastLogin|date('d F Y (H:i)') }}{% else %}Never.{% endif %}</td>
<td>{% if player.isOnline() %}<span style="color: green">ONLINE</span>{% else %}<span style="color: red">Offline</span>{% endif %}</td>
<td>{% if player.isHidden() %}Hidden{% else %}Visible{% endif %}</td>
<td>{% if not player.isDeleted() %}[<a href="{{ getLink('account/character/comment/' ~ player.getName|urlencode) }}" >Edit</a>]{% endif %}</td>
</tr>
{% endfor %}
</table>
Expand Down
2 changes: 2 additions & 0 deletions system/templates/characters.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,13 @@
</td>
<!-- EQUIPMENT_END -->
{% endif %}

{{ hook(constant('HOOK_CHARACTERS_AFTER_EQUIPMENT')) }}
</tr>
</table>

{{ hook(constant('HOOK_CHARACTERS_BEFORE_DEATHS')) }}

{% if deaths|length > 0 %}
<!-- DEATHS -->
<br/>
Expand Down
7 changes: 4 additions & 3 deletions system/templates/exception.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
<meta name="description" content="myaac">
<meta name="generator" content="MyAAC">

<link rel="stylesheet" href="{{ BASE_URL }}tools/css/messages.css">
<link rel="shortcut icon" href="{{ BASE_URL }}images/error.ico">
<base href="{{ BASE_URL }}" />
<link rel="stylesheet" href="tools/css/messages.css">
<link rel="shortcut icon" href="images/error.ico">

<style>
body{
Expand Down Expand Up @@ -56,7 +57,7 @@
}
</style>
<!--[if lt IE 9]>
<script src="{{ BASE_URL }}tools/js/html5shiv.min.js"></script>
<script src="tools/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
Expand Down
2 changes: 1 addition & 1 deletion system/templates/forum.show_thread.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ Page: {{ links_to_pages|raw }}<br/>
<a href="?subtopic=forum&action=move_thread&id={{ post.id }}" title="Move Thread"><img src="images/icons/arrow_right.gif"/></a>
<a href="?subtopic=forum&action=remove_post&id={{ post.id }}" title="Remove Thread" target="_blank" onclick="return confirm('Are you sure you want remove thread > {{ post.post_topic}} <?')"><img src="images/del.png"/></a>
{% endif %}
{% endif %}
{% if logged and (post.player.getAccount().getId() == account_logged.getId() or is_moderator) %}
<a href="?subtopic=forum&action=edit_post&id={{ post.id }}" title="Edit Post" target="_blank">
<img src="images/edit.png"/></a>
{% endif %}
{% if logged %}
<a href="?subtopic=forum&action=new_post&thread_id={{ thread_id }}&quote={{ post.id }}" title="Quote Post"><img src="images/icons/comment_add.png"/></a>
{% endif %}
{% endif %}
</td>
</tr>
{% set i = i + 1 %}
Expand Down
2 changes: 1 addition & 1 deletion templates/tibiacom/account.management.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@
{% else %}
<td><span style="color: red"><b>Offline</b></span></td>
{% endif %}
<td>[<a href="{{ getLink('account/character/comment/' ~ player.getName|urlencode) }}" >Edit</a>]</td>
<td>{% if not player.isDeleted() %}[<a href="{{ getLink('account/character/comment/' ~ player.getName|urlencode) }}" >Edit</a>]{% endif %}</td>
</tr>
{% endfor %}
</table>
Expand Down

0 comments on commit ac40922

Please sign in to comment.