Merge pull request #201 from HalfAway/master

Temporarly fix to solve problems with serverinfo on linux.
This commit is contained in:
Stefan A. Brannfjell 2015-05-24 15:57:11 +02:00
commit 4ee1227001

View File

@ -5,18 +5,27 @@ Here you will find all basic information about <?php echo '<b>'.$config['site_ti
<?php <?php
// Check if PATH is correct // Check if PATH is correct
if (file_exists($config['server_path'].'/config.lua')) {
if (file_exists($config['server_path'].'/data/xml/stages.xml') && file_exists($config['server_path'].'/config.lua')) // Checks OS from config.php ($config['os'])
{ if ($config['os'] == 'LINUX') {
// Check if server stages are enabled if (file_exists($config['server_path'].'/data/XML/stages.xml')) {
$stages_path = simplexml_load_file($config['server_path'].'/data/xml/stages.xml'); $stages_path = simplexml_load_file($config['server_path'].'/data/XML/stages.xml');
} else {
echo 'Couldn\'t locate stages.xml';
}
} else {
if (file_exists($config['server_path'].'/data/xml/stages.xml')) {
$stages_path = simplexml_load_file($config['server_path'].'/data/XML/stages.xml');
} else {
echo 'Couldn\'t locate stages.xml';
}
}
$lua_path = parse_ini_file($config['server_path'].'/config.lua'); $lua_path = parse_ini_file($config['server_path'].'/config.lua');
echo '<h2>Server rates</h2>';
if ($stages_path->config['enabled'] != 0) { if ($stages_path->config['enabled'] != 0) {
// Stages are beeing used // Stages are beeing used
echo "<h2>Server stages</h2> echo "<table class='table table-striped table-hover'>
<table class='table table-striped table-hover'>
<tbody><tr class='yellow'><td>Minium level</td><td>Maximun level</td><td>Multiplier</td></tr>"; <tbody><tr class='yellow'><td>Minium level</td><td>Maximun level</td><td>Multiplier</td></tr>";
foreach ($stages_path->children()->stage as $stages) { foreach ($stages_path->children()->stage as $stages) {
@ -27,23 +36,22 @@ if (file_exists($config['server_path'].'/data/xml/stages.xml') && file_exists($c
echo '<tr><td><center>'.$stages['minlevel'].'</center></td><td><center>'.$stages['maxlevel'].'</center></td><td><center>x'.$stages['multiplier'].'</center></td></tr>'; echo '<tr><td><center>'.$stages['minlevel'].'</center></td><td><center>'.$stages['maxlevel'].'</center></td><td><center>x'.$stages['multiplier'].'</center></td></tr>';
} }
} }
echo '</tbody></table>'; echo '</tbody></table>';
} else { } else {
// Not using stages // Not using stages
echo "<h2>Server rates</h2> echo "<table class='table table-striped table-hover'>
<table class='table table-striped table-hover'> <tbody><tr class='yellow'><td>Experience rate</td></tr>
<tbody><tr class='yellow'><td>Experience rate</td><td>Skills rate</td><td>Magic rate</td><td>Loot rate</td></tr> <tr><td><center>x".$lua_path['rateExp']."</center></td></tr>
<tr><td><center>x".$lua_path['rateExp']."</center></td><td><center>x".$lua_path['rateSkill']."</center></td><td><center>x".$lua_path['rateMagic']."</center></td><td><center>x".$lua_path['rateLoot']."</center></td></tr>
</tbody></table>"; </tbody></table>";
} }
echo "<table class='table table-striped table-hover'>
<tbody><tr class='yellow'><td>Skills rate</td><td>Magic rate</td><td>Loot rate</td></tr>
<tr><td><center>x".$lua_path['rateSkill']."</center></td><td><center>x".$lua_path['rateMagic']."</center></td><td><center>x".$lua_path['rateLoot']."</center></td></tr>
</tbody></table>";
// General info // General info
$information = array( $information = array(
'World type' => $lua_path['worldType'], 'World type' => $lua_path['worldType'],
'Protection level' => $lua_path['protectionLevel'], 'Protection level' => $lua_path['protectionLevel'],
'Kills to red skull' => $lua_path['killsToRedSkull'], 'Kills to red skull' => $lua_path['killsToRedSkull'],
@ -55,11 +63,9 @@ if (file_exists($config['server_path'].'/data/xml/stages.xml') && file_exists($c
'AFK Kickout minutes' => $lua_path['kickIdlePlayerAfterMinutes'], 'AFK Kickout minutes' => $lua_path['kickIdlePlayerAfterMinutes'],
'Location' => $lua_path['location'], 'Location' => $lua_path['location'],
'Owner name' => $lua_path['ownerName'] 'Owner name' => $lua_path['ownerName']
); );
echo "<h2>Server general information</h2><ul>"; echo "<h2>Server general information</h2><ul>";
foreach ($information as $key => $value) { foreach ($information as $key => $value) {
echo "<li>".$key." - <b>".$value."</b></li>"; echo "<li>".$key." - <b>".$value."</b></li>";
} }
@ -67,9 +73,7 @@ if (file_exists($config['server_path'].'/data/xml/stages.xml') && file_exists($c
echo '</ul>'; echo '</ul>';
} else { } else {
echo '<h1>Invliad PATH, please check your config file</h1>'; echo '<h1>Invliad PATH, please check your config file</h1>';
} }
?> include 'layout/overall/footer.php'; ?>
<?php include 'layout/overall/footer.php'; ?>