diff --git a/system/libs/pot/OTS_Account.php b/system/libs/pot/OTS_Account.php
index 0512cf6c..fdf10510 100644
--- a/system/libs/pot/OTS_Account.php
+++ b/system/libs/pot/OTS_Account.php
@@ -922,7 +922,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/pages/account/change_comment.php b/system/pages/account/change_comment.php
index 43cfd0ca..55519ced 100644
--- a/system/pages/account/change_comment.php
+++ b/system/pages/account/change_comment.php
@@ -21,15 +21,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.';
@@ -56,4 +63,4 @@ if($show_form) {
));
}
}
-?>
\ No newline at end of file
+?>
diff --git a/system/pages/account/change_name.php b/system/pages/account/change_name.php
index b3e82876..c31fb2d3 100644
--- a/system/pages/account/change_name.php
+++ b/system/pages/account/change_name.php
@@ -43,6 +43,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.';
}
@@ -61,7 +65,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_sex.php b/system/pages/account/change_sex.php
index c2416ccc..7266aaca 100644
--- a/system/pages/account/change_sex.php
+++ b/system/pages/account/change_sex.php
@@ -34,6 +34,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.';
}
@@ -64,7 +68,7 @@ else
}
}
else {
- $errors[] = 'Character '.$player_name.' is not on your account.';
+ $errors[] = 'Character is not on your account.';
}
}
else {
@@ -78,7 +82,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 f56af9c0..9840b0ec 100644
--- a/system/pages/account/delete_character.php
+++ b/system/pages/account/delete_character.php
@@ -31,6 +31,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 7ae0fedf..8661073a 100644
--- a/system/pages/guilds/accept_invite.php
+++ b/system/pages/guilds/accept_invite.php
@@ -43,6 +43,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.";
}
}
}
@@ -69,7 +71,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 52503d25..7aa88141 100644
--- a/system/pages/guilds/create.php
+++ b/system/pages/guilds/create.php
@@ -20,7 +20,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();
@@ -71,6 +71,10 @@ if($todo == 'save')
}
}
+ if(empty($guild_errors) && $player->isDeleted()) {
+ $guild_errors[] = "Character $name has been deleted.";
+ }
+
if(empty($guild_errors))
{
$bad_char = true;
@@ -130,5 +134,3 @@ else {
'players' => $array_of_player_nig
));
}
-
-?>
\ No newline at end of file
diff --git a/system/pages/guilds/invite.php b/system/pages/guilds/invite.php
index 57eda6cf..d42de006 100644
--- a/system/pages/guilds/invite.php
+++ b/system/pages/guilds/invite.php
@@ -70,6 +70,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
{
@@ -122,4 +124,4 @@ if($show) {
$twig->display('guilds.back_button.html.twig', array(
'action' => getLink('guilds') . '/' . $guild_name
-));
\ No newline at end of file
+));
diff --git a/system/pages/guilds/pass_leadership.php b/system/pages/guilds/pass_leadership.php
index ebf18c89..05734c08 100644
--- a/system/pages/guilds/pass_leadership.php
+++ b/system/pages/guilds/pass_leadership.php
@@ -34,6 +34,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/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.