* full support for OTHire 0.0.3
* added support for otservers that doesn't use account.name field,
instead just account number will be used
* (install) moved admin account creation to new step
* fixed encryption detection on 0.3
* fixed bug when server_config table doesn't exist
* other fixes
This commit is contained in:
slawkens1
2017-05-03 23:48:04 +02:00
parent 94b44a8d37
commit 08fce2ade4
37 changed files with 741 additions and 308 deletions

View File

@@ -80,7 +80,7 @@ Please enter your account name and your password.<br/><a href="?subtopic=createa
<table style="width:100%;" >
<tr>
<td class="LabelV" >
<span<?php echo (isset($errors[0]) ? ' class="red"' : ''); ?>>Account Name:</span>
<span<?php echo (isset($errors[0]) ? ' class="red"' : ''); ?>>Account <?php echo (USE_ACCOUNT_NAME ? 'Name' : 'Number'); ?>:</span>
</td>
<td style="width:100%;" ><input type="password" name="account_login" id="account-name-input" size="30" maxlength="30" ></td>
</tr>
@@ -132,7 +132,7 @@ Please enter your account name and your password.<br/><a href="?subtopic=createa
if(isset($_REQUEST['redirect']))
{
$redirect = urldecode(trim($_REQUEST['redirect']));
$redirect = urldecode($_REQUEST['redirect']);
?>
<div class="TableContainer">
<table class="Table1" cellpadding="0" cellspacing="0">
@@ -887,10 +887,18 @@ function checkName()
if(fieldExist('promotion', 'players'))
$player->setPromotion($char_to_copy->getPromotion());
if(fieldExist('direction', 'players'))
$player->setDirection($char_to_copy->getDirection());
$player->setConditions($char_to_copy->getConditions());
if(fieldExist('rank_id', 'players'))
$rank = $char_to_copy->getRank();
if($rank->isLoaded()) {
$player->setRank($char_to_copy->getRank());
}
if(fieldExist('lookaddons', 'players'))
$player->setLookAddons($char_to_copy->getLookAddons());
$player->setTownId($newchar_town);
$player->setExperience($char_to_copy->getExperience());
$player->setLevel($char_to_copy->getLevel());
@@ -901,8 +909,6 @@ function checkName()
$player->setManaMax($char_to_copy->getManaMax());
$player->setManaSpent($char_to_copy->getManaSpent());
$player->setSoul($char_to_copy->getSoul());
if(fieldExist('direction', 'players'))
$player->setDirection($char_to_copy->getDirection());
$player->setLookBody($char_to_copy->getLookBody());
$player->setLookFeet($char_to_copy->getLookFeet());

View File

@@ -227,6 +227,8 @@ if(check_name($name))
$town_field = 'town';
if(fieldExist('town_id', 'houses'))
$town_field = 'town_id';
else if(fieldExist('townid', 'houses'))
$town_field = 'townid';
$house = $db->query('SELECT `id`, `paid`, `name`, `' . $town_field . '` FROM `houses` WHERE `owner` = '.$player->getId())->fetch();
if(isset($house['id']))

View File

@@ -24,17 +24,28 @@ if($logged)
$step = isset($_POST['step']) ? $_POST['step'] : '';
if($step == 'save')
{
$account_name = $_POST['account_name'];
$account_name_up = strtoupper($account_name);
if(USE_ACCOUNT_NAME) {
$account_name = $_POST['account'];
$account_name_up = strtoupper($account_name);
}
else
$account_id = $_POST['account'];
$email = $_POST['email'];
$password = $_POST['password'];
$password2 = $_POST['password2'];
// account
if(empty($account_name))
$errors['account_name'] = 'Please enter your account name!';
elseif(!check_account_name($account_name_up))
$errors['account_name'] = 'Invalid account name format. Please use only A-Z and numbers 0-9.';
if(isset($account_id)) {
if(!check_number($account_id))
$errors['account'] = 'Invalid account number format. Please use only numbers 0-9.';
}
else {
if(empty($account_name))
$errors['account'] = 'Please enter your account name!';
elseif(!check_account_name($account_name_up))
$errors['account'] = 'Invalid account name format. Please use only A-Z and numbers 0-9.';
}
// email
if(empty($email))
@@ -81,7 +92,7 @@ if($step == 'save')
}
// check if account name is not equal to password
if($account_name_up == strtoupper($password))
if(USE_ACCOUNT_NAME && $account_name_up == strtoupper($password))
{
$errors['password'] = 'Password may not be the same as account name.';
}
@@ -97,9 +108,17 @@ if($step == 'save')
}
$account_db = new OTS_Account();
$account_db->find($account_name);
if($account_db->isLoaded())
$errors['account_name'] = 'Account with this name already exist.';
if(USE_ACCOUNT_NAME)
$account_db->find($account_name);
else
$account_db->load($account_id);
if($account_db->isLoaded()) {
if(USE_ACCOUNT_NAME)
$errors['account'] = 'Account with this name already exist.';
else
$errors['account'] = 'Account with this id already exist.';
}
}
if(!isset($_POST['accept_rules']) || $_POST['accept_rules'] != 'true')
@@ -108,7 +127,10 @@ if($step == 'save')
if(empty($errors))
{
$new_account = $ots->createObject('Account');
$new_account->create($account_name);
if(USE_ACCOUNT_NAME)
$new_account->create($account_name);
else
$new_account->create(NULL, $account_id);
$config_salt_enabled = fieldExist('salt', 'accounts');
if($config_salt_enabled)
@@ -137,7 +159,8 @@ if($step == 'save')
if($config['account_premium_points']) {
$new_account->setCustomField('premium_points', $config['account_premium_points']);
}
$tmp_account = (USE_ACCOUNT_NAME ? $account_name : $account_id);
if($config['mail_enabled'] && $config['account_mail_verify'])
{
$hash = md5(generateRandomString(16, true, true) . $email);
@@ -145,12 +168,13 @@ if($step == 'save')
$verify_url = BASE_URL . '?p=account&action=confirm_email&v=' . $hash;
$server_name = $config['lua']['serverName'];
$body_plain = "Hello!
Thank you for registering on $server_name!
Here are the details of your account:
Name: $account_name
Account" . (USE_ACCOUNT_NAME ? ' Name' : '') . ": $tmp_account
Password: ************ (hidden for security reasons)
To verify your email address please click the link below:
@@ -162,7 +186,7 @@ If you haven't registered on $server_name please ignore this email.";
Thank you for registering on ' . $config['lua']['serverName'] . '!<br/>
<br/>
Here are the details of your account:<br/>
Name: ' . $account_name . '<br/>
Account' . (USE_ACCOUNT_NAME ? ' Name' : '') . ': ' . $tmp_account . '<br/>
Password: ************ (hidden for security reasons)<br/>
<br/>
To verify your email address please click the link below:<br/>
@@ -177,11 +201,11 @@ If you haven\'t registered on ' . $config['lua']['serverName'] . ' please ignore
<tr><td bgcolor="<?php echo $config['vdarkborder']; ?>" class="white"><b>Account Created</b></td></tr>
<tr><td bgcolor="<?php echo $config['darkborder']; ?>'">
<table border="0" cellpadding="1"><tr><td>
<br/>Your account name is <b><?php echo $account_name; ?></b>.
<br/>Your account<?php (USE_ACCOUNT_NAME ? 'name' : 'number'); ?> is <b><?php echo $tmp_account; ?></b>.
You will need the account name and your password to play on <?php echo $config['lua']['serverName']; ?>.
Please keep your account name and password in a safe place and
never give your account name or password to anybody.<br/><br/>
You will need the account <?php echo (USE_ACCOUNT_NAME ? 'name' : 'number'); ?> and your password to play on <?php echo $config['lua']['serverName']; ?>.
Please keep your account <?php echo (USE_ACCOUNT_NAME ? 'name' : 'number'); ?> and password in a safe place and
never give your account <?php echo (USE_ACCOUNT_NAME ? 'name' : 'number'); ?> or password to anybody.<br/><br/>
<?php
}
else
@@ -197,23 +221,23 @@ If you haven\'t registered on ' . $config['lua']['serverName'] . ' please ignore
<TR><TD BGCOLOR="'.$config['vdarkborder'].'" class="white"><B>Account Created</B></TD></TR>
<TR><TD BGCOLOR="'.$config['darkborder'].'">
<TABLE BORDER=0 CELLPADDING=1><TR><TD>
<br/>Your account name is <b>'.$account_name.'</b><br/>You will need the account name and your password to play on '.$config['lua']['serverName'].'.
Please keep your account name and password in a safe place and
never give your account name or password to anybody.<br/><br/>';
<br/>Your account ' . (USE_ACCOUNT_NAME ? 'name' : 'number') . ' is <b>'.$tmp_account.'</b><br/>You will need the account ' . (USE_ACCOUNT_NAME ? 'name' : 'number') . ' and your password to play on '.$config['lua']['serverName'].'.
Please keep your account ' . (USE_ACCOUNT_NAME ? 'name' : 'number') . ' and password in a safe place and
never give your account ' . (USE_ACCOUNT_NAME ? 'name' : 'number') . ' or password to anybody.<br/><br/>';
if($config['mail_enabled'] && $config['account_welcome_mail'])
{
$mailBody = '
<h3>Dear player,</h3>
<p>Thanks for your registration at <a href=" ' . BASE_URL . '"><b>'.$config['lua']['serverName'].'</b></a></p>
<p>Thanks for your registration at <a href=" ' . BASE_URL . '"><b>' . $config['lua']['serverName'] . '</b></a></p>
<br/><br/>
Your login details:
<p>Account name: <b>' . $account_name . '</b></p>
<p>Account' . (USE_ACCOUNT_NAME ? ' name' : '') . ': <b>' . $tmp_account . '</b></p>
<p>Password: <b>' . str_repeat('*', strlen(trim($password))) . '</b> (hidden for security reasons)</p>
<p>Kind Regards,</p>';
if(_mail($email, 'Your account on ' . $config['lua']['serverName'], $mailBody))
echo '<br /><small>These informations were send on email address <b>'.$email.'</b>.';
echo '<br /><small>These informations were send on email address <b>' . $email . '</b>.';
else
echo '<br /><p class="error">An error occorred while sending email (<b>' . $email . '</b>)! Error:<br/>' . $mailer->ErrorInfo . '</p>';
}
@@ -241,9 +265,9 @@ function checkAccount()
eventId = 0;
}
if(document.getElementById("account_name").value == "")
if(document.getElementById("account_input").value == "")
{
document.getElementById("acc_name_check").innerHTML = '<b><font color="red">Please enter account name.</font></b>';
document.getElementById("acc_check").innerHTML = '<b><font color="red">Please enter account<?php echo (USE_ACCOUNT_NAME ? ' name' : ''); ?>.</font></b>';
return;
}
@@ -260,10 +284,10 @@ function checkAccount()
}
}
account = document.getElementById("account_name").value;
account = document.getElementById("account_input").value;
$.get("tools/validate.php", { account: account, uid: Math.random() },
function(data){
document.getElementById("acc_name_check").innerHTML = data;
document.getElementById("acc_check").innerHTML = data;
lastSend = timeNow;
});
}
@@ -296,7 +320,6 @@ function checkEmail()
}
email = document.getElementById("email").value;
account = document.getElementById("account_name").value;
$.get("tools/validate.php", { email: email, uid: Math.random() },
function(data){
document.getElementById("email_check").innerHTML = data;
@@ -338,8 +361,8 @@ function validate_form(thisform)
{
with (thisform)
{
if (validate_required(account_name,"Please enter name of new account!")==false)
{account_name.focus();return false;}
if (validate_required(account_input,"Please enter name of new account!")==false)
{account_input.focus();return false;}
if (validate_required(email,"Please enter your e-mail!")==false)
{email.focus();return false;}
if (validate_email(email,"Invalid e-mail format!")==false)
@@ -362,11 +385,11 @@ function validate_form(thisform)
output_errors($errors);
?>
To play on <?php echo $config['lua']['serverName']; ?> you need an account.
All you have to do to create your new account is to enter an account name, password<?php
All you have to do to create your new account is to enter an account <?php echo (USE_ACCOUNT_NAME ? 'name' : 'number'); ?>, password<?php
if($config['recaptcha_enabled']) echo ', confirm reCAPTCHA';
if($config['account_country']) echo ', country';
?> and your email address.
Also you have to agree to the terms presented below. If you have done so, your account name will be shown on the following page and your account password will be sent to your email address along with further instructions. If you do not receive the email with your password, please check your spam filter.<br/><br/>
Also you have to agree to the terms presented below. If you have done so, your account <?php echo (USE_ACCOUNT_NAME ? 'name' : 'number'); ?> will be shown on the following page and your account password will be sent to your email address along with further instructions. If you do not receive the email with your password, please check your spam filter.<br/><br/>
<form action="?subtopic=createaccount" method="post" >
<div class="TableContainer" >
<table class="Table1" cellpadding="0" cellspacing="0" >
@@ -389,14 +412,14 @@ Also you have to agree to the terms presented below. If you have done so, your a
<table style="width:100%;" >
<tr>
<td class="LabelV" >
<span<?php echo (isset($errors['account_name'][0]) ? ' class="red"' : ''); ?>>Account Name:</span>
<span<?php echo (isset($errors['account'][0]) ? ' class="red"' : ''); ?>>Account <?php echo (USE_ACCOUNT_NAME ? 'Name' : 'Number'); ?>:</span>
</td>
<td>
<input type="text" name="account_name" id="account_name" onkeyup="checkAccount();" id="account-name-input" size="30" maxlength="30" value="<?php echo (isset($_POST['account_name']) ? $_POST['account_name'] : ''); ?>" />
<small id="acc_name_check"></small>
<input type="text" name="account" id="account_input" onkeyup="checkAccount();" size="30" maxlength="<?php echo (USE_ACCOUNT_NAME ? '30' : '10'); ?>" value="<?php echo (isset($_POST['account']) ? $_POST['account'] : ''); ?>" />
<small id="acc_check"></small>
</td>
</tr>
<?php write_if_error('account_name'); ?>
<?php write_if_error('account'); ?>
<tr>
<td class="LabelV" >
<span<?php echo (isset($errors['email'][0]) ? ' class="red"' : ''); ?>>Email Address:</span>
@@ -522,7 +545,7 @@ Also you have to agree to the terms presented below. If you have done so, your a
</table>
<script type="text/javascript">
$(function() {
$('#account-name-input').focus();
$('#account_input').focus();
});
</script>
<?php

View File

@@ -16,11 +16,13 @@ if(!isset($config['lua']['experienceStages']) || !getBoolean($config['lua']['exp
{
$enabled = false;
$stages = new DOMDocument();
$stages->load($config['data_path'] . 'XML/stages.xml');
foreach($stages->getElementsByTagName('config') as $node) {
if($node->getAttribute('enabled'))
$enabled = true;
if(file_exists($config['data_path'] . 'XML/stages.xml')) {
$stages = new DOMDocument();
$stages->load($config['data_path'] . 'XML/stages.xml');
foreach($stages->getElementsByTagName('config') as $node) {
if($node->getAttribute('enabled'))
$enabled = true;
}
}
if(!$enabled) {

View File

@@ -103,10 +103,16 @@ if($action == '')
}
else
echo '<TR BGCOLOR='.$config['lightborder'].'><TD ALIGN="CENTER">-</TD><TD><IMG SRC="images/guilds/' . 'default.gif" WIDTH=64 HEIGHT=64></TD>
<TD valign="top" align="center"><B>Create guild</B><BR/>Actually there is no guild on server. Create first! Press button "Create Guild".</TD>
<TD colspan="4"><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><FORM ACTION="?subtopic=guilds&action=createguild" METHOD=post><TR><TD>
<TD valign="top" align="center"><B>Create guild</B><BR/>Actually there is no guild on server.' . ($logged ? ' Create first! Press button "Create Guild".' : '') . '</TD>
<TD colspan="4">';
if($logged)
echo '
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><FORM ACTION="?subtopic=guilds&action=createguild" METHOD=post><TR><TD>
<INPUT TYPE=image NAME="Create Guild" ALT="Create Guild" SRC="'.$template_path.'/images/buttons/sbutton_createguild.png" BORDER=0 WIDTH=120 HEIGHT=18>
</TD></TR></FORM></TABLE></TD></TR>';
</TD></TR></FORM></TABLE>';
echo '
</TD></TR>';
}
else
{
@@ -135,10 +141,14 @@ if($action == '')
}
else
echo '<TR BGCOLOR='.$config['lightborder'].'><TD><IMG SRC="images/guilds/' . 'default.gif" WIDTH=64 HEIGHT=64></TD>
<TD valign="top"><B>Create guild</B><BR/>Actually there is no guild on server. Create first! Press button "Create Guild".</TD>
<TD><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><FORM ACTION="?subtopic=guilds&action=createguild" METHOD=post><TR><TD>
<TD valign="top"><B>Create guild</B><BR/>Actually there is no guild on server.' . ($logged ? ' Create first! Press button "Create Guild".' : '') . '</TD>
<TD>';
if($logged)
echo '<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><FORM ACTION="?subtopic=guilds&action=createguild" METHOD=post><TR><TD>
<INPUT TYPE=image NAME="Create Guild" ALT="Create Guild" SRC="'.$template_path.'/images/buttons/sbutton_createguild.png" BORDER=0 WIDTH=120 HEIGHT=18>
</TD></TR></FORM></TABLE></TD></TR>';
</TD></TR></FORM></TABLE>';
echo '
</TD></TR>';
}
@@ -151,7 +161,7 @@ if($action == '')
<BR /><a href="?subtopic=guilds&action=cleanup_players">Cleanup players</a> - can\'t join guild/be invited? Can\'t create guild? Try cleanup players.
<BR /><a href="?subtopic=guilds&action=cleanup_guilds">Cleanup guilds</a> - made guild, you are a leader, but you are not on players list? Cleanup guilds!';
else
echo 'Before you can create guild you must login.<br><TABLE BORDER=0 WIDTH=100%><TR><TD ALIGN=center><IMG SRC="'.$template_path.'/images/general/blank.gif" WIDTH=80 HEIGHT=1 BORDER=0<BR></TD><TD ALIGN=center><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><FORM ACTION="?subtopic=accountmanagement&redirect=' . BASE_URL . urlencode(getPageLink('guilds')) . '" METHOD=post><TR><TD>
echo 'Before you can create guild you must login.<br><TABLE BORDER=0 WIDTH=100%><TR><TD ALIGN=center><IMG SRC="'.$template_path.'/images/general/blank.gif" WIDTH=80 HEIGHT=1 BORDER=0<BR></TD><TD ALIGN=center><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><FORM ACTION="?subtopic=accountmanagement&redirect=' . getPageLink('guilds') . '" METHOD=post><TR><TD>
<INPUT TYPE=image NAME="Login" ALT="Login" SRC="'.$template_path.'/images/buttons/sbutton_login.gif" BORDER=0 WIDTH=120 HEIGHT=18>
</TD></TR></FORM></TABLE></TD><TD ALIGN=center><IMG SRC="'.$template_path.'/images/general/blank.gif" WIDTH=80 HEIGHT=1 BORDER=0<BR></TD></TR></TABLE>';
}
@@ -263,11 +273,11 @@ if($action == 'show')
$showed_players = 1;
foreach($rank_list as $rank)
{
if(fieldExist('rank_id', 'players'))
$players_with_rank = $db->query('SELECT `id`, `rank_id` FROM `players` WHERE `rank_id` = ' . $rank->getId() . ' AND `deleted` = 0;');
else
if(tableExist(GUILD_MEMBERS_TABLE))
$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(fieldExist('rank_id', 'players'))
$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)
{

View File

@@ -180,7 +180,7 @@ $type = '';
echo '</TR>';
$players_info = $db->query("SELECT `houses`.`id` AS `houseid` , `players`.`name` AS `ownername` , `accounts`.`premdays` AS `premdays` , `accounts`.`lastday` AS `lastlogin` FROM `houses` , `players` , `accounts` WHERE `players`.`id` = `houses`.`owner` AND `accounts`.`id` = `players`.`account_id`");
$players_info = $db->query("SELECT `houses`.`id` AS `houseid` , `players`.`name` AS `ownername` FROM `houses` , `players` , `accounts` WHERE `players`.`id` = `houses`.`owner` AND `accounts`.`id` = `players`.`account_id`");
$players = array();
foreach($players_info->fetchAll() as $player)
$players[$player['houseid']] = array('name' => $player['ownername']);

View File

@@ -16,7 +16,7 @@ $players_deaths_count = 0;
$players_rows = '';
if(tableExist('player_killers')) // tfs 0.3
{
$players_deaths = $db->query('SELECT `player_deaths`.`id`, `player_deaths`.`date`, `player_deaths`.`level`, `players`.`name`, `players`.`world_id` FROM `player_deaths` LEFT JOIN `players` ON `player_deaths`.`player_id` = `players`.`id` ORDER BY `date` DESC LIMIT 0, ' . $config['last_kills_limit']);
$players_deaths = $db->query('SELECT `player_deaths`.`id`, `player_deaths`.`date`, `player_deaths`.`level`, `players`.`name`' . (fieldExist('world_id', 'players') ? ', `players`.`world_id`' : '') . ' FROM `player_deaths` LEFT JOIN `players` ON `player_deaths`.`player_id` = `players`.`id` ORDER BY `date` DESC LIMIT 0, ' . $config['last_kills_limit']);
if(!empty($players_deaths))
{
foreach($players_deaths as $death)

View File

@@ -48,7 +48,7 @@ if(isset($_GET['archive']))
$author = $query['name'];
}
echo news_parse($news['title'], $news['body'], $news['date'], $categories[$news['category']]['icon_id'], $config['news_author'] ? $author : '', getForumThreadLink($news['comments']));
echo news_parse($news['title'], $news['body'], $news['date'], $categories[$news['category']]['icon_id'], $config['news_author'] ? $author : '', $news['comments'] != 0 ? getForumThreadLink($news['comments']) : NULL);
}
else
echo 'This news doesn\'t exist or is hidden.<br>';
@@ -444,7 +444,7 @@ if(!$news_cached)
</a>';
}
echo news_parse($news['title'], $news['body'] . $admin_options, $news['date'], $categories[$news['category']]['icon_id'], $config['news_author'] ? $author : '', getForumThreadLink($news['comments']));
echo news_parse($news['title'], $news['body'] . $admin_options, $news['date'], $categories[$news['category']]['icon_id'], $config['news_author'] ? $author : '', $news['comments'] != 0 ? getForumThreadLink($news['comments']) : NULL);
}
}

View File

@@ -21,13 +21,16 @@ if($config['account_country'])
<td class="white"><b>Server Status</b></td>
</tr>
<?php
$promotion = '';
if(fieldExist('promotion', 'players'))
$promotion = '`promotion`,';
$order = isset($_GET['order']) ? $_GET['order'] : 'name';
if(!in_array($order, array('country', 'name', 'level', 'vocation')))
$order = $db->fieldName('name');
else if($order == 'country')
$order = $db->tableName('accounts') . '.' . $db->fieldName('country');
else if($order == 'vocation')
$order = 'promotion, vocation ASC';
$order = $promotion . 'vocation ASC';
$skull_type = 'skull';
if(fieldExist('skull_type', 'players')) {
@@ -43,7 +46,7 @@ $vocs = array(0, 0, 0, 0, 0);
if(tableExist('players_online')) // tfs 1.0
$playersOnline = $db->query('SELECT `accounts`.`country`, `players`.`name`, `level`, `vocation`, `' . $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);
else
$playersOnline = $db->query('SELECT `accounts`.`country`, `players`.`name`, `level`, `vocation`, `promotion`, `' . $skull_time . '` as `skulltime`, `' . $skull_type . '` as `skull` FROM `accounts`, `players` WHERE `players`.`online` > 0 AND `accounts`.`id` = `players`.`account_id` ORDER BY ' . $order);
$playersOnline = $db->query('SELECT `accounts`.`country`, `players`.`name`, `level`, `vocation`, ' . $promotion . ' `' . $skull_time . '` as `skulltime`, `' . $skull_type . '` as `skull` FROM `accounts`, `players` WHERE `players`.`online` > 0 AND `accounts`.`id` = `players`.`account_id` ORDER BY ' . $order);
$players = 0;
$data = '';
@@ -116,11 +119,11 @@ if(!$players): ?>
' ORDER BY ' . $db->fieldName('record') . ' DESC LIMIT 1');
$timestamp = true;
}
else{ // tfs 1.0
else if(tableExist('server_config')) { // tfs 1.0
$query = $db->query('SELECT `value` as `record` FROM `server_config` WHERE `config` = ' . $db->quote('players_record'));
}
if($query->rowCount() > 0)
if(isset($query) && $query->rowCount() > 0)
{
$result = $query->fetch();
echo 'The maximum on this game world was ' . $result['record'] . ' players' . ($timestamp ? ' on ' . date("M d Y, H:i:s", $result['timestamp']) . '.' : '.');

View File

@@ -11,12 +11,17 @@
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Server info';
if(isset($config['lua']['experience_stages']))
$config['lua']['experienceStages'] = $config['lua']['experience_stages'];
?>
<center>
<h1><?php echo $config['lua']['serverName']; ?></h1>
<h3>
<?php if(isset($config['lua']['experienceStages']) && getBoolean($config['lua']['experienceStages'])): ?>
Experience stages: <a href="<?php echo getPageLink('experienceStages'); ?>">Look here</a><br/>
<?php endif; ?>
Commands: <a href="<?php echo getPageLink('commands'); ?>">Look here</a><br/>
Team: <a href="<?php echo getPageLink('team'); ?>">Look here</a><br/>
</h3>
@@ -34,9 +39,15 @@ $title = 'Server info';
if(isset($config['lua']['globalSaveEnabled']) && getBoolean($config['lua']['globalSaveEnabled']))
echo '<li>Global save: <b>' . $config['lua']['globalSaveHour'] . ':00</b></li>';
if(isset($config['lua']['min_pvp_level'])){
$config['lua']['protectionLevel'] = $config['lua']['min_pvp_level'];
}
if(isset($config['lua']['protectionLevel'])):
?>
<li>World type: <b>PVP <i>(Protection level: ><?php echo $config['lua']['protectionLevel']; ?>)</i></b></li>
<?php
endif;
$rent = trim(strtolower($config['lua']['houseRentPeriod']));
if($rent != 'yearly' && $rent != 'monthly' && $rent != 'weekly' && $rent != 'daily')
$rent = 'never';
@@ -48,14 +59,31 @@ $title = 'Server info';
if($cleanOld > 0)
echo '<li>Houses with inactive owners are cleaned after 30 days.</li>';
}
if(isset($config['lua']['rate_mag']))
$config['lua']['rateMagic'] = $config['lua']['rate_mag'];
if(isset($config['lua']['rate_skill']))
$config['lua']['rateSkill'] = $config['lua']['rate_skill'];
if(isset($config['lua']['rate_loot']))
$config['lua']['rateLoot'] = $config['lua']['rate_loot'];
if(isset($config['lua']['rate_spawn']))
$config['lua']['rateSpawn'] = $config['lua']['rate_spawn'];
?>
<br/>
<h2>Rates</h2>
<?php if(isset($config['lua']['rateMagic'])): ?>
<li>Magic Level: <b>x<?php echo $config['lua']['rateMagic']; ?></b></li>
<?php endif;
if(isset($config['lua']['rateSkill'])): ?>
<li>Skills: <b>x<?php echo $config['lua']['rateSkill']; ?></b></li>
<?php endif;
if(isset($config['lua']['rateLoot'])): ?>
<li>Loot: <b>x<?php echo $config['lua']['rateLoot']; ?></b></li>
<?php endif;
if(isset($config['lua']['rateSpawn'])): ?>
<li>Spawn: <b>x<?php echo $config['lua']['rateSpawn']; ?></b></li>
<?php endif; ?>
<?php
$house_level = NULL;
if(isset($config['lua']['levelToBuyHouse']))
@@ -65,12 +93,15 @@ $title = 'Server info';
if(isset($house_level)):
?>
<li>Houses: <b><?php echo $config['lua']['levelToBuyHouse']; ?> level</b></li>
<li>Houses: <b><?php echo $house_level; ?> level</b></li>
<?php endif; ?>
<li>Guilds: <b><?php echo $config['guild_need_level']; ?> level</b> (Create via website)</li>
<br>
<?php
if(isset($config['lua']['in_fight_duration']))
$config['lua']['pzLocked'] = $config['lua']['in_fight_duration'];
$pzLocked = eval('return ' . $config['lua']['pzLocked'] . ';');
$whiteSkullTime = isset($config['lua']['whiteSkullTime']) ? $config['lua']['whiteSkullTime'] : NULL;
if(!isset($whiteSkullTime) && isset($config['lua']['unjust_skull_duration']))
@@ -138,13 +169,13 @@ $title = 'Server info';
<?php
endif;
if(isset($config['lua']['banishment_length'])): ?>
<li>Banishment length: <b><?php echo eval('return ' . $config['lua']['banishment_length'] / (24 * 60 * 60) . ';'); ?> days</b></li>
<li>Banishment length: <b><?php echo eval('return (' . $config['lua']['banishment_length'] . ') / (24 * 60 * 60);'); ?> days</b></li>
<?php endif;
if(isset($config['lua']['final_banishment_length'])): ?>
<li>Final banishment length: <b><?php echo eval('return ' . $config['lua']['final_banishment_length'] / (24 * 60 * 60) . ';'); ?> days</b></li>
<li>Final banishment length: <b><?php echo eval('return (' . $config['lua']['final_banishment_length'] . ') / (24 * 60 * 60);'); ?> days</b></li>
<?php endif;
if(isset($config['lua']['ip_banishment_length'])): ?>
<li>IP banishment length: <b><?php echo eval('return ' . $config['lua']['ip_banishment_length'] / (24 * 60 * 60) . ';'); ?> days</b></li>
<li>IP banishment length: <b><?php echo eval('return (' . $config['lua']['ip_banishment_length'] . ') / (24 * 60 * 60);'); ?> days</b></li>
<?php endif; ?>
<br/>
<h2>Other</h2>