mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-14 01:34:55 +02:00
* replace "$twig->render()" with "$this->display"
This commit is contained in:
@@ -25,7 +25,7 @@ if($player_name != null) {
|
||||
$player->setCustomField("hidden", $new_hideacc);
|
||||
$player->setCustomField("comment", $new_comment);
|
||||
$account_logged->logAction('Changed comment for character <b>' . $player->getName() . '</b>.');
|
||||
echo $twig->render('success.html.twig', array(
|
||||
$twig->display('success.html.twig', array(
|
||||
'title' => 'Character Information Changed',
|
||||
'description' => 'The character information has been changed.'
|
||||
));
|
||||
@@ -47,11 +47,11 @@ else {
|
||||
|
||||
if($show_form) {
|
||||
if(!empty($errors)) {
|
||||
echo $twig->render('error_box.html.twig', array('errors' => $errors));
|
||||
$twig->display('error_box.html.twig', array('errors' => $errors));
|
||||
}
|
||||
|
||||
|
||||
if(isset($player)) {
|
||||
echo $twig->render('account.change_comment.html.twig', array(
|
||||
$twig->display('account.change_comment.html.twig', array(
|
||||
'player' => $player
|
||||
));
|
||||
}
|
||||
|
@@ -20,11 +20,11 @@ if($email_new_time < 10) {
|
||||
if(isset($_POST['changeemailsave']) && $_POST['changeemailsave'] == 1) {
|
||||
$email_new = $_POST['new_email'];
|
||||
$post_password = $_POST['password'];
|
||||
|
||||
|
||||
if(!Validator::email($email_new)) {
|
||||
$errors[] = Validator::getLastError();
|
||||
}
|
||||
|
||||
|
||||
if(empty($post_password)) {
|
||||
$errors[] = 'Please enter password to your account.';
|
||||
}
|
||||
@@ -34,12 +34,12 @@ if($email_new_time < 10) {
|
||||
$errors[] = 'Wrong password to account.';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(empty($errors)) {
|
||||
$email_new_time = time() + $config['account_mail_change'] * 24 * 3600;
|
||||
$account_logged->setCustomField("email_new", $email_new);
|
||||
$account_logged->setCustomField("email_new_time", $email_new_time);
|
||||
echo $twig->render('success.html.twig', array(
|
||||
$twig->display('success.html.twig', array(
|
||||
'title' => 'New Email Address Requested',
|
||||
'description' => 'You have requested to change your email address to <b>' . $email_new . '</b>. The actual change will take place after <b>' . date("j F Y, G:i:s", $email_new_time) . '</b>, during which you can cancel the request at any time.'
|
||||
));
|
||||
@@ -47,21 +47,21 @@ if($email_new_time < 10) {
|
||||
else
|
||||
{
|
||||
//show errors
|
||||
echo $twig->render('error_box.html.twig', array('errors' => $errors));
|
||||
|
||||
$twig->display('error_box.html.twig', array('errors' => $errors));
|
||||
|
||||
//show form
|
||||
echo $twig->render('account.change_mail.html.twig', array(
|
||||
$twig->display('account.change_mail.html.twig', array(
|
||||
'new_email' => isset($_POST['new_email']) ? $_POST['new_email'] : null
|
||||
));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo $twig->render('account.change_mail.html.twig', array(
|
||||
$twig->display('account.change_mail.html.twig', array(
|
||||
'new_email' => isset($_POST['new_email']) ? $_POST['new_email'] : null
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -72,8 +72,8 @@ else
|
||||
$account_logged->setEmail($email_new);
|
||||
$account_logged->save();
|
||||
$account_logged->logAction('Account email changed to <b>' . $email_new . '</b>');
|
||||
|
||||
echo $twig->render('success.html.twig', array(
|
||||
|
||||
$twig->display('success.html.twig', array(
|
||||
'title' => 'Email Address Change Accepted',
|
||||
'description' => 'You have accepted <b>' . $account_logged->getEmail() . '</b> as your new email adress.'
|
||||
));
|
||||
@@ -103,7 +103,7 @@ else
|
||||
<td width="30"> </td>
|
||||
</tr>
|
||||
</table>';
|
||||
echo $twig->render('success.html.twig', array(
|
||||
$twig->display('success.html.twig', array(
|
||||
'title' => 'Email Address Change Accepted',
|
||||
'description' => 'Do you accept <b>'.$email_new.'</b> as your new email adress?',
|
||||
'custom_buttons' => $custom_buttons
|
||||
@@ -140,7 +140,7 @@ else
|
||||
</td>
|
||||
</tr>
|
||||
</table>';
|
||||
echo $twig->render('success.html.twig', array(
|
||||
$twig->display('success.html.twig', array(
|
||||
'title' => 'Change of Email Address',
|
||||
'description' => 'A request has been submitted to change the email address of this account to <b>'.$email_new.'</b>.<br/>The actual change will take place on <b>'.date("j F Y, G:i:s", $email_new_time).'</b>.<br>If you do not want to change your email address, please click on "Cancel".',
|
||||
'custom_buttons' => $custom_buttons
|
||||
@@ -150,10 +150,10 @@ else
|
||||
if(isset($_POST['emailchangecancel']) && $_POST['emailchangecancel'] == 1) {
|
||||
$account_logged->setCustomField("email_new", "");
|
||||
$account_logged->setCustomField("email_new_time", 0);
|
||||
|
||||
|
||||
$custom_buttons = '<center><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement" method="post" ><tr><td style="border:0px;" >' . $twig->render('buttons.back.html.twig') . '</td></tr></form></table></center>';
|
||||
|
||||
echo $twig->render('success.html.twig', array(
|
||||
|
||||
$twig->display('success.html.twig', array(
|
||||
'title' => 'Email Address Change Cancelled',
|
||||
'description' => 'Your request to change the email address of your account has been cancelled. The email address will not be changed.',
|
||||
'custom_buttons' => $custom_buttons
|
||||
|
@@ -17,21 +17,21 @@ $new_country = isset($_POST['info_country']) ? htmlspecialchars(stripslashes($_P
|
||||
if(isset($_POST['changeinfosave']) && $_POST['changeinfosave'] == 1) {
|
||||
if(!isset($config['countries'][$new_country]))
|
||||
$errors[] = 'Country is not correct.';
|
||||
|
||||
|
||||
if(empty($errors)) {
|
||||
//save data from form
|
||||
$account_logged->setCustomField("rlname", $new_rlname);
|
||||
$account_logged->setCustomField("location", $new_location);
|
||||
$account_logged->setCustomField("country", $new_country);
|
||||
$account_logged->logAction('Changed Real Name to <b>' . $new_rlname . '</b>, Location to <b>' . $new_location . '</b> and Country to <b>' . $config['countries'][$new_country] . '</b>.');
|
||||
echo $twig->render('success.html.twig', array(
|
||||
$twig->display('success.html.twig', array(
|
||||
'title' => 'Public Information Changed',
|
||||
'description' => 'Your public information has been changed.'
|
||||
));
|
||||
$show_form = false;
|
||||
}
|
||||
else {
|
||||
echo $twig->render('error_box.html.twig', array('errors' => $errors));
|
||||
$twig->display('error_box.html.twig', array('errors' => $errors));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,17 +41,17 @@ if($show_form) {
|
||||
$account_location = $account_logged->getCustomField("location");
|
||||
if ($config['account_country'])
|
||||
$account_country = $account_logged->getCustomField("country");
|
||||
|
||||
|
||||
$countries = array();
|
||||
foreach (array('pl', 'se', 'br', 'us', 'gb',) as $country)
|
||||
$countries[$country] = $config['countries'][$country];
|
||||
|
||||
|
||||
$countries['--'] = '----------';
|
||||
|
||||
|
||||
foreach ($config['countries'] as $code => $country)
|
||||
$countries[$code] = $country;
|
||||
|
||||
echo $twig->render('account.change_info.html.twig', array(
|
||||
|
||||
$twig->display('account.change_info.html.twig', array(
|
||||
'countries' => $countries,
|
||||
'account_rlname' => $account_rlname,
|
||||
'account_location' => $account_location,
|
||||
|
@@ -22,7 +22,7 @@ else
|
||||
if(isset($_POST['changenamesave']) && $_POST['changenamesave'] == 1) {
|
||||
if($points < $config['account_change_character_name_points'])
|
||||
$errors[] = 'You need ' . $config['account_change_character_name_points'] . ' premium points to change name. You have <b>'.$points.'<b> premium points.';
|
||||
|
||||
|
||||
if(empty($errors) && empty($name))
|
||||
$errors[] = 'Please enter a new name for your character!';
|
||||
else if(strlen($name) > 25)
|
||||
@@ -36,13 +36,13 @@ else
|
||||
$errors[] = 'Character with this name already exist.';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(empty($errors))
|
||||
{
|
||||
if(!admin() && !Validator::newCharacterName($name))
|
||||
$errors[] = Validator::getLastError();
|
||||
}
|
||||
|
||||
|
||||
if(empty($errors)) {
|
||||
$player = new OTS_Player();
|
||||
$player->load($player_id);
|
||||
@@ -52,7 +52,7 @@ else
|
||||
if($player->isOnline()) {
|
||||
$errors[] = 'This character is online.';
|
||||
}
|
||||
|
||||
|
||||
if(empty($errors)) {
|
||||
$show_form = false;
|
||||
$old_name = $player->getName();
|
||||
@@ -60,7 +60,7 @@ else
|
||||
$player->save();
|
||||
$account_logged->setCustomField("premium_points", $points - $config['account_change_character_name_points']);
|
||||
$account_logged->logAction('Changed name from <b>' . $old_name . '</b> to <b>' . $player->getName() . '</b>.');
|
||||
echo $twig->render('success.html.twig', array(
|
||||
$twig->display('success.html.twig', array(
|
||||
'title' => 'Character Name Changed',
|
||||
'description' => 'The character <b>'.$old_name.'</b> name has been changed to <b>' . $player->getName() . '</b>.'
|
||||
));
|
||||
@@ -75,13 +75,13 @@ else
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($show_form) {
|
||||
if(!empty($errors)) {
|
||||
echo $twig->render('error_box.html.twig', array('errors' => $errors));
|
||||
$twig->display('error_box.html.twig', array('errors' => $errors));
|
||||
}
|
||||
|
||||
echo $twig->render('account.change_name.html.twig', array(
|
||||
|
||||
$twig->display('account.change_name.html.twig', array(
|
||||
'points' => $points,
|
||||
'errors' => $errors
|
||||
//'account_players' => $account_logged->getPlayersList()
|
||||
|
@@ -14,7 +14,7 @@ $new_password = isset($_POST['newpassword']) ? $_POST['newpassword'] : NULL;
|
||||
$new_password2 = isset($_POST['newpassword2']) ? $_POST['newpassword2'] : NULL;
|
||||
$old_password = isset($_POST['oldpassword']) ? $_POST['oldpassword'] : NULL;
|
||||
if(empty($new_password) && empty($new_password2) && empty($old_password)) {
|
||||
echo $twig->render('account.change_password.html.twig');
|
||||
$twig->display('account.change_password.html.twig');
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -25,12 +25,12 @@ else
|
||||
if($new_password != $new_password2) {
|
||||
$errors[] = "The new passwords do not match!";
|
||||
}
|
||||
|
||||
|
||||
if(empty($errors)) {
|
||||
if(!Validator::password($new_password)) {
|
||||
$errors[] = Validator::getLastError();
|
||||
}
|
||||
|
||||
|
||||
$old_password = encrypt(($config_salt_enabled ? $account_logged->getCustomField('salt') : '') . $old_password);
|
||||
if($old_password != $account_logged->getPassword()) {
|
||||
$errors[] = "Current password is incorrect!";
|
||||
@@ -38,41 +38,41 @@ else
|
||||
}
|
||||
if(!empty($errors)){
|
||||
//show errors
|
||||
echo $twig->render('error_box.html.twig', array('errors' => $errors));
|
||||
|
||||
$twig->display('error_box.html.twig', array('errors' => $errors));
|
||||
|
||||
//show form
|
||||
echo $twig->render('account.change_password.html.twig');
|
||||
$twig->display('account.change_password.html.twig');
|
||||
}
|
||||
else
|
||||
{
|
||||
$org_pass = $new_password;
|
||||
|
||||
|
||||
if($config_salt_enabled)
|
||||
{
|
||||
$salt = generateRandomString(10, false, true, true);
|
||||
$new_password = $salt . $new_password;
|
||||
$account_logged->setCustomField('salt', $salt);
|
||||
}
|
||||
|
||||
|
||||
$new_password = encrypt($new_password);
|
||||
$account_logged->setPassword($new_password);
|
||||
$account_logged->save();
|
||||
$account_logged->logAction('Account password changed.');
|
||||
|
||||
|
||||
$message = '';
|
||||
if($config['mail_enabled'] && $config['send_mail_when_change_password'])
|
||||
{
|
||||
$mailBody = $twig->render('mail.password_changed.html.twig', array(
|
||||
'new_password' => $org_pass
|
||||
));
|
||||
|
||||
|
||||
if(_mail($account_logged->getEMail(), $config['lua']['serverName']." - Changed password", $mailBody))
|
||||
$message = '<br/><small>Your new password were send on email address <b>'.$account_logged->getEMail().'</b>.</small>';
|
||||
else
|
||||
$message = '<br/><p class="error">An error occorred while sending email with password:<br/>' . $mailer->ErrorInfo . '</p>';
|
||||
}
|
||||
|
||||
echo $twig->render('success.html.twig', array(
|
||||
|
||||
$twig->display('success.html.twig', array(
|
||||
'title' => 'Password Changed',
|
||||
'description' => 'Your password has been changed.' . $message
|
||||
));
|
||||
|
@@ -21,43 +21,43 @@ else
|
||||
if(isset($_POST['changesexsave']) && $_POST['changesexsave'] == 1) {
|
||||
if($points < $config['account_change_character_sex_points'])
|
||||
$errors[] = 'You need ' . $config['account_change_character_sex_points'] . ' premium points to change sex. You have <b>'.$points.'</b> premium points.';
|
||||
|
||||
|
||||
if(empty($errors) && !isset($config['genders'][$new_sex])) {
|
||||
$errors[] = 'This sex is invalid.';
|
||||
}
|
||||
|
||||
|
||||
if(empty($errors)) {
|
||||
$player = new OTS_Player();
|
||||
$player->load($player_id);
|
||||
|
||||
|
||||
if($player->isLoaded()) {
|
||||
$player_account = $player->getAccount();
|
||||
|
||||
|
||||
if($account_logged->getId() == $player_account->getId()) {
|
||||
if($player->isOnline()) {
|
||||
$errors[] = 'This character is online.';
|
||||
}
|
||||
|
||||
|
||||
if(empty($errors) && $player->getSex() == $new_sex)
|
||||
$errors[] = 'Sex cannot be same';
|
||||
|
||||
|
||||
if(empty($errors)) {
|
||||
$sex_changed = true;
|
||||
$old_sex = $player->getSex();
|
||||
$player->setSex($new_sex);
|
||||
|
||||
|
||||
$old_sex_str = 'Unknown';
|
||||
if(isset($config['genders'][$old_sex]))
|
||||
$old_sex_str = $config['genders'][$old_sex];
|
||||
|
||||
|
||||
$new_sex_str = 'Unknown';
|
||||
if(isset($config['genders'][$new_sex]))
|
||||
$new_sex_str = $config['genders'][$new_sex];
|
||||
|
||||
|
||||
$player->save();
|
||||
$account_logged->setCustomField("premium_points", $points - $config['account_change_character_name_points']);
|
||||
$account_logged->logAction('Changed sex on character <b>' . $player->getName() . '</b> from <b>' . $old_sex_str . '</b> to <b>' . $new_sex_str . '</b>.');
|
||||
echo $twig->render('success.html.twig', array(
|
||||
$twig->display('success.html.twig', array(
|
||||
'title' => 'Character Sex Changed',
|
||||
'description' => 'The character <b>' . $player->getName() . '</b> sex has been changed to <b>' . $new_sex_str . '</b>.'
|
||||
));
|
||||
@@ -72,12 +72,12 @@ else
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!$sex_changed) {
|
||||
if(!empty($errors)) {
|
||||
echo $twig->render('error_box.html.twig', array('errors' => $errors));
|
||||
$twig->display('error_box.html.twig', array('errors' => $errors));
|
||||
}
|
||||
echo $twig->render('account.change_sex.html.twig', array(
|
||||
$twig->display('account.change_sex.html.twig', array(
|
||||
'players' => $account_logged->getPlayersList(),
|
||||
'player_sex' => isset($player) ? $player->getSex() : -1,
|
||||
'points' => $points
|
||||
|
@@ -183,7 +183,7 @@ if($save) {
|
||||
foreach($loaded_items_to_copy as $save_item)
|
||||
$db->query("INSERT INTO `player_items` (`player_id` ,`pid` ,`sid` ,`itemtype`, `count`, `attributes`) VALUES ('".$player->getId()."', '".$save_item['pid']."', '".$save_item['sid']."', '".$save_item['itemtype']."', '".$save_item['count']."', '".$save_item['attributes']."');");
|
||||
|
||||
echo $twig->render('success.html.twig', array(
|
||||
$twig->display('success.html.twig', array(
|
||||
'title' => 'Character Created',
|
||||
'description' => 'The character <b>' . $newchar_name . '</b> has been created.<br/>
|
||||
Please select the outfit when you log in for the first time.<br/><br/>
|
||||
@@ -199,11 +199,11 @@ if($save) {
|
||||
}
|
||||
|
||||
if(count($errors) > 0) {
|
||||
echo $twig->render('error_box.html.twig', array('errors' => $errors));
|
||||
$twig->display('error_box.html.twig', array('errors' => $errors));
|
||||
}
|
||||
|
||||
if(!$newchar_created) {
|
||||
echo $twig->render('account.create_character.html.twig', array(
|
||||
$twig->display('account.create_character.html.twig', array(
|
||||
'name' => $newchar_name,
|
||||
'sex' => $newchar_sex,
|
||||
'vocation' => $newchar_vocation,
|
||||
|
@@ -32,7 +32,7 @@ if(isset($_POST['deletecharactersave']) && $_POST['deletecharactersave'] == 1) {
|
||||
else
|
||||
$player->setCustomField('deleted', 1);
|
||||
$account_logged->logAction('Deleted character <b>' . $player->getName() . '</b>.');
|
||||
echo $twig->render('success.html.twig', array(
|
||||
$twig->display('success.html.twig', array(
|
||||
'title' => 'Character Deleted',
|
||||
'description' => 'The character <b>' . $player_name . '</b> has been deleted.'
|
||||
));
|
||||
@@ -62,8 +62,8 @@ if(isset($_POST['deletecharactersave']) && $_POST['deletecharactersave'] == 1) {
|
||||
}
|
||||
if($show_form) {
|
||||
if(!empty($errors)) {
|
||||
echo $twig->render('error_box.html.twig', array('errors' => $errors));
|
||||
$twig->display('error_box.html.twig', array('errors' => $errors));
|
||||
}
|
||||
echo $twig->render('account.delete_character.html.twig');
|
||||
$twig->display('account.delete_character.html.twig');
|
||||
}
|
||||
?>
|
@@ -19,10 +19,10 @@ if(isset($_POST['registeraccountsave']) && $_POST['registeraccountsave'] == "1")
|
||||
if(empty($old_key)) {
|
||||
$show_form = false;
|
||||
$new_rec_key = generateRandomString(10, false, true, true);
|
||||
|
||||
|
||||
$account_logged->setCustomField("key", $new_rec_key);
|
||||
$account_logged->logAction('Generated recovery key.');
|
||||
|
||||
|
||||
if($config['mail_enabled'] && $config['send_mail_when_generate_reckey'])
|
||||
{
|
||||
$mailBody = $twig->render('mail.account.register.html.twig', array(
|
||||
@@ -33,7 +33,7 @@ if(isset($_POST['registeraccountsave']) && $_POST['registeraccountsave'] == "1")
|
||||
else
|
||||
$message = '<br /><p class="error">An error occorred while sending email with recovery key! You will not receive e-mail with this key. Error:<br/>' . $mailer->ErrorInfo . '</p>';
|
||||
}
|
||||
echo $twig->render('success.html.twig', array(
|
||||
$twig->display('success.html.twig', array(
|
||||
'title' => 'Account Registered',
|
||||
'description' => 'Thank you for registering your account! You can now recover your account if you have lost access to the assigned email address by using the following<br/><br/><font size="5"> <b>Recovery Key: '.$new_rec_key.'</b></font><br/><br/><br/><b>Important:</b><ul><li>Write down this recovery key carefully.</li><li>Store it at a safe place!</li>' . $message . '</ul>'
|
||||
));
|
||||
@@ -48,11 +48,11 @@ if(isset($_POST['registeraccountsave']) && $_POST['registeraccountsave'] == "1")
|
||||
if($show_form) {
|
||||
if(!empty($errors)) {
|
||||
//show errors
|
||||
echo $twig->render('error_box.html.twig', array('errors' => $errors));
|
||||
$twig->display('error_box.html.twig', array('errors' => $errors));
|
||||
}
|
||||
|
||||
|
||||
//show form
|
||||
echo $twig->render('account.generate_recovery_key.html.twig');
|
||||
$twig->display('account.generate_recovery_key.html.twig');
|
||||
}
|
||||
|
||||
?>
|
@@ -27,11 +27,11 @@ else
|
||||
{
|
||||
$show_form = false;
|
||||
$new_rec_key = generateRandomString(10, false, true, true);
|
||||
|
||||
|
||||
$mailBody = $twig->render('mail.account.register.html.twig', array(
|
||||
'recovery_key' => $new_rec_key
|
||||
));
|
||||
|
||||
|
||||
if(_mail($account_logged->getEMail(), $config['lua']['serverName']." - new recovery key", $mailBody))
|
||||
{
|
||||
$account_logged->setCustomField("key", $new_rec_key);
|
||||
@@ -41,8 +41,8 @@ else
|
||||
}
|
||||
else
|
||||
$message = '<br /><p class="error">An error occorred while sending email ( <b>'.$account_logged->getEMail().'</b> ) with recovery key! Recovery key not changed. Try again. Error:<br/>' . $mailer->ErrorInfo . '</p>';
|
||||
|
||||
echo $twig->render('success.html.twig', array(
|
||||
|
||||
$twig->display('success.html.twig', array(
|
||||
'title' => 'Account Registered',
|
||||
'description' => '<ul>' . $message . '</ul>'
|
||||
));
|
||||
@@ -53,16 +53,16 @@ else
|
||||
else
|
||||
$errors[] = 'Wrong password to account.';
|
||||
}
|
||||
|
||||
|
||||
//show errors if not empty
|
||||
if(!empty($errors)) {
|
||||
echo $twig->render('error_box.html.twig', array('errors' => $errors));
|
||||
$twig->display('error_box.html.twig', array('errors' => $errors));
|
||||
}
|
||||
|
||||
|
||||
if($show_form)
|
||||
{
|
||||
//show form
|
||||
echo $twig->render('account.generate_new_recovery_key.html.twig', array(
|
||||
$twig->display('account.generate_new_recovery_key.html.twig', array(
|
||||
'points' => $points
|
||||
));
|
||||
}
|
||||
|
Reference in New Issue
Block a user