mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-18 03:33:26 +02:00
* forgot to commit twig templates in last commit
* added some validation in guilds actions if guild has been set to prevent php notices
This commit is contained in:
@@ -10,45 +10,57 @@
|
||||
*/
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
|
||||
if($logged)
|
||||
if(!$logged) {
|
||||
echo 'You are not logged.';
|
||||
echo $twig->render('guilds.back_button.html.twig');
|
||||
return;
|
||||
}
|
||||
|
||||
$new_rank = isset($_REQUEST['name']) ? stripslashes($_REQUEST['name']) : null;
|
||||
$new_nick = isset($_REQUEST['nick']) ? stripslashes($_REQUEST['nick']) : null;
|
||||
|
||||
if(!$new_rank) {
|
||||
echo 'Please enter new rank.';
|
||||
return;
|
||||
}
|
||||
|
||||
if(!$new_nick) {
|
||||
echo 'Please enter new nick.';
|
||||
return;
|
||||
}
|
||||
|
||||
$player = new OTS_Player();
|
||||
$player->find($name);
|
||||
$player_from_account = false;
|
||||
if(strlen($new_nick) <= 40)
|
||||
{
|
||||
$name = stripslashes($_REQUEST['name']);
|
||||
$new_nick = stripslashes($_REQUEST['nick']);
|
||||
$player = new OTS_Player();
|
||||
$player->find($name);
|
||||
$player_from_account = false;
|
||||
if(strlen($new_nick) <= 40)
|
||||
if($player->isLoaded())
|
||||
{
|
||||
if($player->isLoaded())
|
||||
$account_players = $account_logged->getPlayersList();
|
||||
if(count($account_players))
|
||||
{
|
||||
$account_players = $account_logged->getPlayersList();
|
||||
if(count($account_players))
|
||||
foreach($account_players as $acc_player)
|
||||
{
|
||||
foreach($account_players as $acc_player)
|
||||
{
|
||||
if($acc_player->getId() == $player->getId())
|
||||
$player_from_account = true;
|
||||
}
|
||||
if($player_from_account)
|
||||
{
|
||||
$player->setGuildNick($new_nick);
|
||||
echo 'Guild nick of player <b>'.$player->getName().'</b> changed to <b>'.htmlentities($new_nick).'</b>.';
|
||||
$addtolink = '&action=show&guild='.$player->getRank()->getGuild()->getName();
|
||||
}
|
||||
else
|
||||
echo 'This player is not from your account.';
|
||||
if($acc_player->getId() == $player->getId())
|
||||
$player_from_account = true;
|
||||
}
|
||||
if($player_from_account)
|
||||
{
|
||||
$player->setGuildNick($new_nick);
|
||||
echo 'Guild nick of player <b>'.$player->getName().'</b> changed to <b>'.htmlentities($new_nick).'</b>.';
|
||||
$addtolink = '&action=show&guild='.$player->getRank()->getGuild()->getName();
|
||||
}
|
||||
else
|
||||
echo 'This player is not from your account.';
|
||||
}
|
||||
else
|
||||
echo 'Unknow error occured.';
|
||||
echo 'This player is not from your account.';
|
||||
}
|
||||
else
|
||||
echo 'Too long guild nick. Max. 40 chars, your length: '.strlen($new_nick);
|
||||
echo 'Unknow error occured.';
|
||||
}
|
||||
else
|
||||
echo 'You are not logged.';
|
||||
echo '<center><h3><a href="?subtopic=guilds'.$addtolink.'">BACK</a></h3></center>';
|
||||
echo 'Too long guild nick. Max. 40 chars, your length: '.strlen($new_nick);
|
||||
|
||||
echo $twig->render('guilds.back_button.html.twig');
|
||||
?>
|
Reference in New Issue
Block a user