* replace "$twig->render()" with "$this->display"

This commit is contained in:
slawkens 2018-05-29 21:29:08 +02:00
parent 68d74a490b
commit c654ea329c
69 changed files with 413 additions and 413 deletions

View File

@ -18,7 +18,7 @@ else {
$locales[] = array('id' => $tmp_locale, 'name' => $locale['name']);
}
}
echo $twig->render('install.welcome.html.twig', array(
$twig->display('install.welcome.html.twig', array(
'locales' => $locales,
'locale' => $locale,
'buttons' => next_buttons(false, true)

View File

@ -1,7 +1,7 @@
<?php
defined('MYAAC') or die('Direct access not allowed!');
echo $twig->render('install.license.html.twig', array(
$twig->display('install.license.html.twig', array(
'license' => file_get_contents(BASE . 'LICENSE'),
'buttons' => next_buttons()
));

View File

@ -6,11 +6,11 @@ foreach($config['clients'] as $client) {
$client_version = (string)($client / 100);
if(strpos($client_version, '.') == false)
$client_version .= '.0';
$clients[$client] = $client_version;
}
echo $twig->render('install.config.html.twig', array(
$twig->display('install.config.html.twig', array(
'clients' => $clients,
'timezones' => DateTimeZone::listIdentifiers(),
'locale' => $locale,

View File

@ -51,7 +51,7 @@ if(!$error) {
error($database_error);
}
else {
echo $twig->render('install.installer.html.twig', array(
$twig->display('install.installer.html.twig', array(
'url' => 'tools/5-database.php',
'message' => $locale['loading_spinner']
));

View File

@ -9,7 +9,7 @@ if(!$error) {
error($database_error);
}
echo $twig->render('install.admin.html.twig', array(
$twig->display('install.admin.html.twig', array(
'locale' => $locale,
'session' => $_SESSION,
'errors' => isset($errors) ? $errors : null,

View File

@ -115,7 +115,7 @@ else {
}
}
echo $twig->render('install.installer.html.twig', array(
$twig->display('install.installer.html.twig', array(
'url' => 'tools/7-finish.php',
'message' => $locale['importing_spinner']
));

View File

@ -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
));
}

View File

@ -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">&nbsp;</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

View File

@ -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,

View File

@ -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()

View File

@ -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
));

View File

@ -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

View File

@ -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,

View File

@ -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');
}
?>

View File

@ -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">&nbsp;&nbsp;&nbsp;<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');
}
?>

View File

@ -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
));
}

View File

@ -21,7 +21,7 @@ $config_salt_enabled = $db->hasColumn('accounts', 'salt');
if(ACTION == "logout" && !isset($_REQUEST['account_login'])) {
if(!defined('HOOK_LOGOUT_DISPLAY') || HOOK_LOGOUT_DISPLAY) { // plugin will take care of this message
echo $twig->render('account.logout.html.twig');
$twig->display('account.logout.html.twig');
}
return;
@ -35,9 +35,9 @@ if(!$logged)
}
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.login.html.twig', array(
$twig->display('account.login.html.twig', array(
'redirect' => isset($_REQUEST['redirect']) ? $_REQUEST['redirect'] : null,
'account' => USE_ACCOUNT_NAME ? 'Name' : 'Number',
'error' => isset($errors[0]) ? $errors[0] : null
@ -52,7 +52,7 @@ $errors = array();
{
$redirect = urldecode($_REQUEST['redirect']);
echo $twig->render('account.redirect.html.twig', array(
$twig->display('account.redirect.html.twig', array(
'redirect' => $redirect
));
return;
@ -114,7 +114,7 @@ $errors = array();
$account_players = $account_logged->getPlayersList();
$account_players->orderBy('id');
echo $twig->render('account.management.html.twig', array(
$twig->display('account.management.html.twig', array(
'welcome_message' => $welcome_message,
'recovery_key' => $recovery_key,
'email_change' => $email_change,

View File

@ -47,7 +47,7 @@ $tmp = '';
if(fetchDatabaseConfig('site_closed_message', $tmp))
$closed_message = $tmp;
echo $twig->render('admin.dashboard.html.twig', array(
$twig->display('admin.dashboard.html.twig', array(
'is_closed' => $is_closed,
'closed_message' => $closed_message,
'status' => $status
@ -60,7 +60,7 @@ function clearCache()
$tmp = '';
if($cache->fetch('status', $tmp))
$cache->delete('status');
if($cache->fetch('templates', $tmp))
$cache->delete('templates');
@ -90,7 +90,7 @@ function clearCache()
if($cache->fetch('news' . $template_name . '_' . TICKER, $tmp))
$cache->delete('news' . $template_name . '_' . TICKER);
if($cache->fetch('template_ini' . $template_name, $tmp))
$cache->delete('template_ini' . $template_name);

View File

@ -13,7 +13,7 @@ $title = 'Load items.xml';
require LIBS . 'items.php';
require LIBS . 'weapons.php';
echo $twig->render('admin.items.html.twig');
$twig->display('admin.items.html.twig');
$reload = isset($_REQUEST['reload']) && (int)$_REQUEST['reload'] == 1;
if($reload) {

View File

@ -19,5 +19,5 @@ if(isset($errors)) {
}
}
echo $twig->render('admin.login.html.twig');
$twig->display('admin.login.html.twig');
?>

View File

@ -30,14 +30,14 @@ $preview_done = false;
if($preview) {
if(!empty($mail_content) && !empty($mail_subject)) {
$preview_done = _mail($account_logged->getCustomField('email'), $mail_subject, $mail_content);
if(!$preview_done)
error('Error while sending preview mail: ' . $mailer->ErrorInfo);
}
}
echo $twig->render('admin.mailer.html.twig', array(
$twig->display('admin.mailer.html.twig', array(
'mail_subject' => $mail_subject,
'mail_content' => $mail_content,
'preview_done' => $preview_done

View File

@ -101,7 +101,7 @@ if(isset($_REQUEST['template'])) {
echo '<input type="button" class="button" value="Cancel" onclick="window.location = \'' . ADMIN_URL . '?p=menus&template=' . $template . '\';">';
echo '</form>';
echo $twig->render('admin.menus.js.html.twig', array(
$twig->display('admin.menus.js.html.twig', array(
'menus' => $menus,
'last_id' => $last_id
));
@ -115,7 +115,7 @@ else {
}
}
echo $twig->render('admin.menus.form.html.twig', array(
$twig->display('admin.menus.form.html.twig', array(
'templates' => $templates
));
}

View File

@ -27,7 +27,7 @@ else
$_content = $notepad_content;
}
echo $twig->render('admin.notepad.html.twig', array('content' => isset($_content) ? $_content : null));
$twig->display('admin.notepad.html.twig', array('content' => isset($_content) ? $_content : null));
class Notepad
{

View File

@ -84,7 +84,7 @@ if(!empty($action))
}
if(!empty($errors))
echo $twig->render('error_box.html.twig', array('errors' => $errors));
$twig->display('error_box.html.twig', array('errors' => $errors));
}
$query =
@ -100,7 +100,7 @@ foreach($query as $_page) {
);
}
echo $twig->render('admin.pages.form.html.twig', array(
$twig->display('admin.pages.form.html.twig', array(
'action' => $action,
'id' => $action == 'edit' ? $id : null,
'name' => $name,
@ -111,7 +111,7 @@ echo $twig->render('admin.pages.form.html.twig', array(
'access' => $access
));
echo $twig->render('admin.pages.html.twig', array(
$twig->display('admin.pages.html.twig', array(
'pages' => $pages
));

View File

@ -12,7 +12,7 @@ $title = 'Plugin manager';
require LIBS . 'plugins.php';
echo $twig->render('admin.plugins.form.html.twig');
$twig->display('admin.plugins.form.html.twig');
if(isset($_REQUEST['uninstall'])){
$uninstall = $_REQUEST['uninstall'];
@ -118,7 +118,7 @@ foreach(get_plugins() as $plugin)
}
}
echo $twig->render('admin.plugins.html.twig', array(
$twig->display('admin.plugins.html.twig', array(
'plugins' => $plugins
));
?>

View File

@ -28,7 +28,7 @@ $total_houses = $query['how_much'];
$points = $db->query('SELECT `premium_points`, `' . (USE_ACCOUNT_NAME ? 'name' : 'id') . '` as `name` FROM `accounts` ORDER BY `premium_points` DESC LIMIT 10;');
echo $twig->render('admin.statistics.html.twig', array(
$twig->display('admin.statistics.html.twig', array(
'total_accounts' => $total_accounts,
'total_players' => $total_players,
'total_guilds' => $total_guilds,

View File

@ -28,7 +28,7 @@ function compare($a, $b) {
$tmp = $visitors->getVisitors();
usort($tmp, 'compare');
echo $twig->render('admin.visitors.html.twig', array(
$twig->display('admin.visitors.html.twig', array(
'config_visitors_counter_ttl' => $config['visitors_counter_ttl'],
'visitors' => $tmp
));

View File

@ -31,11 +31,11 @@ foreach($changelogs as $key => &$log)
if ($i >= $limit)
$next_page = true;
$i++;
}
echo $twig->render('changelog.html.twig', array(
$twig->display('changelog.html.twig', array(
'changelogs' => $changelogs,
'page' => $_page,
'next_page' => $next_page,

View File

@ -377,7 +377,7 @@ WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, kil
}
}
echo $twig->render('characters.html.twig', array(
$twig->display('characters.html.twig', array(
'outfit' => isset($outfit) ? $outfit : null,
'player' => $player,
'account' => $account,
@ -421,7 +421,7 @@ WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, kil
else
{
$search_errors[] = 'Character <b>' . $name . '</b> does not exist or has been deleted.';
echo $twig->render('error_box.html.twig', array('errors' => $search_errors));
$twig->display('error_box.html.twig', array('errors' => $search_errors));
$search_errors = array();
$promotion = '';
@ -450,4 +450,4 @@ else
}
if(!empty($search_errors))
echo $twig->render('error_box.html.twig', array('errors' => $search_errors));
$twig->display('error_box.html.twig', array('errors' => $search_errors));

View File

@ -32,7 +32,7 @@ if($canEdit)
if(isset($_REQUEST['words']))
$words = $_REQUEST['words'];
if(isset($_REQUEST['description']))
$description = stripslashes($_REQUEST['description']);
@ -68,10 +68,10 @@ if($canEdit)
}
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('commands.form.html.twig', array(
$twig->display('commands.form.html.twig', array(
'link' => getLink('commands/' . ($action == 'edit' ? 'edit' : 'add')),
'action' => $action,
'id' => isset($id) ? $id : null,
@ -88,7 +88,7 @@ $commands =
' ORDER BY `ordering`;');
$last = $commands->rowCount();
echo $twig->render('commands.html.twig', array(
$twig->display('commands.html.twig', array(
'commands' => $commands,
'last' => $last,
'canEdit' => $canEdit

View File

@ -171,7 +171,7 @@ if($save)
if(_mail($email, 'New account on ' . $config['lua']['serverName'], $body_html))
{
echo $twig->render('account.created.verify.html.twig', array(
$twig->display('account.created.verify.html.twig', array(
'account' => $tmp_account
));
}
@ -184,7 +184,7 @@ if($save)
}
else
{
echo $twig->render('account.created.html.twig', array(
$twig->display('account.created.html.twig', array(
'account' => $tmp_account
));
@ -223,7 +223,7 @@ if($config['account_country_recognize']) {
}
if(!empty($errors))
echo $twig->render('error_box.html.twig', array('errors' => $errors));
$twig->display('error_box.html.twig', array('errors' => $errors));
if($config['account_country']) {
$countries = array();
@ -235,8 +235,8 @@ if($config['account_country']) {
$countries[$code] = $c;
}
echo $twig->render('account.create.js.html.twig');
echo $twig->render('account.create.html.twig', array(
$twig->display('account.create.js.html.twig');
$twig->display('account.create.html.twig', array(
'account' => isset($_POST['account']) ? $_POST['account'] : '',
'email' => isset($_POST['email']) ? $_POST['email'] : '',
'countries' => isset($countries) ? $countries : null,

View File

@ -238,5 +238,5 @@ else
}
//back button
echo $twig->render('creatures.back_button.html.twig');
$twig->display('creatures.back_button.html.twig');
?>

View File

@ -9,5 +9,5 @@
*/
$title = 'Downloads';
echo $twig->render('downloads.html.twig');
$twig->display('downloads.html.twig');
?>

View File

@ -18,7 +18,7 @@ for($i = 0; $i < $columns; $i++) {
}
}
echo $twig->render('experience_table.html.twig', array(
$twig->display('experience_table.html.twig', array(
'experience' => $experience
));
?>

View File

@ -17,15 +17,15 @@ if($canEdit)
{
if($action == 'delete' || $action == 'edit' || $action == 'hide' || $action == 'moveup' || $action == 'movedown')
$id = $_REQUEST['id'];
if(isset($_REQUEST['question']))
$question = $_REQUEST['question'];
if(isset($_REQUEST['answer']))
$answer = stripslashes($_REQUEST['answer']);
$errors = array();
if($action == 'add') {
if(FAQ::add($question, $answer, $errors))
$question = $answer = '';
@ -54,12 +54,12 @@ if($canEdit)
else if($action == 'movedown') {
FAQ::move($id, 1, $errors);
}
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('faq.form.html.twig', array(
$twig->display('faq.form.html.twig', array(
'link' => getLink('faq/' . ($action == 'edit' ? 'edit' : 'add')),
'action' => $action,
'id' => isset($id) ? $id : null,
@ -83,7 +83,7 @@ if(!$faqs->rowCount())
}
$last = $faqs->rowCount();
echo $twig->render('faq.html.twig', array(
$twig->display('faq.html.twig', array(
'faqs' => $faqs,
'last' => $last,
'canEdit' => $canEdit
@ -97,7 +97,7 @@ class FAQ
if(isset($question[0]) && isset($answer[0]))
{
$query = $db->select(TABLE_PREFIX . 'faq', array('question' => $question));
if($query === false)
{
$query =
@ -106,7 +106,7 @@ class FAQ
' FROM ' . $db->tableName(TABLE_PREFIX . 'faq') .
' ORDER BY ' . $db->fieldName('ordering') . ' DESC LIMIT 1'
);
$ordering = 0;
if($query->rowCount() > 0) {
$query = $query->fetch();
@ -119,20 +119,20 @@ class FAQ
}
else
$errors[] = 'Please fill all inputs.';
return !count($errors);
}
static public function get($id) {
global $db;
return $db->select(TABLE_PREFIX . 'faq', array('id' => $id));
}
static public function update($id, $question, $answer) {
global $db;
$db->update(TABLE_PREFIX . 'faq', array('question' => $question, 'answer' => $answer), array('id' => $id));
}
static public function delete($id, &$errors)
{
global $db;
@ -145,10 +145,10 @@ class FAQ
}
else
$errors[] = 'id not set';
return !count($errors);
}
static public function toggleHidden($id, &$errors)
{
global $db;
@ -162,10 +162,10 @@ class FAQ
}
else
$errors[] = 'id not set';
return !count($errors);
}
static public function move($id, $i, &$errors)
{
global $db;
@ -176,12 +176,12 @@ class FAQ
$old_record = $db->select(TABLE_PREFIX . 'faq', array('ordering' => $ordering));
if($old_record !== false)
$db->update(TABLE_PREFIX . 'faq', array('ordering' => $query['ordering']), array('ordering' => $ordering));
$db->update(TABLE_PREFIX . 'faq', array('ordering' => $ordering), array('id' => $id));
}
else
$errors[] = 'FAQ with id ' . $id . ' does not exists.';
return !count($errors);
}
}

View File

@ -89,14 +89,14 @@ if($canEdit)
}
if(!empty($errors)) {
echo $twig->render('error_box.html.twig', array('errors' => $errors));
$twig->display('error_box.html.twig', array('errors' => $errors));
$action = '';
}
}
if(empty($action) || $action == 'edit_board') {
$guilds = $db->query('SELECT `id`, `name` FROM `guilds`')->fetchAll();
echo $twig->render('forum.add_board.html.twig', array(
$twig->display('forum.add_board.html.twig', array(
'link' => getLink('forum', ($action == 'edit_board' ? 'edit_board' : 'add_board')),
'action' => $action,
'id' => isset($id) ? $id : null,
@ -163,7 +163,7 @@ if(empty($action))
}
}
echo $twig->render('forum.boards.html.twig', array(
$twig->display('forum.boards.html.twig', array(
'boards' => $boards,
'canEdit' => $canEdit,
'last' => count($sections)

View File

@ -17,7 +17,7 @@ if(Forum::canPost($account_logged))
echo 'Please enter post id.';
return;
}
$thread = $db->query("SELECT `author_guid`, `author_aid`, `first_post`, `post_topic`, `post_date`, `post_text`, `post_smile`, `post_html`, `id`, `section` FROM `" . TABLE_PREFIX . "forum` WHERE `id` = ".$post_id." LIMIT 1")->fetch();
if(isset($thread['id']))
{
@ -55,9 +55,9 @@ if(Forum::canPost($account_logged))
$errors[] = 'Please select a character.';
if(empty($post_topic) && $thread['id'] == $thread['first_post'])
$errors[] = 'Thread topic can\'t be empty.';
$player_on_account = false;
if(count($errors) == 0)
{
foreach($players_from_account as $player)
@ -66,7 +66,7 @@ if(Forum::canPost($account_logged))
if(!$player_on_account)
$errors[] = 'Player with selected ID '.$char_id.' doesn\'t exist or isn\'t on your account';
}
if(count($errors) == 0) {
$saved = true;
if($account_logged->getId() != $thread['author_aid'])
@ -85,13 +85,13 @@ if(Forum::canPost($account_logged))
$smile = (int) $thread['post_smile'];
$html = (int) $thread['post_html'];
}
if(!$saved)
{
if(!empty($errors))
echo $twig->render('error_box.html.twig', array('errors' => $errors));
echo $twig->render('forum.edit_post.html.twig', array(
$twig->display('error_box.html.twig', array('errors' => $errors));
$twig->display('forum.edit_post.html.twig', array(
'post_id' => $post_id,
'players' => $players_from_account,
'player_id' => $char_id,

View File

@ -38,17 +38,17 @@ else {
$post_id = (int)$_REQUEST['id'];
$post = $db->query("SELECT `id`, `section`, `first_post`, `post_topic`, `author_guid` FROM `" . TABLE_PREFIX . "forum` WHERE `id` = " . $post_id . " LIMIT 1")->fetch();
$name = $db->query("SELECT `name` FROM `players` WHERE `id` = " . $post['author_guid'] . " ")->fetch();
$sections_allowed = array();
foreach($sections as $id => $section) {
if(Forum::hasAccess($id)) {
$sections_allowed[$id] = $section;
}
}
if ($post['id'] == $post_id) {
if ($post['id'] == $post['first_post']) {
echo $twig->render('forum.move_thread.html.twig', array(
$twig->display('forum.move_thread.html.twig', array(
'thread' => $post['post_topic'],
'author' => $name['name'],
'board' => $sections[$post['section']]['name'],

View File

@ -18,7 +18,7 @@ if(Forum::canPost($account_logged))
echo "Thread with this id doesn't exist.";
return;
}
$thread = $db->query("SELECT `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`id`, `" . TABLE_PREFIX . "forum`.`section` FROM `" . TABLE_PREFIX . "forum` WHERE `" . TABLE_PREFIX . "forum`.`id` = ".(int) $thread_id." AND `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread_id." LIMIT 1")->fetch();
echo '<a href="' . getLink('forum') . '">Boards</a> >> <a href="' . getForumBoardLink($thread['section']) . '">'.$sections[$thread['section']]['name'].'</a> >> <a href="' . getForumThreadLink($thread_id) . '">'.$thread['post_topic'].'</a> >> <b>Post new reply</b><br /><h3>'.$thread['post_topic'].'</h3>';
if(isset($thread['id']) && Forum::hasAccess($thread['section']))
@ -48,7 +48,7 @@ if(Forum::canPost($account_logged))
$errors[] = 'Too short or too long post (short: '.$lenght.' long: '.strlen($text).' letters). Minimum 1 letter, maximum 15000 letters.';
if($char_id == 0)
$errors[] = 'Please select a character.';
$player_on_account = false;
if(count($errors) == 0)
{
@ -81,12 +81,12 @@ if(Forum::canPost($account_logged))
echo '<br />Thank you for posting.<br /><a href="' . getForumThreadLink($thread_id, $_page) . '">GO BACK TO LAST THREAD</a>';
}
}
if(!$saved)
{
if(!empty($errors))
echo $twig->render('error_box.html.twig', array('errors' => $errors));
$twig->display('error_box.html.twig', array('errors' => $errors));
$threads = $db->query("SELECT `players`.`name`, `" . TABLE_PREFIX . "forum`.`post_text`, `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`post_smile`, `" . TABLE_PREFIX . "forum`.`post_html`, `" . TABLE_PREFIX . "forum`.`author_aid` FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` AND `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread_id." ORDER BY `" . TABLE_PREFIX . "forum`.`post_date` DESC LIMIT 5")->fetchAll();
foreach($threads as &$thread) {
$player_account = new OTS_Account();
@ -95,8 +95,8 @@ if(Forum::canPost($account_logged))
$thread['post'] = Forum::showPost(($thread['post_html'] > 0 ? $thread['post_topic'] : htmlspecialchars($thread['post_topic'])), ($thread['post_html'] > 0 ? $thread['post_text'] : htmlspecialchars($thread['post_text'])), $thread['post_smile'] == 0, $thread['post_html'] > 0);
}
}
echo $twig->render('forum.new_post.html.twig', array(
$twig->display('forum.new_post.html.twig', array(
'thread_id' => $thread_id,
'post_player_id' => $char_id,
'players' => $players_from_account,
@ -116,4 +116,4 @@ if(Forum::canPost($account_logged))
else
echo "Your account is banned, deleted or you don't have any player with level " . $config['forum_level_required'] . " on your account. You can't post.";
echo $twig->render('forum.fullscreen.html.twig');
$twig->display('forum.fullscreen.html.twig');

View File

@ -19,7 +19,7 @@ if(Forum::canPost($account_logged))
if(isset($sections[$section_id]['name']) && Forum::hasAccess($section_id)) {
if ($sections[$section_id]['closed'] && !Forum::isModerator())
$errors[] = 'You cannot create topic on this board.';
$quote = (int)(isset($_REQUEST['quote']) ? $_REQUEST['quote'] : 0);
$text = isset($_REQUEST['text']) ? stripslashes($_REQUEST['text']) : '';
$char_id = (int)(isset($_REQUEST['char_id']) ? $_REQUEST['char_id'] : 0);
@ -29,7 +29,7 @@ if(Forum::canPost($account_logged))
$saved = false;
if (isset($_REQUEST['save'])) {
$errors = array();
$lenght = 0;
for ($i = 0; $i < strlen($post_topic); $i++) {
if (ord($post_topic[$i]) >= 33 && ord($post_topic[$i]) <= 126)
@ -44,11 +44,11 @@ if(Forum::canPost($account_logged))
}
if ($lenght < 1 || strlen($text) > 15000)
$errors[] = 'Too short or too long post (short: ' . $lenght . ' long: ' . strlen($text) . ' letters). Minimum 1 letter, maximum 15000 letters.';
if ($char_id == 0)
$errors[] = 'Please select a character.';
$player_on_account = false;
if (count($errors) == 0) {
foreach ($players_from_account as $player)
if ($char_id == $player['id'])
@ -56,7 +56,7 @@ if(Forum::canPost($account_logged))
if (!$player_on_account)
$errors[] = 'Player with selected ID ' . $char_id . ' doesn\'t exist or isn\'t on your account';
}
if (count($errors) == 0) {
$last_post = 0;
$query = $db->query('SELECT `post_date` FROM `' . TABLE_PREFIX . 'forum` ORDER BY `post_date` DESC LIMIT 1');
@ -76,12 +76,12 @@ if(Forum::canPost($account_logged))
echo '<br />Thank you for posting.<br /><a href="' . getForumThreadLink($thread_id) . '">GO BACK TO LAST THREAD</a>';
}
}
if (!$saved) {
if (!empty($errors))
echo $twig->render('error_box.html.twig', array('errors' => $errors));
echo $twig->render('forum.new_thread.html.twig', array(
$twig->display('error_box.html.twig', array('errors' => $errors));
$twig->display('forum.new_thread.html.twig', array(
'section_id' => $section_id,
'players' => $players_from_account,
'post_player_id' => $char_id,

View File

@ -49,7 +49,7 @@ foreach($posts as &$post)
error('Forum error: Player not loaded.');
die();
}
if($config['characters']['outfit']) {
$post['outfit'] = $config['outfit_images_url'] . '?id=' . $player->getLookType() . ($lookaddons ? '&addons=' . $player->getLookAddons() : '') . '&head=' . $player->getLookHead() . '&body=' . $player->getLookBody() . '&legs=' . $player->getLookLegs() . '&feet=' . $player->getLookFeet();
}
@ -59,7 +59,7 @@ foreach($posts as &$post)
if($group->isLoaded()) {
$groupName = $group->getName();
}
$post['group'] = $groupName;
$post['player_link'] = getPlayerLink($player->getName());
@ -75,7 +75,7 @@ foreach($posts as &$post)
$player_account = $player->getAccount();
$post['content'] = Forum::showPost(($post['post_html'] > 0 ? $post['post_topic'] : htmlspecialchars($post['post_topic'])), ($post['post_html'] > 0 ? $post['post_text'] : htmlspecialchars($post['post_text'])), $post['post_smile'] == 0, $post['post_html'] > 0);
$query = $db->query("SELECT COUNT(`id`) AS 'posts' FROM `" . TABLE_PREFIX . "forum` WHERE `author_aid`=".(int) $player_account->getId())->fetch();
$post['author_posts_count'] = (int)$query['posts'];
@ -90,7 +90,7 @@ foreach($posts as &$post)
}
}
echo $twig->render('forum.show_thread.html.twig', array(
$twig->display('forum.show_thread.html.twig', array(
'thread_id' => $thread_id,
'posts' => $posts,
'links_to_pages' => $links_to_pages,
@ -100,4 +100,4 @@ echo $twig->render('forum.show_thread.html.twig', array(
'is_moderator' => Forum::isModerator()
));
echo $twig->render('forum.fullscreen.html.twig');
$twig->display('forum.fullscreen.html.twig');

View File

@ -16,18 +16,18 @@ if($canEdit) {
if (!empty($action)) {
if ($action == 'delete' || $action == 'edit' || $action == 'hide' || $action == 'moveup' || $action == 'movedown')
$id = $_REQUEST['id'];
if (isset($_REQUEST['comment']))
$comment = stripslashes($_REQUEST['comment']);
if (isset($_REQUEST['image']))
$image = $_REQUEST['image'];
if (isset($_REQUEST['author']))
$author = $_REQUEST['author'];
$errors = array();
if ($action == 'add') {
if (Gallery::add($comment, $image, $author, $errors))
$comment = $image = $author = '';
@ -50,13 +50,13 @@ if($canEdit) {
} else if ($action == 'movedown') {
Gallery::move($id, 1, $errors);
}
if (!empty($errors))
echo $twig->render('error_box.html.twig', array('errors' => $errors));
$twig->display('error_box.html.twig', array('errors' => $errors));
}
if(!isset($_GET['image'])) {
echo $twig->render('gallery.form.html.twig', array(
$twig->display('gallery.form.html.twig', array(
'link' => getLink('gallery/' . ($action == 'edit' ? 'edit' : 'add')),
'action' => $action,
'id' => isset($id) ? $id : null,
@ -92,8 +92,8 @@ if(isset($_GET['image']))
$next_image = $next_image->fetch();
else
$next_image = NULL;
echo $twig->render('gallery.get.html.twig', array(
$twig->display('gallery.get.html.twig', array(
'previous' => $previous_image ? $previous_image['id'] : null,
'next' => $next_image ? $next_image['id'] : null,
'image' => $image
@ -117,7 +117,7 @@ if(!$last)
return;
}
echo $twig->render('gallery.html.twig', array(
$twig->display('gallery.html.twig', array(
'images' => $images,
'last' => $last,
'canEdit' => $canEdit
@ -136,13 +136,13 @@ class Gallery
' FROM `' . TABLE_PREFIX . 'gallery`' .
' ORDER BY `ordering`' . ' DESC LIMIT 1'
);
$ordering = 0;
if($query->rowCount() > 0) {
$query = $query->fetch();
$ordering = $query['ordering'] + 1;
}
$pathinfo = pathinfo($image);
$extension = strtolower($pathinfo['extension']);
$thumb_filename = 'images/gallery/' . $pathinfo['filename'] . '_thumb.' . $extension;
@ -158,22 +158,22 @@ class Gallery
}
else
$errors[] = 'Please fill all inputs.';
return !count($errors);
}
static public function get($id) {
global $db;
return $db->select(TABLE_PREFIX . 'gallery', array('id' => $id));
}
static public function update($id, $comment, $image, $author) {
global $db;
$pathinfo = pathinfo($image);
$extension = strtolower($pathinfo['extension']);
$filename = 'images/gallery/' . $pathinfo['filename'] . '.' . $extension;
if($db->update(TABLE_PREFIX . 'gallery', array(
'comment' => $comment,
'image' => $filename, 'author' => $author),
@ -183,7 +183,7 @@ class Gallery
self::resize($image, 650, 500, $filename, $errors);
}
}
static public function delete($id, &$errors)
{
global $db;
@ -196,10 +196,10 @@ class Gallery
}
else
$errors[] = 'id not set';
return !count($errors);
}
static public function toggleHidden($id, &$errors)
{
global $db;
@ -213,10 +213,10 @@ class Gallery
}
else
$errors[] = 'id not set';
return !count($errors);
}
static public function move($id, $i, &$errors)
{
global $db;
@ -227,20 +227,20 @@ class Gallery
$old_record = $db->select(TABLE_PREFIX . 'gallery', array('ordering' => $ordering));
if($old_record !== false)
$db->update(TABLE_PREFIX . 'gallery', array('ordering' => $query['ordering']), array('ordering' => $ordering));
$db->update(TABLE_PREFIX . 'gallery', array('ordering' => $ordering), array('id' => $id));
}
else
$errors[] = 'Image with id ' . $id . ' does not exists.';
return !count($errors);
}
static public function resize($file, $new_width, $new_height, $new_file, &$errors)
{
$pathinfo = pathinfo($file);
$extension = strtolower($pathinfo['extension']);
switch ($extension)
{
case 'gif': // GIF
@ -257,45 +257,45 @@ class Gallery
$errors[] = 'Unsupported file format.';
return false;
}
$width = imagesx($image);
$height = imagesy($image);
// create a new temporary image
$tmp_img = imagecreatetruecolor($new_width, $new_height);
// copy and resize old image into new image
imagecopyresized($tmp_img, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
// save thumbnail into a file
switch($extension)
{
case 'gif':
imagegif($tmp_img, $new_file);
break;
case 'jpg':
case 'jpeg':
imagejpeg($tmp_img, $new_file);
break;
case 'png':
imagepng($tmp_img, $new_file);
break;
}
return true;
}
static public function generateThumb($id, $file, &$errors)
{
$pathinfo = pathinfo($file);
$extension = strtolower($pathinfo['extension']);
$thumb_filename = 'images/gallery/' . $pathinfo['filename'] . '_thumb.' . $extension;
if(!self::resize($file, 170, 110, $thumb_filename, $errors))
return false;
global $db;
if(isset($id))
{
@ -307,7 +307,7 @@ class Gallery
}
else
$errors[] = 'id not set';
return !count($errors);
}
}

View File

@ -33,7 +33,7 @@ if(isset($_REQUEST['todo']) && $_REQUEST['todo'] == 'save') {
if(!Validator::characterName($name)) {
$errors[] = 'Invalid name format.';
}
if(empty($errors)) {
$player = new OTS_Player();
$player->find($name);
@ -63,7 +63,7 @@ if(isset($_REQUEST['todo']) && $_REQUEST['todo'] == 'save') {
}
}
}
if(!$is_invited) {
$errors[] = 'Character '.$player->getName.' isn\'t invited to guild <b>'.$guild->getName().'</b>.';
}
@ -77,7 +77,7 @@ else
include(SYSTEM . 'libs/pot/InvitesDriver.php');
new InvitesDriver($guild);
$invited_list = $guild->listInvites();
if(count($invited_list) > 0) {
foreach($invited_list as $invited) {
foreach($account_players as $player_from_acc) {
@ -96,16 +96,16 @@ else
}
if(!empty($errors)) {
echo $twig->render('error_box.html.twig', array('errors' => $errors));
echo $twig->render('guilds.back_button.html.twig', array(
$twig->display('error_box.html.twig', array('errors' => $errors));
$twig->display('guilds.back_button.html.twig', array(
'action' => getLink('guilds') . '/' . $guild_name
));
}
else {
if(isset($_REQUEST['todo']) && $_REQUEST['todo'] == 'save') {
$guild->acceptInvite($player);
echo $twig->render('success.html.twig', array(
$twig->display('success.html.twig', array(
'title' => 'Accept invitation',
'description' => 'Player with name <b>'.$player->getName().'</b> has been added to guild <b>'.$guild->getName() . '</b>.',
'custom_buttons' => $twig->render('guilds.back_button.html.twig', array(
@ -116,8 +116,8 @@ else {
else
{
sort($list_of_invited_players);
echo $twig->render('guilds.accept_invite.html.twig', array(
$twig->display('guilds.accept_invite.html.twig', array(
'guild_name' => $guild_name,
'invited_players' => $list_of_invited_players
));

View File

@ -55,9 +55,9 @@ if(empty($errors)) {
}
}
if(!empty($errors)) {
echo $twig->render('error_box.html.twig', array('errors' => $errors));
echo $twig->render('guilds.back_button.html.twig', array(
$twig->display('error_box.html.twig', array('errors' => $errors));
$twig->display('guilds.back_button.html.twig', array(
'new_line' => true,
'action' => '?subtopic=guilds&guild='.$guild_name.'&action=show'
));
@ -66,9 +66,9 @@ if(empty($errors)) {
else
{
if(!empty($errors)) {
echo $twig->render('error_box.html.twig', array('errors' => $errors));
echo $twig->render('guilds.back_button.html.twig', array(
$twig->display('error_box.html.twig', array('errors' => $errors));
$twig->display('guilds.back_button.html.twig', array(
'new_line' => true
));
}

View File

@ -37,7 +37,7 @@ if(empty($errors)) {
$level_in_guild = 3;
}
}
$saved = false;
if($guild_leader) {
if(isset($_REQUEST['todo']) && $_REQUEST['todo'] == 'save') {
@ -45,12 +45,12 @@ if(empty($errors)) {
$guild->setCustomField('description', $description);
$saved = true;
}
if($saved) {
success('Changes has been saved');
}
echo $twig->render('guilds.change_description.html.twig', array(
$twig->display('guilds.change_description.html.twig', array(
'guild' => $guild,
'rows' => bcsub($config['guild_description_lines_limit'],1)
));
@ -64,9 +64,9 @@ if(empty($errors)) {
}
}
if(!empty($errors)) {
echo $twig->render('error_box.html.twig', array('errors' => $errors));
echo $twig->render('guilds.back_button.html.twig', array(
$twig->display('error_box.html.twig', array('errors' => $errors));
$twig->display('guilds.back_button.html.twig', array(
'new_line' => true,
'action' => '?subtopic=guilds'
));

View File

@ -18,7 +18,7 @@ if(!Validator::guildName($guild_name)) {
if(empty($errors)) {
$guild = new OTS_Guild();
$guild->find($guild_name);
if(!$guild->isLoaded()) {
$errors[] = 'Guild with name <b>'.$guild_name.'</b> doesn\'t exist.';
}
@ -29,7 +29,7 @@ if(empty($errors)) {
$guild_leader_char = $guild->getOwner();
$guild_leader = false;
$account_players = $account_logged->getPlayers();
foreach($account_players as $player) {
if($guild_leader_char->getId() == $player->getId()) {
$guild_vice = true;
@ -37,7 +37,7 @@ if(empty($errors)) {
$level_in_guild = 3;
}
}
if($guild_leader)
{
$max_image_size_b = $config['guild_image_size_kb'] * 1024;
@ -53,7 +53,7 @@ if(empty($errors)) {
if($file['size'] > $max_image_size_b) {
$upload_errors[] = 'Uploaded image is too big. Size: <b>'.$file['size'].' bytes</b>, Max. size: <b>'.$max_image_size_b.' bytes</b>.';
}
$type = strtolower($file['type']);
if(!in_array($type, $allowed_ext)) {
$upload_errors[] = 'Your file type isn\' allowed. Allowed: <b>gif, jpg, bmp, png</b>. Your file type: <b>'.$type.'</b> If it\'s valid image contact with admin.';
@ -62,14 +62,14 @@ if(empty($errors)) {
else {
$upload_errors[] = 'You didn\'t send file or file is too big. Limit: <b>'.$config['guild_image_size_kb'].' KB</b>.';
}
if(empty($upload_errors)) {
$extension = $ext_name[$type];
if(!move_uploaded_file($file['tmp_name'], $save_path.'.'.$extension)) {
$upload_errors[] = "Sorry! Can't save your image.";
}
}
if(empty($upload_errors))
{
$guild_logo = $guild->getCustomField('logo_name');
@ -77,33 +77,33 @@ if(empty($errors)) {
if(empty($guild_logo) || !file_exists('images/guilds/' . $guild_logo)) {
$guild_logo = "default.gif";
}
if($guild_logo != "default.gif" && $guild_logo != $save_file_name.'.'.$extension) {
unlink('images/guilds/' . $guild_logo);
}
}
//show errors or save file
if(!empty($upload_errors)) {
echo $twig->render('error_box.html.twig', array('errors' => $upload_errors));
$twig->display('error_box.html.twig', array('errors' => $upload_errors));
}
else {
success('Logo has been changed.');
$guild->setCustomField('logo_name', $save_file_name.'.'.$extension);
}
}
$guild_logo = $guild->getCustomField('logo_name');
if(empty($guild_logo) || !file_exists('images/guilds/' . $guild_logo)) {
$guild_logo = "default.gif";
}
echo $twig->render('guilds.change_logo.html.twig', array(
$twig->display('guilds.change_logo.html.twig', array(
'guild_logo' => $guild_logo,
'guild' => $guild,
'max_image_size_b' => $max_image_size_b
));
}
else {
$errors[] = 'You are not a leader of guild!';
@ -115,9 +115,9 @@ if(empty($errors)) {
}
}
if(!empty($errors)) {
echo $twig->render('error_box.html.twig', array('errors' => $errors));
echo $twig->render('guilds.back_button.html.twig', array(
$twig->display('error_box.html.twig', array('errors' => $errors));
$twig->display('guilds.back_button.html.twig', array(
'new_line' => true,
'action' => '?subtopic=guilds'
));

View File

@ -40,7 +40,7 @@ if(empty($errors)) {
$level_in_guild = 3;
}
}
$saved = false;
if($guild_leader) {
if(isset($_REQUEST['todo']) && $_REQUEST['todo'] == 'save') {
@ -48,12 +48,12 @@ if(empty($errors)) {
$guild->setCustomField('motd', $motd);
$saved = true;
}
if($saved) {
success('Changes has been saved');
}
echo $twig->render('guilds.change_motd.html.twig', array(
$twig->display('guilds.change_motd.html.twig', array(
'guild' => $guild
));
}
@ -66,9 +66,9 @@ if(empty($errors)) {
}
}
if(!empty($errors)) {
echo $twig->render('error_box.html.twig', array('errors' => $errors));
echo $twig->render('guilds.back_button.html.twig', array(
$twig->display('error_box.html.twig', array('errors' => $errors));
$twig->display('guilds.back_button.html.twig', array(
'new_line' => true,
'action' => '?subtopic=guilds'
));

View File

@ -12,7 +12,7 @@ defined('MYAAC') or die('Direct access not allowed!');
if(!$logged) {
echo 'You are not logged.';
echo $twig->render('guilds.back_button.html.twig');
$twig->display('guilds.back_button.html.twig');
return;
}
@ -62,5 +62,5 @@ if(strlen($new_nick) <= 40)
else
echo 'Too long guild nick. Max. 40 chars, your length: '.strlen($new_nick);
echo $twig->render('guilds.back_button.html.twig');
$twig->display('guilds.back_button.html.twig');
?>

View File

@ -29,9 +29,9 @@ if(empty($errors))
if(!empty($errors))
{
echo $twig->render('error_box.html.twig', array('errors' => $errors));
echo $twig->render('guilds.back_button.html.twig');
$twig->display('error_box.html.twig', array('errors' => $errors));
$twig->display('guilds.back_button.html.twig');
return;
}
@ -74,23 +74,23 @@ if($guild_vice)
$ranks[$rid]['0'] = $rank->getId();
$ranks[$rid]['1'] = $rank->getName();
$rid++;
if($db->hasColumn('players', 'rank_id'))
$players_with_rank = $db->query('SELECT `id`, `rank_id` FROM `players` WHERE `rank_id` = ' . $rank->getId() . ' AND `deleted` = 0;');
else
$players_with_rank = $db->query('SELECT `players`.`id` as `id`, `' . GUILD_MEMBERS_TABLE . '`.`rank_id` as `rank_id` FROM `players`, `' . GUILD_MEMBERS_TABLE . '` WHERE `' . GUILD_MEMBERS_TABLE . '`.`rank_id` = ' . $rank->getId() . ' AND `players`.`id` = `' . GUILD_MEMBERS_TABLE . '`.`player_id` ORDER BY `name`;');
$players_with_rank_number = $players_with_rank->rowCount();
if(count($players_with_rank) > 0)
{
foreach($players_with_rank as $result)
{
$player = new OTS_Player();
$player->load($result['id']);
if(!$player->isLoaded())
continue;
if($guild->getOwner()->getId() != $player->getId() || $guild_leader)
{
$players_with_lower_rank[$sid][0] = $player->getName();
@ -141,16 +141,16 @@ if($guild_vice)
if(!$player_has_lower_rank)
$change_errors[] = 'This player has higher rank in guild than you. You can\'t change his/her rank.';
}
if(empty($change_errors))
{
$player_to_change->setRank($rank);
echo $twig->render('success.html.twig', array(
$twig->display('success.html.twig', array(
'title' => 'Rank Changed',
'description' => 'Rank of player <b>'.$player_to_change->getName().'</b> has been changed to <b>'.$rank->getName().'</b>.',
'custom_buttons' => ''
));
unset($players_with_lower_rank);
unset($ranks);
$rid = 0;
@ -162,12 +162,12 @@ if($guild_vice)
$ranks[$rid]['0'] = $rank->getId();
$ranks[$rid]['1'] = $rank->getName();
$rid++;
if($db->hasColumn('players', 'rank_id'))
$players_with_rank = $db->query('SELECT `id`, `rank_id` FROM `players` WHERE `rank_id` = ' . $rank->getId() . ' AND `deleted` = 0;');
else
$players_with_rank = $db->query('SELECT `players`.`id` as `id`, `' . GUILD_MEMBERS_TABLE . '`.`rank_id` as `rank_id` FROM `players`, `' . GUILD_MEMBERS_TABLE . '` WHERE `' . GUILD_MEMBERS_TABLE . '`.`rank_id` = ' . $rank->getId() . ' AND `players`.`id` = `' . GUILD_MEMBERS_TABLE . '`.`player_id` ORDER BY `name`;');
$players_with_rank_number = $players_with_rank->rowCount();
if(count($players_with_rank) > 0)
{
@ -177,7 +177,7 @@ if($guild_vice)
$player->load($result['id']);
if(!$player->isLoaded())
continue;
if($guild->getOwner()->getId() != $player->getId() || $guild_leader)
{
$players_with_lower_rank[$sid][0] = $player->getName();
@ -191,10 +191,10 @@ if($guild_vice)
}
else
{
echo $twig->render('error_box.html.twig', array('errors' => $change_errors));
$twig->display('error_box.html.twig', array('errors' => $change_errors));
}
}
echo $twig->render('guilds.change_rank.html.twig', array(
$twig->display('guilds.change_rank.html.twig', array(
'players' => $players_with_lower_rank,
'guild_name' => $guild->getName(),
'ranks' => $ranks
@ -202,7 +202,7 @@ if($guild_vice)
}
else {
echo 'Error. You are not a leader or vice leader in guild ' . $guild->getName();
echo $twig->render('guilds.back_button.html.twig', array(
$twig->display('guilds.back_button.html.twig', array(
'new_line' => true,
'action' => getLink('guilds') . '/' . $guild->getName()
));

View File

@ -13,7 +13,7 @@ defined('MYAAC') or die('Direct access not allowed!');
if(!$logged)
{
echo "You are not logged in.";
echo $twig->render('guilds.back_button.html.twig');
$twig->display('guilds.back_button.html.twig');
return;
}
@ -63,5 +63,5 @@ if(count($guilds_list) > 0)
else
echo "0 guilds found.";
echo $twig->render('guilds.back_button.html.twig');
$twig->display('guilds.back_button.html.twig');
?>

View File

@ -13,7 +13,7 @@ defined('MYAAC') or die('Direct access not allowed!');
if(!$logged)
{
echo "You are not logged in.";
echo $twig->render('guilds.back_button.html.twig');
$twig->display('guilds.back_button.html.twig');
return;
}
@ -50,7 +50,7 @@ if(count($players_list) > 0)
$player->setGuildNick('');
$changed_ranks_of[] = $player->getName();
}
}
}
echo "<b>Deleted ranks (this ranks guilds doesn't exist [bug fix]):</b>";
@ -64,6 +64,6 @@ if(count($players_list) > 0)
}
else
echo "0 players found.";
echo $twig->render('guilds.back_button.html.twig');
$twig->display('guilds.back_button.html.twig');
?>

View File

@ -47,12 +47,12 @@ if($todo == 'save')
$guild_errors[] = Validator::getLastError();
$guild_name = '';
}
if(!Validator::characterName($name)) {
$guild_errors[] = 'Invalid character name format.';
$name = '';
}
if(empty($guild_errors)) {
$player = new OTS_Player();
$player->find($name);
@ -60,8 +60,8 @@ if($todo == 'save')
$guild_errors[] = 'Character <b>'.$name.'</b> doesn\'t exist.';
}
}
if(empty($guild_errors))
{
$guild = new OTS_Guild();
@ -70,7 +70,7 @@ if($todo == 'save')
$guild_errors[] = 'Guild <b>'.$guild_name.'</b> already exist. Select other name.';
}
}
if(empty($guild_errors))
{
$bad_char = true;
@ -83,7 +83,7 @@ if($todo == 'save')
$guild_errors[] = 'Character <b>'.$name.'</b> isn\'t on your account or is already in guild.';
}
}
if(empty($guild_errors)) {
if($player->getLevel() < $config['guild_need_level']) {
$guild_errors[] = 'Character <b>'.$name.'</b> has too low level. To create guild you need character with level <b>'.$config['guild_need_level'].'</b>.';
@ -95,7 +95,7 @@ if($todo == 'save')
}
if(!empty($guild_errors)) {
echo $twig->render('error_box.html.twig', array('errors' => $guild_errors));
$twig->display('error_box.html.twig', array('errors' => $guild_errors));
unset($todo);
}
@ -115,18 +115,18 @@ if(isset($todo) && $todo == 'save')
$player->setRank($rank);
}
}
echo $twig->render('guilds.create.success.html.twig', array(
$twig->display('guilds.create.success.html.twig', array(
'guild_name' => $guild_name,
'leader_name' => $player->getName()
));
/*$db->query('INSERT INTO `guild_ranks` (`id`, `guild_id`, `name`, `level`) VALUES (null, '.$new_guild->getId().', "the Leader", 3)');
$db->query('INSERT INTO `guild_ranks` (`id`, `guild_id`, `name`, `level`) VALUES (null, '.$new_guild->getId().', "a Vice-Leader", 2)');
$db->query('INSERT INTO `guild_ranks` (`id`, `guild_id`, `name`, `level`) VALUES (null, '.$new_guild->getId().', "a Member", 1)');*/
}
else {
sort($array_of_player_nig);
echo $twig->render('guilds.create.html.twig', array(
$twig->display('guilds.create.html.twig', array(
'players' => $array_of_player_nig
));
}

View File

@ -31,16 +31,16 @@ if(empty($errors)) {
delete_guild($guild->getId());
$saved = true;
}
if($saved) {
echo $twig->render('success.html.twig', array(
$twig->display('success.html.twig', array(
'title' => 'Guild Deleted',
'description' => 'Guild with name <b>' . $guild_name . '</b> has been deleted.',
'custom_buttons' => $twig->render('guilds.back_button.html.twig')
));
}
else {
echo $twig->render('success.html.twig', array(
$twig->display('success.html.twig', array(
'title' => 'Delete Guild',
'description' => 'Are you sure you want delete guild <b>' . $guild_name . '</b>?<br/>
<form action="?subtopic=guilds&guild=' . $guild->getName() . '&action=delete_by_admin" METHOD="post"><input type="hidden" name="todo" value="save"><input type="submit" value="Yes, delete"></form>',
@ -57,9 +57,9 @@ if(empty($errors)) {
}
}
if(!empty($errors)) {
echo $twig->render('error_box.html.twig', array('errors' => $errors));
echo $twig->render('guilds.back_button.html.twig', array(
$twig->display('error_box.html.twig', array('errors' => $errors));
$twig->display('guilds.back_button.html.twig', array(
'new_line' => true,
'action' => '?subtopic=guilds'
));

View File

@ -30,7 +30,7 @@ if(empty($errors)) {
$rank_list->orderBy('level', POT::ORDER_DESC);
$guild_leader = false;
$account_players = $account_logged->getPlayers();
foreach($account_players as $player) {
if($guild->getOwner()->getId() == $player->getId()) {
$guild_vice = true;
@ -38,24 +38,24 @@ if(empty($errors)) {
$level_in_guild = 3;
}
}
if($guild_leader) {
$saved = false;
if(isset($_POST['todo']) && $_POST['todo'] == 'save') {
delete_guild($guild->getId());
$saved = true;
}
if($saved) {
echo $twig->render('success.html.twig', array(
$twig->display('success.html.twig', array(
'title' => 'Guild Deleted',
'description' => 'Guild with name <b>'.$guild_name.'</b> has been deleted.',
'custom_buttons' => $twig->render('guilds.back_button.html.twig')
));
}
else {
echo $twig->render('guilds.delete_guild.html.twig', array(
$twig->display('guilds.delete_guild.html.twig', array(
'guild' => $guild
));
}
@ -70,9 +70,9 @@ if(empty($errors)) {
}
if(!empty($errors)) {
echo $twig->render('error_box.html.twig', array('errors' => $errors));
echo $twig->render('guilds.back_button.html.twig', array(
$twig->display('error_box.html.twig', array('errors' => $errors));
$twig->display('guilds.back_button.html.twig', array(
'new_line' => true
));
}

View File

@ -61,7 +61,7 @@ if(empty($errors))
}
}
}
if(!$guild_vice)
$errors[] = 'You are not a leader or vice leader of guild <b>' . $guild_name . '</b>.';
}
@ -92,23 +92,23 @@ if(empty($errors))
}
if(!empty($errors))
{
echo $twig->render('error_box.html.twig', array('errors' => $errors));
echo $twig->render('guilds.back_button.html.twig', array('action' => '?subtopic=guilds&action=show&guild=' . $guild_name));
$twig->display('error_box.html.twig', array('errors' => $errors));
$twig->display('guilds.back_button.html.twig', array('action' => '?subtopic=guilds&action=show&guild=' . $guild_name));
}
else
{
if(isset($_REQUEST['todo']) && $_REQUEST['todo'] == 'save')
{
$guild->deleteInvite($player);
echo $twig->render('success.html.twig', array(
$twig->display('success.html.twig', array(
'title' => 'Deleted player invitation',
'description' => 'Player with name <b>' . $player->getName() . '</b> has been deleted from invites list.',
'custom_buttons' => $twig->render('guilds.back_button.html.twig', array('action' => '?subtopic=guilds&action=show&guild=' . $guild_name))
));
}
else {
echo $twig->render('guilds.delete_invite.html.twig', array(
$twig->display('guilds.delete_invite.html.twig', array(
'player_name' => $player->getName(),
'guild_name' => $guild->getName()
));

View File

@ -59,7 +59,7 @@ if(empty($guild_errors)) {
$players_with_rank = $db->query('SELECT `id`, `rank_id` FROM `players` WHERE `rank_id` = ' . $rank->getId() . ' AND `deleted` = 0;');
else
$players_with_rank = $db->query('SELECT `players`.`id` as `id`, `' . GUILD_MEMBERS_TABLE . '`.`rank_id` as `rank_id` FROM `players`, `' . GUILD_MEMBERS_TABLE . '` WHERE `' . GUILD_MEMBERS_TABLE . '`.`rank_id` = ' . $rank->getId() . ' AND `players`.`id` = `' . GUILD_MEMBERS_TABLE . '`.`player_id` ORDER BY `name`;');
$players_with_rank_number = $players_with_rank->rowCount();
if($players_with_rank_number > 0) {
foreach($rank_list as $checkrank) {
@ -69,7 +69,7 @@ if(empty($guild_errors)) {
}
}
}
if(empty($new_rank)) {
$new_rank = new OTS_GuildRank();
$new_rank->setGuild($guild);
@ -87,16 +87,16 @@ if(empty($guild_errors)) {
}
}
if($saved) {
echo $twig->render('success.html.twig', array(
$twig->display('success.html.twig', array(
'title' => 'Rank Deleted',
'description' => 'Rank <b>'.$rank->getName().'</b> has been deleted. Players with this rank has now other rank.',
'custom_buttons' => ''
));
} else {
echo $twig->render('error_box.html.twig', array('errors' => $guild_errors2));
$twig->display('error_box.html.twig', array('errors' => $guild_errors2));
}
echo $twig->render('guilds.back_button.html.twig', array(
$twig->display('guilds.back_button.html.twig', array(
'new_line' => true,
'action' => '?subtopic=guilds&guild='.$guild->getName().'&action=manager'
));
@ -112,9 +112,9 @@ if(empty($guild_errors)) {
}
}
if(!empty($guild_errors)) {
echo $twig->render('error_box.html.twig', array('errors' => $guild_errors));
echo $twig->render('guilds.back_button.html.twig', array(
$twig->display('error_box.html.twig', array('errors' => $guild_errors));
$twig->display('guilds.back_button.html.twig', array(
'new_line' => true,
'action' => '?subtopic=guilds'
));

View File

@ -45,7 +45,7 @@ if(empty($errors)) {
$guild_vice = true;
$level_in_guild = $player_rank->getLevel();
}
if($guild->getOwner()->getId() == $player->getId()) {
$guild_vice = true;
$guild_leader = true;
@ -64,7 +64,7 @@ if(isset($_REQUEST['todo']) && $_REQUEST['todo'] == 'save') {
if(!Validator::characterName($name)) {
$errors[] = 'Invalid name format.';
}
if(empty($errors)) {
$player = new OTS_Player();
$player->find($name);
@ -95,23 +95,23 @@ if(empty($errors)) {
$show = true;
if(!empty($errors)) {
echo $twig->render('error_box.html.twig', array('errors' => $errors));
$twig->display('error_box.html.twig', array('errors' => $errors));
}
else {
if(isset($_REQUEST['todo']) && $_REQUEST['todo'] == 'save') {
$guild->invite($player);
echo $twig->render('success.html.twig', array(
$twig->display('success.html.twig', array(
'title' => 'Invite player',
'description' => 'Player with name <b>' . $player->getName() . '</b> has been invited to your guild.',
'custom_buttons' => ''
));
$show = false;
}
}
if($show) {
echo $twig->render('success.html.twig', array(
$twig->display('success.html.twig', array(
'title' => 'Invite player',
'description' => $twig->render('guilds.invite.html.twig', array(
'guild_name' => $guild->getName()
@ -120,6 +120,6 @@ if($show) {
));
}
echo $twig->render('guilds.back_button.html.twig', array(
$twig->display('guilds.back_button.html.twig', array(
'action' => getLink('guilds') . '/' . $guild_name
));

View File

@ -93,8 +93,8 @@ if(empty($errors)) {
}
if(!empty($errors)) {
echo $twig->render('error_box.html.twig', array('errors' => $errors));
echo $twig->render('guilds.back_button.html.twig', array(
$twig->display('error_box.html.twig', array('errors' => $errors));
$twig->display('guilds.back_button.html.twig', array(
'action' => getLink('guilds') . '/' . $guild_name
));
}
@ -102,8 +102,8 @@ else
{
if(isset($_REQUEST['todo']) && $_REQUEST['todo'] == 'save') {
$player->setRank();
echo $twig->render('success.html.twig', array(
$twig->display('success.html.twig', array(
'title' => 'Kick player',
'description' => 'Player with name <b>'.$player->getName().'</b> has been kicked from your guild.',
'custom_buttons' => $twig->render('guilds.back_button.html.twig', array(
@ -112,7 +112,7 @@ else
));
}
else {
echo $twig->render('guilds.kick_player.html.twig', array(
$twig->display('guilds.kick_player.html.twig', array(
'player_name' => $player->getName(),
'guild_name' => $guild->getName()
));

View File

@ -36,7 +36,7 @@ if(empty($errors)) {
if(!Validator::characterName($name)) {
$errors[] = 'Invalid name format.';
}
if(empty($errors)) {
$player = new OTS_Player();
$player->find($name);
@ -49,7 +49,7 @@ if(empty($errors)) {
}
}
}
if(empty($errors)) {
$player_loaded_rank = $player->getRank();
if($player_loaded_rank->isLoaded()) {
@ -61,7 +61,7 @@ if(empty($errors)) {
$errors[] = "Character <b>" . $name . "</b> isn't in any guild.";
}
}
if(empty($errors)) {
if($guild_owner_name == $player->getName()) {
$errors[] = "You can't leave guild. You are an owner of guild.";
@ -85,8 +85,8 @@ if(empty($errors)) {
}
if(!empty($errors)) {
echo $twig->render('error_box.html.twig', array('errors' => $errors));
echo $twig->render('guilds.back_button.html.twig', array(
$twig->display('error_box.html.twig', array('errors' => $errors));
$twig->display('guilds.back_button.html.twig', array(
'action' => getLink('guilds') . '/' . $guild_name
));
}
@ -94,7 +94,7 @@ else
{
if(isset($_REQUEST['todo']) && $_REQUEST['todo'] == 'save') {
$player->setRank();
echo $twig->render('success.html.twig', array(
$twig->display('success.html.twig', array(
'title' => 'Leave guild',
'description' => 'Player with name <b>'.$player->getName().'</b> leaved guild <b>'.$guild->getName().'</b>.',
'custom_buttons' => $twig->render('guilds.back_button.html.twig', array(
@ -105,8 +105,8 @@ else
else
{
sort($array_of_player_ig);
echo $twig->render('guilds.leave_guild.html.twig', array(
$twig->display('guilds.leave_guild.html.twig', array(
'players' => $array_of_player_ig,
'guild_name' => $guild_name
));

View File

@ -38,7 +38,7 @@ if(empty($errors)) {
}
}
if($guild_leader) {
echo $twig->render('guilds.manager.html.twig', array(
$twig->display('guilds.manager.html.twig', array(
'guild' => $guild,
'rank_list' => $rank_list
));
@ -54,7 +54,7 @@ if(empty($errors)) {
}
}
if(!empty($errors)) {
echo $twig->render('error_box.html.twig', array('errors' => $errors));
$twig->display('error_box.html.twig', array('errors' => $errors));
}
?>

View File

@ -28,14 +28,14 @@ if(empty($guild_errors)) {
if(!Validator::characterName($pass_to)) {
$guild_errors2[] = 'Invalid player name format.';
}
if(empty($guild_errors2)) {
$to_player = new OTS_Player();
$to_player->find($pass_to);
if(!$to_player->isLoaded()) {
$guild_errors2[] = 'Player with name <b>'.$pass_to.'</b> doesn\'t exist.';
}
if(empty($guild_errors2)) {
$to_player_rank = $to_player->getRank();
if($to_player_rank->isLoaded()) {
@ -63,7 +63,7 @@ if(empty($guild_errors) && empty($guild_errors2)) {
$level_in_guild = 3;
}
}
$saved = false;
if($guild_leader) {
if(isset($_POST['todo']) && $_POST['todo'] == 'save') {
@ -71,25 +71,25 @@ if(empty($guild_errors) && empty($guild_errors2)) {
if($query) {
$guild_leader_char->setRankId($query['id'], $guild->getId());
}
$query = $db->query('SELECT `id` FROM `guild_ranks` WHERE `guild_id` = ' . $guild->getId() . ' ORDER BY `level` DESC LIMIT 1')->fetch();
if($query) {
$to_player->setRankId($query['id'], $guild->getId());
}
$guild->setOwner($to_player);
$guild->save();
$saved = true;
}
if($saved) {
echo $twig->render('success.html.twig', array(
$twig->display('success.html.twig', array(
'title' => 'Leadership passed',
'description' => '<b>'.$to_player->getName().'</b> is now a Leader of <b>'.$guild_name.'</b>.',
'custom_buttons' => '<center><form action="' . getLink('guilds') . '/' . $guild->getName().'" METHOD=post>' . $twig->render('buttons.back.html.twig') . '</form></center>'
));
}
else {
echo $twig->render('guilds.pass_leadership.html.twig', array(
$twig->display('guilds.pass_leadership.html.twig', array(
'guild' => $guild
));
}
@ -103,16 +103,16 @@ if(empty($guild_errors) && empty($guild_errors2)) {
}
}
if(empty($guild_errors) && !empty($guild_errors2)) {
echo $twig->render('error_box.html.twig', array('errors' => $guild_errors2));
$twig->display('error_box.html.twig', array('errors' => $guild_errors2));
echo '<br/><center><form action="?subtopic=guilds&guild='.$guild->getName().'&action=pass_leadership" method="post">' . $twig->render('buttons.back.html.twig') . '</form></center>';
}
if(!empty($guild_errors)) {
if(!empty($guild_errors2)) {
$guild_errors = array_merge($guild_errors, $guild_errors2);
}
echo $twig->render('error_box.html.twig', array('errors' => $guild_errors));
$twig->display('error_box.html.twig', array('errors' => $guild_errors));
echo '<br/><center><form action="?subtopic=guilds" method="post">' . $twig->render('buttons.back.html.twig') . '</form></center>';
}

View File

@ -30,7 +30,7 @@ if(empty($errors)) {
$rank_list->orderBy('level', POT::ORDER_DESC);
$guild_leader = false;
$account_players = $account_logged->getPlayers();
foreach($account_players as $player) {
if($guild_leader_char->getId() == $player->getId()) {
$guild_vice = true;
@ -38,7 +38,7 @@ if(empty($errors)) {
$level_in_guild = 3;
}
}
if($guild_leader) {
foreach($rank_list as $rank) {
$rank_id = $rank->getId();
@ -56,12 +56,12 @@ if(empty($errors)) {
else {
$errors[] = 'Invalid rank level. Contact with admin. Rank ID <b>'.$rank_id.'</b>.';
}
$rank->save();
}
//show errors or redirect
if(!empty($errors)) {
echo $twig->render('error_box.html.twig', array('errors' => $errors));
$twig->display('error_box.html.twig', array('errors' => $errors));
}
else
{
@ -79,7 +79,7 @@ if(empty($errors)) {
}
}
if(!empty($errors)) {
echo $twig->render('error_box.html.twig', array('errors' => $errors));
$twig->display('error_box.html.twig', array('errors' => $errors));
}
?>

View File

@ -25,9 +25,9 @@ if(empty($errors))
if(!empty($errors))
{
echo $twig->render('error_box.html.twig', array('errors' => $errors));
echo $twig->render('guilds.back_button.html.twig');
$twig->display('error_box.html.twig', array('errors' => $errors));
$twig->display('guilds.back_button.html.twig');
}
else
{
@ -102,13 +102,13 @@ else
<TD WIDTH=30%><B>Rank</B></TD>
<TD WIDTH=30%><B>Name, title, level & status</B></TD>
</TR>';
//Slaw stats values
//$s_total_members = 0;
//$s_members_online = 0;
//$s_total_level = 0;
//End Slaw stats values
$showed_players = 1;
foreach($rank_list as $rank)
{
@ -116,7 +116,7 @@ else
$players_with_rank = $db->query('SELECT `players`.`id` as `id`, `' . GUILD_MEMBERS_TABLE . '`.`rank_id` as `rank_id` FROM `players`, `' . GUILD_MEMBERS_TABLE . '` WHERE `' . GUILD_MEMBERS_TABLE . '`.`rank_id` = ' . $rank->getId() . ' AND `players`.`id` = `' . GUILD_MEMBERS_TABLE . '`.`player_id` ORDER BY `name`;');
else if($db->hasColumn('players', 'rank_id'))
$players_with_rank = $db->query('SELECT `id`, `rank_id` FROM `players` WHERE `rank_id` = ' . $rank->getId() . ' AND `deleted` = 0;');
$players_with_rank_number = $players_with_rank->rowCount();
if($players_with_rank_number > 0)
{
@ -133,7 +133,7 @@ else
$player->load($result['id']);
if(!$player->isLoaded())
continue;
//$s_total_members++;
//$s_total_level += $player->getLevel();
echo '<TR><TD>' . getPlayerLink($player->getName()) . '<FORM ACTION="?subtopic=guilds&action=change_nick&name='.$player->getName().'" METHOD=post>';
@ -151,11 +151,11 @@ else
else
if(!empty($guild_nick))
echo ' ('.htmlentities($player->getGuildNick()).')';
if($level_in_guild > $rank->getLevel() || $guild_leader)
if($guild_leader_char->getName() != $player->getName())
echo '&nbsp;<font size=1>{<a href="?subtopic=guilds&action=kick_player&guild='.urlencode($guild->getName()).'&name='.urlencode($player->getName()).'">KICK</a>}</font>';
echo '</FORM></TD><TD align="right" width="10%">'.$player->getLevel().'</TD><TD align="right" width="20%"><font color="'.($player->isOnline() ? 'green"><b>Online' : 'red"><b>Offline').'</b></font></TD></TR>';
}
echo '</TABLE></TD></TR>';
@ -207,7 +207,7 @@ else
echo '</TABLE>';
*/
//End statistics
//Lets update some stuff in database
//$db->query('UPDATE `guilds` SET `total_members` = '.$s_total_members.', `members_online` = '.$s_members_online.', `total_level` = '.$s_total_level.', `average_level` = '.ceil($s_total_level/$s_total_members).' WHERE `id` = '.$guild->getId());
include(SYSTEM . 'libs/pot/InvitesDriver.php');

View File

@ -21,10 +21,10 @@ $config_salt_enabled = $db->hasColumn('accounts', 'salt');
$action_type = isset($_REQUEST['action_type']) ? $_REQUEST['action_type'] : '';
if($action == '')
{
echo $twig->render('account.lost.form.html.twig');
$twig->display('account.lost.form.html.twig');
}
else if($action == 'step1' && $action_type == '') {
echo $twig->render('account.lost.noaction.html.twig');
$twig->display('account.lost.noaction.html.twig');
}
elseif($action == 'step1' && $action_type == 'email')
{
@ -36,7 +36,7 @@ elseif($action == 'step1' && $action_type == 'email')
$player->find($nick);
if($player->isLoaded())
$account = $player->getAccount();
if($account->isLoaded())
{
if($account->getCustomField('email_next') < time())
@ -83,7 +83,7 @@ elseif($action == 'sendcode')
$player->find($nick);
if($player->isLoaded())
$account = $player->getAccount();
if($account->isLoaded())
{
if($account->getCustomField('email_next') < time())
@ -290,20 +290,20 @@ elseif($action == 'step3')
if(Validator::email($new_email))
{
$account->setEMail($new_email);
$tmp_new_pass = $new_pass;
if($config_salt_enabled)
{
$salt = generateRandomString(10, false, true, true);
$tmp_new_pass = $salt . $new_pass;
}
$account->setPassword(encrypt($tmp_new_pass));
$account->save();
if($config_salt_enabled)
$account->setCustomField('salt', $salt);
echo 'Your account name, new password and new e-mail.<BR>
<FORM ACTION="?subtopic=accountmanagement" onsubmit="return validate_form(this)" METHOD=post>
<INPUT TYPE=hidden NAME="character" VALUE="">
@ -487,7 +487,7 @@ elseif($action == 'setnewpassword')
$tmp_new_pass = $salt . $newpassword;
$account->setCustomField('salt', $salt);
}
$account->setPassword(encrypt($tmp_new_pass ));
$account->save();
$account->setCustomField('email_code', '');

View File

@ -55,7 +55,7 @@ if(isset($_GET['archive']))
}
}
echo $twig->render('news.html.twig', array(
$twig->display('news.html.twig', array(
'title' => stripslashes($news['title']),
'content' => $content_,
'date' => $news['date'],
@ -68,7 +68,7 @@ if(isset($_GET['archive']))
else
echo "This news doesn't exist or is hidden.<br/>";
echo $twig->render('news.back_button.html.twig');
$twig->display('news.back_button.html.twig');
return;
}
?>
@ -87,7 +87,7 @@ if(isset($_GET['archive']))
);
}
echo $twig->render('news.archive.html.twig', array(
$twig->display('news.archive.html.twig', array(
'newses' => $newses
));
@ -164,7 +164,7 @@ if($canEdit)
}
if(!empty($errors))
echo $twig->render('error_box.html.twig', array('errors' => $errors));
$twig->display('error_box.html.twig', array('errors' => $errors));
if($cache->enabled())
{
@ -259,7 +259,7 @@ if(!$news_cached)
$account_players = $account_logged->getPlayersList();
$account_players->orderBy('group_id', POT::ORDER_DESC);
echo $twig->render('news.add.html.twig', array(
$twig->display('news.add.html.twig', array(
'action' => $action,
'news_link' => getLink(PAGE),
'news_link_form' => getLink('news/' . ($action == 'edit' ? 'edit' : 'add')),
@ -324,7 +324,7 @@ if(!$news_cached)
}
}
echo $twig->render('news.html.twig', array(
$twig->display('news.html.twig', array(
'id' => $news['id'],
'title' => stripslashes($news['title']),
'content' => $content_ . $admin_options,

View File

@ -120,11 +120,11 @@ if($players > 0)
}
}
echo $twig->render('online.html.twig', array(
$twig->display('online.html.twig', array(
'players' => $players_data,
'record' => $record
));
//search bar
echo $twig->render('online.form.html.twig');
$twig->display('online.form.html.twig');
?>

View File

@ -11,4 +11,4 @@
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Server Rules';
echo $twig->render('rules.html.twig');
$twig->display('rules.html.twig');

View File

@ -31,7 +31,7 @@ if(isset($_REQUEST['vocation_id'])) {
}
else {
$vocation = (isset($_REQUEST['vocation']) ? urldecode($_REQUEST['vocation']) : 'all');
if($vocation == 'all') {
$vocation_id = 'all';
}
@ -63,20 +63,20 @@ if((string)$vocation_id != 'all') {
else {
foreach($spells_db->fetchAll() as $spell) {
$vocations = json_decode($spell['vocations'], true);
foreach($vocations as &$tmp_vocation) {
if(isset($config['vocations'][$tmp_vocation]))
$tmp_vocation = $config['vocations'][$tmp_vocation];
else
$tmp_vocation = 'Unknown';
}
$spell['vocations'] = implode('<br/>', $vocations);
$spells[] = $spell;
}
}
echo $twig->render('spells.html.twig', array(
$twig->display('spells.html.twig', array(
'canEdit' => $canEdit,
'post_vocation_id' => $vocation_id,
'post_vocation' => $vocation,

View File

@ -8,22 +8,22 @@ defined('MYAAC') or die('Direct access not allowed!');
<link rel="stylesheet" href="<?php echo $template_path; ?>/style.css" type="text/css" />
<script type="text/javascript">
<?php
echo $twig->render('menu.js.html.twig', array('categories' => $config['menu_categories']));
$twig->display('menu.js.html.twig', array('categories' => $config['menu_categories']));
?>
</script>
<script type="text/javascript" src="tools/basic.js"></script>
<script type="text/javascript">
<?php
$menus = get_template_menus();
function get_template_pages($category) {
global $menus;
$ret = array();
foreach($menus[$category] as $menu) {
$ret[] = $menu['link'];
}
return $ret;
}
?>
@ -40,7 +40,7 @@ defined('MYAAC') or die('Direct access not allowed!');
$tmp = explode('/', URI);
}
}
if(in_array($tmp[0], get_template_pages(MENU_CATEGORY_NEWS)))
echo 'news';
elseif(in_array($tmp[0], get_template_pages(MENU_CATEGORY_LIBRARY)))
@ -86,12 +86,12 @@ defined('MYAAC') or die('Direct access not allowed!');
if(!isset($menus[$category])) {
continue;
}
echo '<div id="' . $config['menu_categories'][$category]['id'] . '-submenu">';
$size = count($menus[$category]);
$i = 0;
foreach($menus[$category] as $menu) {
echo '<a href="' . $menu['link_full'] . '"' . ($menu['blank'] ? ' target="_blank"' : '') . ' style="color: #' . (strlen($menu['color']) == 0 ? $default_menu_color : $menu['color']) . ';">' . $menu['name'] . '</a>';
@ -99,7 +99,7 @@ defined('MYAAC') or die('Direct access not allowed!');
echo '<span class="separator"></span>';
}
}
echo '</div>';
}
?>