diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml
index 2909555a..067c9a6c 100644
--- a/.github/workflows/cypress.yml
+++ b/.github/workflows/cypress.yml
@@ -1,9 +1,9 @@
name: Cypress
on:
pull_request:
- branches: [develop]
+ branches: [0.9]
push:
- branches: [develop]
+ branches: [0.9]
jobs:
cypress:
@@ -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
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4ec987f9..399eba44 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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.
@@ -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
diff --git a/system/libs/CreateCharacter.php b/system/libs/CreateCharacter.php
index c81893e1..60909c0f 100644
--- a/system/libs/CreateCharacter.php
+++ b/system/libs/CreateCharacter.php
@@ -138,7 +138,7 @@ class CreateCharacter
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 ('.$number_of_players_on_account.'/'.config('characters_per_account').')!';
}
diff --git a/system/libs/pot/OTS_Account.php b/system/libs/pot/OTS_Account.php
index 9a6b39a7..366dccdf 100644
--- a/system/libs/pot/OTS_Account.php
+++ b/system/libs/pot/OTS_Account.php
@@ -994,7 +994,7 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
$access = 0;
// finds ranks of all characters
- foreach($this->getPlayersList() as $player)
+ foreach($this->getPlayersList(false) as $player)
{
$rank = $player->getRank();
diff --git a/system/login.php b/system/login.php
index 5d55cd18..e018c043 100644
--- a/system/login.php
+++ b/system/login.php
@@ -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())
diff --git a/system/pages/account/change_comment.php b/system/pages/account/change_comment.php
index 0f0bc2f1..21221426 100644
--- a/system/pages/account/change_comment.php
+++ b/system/pages/account/change_comment.php
@@ -28,15 +28,22 @@ if($player_name != null) {
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 ' . $player->getName() . '.');
- $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 ' . $player->getName() . '.');
+ $twig->display('success.html.twig', array(
+ 'title' => 'Character Information Changed',
+ 'description' => 'The character information has been changed.'
+ ));
+ $show_form = false;
+ }
}
} else {
$errors[] = 'Error. Character ' . $player_name . ' is not on your account.';
@@ -57,7 +64,7 @@ if($show_form) {
$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
));
diff --git a/system/pages/account/change_name.php b/system/pages/account/change_name.php
index 448e730c..48b6bb4d 100644
--- a/system/pages/account/change_name.php
+++ b/system/pages/account/change_name.php
@@ -50,6 +50,10 @@ else
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.';
}
@@ -91,7 +95,7 @@ else
}
}
else {
- $errors[] = 'Character ' . $player_name . ' is not on your account.';
+ $errors[] = 'Character is not on your account.';
}
}
else {
diff --git a/system/pages/account/change_password.php b/system/pages/account/change_password.php
index 01190497..deef3602 100644
--- a/system/pages/account/change_password.php
+++ b/system/pages/account/change_password.php
@@ -89,6 +89,4 @@ else
));
setSession('password', $new_password);
}
-}
-
-?>
+}
\ No newline at end of file
diff --git a/system/pages/account/change_sex.php b/system/pages/account/change_sex.php
index 868cf24f..2f944564 100644
--- a/system/pages/account/change_sex.php
+++ b/system/pages/account/change_sex.php
@@ -41,6 +41,10 @@ else
$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.';
}
@@ -71,7 +75,7 @@ else
}
}
else {
- $errors[] = 'Character '.$player_name.' is not on your account.';
+ $errors[] = 'Character is not on your account.';
}
}
else {
@@ -85,7 +89,7 @@ else
$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
));
diff --git a/system/pages/account/delete_character.php b/system/pages/account/delete_character.php
index f5894c77..4e74e711 100644
--- a/system/pages/account/delete_character.php
+++ b/system/pages/account/delete_character.php
@@ -61,6 +61,14 @@ if(isset($_POST['deletecharactersave']) && $_POST['deletecharactersave'] == 1) {
}
}
+ $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;
diff --git a/system/pages/guilds/accept_invite.php b/system/pages/guilds/accept_invite.php
index 7b013a2c..bc782480 100644
--- a/system/pages/guilds/accept_invite.php
+++ b/system/pages/guilds/accept_invite.php
@@ -45,6 +45,8 @@ if(isset($_REQUEST['todo']) && $_REQUEST['todo'] == 'save') {
$errors[] = 'Character with name ' . $name. ' is not in your account.';
}else if ($player->getRank()->isLoaded()){
$errors[] = 'Character with name '.$name.' is already in guild. You must leave guild before you join other guild.';
+ } else if ($player->isDeleted()) {
+ $errors[] = "Character with name $name has been deleted.";
}
}
}
@@ -72,7 +74,7 @@ else
{
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();
diff --git a/system/pages/guilds/create.php b/system/pages/guilds/create.php
index 9814ade0..d7319fce 100644
--- a/system/pages/guilds/create.php
+++ b/system/pages/guilds/create.php
@@ -22,7 +22,7 @@ if(!$logged) {
$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();
@@ -73,6 +73,10 @@ if($todo == 'save')
}
}
+ if(empty($guild_errors) && $player->isDeleted()) {
+ $guild_errors[] = "Character $name has been deleted.";
+ }
+
if(empty($guild_errors))
{
$bad_char = true;
@@ -132,5 +136,3 @@ else {
'players' => $array_of_player_nig
));
}
-
-?>
diff --git a/system/pages/guilds/invite.php b/system/pages/guilds/invite.php
index 09957d2d..8fae8e27 100644
--- a/system/pages/guilds/invite.php
+++ b/system/pages/guilds/invite.php
@@ -72,6 +72,8 @@ if(isset($_REQUEST['todo']) && $_REQUEST['todo'] == 'save') {
$player->find($name);
if(!$player->isLoaded()) {
$errors[] = 'Player with name ' . $name . ' doesn\'t exist.';
+ } else if ($player->isDeleted()) {
+ $errors[] = "Character with name $name has been deleted.";
}
else
{
diff --git a/system/pages/guilds/pass_leadership.php b/system/pages/guilds/pass_leadership.php
index d5f0ed20..065e4c3b 100644
--- a/system/pages/guilds/pass_leadership.php
+++ b/system/pages/guilds/pass_leadership.php
@@ -36,6 +36,8 @@ if(empty($guild_errors)) {
$to_player->find($pass_to);
if(!$to_player->isLoaded()) {
$guild_errors2[] = 'Player with name '.$pass_to.' doesn\'t exist.';
+ } else if ($to_player->isDeleted()) {
+ $guild_errors2[] = "Character with name $pass_to has been deleted.";
}
if(empty($guild_errors2)) {
diff --git a/system/pages/online.php b/system/pages/online.php
index ca629a3b..2d96a405 100644
--- a/system/pages/online.php
+++ b/system/pages/online.php
@@ -54,9 +54,9 @@ if($config['online_vocations']) {
}
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;
diff --git a/system/templates/account.change_name.html.twig b/system/templates/account.change_name.html.twig
index 255689e3..bd1fa8f0 100644
--- a/system/templates/account.change_name.html.twig
+++ b/system/templates/account.change_name.html.twig
@@ -25,7 +25,7 @@ To change a name of character select player and choose a new name.