some not-important changes

This commit is contained in:
slawkens 2022-10-28 17:16:17 +02:00
parent e1d486c8c8
commit 616b8eb61a
10 changed files with 44 additions and 58 deletions

View File

@ -22,6 +22,7 @@ if(isset($_POST['registeraccountsave']) && $_POST['registeraccountsave'] == "1")
$account_logged->setCustomField("key", $new_rec_key); $account_logged->setCustomField("key", $new_rec_key);
$account_logged->logAction('Generated recovery key.'); $account_logged->logAction('Generated recovery key.');
$message = '';
if($config['mail_enabled'] && $config['send_mail_when_generate_reckey']) if($config['mail_enabled'] && $config['send_mail_when_generate_reckey'])
{ {
@ -54,5 +55,3 @@ if($show_form) {
//show form //show form
$twig->display('account.generate_recovery_key.html.twig'); $twig->display('account.generate_recovery_key.html.twig');
} }
?>

View File

@ -40,7 +40,7 @@ else
$message = '<br />Your recovery key were send on email address <b>'.$account_logged->getEMail().'</b> for '.$config['generate_new_reckey_price'].' premium points.'; $message = '<br />Your recovery key were send on email address <b>'.$account_logged->getEMail().'</b> for '.$config['generate_new_reckey_price'].' premium points.';
} }
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 later. For Admin: More info can be found in system/logs/mailer-error.log</p>'; $message = '<br /><p class="error">An error occurred while sending email ( <b>'.$account_logged->getEMail().'</b> ) with recovery key! Recovery key not changed. Try again later. For Admin: More info can be found in system/logs/mailer-error.log</p>';
$twig->display('success.html.twig', array( $twig->display('success.html.twig', array(
'title' => 'Account Registered', 'title' => 'Account Registered',

View File

@ -59,8 +59,7 @@ $errors = array();
return; return;
} }
if($action == '') if($action == '') {
{
$freePremium = isset($config['lua']['freePremium']) && getBoolean($config['lua']['freePremium']) || $account_logged->getPremDays() == OTS_Account::GRATIS_PREMIUM_DAYS; $freePremium = isset($config['lua']['freePremium']) && getBoolean($config['lua']['freePremium']) || $account_logged->getPremDays() == OTS_Account::GRATIS_PREMIUM_DAYS;
$dayOrDays = $account_logged->getPremDays() == 1 ? 'day' : 'days'; $dayOrDays = $account_logged->getPremDays() == 1 ? 'day' : 'days';
/** /**
@ -72,10 +71,9 @@ $errors = array();
$account_status = '<b><span style="color: green">' . ($freePremium ? 'Gratis Premium Account' : 'Premium Account, ' . $account_logged->getPremDays() . ' '.$dayOrDays.' left') . '</span></b>'; $account_status = '<b><span style="color: green">' . ($freePremium ? 'Gratis Premium Account' : 'Premium Account, ' . $account_logged->getPremDays() . ' '.$dayOrDays.' left') . '</span></b>';
$recovery_key = $account_logged->getCustomField('key'); $recovery_key = $account_logged->getCustomField('key');
if(empty($recovery_key)) if(empty($recovery_key)) {
$account_registered = '<b><span style="color: red">No</span></b>'; $account_registered = '<b><span style="color: red">No</span></b>';
else } else {
{
if($config['generate_new_reckey'] && $config['mail_enabled']) if($config['generate_new_reckey'] && $config['mail_enabled'])
$account_registered = '<b><span style="color: green">Yes ( <a href="' . getLink('account/register/new') . '"> Buy new Recovery Key </a> )</span></b>'; $account_registered = '<b><span style="color: green">Yes ( <a href="' . getLink('account/register/new') . '"> Buy new Recovery Key </a> )</span></b>';
else else

View File

@ -47,7 +47,7 @@ if(isset($_REQUEST['name']))
if(empty($name)) if(empty($name))
{ {
$tmp_link = getPlayerLink($name); $tmp_link = getPlayerLink($name);
echo 'Here you can get detailed information about a certain player on ' . $config['lua']['serverName'] . '.<BR>'; echo 'Here you can get detailed information about a certain player on ' . $config['lua']['serverName'] . '.<br/>';
echo generate_search_form(true); echo generate_search_form(true);
return; return;
} }
@ -82,8 +82,9 @@ if($player->isLoaded() && !$player->isDeleted())
$outfit = $config['outfit_images_url'] . '?id=' . $player->getLookType() . ($db->hasColumn('players', 'lookaddons') ? '&addons=' . $player->getLookAddons() : '') . '&head=' . $player->getLookHead() . '&body=' . $player->getLookBody() . '&legs=' . $player->getLookLegs() . '&feet=' . $player->getLookFeet(); $outfit = $config['outfit_images_url'] . '?id=' . $player->getLookType() . ($db->hasColumn('players', 'lookaddons') ? '&addons=' . $player->getLookAddons() : '') . '&head=' . $player->getLookHead() . '&body=' . $player->getLookBody() . '&legs=' . $player->getLookLegs() . '&feet=' . $player->getLookFeet();
$flag = ''; $flag = '';
if($config['account_country']) if($config['account_country']) {
$flag = getFlagImage($account->getCountry()); $flag = getFlagImage($account->getCountry());
}
$player_sex = 'Unknown'; $player_sex = 'Unknown';
if(isset($config['genders'][$player->getSex()])) if(isset($config['genders'][$player->getSex()]))
@ -147,9 +148,10 @@ if($player->isLoaded() && !$player->isDeleted())
if($config['characters']['skills']) if($config['characters']['skills'])
{ {
if($db->hasColumn('players', 'skill_fist')) {// tfs 1.0+ if($db->hasColumn('players', 'skill_fist')) {// tfs 1.0+
$skills_db = $db->query('SELECT `skill_fist`, `skill_club`, `skill_sword`, `skill_axe`, `skill_dist`, `skill_shielding`, `skill_fishing` FROM `players` WHERE `id` = ' . $player->getId())->fetch(); $skills_db = $db->query('SELECT `maglevel`, `skill_fist`, `skill_club`, `skill_sword`, `skill_axe`, `skill_dist`, `skill_shielding`, `skill_fishing` FROM `players` WHERE `id` = ' . $player->getId())->fetch();
$skill_ids = array( $skill_ids = array(
POT::SKILL_MAGIC => 'maglevel',
POT::SKILL_FIST => 'skill_fist', POT::SKILL_FIST => 'skill_fist',
POT::SKILL_CLUB => 'skill_club', POT::SKILL_CLUB => 'skill_club',
POT::SKILL_SWORD => 'skill_sword', POT::SKILL_SWORD => 'skill_sword',
@ -175,8 +177,7 @@ if($player->isLoaded() && !$player->isDeleted())
} }
$quests_enabled = $config['characters']['quests'] && !empty($config['quests']); $quests_enabled = $config['characters']['quests'] && !empty($config['quests']);
if($quests_enabled) if($quests_enabled) {
{
$quests = $config['quests']; $quests = $config['quests'];
$sql_query_in = ''; $sql_query_in = '';
$i = 0; $i = 0;
@ -197,10 +198,10 @@ if($player->isLoaded() && !$player->isDeleted())
foreach($quests as &$storage) { foreach($quests as &$storage) {
$storage = isset($player_storage[$storage]) && $player_storage[$storage] > 0; $storage = isset($player_storage[$storage]) && $player_storage[$storage] > 0;
} }
unset($storage);
} }
if($config['characters']['equipment']) if($config['characters']['equipment']) {
{
global $db; global $db;
$eq_sql = $db->query('SELECT `pid`, `itemtype` FROM player_items WHERE player_id = '.$player->getId().' AND (`pid` >= 1 and `pid` <= 10)'); $eq_sql = $db->query('SELECT `pid`, `itemtype` FROM player_items WHERE player_id = '.$player->getId().' AND (`pid` >= 1 and `pid` <= 10)');
$equipment = array(); $equipment = array();
@ -284,8 +285,7 @@ WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, kil
$deaths[] = array('time' => $death['date'], 'description' => $description . '.'); $deaths[] = array('time' => $death['date'], 'description' => $description . '.');
} }
} }
} } else {
else {
$mostdamage = ''; $mostdamage = '';
if($db->hasColumn('player_deaths', 'mostdamage_by')) if($db->hasColumn('player_deaths', 'mostdamage_by'))
$mostdamage = ', `mostdamage_by`, `mostdamage_is_player`, `unjustified`, `mostdamage_unjustified`'; $mostdamage = ', `mostdamage_by`, `mostdamage_is_player`, `unjustified`, `mostdamage_unjustified`';
@ -294,8 +294,7 @@ WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, kil
FROM `player_deaths` FROM `player_deaths`
WHERE `player_id` = ' . $player->getId() . ' ORDER BY `time` DESC LIMIT 10;')->fetchAll(); WHERE `player_id` = ' . $player->getId() . ' ORDER BY `time` DESC LIMIT 10;')->fetchAll();
if(count($deaths_db)) if(count($deaths_db)) {
{
$number_of_rows = 0; $number_of_rows = 0;
foreach($deaths_db as $death) foreach($deaths_db as $death)
{ {
@ -326,14 +325,12 @@ WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, kil
$frags = array(); $frags = array();
$frag_add_content = ''; $frag_add_content = '';
if($config['characters']['frags'] && $db->hasTable('killers')) if($config['characters']['frags'] && $db->hasTable('killers')) {
{
//frags list by Xampy //frags list by Xampy
$i = 0; $i = 0;
$frags_limit = 10; // frags limit to show? // default: 10 $frags_limit = 10; // frags limit to show? // default: 10
$player_frags = $db->query('SELECT `player_deaths`.*, `players`.`name`, `killers`.`unjustified` FROM `player_deaths` LEFT JOIN `killers` ON `killers`.`death_id` = `player_deaths`.`id` LEFT JOIN `player_killers` ON `player_killers`.`kill_id` = `killers`.`id` LEFT JOIN `players` ON `players`.`id` = `player_deaths`.`player_id` WHERE `player_killers`.`player_id` = '.$player->getId().' ORDER BY `date` DESC LIMIT 0,'.$frags_limit.';')->fetchAll(); $player_frags = $db->query('SELECT `player_deaths`.*, `players`.`name`, `killers`.`unjustified` FROM `player_deaths` LEFT JOIN `killers` ON `killers`.`death_id` = `player_deaths`.`id` LEFT JOIN `player_killers` ON `player_killers`.`kill_id` = `killers`.`id` LEFT JOIN `players` ON `players`.`id` = `player_deaths`.`player_id` WHERE `player_killers`.`player_id` = '.$player->getId().' ORDER BY `date` DESC LIMIT 0,'.$frags_limit.';')->fetchAll();
if(count($player_frags)) if(count($player_frags)) {
{
$row_count = 0; $row_count = 0;
foreach($player_frags as $frag) foreach($player_frags as $frag)
{ {
@ -416,9 +413,7 @@ WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, kil
'search_form' => generate_search_form(), 'search_form' => generate_search_form(),
'canEdit' => hasFlag(FLAG_CONTENT_PLAYERS) || superAdmin() 'canEdit' => hasFlag(FLAG_CONTENT_PLAYERS) || superAdmin()
)); ));
} } else {
else
{
$search_errors[] = 'Character <b>' . $name . '</b> does not exist or has been deleted.'; $search_errors[] = 'Character <b>' . $name . '</b> does not exist or has been deleted.';
$twig->display('error_box.html.twig', array('errors' => $search_errors)); $twig->display('error_box.html.twig', array('errors' => $search_errors));
$search_errors = array(); $search_errors = array();
@ -432,8 +427,7 @@ else
$deleted = 'deletion'; $deleted = 'deletion';
$query = $db->query('SELECT `name`, `level`, `vocation`' . $promotion . ' FROM `players` WHERE `name` LIKE ' . $db->quote('%' . $name . '%') . ' AND ' . $deleted . ' != 1 LIMIT ' . (int)config('characters_search_limit') . ';'); $query = $db->query('SELECT `name`, `level`, `vocation`' . $promotion . ' FROM `players` WHERE `name` LIKE ' . $db->quote('%' . $name . '%') . ' AND ' . $deleted . ' != 1 LIMIT ' . (int)config('characters_search_limit') . ';');
if($query->rowCount() > 0) if($query->rowCount() > 0) {
{
echo 'Did you mean:<ul>'; echo 'Did you mean:<ul>';
foreach($query as $player) { foreach($query as $player) {
if(isset($player['promotion'])) { if(isset($player['promotion'])) {

View File

@ -244,6 +244,14 @@ if($save)
} }
else else
{ {
if(config('account_create_character_create')) {
// character creation
$character_created = $createCharacter->doCreate($character_name, $character_sex, $character_vocation, $character_town, $new_account, $errors);
if (!$character_created) {
error('There was an error creating your character. Please create your character later in account management page.');
}
}
if($config['account_create_auto_login']) { if($config['account_create_auto_login']) {
$_POST['account_login'] = USE_ACCOUNT_NAME ? $account_name : $account_id; $_POST['account_login'] = USE_ACCOUNT_NAME ? $account_name : $account_id;
$_POST['password_login'] = $password2; $_POST['password_login'] = $password2;
@ -286,14 +294,6 @@ if($save)
error('An error occurred while sending email. For Admin: More info can be found in system/logs/mailer-error.log'); error('An error occurred while sending email. For Admin: More info can be found in system/logs/mailer-error.log');
} }
} }
if(config('account_create_character_create')) {
// character creation
$character_created = $createCharacter->doCreate($character_name, $character_sex, $character_vocation, $character_town, $new_account, $errors);
if (!$character_created) {
error('There was an error creating your character. Please create your character later in account management page.');
}
}
} }
return; return;

View File

@ -57,8 +57,7 @@ if(isset($last_threads[0]))
foreach($last_threads as $thread) foreach($last_threads as $thread)
{ {
echo '<tr bgcolor="' . getStyle($number_of_rows++) . '"><td>'; echo '<tr bgcolor="' . getStyle($number_of_rows++) . '"><td>';
if(Forum::isModerator()) if(Forum::isModerator()) {
{
echo '<a href="?subtopic=forum&action=move_thread&id='.$thread['id'].'"\')"><span style="color:darkgreen">[MOVE]</span></a>'; echo '<a href="?subtopic=forum&action=move_thread&id='.$thread['id'].'"\')"><span style="color:darkgreen">[MOVE]</span></a>';
echo '<a href="?subtopic=forum&action=remove_post&id='.$thread['id'].'" onclick="return confirm(\'Are you sure you want remove thread > '.$thread['post_topic'].' <?\')"><span style="color: red">[REMOVE]</span></a> '; echo '<a href="?subtopic=forum&action=remove_post&id='.$thread['id'].'" onclick="return confirm(\'Are you sure you want remove thread > '.$thread['post_topic'].' <?\')"><span style="color: red">[REMOVE]</span></a> ';
} }

View File

@ -60,6 +60,7 @@ if(isset($_REQUEST['todo']) && $_REQUEST['todo'] == 'save') {
} }
} }
} }
if(!$is_invited) { if(!$is_invited) {
$errors[] = 'Character '.$player->getName() .' isn\'t invited to guild <b>'.$guild->getName().'</b>.'; $errors[] = 'Character '.$player->getName() .' isn\'t invited to guild <b>'.$guild->getName().'</b>.';
} }
@ -119,5 +120,3 @@ else {
)); ));
} }
} }
?>

View File

@ -111,7 +111,7 @@ elseif($action == 'sendcode')
else else
{ {
$account->setCustomField('email_next', (time() + 60)); $account->setCustomField('email_next', (time() + 60));
echo '<br /><p class="error">An error occorred while sending email! Try again later or contact with admin. For Admin: More info can be found in system/logs/mailer-error.log</p>'; echo '<br /><p class="error">An error occurred while sending email! Try again later or contact with admin. For Admin: More info can be found in system/logs/mailer-error.log</p>';
} }
} }
else else
@ -330,7 +330,7 @@ elseif($action == 'step3')
} }
else else
{ {
echo '<br /><p class="error">An error occorred while sending email! You will not receive e-mail with this informations. For Admin: More info can be found in system/logs/mailer-error.log</p>'; echo '<br /><p class="error">An error occurred while sending email! You will not receive e-mail with this informations. For Admin: More info can be found in system/logs/mailer-error.log</p>';
} }
} }
else else
@ -513,7 +513,7 @@ elseif($action == 'setnewpassword')
} }
else else
{ {
echo '<br /><p class="error">New password work! An error occorred while sending email! You will not receive e-mail with new password. For Admin: More info can be found in system/logs/mailer-error.log'; echo '<br /><p class="error">New password work! An error occurred while sending email! You will not receive e-mail with new password. For Admin: More info can be found in system/logs/mailer-error.log';
} }
echo '</TD></TR> echo '</TD></TR>
</TABLE> </TABLE>

View File

@ -47,9 +47,10 @@ if($config['online_outfit']) {
if($config['online_vocations']) { if($config['online_vocations']) {
$vocs = array(); $vocs = array();
foreach($config['vocations'] as $id => $name) foreach($config['vocations'] as $id => $name) {
$vocs[$id] = 0; $vocs[$id] = 0;
} }
}
if($db->hasTable('players_online')) // tfs 1.0 if($db->hasTable('players_online')) // tfs 1.0
$playersOnline = $db->query('SELECT `accounts`.`country`, `players`.`name`, `level`, `vocation`' . $outfit . ', `' . $skull_time . '` as `skulltime`, `' . $skull_type . '` as `skull` FROM `accounts`, `players`, `players_online` WHERE `players`.`id` = `players_online`.`player_id` AND `accounts`.`id` = `players`.`account_id` ORDER BY ' . $order); $playersOnline = $db->query('SELECT `accounts`.`country`, `players`.`name`, `level`, `vocation`' . $outfit . ', `' . $skull_time . '` as `skulltime`, `' . $skull_type . '` as `skull` FROM `accounts`, `players`, `players_online` WHERE `players`.`id` = `players_online`.`player_id` AND `accounts`.`id` = `players`.`account_id` ORDER BY ' . $order);
@ -59,8 +60,7 @@ else
$players_data = array(); $players_data = array();
$players = 0; $players = 0;
$data = ''; $data = '';
foreach($playersOnline as $player) foreach($playersOnline as $player) {
{
$skull = ''; $skull = '';
if($config['online_skulls']) if($config['online_skulls'])
{ {
@ -89,15 +89,14 @@ foreach($playersOnline as $player)
'outfit' => $config['online_outfit'] ? $config['outfit_images_url'] . '?id=' . $player['looktype'] . ($outfit_addons ? '&addons=' . $player['lookaddons'] : '') . '&head=' . $player['lookhead'] . '&body=' . $player['lookbody'] . '&legs=' . $player['looklegs'] . '&feet=' . $player['lookfeet'] : null 'outfit' => $config['online_outfit'] ? $config['outfit_images_url'] . '?id=' . $player['looktype'] . ($outfit_addons ? '&addons=' . $player['lookaddons'] : '') . '&head=' . $player['lookhead'] . '&body=' . $player['lookbody'] . '&legs=' . $player['looklegs'] . '&feet=' . $player['lookfeet'] : null
); );
if($config['online_vocations']) if($config['online_vocations']) {
$vocs[($player['vocation'] > $config['vocations_amount'] ? $player['vocation'] - $config['vocations_amount'] : $player['vocation'])]++; $vocs[($player['vocation'] > $config['vocations_amount'] ? $player['vocation'] - $config['vocations_amount'] : $player['vocation'])]++;
} }
}
$record = ''; $record = '';
if($players > 0) if($players > 0) {
{ if($config['online_record']) {
if($config['online_record'])
{
$timestamp = false; $timestamp = false;
if($db->hasTable('server_record')) { if($db->hasTable('server_record')) {
$query = $query =
@ -105,15 +104,13 @@ if($players > 0)
'SELECT `record`, `timestamp` FROM `server_record` WHERE `world_id` = ' . (int)$config['lua']['worldId'] . 'SELECT `record`, `timestamp` FROM `server_record` WHERE `world_id` = ' . (int)$config['lua']['worldId'] .
' ORDER BY `record` DESC LIMIT 1'); ' ORDER BY `record` DESC LIMIT 1');
$timestamp = true; $timestamp = true;
} } else if($db->hasTable('server_config')) { // tfs 1.0
else if($db->hasTable('server_config')) { // tfs 1.0
$query = $db->query('SELECT `value` as `record` FROM `server_config` WHERE `config` = ' . $db->quote('players_record')); $query = $db->query('SELECT `value` as `record` FROM `server_config` WHERE `config` = ' . $db->quote('players_record'));
} } else {
else
$query = NULL; $query = NULL;
}
if(isset($query) && $query->rowCount() > 0) if(isset($query) && $query->rowCount() > 0) {
{
$result = $query->fetch(); $result = $query->fetch();
$record = 'The maximum on this game world was ' . $result['record'] . ' players' . ($timestamp ? ' on ' . date("M d Y, H:i:s", $result['timestamp']) . '.' : '.'); $record = 'The maximum on this game world was ' . $result['record'] . ' players' . ($timestamp ? ' on ' . date("M d Y, H:i:s", $result['timestamp']) . '.' : '.');
} }

View File

@ -227,7 +227,7 @@
{% if config.character_towns|length > 1 %} {% if config.character_towns|length > 1 %}
<tr> <tr>
<td class="LabelV" style="width: 150px"> <td class="LabelV" style="width: 150px">
<span{% if errors.town is defined %} class="red"{% endif %}>Select your city:</span> <span{% if errors.town is defined %} class="red"{% endif %}>Select your town:</span>
</td> </td>
<td> <td>
<table width="100%" > <table width="100%" >