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 = {} local outfits = {}
if itemid > 1000 then if itemid > 1000 then
local first = math.floor(itemid/1000) local first = math.floor(itemid/1000)
table.insert(outfits, first) table.insert(outfits, first)
itemid = itemid - (first * 1000) itemid = itemid - (first * 1000)
end end
table.insert(outfits, itemid) table.insert(outfits, itemid)

View File

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

View File

@ -70,9 +70,9 @@ function onSay(cid, words, param)
local outfits = {} local outfits = {}
if itemid > 1000 then if itemid > 1000 then
local first = math.floor(itemid/1000) local first = math.floor(itemid/1000)
table.insert(outfits, first) table.insert(outfits, first)
itemid = itemid - (first * 1000) itemid = itemid - (first * 1000)
end end
table.insert(outfits, itemid) 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. -- 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. -- Regular TFS global storage values get reset every time server reboots. This does not.
local function getEternalStorage(key, parser) local function getEternalStorage(key, parser)
local value = result.getString(db.storeQuery("SELECT `value` FROM `znote_global_storage` WHERE `key` = ".. key .. ";"), "value") local value = result.getString(db.storeQuery("SELECT `value` FROM `znote_global_storage` WHERE `key` = ".. key .. ";"), "value")
if not value then if not value then
if parser then if parser then
return false return false
else else
return -1 return -1
end end
end end
return tonumber(value) or value return tonumber(value) or value
end end
local function setEternalStorage(key, value) local function setEternalStorage(key, value)
if getEternalStorage(key, true) then if getEternalStorage(key, true) then
db.query("UPDATE `znote_global_storage` SET `value` = '".. value .. "' WHERE `key` = ".. key .. ";") db.query("UPDATE `znote_global_storage` SET `value` = '".. value .. "' WHERE `key` = ".. key .. ";")
else else
db.query("INSERT INTO `znote_global_storage` (`key`, `value`) VALUES (".. key ..", ".. value ..");") db.query("INSERT INTO `znote_global_storage` (`key`, `value`) VALUES (".. key ..", ".. value ..");")
end end
return true return true
end end
-- SQL Query to execute: -- -- 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"/> -- <globalevent name="PowerGamers" interval="60000" script="powergamers.lua"/>
function onThink(interval, lastExecution, thinkInterval) function onThink(interval, lastExecution, thinkInterval)
if tonumber(os.date("%d")) ~= getEternalStorage(23856) then if tonumber(os.date("%d")) ~= getEternalStorage(23856) then
setEternalStorage(23856, (tonumber(os.date("%d")))) 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` 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`;") 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 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`)") 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 return true
end end

View File

@ -1,7 +1,7 @@
<?php require_once 'engine/init.php'; include 'layout/overall/header.php'; <?php require_once 'engine/init.php'; include 'layout/overall/header.php';
if(!isset($_SESSION['csrf_token'])){ 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){ if(!$crypto_strong){
// we don't really care, the csrf token doesn't really have to be cryptographically 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! // 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 (!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'])) { if (user_character_exist($_POST['ban_char'])) {
// Decrypt and store values // Decrypt and store values
$charname = $_POST['ban_char']; $charname = $_POST['ban_char'];
$typeid = (int)$_POST['ban_type'] - $enc; $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.'; $errors[] = 'Character '. hhb_tohtml(getValue($_POST['ban_char'])) .' does not exist.';
} }
} }
// Delete character:
// delete character:
if (empty($_POST['del_name']) === false) { if (empty($_POST['del_name']) === false) {
if (user_character_exist($_POST['del_name'])) { if (user_character_exist($_POST['del_name'])) {
user_delete_character(user_character_id($_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.'; $errors[] = 'Character '. hhb_tohtml(getValue($_POST['del_name'])) .' does not exist.';
} }
} }
// Reset password for char name // Reset password for char name
if (empty($_POST['reset_pass']) === false && empty($_POST['new_pass']) === false) { if (empty($_POST['reset_pass']) === false && empty($_POST['new_pass']) === false) {
// reset_pass = character name // reset_pass = character name
if (user_character_exist($_POST['reset_pass'])) { if (user_character_exist($_POST['reset_pass'])) {
$acc_id = user_character_account_id($_POST['reset_pass']); $acc_id = user_character_account_id($_POST['reset_pass']);
if ($acc_id != $session_user_id) { if ($acc_id != $session_user_id) {
if ($config['ServerEngine'] == 'TFS_02' || $config['ServerEngine'] == 'TFS_10' || $config['ServerEngine'] == 'OTHIRE') { if ($config['ServerEngine'] == 'TFS_02' || $config['ServerEngine'] == 'TFS_10' || $config['ServerEngine'] == 'OTHIRE') {
user_change_password($acc_id, $_POST['new_pass']); user_change_password($acc_id, $_POST['new_pass']);
@ -100,7 +99,7 @@ if (empty($_POST) === false) {
$points += $znote_account['points']; $points += $znote_account['points'];
mysql_update("UPDATE `znote_accounts` SET `points`='$points' WHERE `account_id`='". $account['account_id'] ."';"); mysql_update("UPDATE `znote_accounts` SET `points`='$points' WHERE `account_id`='". $account['account_id'] ."';");
} }
// Set character position // Set character position
if (empty($_POST['position_name']) === false && empty($_POST['position_type']) === false) { if (empty($_POST['position_name']) === false && empty($_POST['position_type']) === false) {
if (user_character_exist($_POST['position_name'])) { 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.'; $errors[] = 'Character '. hhb_tohtml(getValue($_POST['position_name'])) .' does not exist.';
} }
} }
// Teleport Player // Teleport Player
if (isset($_POST['from']) && in_array($_POST['from'], ['all', 'only'])) { if (isset($_POST['from']) && in_array($_POST['from'], ['all', 'only'])) {
$from = $_POST['from']; $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..."> <input type="text" name="ban_char" placeholder="Character name...">
</td> </td>
</tr> </tr>
<!-- row 2 --> <!-- row 2 -->
<tr> <tr>
<td> <td>
@ -220,7 +219,7 @@ echo "Last cached on: ". hhb_tohtml(getClock($basic['cached'], true)) .".<br>";
</select> </select>
</td> </td>
</tr> </tr>
<!-- row 3 --> <!-- row 3 -->
<tr> <tr>
<td> <td>
@ -234,7 +233,7 @@ echo "Last cached on: ". hhb_tohtml(getClock($basic['cached'], true)) .".<br>";
</select> </select>
</td> </td>
</tr> </tr>
<!-- row 4 --> <!-- row 4 -->
<tr> <tr>
<td> <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. // 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. // Feel free to add/remove and change name/color of status types.
$statusTypes = array( $statusTypes = array(
0 => '<font color="purple">Reported</font>', 0 => '<font color="purple">Reported</font>',
1 => '<font color="darkblue">To-Do List</font>', 1 => '<font color="darkblue">To-Do List</font>',
2 => '<font color="red">Confirmed bug</font>', 2 => '<font color="red">Confirmed bug</font>',
3 => '<font color="grey">Invalid</font>', 3 => '<font color="grey">Invalid</font>',
4 => '<font color="grey">Rejected</font>', 4 => '<font color="grey">Rejected</font>',
5 => '<font color="green"><b>Fixed</b></font>' 5 => '<font color="green"><b>Fixed</b></font>'
); );
// Which status IDs should give option to add to changelog? // Which status IDs should give option to add to changelog?
$statusChangeLog = array(0,5); $statusChangeLog = array(0,5);
@ -22,222 +22,222 @@ $hideStatus = array(3, 4, 5);
// Fetch data from SQL // 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;'); $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) { if ($reportsData !== false) {
// Order reports array by ID for easy reference later on. // Order reports array by ID for easy reference later on.
$reports = array(); $reports = array();
for ($i = 0; $i < count($reportsData); $i++) for ($i = 0; $i < count($reportsData); $i++)
foreach ($statusTypes as $key => $value) foreach ($statusTypes as $key => $value)
if ($key == $reportsData[$i]['status']) if ($key == $reportsData[$i]['status'])
$reports[$key][$reportsData[$i]['id']] = $reportsData[$i]; $reports[$key][$reportsData[$i]['id']] = $reportsData[$i];
} }
// POST logic (Update report and give player points) // POST logic (Update report and give player points)
if (!empty($_POST)) { if (!empty($_POST)) {
// Fetch POST data // Fetch POST data
$playerName = getValue($_POST['playerName']); $playerName = getValue($_POST['playerName']);
$status = getValue($_POST['status']); $status = getValue($_POST['status']);
$price = getValue($_POST['price']); $price = getValue($_POST['price']);
$customPoints = getValue($_POST['customPoints']); $customPoints = getValue($_POST['customPoints']);
$reportId = getValue($_POST['id']); $reportId = getValue($_POST['id']);
$changelogReportId = (int)$_POST['changelogReportId']; $changelogReportId = (int)$_POST['changelogReportId'];
$changelogValue = &$_POST['changelogValue']; $changelogValue = &$_POST['changelogValue'];
$changelogText = getValue($_POST['changelogText']); $changelogText = getValue($_POST['changelogText']);
$changelogStatus = ($changelogReportId !== false && $changelogValue === '2' && $changelogText !== false) ? true : false; $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 // Update SQL
mysql_update("UPDATE `znote_player_reports` SET `status`='$status' WHERE `id`='$reportId' LIMIT 1;"); mysql_update("UPDATE `znote_player_reports` SET `status`='$status' WHERE `id`='$reportId' LIMIT 1;");
echo "<h1>Report status updated to ".$statusTypes[(int)$status] ."!</h1>"; echo "<h1>Report status updated to ".$statusTypes[(int)$status] ."!</h1>";
// Update local array representation // Update local array representation
foreach ($reports as $sid => $sa) foreach ($reports as $sid => $sa)
foreach ($sa as $rid => $ra) foreach ($sa as $rid => $ra)
if ($reportId == $rid) { if ($reportId == $rid) {
$reports[$status][$reportId] = $reports[$sid][$rid]; $reports[$status][$reportId] = $reports[$sid][$rid];
$reports[$status][$reportId]['status'] = $status; $reports[$status][$reportId]['status'] = $status;
unset($reports[$sid][$rid]); unset($reports[$sid][$rid]);
} }
// If we should do anything with changelog: // If we should do anything with changelog:
if ($changelogStatus) { if ($changelogStatus) {
$time = time(); $time = time();
// Check if changelog exist (`id`, `text`, `time`, `report_id`, `status`) // Check if changelog exist (`id`, `text`, `time`, `report_id`, `status`)
$changelog = mysql_select_single("SELECT * FROM `znote_changelog` WHERE `report_id`='$changelogReportId' LIMIT 1;"); $changelog = mysql_select_single("SELECT * FROM `znote_changelog` WHERE `report_id`='$changelogReportId' LIMIT 1;");
// If changelog exist // If changelog exist
$updatechangelog = false; $updatechangelog = false;
if ($changelog !== false) { if ($changelog !== false) {
// Update it // Update it
mysql_update("UPDATE `znote_changelog` SET `text`='$changelogText', `time`='$time' WHERE `id`='".$changelog['id']."' LIMIT 1;"); mysql_update("UPDATE `znote_changelog` SET `text`='$changelogText', `time`='$time' WHERE `id`='".$changelog['id']."' LIMIT 1;");
echo "<h2>Changelog message updated!</h2>"; echo "<h2>Changelog message updated!</h2>";
$updatechangelog = true; $updatechangelog = true;
} else { } else {
// Create it // Create it
mysql_insert("INSERT INTO `znote_changelog` (`text`, `time`, `report_id`, `status`) mysql_insert("INSERT INTO `znote_changelog` (`text`, `time`, `report_id`, `status`)
VALUES ('$changelogText', '$time', '$changelogReportId', '$status');"); VALUES ('$changelogText', '$time', '$changelogReportId', '$status');");
echo "<h2>Changelog message created!</h2>"; echo "<h2>Changelog message created!</h2>";
$updatechangelog = true; $updatechangelog = true;
} }
if ($updatechangelog) { if ($updatechangelog) {
// Cache changelog // Cache changelog
$cache = new Cache('engine/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->setContent(mysql_select_multi("SELECT `id`, `text`, `time`, `report_id`, `status` FROM `znote_changelog` ORDER BY `id` DESC;"));
$cache->save(); $cache->save();
} }
} }
// If we should give user price // If we should give user price
if ($price > 0) { if ($price > 0) {
$account = mysql_select_single("SELECT `a`.`id`, `a`.`email` FROM `accounts` AS `a` $account = mysql_select_single("SELECT `a`.`id`, `a`.`email` FROM `accounts` AS `a`
INNER JOIN `players` AS `p` ON `p`.`account_id` = `a`.`id` INNER JOIN `players` AS `p` ON `p`.`account_id` = `a`.`id`
WHERE `p`.`name` = '$playerName' LIMIT 1;"); WHERE `p`.`name` = '$playerName' LIMIT 1;");
if ($account !== false) { if ($account !== false) {
// transaction log // transaction log
mysql_insert("INSERT INTO `znote_paypal` VALUES ('', '$reportId', 'report@admin.".$user_data['name']." to ".$account['email']."', '".$account['id']."', '0', '".$price."')"); mysql_insert("INSERT INTO `znote_paypal` VALUES ('', '$reportId', 'report@admin.".$user_data['name']." to ".$account['email']."', '".$account['id']."', '0', '".$price."')");
// Process payment // Process payment
$data = mysql_select_single("SELECT `points` AS `old_points` FROM `znote_accounts` WHERE `account_id`='".$account['id']."';"); $data = mysql_select_single("SELECT `points` AS `old_points` FROM `znote_accounts` WHERE `account_id`='".$account['id']."';");
// Give points to user // Give points to user
$new_points = $data['old_points'] + $price; $new_points = $data['old_points'] + $price;
mysql_update("UPDATE `znote_accounts` SET `points`='$new_points' WHERE `account_id`='".$account['id']."'"); mysql_update("UPDATE `znote_accounts` SET `points`='$new_points' WHERE `account_id`='".$account['id']."'");
// Remind GM that he sent points to character // Remind GM that he sent points to character
echo "<font color='green' size='5'>".$playerName." has been granted ".$price." points for his reports.</font>"; 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) // GET logic (Edit report data and specify how many [if any] points to give to user)
} elseif (!empty($_GET)) { } elseif (!empty($_GET)) {
// Fetch GET data // Fetch GET data
$action = getValue($_GET['action']); $action = getValue($_GET['action']);
$playerName = getValue($_GET['name']); $playerName = getValue($_GET['name']);
$reportId = getValue($_GET['id']); $reportId = getValue($_GET['id']);
// Fetch the report we intend to modify // Fetch the report we intend to modify
foreach ($reports as $sid => $sa) foreach ($reports as $sid => $sa)
foreach ($sa as $rid => $ra) foreach ($sa as $rid => $ra)
if ($rid == $reportId) if ($rid == $reportId)
$report = $reports[$sid][$reportId]; $report = $reports[$sid][$reportId];
// Create html form // Create HTML form
?> ?>
<div style="width: 300px; margin: auto;"> <div style="width: 300px; margin: auto;">
<form action="admin_reports.php" method="POST"> <form action="admin_reports.php" method="POST">
Player: <a target="_BLANK" href="characterprofile.php?name=<?php echo $report['name']; ?>"><?php echo $report['name']; ?></a> 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="playerName" value="<?php echo $report['name']; ?>">
<input type="hidden" name="id" value="<?php echo $report['id']; ?>"> <input type="hidden" name="id" value="<?php echo $report['id']; ?>">
<br>Set status: <br>Set status:
<select name="status"> <select name="status">
<?php <?php
foreach ($statusTypes as $sid => $sname) foreach ($statusTypes as $sid => $sname)
echo ($sid != $report['status']) ? "<option value='$sid'>$sname</option>" : "<option value='$sid' selected>$sname</option>"; echo ($sid != $report['status']) ? "<option value='$sid'>$sname</option>" : "<option value='$sid' selected>$sname</option>";
?> ?>
</select><br> </select><br>
Give user points: Give user points:
<select name="price"> <select name="price">
<option value='0'>0</option> <option value='0'>0</option>
<?php <?php
foreach ($config['paypal_prices'] as $price) foreach ($config['paypal_prices'] as $price)
echo "<option value='$price'>$price</option>"; echo "<option value='$price'>$price</option>";
?> ?>
</select> + <input name="customPoints" type="text" style="width: 50px;" placeholder="0"><br> </select> + <input name="customPoints" type="text" style="width: 50px;" placeholder="0"><br>
<?php <?php
if (in_array($report['status'], $statusChangeLog)) { if (in_array($report['status'], $statusChangeLog)) {
?> ?>
<br> <br>
<input type="hidden" name="changelogReportId" value="<?php echo $report['id']; ?>"> <input type="hidden" name="changelogReportId" value="<?php echo $report['id']; ?>">
Add / update changelog message? <select name="changelogValue"> Add / update changelog message? <select name="changelogValue">
<option value="1">No</option> <option value="1">No</option>
<option value="2">Yes</option> <option value="2">Yes</option>
</select><br> </select><br>
<textarea rows="7" cols="40" maxlength="254" name="changelogText"></textarea> <textarea rows="7" cols="40" maxlength="254" name="changelogText"></textarea>
<?php <?php
} }
?> ?>
<br> <br>
<input type="submit" value="Update Report" style="width: 100%;"> <input type="submit" value="Update Report" style="width: 100%;">
</form> </form>
</div> </div>
<?php <?php
} }
// If sql data is not empty // If SQL data is not empty
if ($reportsData !== false) { if ($reportsData !== false) {
// Render HTML // Render HTML
?> ?>
<center> <center>
<?php <?php
foreach ($reports as $statusId => $statusArray) { foreach ($reports as $statusId => $statusArray) {
?> ?>
<h2 class="statusType"><?php echo $statusTypes[$statusId]; ?> (<span id="status-<?php echo $statusId; ?>">Visible</span>)</h2> <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%"> <table class="table tbl" border="0" cellspacing="1" cellpadding="4" width="100%">
<thead> <thead>
<tr class="yellow" onclick="javascript:toggle('<?php echo $statusId; ?>')"> <tr class="yellow" onclick="javascript:toggle('<?php echo $statusId; ?>')">
<td width="38%">Info</td> <td width="38%">Info</td>
<td>Description</td> <td>Description</td>
</tr> </tr>
</thead> </thead>
<?php <?php
foreach ($statusArray as $reportId => $report) { foreach ($statusArray as $reportId => $report) {
?> ?>
<tbody class="row<?php echo $report['status']; ?>"> <tbody class="row<?php echo $report['status']; ?>">
<tr> <tr>
<td> <td>
<b>Report ID:</b> #<?php echo $report['id']; ?> <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>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>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>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> <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>
<td><?php echo $report['report_description']; ?></td> <td><?php echo $report['report_description']; ?></td>
</tr> </tr>
</tbody> </tbody>
<?php <?php
} }
?></table><?php ?></table><?php
} }
?> ?>
</center> </center>
<?php <?php
} else echo "<h2>No reports submitted.</h2>"; } else echo "<h2>No reports submitted.</h2>";
?> ?>
<style> <style>
tr.yellow[onclick] td { tr.yellow[onclick] td {
font-weight: bold; font-weight: bold;
color: white; color: white;
text-align: center; text-align: center;
} }
tbody[class^=row] td:last-of-type { tbody[class^=row] td:last-of-type {
text-align: center; text-align: center;
} }
</style> </style>
<script type="text/javascript"> <script type="text/javascript">
// Hide and show tables // Hide and show tables
// Written in clean javascript to make it cross-layout compatible. // Written in clean javascript to make it cross-layout compatible.
function toggle(statusId) { function toggle(statusId) {
var divStatus = 'row' + statusId, var divStatus = 'row' + statusId,
msgStatus = 'status-' + statusId; msgStatus = 'status-' + statusId;
// Change visibility status // Change visibility status
statusElement = document.getElementById(msgStatus); statusElement = document.getElementById(msgStatus);
statusElement.innerHTML = (statusElement.innerHTML == 'Visible') ? 'Hidden' : 'Visible'; statusElement.innerHTML = (statusElement.innerHTML == 'Visible') ? 'Hidden' : 'Visible';
// Show/hide elements. // Show/hide elements.
var elements = document.getElementsByClassName(divStatus); var elements = document.getElementsByClassName(divStatus);
for (var i = 0; i < elements.length; i++) for (var i = 0; i < elements.length; i++)
elements[i].style.display = (elements[i].style.display == 'none') ? 'table-header-group' : 'none'; elements[i].style.display = (elements[i].style.display == 'none') ? 'table-header-group' : 'none';
} }
<?php // Hide configured tables by default <?php // Hide configured tables by default
foreach ($hideStatus as $statusId) foreach ($hideStatus as $statusId)
echo "toggle($statusId);"; echo "toggle($statusId);";
?> ?>
var st = document.body.querySelectorAll('.statusType'); var st = document.body.querySelectorAll('.statusType');
for(i = 0; i < st.length; i++) for(i = 0; i < st.length; i++)
st[i].addEventListener('click', function(e) { st[i].addEventListener('click', function(e) {
toggle(e.currentTarget.querySelector('span').id.match(/(\d)+/)[0]); toggle(e.currentTarget.querySelector('span').id.match(/(\d)+/)[0]);
}); });
</script> </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'; <?php require_once 'engine/init.php';
protect_page(); protect_page();
include 'layout/overall/header.php'; include 'layout/overall/header.php';
// Convert a seconds integer value into days, hours, minutes and seconds string. // Convert a seconds integer value into days, hours, minutes and seconds string.
function toDuration($is) { function toDuration($is) {
$duration['day'] = $is / (24 * 60 * 60); $duration['day'] = $is / (24 * 60 * 60);
if (($duration['day'] - (int)$duration['day']) > 0) if (($duration['day'] - (int)$duration['day']) > 0)
$duration['hour'] = ($duration['day'] - (int)$duration['day']) * 24; $duration['hour'] = ($duration['day'] - (int)$duration['day']) * 24;
if (isset($duration['hour'])) { 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; $duration['minute'] = ($duration['hour'] - (int)$duration['hour']) * 60;
if (isset($duration['minute'])) { 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; $duration['second'] = ($duration['minute'] - (int)$duration['minute']) * 60;
} }
} }
@ -49,23 +49,23 @@ if ($auction['characterAuction']) {
$step = $auction['step']; $step = $auction['step'];
$step_duration = $auction['step_duration']; $step_duration = $auction['step_duration'];
$actions = array( $actions = array(
'list', // list all available players in auction 'list', // list all available players in auction
'view', // view a specific player 'view', // view a specific player
'create', // select which character to add and initial price 'create', // select which character to add and initial price
'add', // add character to list 'add', // add character to list
'bid', // Bid or buy a specific player 'bid', // Bid or buy a specific player
'refund', // Refund a player you added back to your account 'refund', // Refund a player you added back to your account
'claim' // Claim a character you won through purchase or bid 'claim' // Claim a character you won through purchase or bid
); );
// Default action is list, but $_GET or $_POST will override it. // Default action is list, but $_GET or $_POST will override it.
$action = 'list'; $action = 'list';
// Load selected string from actions array based on input, strict whitelist validation // Load selected string from actions array based on input, strict whitelist validation
if (isset( $_GET['action']) && in_array( $_GET['action'], $actions)) { if (isset( $_GET['action']) && in_array( $_GET['action'], $actions)) {
$action = $actions[array_search( $_GET['action'], $actions, true)]; $action = $actions[array_search( $_GET['action'], $actions, true)];
} }
if (isset($_POST['action']) && in_array($_POST['action'], $actions)) { if (isset($_POST['action']) && in_array($_POST['action'], $actions)) {
$action = $actions[array_search($_POST['action'], $actions, true)]; $action = $actions[array_search($_POST['action'], $actions, true)];
} }
// Passive check to see if bid period has expired and someone won a deal // Passive check to see if bid period has expired and someone won a deal
@ -86,8 +86,8 @@ if ($auction['characterAuction']) {
if (!empty($soldIds)) { if (!empty($soldIds)) {
mysql_update(" mysql_update("
UPDATE `znote_auction_player` UPDATE `znote_auction_player`
SET `sold`=1 SET `sold` = 1
WHERE `id` IN(".implode(',', $soldIds).") WHERE `id` IN(".implode(',', $soldIds).")
LIMIT ".COUNT($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 // The account of the buyer, if he can afford what he is trying to pay
$account = mysql_select_single(" $account = mysql_select_single("
SELECT SELECT
`a`.`id`, `a`.`id`,
`za`.`points` `za`.`points`
FROM `accounts` a FROM `accounts` a
INNER JOIN `znote_accounts` za INNER JOIN `znote_accounts` za
ON `a`.`id` = `za`.`account_id` ON `a`.`id` = `za`.`account_id`
WHERE `a`.`id`= {$this_account_id} WHERE `a`.`id`= {$this_account_id}
AND `za`.`points` >= {$price} AND `za`.`points` >= {$price}
LIMIT 1; LIMIT 1;
"); ");
//data_dump($account, false, "Buyer account:"); //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 // The character to buy, presuming it isn't sold, buyer isn't the owner, buyer can afford it
if ($account !== false) { if ($account !== false) {
$character = mysql_select_single(" $character = mysql_select_single("
SELECT SELECT
`za`.`id` AS `zaid`, `za`.`id` AS `zaid`,
`za`.`player_id`, `za`.`player_id`,
`za`.`original_account_id`, `za`.`original_account_id`,
`za`.`bidder_account_id`, `za`.`bidder_account_id`,
`za`.`time_begin`, `za`.`time_begin`,
`za`.`time_end`, `za`.`time_end`,
`za`.`price`, `za`.`price`,
`za`.`bid`, `za`.`bid`,
`za`.`deposit`, `za`.`deposit`,
`za`.`sold` `za`.`sold`
FROM `znote_auction_player` za FROM `znote_auction_player` za
WHERE `za`.`id` = {$zaid} WHERE `za`.`id` = {$zaid}
AND `za`.`sold` = 0 AND `za`.`sold` = 0
AND `za`.`original_account_id` != {$this_account_id} AND `za`.`original_account_id` != {$this_account_id}
AND `za`.`price` <= {$price} AND `za`.`price` <= {$price}
AND `za`.`bid`+{$step} <= {$price} AND `za`.`bid`+{$step} <= {$price}
LIMIT 1 LIMIT 1
"); ");
//data_dump($character, false, "Character to buy:"); //data_dump($character, false, "Character to buy:");
@ -146,8 +146,8 @@ if ($auction['characterAuction']) {
if ($character['bid'] > 0 && $character['bidder_account_id'] > 0) { if ($character['bid'] > 0 && $character['bidder_account_id'] > 0) {
mysql_update(" mysql_update("
UPDATE `znote_accounts` UPDATE `znote_accounts`
SET `points` = `points`+{$character['bid']} SET `points` = `points`+{$character['bid']}
WHERE `account_id` = {$character['bidder_account_id']} WHERE `account_id` = {$character['bidder_account_id']}
LIMIT 1; LIMIT 1;
"); ");
// If previous bidder is not you, increase bidding period by 1 hour // If previous bidder is not you, increase bidding period by 1 hour
@ -156,7 +156,7 @@ if ($auction['characterAuction']) {
mysql_update(" mysql_update("
UPDATE `znote_auction_player` UPDATE `znote_auction_player`
SET `time_end` = `time_end`+{$step_duration} SET `time_end` = `time_end`+{$step_duration}
WHERE `id` = {$character['zaid']} WHERE `id` = {$character['zaid']}
LIMIT 1; LIMIT 1;
"); ");
} }
@ -164,15 +164,15 @@ if ($auction['characterAuction']) {
// Remove points from buyer // Remove points from buyer
mysql_update(" mysql_update("
UPDATE `znote_accounts` UPDATE `znote_accounts`
SET `points` = `points`-{$price} SET `points` = `points`-{$price}
WHERE `account_id` = {$account['id']} WHERE `account_id` = {$account['id']}
LIMIT 1; LIMIT 1;
"); ");
// Update auction, and set new bidder data // Update auction, and set new bidder data
$time = time(); $time = time();
mysql_update(" mysql_update("
UPDATE `znote_auction_player` UPDATE `znote_auction_player`
SET SET
`bidder_account_id` = {$account['id']}, `bidder_account_id` = {$account['id']},
`bid` = {$price}, `bid` = {$price},
`sold` = CASE WHEN {$time} >= `time_end` THEN 1 ELSE 0 END `sold` = CASE WHEN {$time} >= `time_end` THEN 1 ELSE 0 END
@ -183,8 +183,8 @@ if ($auction['characterAuction']) {
if (time() >= $character['time_end']) { if (time() >= $character['time_end']) {
mysql_update(" mysql_update("
UPDATE `znote_accounts` UPDATE `znote_accounts`
SET `points` = `points`+{$character['deposit']} SET `points` = `points`+{$character['deposit']}
WHERE `account_id` = {$account['id']} WHERE `account_id` = {$account['id']}
LIMIT 1; LIMIT 1;
"); ");
} else { } 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 // silently fallback to list if he doesn't exist or is already sold
if ($action === 'view') { // View a character in the auction if ($action === 'view') { // View a character in the auction
if (!isset($zaid)) { if (!isset($zaid)) {
@ -206,7 +206,7 @@ if ($auction['characterAuction']) {
if ($zaid !== false) { if ($zaid !== false) {
// Retrieve basic character information // Retrieve basic character information
$character = mysql_select_single(" $character = mysql_select_single("
SELECT SELECT
`za`.`id` AS `zaid`, `za`.`id` AS `zaid`,
`za`.`player_id`, `za`.`player_id`,
`za`.`original_account_id`, `za`.`original_account_id`,
@ -214,33 +214,33 @@ if ($auction['characterAuction']) {
`za`.`time_begin`, `za`.`time_begin`,
`za`.`time_end`, `za`.`time_end`,
CASE WHEN `za`.`price` > `za`.`bid` CASE WHEN `za`.`price` > `za`.`bid`
THEN `za`.`price` THEN `za`.`price`
ELSE `za`.`bid`+{$step} ELSE `za`.`bid`+{$step}
END AS `price`, END AS `price`,
CASE WHEN `za`.`original_account_id` = {$this_account_id} CASE WHEN `za`.`original_account_id` = {$this_account_id}
THEN 1 THEN 1
ELSE 0 ELSE 0
END AS `own`, END AS `own`,
CASE WHEN `za`.`original_account_id` = {$this_account_id} CASE WHEN `za`.`original_account_id` = {$this_account_id}
THEN `p`.`name` THEN `p`.`name`
ELSE '' ELSE ''
END AS `name`, END AS `name`,
CASE WHEN `za`.`original_account_id` = {$this_account_id} CASE WHEN `za`.`original_account_id` = {$this_account_id}
THEN `za`.`bid` THEN `za`.`bid`
ELSE 0 ELSE 0
END AS `bid`, END AS `bid`,
CASE WHEN `za`.`original_account_id` = {$this_account_id} CASE WHEN `za`.`original_account_id` = {$this_account_id}
THEN `za`.`deposit` THEN `za`.`deposit`
ELSE 0 ELSE 0
END AS `deposit`, END AS `deposit`,
`p`.`vocation`, `p`.`vocation`,
`p`.`level`, `p`.`level`,
`p`.`balance`, `p`.`balance`,
`p`.`lookbody` AS `body`, `p`.`lookbody` AS `body`,
`p`.`lookfeet` AS `feet`, `p`.`lookfeet` AS `feet`,
`p`.`lookhead` AS `head`, `p`.`lookhead` AS `head`,
`p`.`looklegs` AS `legs`, `p`.`looklegs` AS `legs`,
`p`.`looktype` AS `type`, `p`.`looktype` AS `type`,
`p`.`lookaddons` AS `addons`, `p`.`lookaddons` AS `addons`,
`p`.`maglevel` AS `magic`, `p`.`maglevel` AS `magic`,
`p`.`skill_fist` AS `fist`, `p`.`skill_fist` AS `fist`,
@ -277,9 +277,9 @@ if ($auction['characterAuction']) {
ORDER BY MIN(`pid`) ASC ORDER BY MIN(`pid`) ASC
"); ");
$account = mysql_select_single(" $account = mysql_select_single("
SELECT `points` SELECT `points`
FROM `znote_accounts` FROM `znote_accounts`
WHERE `account_id`={$this_account_id} WHERE `account_id` = {$this_account_id}
AND `points` >= {$character['price']} AND `points` >= {$character['price']}
LIMIT 1; LIMIT 1;
"); ");
@ -448,11 +448,11 @@ if ($auction['characterAuction']) {
if ($pid > 0 && $cost >= $auction['lowestPrice']) { if ($pid > 0 && $cost >= $auction['lowestPrice']) {
$account = mysql_select_single(" $account = mysql_select_single("
SELECT `a`.`id`, `a`.`password`, `za`.`points` SELECT `a`.`id`, `a`.`password`, `za`.`points`
FROM `accounts` a FROM `accounts` a
INNER JOIN `znote_accounts` za INNER JOIN `znote_accounts` za
ON `a`.`id` = `za`.`account_id` ON `a`.`id` = `za`.`account_id`
WHERE `a`.`id`= {$this_account_id} WHERE `a`.`id`= {$this_account_id}
AND `a`.`password`='{$password}' AND `a`.`password`='{$password}'
AND `za`.`points` >= {$deposit} AND `za`.`points` >= {$deposit}
LIMIT 1 LIMIT 1
;"); ;");
@ -460,34 +460,34 @@ if ($auction['characterAuction']) {
// Check if player exist, is offline and not already in auction // Check if player exist, is offline and not already in auction
// And is not a tutor or a GM+. // And is not a tutor or a GM+.
$player = mysql_select_single(" $player = mysql_select_single("
SELECT `p`.`id`, `p`.`name`, SELECT `p`.`id`, `p`.`name`,
CASE CASE
WHEN `po`.`player_id` IS NULL WHEN `po`.`player_id` IS NULL
THEN 0 THEN 0
ELSE 1 ELSE 1
END AS `online`, END AS `online`,
CASE CASE
WHEN `za`.`player_id` IS NULL WHEN `za`.`player_id` IS NULL
THEN 0 THEN 0
ELSE 1 ELSE 1
END AS `alreadyInAuction` END AS `alreadyInAuction`
FROM `players` p FROM `players` p
LEFT JOIN `players_online` po LEFT JOIN `players_online` po
ON `p`.`id` = `po`.`player_id` ON `p`.`id` = `po`.`player_id`
LEFT JOIN `znote_auction_player` za LEFT JOIN `znote_auction_player` za
ON `p`.`id` = `za`.`player_id` ON `p`.`id` = `za`.`player_id`
AND `p`.`account_id` = `za`.`original_account_id` AND `p`.`account_id` = `za`.`original_account_id`
AND `za`.`claimed` = 0 AND `za`.`claimed` = 0
WHERE `p`.`id` = {$pid} WHERE `p`.`id` = {$pid}
AND `p`.`account_id` = {$this_account_id} AND `p`.`account_id` = {$this_account_id}
AND `p`.`group_id` = 1 AND `p`.`group_id` = 1
LIMIT 1 LIMIT 1
;"); ;");
// Verify storage account ID exist // Verify storage account ID exist
$storage_account = mysql_select_single(" $storage_account = mysql_select_single("
SELECT `id` SELECT `id`
FROM `accounts` FROM `accounts`
WHERE `id`={$auction['storage_account_id']} WHERE `id`={$auction['storage_account_id']}
LIMIT 1; LIMIT 1;
"); ");
if ($storage_account === false) { if ($storage_account === false) {
@ -534,22 +534,22 @@ if ($auction['characterAuction']) {
mysql_update(" mysql_update("
UPDATE `players` UPDATE `players`
SET `account_id` = {$auction['storage_account_id']} SET `account_id` = {$auction['storage_account_id']}
WHERE `id` = {$pid} WHERE `id` = {$pid}
LIMIT 1; LIMIT 1;
"); ");
// Hide character from public character list (in pidprofile.php) // Hide character from public character list (in pidprofile.php)
mysql_update(" mysql_update("
UPDATE `znote_players` UPDATE `znote_players`
SET `hide_char` = 1 SET `hide_char` = 1
WHERE `player_id` = {$pid} WHERE `player_id` = {$pid}
LIMIT 1; LIMIT 1;
"); ");
// Remove deposit from account // Remove deposit from account
$afterDeposit = $account['points'] - $deposit; $afterDeposit = $account['points'] - $deposit;
mysql_update(" mysql_update("
UPDATE `znote_accounts` UPDATE `znote_accounts`
SET `points` = {$afterDeposit} SET `points` = {$afterDeposit}
WHERE `account_id` = {$account['id']} WHERE `account_id` = {$account['id']}
LIMIT 1; LIMIT 1;
"); ");
} }
@ -565,7 +565,7 @@ if ($auction['characterAuction']) {
$time = time(); $time = time();
// If original account is the one trying to get it back, // If original account is the one trying to get it back,
// and bidding period is over, // and bidding period is over,
// and its not labelled as sold // and its not labeled as sold
// and nobody has bid on it // and nobody has bid on it
$character = mysql_select_single(" $character = mysql_select_single("
SELECT `player_id` SELECT `player_id`
@ -573,9 +573,9 @@ if ($auction['characterAuction']) {
WHERE `id`= {$zaid} WHERE `id`= {$zaid}
AND `original_account_id` = {$this_account_id} AND `original_account_id` = {$this_account_id}
AND `time_end` <= {$time} AND `time_end` <= {$time}
AND `bidder_account_id` = 0 AND `bidder_account_id` = 0
AND `bid` = 0 AND `bid` = 0
AND `sold` = 0 AND `sold` = 0
LIMIT 1 LIMIT 1
"); ");
//data_dump($character, false, "Character"); //data_dump($character, false, "Character");
@ -583,22 +583,22 @@ if ($auction['characterAuction']) {
// Move character to buyer account and give it a new name // Move character to buyer account and give it a new name
mysql_update(" mysql_update("
UPDATE `players` UPDATE `players`
SET `account_id` = {$this_account_id} SET `account_id` = {$this_account_id}
WHERE `id` = {$character['player_id']} WHERE `id` = {$character['player_id']}
LIMIT 1; LIMIT 1;
"); ");
// Set label to sold // Set label to sold
mysql_update(" mysql_update("
UPDATE `znote_auction_player` UPDATE `znote_auction_player`
SET `sold` = 1 SET `sold` = 1
WHERE `id`= {$zaid} WHERE `id`= {$zaid}
LIMIT 1; LIMIT 1;
"); ");
// Show character in public character list (in characterprofile.php) // Show character in public character list (in characterprofile.php)
mysql_update(" mysql_update("
UPDATE `znote_players` UPDATE `znote_players`
SET `hide_char` = 0 SET `hide_char` = 0
WHERE `player_id` = {$character['player_id']} WHERE `player_id` = {$character['player_id']}
LIMIT 1; LIMIT 1;
"); ");
} }
@ -650,56 +650,56 @@ if ($auction['characterAuction']) {
// end name validation // end name validation
if (empty($errors)) { if (empty($errors)) {
// Make sure you have access to claim this zaid character. // 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... // And that the character isn't online...
$character = mysql_select_single(" $character = mysql_select_single("
SELECT SELECT
`za`.`id` AS `zaid`, `za`.`id` AS `zaid`,
`za`.`player_id`, `za`.`player_id`,
`p`.`account_id` `p`.`account_id`
FROM `znote_auction_player` za FROM `znote_auction_player` za
INNER JOIN `players` p INNER JOIN `players` p
ON `za`.`player_id` = `p`.`id` ON `za`.`player_id` = `p`.`id`
LEFT JOIN `players_online` po LEFT JOIN `players_online` po
ON `p`.`id` = `po`.`player_id` ON `p`.`id` = `po`.`player_id`
WHERE `za`.`id` = {$zaid} WHERE `za`.`id` = {$zaid}
AND `za`.`sold` = 1 AND `za`.`sold` = 1
AND `p`.`account_id` != {$this_account_id} AND `p`.`account_id` != {$this_account_id}
AND `za`.`bidder_account_id` = {$this_account_id} AND `za`.`bidder_account_id` = {$this_account_id}
AND `po`.`player_id` IS NULL AND `po`.`player_id` IS NULL
"); ");
//data_dump($character, false, "Character"); //data_dump($character, false, "Character");
if ($character !== false) { if ($character !== false) {
// Set character to claimed // Set character to claimed
mysql_update(" mysql_update("
UPDATE `znote_auction_player` UPDATE `znote_auction_player`
SET `claimed`='1' SET `claimed`='1'
WHERE `id` = {$character['zaid']} WHERE `id` = {$character['zaid']}
"); ");
// Move character to buyer account and give it a new name // Move character to buyer account and give it a new name
mysql_update(" mysql_update("
UPDATE `players` UPDATE `players`
SET `name` = '{$name}', SET `name` = '{$name}',
`account_id` = {$this_account_id} `account_id` = {$this_account_id}
WHERE `id` = {$character['player_id']} WHERE `id` = {$character['player_id']}
LIMIT 1; LIMIT 1;
"); ");
// Show character in public character list (in characterprofile.php) // Show character in public character list (in characterprofile.php)
mysql_update(" mysql_update("
UPDATE `znote_players` UPDATE `znote_players`
SET `hide_char` = 0 SET `hide_char` = 0
WHERE `player_id` = {$character['player_id']} WHERE `player_id` = {$character['player_id']}
LIMIT 1; LIMIT 1;
"); ");
// Remove character from other players VIP lists // Remove character from other players VIP lists
mysql_delete(" mysql_delete("
DELETE FROM `account_viplist` DELETE FROM `account_viplist`
WHERE `player_id` = {$character['player_id']} WHERE `player_id` = {$character['player_id']}
"); ");
// Remove the character deathlist // Remove the character deathlist
mysql_delete(" mysql_delete("
DELETE FROM `player_deaths` DELETE FROM `player_deaths`
WHERE `player_id` = {$character['player_id']} WHERE `player_id` = {$character['player_id']}
"); ");
} else { } 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."; $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"> <table class="auction_error">
<tr class="yellow"> <tr class="yellow">
<td>#</td> <td>#</td>
<td>Issues occured while claiming your name</td> <td>Issues occurred while claiming your name</td>
</tr> </tr>
<?php foreach($errors as $i => $error): ?> <?php foreach($errors as $i => $error): ?>
<tr> <tr>
@ -734,28 +734,28 @@ if ($auction['characterAuction']) {
// If this account have successfully bought or won an auction // If this account have successfully bought or won an auction
// Intercept the list action and let the user do claim actions // Intercept the list action and let the user do claim actions
$pending = mysql_select_multi(" $pending = mysql_select_multi("
SELECT SELECT
`za`.`id` AS `zaid`, `za`.`id` AS `zaid`,
CASE WHEN `za`.`price` > `za`.`bid` CASE WHEN `za`.`price` > `za`.`bid`
THEN `za`.`price` THEN `za`.`price`
ELSE `za`.`bid` ELSE `za`.`bid`
END AS `price`, END AS `price`,
`za`.`time_begin`, `za`.`time_begin`,
`za`.`time_end`, `za`.`time_end`,
`p`.`vocation`, `p`.`vocation`,
`p`.`level`, `p`.`level`,
`p`.`lookbody` AS `body`, `p`.`lookbody` AS `body`,
`p`.`lookfeet` AS `feet`, `p`.`lookfeet` AS `feet`,
`p`.`lookhead` AS `head`, `p`.`lookhead` AS `head`,
`p`.`looklegs` AS `legs`, `p`.`looklegs` AS `legs`,
`p`.`looktype` AS `type`, `p`.`looktype` AS `type`,
`p`.`lookaddons` AS `addons` `p`.`lookaddons` AS `addons`
FROM `znote_auction_player` za FROM `znote_auction_player` za
INNER JOIN `players` p INNER JOIN `players` p
ON `za`.`player_id` = `p`.`id` 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`.`claimed` = 0
AND `za`.`sold` = 1 AND `za`.`sold` = 1
AND `za`.`bidder_account_id` = {$this_account_id} AND `za`.`bidder_account_id` = {$this_account_id}
ORDER BY `p`.`level` desc ORDER BY `p`.`level` desc
"); ");
@ -803,25 +803,25 @@ if ($auction['characterAuction']) {
// Show the list // Show the list
$characters = mysql_select_multi(" $characters = mysql_select_multi("
SELECT SELECT
`za`.`id` AS `zaid`, `za`.`id` AS `zaid`,
CASE WHEN `za`.`price` > `za`.`bid` CASE WHEN `za`.`price` > `za`.`bid`
THEN `za`.`price` THEN `za`.`price`
ELSE `za`.`bid`+{$step} ELSE `za`.`bid`+{$step}
END AS `price`, END AS `price`,
`za`.`time_begin`, `za`.`time_begin`,
`za`.`time_end`, `za`.`time_end`,
`p`.`vocation`, `p`.`vocation`,
`p`.`level`, `p`.`level`,
`p`.`lookbody` AS `body`, `p`.`lookbody` AS `body`,
`p`.`lookfeet` AS `feet`, `p`.`lookfeet` AS `feet`,
`p`.`lookhead` AS `head`, `p`.`lookhead` AS `head`,
`p`.`looklegs` AS `legs`, `p`.`looklegs` AS `legs`,
`p`.`looktype` AS `type`, `p`.`looktype` AS `type`,
`p`.`lookaddons` AS `addons` `p`.`lookaddons` AS `addons`
FROM `znote_auction_player` za FROM `znote_auction_player` za
INNER JOIN `players` p INNER JOIN `players` p
ON `za`.`player_id` = `p`.`id` 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 AND `za`.`sold` = 0
ORDER BY `p`.`level` desc; ORDER BY `p`.`level` desc;
"); ");
@ -831,7 +831,7 @@ if ($auction['characterAuction']) {
<p>Admin: <a href="/admin_auction.php">Character auction history</a></p> <p>Admin: <a href="/admin_auction.php">Character auction history</a></p>
<?php <?php
} }
if (is_array($characters) && !empty($characters)): if (is_array($characters) && !empty($characters)):
?> ?>
<table class="auction_char"> <table class="auction_char">
<tr class="yellow"> <tr class="yellow">
@ -875,20 +875,20 @@ if ($auction['characterAuction']) {
$minToCreate = (int)ceil(($auction['lowestPrice'] / 100) * $auction['deposit']); $minToCreate = (int)ceil(($auction['lowestPrice'] / 100) * $auction['deposit']);
$own_characters = mysql_select_multi(" $own_characters = mysql_select_multi("
SELECT SELECT
`p`.`id`, `p`.`id`,
`p`.`name`, `p`.`name`,
`p`.`level`, `p`.`level`,
`p`.`vocation`, `p`.`vocation`,
`a`.`points` `a`.`points`
FROM `players` p FROM `players` p
INNER JOIN `znote_accounts` a INNER JOIN `znote_accounts` a
ON `p`.`account_id` = `a`.`account_id` ON `p`.`account_id` = `a`.`account_id`
LEFT JOIN `znote_auction_player` za LEFT JOIN `znote_auction_player` za
ON `p`.`id` = `za`.`player_id` ON `p`.`id` = `za`.`player_id`
AND `p`.`account_id` = `za`.`original_account_id` AND `p`.`account_id` = `za`.`original_account_id`
AND `za`.`claimed` = 0 AND `za`.`claimed` = 0
LEFT JOIN `players_online` po LEFT JOIN `players_online` po
ON `p`.`id` = `po`.`player_id` ON `p`.`id` = `po`.`player_id`
WHERE `p`.`account_id`={$this_account_id} WHERE `p`.`account_id`={$this_account_id}
AND `za`.`player_id` IS NULL AND `za`.`player_id` IS NULL
AND `po`.`player_id` IS NULL AND `po`.`player_id` IS NULL
@ -905,7 +905,7 @@ if ($auction['characterAuction']) {
<input type="hidden" name="action" value="add"> <input type="hidden" name="action" value="add">
<p>Character: (Must be offline)</p> <p>Character: (Must be offline)</p>
<select name="pid"> <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): ?> foreach($own_characters as $char): ?>
<option value="<?php echo $char['id']; ?>"> <option value="<?php echo $char['id']; ?>">
<?php echo "Level: ", $char['level'], " ", vocation_id_to_name($char['vocation']), ": ", $char['name']; ?> <?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>"; } 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'; <?php require_once 'engine/init.php'; include 'layout/overall/header.php';
if ($config['log_ip']) { if ($config['log_ip']) {
znote_visitor_insert_detailed_data(4); znote_visitor_insert_detailed_data(4);
} }
@ -323,7 +323,7 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
<div class="inventory_outfit"> <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"> <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> </div>
<?php endif; ?> <?php endif; ?>
</div> </div>
<?php endif; ?> <?php endif; ?>
@ -456,15 +456,15 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
border-radius: 3px; border-radius: 3px;
} }
#piv_flex .itm { background-image: url("/engine/img/bg.png"); } #piv_flex .itm { background-image: url("/engine/img/bg.png"); }
#piv_flex .itm-1 { left: 48px; top: 39px; } #piv_flex .itm-1 { left: 48px; top: 39px; }
#piv_flex .itm-2 { left: 11px; top: 53px; } #piv_flex .itm-2 { left: 11px; top: 53px; }
#piv_flex .itm-3 { left: 85px; top: 53px; } #piv_flex .itm-3 { left: 85px; top: 53px; }
#piv_flex .itm-4 { left: 48px; top: 76px; } #piv_flex .itm-4 { left: 48px; top: 76px; }
#piv_flex .itm-5 { left: 85px; top: 90px; } #piv_flex .itm-5 { left: 85px; top: 90px; }
#piv_flex .itm-6 { left: 11px; top: 90px; } #piv_flex .itm-6 { left: 11px; top: 90px; }
#piv_flex .itm-7 { left: 48px; top: 113px; } #piv_flex .itm-7 { left: 48px; top: 113px; }
#piv_flex .itm-8 { left: 48px; top: 150px; } #piv_flex .itm-8 { left: 48px; top: 150px; }
#piv_flex .itm-9 { left: 11px; top: 127px; } #piv_flex .itm-9 { left: 11px; top: 127px; }
#piv_flex .itm-10 { left: 85px; top: 127px; } #piv_flex .itm-10 { left: 85px; top: 127px; }
#piv_cap { #piv_cap {
position: absolute; position: absolute;
@ -589,24 +589,24 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
/* Outfit column positions */ /* Outfit column positions */
<?php for ($column = 1; $column <= $outfit_columns; $column++): ?> <?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; ?> <?php endfor; ?>
/* Outfit row positions */ /* Outfit row positions */
<?php for ($row = 1; $row <= $outfit_rows; $row++): ?> <?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; ?> <?php endfor; ?>
#piv_o_container .o.grayimg { #piv_o_container .o.grayimg {
filter: none; filter: none;
-webkit-filter: grayscale(100%); -webkit-filter: grayscale(100%);
-moz-filter: grayscale(100%); -moz-filter: grayscale(100%);
-ms-filter: grayscale(100%); -ms-filter: grayscale(100%);
-o-filter: grayscale(100%); -o-filter: grayscale(100%);
opacity: .5; opacity: .5;
filter: alpha(opacity=50); filter: alpha(opacity=50);
margin-left: -25pt; margin-left: -25pt;
margin-top: -25px; margin-top: -25px;
} }
</style> </style>
</td> </td>
@ -650,7 +650,7 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
<!-- <div id="accordion"> <!-- <div id="accordion">
<h3>Show/hide player achievements</h3> <h3>Show/hide player achievements</h3>
<div> <div>
</div> </div>
</div><br> --> </div><br> -->
<input type="checkbox" id="ac_toggle_hide" name="ac_toggle_hide"> <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']) $mostdmg = ($d['mostdamage_is_player'])
? "<a href='characterprofile.php?name=".$d['mostdamage_by']."'>".$d['mostdamage_by']."</a>" ? "<a href='characterprofile.php?name=".$d['mostdamage_by']."'>".$d['mostdamage_by']."</a>"
: $d['mostdamage_by']; : $d['mostdamage_by'];
echo "<br>and by $mostdmg."; echo "<br>and by $mostdmg.";
if ($d['mostdamage_unjustified']) { if ($d['mostdamage_unjustified']) {
echo " <font color='red' style='font-style: italic;'>(unjustified)</font>"; echo " <font color='red' style='font-style: italic;'>(unjustified)</font>";
} }
@ -824,15 +824,15 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
?> ?>
</tbody> </tbody>
</table> </table>
<!-- QUEST PROGRESSION --> <!-- QUEST PROGRESSION -->
<?php <?php
$totalquests = 0; $totalquests = 0;
$completedquests = 0; $completedquests = 0;
$firstrun = 1; $firstrun = 1;
if ($config['EnableQuests'] == true) { if ($config['EnableQuests'] == true) {
$sqlquests = mysql_select_multi(" $sqlquests = mysql_select_multi("
SELECT `player_id`, `key`, `value` SELECT `player_id`, `key`, `value`
FROM player_storage FROM player_storage
WHERE `player_id` = {$user_id} WHERE `player_id` = {$user_id}
@ -941,4 +941,4 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
} else { } else {
header('Location: index.php'); 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. // CURL enabled. Lets create an API web request to github.
$request = curl_init(); $request = curl_init();
curl_setopt($request, CURLOPT_URL, 'https://api.github.com/repos/Znote/ZnoteAAC/contributors'); 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_USERAGENT, 'ZnoteAAC'); // GitHub requires user agent header.
curl_setopt($request, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($request, CURLOPT_SSL_VERIFYPEER, false);
// Load contributors and close the request. // Load contributors and close the request.
$developers = json_decode(curl_exec($request), true); // Sorted by contributions. $developers = json_decode(curl_exec($request), true); // Sorted by contributions.
curl_close($request); curl_close($request);
@ -83,4 +83,4 @@ endif;
text-align: center; text-align: center;
} }
</style> </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 (!isset($version)) $version = '1.5_SVN';
if (!function_exists("elapsedTime")) { if (!function_exists("elapsedTime")) {
function elapsedTime($l_start = false, $l_time = false) { function elapsedTime($l_start = false, $l_time = false) {
if ($l_start === false) global $l_start; if ($l_start === false) global $l_start;
if ($l_time === false) global $l_time; if ($l_time === false) global $l_time;
$l_time = explode(' ', microtime()); $l_time = explode(' ', microtime());
$l_finish = $l_time[1] + $l_time[0]; $l_finish = $l_time[1] + $l_time[0];
return round(($l_finish - $l_start), 4); return round(($l_finish - $l_start), 4);
} }
} }
// ALTER TABLE `znote_accounts` ADD `active_email` TINYINT(4) NOT NULL DEFAULT '0' AFTER `active`; // 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']); $connect = new mysqli($config['sqlHost'], $config['sqlUser'], $config['sqlPassword'], $config['sqlDatabase']);
if ($connect->connect_errno) { 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) { function mysql_znote_escape_string($escapestr) {
global $connect; global $connect;
return mysqli_real_escape_string($connect, $escapestr); return mysqli_real_escape_string($connect, $escapestr);
} }
// Select single row from database // Select single row from database
function mysql_select_single($query) { function mysql_select_single($query) {
global $connect; global $connect;
global $aacQueries; global $aacQueries;
$aacQueries++; $aacQueries++;
global $accQueriesData; global $accQueriesData;
$accQueriesData[] = "[" . elapsedTime() . "] " . $query; $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)); $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); $row = mysqli_fetch_assoc($result);
return !empty($row) ? $row : false; return !empty($row) ? $row : false;
} }
// Selecting multiple rows from database. // Selecting multiple rows from database.
function mysql_select_multi($query){ function mysql_select_multi($query){
global $connect; global $connect;
global $aacQueries; global $aacQueries;
$aacQueries++; $aacQueries++;
global $accQueriesData; global $accQueriesData;
$accQueriesData[] = "[" . elapsedTime() . "] " . $query; $accQueriesData[] = "[" . elapsedTime() . "] " . $query;
$array = array(); $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)); $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)) { while($row = mysqli_fetch_assoc($results)) {
$array[] = $row; $array[] = $row;
} }
return !empty($array) ? $array : false; return !empty($array) ? $array : false;
} }
////// //////
@ -81,11 +82,11 @@ function mysql_insert($query){ voidQuery($query); }
function mysql_delete($query){ voidQuery($query); } function mysql_delete($query){ voidQuery($query); }
// Send a void query // Send a void query
function voidQuery($query) { function voidQuery($query) {
global $connect; global $connect;
global $aacQueries; global $aacQueries;
$aacQueries++; $aacQueries++;
global $accQueriesData; global $accQueriesData;
$accQueriesData[] = "[" . elapsedTime() . "] " . $query; $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)); 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 //send the message, check for errors
$status = false; $status = false;
if (!$mail->send()) { if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo; echo "Mailer Error: " . $mail->ErrorInfo;
exit(); exit();
} else { } else {
$status = true; $status = true;
} }
return $status; return $status;
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -4,7 +4,7 @@ $cache = new Cache('engine/cache/support');
if ($cache->hasExpired()) { if ($cache->hasExpired()) {
// Fetch all staffs in-game. // Fetch all staffs in-game.
if ($config['ServerEngine'] == 'TFS_03') { if ($config['ServerEngine'] == 'TFS_03') {
$staffs = support_list03(); $staffs = support_list03();
} else $staffs = support_list(); } else $staffs = support_list();
// Fetch group ids and names from config.php // Fetch group ids and names from config.php
$groups = $config['ingame_positions']; $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 the results
$cache = new Cache('engine/cache/topGuilds'); $cache = new Cache('engine/cache/topGuilds');
if ($cache->hasExpired()) { 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;"); $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->setContent($guilds);
$cache->save(); $cache->save();
} else { } else {
$guilds = $cache->load(); $guilds = $cache->load();
} }
$count = 1; $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) { function convert_number_to_words($number) {
return $negative . convert_number_to_words(abs($number));
} $hyphen = '-';
$conjunction = ' and ';
$string = $fraction = null; $separator = ', ';
$negative= 'negative ';
if (strpos($number, '.') !== false) { $decimal = ' point ';
list($number, $fraction) = explode('.', $number); $dictionary = array(
} 0 => 'zero',
1 => 'first',
switch (true) { 2 => 'second',
case $number < 21: 3 => 'third',
$string = $dictionary[$number]; 4 => 'fourth',
break; 5 => 'fifth',
case $number < 100: 6 => 'sixth',
$tens = ((int) ($number / 10)) * 10; 7 => 'seventh',
$units = $number % 10; 8 => 'eighth',
$string = $dictionary[$tens]; 9 => 'ninth',
if ($units) { 10 => 'tenth',
$string .= $hyphen . $dictionary[$units]; 11 => 'eleventh',
} 12 => 'twelve',
break; 13 => 'thirteen',
case $number < 1000: 14 => 'fourteen',
$hundreds = $number / 100; 15 => 'fifteen',
$remainder = $number % 100; 16 => 'sixteen',
$string = $dictionary[$hundreds] . ' ' . $dictionary[100]; 17 => 'seventeen',
if ($remainder) { 18 => 'eighteen',
$string .= $conjunction . convert_number_to_words($remainder); 19 => 'nineteen',
} 20 => 'twenty',
break; 30 => 'thirty',
default: 40 => 'fourty',
$baseUnit = pow(1000, floor(log($number, 1000))); 50 => 'fifty',
$numBaseUnits = (int) ($number / $baseUnit); 60 => 'sixty',
$remainder = $number % $baseUnit; 70 => 'seventy',
$string = convert_number_to_words($numBaseUnits) . ' ' . $dictionary[$baseUnit]; 80 => 'eighty',
if ($remainder) { 90 => 'ninety',
$string .= $remainder < 100 ? $conjunction : $separator; 100 => 'hundred',
$string .= convert_number_to_words($remainder); 1000 => 'thousand',
} 1000000 => 'million',
break; 1000000000 => 'billion',
} 1000000000000 => 'trillion',
1000000000000000 => 'quadrillion',
if (null !== $fraction && is_numeric($fraction)) { 1000000000000000000 => 'quintillion'
$string .= $decimal; );
$words = array();
foreach (str_split((string) $fraction) as $number) { if (!is_numeric($number)) {
$words[] = $dictionary[$number]; return false;
} }
$string .= implode(' ', $words);
} if (($number >= 0 && (int) $number < 0) || (int) $number < 0 - PHP_INT_MAX) {
// overflow
return $string; 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"> <table id="onlinelistTable" class="table table-striped table-hover">
<tr class="yellow"> <tr class="yellow">
<b><tr><h3><center>Top 10 guilds with most frags</center></h3></tr></b> <b><tr><h3><center>Top 10 guilds with most frags</center></h3></tr></b>
<th>#</th> <th>#</th>
<th>Name:</th> <th>Name:</th>
<th>Frags:</th> <th>Frags:</th>
</tr> </tr>
<?php foreach ($guilds as $guild) { <?php foreach ($guilds as $guild) {
$url = url("guilds.php?name=". $guild['name']); $url = url("guilds.php?name=". $guild['name']);
echo '<tr class="special" onclick="javascript:window.location.href=\'' . $url . '\'">'; ?> echo '<tr class="special" onclick="javascript:window.location.href=\'' . $url . '\'">'; ?>
<td><?php echo convert_number_to_words($count); <td><?php echo convert_number_to_words($count);
$count++; ?></td> $count++; ?></td>
<td><a href="" onclick="return false"><?php echo $guild['name']; ?></a></td> <td><a href="" onclick="return false"><?php echo $guild['name']; ?></a></td>
<td><?php echo $guild['frags']; ?></td> <td><?php echo $guild['frags']; ?></td>
</tr> </tr>
<?php } ?> <?php } ?>
</table> </table>
<?php <?php
} else echo '<h1>No frags yet.</h1>'; } else echo '<h1>No frags yet.</h1>';
include 'layout/overall/footer.php'; ?> 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> <a class="twitter-timeline" href="https://twitter.com/ZnoteAAC" data-widget-id="353297614114021376">Tweets from @ZnoteAAC</a>
<script> <script>
!function(d,s,id){ !function(d,s,id){
var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https'; var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';
if(!d.getElementById(id)){ if(!d.getElementById(id)){
js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js"; js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js,fjs); fjs.parentNode.insertBefore(js,fjs);
} }
}(document,"script","twitter-wjs"); }(document,"script","twitter-wjs");
</script> </script>