Tabs instead of spaces (#416)

* Tabs instead of spaces
This commit is contained in:
Evil Puncker 2020-06-02 12:50:52 -03:00 committed by GitHub
parent 5a80034915
commit 0fae6d6e5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 786 additions and 787 deletions

View File

@ -57,9 +57,9 @@ function onSay(cid, words, param)
local outfits = {}
if itemid > 1000 then
local first = math.floor(itemid/1000)
table.insert(outfits, first)
itemid = itemid - (first * 1000)
local first = math.floor(itemid/1000)
table.insert(outfits, first)
itemid = itemid - (first * 1000)
end
table.insert(outfits, itemid)

View File

@ -59,9 +59,9 @@ function onSay(cid, words, param)
local outfits = {}
if itemid > 1000 then
local first = math.floor(itemid/1000)
table.insert(outfits, first)
itemid = itemid - (first * 1000)
local first = math.floor(itemid/1000)
table.insert(outfits, first)
itemid = itemid - (first * 1000)
end
table.insert(outfits, itemid)

View File

@ -70,9 +70,9 @@ function onSay(cid, words, param)
local outfits = {}
if itemid > 1000 then
local first = math.floor(itemid/1000)
table.insert(outfits, first)
itemid = itemid - (first * 1000)
local first = math.floor(itemid/1000)
table.insert(outfits, first)
itemid = itemid - (first * 1000)
end
table.insert(outfits, itemid)

View File

@ -2,24 +2,24 @@
-- can be added to data/global.lua if you want to use eternal storage for another purpose than this.
-- Regular TFS global storage values get reset every time server reboots. This does not.
local function getEternalStorage(key, parser)
local value = result.getString(db.storeQuery("SELECT `value` FROM `znote_global_storage` WHERE `key` = ".. key .. ";"), "value")
if not value then
if parser then
return false
else
return -1
end
end
return tonumber(value) or value
local value = result.getString(db.storeQuery("SELECT `value` FROM `znote_global_storage` WHERE `key` = ".. key .. ";"), "value")
if not value then
if parser then
return false
else
return -1
end
end
return tonumber(value) or value
end
local function setEternalStorage(key, value)
if getEternalStorage(key, true) then
db.query("UPDATE `znote_global_storage` SET `value` = '".. value .. "' WHERE `key` = ".. key .. ";")
else
db.query("INSERT INTO `znote_global_storage` (`key`, `value`) VALUES (".. key ..", ".. value ..");")
end
return true
if getEternalStorage(key, true) then
db.query("UPDATE `znote_global_storage` SET `value` = '".. value .. "' WHERE `key` = ".. key .. ";")
else
db.query("INSERT INTO `znote_global_storage` (`key`, `value`) VALUES (".. key ..", ".. value ..");")
end
return true
end
-- SQL Query to execute: --
@ -53,11 +53,11 @@ UPDATE `znote_players` AS `z` INNER JOIN `players` AS `p` ON `p`.`id`=`z`.`play
-- <globalevent name="PowerGamers" interval="60000" script="powergamers.lua"/>
function onThink(interval, lastExecution, thinkInterval)
if tonumber(os.date("%d")) ~= getEternalStorage(23856) then
setEternalStorage(23856, (tonumber(os.date("%d"))))
db.query("UPDATE `znote_players` SET `onlinetime7`=`onlinetime6`, `onlinetime6`=`onlinetime5`, `onlinetime5`=`onlinetime4`, `onlinetime4`=`onlinetime3`, `onlinetime3`=`onlinetime2`, `onlinetime2`=`onlinetime1`, `onlinetime1`=`onlinetimetoday`, `onlinetimetoday`=0;")
db.query("UPDATE `znote_players` `z` INNER JOIN `players` `p` ON `p`.`id`=`z`.`player_id` SET `z`.`exphist7`=`z`.`exphist6`, `z`.`exphist6`=`z`.`exphist5`, `z`.`exphist5`=`z`.`exphist4`, `z`.`exphist4`=`z`.`exphist3`, `z`.`exphist3`=`z`.`exphist2`, `z`.`exphist2`=`z`.`exphist1`, `z`.`exphist1`=`p`.`experience`-`z`.`exphist_lastexp`, `z`.`exphist_lastexp`=`p`.`experience`;")
end
db.query("UPDATE `znote_players` SET `onlinetimetoday` = `onlinetimetoday` + 60, `onlinetimeall` = `onlinetimeall` + 60 WHERE `player_id` IN (SELECT `player_id` FROM `players_online` WHERE `players_online`.`player_id` = `znote_players`.`player_id`)")
return true
if tonumber(os.date("%d")) ~= getEternalStorage(23856) then
setEternalStorage(23856, (tonumber(os.date("%d"))))
db.query("UPDATE `znote_players` SET `onlinetime7`=`onlinetime6`, `onlinetime6`=`onlinetime5`, `onlinetime5`=`onlinetime4`, `onlinetime4`=`onlinetime3`, `onlinetime3`=`onlinetime2`, `onlinetime2`=`onlinetime1`, `onlinetime1`=`onlinetimetoday`, `onlinetimetoday`=0;")
db.query("UPDATE `znote_players` `z` INNER JOIN `players` `p` ON `p`.`id`=`z`.`player_id` SET `z`.`exphist7`=`z`.`exphist6`, `z`.`exphist6`=`z`.`exphist5`, `z`.`exphist5`=`z`.`exphist4`, `z`.`exphist4`=`z`.`exphist3`, `z`.`exphist3`=`z`.`exphist2`, `z`.`exphist2`=`z`.`exphist1`, `z`.`exphist1`=`p`.`experience`-`z`.`exphist_lastexp`, `z`.`exphist_lastexp`=`p`.`experience`;")
end
db.query("UPDATE `znote_players` SET `onlinetimetoday` = `onlinetimetoday` + 60, `onlinetimeall` = `onlinetimeall` + 60 WHERE `player_id` IN (SELECT `player_id` FROM `players_online` WHERE `players_online`.`player_id` = `znote_players`.`player_id`)")
return true
end

View File

@ -1,7 +1,7 @@
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
if(!isset($_SESSION['csrf_token'])){
$_SESSION['csrf_token']=bin2hex(random_bytes_compat(5,$crypto_strong));
$_SESSION['csrf_token'] = bin2hex(random_bytes_compat(5, $crypto_strong));
if(!$crypto_strong){
// we don't really care, the csrf token doesn't really have to be cryptographically strong.
}
@ -26,7 +26,7 @@ if (empty($_POST) === false) {
// BAN system!
if (!empty($_POST['ban_char']) && !empty($_POST['ban_type']) && !empty($_POST['ban_action']) && !empty($_POST['ban_reason']) && !empty($_POST['ban_time']) && !empty($_POST['ban_comment'])) {
if (user_character_exist($_POST['ban_char'])) {
// Decrypt and store values
$charname = $_POST['ban_char'];
$typeid = (int)$_POST['ban_type'] - $enc;
@ -47,9 +47,8 @@ if (empty($_POST) === false) {
$errors[] = 'Character '. hhb_tohtml(getValue($_POST['ban_char'])) .' does not exist.';
}
}
// delete character:
// Delete character:
if (empty($_POST['del_name']) === false) {
if (user_character_exist($_POST['del_name'])) {
user_delete_character(user_character_id($_POST['del_name']));
@ -58,13 +57,13 @@ if (empty($_POST) === false) {
$errors[] = 'Character '. hhb_tohtml(getValue($_POST['del_name'])) .' does not exist.';
}
}
// Reset password for char name
if (empty($_POST['reset_pass']) === false && empty($_POST['new_pass']) === false) {
// reset_pass = character name
if (user_character_exist($_POST['reset_pass'])) {
$acc_id = user_character_account_id($_POST['reset_pass']);
if ($acc_id != $session_user_id) {
if ($config['ServerEngine'] == 'TFS_02' || $config['ServerEngine'] == 'TFS_10' || $config['ServerEngine'] == 'OTHIRE') {
user_change_password($acc_id, $_POST['new_pass']);
@ -100,7 +99,7 @@ if (empty($_POST) === false) {
$points += $znote_account['points'];
mysql_update("UPDATE `znote_accounts` SET `points`='$points' WHERE `account_id`='". $account['account_id'] ."';");
}
// Set character position
if (empty($_POST['position_name']) === false && empty($_POST['position_type']) === false) {
if (user_character_exist($_POST['position_name'])) {
@ -122,7 +121,7 @@ if (empty($_POST) === false) {
$errors[] = 'Character '. hhb_tohtml(getValue($_POST['position_name'])) .' does not exist.';
}
}
// Teleport Player
if (isset($_POST['from']) && in_array($_POST['from'], ['all', 'only'])) {
$from = $_POST['from'];
@ -193,7 +192,7 @@ echo "Last cached on: ". hhb_tohtml(getClock($basic['cached'], true)) .".<br>";
<input type="text" name="ban_char" placeholder="Character name...">
</td>
</tr>
<!-- row 2 -->
<tr>
<td>
@ -220,7 +219,7 @@ echo "Last cached on: ". hhb_tohtml(getClock($basic['cached'], true)) .".<br>";
</select>
</td>
</tr>
<!-- row 3 -->
<tr>
<td>
@ -234,7 +233,7 @@ echo "Last cached on: ". hhb_tohtml(getClock($basic['cached'], true)) .".<br>";
</select>
</td>
</tr>
<!-- row 4 -->
<tr>
<td>

View File

@ -7,12 +7,12 @@ include 'layout/overall/header.php';
// Report status types. When a player make new report it will be default to 0.
// Feel free to add/remove and change name/color of status types.
$statusTypes = array(
0 => '<font color="purple">Reported</font>',
1 => '<font color="darkblue">To-Do List</font>',
2 => '<font color="red">Confirmed bug</font>',
3 => '<font color="grey">Invalid</font>',
4 => '<font color="grey">Rejected</font>',
5 => '<font color="green"><b>Fixed</b></font>'
0 => '<font color="purple">Reported</font>',
1 => '<font color="darkblue">To-Do List</font>',
2 => '<font color="red">Confirmed bug</font>',
3 => '<font color="grey">Invalid</font>',
4 => '<font color="grey">Rejected</font>',
5 => '<font color="green"><b>Fixed</b></font>'
);
// Which status IDs should give option to add to changelog?
$statusChangeLog = array(0,5);
@ -22,222 +22,222 @@ $hideStatus = array(3, 4, 5);
// Fetch data from SQL
$reportsData = mysql_select_multi('SELECT id, name, posx, posy, posz, report_description, date, status FROM znote_player_reports ORDER BY id DESC;');
// If sql data is not empty
// If SQL data is not empty
if ($reportsData !== false) {
// Order reports array by ID for easy reference later on.
$reports = array();
for ($i = 0; $i < count($reportsData); $i++)
foreach ($statusTypes as $key => $value)
if ($key == $reportsData[$i]['status'])
$reports[$key][$reportsData[$i]['id']] = $reportsData[$i];
// Order reports array by ID for easy reference later on.
$reports = array();
for ($i = 0; $i < count($reportsData); $i++)
foreach ($statusTypes as $key => $value)
if ($key == $reportsData[$i]['status'])
$reports[$key][$reportsData[$i]['id']] = $reportsData[$i];
}
// POST logic (Update report and give player points)
if (!empty($_POST)) {
// Fetch POST data
$playerName = getValue($_POST['playerName']);
$status = getValue($_POST['status']);
$price = getValue($_POST['price']);
$customPoints = getValue($_POST['customPoints']);
$reportId = getValue($_POST['id']);
// Fetch POST data
$playerName = getValue($_POST['playerName']);
$status = getValue($_POST['status']);
$price = getValue($_POST['price']);
$customPoints = getValue($_POST['customPoints']);
$reportId = getValue($_POST['id']);
$changelogReportId = (int)$_POST['changelogReportId'];
$changelogValue = &$_POST['changelogValue'];
$changelogText = getValue($_POST['changelogText']);
$changelogStatus = ($changelogReportId !== false && $changelogValue === '2' && $changelogText !== false) ? true : false;
$changelogReportId = (int)$_POST['changelogReportId'];
$changelogValue = &$_POST['changelogValue'];
$changelogText = getValue($_POST['changelogText']);
$changelogStatus = ($changelogReportId !== false && $changelogValue === '2' && $changelogText !== false) ? true : false;
if ($customPoints !== false) $price = (int)($price + $customPoints);
if ($customPoints !== false) $price = (int)($price + $customPoints);
// Update SQL
mysql_update("UPDATE `znote_player_reports` SET `status`='$status' WHERE `id`='$reportId' LIMIT 1;");
echo "<h1>Report status updated to ".$statusTypes[(int)$status] ."!</h1>";
// Update local array representation
foreach ($reports as $sid => $sa)
foreach ($sa as $rid => $ra)
if ($reportId == $rid) {
$reports[$status][$reportId] = $reports[$sid][$rid];
$reports[$status][$reportId]['status'] = $status;
unset($reports[$sid][$rid]);
}
// Update SQL
mysql_update("UPDATE `znote_player_reports` SET `status`='$status' WHERE `id`='$reportId' LIMIT 1;");
echo "<h1>Report status updated to ".$statusTypes[(int)$status] ."!</h1>";
// Update local array representation
foreach ($reports as $sid => $sa)
foreach ($sa as $rid => $ra)
if ($reportId == $rid) {
$reports[$status][$reportId] = $reports[$sid][$rid];
$reports[$status][$reportId]['status'] = $status;
unset($reports[$sid][$rid]);
}
// If we should do anything with changelog:
if ($changelogStatus) {
$time = time();
// Check if changelog exist (`id`, `text`, `time`, `report_id`, `status`)
$changelog = mysql_select_single("SELECT * FROM `znote_changelog` WHERE `report_id`='$changelogReportId' LIMIT 1;");
// If changelog exist
$updatechangelog = false;
if ($changelog !== false) {
// Update it
mysql_update("UPDATE `znote_changelog` SET `text`='$changelogText', `time`='$time' WHERE `id`='".$changelog['id']."' LIMIT 1;");
echo "<h2>Changelog message updated!</h2>";
$updatechangelog = true;
} else {
// Create it
mysql_insert("INSERT INTO `znote_changelog` (`text`, `time`, `report_id`, `status`)
VALUES ('$changelogText', '$time', '$changelogReportId', '$status');");
echo "<h2>Changelog message created!</h2>";
$updatechangelog = true;
}
if ($updatechangelog) {
// Cache changelog
$cache = new Cache('engine/cache/changelog');
$cache->setContent(mysql_select_multi("SELECT `id`, `text`, `time`, `report_id`, `status` FROM `znote_changelog` ORDER BY `id` DESC;"));
$cache->save();
}
}
// If we should give user price
if ($price > 0) {
$account = mysql_select_single("SELECT `a`.`id`, `a`.`email` FROM `accounts` AS `a`
INNER JOIN `players` AS `p` ON `p`.`account_id` = `a`.`id`
WHERE `p`.`name` = '$playerName' LIMIT 1;");
if ($account !== false) {
// transaction log
mysql_insert("INSERT INTO `znote_paypal` VALUES ('', '$reportId', 'report@admin.".$user_data['name']." to ".$account['email']."', '".$account['id']."', '0', '".$price."')");
// Process payment
$data = mysql_select_single("SELECT `points` AS `old_points` FROM `znote_accounts` WHERE `account_id`='".$account['id']."';");
// Give points to user
$new_points = $data['old_points'] + $price;
mysql_update("UPDATE `znote_accounts` SET `points`='$new_points' WHERE `account_id`='".$account['id']."'");
// If we should do anything with changelog:
if ($changelogStatus) {
$time = time();
// Check if changelog exist (`id`, `text`, `time`, `report_id`, `status`)
$changelog = mysql_select_single("SELECT * FROM `znote_changelog` WHERE `report_id`='$changelogReportId' LIMIT 1;");
// If changelog exist
$updatechangelog = false;
if ($changelog !== false) {
// Update it
mysql_update("UPDATE `znote_changelog` SET `text`='$changelogText', `time`='$time' WHERE `id`='".$changelog['id']."' LIMIT 1;");
echo "<h2>Changelog message updated!</h2>";
$updatechangelog = true;
} else {
// Create it
mysql_insert("INSERT INTO `znote_changelog` (`text`, `time`, `report_id`, `status`)
VALUES ('$changelogText', '$time', '$changelogReportId', '$status');");
echo "<h2>Changelog message created!</h2>";
$updatechangelog = true;
}
if ($updatechangelog) {
// Cache changelog
$cache = new Cache('engine/cache/changelog');
$cache->setContent(mysql_select_multi("SELECT `id`, `text`, `time`, `report_id`, `status` FROM `znote_changelog` ORDER BY `id` DESC;"));
$cache->save();
}
}
// If we should give user price
if ($price > 0) {
$account = mysql_select_single("SELECT `a`.`id`, `a`.`email` FROM `accounts` AS `a`
INNER JOIN `players` AS `p` ON `p`.`account_id` = `a`.`id`
WHERE `p`.`name` = '$playerName' LIMIT 1;");
if ($account !== false) {
// transaction log
mysql_insert("INSERT INTO `znote_paypal` VALUES ('', '$reportId', 'report@admin.".$user_data['name']." to ".$account['email']."', '".$account['id']."', '0', '".$price."')");
// Process payment
$data = mysql_select_single("SELECT `points` AS `old_points` FROM `znote_accounts` WHERE `account_id`='".$account['id']."';");
// Give points to user
$new_points = $data['old_points'] + $price;
mysql_update("UPDATE `znote_accounts` SET `points`='$new_points' WHERE `account_id`='".$account['id']."'");
// Remind GM that he sent points to character
echo "<font color='green' size='5'>".$playerName." has been granted ".$price." points for his reports.</font>";
}
}
// Remind GM that he sent points to character
echo "<font color='green' size='5'>".$playerName." has been granted ".$price." points for his reports.</font>";
}
}
// GET logic (Edit report data and specify how many [if any] points to give to user)
} elseif (!empty($_GET)) {
// Fetch GET data
$action = getValue($_GET['action']);
$playerName = getValue($_GET['name']);
$reportId = getValue($_GET['id']);
// Fetch GET data
$action = getValue($_GET['action']);
$playerName = getValue($_GET['name']);
$reportId = getValue($_GET['id']);
// Fetch the report we intend to modify
foreach ($reports as $sid => $sa)
foreach ($sa as $rid => $ra)
if ($rid == $reportId)
$report = $reports[$sid][$reportId];
// Create html form
?>
<div style="width: 300px; margin: auto;">
<form action="admin_reports.php" method="POST">
Player: <a target="_BLANK" href="characterprofile.php?name=<?php echo $report['name']; ?>"><?php echo $report['name']; ?></a>
<input type="hidden" name="playerName" value="<?php echo $report['name']; ?>">
<input type="hidden" name="id" value="<?php echo $report['id']; ?>">
<br>Set status:
<select name="status">
<?php
foreach ($statusTypes as $sid => $sname)
echo ($sid != $report['status']) ? "<option value='$sid'>$sname</option>" : "<option value='$sid' selected>$sname</option>";
?>
</select><br>
Give user points:
<select name="price">
<option value='0'>0</option>
<?php
foreach ($config['paypal_prices'] as $price)
echo "<option value='$price'>$price</option>";
?>
</select> + <input name="customPoints" type="text" style="width: 50px;" placeholder="0"><br>
<?php
if (in_array($report['status'], $statusChangeLog)) {
?>
<br>
<input type="hidden" name="changelogReportId" value="<?php echo $report['id']; ?>">
Add / update changelog message? <select name="changelogValue">
<option value="1">No</option>
<option value="2">Yes</option>
</select><br>
<textarea rows="7" cols="40" maxlength="254" name="changelogText"></textarea>
<?php
}
?>
<br>
<input type="submit" value="Update Report" style="width: 100%;">
</form>
</div>
<?php
// Fetch the report we intend to modify
foreach ($reports as $sid => $sa)
foreach ($sa as $rid => $ra)
if ($rid == $reportId)
$report = $reports[$sid][$reportId];
// Create HTML form
?>
<div style="width: 300px; margin: auto;">
<form action="admin_reports.php" method="POST">
Player: <a target="_BLANK" href="characterprofile.php?name=<?php echo $report['name']; ?>"><?php echo $report['name']; ?></a>
<input type="hidden" name="playerName" value="<?php echo $report['name']; ?>">
<input type="hidden" name="id" value="<?php echo $report['id']; ?>">
<br>Set status:
<select name="status">
<?php
foreach ($statusTypes as $sid => $sname)
echo ($sid != $report['status']) ? "<option value='$sid'>$sname</option>" : "<option value='$sid' selected>$sname</option>";
?>
</select><br>
Give user points:
<select name="price">
<option value='0'>0</option>
<?php
foreach ($config['paypal_prices'] as $price)
echo "<option value='$price'>$price</option>";
?>
</select> + <input name="customPoints" type="text" style="width: 50px;" placeholder="0"><br>
<?php
if (in_array($report['status'], $statusChangeLog)) {
?>
<br>
<input type="hidden" name="changelogReportId" value="<?php echo $report['id']; ?>">
Add / update changelog message? <select name="changelogValue">
<option value="1">No</option>
<option value="2">Yes</option>
</select><br>
<textarea rows="7" cols="40" maxlength="254" name="changelogText"></textarea>
<?php
}
?>
<br>
<input type="submit" value="Update Report" style="width: 100%;">
</form>
</div>
<?php
}
// If sql data is not empty
// If SQL data is not empty
if ($reportsData !== false) {
// Render HTML
?>
<center>
<?php
foreach ($reports as $statusId => $statusArray) {
?>
<h2 class="statusType"><?php echo $statusTypes[$statusId]; ?> (<span id="status-<?php echo $statusId; ?>">Visible</span>)</h2>
<table class="table tbl" border="0" cellspacing="1" cellpadding="4" width="100%">
<thead>
<tr class="yellow" onclick="javascript:toggle('<?php echo $statusId; ?>')">
<td width="38%">Info</td>
<td>Description</td>
</tr>
</thead>
<?php
foreach ($statusArray as $reportId => $report) {
?>
<tbody class="row<?php echo $report['status']; ?>">
<tr>
<td>
<b>Report ID:</b> #<?php echo $report['id']; ?>
<br><b>Name:</b> <a href="characterprofile.php?name=<?php echo $report['name']; ?>"><?php echo $report['name']; ?></a>
<br><b>Position:</b> <input type="text" disabled value="/pos <?php echo $report['posx'].', '.$report['posy'].', '.$report['posz']; ?>">
<br><b>Reported:</b> <?php echo getClock($report['date'], true, true); ?>
<br><b>Status:</b> <?php echo $statusTypes[$report['status']]; ?>. <a href="?action=edit&name=<?php echo $report['name'].'&id='.$report['id']; ?>">Edit</a>
</td>
<td><?php echo $report['report_description']; ?></td>
</tr>
</tbody>
<?php
}
?></table><?php
}
?>
</center>
<?php
// Render HTML
?>
<center>
<?php
foreach ($reports as $statusId => $statusArray) {
?>
<h2 class="statusType"><?php echo $statusTypes[$statusId]; ?> (<span id="status-<?php echo $statusId; ?>">Visible</span>)</h2>
<table class="table tbl" border="0" cellspacing="1" cellpadding="4" width="100%">
<thead>
<tr class="yellow" onclick="javascript:toggle('<?php echo $statusId; ?>')">
<td width="38%">Info</td>
<td>Description</td>
</tr>
</thead>
<?php
foreach ($statusArray as $reportId => $report) {
?>
<tbody class="row<?php echo $report['status']; ?>">
<tr>
<td>
<b>Report ID:</b> #<?php echo $report['id']; ?>
<br><b>Name:</b> <a href="characterprofile.php?name=<?php echo $report['name']; ?>"><?php echo $report['name']; ?></a>
<br><b>Position:</b> <input type="text" disabled value="/pos <?php echo $report['posx'].', '.$report['posy'].', '.$report['posz']; ?>">
<br><b>Reported:</b> <?php echo getClock($report['date'], true, true); ?>
<br><b>Status:</b> <?php echo $statusTypes[$report['status']]; ?>. <a href="?action=edit&name=<?php echo $report['name'].'&id='.$report['id']; ?>">Edit</a>
</td>
<td><?php echo $report['report_description']; ?></td>
</tr>
</tbody>
<?php
}
?></table><?php
}
?>
</center>
<?php
} else echo "<h2>No reports submitted.</h2>";
?>
<style>
tr.yellow[onclick] td {
font-weight: bold;
color: white;
text-align: center;
font-weight: bold;
color: white;
text-align: center;
}
tbody[class^=row] td:last-of-type {
text-align: center;
text-align: center;
}
</style>
<script type="text/javascript">
// Hide and show tables
// Written in clean javascript to make it cross-layout compatible.
function toggle(statusId) {
var divStatus = 'row' + statusId,
msgStatus = 'status-' + statusId;
// Hide and show tables
// Written in clean javascript to make it cross-layout compatible.
function toggle(statusId) {
var divStatus = 'row' + statusId,
msgStatus = 'status-' + statusId;
// Change visibility status
statusElement = document.getElementById(msgStatus);
// Change visibility status
statusElement = document.getElementById(msgStatus);
statusElement.innerHTML = (statusElement.innerHTML == 'Visible') ? 'Hidden' : 'Visible';
// Show/hide elements.
var elements = document.getElementsByClassName(divStatus);
for (var i = 0; i < elements.length; i++)
elements[i].style.display = (elements[i].style.display == 'none') ? 'table-header-group' : 'none';
}
statusElement.innerHTML = (statusElement.innerHTML == 'Visible') ? 'Hidden' : 'Visible';
// Show/hide elements.
var elements = document.getElementsByClassName(divStatus);
for (var i = 0; i < elements.length; i++)
elements[i].style.display = (elements[i].style.display == 'none') ? 'table-header-group' : 'none';
}
<?php // Hide configured tables by default
foreach ($hideStatus as $statusId)
echo "toggle($statusId);";
?>
<?php // Hide configured tables by default
foreach ($hideStatus as $statusId)
echo "toggle($statusId);";
?>
var st = document.body.querySelectorAll('.statusType');
for(i = 0; i < st.length; i++)
st[i].addEventListener('click', function(e) {
toggle(e.currentTarget.querySelector('span').id.match(/(\d)+/)[0]);
});
var st = document.body.querySelectorAll('.statusType');
for(i = 0; i < st.length; i++)
st[i].addEventListener('click', function(e) {
toggle(e.currentTarget.querySelector('span').id.match(/(\d)+/)[0]);
});
</script>
<?php include 'layout/overall/footer.php'; ?>
<?php include 'layout/overall/footer.php'; ?>

View File

@ -1,16 +1,16 @@
<?php require_once 'engine/init.php';
protect_page();
include 'layout/overall/header.php';
include 'layout/overall/header.php';
// Convert a seconds integer value into days, hours, minutes and seconds string.
function toDuration($is) {
$duration['day'] = $is / (24 * 60 * 60);
if (($duration['day'] - (int)$duration['day']) > 0)
$duration['hour'] = ($duration['day'] - (int)$duration['day']) * 24;
if (isset($duration['hour'])) {
if (($duration['hour'] - (int)$duration['hour']) > 0)
if (($duration['hour'] - (int)$duration['hour']) > 0)
$duration['minute'] = ($duration['hour'] - (int)$duration['hour']) * 60;
if (isset($duration['minute'])) {
if (($duration['minute'] - (int)$duration['minute']) > 0)
if (($duration['minute'] - (int)$duration['minute']) > 0)
$duration['second'] = ($duration['minute'] - (int)$duration['minute']) * 60;
}
}
@ -49,23 +49,23 @@ if ($auction['characterAuction']) {
$step = $auction['step'];
$step_duration = $auction['step_duration'];
$actions = array(
'list', // list all available players in auction
'view', // view a specific player
'create', // select which character to add and initial price
'add', // add character to list
'bid', // Bid or buy a specific player
'refund', // Refund a player you added back to your account
'claim' // Claim a character you won through purchase or bid
'list', // list all available players in auction
'view', // view a specific player
'create', // select which character to add and initial price
'add', // add character to list
'bid', // Bid or buy a specific player
'refund', // Refund a player you added back to your account
'claim' // Claim a character you won through purchase or bid
);
// Default action is list, but $_GET or $_POST will override it.
$action = 'list';
// Load selected string from actions array based on input, strict whitelist validation
if (isset( $_GET['action']) && in_array( $_GET['action'], $actions)) {
$action = $actions[array_search( $_GET['action'], $actions, true)];
if (isset( $_GET['action']) && in_array( $_GET['action'], $actions)) {
$action = $actions[array_search( $_GET['action'], $actions, true)];
}
if (isset($_POST['action']) && in_array($_POST['action'], $actions)) {
$action = $actions[array_search($_POST['action'], $actions, true)];
if (isset($_POST['action']) && in_array($_POST['action'], $actions)) {
$action = $actions[array_search($_POST['action'], $actions, true)];
}
// Passive check to see if bid period has expired and someone won a deal
@ -86,8 +86,8 @@ if ($auction['characterAuction']) {
if (!empty($soldIds)) {
mysql_update("
UPDATE `znote_auction_player`
SET `sold`=1
WHERE `id` IN(".implode(',', $soldIds).")
SET `sold` = 1
WHERE `id` IN(".implode(',', $soldIds).")
LIMIT ".COUNT($soldIds).";
");
}
@ -106,13 +106,13 @@ if ($auction['characterAuction']) {
// The account of the buyer, if he can afford what he is trying to pay
$account = mysql_select_single("
SELECT
`a`.`id`,
`a`.`id`,
`za`.`points`
FROM `accounts` a
FROM `accounts` a
INNER JOIN `znote_accounts` za
ON `a`.`id` = `za`.`account_id`
WHERE `a`.`id`= {$this_account_id}
AND `za`.`points` >= {$price}
WHERE `a`.`id`= {$this_account_id}
AND `za`.`points` >= {$price}
LIMIT 1;
");
//data_dump($account, false, "Buyer account:");
@ -120,23 +120,23 @@ if ($auction['characterAuction']) {
// The character to buy, presuming it isn't sold, buyer isn't the owner, buyer can afford it
if ($account !== false) {
$character = mysql_select_single("
SELECT
SELECT
`za`.`id` AS `zaid`,
`za`.`player_id`,
`za`.`original_account_id`,
`za`.`bidder_account_id`,
`za`.`time_begin`,
`za`.`time_end`,
`za`.`price`,
`za`.`bid`,
`za`.`deposit`,
`za`.`sold`
`za`.`price`,
`za`.`bid`,
`za`.`deposit`,
`za`.`sold`
FROM `znote_auction_player` za
WHERE `za`.`id` = {$zaid}
AND `za`.`sold` = 0
AND `za`.`original_account_id` != {$this_account_id}
AND `za`.`sold` = 0
AND `za`.`original_account_id` != {$this_account_id}
AND `za`.`price` <= {$price}
AND `za`.`bid`+{$step} <= {$price}
AND `za`.`bid`+{$step} <= {$price}
LIMIT 1
");
//data_dump($character, false, "Character to buy:");
@ -146,8 +146,8 @@ if ($auction['characterAuction']) {
if ($character['bid'] > 0 && $character['bidder_account_id'] > 0) {
mysql_update("
UPDATE `znote_accounts`
SET `points` = `points`+{$character['bid']}
WHERE `account_id` = {$character['bidder_account_id']}
SET `points` = `points`+{$character['bid']}
WHERE `account_id` = {$character['bidder_account_id']}
LIMIT 1;
");
// If previous bidder is not you, increase bidding period by 1 hour
@ -156,7 +156,7 @@ if ($auction['characterAuction']) {
mysql_update("
UPDATE `znote_auction_player`
SET `time_end` = `time_end`+{$step_duration}
WHERE `id` = {$character['zaid']}
WHERE `id` = {$character['zaid']}
LIMIT 1;
");
}
@ -164,15 +164,15 @@ if ($auction['characterAuction']) {
// Remove points from buyer
mysql_update("
UPDATE `znote_accounts`
SET `points` = `points`-{$price}
WHERE `account_id` = {$account['id']}
SET `points` = `points`-{$price}
WHERE `account_id` = {$account['id']}
LIMIT 1;
");
// Update auction, and set new bidder data
$time = time();
mysql_update("
UPDATE `znote_auction_player`
SET
SET
`bidder_account_id` = {$account['id']},
`bid` = {$price},
`sold` = CASE WHEN {$time} >= `time_end` THEN 1 ELSE 0 END
@ -183,8 +183,8 @@ if ($auction['characterAuction']) {
if (time() >= $character['time_end']) {
mysql_update("
UPDATE `znote_accounts`
SET `points` = `points`+{$character['deposit']}
WHERE `account_id` = {$account['id']}
SET `points` = `points`+{$character['deposit']}
WHERE `account_id` = {$account['id']}
LIMIT 1;
");
} else {
@ -197,7 +197,7 @@ if ($auction['characterAuction']) {
}
}
// See a specific character in auction,
// See a specific character in auction,
// silently fallback to list if he doesn't exist or is already sold
if ($action === 'view') { // View a character in the auction
if (!isset($zaid)) {
@ -206,7 +206,7 @@ if ($auction['characterAuction']) {
if ($zaid !== false) {
// Retrieve basic character information
$character = mysql_select_single("
SELECT
SELECT
`za`.`id` AS `zaid`,
`za`.`player_id`,
`za`.`original_account_id`,
@ -214,33 +214,33 @@ if ($auction['characterAuction']) {
`za`.`time_begin`,
`za`.`time_end`,
CASE WHEN `za`.`price` > `za`.`bid`
THEN `za`.`price`
THEN `za`.`price`
ELSE `za`.`bid`+{$step}
END AS `price`,
CASE WHEN `za`.`original_account_id` = {$this_account_id}
CASE WHEN `za`.`original_account_id` = {$this_account_id}
THEN 1
ELSE 0
END AS `own`,
CASE WHEN `za`.`original_account_id` = {$this_account_id}
CASE WHEN `za`.`original_account_id` = {$this_account_id}
THEN `p`.`name`
ELSE ''
END AS `name`,
CASE WHEN `za`.`original_account_id` = {$this_account_id}
CASE WHEN `za`.`original_account_id` = {$this_account_id}
THEN `za`.`bid`
ELSE 0
END AS `bid`,
CASE WHEN `za`.`original_account_id` = {$this_account_id}
CASE WHEN `za`.`original_account_id` = {$this_account_id}
THEN `za`.`deposit`
ELSE 0
END AS `deposit`,
`p`.`vocation`,
`p`.`level`,
`p`.`balance`,
`p`.`lookbody` AS `body`,
`p`.`lookfeet` AS `feet`,
`p`.`lookhead` AS `head`,
`p`.`looklegs` AS `legs`,
`p`.`looktype` AS `type`,
`p`.`vocation`,
`p`.`level`,
`p`.`balance`,
`p`.`lookbody` AS `body`,
`p`.`lookfeet` AS `feet`,
`p`.`lookhead` AS `head`,
`p`.`looklegs` AS `legs`,
`p`.`looktype` AS `type`,
`p`.`lookaddons` AS `addons`,
`p`.`maglevel` AS `magic`,
`p`.`skill_fist` AS `fist`,
@ -277,9 +277,9 @@ if ($auction['characterAuction']) {
ORDER BY MIN(`pid`) ASC
");
$account = mysql_select_single("
SELECT `points`
FROM `znote_accounts`
WHERE `account_id`={$this_account_id}
SELECT `points`
FROM `znote_accounts`
WHERE `account_id` = {$this_account_id}
AND `points` >= {$character['price']}
LIMIT 1;
");
@ -448,11 +448,11 @@ if ($auction['characterAuction']) {
if ($pid > 0 && $cost >= $auction['lowestPrice']) {
$account = mysql_select_single("
SELECT `a`.`id`, `a`.`password`, `za`.`points`
FROM `accounts` a
FROM `accounts` a
INNER JOIN `znote_accounts` za
ON `a`.`id` = `za`.`account_id`
WHERE `a`.`id`= {$this_account_id}
AND `a`.`password`='{$password}'
WHERE `a`.`id`= {$this_account_id}
AND `a`.`password`='{$password}'
AND `za`.`points` >= {$deposit}
LIMIT 1
;");
@ -460,34 +460,34 @@ if ($auction['characterAuction']) {
// Check if player exist, is offline and not already in auction
// And is not a tutor or a GM+.
$player = mysql_select_single("
SELECT `p`.`id`, `p`.`name`,
CASE
WHEN `po`.`player_id` IS NULL
SELECT `p`.`id`, `p`.`name`,
CASE
WHEN `po`.`player_id` IS NULL
THEN 0
ELSE 1
END AS `online`,
CASE
WHEN `za`.`player_id` IS NULL
CASE
WHEN `za`.`player_id` IS NULL
THEN 0
ELSE 1
END AS `alreadyInAuction`
FROM `players` p
LEFT JOIN `players_online` po
FROM `players` p
LEFT JOIN `players_online` po
ON `p`.`id` = `po`.`player_id`
LEFT JOIN `znote_auction_player` za
ON `p`.`id` = `za`.`player_id`
AND `p`.`account_id` = `za`.`original_account_id`
LEFT JOIN `znote_auction_player` za
ON `p`.`id` = `za`.`player_id`
AND `p`.`account_id` = `za`.`original_account_id`
AND `za`.`claimed` = 0
WHERE `p`.`id` = {$pid}
AND `p`.`account_id` = {$this_account_id}
AND `p`.`account_id` = {$this_account_id}
AND `p`.`group_id` = 1
LIMIT 1
;");
// Verify storage account ID exist
$storage_account = mysql_select_single("
SELECT `id`
FROM `accounts`
WHERE `id`={$auction['storage_account_id']}
SELECT `id`
FROM `accounts`
WHERE `id`={$auction['storage_account_id']}
LIMIT 1;
");
if ($storage_account === false) {
@ -534,22 +534,22 @@ if ($auction['characterAuction']) {
mysql_update("
UPDATE `players`
SET `account_id` = {$auction['storage_account_id']}
WHERE `id` = {$pid}
WHERE `id` = {$pid}
LIMIT 1;
");
// Hide character from public character list (in pidprofile.php)
mysql_update("
UPDATE `znote_players`
SET `hide_char` = 1
WHERE `player_id` = {$pid}
SET `hide_char` = 1
WHERE `player_id` = {$pid}
LIMIT 1;
");
// Remove deposit from account
$afterDeposit = $account['points'] - $deposit;
mysql_update("
UPDATE `znote_accounts`
SET `points` = {$afterDeposit}
WHERE `account_id` = {$account['id']}
SET `points` = {$afterDeposit}
WHERE `account_id` = {$account['id']}
LIMIT 1;
");
}
@ -565,7 +565,7 @@ if ($auction['characterAuction']) {
$time = time();
// If original account is the one trying to get it back,
// and bidding period is over,
// and its not labelled as sold
// and its not labeled as sold
// and nobody has bid on it
$character = mysql_select_single("
SELECT `player_id`
@ -573,9 +573,9 @@ if ($auction['characterAuction']) {
WHERE `id`= {$zaid}
AND `original_account_id` = {$this_account_id}
AND `time_end` <= {$time}
AND `bidder_account_id` = 0
AND `bidder_account_id` = 0
AND `bid` = 0
AND `sold` = 0
AND `sold` = 0
LIMIT 1
");
//data_dump($character, false, "Character");
@ -583,22 +583,22 @@ if ($auction['characterAuction']) {
// Move character to buyer account and give it a new name
mysql_update("
UPDATE `players`
SET `account_id` = {$this_account_id}
WHERE `id` = {$character['player_id']}
SET `account_id` = {$this_account_id}
WHERE `id` = {$character['player_id']}
LIMIT 1;
");
// Set label to sold
mysql_update("
UPDATE `znote_auction_player`
SET `sold` = 1
WHERE `id`= {$zaid}
SET `sold` = 1
WHERE `id`= {$zaid}
LIMIT 1;
");
// Show character in public character list (in characterprofile.php)
mysql_update("
UPDATE `znote_players`
SET `hide_char` = 0
WHERE `player_id` = {$character['player_id']}
SET `hide_char` = 0
WHERE `player_id` = {$character['player_id']}
LIMIT 1;
");
}
@ -650,56 +650,56 @@ if ($auction['characterAuction']) {
// end name validation
if (empty($errors)) {
// Make sure you have access to claim this zaid character.
// And that you havent already claimed it.
// And that you haven't already claimed it.
// And that the character isn't online...
$character = mysql_select_single("
SELECT
SELECT
`za`.`id` AS `zaid`,
`za`.`player_id`,
`p`.`account_id`
`p`.`account_id`
FROM `znote_auction_player` za
INNER JOIN `players` p
INNER JOIN `players` p
ON `za`.`player_id` = `p`.`id`
LEFT JOIN `players_online` po
ON `p`.`id` = `po`.`player_id`
WHERE `za`.`id` = {$zaid}
AND `za`.`sold` = 1
AND `p`.`account_id` != {$this_account_id}
AND `za`.`bidder_account_id` = {$this_account_id}
AND `po`.`player_id` IS NULL
AND `p`.`account_id` != {$this_account_id}
AND `za`.`bidder_account_id` = {$this_account_id}
AND `po`.`player_id` IS NULL
");
//data_dump($character, false, "Character");
if ($character !== false) {
// Set character to claimed
mysql_update("
UPDATE `znote_auction_player`
SET `claimed`='1'
WHERE `id` = {$character['zaid']}
UPDATE `znote_auction_player`
SET `claimed`='1'
WHERE `id` = {$character['zaid']}
");
// Move character to buyer account and give it a new name
mysql_update("
UPDATE `players`
SET `name` = '{$name}',
`account_id` = {$this_account_id}
WHERE `id` = {$character['player_id']}
`account_id` = {$this_account_id}
WHERE `id` = {$character['player_id']}
LIMIT 1;
");
// Show character in public character list (in characterprofile.php)
mysql_update("
UPDATE `znote_players`
SET `hide_char` = 0
WHERE `player_id` = {$character['player_id']}
SET `hide_char` = 0
WHERE `player_id` = {$character['player_id']}
LIMIT 1;
");
// Remove character from other players VIP lists
mysql_delete("
DELETE FROM `account_viplist`
WHERE `player_id` = {$character['player_id']}
DELETE FROM `account_viplist`
WHERE `player_id` = {$character['player_id']}
");
// Remove the character deathlist
mysql_delete("
DELETE FROM `player_deaths`
WHERE `player_id` = {$character['player_id']}
DELETE FROM `player_deaths`
WHERE `player_id` = {$character['player_id']}
");
} else {
$errors[] = "You either don't have access to claim this character, or you have already claimed it, or this character isn't sold yet, or we were unable to find this auction order.";
@ -715,7 +715,7 @@ if ($auction['characterAuction']) {
<table class="auction_error">
<tr class="yellow">
<td>#</td>
<td>Issues occured while claiming your name</td>
<td>Issues occurred while claiming your name</td>
</tr>
<?php foreach($errors as $i => $error): ?>
<tr>
@ -734,28 +734,28 @@ if ($auction['characterAuction']) {
// If this account have successfully bought or won an auction
// Intercept the list action and let the user do claim actions
$pending = mysql_select_multi("
SELECT
`za`.`id` AS `zaid`,
CASE WHEN `za`.`price` > `za`.`bid`
THEN `za`.`price`
ELSE `za`.`bid`
SELECT
`za`.`id` AS `zaid`,
CASE WHEN `za`.`price` > `za`.`bid`
THEN `za`.`price`
ELSE `za`.`bid`
END AS `price`,
`za`.`time_begin`,
`za`.`time_end`,
`p`.`vocation`,
`p`.`level`,
`p`.`lookbody` AS `body`,
`p`.`lookfeet` AS `feet`,
`p`.`lookhead` AS `head`,
`p`.`looklegs` AS `legs`,
`p`.`looktype` AS `type`,
`p`.`vocation`,
`p`.`level`,
`p`.`lookbody` AS `body`,
`p`.`lookfeet` AS `feet`,
`p`.`lookhead` AS `head`,
`p`.`looklegs` AS `legs`,
`p`.`looktype` AS `type`,
`p`.`lookaddons` AS `addons`
FROM `znote_auction_player` za
FROM `znote_auction_player` za
INNER JOIN `players` p
ON `za`.`player_id` = `p`.`id`
WHERE `p`.`account_id` = {$auction['storage_account_id']}
WHERE `p`.`account_id` = {$auction['storage_account_id']}
AND `za`.`claimed` = 0
AND `za`.`sold` = 1
AND `za`.`sold` = 1
AND `za`.`bidder_account_id` = {$this_account_id}
ORDER BY `p`.`level` desc
");
@ -803,25 +803,25 @@ if ($auction['characterAuction']) {
// Show the list
$characters = mysql_select_multi("
SELECT
`za`.`id` AS `zaid`,
CASE WHEN `za`.`price` > `za`.`bid`
`za`.`id` AS `zaid`,
CASE WHEN `za`.`price` > `za`.`bid`
THEN `za`.`price`
ELSE `za`.`bid`+{$step}
ELSE `za`.`bid`+{$step}
END AS `price`,
`za`.`time_begin`,
`za`.`time_end`,
`p`.`vocation`,
`p`.`level`,
`p`.`lookbody` AS `body`,
`p`.`lookfeet` AS `feet`,
`p`.`lookhead` AS `head`,
`p`.`looklegs` AS `legs`,
`p`.`looktype` AS `type`,
`p`.`vocation`,
`p`.`level`,
`p`.`lookbody` AS `body`,
`p`.`lookfeet` AS `feet`,
`p`.`lookhead` AS `head`,
`p`.`looklegs` AS `legs`,
`p`.`looktype` AS `type`,
`p`.`lookaddons` AS `addons`
FROM `znote_auction_player` za
FROM `znote_auction_player` za
INNER JOIN `players` p
ON `za`.`player_id` = `p`.`id`
WHERE `p`.`account_id` = {$auction['storage_account_id']}
WHERE `p`.`account_id` = {$auction['storage_account_id']}
AND `za`.`sold` = 0
ORDER BY `p`.`level` desc;
");
@ -831,7 +831,7 @@ if ($auction['characterAuction']) {
<p>Admin: <a href="/admin_auction.php">Character auction history</a></p>
<?php
}
if (is_array($characters) && !empty($characters)):
if (is_array($characters) && !empty($characters)):
?>
<table class="auction_char">
<tr class="yellow">
@ -875,20 +875,20 @@ if ($auction['characterAuction']) {
$minToCreate = (int)ceil(($auction['lowestPrice'] / 100) * $auction['deposit']);
$own_characters = mysql_select_multi("
SELECT
`p`.`id`,
`p`.`name`,
`p`.`level`,
`p`.`vocation`,
`a`.`points`
FROM `players` p
`p`.`id`,
`p`.`name`,
`p`.`level`,
`p`.`vocation`,
`a`.`points`
FROM `players` p
INNER JOIN `znote_accounts` a
ON `p`.`account_id` = `a`.`account_id`
LEFT JOIN `znote_auction_player` za
ON `p`.`id` = `za`.`player_id`
AND `p`.`account_id` = `za`.`original_account_id`
LEFT JOIN `znote_auction_player` za
ON `p`.`id` = `za`.`player_id`
AND `p`.`account_id` = `za`.`original_account_id`
AND `za`.`claimed` = 0
LEFT JOIN `players_online` po
ON `p`.`id` = `po`.`player_id`
LEFT JOIN `players_online` po
ON `p`.`id` = `po`.`player_id`
WHERE `p`.`account_id`={$this_account_id}
AND `za`.`player_id` IS NULL
AND `po`.`player_id` IS NULL
@ -905,7 +905,7 @@ if ($auction['characterAuction']) {
<input type="hidden" name="action" value="add">
<p>Character: (Must be offline)</p>
<select name="pid">
<?php if(is_array($own_characters) && !empty($own_characters))
<?php if(is_array($own_characters) && !empty($own_characters))
foreach($own_characters as $char): ?>
<option value="<?php echo $char['id']; ?>">
<?php echo "Level: ", $char['level'], " ", vocation_id_to_name($char['vocation']), ": ", $char['name']; ?>
@ -944,4 +944,4 @@ if ($auction['characterAuction']) {
}
}
} else echo "<p>Character shop auctioning system is disabled.</p>";
include 'layout/overall/footer.php'; ?>
include 'layout/overall/footer.php'; ?>

View File

@ -1,5 +1,5 @@
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
if ($config['log_ip']) {
znote_visitor_insert_detailed_data(4);
}
@ -323,7 +323,7 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
<div class="inventory_outfit">
<img src="<?php echo $config['show_outfits']['imageServer']; ?>?id=<?php echo $profile_data['looktype']; ?>&addons=<?php echo $profile_data['lookaddons']; ?>&head=<?php echo $profile_data['lookhead']; ?>&body=<?php echo $profile_data['lookbody']; ?>&legs=<?php echo $profile_data['looklegs']; ?>&feet=<?php echo $profile_data['lookfeet']; ?>" alt="img">
</div>
<?php endif; ?>
<?php endif; ?>
</div>
<?php endif; ?>
@ -456,15 +456,15 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
border-radius: 3px;
}
#piv_flex .itm { background-image: url("/engine/img/bg.png"); }
#piv_flex .itm-1 { left: 48px; top: 39px; }
#piv_flex .itm-2 { left: 11px; top: 53px; }
#piv_flex .itm-3 { left: 85px; top: 53px; }
#piv_flex .itm-4 { left: 48px; top: 76px; }
#piv_flex .itm-5 { left: 85px; top: 90px; }
#piv_flex .itm-6 { left: 11px; top: 90px; }
#piv_flex .itm-7 { left: 48px; top: 113px; }
#piv_flex .itm-8 { left: 48px; top: 150px; }
#piv_flex .itm-9 { left: 11px; top: 127px; }
#piv_flex .itm-1 { left: 48px; top: 39px; }
#piv_flex .itm-2 { left: 11px; top: 53px; }
#piv_flex .itm-3 { left: 85px; top: 53px; }
#piv_flex .itm-4 { left: 48px; top: 76px; }
#piv_flex .itm-5 { left: 85px; top: 90px; }
#piv_flex .itm-6 { left: 11px; top: 90px; }
#piv_flex .itm-7 { left: 48px; top: 113px; }
#piv_flex .itm-8 { left: 48px; top: 150px; }
#piv_flex .itm-9 { left: 11px; top: 127px; }
#piv_flex .itm-10 { left: 85px; top: 127px; }
#piv_cap {
position: absolute;
@ -589,24 +589,24 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
/* Outfit column positions */
<?php for ($column = 1; $column <= $outfit_columns; $column++): ?>
#piv_o_container .o:nth-child(<?php echo $outfit_columns.'n+'.$column;?>) { right: <?php echo 10 + 40 * ($outfit_columns-$column); ?>px; }
#piv_o_container .o:nth-child(<?php echo $outfit_columns.'n+'.$column;?>) { right: <?php echo 10 + 40 * ($outfit_columns-$column); ?>px; }
<?php endfor; ?>
/* Outfit row positions */
<?php for ($row = 1; $row <= $outfit_rows; $row++): ?>
#piv_o_container .o:nth-child(n+<?php echo $outfit_columns * ($row-1)+1; ?>):nth-child(-n+<?php echo $outfit_columns*$row; ?>) { bottom: <?php echo 10 + 33 * ($outfit_rows-$row); ?>px; }
#piv_o_container .o:nth-child(n+<?php echo $outfit_columns * ($row-1)+1; ?>):nth-child(-n+<?php echo $outfit_columns*$row; ?>) { bottom: <?php echo 10 + 33 * ($outfit_rows-$row); ?>px; }
<?php endfor; ?>
#piv_o_container .o.grayimg {
filter: none;
-webkit-filter: grayscale(100%);
-moz-filter: grayscale(100%);
-ms-filter: grayscale(100%);
-o-filter: grayscale(100%);
opacity: .5;
filter: alpha(opacity=50);
margin-left: -25pt;
margin-top: -25px;
filter: none;
-webkit-filter: grayscale(100%);
-moz-filter: grayscale(100%);
-ms-filter: grayscale(100%);
-o-filter: grayscale(100%);
opacity: .5;
filter: alpha(opacity=50);
margin-left: -25pt;
margin-top: -25px;
}
</style>
</td>
@ -650,7 +650,7 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
<!-- <div id="accordion">
<h3>Show/hide player achievements</h3>
<div>
</div>
</div><br> -->
<input type="checkbox" id="ac_toggle_hide" name="ac_toggle_hide">
@ -743,9 +743,9 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
$mostdmg = ($d['mostdamage_is_player'])
? "<a href='characterprofile.php?name=".$d['mostdamage_by']."'>".$d['mostdamage_by']."</a>"
: $d['mostdamage_by'];
echo "<br>and by $mostdmg.";
if ($d['mostdamage_unjustified']) {
echo " <font color='red' style='font-style: italic;'>(unjustified)</font>";
}
@ -824,15 +824,15 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
?>
</tbody>
</table>
<!-- QUEST PROGRESSION -->
<?php
$totalquests = 0;
$completedquests = 0;
$firstrun = 1;
if ($config['EnableQuests'] == true) {
$sqlquests = mysql_select_multi("
$sqlquests = mysql_select_multi("
SELECT `player_id`, `key`, `value`
FROM player_storage
WHERE `player_id` = {$user_id}
@ -941,4 +941,4 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
} else {
header('Location: index.php');
}
include 'layout/overall/footer.php'; ?>
include 'layout/overall/footer.php'; ?>

View File

@ -14,10 +14,10 @@ if(!function_exists('curl_version')):
// CURL enabled. Lets create an API web request to github.
$request = curl_init();
curl_setopt($request, CURLOPT_URL, 'https://api.github.com/repos/Znote/ZnoteAAC/contributors');
curl_setopt($request, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($request, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($request, CURLOPT_USERAGENT, 'ZnoteAAC'); // GitHub requires user agent header.
curl_setopt($request, CURLOPT_SSL_VERIFYPEER, false);
// Load contributors and close the request.
$developers = json_decode(curl_exec($request), true); // Sorted by contributions.
curl_close($request);
@ -83,4 +83,4 @@ endif;
text-align: center;
}
</style>
<?php include 'layout/overall/footer.php'; ?>
<?php include 'layout/overall/footer.php'; ?>

View File

@ -3,14 +3,14 @@ $time = time();
if (!isset($version)) $version = '1.5_SVN';
if (!function_exists("elapsedTime")) {
function elapsedTime($l_start = false, $l_time = false) {
if ($l_start === false) global $l_start;
if ($l_time === false) global $l_time;
$l_time = explode(' ', microtime());
$l_finish = $l_time[1] + $l_time[0];
return round(($l_finish - $l_start), 4);
}
function elapsedTime($l_start = false, $l_time = false) {
if ($l_start === false) global $l_start;
if ($l_time === false) global $l_time;
$l_time = explode(' ', microtime());
$l_finish = $l_time[1] + $l_time[0];
return round(($l_finish - $l_start), 4);
}
}
// ALTER TABLE `znote_accounts` ADD `active_email` TINYINT(4) NOT NULL DEFAULT '0' AFTER `active`;
@ -35,39 +35,40 @@ $install = "
$connect = new mysqli($config['sqlHost'], $config['sqlUser'], $config['sqlPassword'], $config['sqlDatabase']);
if ($connect->connect_errno) {
die("Failed to connect to MySQL: (" . $connect->connect_errno . ") " . $connect->connect_error . $install);
die("Failed to connect to MySQL: (" . $connect->connect_errno . ") " . $connect->connect_error . $install);
}
function mysql_znote_escape_string($escapestr) {
global $connect;
return mysqli_real_escape_string($connect, $escapestr);
global $connect;
return mysqli_real_escape_string($connect, $escapestr);
}
// Select single row from database
function mysql_select_single($query) {
global $connect;
global $aacQueries;
$aacQueries++;
global $connect;
global $aacQueries;
$aacQueries++;
global $accQueriesData;
$accQueriesData[] = "[" . elapsedTime() . "] " . $query;
$result = mysqli_query($connect,$query) or die(var_dump($query)."<br>(query - <font color='red'>SQL error</font>) <br>Type: <b>select_single</b> (select single row from database)<br><br>".mysqli_error($connect));
$row = mysqli_fetch_assoc($result);
return !empty($row) ? $row : false;
global $accQueriesData;
$accQueriesData[] = "[" . elapsedTime() . "] " . $query;
$result = mysqli_query($connect,$query) or die(var_dump($query)."<br>(query - <font color='red'>SQL error</font>) <br>Type: <b>select_single</b> (select single row from database)<br><br>".mysqli_error($connect));
$row = mysqli_fetch_assoc($result);
return !empty($row) ? $row : false;
}
// Selecting multiple rows from database.
function mysql_select_multi($query){
global $connect;
global $aacQueries;
$aacQueries++;
global $accQueriesData;
$accQueriesData[] = "[" . elapsedTime() . "] " . $query;
$array = array();
$results = mysqli_query($connect,$query) or die(var_dump($query)."<br>(query - <font color='red'>SQL error</font>) <br>Type: <b>select_multi</b> (select multiple rows from database)<br><br>".mysqli_error($connect));
while($row = mysqli_fetch_assoc($results)) {
$array[] = $row;
}
return !empty($array) ? $array : false;
global $connect;
global $aacQueries;
$aacQueries++;
global $accQueriesData;
$accQueriesData[] = "[" . elapsedTime() . "] " . $query;
$array = array();
$results = mysqli_query($connect,$query) or die(var_dump($query)."<br>(query - <font color='red'>SQL error</font>) <br>Type: <b>select_multi</b> (select multiple rows from database)<br><br>".mysqli_error($connect));
while($row = mysqli_fetch_assoc($results)) {
$array[] = $row;
}
return !empty($array) ? $array : false;
}
//////
@ -81,11 +82,11 @@ function mysql_insert($query){ voidQuery($query); }
function mysql_delete($query){ voidQuery($query); }
// Send a void query
function voidQuery($query) {
global $connect;
global $aacQueries;
$aacQueries++;
global $accQueriesData;
$accQueriesData[] = "[" . elapsedTime() . "] " . $query;
mysqli_query($connect,$query) or die(var_dump($query)."<br>(query - <font color='red'>SQL error</font>) <br>Type: <b>voidQuery</b> (voidQuery is used for update, insert or delete from database)<br><br>".mysqli_error($connect));
global $connect;
global $aacQueries;
$aacQueries++;
global $accQueriesData;
$accQueriesData[] = "[" . elapsedTime() . "] " . $query;
mysqli_query($connect,$query) or die(var_dump($query)."<br>(query - <font color='red'>SQL error</font>) <br>Type: <b>voidQuery</b> (voidQuery is used for update, insert or delete from database)<br><br>".mysqli_error($connect));
}
?>
?>

View File

@ -89,10 +89,10 @@ class Mail {
//send the message, check for errors
$status = false;
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
exit();
echo "Mailer Error: " . $mail->ErrorInfo;
exit();
} else {
$status = true;
$status = true;
}
return $status;
}

View File

@ -58,13 +58,13 @@ function fetchLatestDeaths_03($rowz = 30, $killers = false) {
$countz = 0;
if ($rowz === false || $killers === true) $getdeaths = mysql_select_multi("SELECT * FROM player_deaths ORDER BY date DESC;");
else $getdeaths = mysql_select_multi("SELECT * FROM `player_deaths` ORDER BY `date` DESC LIMIT 0, $rowz;");
$data = false;
$data = false;
//while ($showdeaths = mysql_fetch_assoc($getdeaths)) {
if ($getdeaths !== false) {
for ($i = 0; $i < count($getdeaths); $i++) {
$pid = $getdeaths[$i]['player_id'];
$level = $getdeaths[$i]['level'];
$kid = user_get_kid($getdeaths[$i]['id']);
if ($getdeaths !== false) {
for ($i = 0; $i < count($getdeaths); $i++) {
$pid = $getdeaths[$i]['player_id'];
$level = $getdeaths[$i]['level'];
$kid = user_get_kid($getdeaths[$i]['id']);
$killedby = user_name(user_get_killer_id($kid));
@ -78,7 +78,7 @@ function fetchLatestDeaths_03($rowz = 30, $killers = false) {
$player = 2;
$killedby = "Deleted player.";
}
$getname = mysql_select_single("SELECT `name` FROM `players` WHERE `id` = '$pid' LIMIT 1;");
$getname = mysql_select_single("SELECT `name` FROM `players` WHERE `id` = '$pid' LIMIT 1;");
$name = $getname['name'];
$row = array();
$row['level'] = $level;
@ -98,47 +98,47 @@ function fetchLatestDeaths_03($rowz = 30, $killers = false) {
}
}
} else $data[] = $row;
}
}
}
}
return $data;
}
// Support list
function support_list() {
$TFS = Config('ServerEngine');
$TFS = Config('ServerEngine');
if ($TFS == 'TFS_10') $staffs = mysql_select_multi("SELECT `p`.`id`, `a`.`type` as `group_id`, `p`.`name`, `p`.`account_id` FROM `players` AS `p` INNER JOIN `accounts` AS `a` ON `p`.`account_id` = `a`.`id` WHERE `a`.`type` > 1 ORDER BY `p`.`account_id` DESC, `p`.`group_id` ASC, `p`.`level` ASC;");
else $staffs = mysql_select_multi("SELECT `a`.`type` as `group_id`, `p`.`name`, `p`.`online`, `p`.`account_id` FROM `players` AS `p` INNER JOIN `accounts` AS `a` ON `a`.`id` = `p`.`account_id` WHERE `a`.`type` > 1 ORDER BY `p`.`account_id` DESC, `p`.`group_id` ASC, `p`.`level` ASC;");
if ($TFS == 'TFS_10') $staffs = mysql_select_multi("SELECT `p`.`id`, `a`.`type` as `group_id`, `p`.`name`, `p`.`account_id` FROM `players` AS `p` INNER JOIN `accounts` AS `a` ON `p`.`account_id` = `a`.`id` WHERE `a`.`type` > 1 ORDER BY `p`.`account_id` DESC, `p`.`group_id` ASC, `p`.`level` ASC;");
else $staffs = mysql_select_multi("SELECT `a`.`type` as `group_id`, `p`.`name`, `p`.`online`, `p`.`account_id` FROM `players` AS `p` INNER JOIN `accounts` AS `a` ON `a`.`id` = `p`.`account_id` WHERE `a`.`type` > 1 ORDER BY `p`.`account_id` DESC, `p`.`group_id` ASC, `p`.`level` ASC;");
foreach($staffs as $k => $v) {
foreach($staffs as $key => $value) {
if($k != $key && $v['account_id'] == $value['account_id']) {
unset($staffs[$k]);
}
}
}
$staffs = array_values($staffs);
foreach($staffs as $k => $v) {
foreach($staffs as $key => $value) {
if($k != $key && $v['account_id'] == $value['account_id']) {
unset($staffs[$k]);
}
}
}
$staffs = array_values($staffs);
if ($staffs !== false && $TFS == 'TFS_10') {
for ($i = 0; $i < count($staffs); $i++) {
// Fix online status on TFS 1.0
$staffs[$i]['online'] = (isset($staffs[$i]['id']) && user_is_online_10($staffs[$i]['id'])) ? 1 : 0;
unset($staffs[$i]['id']);
}
}
return $staffs;
if ($staffs !== false && $TFS == 'TFS_10') {
for ($i = 0; $i < count($staffs); $i++) {
// Fix online status on TFS 1.0
$staffs[$i]['online'] = (isset($staffs[$i]['id']) && user_is_online_10($staffs[$i]['id'])) ? 1 : 0;
unset($staffs[$i]['id']);
}
}
return $staffs;
}
function support_list03() {
$staffs = mysql_select_multi("SELECT `group_id`, `name`, `online`, `account_id` FROM `players` WHERE `group_id` > 1 ORDER BY `group_id` ASC;");
$staffs = mysql_select_multi("SELECT `group_id`, `name`, `online`, `account_id` FROM `players` WHERE `group_id` > 1 ORDER BY `group_id` ASC;");
if ($staffs !== false) {
for ($i = 0; $i < count($staffs); $i++) {
// $staffs[$i]['']
unset($staffs[$i]['account_id']);
}
}
return $staffs;
if ($staffs !== false) {
for ($i = 0; $i < count($staffs); $i++) {
// $staffs[$i]['']
unset($staffs[$i]['account_id']);
}
}
return $staffs;
}
// NEWS
@ -430,23 +430,22 @@ function update_player_guild_position_10($cid, $rid) {
// Update player's guild nick
function update_player_guildnick($cid, $nick) {
$cid = (int)$cid;
$nick = sanitize($nick);
if (!empty($nick)) {
mysql_update("UPDATE `players` SET `guildnick`='$nick' WHERE `id`=$cid");
} else {
mysql_update("UPDATE `players` SET `guildnick`='' WHERE `id`=$cid");
}
$cid = (int)$cid;
$nick = sanitize($nick);
if (!empty($nick)) {
mysql_update("UPDATE `players` SET `guildnick`='$nick' WHERE `id`=$cid");
} else {
mysql_update("UPDATE `players` SET `guildnick`='' WHERE `id`=$cid");
}
}
function update_player_guildnick_10($cid, $nick) {
$cid = (int)$cid;
$nick = sanitize($nick);
if (!empty($nick)) {
mysql_update("UPDATE `guild_membership` SET `nick`='$nick' WHERE `player_id`=$cid");
} else {
mysql_update("UPDATE `guild_membership` SET `nick`='' WHERE `player_id`=$cid");
}
$cid = (int)$cid;
$nick = sanitize($nick);
if (!empty($nick)) {
mysql_update("UPDATE `guild_membership` SET `nick`='$nick' WHERE `player_id`=$cid");
} else {
mysql_update("UPDATE `guild_membership` SET `nick`='' WHERE `player_id`=$cid");
}
}
// Get guild data, using guild id.
@ -554,9 +553,9 @@ function get_guilds_list() {
// Get array of player data related to a guild.
function get_guild_players($gid) {
$gid = (int)$gid; // Sanitizing the parameter id
if (config('ServerEngine') !== 'TFS_10') return mysql_select_multi("SELECT `p`.`id`, `p`.`rank_id`, `p`.`name`, `p`.`level`, `p`.`guildnick`, `p`.`vocation`, `p`.`online`, `gr`.`name` AS `rank_name`, `gr`.`level` AS `rank_level` FROM `players` AS `p` LEFT JOIN `guild_ranks` AS `gr` ON `gr`.`id` = `p`.`rank_id` WHERE `gr`.`guild_id` ='$gid' ORDER BY `gr`.`id`, `p`.`name`;");
else return mysql_select_multi("SELECT `p`.`id`, `p`.`name`, `p`.`level`, `p`.`vocation`, `gm`.`rank_id`, `gm`.`nick` AS `guildnick`, `gr`.`name` AS `rank_name`, `gr`.`level` AS `rank_level` FROM `players` AS `p` LEFT JOIN `guild_membership` AS `gm` ON `gm`.`player_id` = `p`.`id` LEFT JOIN `guild_ranks` AS `gr` ON `gr`.`id` = `gm`.`rank_id` WHERE `gm`.`guild_id` = '$gid' ORDER BY `gm`.`rank_id`, `p`.`name`");
$gid = (int)$gid; // Sanitizing the parameter id
if (config('ServerEngine') !== 'TFS_10') return mysql_select_multi("SELECT `p`.`id`, `p`.`rank_id`, `p`.`name`, `p`.`level`, `p`.`guildnick`, `p`.`vocation`, `p`.`online`, `gr`.`name` AS `rank_name`, `gr`.`level` AS `rank_level` FROM `players` AS `p` LEFT JOIN `guild_ranks` AS `gr` ON `gr`.`id` = `p`.`rank_id` WHERE `gr`.`guild_id` ='$gid' ORDER BY `gr`.`id`, `p`.`name`;");
else return mysql_select_multi("SELECT `p`.`id`, `p`.`name`, `p`.`level`, `p`.`vocation`, `gm`.`rank_id`, `gm`.`nick` AS `guildnick`, `gr`.`name` AS `rank_name`, `gr`.`level` AS `rank_level` FROM `players` AS `p` LEFT JOIN `guild_membership` AS `gm` ON `gm`.`player_id` = `p`.`id` LEFT JOIN `guild_ranks` AS `gr` ON `gr`.`id` = `gm`.`rank_id` WHERE `gm`.`guild_id` = '$gid' ORDER BY `gm`.`rank_id`, `p`.`name`");
}
// Get guild level data (avg level, total level, count of players)
@ -660,20 +659,20 @@ function gesior_sql_killer($did) {
// ADMIN FUNCTIONS
function set_ingame_position($name, $acctype) {
$acctype = (int)$acctype;
$name = sanitize($name);
$acctype = (int)$acctype;
$name = sanitize($name);
$acc_id = user_character_account_id($name);
$char_id = user_character_id($name);
$acc_id = user_character_account_id($name);
$char_id = user_character_id($name);
$group_id = 1;
if ($acctype == 4) {
$group_id = 2;
} elseif ($acctype >= 5) {
$group_id = 3;
}
mysql_update("UPDATE `accounts` SET `type` = '$acctype' WHERE `id` =$acc_id;");
mysql_update("UPDATE `players` SET `group_id` = '$group_id' WHERE `id` =$char_id;");
$group_id = 1;
if ($acctype == 4) {
$group_id = 2;
} elseif ($acctype >= 5) {
$group_id = 3;
}
mysql_update("UPDATE `accounts` SET `type` = '$acctype' WHERE `id` =$acc_id;");
mysql_update("UPDATE `players` SET `group_id` = '$group_id' WHERE `id` =$char_id;");
}
// .3
@ -1290,11 +1289,11 @@ function user_create_character($character_data) {
// This is TFS 0.2 compatible import data with Znote AAC mysql schema
if (config('ServerEngine') !== 'OTHIRE') {
$import_data = array(
'name' => $character_data['name'],
'name' => $character_data['name'],
'group_id' => 1,
'account_id' => $character_data['account_id'],
'level' => $create['level'],
'vocation' => $vocation,
'vocation' => $vocation,
'health' => $health,
'healthmax' => $health,
'experience' => level_to_experience($create['level']),
@ -1335,11 +1334,11 @@ function user_create_character($character_data) {
);
} else {
$import_data = array(
'name' => $character_data['name'],
'name' => $character_data['name'],
'group_id' => 1,
'account_id' => $character_data['account_id'],
'level' => $create['level'],
'vocation' => $vocation,
'vocation' => $vocation,
'health' => $health,
'healthmax' => $health,
'experience' => level_to_experience($create['level']),
@ -1590,10 +1589,10 @@ function user_exist($username) {
}
function user_name($id) { //USERNAME FROM PLAYER ID
$id = (int)$id;
$name = mysql_select_single("SELECT `name` FROM `players` WHERE `id`='$id';");
if ($name !== false) return $name['name'];
else return false;
$id = (int)$id;
$name = mysql_select_single("SELECT `name` FROM `players` WHERE `id`='$id';");
if ($name !== false) return $name['name'];
else return false;
}
// Checks that character name exist

View File

@ -699,7 +699,7 @@ if ($highest_access >= 2) {
</ul>
</form>
<?php if ($config['guild_allow_nicknames']): ?>
<!-- FORMS TO CHANGE GUILD NICK -->
<!-- FORMS TO CHANGE GUILD NICK -->
<form action="" method="post">
<ul>
<li>

View File

@ -1,14 +1,14 @@
<!DOCTYPE HTML>
<html>
<?php
<?php
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$start = $time;
include 'layout/head.php'; ?>
<body<?php if (isset($page_filename) && strlen($page_filename) > 0) echo " class='page_{$page_filename}'"; ?>>
<div id="main">
<?php include 'layout/header.php'; ?>
<div id="site_content">
<?php include 'layout/aside.php'; ?>
<div class="content">
<div id="main">
<?php include 'layout/header.php'; ?>
<div id="site_content">
<?php include 'layout/aside.php'; ?>
<div class="content">

View File

@ -1,100 +1,100 @@
<?php require_once 'engine/init.php'; include 'layout/overall/header.php'; ?>
<?php
###### MONSTER LOOT CHECKER ######
###### VERSION: 1.5
###### MONSTER LOOT CHECKER ######
###### VERSION: 1.5
$otdir = 'misc/';
$otdir = 'misc/';
// In percent (highest first).
$rarity = array(
'Not Rare' => 7,
'Semi Rare' => 2,
'Rare' => 0.5,
'Very Rare' => 0
);
?>
<script language="javascript">
function toggleVisibility(obj) {
var el = document.getElementById('d' + obj.id);
var name = obj.innerHTML.substring(4);
if(el.style.display == 'none') {
obj.innerHTML = '[ -]';
el.style.display = 'block';
} else {
obj.innerHTML = '[+]';
el.style.display = 'none';
}
obj.innerHTML += ' ' + name;
}
</script>
// In percent (highest first).
$rarity = array(
'Not Rare' => 7,
'Semi Rare' => 2,
'Rare' => 0.5,
'Very Rare' => 0
);
?>
<script language="javascript">
function toggleVisibility(obj) {
var el = document.getElementById('d' + obj.id);
var name = obj.innerHTML.substring(4);
<?php
if(isset($_GET['lootrate']))
$add = '&lootrate';
echo '<a href="' . htmlspecialchars($_SERVER['PHP_SELF'] . ($add ? '?lootrate' : '')) . '">Hide None</a> | ';
echo '<a href="?hidefail' . $add . '">Hide Not Found</a> | ';
echo '<a href="?hideempty' . $add . '">Hide Monsters Without Loot</a> | ';
echo '<a href="?hideempty&hidefail' . $add . '">Hide All</a> | ';
if(el.style.display == 'none') {
obj.innerHTML = '[ -]';
el.style.display = 'block';
} else {
obj.innerHTML = '[+]';
el.style.display = 'none';
}
obj.innerHTML += ' ' + name;
}
</script>
<?php
if(isset($_GET['lootrate']))
$add = '&lootrate';
echo '<a href="' . htmlspecialchars($_SERVER['PHP_SELF'] . ($add ? '?lootrate' : '')) . '">Hide None</a> | ';
echo '<a href="?hidefail' . $add . '">Hide Not Found</a> | ';
echo '<a href="?hideempty' . $add . '">Hide Monsters Without Loot</a> | ';
echo '<a href="?hideempty&hidefail' . $add . '">Hide All</a> | ';
echo '<a href="monsters_loot.php">Use Normal Loot Rate</a> | ';
echo '<a href="?lootrate">Use Server Loot Rate</a>';
?>
<br><br>
<?php
$items = simplexml_load_file($otdir . '/data/items/items.xml') or die('<b>Could not load items!</b>');
$items = simplexml_load_file($otdir . '/data/items/items.xml') or die('<b>Could not load items!</b>');
foreach($items->item as $v)
$itemList[(int)$v['id']] = $v['name'];
if(isset($_GET['lootrate'])) {
$config = parse_ini_file($otdir . '/config.lua');
$lootRate = $config['rate_loot'];
}
$monsters = simplexml_load_file($otdir . '/data/monster/monsters.xml') or die('<b>Could not load monsters!</b>');
foreach($monsters->monster as $monster) {
$loot = simplexml_load_file($otdir . '/data/monster/' . $monster['file']);
if($loot) {
if($item = $loot->loot->item) {
echo '
<a id="' . ++$i . '" style="text-decoration: none; font: bold 14px verdana; color: orange;" href="javascript:void(0);" onclick="toggleVisibility(this)">[+] ' . $monster['name'] . '</a>
<br><div style="display: none;" id="d' . $i . '"><br>';
addLoot($item);
echo '<br></pre></div>';
} elseif(!isset($_GET['hideempty']))
echo '<span style="font: bold 14px verdana; color: red;">[x] ' . $monster['name'] . '</span><br>';
} elseif(!isset($_GET['hidefail']))
echo '<span style="color: white;">Failed to load monster <b>' . $monster[name] . '</b> <i>(' . $monster[file] . ')</i><br>';
}
$config = parse_ini_file($otdir . '/config.lua');
$lootRate = $config['rate_loot'];
}
function addLoot($loot, $level=1) {
foreach($loot as $test) {
$chance = $test['chance'];
if(!$chance)
$chance = $test['chance1'];
$monsters = simplexml_load_file($otdir . '/data/monster/monsters.xml') or die('<b>Could not load monsters!</b>');
foreach($monsters->monster as $monster) {
$loot = simplexml_load_file($otdir . '/data/monster/' . $monster['file']);
if($loot) {
if($item = $loot->loot->item) {
echo '
<a id="' . ++$i . '" style="text-decoration: none; font: bold 14px verdana; color: orange;" href="javascript:void(0);" onclick="toggleVisibility(this)">[+] ' . $monster['name'] . '</a>
<br><div style="display: none;" id="d' . $i . '"><br>';
addLoot($item);
echo '<br></pre></div>';
} elseif(!isset($_GET['hideempty']))
echo '<span style="font: bold 14px verdana; color: red;">[x] ' . $monster['name'] . '</span><br>';
} elseif(!isset($_GET['hidefail']))
echo '<span style="color: white;">Failed to load monster <b>' . $monster[name] . '</b> <i>(' . $monster[file] . ')</i><br>';
}
printLoot($level, $test['id'], $test['countmax'], $chance);
foreach($test as $k => $v)
addLoot($v->item, $level + 1);
}
}
function printLoot($level, $itemid, $count, $chance) {
global $itemList, $rarity;
$chance /= 1000;
if(isset($_GET['lootrate'])) {
global $lootRate;
$chance *= $lootRate;
}
foreach($rarity as $lootRarity => $percent){
if($chance >= $percent) {
echo str_repeat("... ", $level) . '<u>' . ($count ? $count : 1) . '</u> <span style="color: #7878FF; font-weight: bold;">' . $itemList[(int)$itemid] . '</span> - <span style="color: #C45; font-weight: bold;">' . $lootRarity . '</span> (<span style="color: #FF9A9A;">' . $chance . '%</span>)<br>';
break;
}
}
}
?>
function addLoot($loot, $level=1) {
foreach($loot as $test) {
$chance = $test['chance'];
if(!$chance)
$chance = $test['chance1'];
printLoot($level, $test['id'], $test['countmax'], $chance);
foreach($test as $k => $v)
addLoot($v->item, $level + 1);
}
}
function printLoot($level, $itemid, $count, $chance) {
global $itemList, $rarity;
$chance /= 1000;
if(isset($_GET['lootrate'])) {
global $lootRate;
$chance *= $lootRate;
}
foreach($rarity as $lootRarity => $percent){
if($chance >= $percent) {
echo str_repeat("... ", $level) . '<u>' . ($count ? $count : 1) . '</u> <span style="color: #7878FF; font-weight: bold;">' . $itemList[(int)$itemid] . '</span> - <span style="color: #C45; font-weight: bold;">' . $lootRarity . '</span> (<span style="color: #FF9A9A;">' . $chance . '%</span>)<br>';
break;
}
}
}
?>
<?php include 'layout/overall/footer.php'; ?>

View File

@ -37,16 +37,16 @@ if (empty($_POST) === false) {
$errors[] = 'This account name is blocked for registration.';
}
if ($config['ServerEngine'] !== 'OTHIRE' && $config['client'] >= 830) {
if (preg_match("/^[a-zA-Z0-9]+$/", $_POST['username']) == false) {
$errors[] = 'Your account name can only contain characters a-z, A-Z and 0-9.';
}
if (preg_match("/^[a-zA-Z0-9]+$/", $_POST['username']) == false) {
$errors[] = 'Your account name can only contain characters a-z, A-Z and 0-9.';
}
} else {
if (preg_match("/^[0-9]+$/", $_POST['username']) == false) {
$errors[] = 'Your account can only contain numbers 0-9.';
}
if ((int)$_POST['username'] < 100000 || (int)$_POST['username'] > 999999999) {
$errors[] = 'Your account number must be a value between 6-8 numbers long.';
}
if (preg_match("/^[0-9]+$/", $_POST['username']) == false) {
$errors[] = 'Your account can only contain numbers 0-9.';
}
if ((int)$_POST['username'] < 100000 || (int)$_POST['username'] > 999999999) {
$errors[] = 'Your account number must be a value between 6-8 numbers long.';
}
}
// name restriction
$resname = explode(" ", $_POST['username']);
@ -83,9 +83,9 @@ if (empty($_POST) === false) {
if (validate_ip(getIP()) === false && $config['validate_IP'] === true) {
$errors[] = 'Failed to recognize your IP address. (Not a valid IPv4 address).';
}
if (strlen($_POST['flag']) < 1) {
$errors[] = 'Please choose country.';
}
if (strlen($_POST['flag']) < 1) {
$errors[] = 'Please choose country.';
}
}
}

View File

@ -376,18 +376,18 @@ foreach ($shop_list as $key => $offer) {
<?php if ($shop['enableShopConfirmation']) { ?>
<script src="https://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script>
$(document).ready(function(){
$(".needconfirmation").each(function(e){
$(this).click(function(e){
var itemname = $(this).attr("data-item-name");
var itemcost = $(this).attr("data-item-cost");
$(document).ready(function(){
$(".needconfirmation").each(function(e){
$(this).click(function(e){
var itemname = $(this).attr("data-item-name");
var itemcost = $(this).attr("data-item-cost");
var r = confirm("Do you really want to purchase "+itemname+" for "+itemcost+" points?")
if(r == false){
e.preventDefault();
}
});
});
});
});
});
});
</script>
<?php }

View File

@ -4,7 +4,7 @@ $cache = new Cache('engine/cache/support');
if ($cache->hasExpired()) {
// Fetch all staffs in-game.
if ($config['ServerEngine'] == 'TFS_03') {
$staffs = support_list03();
$staffs = support_list03();
} else $staffs = support_list();
// Fetch group ids and names from config.php
$groups = $config['ingame_positions'];

View File

@ -1,151 +1,151 @@
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
// Cache the results
$cache = new Cache('engine/cache/topGuilds');
if ($cache->hasExpired()) {
$guilds = mysql_select_multi("SELECT `g`.`id` AS `id`, `g`.`name` AS `name`, COUNT(`g`.`name`) as `frags` FROM `players` p LEFT JOIN `player_deaths` pd ON `pd`.`killed_by` = `p`.`name` LEFT JOIN `guild_membership` gm ON `p`.`id` = `gm`.`player_id` LEFT JOIN `guilds` g ON `gm`.`guild_id` = `g`.`id` WHERE `pd`.`unjustified` = 1 GROUP BY `name` ORDER BY `frags` DESC, `name` ASC LIMIT 0, 10;");
$cache->setContent($guilds);
$cache->save();
} else {
$guilds = $cache->load();
}
// Cache the results
$cache = new Cache('engine/cache/topGuilds');
if ($cache->hasExpired()) {
$guilds = mysql_select_multi("SELECT `g`.`id` AS `id`, `g`.`name` AS `name`, COUNT(`g`.`name`) as `frags` FROM `players` p LEFT JOIN `player_deaths` pd ON `pd`.`killed_by` = `p`.`name` LEFT JOIN `guild_membership` gm ON `p`.`id` = `gm`.`player_id` LEFT JOIN `guilds` g ON `gm`.`guild_id` = `g`.`id` WHERE `pd`.`unjustified` = 1 GROUP BY `name` ORDER BY `frags` DESC, `name` ASC LIMIT 0, 10;");
$cache->setContent($guilds);
$cache->save();
} else {
$guilds = $cache->load();
}
$count = 1;
function convert_number_to_words($number) {
$hyphen = '-';
$conjunction = ' and ';
$separator = ', ';
$negative = 'negative ';
$decimal = ' point ';
$dictionary = array(
0 => 'zero',
1 => 'First',
2 => 'Second',
3 => 'Third',
4 => 'Fourth',
5 => 'Fifth',
6 => 'Sixth',
7 => 'Seventh',
8 => 'Eighth',
9 => 'Ninth',
10 => 'Tenth',
11 => 'eleventh',
12 => 'twelve',
13 => 'thirteen',
14 => 'fourteen',
15 => 'fifteen',
16 => 'sixteen',
17 => 'seventeen',
18 => 'eighteen',
19 => 'nineteen',
20 => 'twenty',
30 => 'thirty',
40 => 'fourty',
50 => 'fifty',
60 => 'sixty',
70 => 'seventy',
80 => 'eighty',
90 => 'ninety',
100 => 'hundred',
1000 => 'thousand',
1000000 => 'million',
1000000000 => 'billion',
1000000000000 => 'trillion',
1000000000000000 => 'quadrillion',
1000000000000000000 => 'quintillion'
);
if (!is_numeric($number)) {
return false;
}
if (($number >= 0 && (int) $number < 0) || (int) $number < 0 - PHP_INT_MAX) {
// overflow
trigger_error(
'convert_number_to_words only accepts numbers between -' . PHP_INT_MAX . ' and ' . PHP_INT_MAX,
E_USER_WARNING
);
return false;
}
if ($number < 0) {
return $negative . convert_number_to_words(abs($number));
}
$string = $fraction = null;
if (strpos($number, '.') !== false) {
list($number, $fraction) = explode('.', $number);
}
switch (true) {
case $number < 21:
$string = $dictionary[$number];
break;
case $number < 100:
$tens = ((int) ($number / 10)) * 10;
$units = $number % 10;
$string = $dictionary[$tens];
if ($units) {
$string .= $hyphen . $dictionary[$units];
}
break;
case $number < 1000:
$hundreds = $number / 100;
$remainder = $number % 100;
$string = $dictionary[$hundreds] . ' ' . $dictionary[100];
if ($remainder) {
$string .= $conjunction . convert_number_to_words($remainder);
}
break;
default:
$baseUnit = pow(1000, floor(log($number, 1000)));
$numBaseUnits = (int) ($number / $baseUnit);
$remainder = $number % $baseUnit;
$string = convert_number_to_words($numBaseUnits) . ' ' . $dictionary[$baseUnit];
if ($remainder) {
$string .= $remainder < 100 ? $conjunction : $separator;
$string .= convert_number_to_words($remainder);
}
break;
}
if (null !== $fraction && is_numeric($fraction)) {
$string .= $decimal;
$words = array();
foreach (str_split((string) $fraction) as $number) {
$words[] = $dictionary[$number];
}
$string .= implode(' ', $words);
}
return $string;
function convert_number_to_words($number) {
$hyphen = '-';
$conjunction = ' and ';
$separator = ', ';
$negative= 'negative ';
$decimal = ' point ';
$dictionary = array(
0 => 'zero',
1 => 'first',
2 => 'second',
3 => 'third',
4 => 'fourth',
5 => 'fifth',
6 => 'sixth',
7 => 'seventh',
8 => 'eighth',
9 => 'ninth',
10 => 'tenth',
11 => 'eleventh',
12 => 'twelve',
13 => 'thirteen',
14 => 'fourteen',
15 => 'fifteen',
16 => 'sixteen',
17 => 'seventeen',
18 => 'eighteen',
19 => 'nineteen',
20 => 'twenty',
30 => 'thirty',
40 => 'fourty',
50 => 'fifty',
60 => 'sixty',
70 => 'seventy',
80 => 'eighty',
90 => 'ninety',
100 => 'hundred',
1000 => 'thousand',
1000000 => 'million',
1000000000 => 'billion',
1000000000000 => 'trillion',
1000000000000000 => 'quadrillion',
1000000000000000000 => 'quintillion'
);
if (!is_numeric($number)) {
return false;
}
if (($number >= 0 && (int) $number < 0) || (int) $number < 0 - PHP_INT_MAX) {
// overflow
trigger_error(
'convert_number_to_words only accepts numbers between -' . PHP_INT_MAX . ' and ' . PHP_INT_MAX,
E_USER_WARNING
);
return false;
}
if ($number < 0) {
return $negative . convert_number_to_words(abs($number));
}
$string = $fraction = null;
if (strpos($number, '.') !== false) {
list($number, $fraction) = explode('.', $number);
}
switch (true) {
case $number < 21:
$string = $dictionary[$number];
break;
case $number < 100:
$tens = ((int) ($number / 10)) * 10;
$units = $number % 10;
$string = $dictionary[$tens];
if ($units) {
$string .= $hyphen . $dictionary[$units];
}
break;
case $number < 1000:
$hundreds = $number / 100;
$remainder = $number % 100;
$string = $dictionary[$hundreds] . ' ' . $dictionary[100];
if ($remainder) {
$string .= $conjunction . convert_number_to_words($remainder);
}
break;
default:
$baseUnit = pow(1000, floor(log($number, 1000)));
$numBaseUnits = (int) ($number / $baseUnit);
$remainder = $number % $baseUnit;
$string = convert_number_to_words($numBaseUnits) . ' ' . $dictionary[$baseUnit];
if ($remainder) {
$string .= $remainder < 100 ? $conjunction : $separator;
$string .= convert_number_to_words($remainder);
}
break;
}
if (null !== $fraction && is_numeric($fraction)) {
$string .= $decimal;
$words = array();
foreach (str_split((string) $fraction) as $number) {
$words[] = $dictionary[$number];
}
$string .= implode(' ', $words);
}
return $string;
}
if (!empty($guilds) || $guilds !== false) {
?>
if (!empty($guilds) || $guilds !== false) {
?>
<table id="onlinelistTable" class="table table-striped table-hover">
<tr class="yellow">
<table id="onlinelistTable" class="table table-striped table-hover">
<tr class="yellow">
<b><tr><h3><center>Top 10 guilds with most frags</center></h3></tr></b>
<th>#</th>
<th>Name:</th>
<th>Frags:</th>
</tr>
<?php foreach ($guilds as $guild) {
<th>#</th>
<th>Name:</th>
<th>Frags:</th>
</tr>
<?php foreach ($guilds as $guild) {
$url = url("guilds.php?name=". $guild['name']);
echo '<tr class="special" onclick="javascript:window.location.href=\'' . $url . '\'">'; ?>
<td><?php echo convert_number_to_words($count);
$count++; ?></td>
<td><a href="" onclick="return false"><?php echo $guild['name']; ?></a></td>
<td><?php echo $guild['frags']; ?></td>
</tr>
<?php } ?>
</table>
$url = url("guilds.php?name=". $guild['name']);
echo '<tr class="special" onclick="javascript:window.location.href=\'' . $url . '\'">'; ?>
<td><?php echo convert_number_to_words($count);
$count++; ?></td>
<td><a href="" onclick="return false"><?php echo $guild['name']; ?></a></td>
<td><?php echo $guild['frags']; ?></td>
</tr>
<?php } ?>
</table>
<?php
} else echo '<h1>No frags yet.</h1>';
include 'layout/overall/footer.php'; ?>
} else echo '<h1>No frags yet.</h1>';
include 'layout/overall/footer.php'; ?>

View File

@ -1,10 +1,10 @@
<a class="twitter-timeline" href="https://twitter.com/ZnoteAAC" data-widget-id="353297614114021376">Tweets from @ZnoteAAC</a>
<script>
!function(d,s,id){
var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';
if(!d.getElementById(id)){
js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js,fjs);
}
}(document,"script","twitter-wjs");
!function(d,s,id){
var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';
if(!d.getElementById(id)){
js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js,fjs);
}
}(document,"script","twitter-wjs");
</script>