mirror of
https://github.com/Znote/ZnoteAAC.git
synced 2025-06-07 21:34:31 +02:00
Compare commits
23 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
13c0be7d7e | ||
![]() |
e26896fbff | ||
![]() |
e518cd1b1b | ||
![]() |
3d42e8a7ec | ||
![]() |
ee351e7ada | ||
![]() |
9b6d8d93d8 | ||
![]() |
b482b77d7b | ||
![]() |
a7fed3bfe3 | ||
![]() |
d914c93085 | ||
![]() |
f7445bb89a | ||
![]() |
ae07a0f421 | ||
![]() |
bc76e8cb65 | ||
![]() |
9898bb27f5 | ||
![]() |
f011f782bd | ||
![]() |
f896b59e36 | ||
![]() |
0e941b2c1e | ||
![]() |
8f5487db2b | ||
![]() |
9e790a71f6 | ||
![]() |
ac2b909805 | ||
![]() |
400497bd25 | ||
![]() |
8a71f19db0 | ||
![]() |
e40e811b72 | ||
![]() |
2ec9cfbff4 |
@ -25,23 +25,23 @@ end
|
|||||||
|
|
||||||
-- SQL Query to execute: --
|
-- SQL Query to execute: --
|
||||||
--[[
|
--[[
|
||||||
ALTER TABLE `znote_players` ADD `exphist_lastexp` BIGINT UNSIGNED NOT NULL DEFAULT '0',
|
ALTER TABLE `znote_players` ADD `exphist_lastexp` BIGINT NOT NULL DEFAULT '0',
|
||||||
ADD `exphist1` BIGINT UNSIGNED NOT NULL DEFAULT '0',
|
ADD `exphist1` BIGINT NOT NULL DEFAULT '0',
|
||||||
ADD `exphist2` BIGINT UNSIGNED NOT NULL DEFAULT '0',
|
ADD `exphist2` BIGINT NOT NULL DEFAULT '0',
|
||||||
ADD `exphist3` BIGINT UNSIGNED NOT NULL DEFAULT '0',
|
ADD `exphist3` BIGINT NOT NULL DEFAULT '0',
|
||||||
ADD `exphist4` BIGINT UNSIGNED NOT NULL DEFAULT '0',
|
ADD `exphist4` BIGINT NOT NULL DEFAULT '0',
|
||||||
ADD `exphist5` BIGINT UNSIGNED NOT NULL DEFAULT '0',
|
ADD `exphist5` BIGINT NOT NULL DEFAULT '0',
|
||||||
ADD `exphist6` BIGINT UNSIGNED NOT NULL DEFAULT '0',
|
ADD `exphist6` BIGINT NOT NULL DEFAULT '0',
|
||||||
ADD `exphist7` BIGINT UNSIGNED NOT NULL DEFAULT '0',
|
ADD `exphist7` BIGINT NOT NULL DEFAULT '0',
|
||||||
ADD `onlinetimetoday` BIGINT NOT NULL DEFAULT '0',
|
ADD `onlinetimetoday` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
|
||||||
ADD `onlinetime1` BIGINT NOT NULL DEFAULT '0',
|
ADD `onlinetime1` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
|
||||||
ADD `onlinetime2` BIGINT NOT NULL DEFAULT '0',
|
ADD `onlinetime2` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
|
||||||
ADD `onlinetime3` BIGINT NOT NULL DEFAULT '0',
|
ADD `onlinetime3` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
|
||||||
ADD `onlinetime4` BIGINT NOT NULL DEFAULT '0',
|
ADD `onlinetime4` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
|
||||||
ADD `onlinetime5` BIGINT NOT NULL DEFAULT '0',
|
ADD `onlinetime5` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
|
||||||
ADD `onlinetime6` BIGINT NOT NULL DEFAULT '0',
|
ADD `onlinetime6` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
|
||||||
ADD `onlinetime7` BIGINT NOT NULL DEFAULT '0',
|
ADD `onlinetime7` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
|
||||||
ADD `onlinetimeall` BIGINT NOT NULL DEFAULT '0';
|
ADD `onlinetimeall` INT UNSIGNED NOT NULL DEFAULT '0';
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
-- after that execute: --
|
-- after that execute: --
|
||||||
|
@ -25,23 +25,23 @@ end
|
|||||||
|
|
||||||
-- SQL Query to execute: --
|
-- SQL Query to execute: --
|
||||||
--[[
|
--[[
|
||||||
ALTER TABLE `znote_players` ADD `exphist_lastexp` BIGINT UNSIGNED NOT NULL DEFAULT '0',
|
ALTER TABLE `znote_players` ADD `exphist_lastexp` BIGINT NOT NULL DEFAULT '0',
|
||||||
ADD `exphist1` BIGINT UNSIGNED NOT NULL DEFAULT '0',
|
ADD `exphist1` BIGINT NOT NULL DEFAULT '0',
|
||||||
ADD `exphist2` BIGINT UNSIGNED NOT NULL DEFAULT '0',
|
ADD `exphist2` BIGINT NOT NULL DEFAULT '0',
|
||||||
ADD `exphist3` BIGINT UNSIGNED NOT NULL DEFAULT '0',
|
ADD `exphist3` BIGINT NOT NULL DEFAULT '0',
|
||||||
ADD `exphist4` BIGINT UNSIGNED NOT NULL DEFAULT '0',
|
ADD `exphist4` BIGINT NOT NULL DEFAULT '0',
|
||||||
ADD `exphist5` BIGINT UNSIGNED NOT NULL DEFAULT '0',
|
ADD `exphist5` BIGINT NOT NULL DEFAULT '0',
|
||||||
ADD `exphist6` BIGINT UNSIGNED NOT NULL DEFAULT '0',
|
ADD `exphist6` BIGINT NOT NULL DEFAULT '0',
|
||||||
ADD `exphist7` BIGINT UNSIGNED NOT NULL DEFAULT '0',
|
ADD `exphist7` BIGINT NOT NULL DEFAULT '0',
|
||||||
ADD `onlinetimetoday` BIGINT NOT NULL DEFAULT '0',
|
ADD `onlinetimetoday` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
|
||||||
ADD `onlinetime1` BIGINT NOT NULL DEFAULT '0',
|
ADD `onlinetime1` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
|
||||||
ADD `onlinetime2` BIGINT NOT NULL DEFAULT '0',
|
ADD `onlinetime2` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
|
||||||
ADD `onlinetime3` BIGINT NOT NULL DEFAULT '0',
|
ADD `onlinetime3` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
|
||||||
ADD `onlinetime4` BIGINT NOT NULL DEFAULT '0',
|
ADD `onlinetime4` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
|
||||||
ADD `onlinetime5` BIGINT NOT NULL DEFAULT '0',
|
ADD `onlinetime5` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
|
||||||
ADD `onlinetime6` BIGINT NOT NULL DEFAULT '0',
|
ADD `onlinetime6` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
|
||||||
ADD `onlinetime7` BIGINT NOT NULL DEFAULT '0',
|
ADD `onlinetime7` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
|
||||||
ADD `onlinetimeall` BIGINT NOT NULL DEFAULT '0';
|
ADD `onlinetimeall` INT UNSIGNED NOT NULL DEFAULT '0';
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
-- after that execute: --
|
-- after that execute: --
|
||||||
|
@ -1,6 +1,14 @@
|
|||||||
ZnoteAAC
|
ZnoteAAC
|
||||||
========
|
========
|
||||||
[](https://www.codefactor.io/repository/github/znote/znoteaac)
|
[](https://www.codefactor.io/repository/github/znote/znoteaac)
|
||||||
|
### Branch: v2
|
||||||
|
The purpose of this branch is to server as code cleanup, and strip distro compatibility for anything below TFS 1.4.
|
||||||
|
I want to refactor some code, try to get Znote AAC a bit more lightweight. Remove single-use functions from globally included function files etc.
|
||||||
|
|
||||||
|
New features and bugfixes might arrive here first, and then backported to 1.5/6 (master branch).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
### What is Znote AAC?
|
### What is Znote AAC?
|
||||||
|
|
||||||
Znote AAC is a full-fledged website used together with an Open Tibia(OT) server.
|
Znote AAC is a full-fledged website used together with an Open Tibia(OT) server.
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
// Verify the PHP version, gives tutorial if fail.
|
// Verify the PHP version, gives tutorial if fail.
|
||||||
if (version_compare(phpversion(), '5.3.3', '<')) die('PHP 5.3.3 or higher is required');
|
if (version_compare(phpversion(), '7.2', '<')) die('PHP version 7.2 or higher is required.');
|
||||||
if (!isset($filepath)) $filepath = '../';
|
if (!isset($filepath)) $filepath = '../';
|
||||||
|
|
||||||
$version = '1.5_SVN';
|
$version = '2.0_DEV';
|
||||||
session_start();
|
session_start();
|
||||||
ob_start();
|
ob_start();
|
||||||
require_once $filepath.'config.php';
|
require_once $filepath.'config.php';
|
||||||
|
$sessionPrefix = $config['session_prefix'];
|
||||||
|
|
||||||
require_once $filepath.'engine/database/connect.php';
|
require_once $filepath.'engine/database/connect.php';
|
||||||
require_once $filepath.'engine/function/general.php';
|
require_once $filepath.'engine/function/general.php';
|
||||||
require_once $filepath.'engine/function/cache.php';
|
require_once $filepath.'engine/function/cache.php';
|
||||||
|
@ -54,6 +54,7 @@ if (user_logged_in()) {
|
|||||||
<h1>Changelog</h1>
|
<h1>Changelog</h1>
|
||||||
<?php
|
<?php
|
||||||
$cache = new Cache('engine/cache/changelog');
|
$cache = new Cache('engine/cache/changelog');
|
||||||
|
$cache->useMemory(false);
|
||||||
if ($updateCache === true) {
|
if ($updateCache === true) {
|
||||||
$changelogs = mysql_select_multi("SELECT `id`, `text`, `time`, `report_id`, `status` FROM `znote_changelog` ORDER BY `id` DESC;");
|
$changelogs = mysql_select_multi("SELECT `id`, `text`, `time`, `report_id`, `status` FROM `znote_changelog` ORDER BY `id` DESC;");
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
|
|||||||
if ($user_id !== false) {
|
if ($user_id !== false) {
|
||||||
$loadOutfits = $config['show_outfits']['characterprofile'];
|
$loadOutfits = $config['show_outfits']['characterprofile'];
|
||||||
|
|
||||||
if ($config['ServerEngine'] == 'TFS_10') {
|
|
||||||
if (!$loadOutfits) {
|
if (!$loadOutfits) {
|
||||||
$profile_data = user_character_data($user_id, 'account_id', 'name', 'level', 'group_id', 'vocation', 'health', 'healthmax', 'experience', 'mana', 'manamax', 'sex', 'lastlogin');
|
$profile_data = user_character_data($user_id, 'account_id', 'name', 'level', 'group_id', 'vocation', 'health', 'healthmax', 'experience', 'mana', 'manamax', 'sex', 'lastlogin');
|
||||||
} else { // Load outfits
|
} else { // Load outfits
|
||||||
@ -27,21 +26,6 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
|
|||||||
$user_id = (int) $user_id;
|
$user_id = (int) $user_id;
|
||||||
$achievementPoints = mysql_select_single("SELECT SUM(`value`) AS `sum` FROM `player_storage` WHERE `key` LIKE '30___' AND `player_id`={$user_id} LIMIT 1");
|
$achievementPoints = mysql_select_single("SELECT SUM(`value`) AS `sum` FROM `player_storage` WHERE `key` LIKE '30___' AND `player_id`={$user_id} LIMIT 1");
|
||||||
}
|
}
|
||||||
} else { // TFS 0.2, 0.3
|
|
||||||
if (!$loadOutfits) {
|
|
||||||
$profile_data = user_character_data($user_id, 'name', 'account_id', 'level', 'group_id', 'vocation', 'health', 'healthmax', 'experience', 'mana', 'manamax', 'lastlogin', 'online', 'sex');
|
|
||||||
} else { // Load outfits
|
|
||||||
if ($config['ServerEngine'] !== 'OTHIRE') {
|
|
||||||
if ($config['client'] < 780) {
|
|
||||||
$profile_data = user_character_data($user_id, 'name', 'account_id', 'level', 'group_id', 'vocation', 'health', 'healthmax', 'experience', 'mana', 'manamax', 'lastlogin', 'online', 'sex', 'lookbody', 'lookfeet', 'lookhead', 'looklegs', 'looktype');
|
|
||||||
} else {
|
|
||||||
$profile_data = user_character_data($user_id, 'name', 'account_id', 'level', 'group_id', 'vocation', 'health', 'healthmax', 'experience', 'mana', 'manamax', 'lastlogin', 'online', 'sex', 'lookbody', 'lookfeet', 'lookhead', 'looklegs', 'looktype', 'lookaddons');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$profile_data = user_character_data($user_id, 'name', 'account_id', 'level', 'group_id', 'vocation', 'health', 'healthmax', 'experience', 'mana', 'manamax', 'lastlogin', 'online', 'sex', 'lookbody', 'lookfeet', 'lookhead', 'looklegs', 'looktype');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$profile_znote_data = user_znote_character_data($user_id, 'created', 'hide_char', 'comment');
|
$profile_znote_data = user_znote_character_data($user_id, 'created', 'hide_char', 'comment');
|
||||||
$guild_exist = false;
|
$guild_exist = false;
|
||||||
@ -82,10 +66,22 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<!-- Player Position -->
|
<!-- Player Position -->
|
||||||
<?php if ($profile_data['group_id'] > 1): ?>
|
<?php if ($profile_data['group_id'] > 1):
|
||||||
|
$position = mysql_select_single("
|
||||||
|
SELECT
|
||||||
|
`a`.`type`
|
||||||
|
FROM `players` AS `p`
|
||||||
|
INNER JOIN `accounts` AS `a`
|
||||||
|
ON `p`.`account_id` = `a`.`id`
|
||||||
|
WHERE
|
||||||
|
`a`.`type` > 1
|
||||||
|
AND `p`.`id` = '{$user_id}'
|
||||||
|
");
|
||||||
|
$position = (isset($config['ingame_positions'][$position['type']])) ? $config['ingame_positions'][$position['type']] : "Unknown";
|
||||||
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Position</td>
|
<td>Position</td>
|
||||||
<td><?php echo group_id_to_name($profile_data['group_id']); ?></td>
|
<td><?php echo $position; ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<!-- Player male / female -->
|
<!-- Player male / female -->
|
||||||
@ -124,19 +120,9 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<!-- Display house start -->
|
<!-- Display house start -->
|
||||||
<?php
|
<?php
|
||||||
if ($config['ServerEngine'] !== 'TFS_02') {
|
|
||||||
// Compatibility fix
|
|
||||||
$column_town_id = array(
|
|
||||||
'OTHIRE' => 'townid',
|
|
||||||
'TFS_03' => 'town'
|
|
||||||
// Default: town_id
|
|
||||||
);
|
|
||||||
$column_town_id = (isset($column_town_id[$config['ServerEngine']]))
|
|
||||||
? $column_town_id[$config['ServerEngine']]
|
|
||||||
: 'town_id';
|
|
||||||
|
|
||||||
$houses = mysql_select_multi("
|
$houses = mysql_select_multi("
|
||||||
SELECT `id`, `owner`, `name`, `{$column_town_id}` AS `town_id`
|
SELECT `id`, `owner`, `name`, `town_id` AS `town_id`
|
||||||
FROM `houses`
|
FROM `houses`
|
||||||
WHERE `owner` = {$user_id};
|
WHERE `owner` = {$user_id};
|
||||||
");
|
");
|
||||||
@ -149,7 +135,6 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
|
|||||||
</tr>
|
</tr>
|
||||||
<?php endforeach;
|
<?php endforeach;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
<!-- Display player status -->
|
<!-- Display player status -->
|
||||||
<tr class="status_<?php echo ($profile_data['online']) ? 'online' : 'offline'; ?>">
|
<tr class="status_<?php echo ($profile_data['online']) ? 'online' : 'offline'; ?>">
|
||||||
@ -180,16 +165,13 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
|
|||||||
AND `pid`<'11'
|
AND `pid`<'11'
|
||||||
");
|
");
|
||||||
|
|
||||||
$soulStamina = (in_array($config['ServerEngine'], ['TFS_10']))
|
$soulStamina = " `soul`, `stamina`,";
|
||||||
? " `soul`, `stamina`,"
|
|
||||||
: " `p`.`soul`, `p`.`stamina`,";
|
|
||||||
|
|
||||||
if ($config['client'] < 780) {
|
if ($config['client'] < 780) {
|
||||||
$soulStamina = " 0 AS `soul`, 0 AS `stamina`,";
|
$soulStamina = " 0 AS `soul`, 0 AS `stamina`,";
|
||||||
}
|
}
|
||||||
|
|
||||||
$player_query = (in_array($config['ServerEngine'], ['TFS_10']))
|
$player_query = "
|
||||||
? /* true */ "SELECT
|
SELECT
|
||||||
`health`, `healthmax`,
|
`health`, `healthmax`,
|
||||||
`mana`, `manamax`,
|
`mana`, `manamax`,
|
||||||
`cap`,
|
`cap`,
|
||||||
@ -205,31 +187,8 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
|
|||||||
`skill_fishing`
|
`skill_fishing`
|
||||||
FROM `players`
|
FROM `players`
|
||||||
WHERE `id`={$user_id}
|
WHERE `id`={$user_id}
|
||||||
LIMIT 1;"
|
LIMIT 1;
|
||||||
: /* false */ "SELECT
|
";
|
||||||
`p`.`health`, `p`.`healthmax`,
|
|
||||||
`p`.`mana`, `p`.`manamax`,
|
|
||||||
`p`.`cap`,
|
|
||||||
`p`.`experience`, `p`.`level`,
|
|
||||||
{$soulStamina}
|
|
||||||
`p`.`maglevel`,
|
|
||||||
`fist`.`value` AS `skill_fist`,
|
|
||||||
`club`.`value` AS `skill_club`,
|
|
||||||
`sword`.`value` AS `skill_sword`,
|
|
||||||
`axe`.`value` AS `skill_axe`,
|
|
||||||
`dist`.`value` AS `skill_dist`,
|
|
||||||
`shield`.`value` AS `skill_shielding`,
|
|
||||||
`fish`.`value` AS `skill_fishing`
|
|
||||||
FROM `players` AS `p`
|
|
||||||
LEFT JOIN `player_skills` AS `fist` ON `p`.`id` = `fist`.`player_id` AND `fist`.`skillid` = 0
|
|
||||||
LEFT JOIN `player_skills` AS `club` ON `p`.`id` = `club`.`player_id` AND `club`.`skillid` = 1
|
|
||||||
LEFT JOIN `player_skills` AS `sword` ON `p`.`id` = `sword`.`player_id` AND `sword`.`skillid` = 2
|
|
||||||
LEFT JOIN `player_skills` AS `axe` ON `p`.`id` = `axe`.`player_id` AND `axe`.`skillid` = 3
|
|
||||||
LEFT JOIN `player_skills` AS `dist` ON `p`.`id` = `dist`.`player_id` AND `dist`.`skillid` = 4
|
|
||||||
LEFT JOIN `player_skills` AS `shield` ON `p`.`id` = `shield`.`player_id` AND `shield`.`skillid` = 5
|
|
||||||
LEFT JOIN `player_skills` AS `fish` ON `p`.`id` = `fish`.`player_id` AND `fish`.`skillid` = 6
|
|
||||||
WHERE `p`.`id`= {$user_id}
|
|
||||||
LIMIT 1;";
|
|
||||||
$playerstats = mysql_select_single($player_query);
|
$playerstats = mysql_select_single($player_query);
|
||||||
|
|
||||||
$playerstats['experience'] = number_format($playerstats['experience'],0,'',',');
|
$playerstats['experience'] = number_format($playerstats['experience'],0,'',',');
|
||||||
@ -252,9 +211,8 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
|
|||||||
[133,134,143,144,145],
|
[133,134,143,144,145],
|
||||||
[146,151,152,153,154],
|
[146,151,152,153,154],
|
||||||
[251,268,273,278,289],
|
[251,268,273,278,289],
|
||||||
[325,328,335,367,430],
|
[325,328,335,367],
|
||||||
[432,463,465,472,512],
|
//430,432,463,465,472,512,516,541,574,577,610,619,633,634,637,665,667,684,695,697,699,725,733,746,750,760,846,853,873,884,899
|
||||||
//516,541,574,577,610,619,633,634,637,665,667,684,695,697,699,725,733,746,750,760,846,853,873,884,899
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$female_outfits = array(
|
$female_outfits = array(
|
||||||
@ -262,9 +220,8 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
|
|||||||
[141,142,147,148,149],
|
[141,142,147,148,149],
|
||||||
[150,155,156,157,158],
|
[150,155,156,157,158],
|
||||||
[252,269,270,279,288],
|
[252,269,270,279,288],
|
||||||
[324,329,336,366,431],
|
[324,329,336,366],
|
||||||
[433,464,466,471,513],
|
//431,433,464,466,471,513,514,542,575,578,618,620,632,635,636,664,666,683,694,696,698,724,732,745,749,759,845,852,874,885,900
|
||||||
//514,542,575,578,618,620,632,635,636,664,666,683,694,696,698,724,732,745,749,759,845,852,874,885,900
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$featured_outfits = ($profile_data['sex'] == 1) ? $male_outfits : $female_outfits;
|
$featured_outfits = ($profile_data['sex'] == 1) ? $male_outfits : $female_outfits;
|
||||||
@ -411,11 +368,15 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
|
|||||||
}
|
}
|
||||||
#piv_flex img {
|
#piv_flex img {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
right: 0;
|
||||||
}
|
}
|
||||||
#piv_i .inventory_outfit {
|
#piv_i .inventory_outfit {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 130px;
|
top: 130px;
|
||||||
left: -24px;
|
left: -24px;
|
||||||
|
width: 64px;
|
||||||
|
height: 64px;
|
||||||
}
|
}
|
||||||
#piv_lifebar {
|
#piv_lifebar {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@ -711,7 +672,6 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
if ($config['ServerEngine'] == 'TFS_10') {
|
|
||||||
$deaths = mysql_select_multi("
|
$deaths = mysql_select_multi("
|
||||||
SELECT
|
SELECT
|
||||||
`player_id`,
|
`player_id`,
|
||||||
@ -770,63 +730,6 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
|
|||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
} elseif ($config['ServerEngine'] == 'TFS_02') {
|
|
||||||
$array = user_fetch_deathlist($user_id);
|
|
||||||
if ($array) {
|
|
||||||
foreach ($array as $value):
|
|
||||||
if ($value['is_player'] == 1) {
|
|
||||||
$value['killed_by'] = 'player: <a href="characterprofile.php?name='. $value['killed_by'] .'">'. $value['killed_by'] .'</a>';
|
|
||||||
} else {
|
|
||||||
$value['killed_by'] = 'monster: '. $value['killed_by'] .'.';
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td><?php echo getClock($value['time'], true, true); ?></td>
|
|
||||||
<td><?php echo 'Killed at level '. $value['level'] .' by '. $value['killed_by']; ?></td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach;
|
|
||||||
} else {
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td colspan="2">This player has never died.</td>
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
} elseif (in_array($config['ServerEngine'], array('TFS_03', 'OTHIRE'))) {
|
|
||||||
//mysql_select_single("SELECT * FROM players WHERE name='TEST DEBUG';");
|
|
||||||
$array = user_fetch_deathlist03($user_id);
|
|
||||||
if ($array) {
|
|
||||||
// Design and present the list
|
|
||||||
foreach ($array as $value):
|
|
||||||
$value[3] = user_get_killer_id(user_get_kid($value['id']));
|
|
||||||
if ($value[3] !== false && $value[3] >= 1) {
|
|
||||||
$namedata = user_character_data((int)$value[3], 'name');
|
|
||||||
if ($namedata !== false) {
|
|
||||||
$value[3] = $namedata['name'];
|
|
||||||
$value[3] = 'player: <a href="characterprofile.php?name='. $value[3] .'">'. $value[3] .'</a>';
|
|
||||||
} else {
|
|
||||||
$value[3] = 'deleted player.';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$value[3] = user_get_killer_m_name(user_get_kid($value['id']));
|
|
||||||
if ($value[3] === false) {
|
|
||||||
$value[3] = 'deleted player.';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td><?php echo getClock($value['date'], true, true); ?></td>
|
|
||||||
<td><?php echo 'Killed at level '. $value['level'] .' by '. $value[3]; ?></td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach;
|
|
||||||
} else {
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td colspan="2">This player has never died.</td>
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -893,14 +796,6 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
|
|||||||
|
|
||||||
<!-- CHARACTER LIST -->
|
<!-- CHARACTER LIST -->
|
||||||
<?php
|
<?php
|
||||||
// Backward compatibility
|
|
||||||
$select_online = "CASE WHEN `l`.`player_id` IS NULL THEN 0 else 1 END as `online`";
|
|
||||||
$join_online = "LEFT JOIN `players_online` as `l` ON `p`.`id` = `l`.`player_id`";
|
|
||||||
if ($config['ServerEngine'] != 'TFS_10') {
|
|
||||||
$select_online = "`p`.`online`";
|
|
||||||
$join_online = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load other visible characters
|
// Load other visible characters
|
||||||
$otherChars = mysql_select_multi("
|
$otherChars = mysql_select_multi("
|
||||||
SELECT
|
SELECT
|
||||||
@ -909,7 +804,7 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
|
|||||||
`p`.`level`,
|
`p`.`level`,
|
||||||
`p`.`vocation`,
|
`p`.`vocation`,
|
||||||
`p`.`lastlogin`,
|
`p`.`lastlogin`,
|
||||||
{$select_online}
|
CASE WHEN `l`.`player_id` IS NULL THEN 0 else 1 END as `online`
|
||||||
FROM `players` as `o`
|
FROM `players` as `o`
|
||||||
JOIN `players` as `p`
|
JOIN `players` as `p`
|
||||||
ON `o`.`account_id` = `p`.`account_id`
|
ON `o`.`account_id` = `p`.`account_id`
|
||||||
@ -917,7 +812,7 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
|
|||||||
ON `p`.`id` = `z`.`player_id`
|
ON `p`.`id` = `z`.`player_id`
|
||||||
LEFT JOIN `znote_players` as `z2`
|
LEFT JOIN `znote_players` as `z2`
|
||||||
ON `o`.`id` = `z2`.`player_id`
|
ON `o`.`id` = `z2`.`player_id`
|
||||||
{$join_online}
|
LEFT JOIN `players_online` as `l` ON `p`.`id` = `l`.`player_id`
|
||||||
WHERE `o`.`id` = {$user_id}
|
WHERE `o`.`id` = {$user_id}
|
||||||
AND `p`.`id` != `o`.`id`
|
AND `p`.`id` != `o`.`id`
|
||||||
AND `z`.`hide_char` = 0
|
AND `z`.`hide_char` = 0
|
||||||
|
14
config.php
14
config.php
@ -658,14 +658,24 @@
|
|||||||
'name' => 'Forgotten' // Must be identical to config.lua (OT config file) server name.
|
'name' => 'Forgotten' // Must be identical to config.lua (OT config file) server name.
|
||||||
);
|
);
|
||||||
|
|
||||||
// How often do you want highscores to update?
|
// How often do you want highscores (cache) to update?
|
||||||
$config['cache_lifespan'] = 5; // 60 * 15; // 15 minutes.
|
$config['cache'] = array(
|
||||||
|
// If you have two instances installed on same server, make each instance prefix unique
|
||||||
|
'prefix' => 'znote_',
|
||||||
|
// 60 * 15; // 15 minutes.
|
||||||
|
'lifespan' => 5,
|
||||||
|
// Store cache in memory/RAM? Requires PHP extension APCu
|
||||||
|
'memory' => true
|
||||||
|
);
|
||||||
|
|
||||||
// WARNING! Account names written here will have admin access to web page!
|
// WARNING! Account names written here will have admin access to web page!
|
||||||
$config['page_admin_access'] = array(
|
$config['page_admin_access'] = array(
|
||||||
'firstaccountName',
|
'firstaccountName',
|
||||||
'secondaccountName',
|
'secondaccountName',
|
||||||
);
|
);
|
||||||
|
// Allow admins to see executed SQL queries overlay
|
||||||
|
// Useful for testing and optimizing query usage on website
|
||||||
|
$config['admin_show_queries'] = true;
|
||||||
|
|
||||||
// Built-in FORUM
|
// Built-in FORUM
|
||||||
// Enable forum, enable guildboards, level to create threads/post in them
|
// Enable forum, enable guildboards, level to create threads/post in them
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
$time = time();
|
$time = time();
|
||||||
if (!isset($version)) $version = '1.5_SVN';
|
if (!isset($version)) $version = '2.0_DEV';
|
||||||
|
|
||||||
if (!function_exists("elapsedTime")) {
|
if (!function_exists("elapsedTime")) {
|
||||||
function elapsedTime($l_start = false, $l_time = false) {
|
function elapsedTime($l_start = false, $l_time = false) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
-- Start of Znote AAC database schema
|
-- Start of Znote AAC database schema
|
||||||
|
|
||||||
SET @znote_version = '1.5_SVN';
|
SET @znote_version = '2.0_DEV';
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `znote` (
|
CREATE TABLE IF NOT EXISTS `znote` (
|
||||||
`id` int NOT NULL AUTO_INCREMENT,
|
`id` int NOT NULL AUTO_INCREMENT,
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class Cache
|
class Cache
|
||||||
{
|
{
|
||||||
protected $_file = false;
|
protected $_file = false;
|
||||||
protected $_lifespan = 0;
|
protected $_lifespan = 0;
|
||||||
protected $_content;
|
protected $_content;
|
||||||
|
protected $_memory = false;
|
||||||
|
protected $_canMemory = false;
|
||||||
|
|
||||||
const EXT = '.cache.php';
|
const EXT = '.cache.php';
|
||||||
|
|
||||||
@ -15,8 +17,22 @@
|
|||||||
* @return void
|
* @return void
|
||||||
**/
|
**/
|
||||||
public function __construct($file) {
|
public function __construct($file) {
|
||||||
|
$cfg = config('cache');
|
||||||
|
|
||||||
|
$this->setExpiration($cfg['lifespan']);
|
||||||
|
if (function_exists('apcu_fetch')) {
|
||||||
|
$this->_canMemory = true;
|
||||||
|
$this->_memory = $cfg['memory'];
|
||||||
|
}
|
||||||
$this->_file = $file . self::EXT;
|
$this->_file = $file . self::EXT;
|
||||||
$this->setExpiration(config('cache_lifespan'));
|
|
||||||
|
if (!$this->_memory && $cfg['memory']) die("
|
||||||
|
<p><strong>Configuration error!</strong>
|
||||||
|
<br>Cannot save cache to memory, but it is configured to do so.
|
||||||
|
<br>You need to enable PHP extension APCu to enable memory cache.
|
||||||
|
<br>Install it or set \$config['cache']['memory'] to false!
|
||||||
|
<br><strong>Ubuntu install:</strong> sudo apt install php-apcu</p>
|
||||||
|
");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -32,6 +48,23 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable or disable memory RAM storage.
|
||||||
|
*
|
||||||
|
* @param bool $bool
|
||||||
|
* @access public
|
||||||
|
* @return bool $status
|
||||||
|
**/
|
||||||
|
public function useMemory($bool) {
|
||||||
|
if ($bool and $this->_canMemory) {
|
||||||
|
$this->_memory = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
$this->_memory = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the content you'd like to cache.
|
* Set the content you'd like to cache.
|
||||||
*
|
*
|
||||||
@ -40,15 +73,7 @@
|
|||||||
* @return void
|
* @return void
|
||||||
**/
|
**/
|
||||||
public function setContent($content) {
|
public function setContent($content) {
|
||||||
switch (strtolower(gettype($content))) {
|
$this->_content = (!$this->_memory && strtolower(gettype($content)) == 'array') ? json_encode($content) : $content;
|
||||||
case 'array':
|
|
||||||
$this->_content = json_encode($content);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
$this->_content = $content;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -59,10 +84,12 @@
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
**/
|
**/
|
||||||
public function hasExpired() {
|
public function hasExpired() {
|
||||||
|
if ($this->_memory) {
|
||||||
|
return !apcu_exists($this->_file);
|
||||||
|
}
|
||||||
if (is_file($this->_file) && time() < filemtime($this->_file) + $this->_lifespan) {
|
if (is_file($this->_file) && time() < filemtime($this->_file) + $this->_lifespan) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,6 +101,18 @@
|
|||||||
**/
|
**/
|
||||||
public function remainingTime() {
|
public function remainingTime() {
|
||||||
$remaining = 0;
|
$remaining = 0;
|
||||||
|
if ($this->_memory) {
|
||||||
|
if (apcu_exists($this->_file)) {
|
||||||
|
$meta = apc_cache_info('user');
|
||||||
|
foreach ($meta['cache_list'] AS $item) {
|
||||||
|
if ($item['info'] == $this->_file) {
|
||||||
|
$remaining = ($item['creation_time'] + $item['ttl']) - time();
|
||||||
|
return ($remaining > 0) ? $remaining : 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $remaining;
|
||||||
|
}
|
||||||
if (!$this->hasExpired()) {
|
if (!$this->hasExpired()) {
|
||||||
$remaining = (filemtime($this->_file) + $this->_lifespan) - time();
|
$remaining = (filemtime($this->_file) + $this->_lifespan) - time();
|
||||||
}
|
}
|
||||||
@ -88,6 +127,9 @@
|
|||||||
* @return void
|
* @return void
|
||||||
**/
|
**/
|
||||||
public function save() {
|
public function save() {
|
||||||
|
if ($this->_memory) {
|
||||||
|
return apcu_store($this->_file, $this->_content, $this->_lifespan);
|
||||||
|
}
|
||||||
$handle = fopen($this->_file, 'w');
|
$handle = fopen($this->_file, 'w');
|
||||||
fwrite($handle, $this->_content);
|
fwrite($handle, $this->_content);
|
||||||
fclose($handle);
|
fclose($handle);
|
||||||
@ -101,6 +143,9 @@
|
|||||||
* @return mixed
|
* @return mixed
|
||||||
**/
|
**/
|
||||||
public function load() {
|
public function load() {
|
||||||
|
if ($this->_memory) {
|
||||||
|
return apcu_fetch($this->_file);
|
||||||
|
}
|
||||||
if (!is_file($this->_file)) {
|
if (!is_file($this->_file)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -119,4 +164,4 @@
|
|||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -422,10 +422,8 @@ function output_errors($errors) {
|
|||||||
return '<ul><li>'. implode('</li><li>', $errors) .'</li></ul>';
|
return '<ul><li>'. implode('</li><li>', $errors) .'</li></ul>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resize images
|
// Resize images and create image
|
||||||
|
|
||||||
function resize_imagex($file, $width, $height) {
|
function resize_imagex($file, $width, $height) {
|
||||||
|
|
||||||
list($w, $h) = getimagesize($file['tmp']);
|
list($w, $h) = getimagesize($file['tmp']);
|
||||||
|
|
||||||
$ratio = max($width/$w, $height/$h);
|
$ratio = max($width/$w, $height/$h);
|
||||||
@ -443,7 +441,8 @@ function resize_imagex($file, $width, $height) {
|
|||||||
0, 0,
|
0, 0,
|
||||||
$x, 0,
|
$x, 0,
|
||||||
$width, $height,
|
$width, $height,
|
||||||
$w, $h);
|
$w, $h
|
||||||
|
);
|
||||||
|
|
||||||
imagegif($tmp, $path);
|
imagegif($tmp, $path);
|
||||||
imagedestroy($image);
|
imagedestroy($image);
|
||||||
@ -452,71 +451,43 @@ function resize_imagex($file, $width, $height) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Guild logo upload security
|
// Validate guild logo
|
||||||
function check_image($image) {
|
function check_image($image) {
|
||||||
|
$image_data = array(
|
||||||
|
'new_name' => $_GET['name'].'.gif',
|
||||||
|
'name' => $image['name'],
|
||||||
|
'tmp' => $image['tmp_name'],
|
||||||
|
'error' => $image['error'],
|
||||||
|
'size' => $image['size'],
|
||||||
|
'type' => $image['type']
|
||||||
|
);
|
||||||
|
|
||||||
$image_data = array('new_name' => $_GET['name'].'.gif', 'name' => $image['name'], 'tmp' => $image['tmp_name'], 'error' => $image['error'], 'size' => $image['size'], 'type' => $image['type']);
|
if ($image_data['type'] !== 'image/gif') {
|
||||||
|
header('Location: guilds.php?error=Only gif images are accepted, you uploaded:['.$image_data['type'].'].&name='. $_GET['name']);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
// First security check, quite useless but still do its job
|
|
||||||
if ($image_data['type'] === 'image/gif') {
|
|
||||||
|
|
||||||
// Second security check, lets go
|
|
||||||
$check = getimagesize($image_data['tmp']);
|
$check = getimagesize($image_data['tmp']);
|
||||||
|
if (!$check) {
|
||||||
if ($check) {
|
|
||||||
|
|
||||||
// Third
|
|
||||||
if ($check['mime'] === 'image/gif') {
|
|
||||||
|
|
||||||
$path_info = pathinfo($image_data['name']);
|
|
||||||
|
|
||||||
// Last one
|
|
||||||
if ($path_info['extension'] === 'gif') {
|
|
||||||
|
|
||||||
// Resize image
|
|
||||||
$img = resize_imagex($image_data, 100, 100);
|
|
||||||
|
|
||||||
if ($img) {
|
|
||||||
|
|
||||||
header('Location: guilds.php?name='. $_GET['name']);
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
header('Location: guilds.php?error=Only gif images accepted, you uploaded:['.$path_info['extension'].'].&name='. $_GET['name']);
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
header('Location: guilds.php?error=Only gif images accepted, you uploaded:['.$check['mime'].'].&name='. $_GET['name']);
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
header('Location: guilds.php?error=Uploaded image is invalid.&name='. $_GET['name']);
|
header('Location: guilds.php?error=Uploaded image is invalid.&name='. $_GET['name']);
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
if ($check['mime'] !== 'image/gif') {
|
||||||
|
header('Location: guilds.php?error=Only gif images accepted, you uploaded:['.$check['mime'].'].&name='. $_GET['name']);
|
||||||
header('Location: guilds.php?error=Only gif images are accepted, you uploaded:['.$image_data['type'].'].&name='. $_GET['name']);
|
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Check guild logo
|
$path_info = pathinfo($image_data['name']);
|
||||||
function logo_exists($guild) {
|
if ($path_info['extension'] !== 'gif') {
|
||||||
$guild = sanitize($guild);
|
header('Location: guilds.php?error=Only gif images accepted, you uploaded:['.$path_info['extension'].'].&name='. $_GET['name']);
|
||||||
if (file_exists('engine/guildimg/'.$guild.'.gif')) {
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
echo'engine/guildimg/'.$guild.'.gif';
|
// Resize image
|
||||||
|
if (resize_imagex($image_data, 100, 100)) {
|
||||||
} else {
|
header('Location: guilds.php?name='. $_GET['name']);
|
||||||
|
exit();
|
||||||
echo'engine/guildimg/default@logo.gif';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +143,18 @@ function support_list03() {
|
|||||||
|
|
||||||
// NEWS
|
// NEWS
|
||||||
function fetchAllNews() {
|
function fetchAllNews() {
|
||||||
return mysql_select_multi("SELECT `n`.`id`, `n`.`title`, `n`.`text`, `n`.`date`, `p`.`name` FROM `znote_news` AS `n` INNER JOIN `players` AS `p` ON `n`.`pid` = `p`.`id` ORDER BY `n`.`id` DESC;");
|
return mysql_select_multi("
|
||||||
|
SELECT
|
||||||
|
`n`.`id`,
|
||||||
|
`n`.`title`,
|
||||||
|
`n`.`text`,
|
||||||
|
`n`.`date`,
|
||||||
|
`p`.`name`
|
||||||
|
FROM `znote_news` AS `n`
|
||||||
|
INNER JOIN `players` AS `p`
|
||||||
|
ON `n`.`pid` = `p`.`id`
|
||||||
|
ORDER BY `n`.`id` DESC;
|
||||||
|
");
|
||||||
}
|
}
|
||||||
|
|
||||||
// HOUSES
|
// HOUSES
|
||||||
@ -250,62 +261,6 @@ function guild_remove_member_10($cid) {
|
|||||||
mysql_update("DELETE FROM `guild_membership` WHERE `player_id`='$cid' LIMIT 1;");
|
mysql_update("DELETE FROM `guild_membership` WHERE `player_id`='$cid' LIMIT 1;");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change guild rank name.
|
|
||||||
function guild_change_rank($rid, $name) {
|
|
||||||
$rid = (int)$rid;
|
|
||||||
$name = sanitize($name);
|
|
||||||
|
|
||||||
mysql_update("UPDATE `guild_ranks` SET `name`='$name' WHERE `id`=$rid");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Change guild leader (parameters: cid, new and old leader).
|
|
||||||
function guild_change_leader($nCid, $oCid) {
|
|
||||||
$nCid = (int)$nCid;
|
|
||||||
$oCid = (int)$oCid;
|
|
||||||
$gid = guild_leader_gid($oCid);
|
|
||||||
$ranks = get_guild_rank_data($gid);
|
|
||||||
$leader_rid = 0;
|
|
||||||
$vice_rid = 0;
|
|
||||||
|
|
||||||
|
|
||||||
// Get rank id for leader and vice leader.
|
|
||||||
foreach ($ranks as $rank) {
|
|
||||||
if ($rank['level'] == 3) $leader_rid = $rank['id'];
|
|
||||||
if ($rank['level'] == 2) $vice_rid = $rank['id'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$status = false;
|
|
||||||
if ($leader_rid > 0 && $vice_rid > 0) $status = true;
|
|
||||||
|
|
||||||
// Verify that we found the rank ids for vice leader and leader.
|
|
||||||
if ($status) {
|
|
||||||
|
|
||||||
// Update players and set their new rank id
|
|
||||||
if (config('ServerEngine') !== 'TFS_10') {
|
|
||||||
mysql_update("UPDATE `players` SET `rank_id`='$leader_rid' WHERE `id`=$nCid LIMIT 1;");
|
|
||||||
mysql_update("UPDATE `players` SET `rank_id`='$vice_rid' WHERE `id`=$oCid LIMIT 1;");
|
|
||||||
} else {
|
|
||||||
mysql_update("UPDATE `guild_membership` SET `rank_id`='$leader_rid' WHERE `player_id`=$nCid LIMIT 1;");
|
|
||||||
mysql_update("UPDATE `guild_membership` SET `rank_id`='$vice_rid' WHERE `player_id`=$oCid LIMIT 1;");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update guilds set new ownerid
|
|
||||||
guild_new_leader($nCid, $gid);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $status;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Changes leadership of aguild to player_id
|
|
||||||
function guild_new_leader($new_leader, $gid) {
|
|
||||||
$new_leader = (int)$new_leader;
|
|
||||||
$gid = (int)$gid;
|
|
||||||
if (config('ServerEngine') !== 'OTHIRE')
|
|
||||||
mysql_update("UPDATE `guilds` SET `ownerid`='$new_leader' WHERE `id`=$gid");
|
|
||||||
else
|
|
||||||
mysql_update("UPDATE `guilds` SET `owner_id`='$new_leader' WHERE `id`=$gid");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns $gid of a guild leader($cid).
|
// Returns $gid of a guild leader($cid).
|
||||||
function guild_leader_gid($leader) {
|
function guild_leader_gid($leader) {
|
||||||
$leader = (int)$leader;
|
$leader = (int)$leader;
|
||||||
@ -326,158 +281,12 @@ function guild_leader($gid) {
|
|||||||
return ($data !== false) ? $data['ownerid'] : false;
|
return ($data !== false) ? $data['ownerid'] : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disband guild
|
|
||||||
function guild_remove_invites($gid) {
|
|
||||||
$gid = (int)$gid;
|
|
||||||
mysql_delete("DELETE FROM `guild_invites` WHERE `guild_id`='$gid';");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove guild invites
|
|
||||||
function guild_delete($gid) {
|
|
||||||
$gid = (int)$gid;
|
|
||||||
mysql_delete("DELETE FROM `guilds` WHERE `id`='$gid';");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Player leave guild
|
|
||||||
function guild_player_leave($cid) {
|
|
||||||
$cid = (int)$cid;
|
|
||||||
mysql_update("UPDATE `players` SET `rank_id`='0', `guildnick`= NULL WHERE `id`=$cid LIMIT 1;");
|
|
||||||
}
|
|
||||||
function guild_player_leave_10($cid) {
|
|
||||||
$cid = (int)$cid;
|
|
||||||
mysql_delete("DELETE FROM `guild_membership` WHERE `player_id`='$cid' LIMIT 1;");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Player join guild
|
|
||||||
function guild_player_join($cid, $gid) {
|
|
||||||
$cid = (int)$cid;
|
|
||||||
$gid = (int)$gid;
|
|
||||||
// Create a status we can return depending on results.
|
|
||||||
$status = false;
|
|
||||||
|
|
||||||
if (config('ServerEngine') !== 'TFS_10') {
|
|
||||||
// Get rank data
|
|
||||||
$ranks = get_guild_rank_data($gid);
|
|
||||||
// Locate rank id for regular member position in this guild
|
|
||||||
$rid = false;
|
|
||||||
foreach ($ranks as $rank) {
|
|
||||||
if ($rank['level'] == 1) $rid = $rank['id'];
|
|
||||||
}
|
|
||||||
// Add to guild if rank id was found:
|
|
||||||
if ($rid != false) {
|
|
||||||
// Remove the invite:
|
|
||||||
//guild_remove_invitation($cid, $gid);
|
|
||||||
guild_remove_all_invitations($cid);
|
|
||||||
// Add to guild:
|
|
||||||
mysql_update("UPDATE `players` SET `rank_id`='$rid' WHERE `id`=$cid");
|
|
||||||
$status = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
// Find rank id for regular member in this guild
|
|
||||||
$guildrank = mysql_select_single("SELECT `id` FROM `guild_ranks` WHERE `guild_id`='$gid' AND `level`='1' LIMIT 1;");
|
|
||||||
if ($guildrank !== false) {
|
|
||||||
$rid = $guildrank['id'];
|
|
||||||
// Remove invite
|
|
||||||
//guild_remove_invitation($cid, $gid);
|
|
||||||
guild_remove_all_invitations($cid);
|
|
||||||
// Add to guild
|
|
||||||
mysql_insert("INSERT INTO `guild_membership` (`player_id`, `guild_id`, `rank_id`, `nick`) VALUES ('$cid', '$gid', '$rid', '');");
|
|
||||||
// Return success
|
|
||||||
return true;
|
|
||||||
} return false;
|
|
||||||
}
|
|
||||||
return $status;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove cid invitation from guild (gid)
|
|
||||||
function guild_remove_invitation($cid, $gid) {
|
|
||||||
$cid = (int)$cid;
|
|
||||||
$gid = (int)$gid;
|
|
||||||
mysql_delete("DELETE FROM `guild_invites` WHERE `player_id`='$cid' AND `guild_id`='$gid';");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove ALL invitations
|
|
||||||
function guild_remove_all_invitations($cid) {
|
|
||||||
$cid = (int)$cid;
|
|
||||||
mysql_delete("DELETE FROM `guild_invites` WHERE `player_id`='$cid';");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Invite character to guild
|
|
||||||
function guild_invite_player($cid, $gid) {
|
|
||||||
$cid = (int)$cid;
|
|
||||||
$gid = (int)$gid;
|
|
||||||
mysql_insert("INSERT INTO `guild_invites` (`player_id`, `guild_id`) VALUES ('$cid', '$gid')");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Gets a list of invited players to a particular guild.
|
// Gets a list of invited players to a particular guild.
|
||||||
function guild_invite_list($gid) {
|
function guild_invite_list($gid) {
|
||||||
$gid = (int)$gid;
|
$gid = (int)$gid;
|
||||||
return mysql_select_multi("SELECT `gi`.`player_id`, `gi`.`guild_id`, `p`.`name` FROM `guild_invites` AS `gi` INNER JOIN `players` AS `p` ON `gi`.`player_id`=`p`.`id` WHERE `gi`.`guild_id`='$gid';");
|
return mysql_select_multi("SELECT `gi`.`player_id`, `gi`.`guild_id`, `p`.`name` FROM `guild_invites` AS `gi` INNER JOIN `players` AS `p` ON `gi`.`player_id`=`p`.`id` WHERE `gi`.`guild_id`='$gid';");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update player's guild position
|
|
||||||
function update_player_guild_position($cid, $rid) {
|
|
||||||
$cid = (int)$cid;
|
|
||||||
$rid = (int)$rid;
|
|
||||||
mysql_update("UPDATE `players` SET `rank_id`='$rid' WHERE `id`=$cid");
|
|
||||||
}
|
|
||||||
function update_player_guild_position_10($cid, $rid) {
|
|
||||||
$cid = (int)$cid;
|
|
||||||
$rid = (int)$rid;
|
|
||||||
mysql_update("UPDATE `guild_membership` SET `rank_id`='$rid' WHERE `player_id`=$cid");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update player's guild nick
|
|
||||||
function update_player_guildnick($cid, $nick) {
|
|
||||||
$cid = (int)$cid;
|
|
||||||
$nick = sanitize($nick);
|
|
||||||
if (!empty($nick)) {
|
|
||||||
mysql_update("UPDATE `players` SET `guildnick`='$nick' WHERE `id`=$cid");
|
|
||||||
} else {
|
|
||||||
mysql_update("UPDATE `players` SET `guildnick`='' WHERE `id`=$cid");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function update_player_guildnick_10($cid, $nick) {
|
|
||||||
$cid = (int)$cid;
|
|
||||||
$nick = sanitize($nick);
|
|
||||||
if (!empty($nick)) {
|
|
||||||
mysql_update("UPDATE `guild_membership` SET `nick`='$nick' WHERE `player_id`=$cid");
|
|
||||||
} else {
|
|
||||||
mysql_update("UPDATE `guild_membership` SET `nick`='' WHERE `player_id`=$cid");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get guild data, using guild id.
|
|
||||||
function get_guild_rank_data($gid) {
|
|
||||||
$gid = (int)$gid;
|
|
||||||
return mysql_select_multi("SELECT `id`, `guild_id`, `name`, `level` FROM `guild_ranks` WHERE `guild_id`='$gid' ORDER BY `id` DESC LIMIT 0, 30");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Creates a guild, where cid is the owner of the guild, and name is the name of guild.
|
|
||||||
function create_guild($cid, $name) {
|
|
||||||
$cid = (int)$cid;
|
|
||||||
$name = sanitize($name);
|
|
||||||
$time = time();
|
|
||||||
|
|
||||||
// Create the guild
|
|
||||||
if (config('ServerEngine') !== 'OTHIRE')
|
|
||||||
mysql_insert("INSERT INTO `guilds` (`name`, `ownerid`, `creationdata`, `motd`) VALUES ('$name', '$cid', '$time', '');");
|
|
||||||
else
|
|
||||||
mysql_insert("INSERT INTO `guilds` (`name`, `owner_id`, `creationdate`) VALUES ('$name', '$cid', '$time');");
|
|
||||||
|
|
||||||
// Get guild id
|
|
||||||
$gid = get_guild_id($name);
|
|
||||||
|
|
||||||
// Get rank id for guild leader
|
|
||||||
$data = mysql_select_single("SELECT `id` FROM `guild_ranks` WHERE `guild_id`='$gid' AND `level`='3' LIMIT 1;");
|
|
||||||
$rid = ($data !== false) ? $data['id'] : false;
|
|
||||||
|
|
||||||
// Give player rank id for leader of his guild
|
|
||||||
if (config('ServerEngine') !== 'TFS_10') mysql_update("UPDATE `players` SET `rank_id`='$rid' WHERE `id`='$cid' LIMIT 1;");
|
|
||||||
else mysql_insert("INSERT INTO `guild_membership` (`player_id`, `guild_id`, `rank_id`, `nick`) VALUES ('$cid', '$gid', '$rid', '');");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Search player table on cid for his rank_id, returns rank_id
|
// Search player table on cid for his rank_id, returns rank_id
|
||||||
function get_character_guild_rank($cid) {
|
function get_character_guild_rank($cid) {
|
||||||
$cid = (int)$cid;
|
$cid = (int)$cid;
|
||||||
@ -497,13 +306,6 @@ function get_player_guild_rank($rank_id) {
|
|||||||
return ($data !== false) ? $data['name'] : false;
|
return ($data !== false) ? $data['name'] : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get a player guild position ID, using his rank_id
|
|
||||||
function get_guild_position($rid) {
|
|
||||||
$rid = (int)$rid;
|
|
||||||
$data = mysql_select_single("SELECT `level` FROM `guild_ranks` WHERE `id`=$rid;");
|
|
||||||
return ($data !== false) ? $data['level'] : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get a players rank_id, guild_id, rank_level(ID), rank_name(string), using cid(player id)
|
// Get a players rank_id, guild_id, rank_level(ID), rank_name(string), using cid(player id)
|
||||||
function get_player_guild_data($cid) {
|
function get_player_guild_data($cid) {
|
||||||
$cid = (int)$cid;
|
$cid = (int)$cid;
|
||||||
@ -522,7 +324,7 @@ function get_player_guild_data($cid) {
|
|||||||
// Returns guild name of guild id
|
// Returns guild name of guild id
|
||||||
function get_guild_name($gid) {
|
function get_guild_name($gid) {
|
||||||
$gid = (int)$gid;
|
$gid = (int)$gid;
|
||||||
$guild = mysql_select_single("SELECT `name` FROM `guilds` WHERE `id`=$gid LIMIT 1;");
|
$guild = mysql_select_single("SELECT `name` FROM `guilds` WHERE `id`={$gid} LIMIT 1;");
|
||||||
if ($guild !== false) return $guild['name'];
|
if ($guild !== false) return $guild['name'];
|
||||||
else return false;
|
else return false;
|
||||||
}
|
}
|
||||||
@ -530,7 +332,7 @@ function get_guild_name($gid) {
|
|||||||
// Returns guild id from name
|
// Returns guild id from name
|
||||||
function get_guild_id($name) {
|
function get_guild_id($name) {
|
||||||
$name = sanitize($name);
|
$name = sanitize($name);
|
||||||
$data = mysql_select_single("SELECT `id` FROM `guilds` WHERE `name`='$name';");
|
$data = mysql_select_single("SELECT `id` FROM `guilds` WHERE `name`='{$name}';");
|
||||||
return ($data !== false) ? $data['id'] : false;
|
return ($data !== false) ? $data['id'] : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -573,18 +375,6 @@ function get_guild_level_data($gid) {
|
|||||||
} else return false;
|
} else return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns total members in a guild (integer)
|
|
||||||
function count_guild_members($gid) {
|
|
||||||
$gid = (int)$gid;
|
|
||||||
if (config('ServerEngine') !== 'TFS_10') {
|
|
||||||
$data = mysql_select_single("SELECT COUNT(p.id) AS total FROM players AS p LEFT JOIN guild_ranks AS gr ON gr.id = p.rank_id WHERE gr.guild_id =$gid");
|
|
||||||
return ($data !== false) ? $data['total'] : false;
|
|
||||||
} else {
|
|
||||||
$data = mysql_select_single("SELECT COUNT('guild_id') AS `total` FROM `guild_membership` WHERE `guild_id`='$gid';");
|
|
||||||
return ($data !== false) ? $data['total'] : false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// GUILD WAR
|
// GUILD WAR
|
||||||
//
|
//
|
||||||
@ -861,16 +651,30 @@ function user_character_list($account_id) {
|
|||||||
//$count = user_character_list_count($account_id);
|
//$count = user_character_list_count($account_id);
|
||||||
$account_id = (int)$account_id;
|
$account_id = (int)$account_id;
|
||||||
|
|
||||||
if (config('ServerEngine') == 'TFS_10') {
|
$characters = mysql_select_multi("
|
||||||
$characters = mysql_select_multi("SELECT `p`.`id`, `p`.`name`, `p`.`level`, `p`.`vocation`, `p`.`town_id`, `p`.`lastlogin`, `gm`.`rank_id`, `po`.`player_id` AS `online` FROM `players` AS `p` LEFT JOIN `guild_membership` AS `gm` ON `p`.`id`=`gm`.`player_id` LEFT JOIN `players_online` AS `po` ON `p`.`id`=`po`.`player_id` WHERE `p`.`account_id`='$account_id' ORDER BY `p`.`level` DESC");
|
SELECT
|
||||||
if ($characters !== false) {
|
`p`.`id`,
|
||||||
for ($i = 0; $i < count($characters); $i++) {
|
`p`.`name`,
|
||||||
$characters[$i]['online'] = ($characters[$i]['online'] > 0) ? 1 : 0;
|
`p`.`level`,
|
||||||
//unset($characters[$i]['id']);
|
`p`.`vocation`,
|
||||||
}
|
`p`.`town_id`,
|
||||||
}
|
`p`.`lastlogin`,
|
||||||
|
`gm`.`rank_id`,
|
||||||
} else $characters = mysql_select_multi("SELECT `id`, `name`, `level`, `vocation`, `town_id`, `lastlogin`, `online`, `rank_id` FROM `players` WHERE `account_id`='$account_id' ORDER BY `level` DESC");
|
`zp`.`hide_char`,
|
||||||
|
CASE WHEN `po`.`player_id` IS NULL
|
||||||
|
THEN 0
|
||||||
|
ELSE 1
|
||||||
|
END AS `online`
|
||||||
|
FROM `players` AS `p`
|
||||||
|
LEFT JOIN `guild_membership` AS `gm`
|
||||||
|
ON `p`.`id`=`gm`.`player_id`
|
||||||
|
LEFT JOIN `players_online` AS `po`
|
||||||
|
ON `p`.`id`=`po`.`player_id`
|
||||||
|
LEFT JOIN `znote_players` AS `zp`
|
||||||
|
ON `p`.`id`=`zp`.`player_id`
|
||||||
|
WHERE `p`.`account_id`='{$account_id}'
|
||||||
|
ORDER BY `p`.`level` DESC
|
||||||
|
");
|
||||||
|
|
||||||
if ($characters !== false) {
|
if ($characters !== false) {
|
||||||
$count = count($characters);
|
$count = count($characters);
|
||||||
@ -910,15 +714,11 @@ function user_character_list_count($account_id) {
|
|||||||
|
|
||||||
// HIGHSCORE FUNCTIONS \\
|
// HIGHSCORE FUNCTIONS \\
|
||||||
function fetchAllScores($rows, $tfs, $g, $vlist, $v = -1, $flags = false, $outfits = false) {
|
function fetchAllScores($rows, $tfs, $g, $vlist, $v = -1, $flags = false, $outfits = false) {
|
||||||
if (config('ServerEngine') !== 'OTHIRE') {
|
|
||||||
if (config('client') < 780) {
|
if (config('client') < 780) {
|
||||||
$outfits = ($outfits) ? ", `p`.`lookbody` AS `body`, `p`.`lookfeet` AS `feet`, `p`.`lookhead` AS `head`, `p`.`looklegs` AS `legs`, `p`.`looktype` AS `type`" : "";
|
$outfits = ($outfits) ? ", `p`.`lookbody` AS `body`, `p`.`lookfeet` AS `feet`, `p`.`lookhead` AS `head`, `p`.`looklegs` AS `legs`, `p`.`looktype` AS `type`" : "";
|
||||||
} else {
|
} else {
|
||||||
$outfits = ($outfits) ? ", `p`.`lookbody` AS `body`, `p`.`lookfeet` AS `feet`, `p`.`lookhead` AS `head`, `p`.`looklegs` AS `legs`, `p`.`looktype` AS `type`, `p`.`lookaddons` AS `addons`" : "";
|
$outfits = ($outfits) ? ", `p`.`lookbody` AS `body`, `p`.`lookfeet` AS `feet`, `p`.`lookhead` AS `head`, `p`.`looklegs` AS `legs`, `p`.`looktype` AS `type`, `p`.`lookaddons` AS `addons`" : "";
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$outfits = ($outfits) ? ", `p`.`lookbody` AS `body`, `p`.`lookfeet` AS `feet`, `p`.`lookhead` AS `head`, `p`.`looklegs` AS `legs`, `p`.`looktype` AS `type`" : "";
|
|
||||||
}
|
|
||||||
// Return scores ordered by type and vocation (if set)
|
// Return scores ordered by type and vocation (if set)
|
||||||
$data = array();
|
$data = array();
|
||||||
|
|
||||||
@ -956,59 +756,30 @@ function fetchAllScores($rows, $tfs, $g, $vlist, $v = -1, $flags = false, $outfi
|
|||||||
if ($vGrp !== 'all')
|
if ($vGrp !== 'all')
|
||||||
$v = (strpos($vGrp, ',') !== false) ? 'AND `p`.`vocation` IN ('. $vGrp . ')' : 'AND `p`.`vocation` = \''.intval($vGrp).'\'';
|
$v = (strpos($vGrp, ',') !== false) ? 'AND `p`.`vocation` IN ('. $vGrp . ')' : 'AND `p`.`vocation` = \''.intval($vGrp).'\'';
|
||||||
|
|
||||||
if ($tfs == 'TFS_10') {
|
|
||||||
|
|
||||||
if ($flags === false) { // In this case we only need to query players table
|
if ($flags === false) { // In this case we only need to query players table
|
||||||
$v = str_replace('`p`.', '', $v);
|
$v = str_replace('`p`.', '', $v);
|
||||||
$outfits = str_replace('`p`.', '', $outfits);
|
$outfits = str_replace('`p`.', '', $outfits);
|
||||||
|
|
||||||
$vocGroups[$vGrp][1] = mysql_select_multi("SELECT `name`, `vocation`, `skill_club` AS `value` $outfits FROM `players` WHERE `group_id` < $g $v ORDER BY `skill_club` DESC LIMIT 0, $rows;");
|
$vocGroups[$vGrp][1] = mysql_select_multi("SELECT `name`, `vocation`, `lastlogout`, `skill_club` AS `value` $outfits FROM `players` WHERE `group_id` < $g $v ORDER BY `skill_club` DESC LIMIT 0, $rows;");
|
||||||
$vocGroups[$vGrp][2] = mysql_select_multi("SELECT `name`, `vocation`, `skill_sword` AS `value` $outfits FROM `players` WHERE `group_id` < $g $v ORDER BY `skill_sword` DESC LIMIT 0, $rows;");
|
$vocGroups[$vGrp][2] = mysql_select_multi("SELECT `name`, `vocation`, `lastlogout`, `skill_sword` AS `value` $outfits FROM `players` WHERE `group_id` < $g $v ORDER BY `skill_sword` DESC LIMIT 0, $rows;");
|
||||||
$vocGroups[$vGrp][3] = mysql_select_multi("SELECT `name`, `vocation`, `skill_axe` AS `value` $outfits FROM `players` WHERE `group_id` < $g $v ORDER BY `skill_axe` DESC LIMIT 0, $rows;");
|
$vocGroups[$vGrp][3] = mysql_select_multi("SELECT `name`, `vocation`, `lastlogout`, `skill_axe` AS `value` $outfits FROM `players` WHERE `group_id` < $g $v ORDER BY `skill_axe` DESC LIMIT 0, $rows;");
|
||||||
$vocGroups[$vGrp][4] = mysql_select_multi("SELECT `name`, `vocation`, `skill_dist` AS `value` $outfits FROM `players` WHERE `group_id` < $g $v ORDER BY `skill_dist` DESC LIMIT 0, $rows;");
|
$vocGroups[$vGrp][4] = mysql_select_multi("SELECT `name`, `vocation`, `lastlogout`, `skill_dist` AS `value` $outfits FROM `players` WHERE `group_id` < $g $v ORDER BY `skill_dist` DESC LIMIT 0, $rows;");
|
||||||
$vocGroups[$vGrp][5] = mysql_select_multi("SELECT `name`, `vocation`, `skill_shielding` AS `value` $outfits FROM `players` WHERE `group_id` < $g $v ORDER BY `skill_shielding` DESC LIMIT 0, $rows;");
|
$vocGroups[$vGrp][5] = mysql_select_multi("SELECT `name`, `vocation`, `lastlogout`, `skill_shielding` AS `value` $outfits FROM `players` WHERE `group_id` < $g $v ORDER BY `skill_shielding` DESC LIMIT 0, $rows;");
|
||||||
$vocGroups[$vGrp][6] = mysql_select_multi("SELECT `name`, `vocation`, `skill_fishing` AS `value` $outfits FROM `players` WHERE `group_id` < $g $v ORDER BY `skill_fishing` DESC LIMIT 0, $rows;");
|
$vocGroups[$vGrp][6] = mysql_select_multi("SELECT `name`, `vocation`, `lastlogout`, `skill_fishing` AS `value` $outfits FROM `players` WHERE `group_id` < $g $v ORDER BY `skill_fishing` DESC LIMIT 0, $rows;");
|
||||||
$vocGroups[$vGrp][7] = mysql_select_multi("SELECT `name`, `vocation`, `experience`, `level` AS `value` $outfits FROM `players` WHERE `group_id` < $g $v ORDER BY `experience` DESC LIMIT 0, $rows;");
|
$vocGroups[$vGrp][7] = mysql_select_multi("SELECT `name`, `vocation`, `lastlogout`, `experience`, `level` AS `value` $outfits FROM `players` WHERE `group_id` < $g $v ORDER BY `experience` DESC LIMIT 0, $rows;");
|
||||||
$vocGroups[$vGrp][8] = mysql_select_multi("SELECT `name`, `vocation`, `maglevel` AS `value` $outfits FROM `players` WHERE `group_id` < $g $v ORDER BY `maglevel` DESC LIMIT 0, $rows;");
|
$vocGroups[$vGrp][8] = mysql_select_multi("SELECT `name`, `vocation`, `lastlogout`, `maglevel` AS `value` $outfits FROM `players` WHERE `group_id` < $g $v ORDER BY `maglevel` DESC LIMIT 0, $rows;");
|
||||||
$vocGroups[$vGrp][9] = mysql_select_multi("SELECT `name`, `vocation`, `skill_fist` AS `value` $outfits FROM `players` WHERE `group_id` < $g $v ORDER BY `skill_fist` DESC LIMIT 0, $rows;");
|
$vocGroups[$vGrp][9] = mysql_select_multi("SELECT `name`, `vocation`, `lastlogout`, `skill_fist` AS `value` $outfits FROM `players` WHERE `group_id` < $g $v ORDER BY `skill_fist` DESC LIMIT 0, $rows;");
|
||||||
|
|
||||||
} else { // Inner join znote_accounts table to retrieve the flag
|
} else { // Inner join znote_accounts table to retrieve the flag
|
||||||
$vocGroups[$vGrp][1] = mysql_select_multi("SELECT `p`.`name`, `p`.`vocation`, `p`.`skill_club` AS `value`, `za`.`flag` $outfits FROM `players` AS `p` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id`=`za`.`account_id` WHERE `p`.`group_id` < $g $v ORDER BY `p`.`skill_club` DESC LIMIT 0, $rows;");
|
$vocGroups[$vGrp][1] = mysql_select_multi("SELECT `p`.`name`, `p`.`vocation`, `p`.`lastlogout`, `p`.`skill_club` AS `value`, `za`.`flag` $outfits FROM `players` AS `p` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id`=`za`.`account_id` WHERE `p`.`group_id` < $g $v ORDER BY `p`.`skill_club` DESC LIMIT 0, $rows;");
|
||||||
$vocGroups[$vGrp][2] = mysql_select_multi("SELECT `p`.`name`, `p`.`vocation`, `p`.`skill_sword` AS `value`, `za`.`flag` $outfits FROM `players` AS `p` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id`=`za`.`account_id` WHERE `p`.`group_id` < $g $v ORDER BY `p`.`skill_sword` DESC LIMIT 0, $rows;");
|
$vocGroups[$vGrp][2] = mysql_select_multi("SELECT `p`.`name`, `p`.`vocation`, `p`.`lastlogout`, `p`.`skill_sword` AS `value`, `za`.`flag` $outfits FROM `players` AS `p` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id`=`za`.`account_id` WHERE `p`.`group_id` < $g $v ORDER BY `p`.`skill_sword` DESC LIMIT 0, $rows;");
|
||||||
$vocGroups[$vGrp][3] = mysql_select_multi("SELECT `p`.`name`, `p`.`vocation`, `p`.`skill_axe` AS `value`, `za`.`flag` $outfits FROM `players` AS `p` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id`=`za`.`account_id` WHERE `p`.`group_id` < $g $v ORDER BY `p`.`skill_axe` DESC LIMIT 0, $rows;");
|
$vocGroups[$vGrp][3] = mysql_select_multi("SELECT `p`.`name`, `p`.`vocation`, `p`.`lastlogout`, `p`.`skill_axe` AS `value`, `za`.`flag` $outfits FROM `players` AS `p` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id`=`za`.`account_id` WHERE `p`.`group_id` < $g $v ORDER BY `p`.`skill_axe` DESC LIMIT 0, $rows;");
|
||||||
$vocGroups[$vGrp][4] = mysql_select_multi("SELECT `p`.`name`, `p`.`vocation`, `p`.`skill_dist` AS `value`, `za`.`flag` $outfits FROM `players` AS `p` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id`=`za`.`account_id` WHERE `p`.`group_id` < $g $v ORDER BY `p`.`skill_dist` DESC LIMIT 0, $rows;");
|
$vocGroups[$vGrp][4] = mysql_select_multi("SELECT `p`.`name`, `p`.`vocation`, `p`.`lastlogout`, `p`.`skill_dist` AS `value`, `za`.`flag` $outfits FROM `players` AS `p` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id`=`za`.`account_id` WHERE `p`.`group_id` < $g $v ORDER BY `p`.`skill_dist` DESC LIMIT 0, $rows;");
|
||||||
$vocGroups[$vGrp][5] = mysql_select_multi("SELECT `p`.`name`, `p`.`vocation`, `p`.`skill_shielding` AS `value`, `za`.`flag` $outfits FROM `players` AS `p` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id`=`za`.`account_id` WHERE `p`.`group_id` < $g $v ORDER BY `p`.`skill_shielding` DESC LIMIT 0, $rows;");
|
$vocGroups[$vGrp][5] = mysql_select_multi("SELECT `p`.`name`, `p`.`vocation`, `p`.`lastlogout`, `p`.`skill_shielding` AS `value`, `za`.`flag` $outfits FROM `players` AS `p` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id`=`za`.`account_id` WHERE `p`.`group_id` < $g $v ORDER BY `p`.`skill_shielding` DESC LIMIT 0, $rows;");
|
||||||
$vocGroups[$vGrp][6] = mysql_select_multi("SELECT `p`.`name`, `p`.`vocation`, `p`.`skill_fishing` AS `value`, `za`.`flag` $outfits FROM `players` AS `p` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id`=`za`.`account_id` WHERE `p`.`group_id` < $g $v ORDER BY `p`.`skill_fishing` DESC LIMIT 0, $rows;");
|
$vocGroups[$vGrp][6] = mysql_select_multi("SELECT `p`.`name`, `p`.`vocation`, `p`.`lastlogout`, `p`.`skill_fishing` AS `value`, `za`.`flag` $outfits FROM `players` AS `p` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id`=`za`.`account_id` WHERE `p`.`group_id` < $g $v ORDER BY `p`.`skill_fishing` DESC LIMIT 0, $rows;");
|
||||||
$vocGroups[$vGrp][7] = mysql_select_multi("SELECT `p`.`name`, `p`.`vocation`, `p`.`experience`, `level` AS `value`, `za`.`flag` $outfits FROM `players` AS `p` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id`=`za`.`account_id` WHERE `p`.`group_id` < $g $v ORDER BY `p`.`experience` DESC LIMIT 0, $rows;");
|
$vocGroups[$vGrp][7] = mysql_select_multi("SELECT `p`.`name`, `p`.`vocation`, `p`.`lastlogout`, `p`.`experience`, `level` AS `value`, `za`.`flag` $outfits FROM `players` AS `p` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id`=`za`.`account_id` WHERE `p`.`group_id` < $g $v ORDER BY `p`.`experience` DESC LIMIT 0, $rows;");
|
||||||
$vocGroups[$vGrp][8] = mysql_select_multi("SELECT `p`.`name`, `p`.`vocation`, `p`.`maglevel` AS `value`, `za`.`flag` $outfits FROM `players` AS `p` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id`=`za`.`account_id` WHERE `p`.`group_id` < $g $v ORDER BY `p`.`maglevel` DESC LIMIT 0, $rows;");
|
$vocGroups[$vGrp][8] = mysql_select_multi("SELECT `p`.`name`, `p`.`vocation`, `p`.`lastlogout`, `p`.`maglevel` AS `value`, `za`.`flag` $outfits FROM `players` AS `p` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id`=`za`.`account_id` WHERE `p`.`group_id` < $g $v ORDER BY `p`.`maglevel` DESC LIMIT 0, $rows;");
|
||||||
$vocGroups[$vGrp][9] = mysql_select_multi("SELECT `p`.`name`, `p`.`vocation`, `p`.`skill_fist` AS `value`, `za`.`flag` $outfits FROM `players` AS `p` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id`=`za`.`account_id` WHERE `p`.`group_id` < $g $v ORDER BY `p`.`skill_fist` DESC LIMIT 0, $rows;");
|
$vocGroups[$vGrp][9] = mysql_select_multi("SELECT `p`.`name`, `p`.`vocation`, `p`.`lastlogout`, `p`.`skill_fist` AS `value`, `za`.`flag` $outfits FROM `players` AS `p` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id`=`za`.`account_id` WHERE `p`.`group_id` < $g $v ORDER BY `p`.`skill_fist` DESC LIMIT 0, $rows;");
|
||||||
}
|
|
||||||
} else { // TFS 0.2, 0.3, 0.4
|
|
||||||
|
|
||||||
if ($flags === false) {
|
|
||||||
$vocGroups[$vGrp][9] = mysql_select_multi("SELECT `s`.`player_id` AS `id`, `s`.`value` AS `value`, `p`.`name` AS `name`, `p`.`vocation` AS `vocation` $outfits FROM `player_skills` AS `s` LEFT JOIN `players` AS `p` ON `s`.`player_id`=`p`.`id` WHERE `s`.`skillid` = 0 AND `p`.`group_id` < $g $v ORDER BY `s`.`value` DESC LIMIT 0, $rows;");
|
|
||||||
$vocGroups[$vGrp][1] = mysql_select_multi("SELECT `s`.`player_id` AS `id`, `s`.`value` AS `value`, `p`.`name` AS `name`, `p`.`vocation` AS `vocation` $outfits FROM `player_skills` AS `s` LEFT JOIN `players` AS `p` ON `s`.`player_id`=`p`.`id` WHERE `s`.`skillid` = 1 AND `p`.`group_id` < $g $v ORDER BY `s`.`value` DESC LIMIT 0, $rows;");
|
|
||||||
$vocGroups[$vGrp][2] = mysql_select_multi("SELECT `s`.`player_id` AS `id`, `s`.`value` AS `value`, `p`.`name` AS `name`, `p`.`vocation` AS `vocation` $outfits FROM `player_skills` AS `s` LEFT JOIN `players` AS `p` ON `s`.`player_id`=`p`.`id` WHERE `s`.`skillid` = 2 AND `p`.`group_id` < $g $v ORDER BY `s`.`value` DESC LIMIT 0, $rows;");
|
|
||||||
$vocGroups[$vGrp][3] = mysql_select_multi("SELECT `s`.`player_id` AS `id`, `s`.`value` AS `value`, `p`.`name` AS `name`, `p`.`vocation` AS `vocation` $outfits FROM `player_skills` AS `s` LEFT JOIN `players` AS `p` ON `s`.`player_id`=`p`.`id` WHERE `s`.`skillid` = 3 AND `p`.`group_id` < $g $v ORDER BY `s`.`value` DESC LIMIT 0, $rows;");
|
|
||||||
$vocGroups[$vGrp][4] = mysql_select_multi("SELECT `s`.`player_id` AS `id`, `s`.`value` AS `value`, `p`.`name` AS `name`, `p`.`vocation` AS `vocation` $outfits FROM `player_skills` AS `s` LEFT JOIN `players` AS `p` ON `s`.`player_id`=`p`.`id` WHERE `s`.`skillid` = 4 AND `p`.`group_id` < $g $v ORDER BY `s`.`value` DESC LIMIT 0, $rows;");
|
|
||||||
$vocGroups[$vGrp][5] = mysql_select_multi("SELECT `s`.`player_id` AS `id`, `s`.`value` AS `value`, `p`.`name` AS `name`, `p`.`vocation` AS `vocation` $outfits FROM `player_skills` AS `s` LEFT JOIN `players` AS `p` ON `s`.`player_id`=`p`.`id` WHERE `s`.`skillid` = 5 AND `p`.`group_id` < $g $v ORDER BY `s`.`value` DESC LIMIT 0, $rows;");
|
|
||||||
$vocGroups[$vGrp][6] = mysql_select_multi("SELECT `s`.`player_id` AS `id`, `s`.`value` AS `value`, `p`.`name` AS `name`, `p`.`vocation` AS `vocation` $outfits FROM `player_skills` AS `s` LEFT JOIN `players` AS `p` ON `s`.`player_id`=`p`.`id` WHERE `s`.`skillid` = 6 AND `p`.`group_id` < $g $v ORDER BY `s`.`value` DESC LIMIT 0, $rows;");
|
|
||||||
$v = str_replace('`p`.', '', $v);
|
|
||||||
$outfits = str_replace('`p`.', '', $outfits);
|
|
||||||
$vocGroups[$vGrp][7] = mysql_select_multi("SELECT `id`, `name`, `vocation`, `experience`, `level` AS `value` $outfits $outfits FROM `players` WHERE `group_id` < $g $v ORDER BY `experience` DESC limit 0, $rows;");
|
|
||||||
$vocGroups[$vGrp][8] = mysql_select_multi("SELECT `id`, `name`, `vocation`, `maglevel` AS `value` $outfits $outfits FROM `players` WHERE `group_id` < $g $v ORDER BY `maglevel` DESC limit 0, $rows;");
|
|
||||||
|
|
||||||
} else { // Inner join znote_accounts table to retrieve the flag
|
|
||||||
$vocGroups[$vGrp][9] = mysql_select_multi("SELECT `s`.`player_id` AS `id`, `s`.`value` AS `value`, `p`.`name` AS `name`, `p`.`vocation` AS `vocation`, `za`.`flag` AS `flag` $outfits FROM `player_skills` AS `s` INNER JOIN `players` AS `p` ON `s`.`player_id`=`p`.`id` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id`=`za`.`account_id` WHERE `s`.`skillid` = 0 AND `p`.`group_id` < $g $v ORDER BY `s`.`value` DESC LIMIT 0, $rows;");
|
|
||||||
$vocGroups[$vGrp][1] = mysql_select_multi("SELECT `s`.`player_id` AS `id`, `s`.`value` AS `value`, `p`.`name` AS `name`, `p`.`vocation` AS `vocation`, `za`.`flag` AS `flag` $outfits FROM `player_skills` AS `s` INNER JOIN `players` AS `p` ON `s`.`player_id`=`p`.`id` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id`=`za`.`account_id` WHERE `s`.`skillid` = 1 AND `p`.`group_id` < $g $v ORDER BY `s`.`value` DESC LIMIT 0, $rows;");
|
|
||||||
$vocGroups[$vGrp][2] = mysql_select_multi("SELECT `s`.`player_id` AS `id`, `s`.`value` AS `value`, `p`.`name` AS `name`, `p`.`vocation` AS `vocation`, `za`.`flag` AS `flag` $outfits FROM `player_skills` AS `s` INNER JOIN `players` AS `p` ON `s`.`player_id`=`p`.`id` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id`=`za`.`account_id` WHERE `s`.`skillid` = 2 AND `p`.`group_id` < $g $v ORDER BY `s`.`value` DESC LIMIT 0, $rows;");
|
|
||||||
$vocGroups[$vGrp][3] = mysql_select_multi("SELECT `s`.`player_id` AS `id`, `s`.`value` AS `value`, `p`.`name` AS `name`, `p`.`vocation` AS `vocation`, `za`.`flag` AS `flag` $outfits FROM `player_skills` AS `s` INNER JOIN `players` AS `p` ON `s`.`player_id`=`p`.`id` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id`=`za`.`account_id` WHERE `s`.`skillid` = 3 AND `p`.`group_id` < $g $v ORDER BY `s`.`value` DESC LIMIT 0, $rows;");
|
|
||||||
$vocGroups[$vGrp][4] = mysql_select_multi("SELECT `s`.`player_id` AS `id`, `s`.`value` AS `value`, `p`.`name` AS `name`, `p`.`vocation` AS `vocation`, `za`.`flag` AS `flag` $outfits FROM `player_skills` AS `s` INNER JOIN `players` AS `p` ON `s`.`player_id`=`p`.`id` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id`=`za`.`account_id` WHERE `s`.`skillid` = 4 AND `p`.`group_id` < $g $v ORDER BY `s`.`value` DESC LIMIT 0, $rows;");
|
|
||||||
$vocGroups[$vGrp][5] = mysql_select_multi("SELECT `s`.`player_id` AS `id`, `s`.`value` AS `value`, `p`.`name` AS `name`, `p`.`vocation` AS `vocation`, `za`.`flag` AS `flag` $outfits FROM `player_skills` AS `s` INNER JOIN `players` AS `p` ON `s`.`player_id`=`p`.`id` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id`=`za`.`account_id` WHERE `s`.`skillid` = 5 AND `p`.`group_id` < $g $v ORDER BY `s`.`value` DESC LIMIT 0, $rows;");
|
|
||||||
$vocGroups[$vGrp][6] = mysql_select_multi("SELECT `s`.`player_id` AS `id`, `s`.`value` AS `value`, `p`.`name` AS `name`, `p`.`vocation` AS `vocation`, `za`.`flag` AS `flag` $outfits FROM `player_skills` AS `s` INNER JOIN `players` AS `p` ON `s`.`player_id`=`p`.`id` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id`=`za`.`account_id` WHERE `s`.`skillid` = 6 AND `p`.`group_id` < $g $v ORDER BY `s`.`value` DESC LIMIT 0, $rows;");
|
|
||||||
$vocGroups[$vGrp][7] = mysql_select_multi("SELECT `p`.`id`, `p`.`name`, `p`.`vocation`, `p`.`experience`, `p`.`level` AS `value`, `za`.`flag` AS `flag` $outfits FROM `players` AS `p` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id`=`za`.`account_id` WHERE `p`.`group_id` < $g $v ORDER BY `p`.`experience` DESC limit 0, $rows;");
|
|
||||||
$vocGroups[$vGrp][8] = mysql_select_multi("SELECT `p`.`id`, `p`.`name`, `p`.`vocation`, `p`.`maglevel` AS `value`, `za`.`flag` AS `flag` $outfits FROM `players` AS `p` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id`=`za`.`account_id` WHERE `p`.`group_id` < $g $v ORDER BY `p`.`maglevel` DESC limit 0, $rows;");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1114,36 +885,13 @@ function user_account_id_from_name($id) {
|
|||||||
|
|
||||||
// Add additional premium days to account id
|
// Add additional premium days to account id
|
||||||
function user_account_add_premdays($accid, $days) {
|
function user_account_add_premdays($accid, $days) {
|
||||||
global $tfs_10_hasPremDays; // Initialized in engine/init.php
|
|
||||||
$accid = (int)$accid;
|
$accid = (int)$accid;
|
||||||
$days = (int)$days;
|
$days = (int)$days;
|
||||||
|
mysql_update("
|
||||||
if (config('ServerEngine') !== 'OTHIRE') {
|
UPDATE `accounts`
|
||||||
if ($tfs_10_hasPremDays) {
|
|
||||||
if (mysql_select_single("SHOW COLUMNS from `accounts` WHERE `Field` = 'lastday'") === false) {
|
|
||||||
mysql_update("UPDATE `accounts` SET `premdays` = `premdays`+{$days} WHERE `id`='{$accid}'");
|
|
||||||
} else {
|
|
||||||
mysql_update(" UPDATE `accounts`
|
|
||||||
SET `premdays` = `premdays`+{$days}
|
|
||||||
,`lastday` = GREATEST(`lastday`,UNIX_TIMESTAMP(CURDATE())) + ({$days} * 86400)
|
|
||||||
WHERE `id`='{$accid}'
|
|
||||||
");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
mysql_update(" UPDATE `accounts`
|
|
||||||
SET `premium_ends_at` = GREATEST(`premium_ends_at`, UNIX_TIMESTAMP(CURDATE())) + ({$days} * 86400)
|
SET `premium_ends_at` = GREATEST(`premium_ends_at`, UNIX_TIMESTAMP(CURDATE())) + ({$days} * 86400)
|
||||||
WHERE `id`='{$accid}';
|
WHERE `id`='{$accid}';
|
||||||
");
|
");
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$data = mysql_select_single("SELECT `premend` FROM `accounts` WHERE `id`='$accid';");
|
|
||||||
$tmp = $data['premend'];
|
|
||||||
if($tmp == 0)
|
|
||||||
$tmp = time() + ($days * 24 * 60 * 60);
|
|
||||||
else
|
|
||||||
$tmp = $tmp + ($days * 24 * 60 * 60);
|
|
||||||
mysql_update("UPDATE `accounts` SET `premend`='$tmp' WHERE `id`='$accid'");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Name = char name. Changes from male to female & vice versa.
|
// Name = char name. Changes from male to female & vice versa.
|
||||||
@ -1447,19 +1195,8 @@ function user_create_character($character_data) {
|
|||||||
|
|
||||||
// Returns counted value of all players online
|
// Returns counted value of all players online
|
||||||
function user_count_online() {
|
function user_count_online() {
|
||||||
if (config('ServerEngine') == 'TFS_10') {
|
|
||||||
$online = mysql_select_single("SELECT COUNT(`player_id`) AS `value` FROM `players_online`;");
|
$online = mysql_select_single("SELECT COUNT(`player_id`) AS `value` FROM `players_online`;");
|
||||||
return ($online !== false) ? $online['value'] : 0;
|
return ($online !== false) ? $online['value'] : 0;
|
||||||
} else {
|
|
||||||
$data = mysql_select_single("SELECT COUNT(`id`) AS `count` from `players` WHERE `online` = 1;");
|
|
||||||
return ($data !== false) ? $data['count'] : 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns counted value of all accounts.
|
|
||||||
function user_count_accounts() {
|
|
||||||
$result = mysql_select_single("SELECT COUNT(`id`) AS `id` from `accounts`;");
|
|
||||||
return ($result !== false) ? $result['id'] : 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* user_character_data (fetches whatever data you want from players table)!
|
/* user_character_data (fetches whatever data you want from players table)!
|
||||||
@ -1736,33 +1473,4 @@ function user_logged_in() {
|
|||||||
return (getSession('user_id') !== false) ? true : false;
|
return (getSession('user_id') !== false) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function guild_war_invitation($cid, $gid) {
|
|
||||||
$cid = (int)$cid;
|
|
||||||
$gid = (int)$gid;
|
|
||||||
$gname = get_guild_name($cid);
|
|
||||||
$ename = get_guild_name($gid);
|
|
||||||
$time = time();
|
|
||||||
mysql_insert("INSERT INTO `guild_wars` (`guild1`, `guild2`, `name1`, `name2`, `status`, `started`, `ended`) VALUES ('$cid', '$gid', '$gname', '$ename', '0', '$time', '0');");
|
|
||||||
}
|
|
||||||
|
|
||||||
function accept_war_invitation($cid, $gid) {
|
|
||||||
$cid = (int)$cid;
|
|
||||||
$gid = (int)$gid;
|
|
||||||
mysql_update("UPDATE `guild_wars` SET `status` = 1 WHERE `guild1` = '$cid' AND `guild2` = '$gid' AND `status` = 0;");
|
|
||||||
}
|
|
||||||
|
|
||||||
function reject_war_invitation($cid, $gid) {
|
|
||||||
$cid = (int)$cid;
|
|
||||||
$gid = (int)$gid;
|
|
||||||
$time = time();
|
|
||||||
mysql_update("UPDATE `guild_wars` SET `status` = 2, `ended` = '$time' WHERE `guild1` = '$cid' AND `guild2` = '$gid';");
|
|
||||||
}
|
|
||||||
|
|
||||||
function cancel_war_invitation($cid, $gid) {
|
|
||||||
$cid = (int)$cid;
|
|
||||||
$gid = (int)$gid;
|
|
||||||
$time = time();
|
|
||||||
mysql_update("UPDATE `guild_wars` SET `status` = 3, `ended` = '$time' WHERE `guild2` = '$cid' AND `guild1` = '$gid';");
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?php if (version_compare(phpversion(), '5.6', '<')) die('PHP version 5.6 or higher is required.');
|
<?php if (version_compare(phpversion(), '7.2', '<')) die('PHP version 7.2 or higher is required.');
|
||||||
|
|
||||||
$l_time = microtime();
|
$l_time = microtime();
|
||||||
$l_time = explode(' ', $l_time);
|
$l_time = explode(' ', $l_time);
|
||||||
@ -15,7 +15,7 @@ function elapsedTime($l_start = false, $l_time = false) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$time = time();
|
$time = time();
|
||||||
$version = '1.5_SVN';
|
$version = '2.0_DEV';
|
||||||
|
|
||||||
$aacQueries = 0;
|
$aacQueries = 0;
|
||||||
$accQueriesData = array();
|
$accQueriesData = array();
|
||||||
@ -50,25 +50,10 @@ if (isset($_SESSION['token'])) {
|
|||||||
}
|
}
|
||||||
Token::generate();
|
Token::generate();
|
||||||
|
|
||||||
$tfs_10_hasPremDays = true; // https://github.com/otland/forgottenserver/pull/2813
|
|
||||||
|
|
||||||
if (user_logged_in() === true) {
|
if (user_logged_in() === true) {
|
||||||
$session_user_id = getSession('user_id');
|
$session_user_id = (int)getSession('user_id');
|
||||||
if ($config['ServerEngine'] !== 'OTHIRE') {
|
|
||||||
if ($config['ServerEngine'] == 'TFS_10') {
|
|
||||||
$hasPremDays = mysql_select_single("SHOW COLUMNS from `accounts` WHERE `Field` = 'premdays'");
|
|
||||||
if ($hasPremDays === false) {
|
|
||||||
$tfs_10_hasPremDays = false;
|
|
||||||
$user_data = user_data($session_user_id, 'id', 'name', 'password', 'email', 'premium_ends_at');
|
$user_data = user_data($session_user_id, 'id', 'name', 'password', 'email', 'premium_ends_at');
|
||||||
$user_data['premdays'] = ($user_data['premium_ends_at'] - time() > 0) ? floor(($user_data['premium_ends_at'] - time()) / 86400) : 0;
|
$user_data['premdays'] = ($user_data['premium_ends_at'] - time() > 0) ? floor(($user_data['premium_ends_at'] - time()) / 86400) : 0;
|
||||||
} else {
|
|
||||||
$user_data = user_data($session_user_id, 'id', 'name', 'password', 'email', 'premdays');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$user_data = user_data($session_user_id, 'id', 'name', 'password', 'email', 'premdays');
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
$user_data = user_data($session_user_id, 'id', 'password', 'email', 'premend');
|
|
||||||
$user_znote_data = user_znote_account_data($session_user_id, 'ip', 'created', 'points', 'cooldown', 'flag' ,'active_email');
|
$user_znote_data = user_znote_account_data($session_user_id, 'ip', 'created', 'points', 'cooldown', 'flag' ,'active_email');
|
||||||
}
|
}
|
||||||
$errors = array();
|
$errors = array();
|
||||||
|
784
guilds.php
784
guilds.php
File diff suppressed because it is too large
Load Diff
130
house.php
130
house.php
@ -4,12 +4,22 @@ if ($config['log_ip']) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$house = (isset($_GET['id']) && (int)$_GET['id'] > 0) ? (int)$_GET['id'] : false;
|
$house = (isset($_GET['id']) && (int)$_GET['id'] > 0) ? (int)$_GET['id'] : false;
|
||||||
|
$house_SQL = "";
|
||||||
if ($house !== false && $config['ServerEngine'] === 'TFS_10') {
|
if ($house !== false) {
|
||||||
$house_SQL = "SELECT `id`, `owner`, `paid`, `name`, `rent`, `town_id`, `size`, `beds`, `bid`, `bid_end`, `last_bid`, `highest_bidder` FROM `houses` WHERE `id`='$house';";
|
$house_SQL = "
|
||||||
|
SELECT
|
||||||
|
`h`.`id`, `h`.`owner`, `h`.`paid`, `h`.`name`, `h`.`rent`, `h`.`town_id`,
|
||||||
|
`h`.`size`, `h`.`beds`, `h`.`bid`, `h`.`bid_end`, `h`.`last_bid`, `h`.`highest_bidder`,
|
||||||
|
`p`.`name` AS `ownername`
|
||||||
|
FROM `houses` AS `h`
|
||||||
|
LEFT JOIN `players` AS `p`
|
||||||
|
ON `h`.`owner` > 0
|
||||||
|
AND `p`.`id` = `h`.`owner`
|
||||||
|
WHERE `h`.`id`='{$house}';
|
||||||
|
";
|
||||||
$house = mysql_select_single($house_SQL);
|
$house = mysql_select_single($house_SQL);
|
||||||
$minbid = $config['houseConfig']['minimumBidSQM'] * $house['size'];
|
$minbid = $config['houseConfig']['minimumBidSQM'] * $house['size'];
|
||||||
if ($house['owner'] > 0) $house['ownername'] = user_name($house['owner']);
|
if ($house['owner'] == 0) unset($house['ownername']);
|
||||||
|
|
||||||
if ($config['houseConfig']['shopPoints']['enabled']) {
|
if ($config['houseConfig']['shopPoints']['enabled']) {
|
||||||
$house['points'] = $house['size'];
|
$house['points'] = $house['size'];
|
||||||
@ -28,19 +38,36 @@ if ($house !== false && $config['ServerEngine'] === 'TFS_10') {
|
|||||||
if ($bid_amount && $bid_char) {
|
if ($bid_amount && $bid_char) {
|
||||||
$bid_char = (int)$bid_char;
|
$bid_char = (int)$bid_char;
|
||||||
$bid_amount = (int)$bid_amount;
|
$bid_amount = (int)$bid_amount;
|
||||||
$player = mysql_select_single("SELECT `id`, `account_id`, `name`, `level`, `balance` FROM `players` WHERE `id`='$bid_char' LIMIT 1;");
|
|
||||||
|
$player = mysql_select_single("
|
||||||
|
SELECT `id`, `account_id`, `name`, `level`, `balance`
|
||||||
|
FROM `players`
|
||||||
|
WHERE `id`='$bid_char' LIMIT 1;
|
||||||
|
");
|
||||||
|
|
||||||
if (user_logged_in() === true && $player['account_id'] == $session_user_id) {
|
if (user_logged_in() === true && $player['account_id'] == $session_user_id) {
|
||||||
// Does player have or need premium?
|
// Does player have or need premium?
|
||||||
$premstatus = ($config['houseConfig']['requirePremium'] && $user_data['premdays'] == 0) ? false : true;
|
$premstatus = ($config['houseConfig']['requirePremium'] && $user_data['premdays'] == 0) ? false : true;
|
||||||
if ($premstatus) {
|
if ($premstatus) {
|
||||||
|
|
||||||
// Can player have or bid on more houses?
|
// Can player have or bid on more houses?
|
||||||
$pHouseCount = mysql_select_single("SELECT COUNT('id') AS `value` FROM `houses` WHERE ((`highest_bidder`='$bid_char' AND `owner`='$bid_char') OR (`highest_bidder`='$bid_char') OR (`owner`='$bid_char')) AND `id`!='".$house['id']."' LIMIT 1;");
|
$pHouseCount = mysql_select_single("
|
||||||
|
SELECT COUNT('id') AS `value`
|
||||||
|
FROM `houses`
|
||||||
|
WHERE (
|
||||||
|
(`highest_bidder`='{$bid_char}' AND `owner`='{$bid_char}')
|
||||||
|
OR (`highest_bidder`='{$bid_char}')
|
||||||
|
OR (`owner`='{$bid_char}')
|
||||||
|
)
|
||||||
|
AND `id`!='{$house['id']}' LIMIT 1;
|
||||||
|
");
|
||||||
|
|
||||||
if ($pHouseCount['value'] < $config['houseConfig']['housesPerPlayer']) {
|
if ($pHouseCount['value'] < $config['houseConfig']['housesPerPlayer']) {
|
||||||
// Is character level high enough?
|
// Is character level high enough?
|
||||||
if ($player['level'] >= $config['houseConfig']['levelToBuyHouse']) {
|
if ($player['level'] >= $config['houseConfig']['levelToBuyHouse']) {
|
||||||
// Can player afford this bid?
|
// Can player afford this bid?
|
||||||
if ($player['balance'] > $bid_amount) {
|
if ($player['balance'] > $bid_amount) {
|
||||||
|
|
||||||
// Is bid higher than previous bid?
|
// Is bid higher than previous bid?
|
||||||
if ($bid_amount > $house['bid']) {
|
if ($bid_amount > $house['bid']) {
|
||||||
// Is bid higher than lowest bid?
|
// Is bid higher than lowest bid?
|
||||||
@ -55,17 +82,51 @@ if ($house !== false && $config['ServerEngine'] === 'TFS_10') {
|
|||||||
// Has bid already started?
|
// Has bid already started?
|
||||||
if ($house['bid_end'] > 0) {
|
if ($house['bid_end'] > 0) {
|
||||||
if ($house['bid_end'] > time()) {
|
if ($house['bid_end'] > time()) {
|
||||||
mysql_update("UPDATE `houses` SET `highest_bidder`='". $player['id'] ."', `bid`='$bid_amount', `last_bid`='$lastbid' WHERE `id`='". $house['id'] ."' LIMIT 1;");
|
|
||||||
$house = mysql_select_single("SELECT `id`, `owner`, `paid`, `name`, `rent`, `town_id`, `size`, `beds`, `bid`, `bid_end`, `last_bid`, `highest_bidder` FROM `houses` WHERE `id`='". $house['id'] ."';");
|
mysql_update("
|
||||||
|
UPDATE `houses`
|
||||||
|
SET
|
||||||
|
`highest_bidder`='{$player['id']}',
|
||||||
|
`bid`='{$bid_amount}',
|
||||||
|
`last_bid`='{$lastbid}'
|
||||||
|
WHERE `id`='{$house['id']}' LIMIT 1;
|
||||||
|
");
|
||||||
|
|
||||||
|
$house = mysql_select_single("
|
||||||
|
SELECT
|
||||||
|
`id`, `owner`, `paid`, `name`, `rent`, `town_id`, `size`,
|
||||||
|
`beds`, `bid`, `bid_end`, `last_bid`, `highest_bidder`
|
||||||
|
FROM `houses`
|
||||||
|
WHERE `id`='{$house['id']}';
|
||||||
|
");
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$lastbid = $minbid + 1;
|
$lastbid = $minbid + 1;
|
||||||
$bidend = time() + $config['houseConfig']['auctionPeriod'];
|
$bidend = time() + $config['houseConfig']['auctionPeriod'];
|
||||||
mysql_update("UPDATE `houses` SET `highest_bidder`='". $player['id'] ."', `bid`='$bid_amount', `last_bid`='$lastbid', `bid_end`='$bidend' WHERE `id`='". $house['id'] ."' LIMIT 1;");
|
|
||||||
$house = mysql_select_single("SELECT `id`, `owner`, `paid`, `name`, `rent`, `town_id`, `size`, `beds`, `bid`, `bid_end`, `last_bid`, `highest_bidder` FROM `houses` WHERE `id`='". $house['id'] ."';");
|
mysql_update("
|
||||||
|
UPDATE `houses`
|
||||||
|
SET
|
||||||
|
`highest_bidder`='{$player['id']}',
|
||||||
|
`bid`='{$bid_amount}',
|
||||||
|
`last_bid`='{$lastbid}',
|
||||||
|
`bid_end`='{$bidend}'
|
||||||
|
WHERE `id`='{$house['id']}' LIMIT 1;
|
||||||
|
");
|
||||||
|
|
||||||
|
$house = mysql_select_single("
|
||||||
|
SELECT
|
||||||
|
`id`, `owner`, `paid`, `name`, `rent`, `town_id`, `size`,
|
||||||
|
`beds`, `bid`, `bid_end`, `last_bid`, `highest_bidder`
|
||||||
|
FROM `houses`
|
||||||
|
WHERE `id`='{$house['id']}';
|
||||||
|
");
|
||||||
|
|
||||||
}
|
}
|
||||||
echo "<b><font color='green'>You have the highest bid on this house!</font></b>";
|
echo "<b><font color='green'>You have the highest bid on this house!</font></b>";
|
||||||
} else echo "<b><font color='red'>You need to place a bid that is higher or equal to {$minbid}gp.</font></b>";
|
} else echo "<b><font color='red'>You need to place a bid that is higher or equal to {$minbid}gp.</font></b>";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Check if current bid is higher than last_bid
|
// Check if current bid is higher than last_bid
|
||||||
if ($bid_amount > $house['last_bid']) {
|
if ($bid_amount > $house['last_bid']) {
|
||||||
@ -73,8 +134,21 @@ if ($house !== false && $config['ServerEngine'] === 'TFS_10') {
|
|||||||
// being forced to pay his full previous bid.
|
// being forced to pay his full previous bid.
|
||||||
if ($house['highest_bidder'] != $player['id']) {
|
if ($house['highest_bidder'] != $player['id']) {
|
||||||
$lastbid = $bid_amount + 1;
|
$lastbid = $bid_amount + 1;
|
||||||
mysql_update("UPDATE `houses` SET `last_bid`='$lastbid' WHERE `id`='". $house['id'] ."' LIMIT 1;");
|
|
||||||
$house = mysql_select_single("SELECT `id`, `owner`, `paid`, `name`, `rent`, `town_id`, `size`, `beds`, `bid`, `bid_end`, `last_bid`, `highest_bidder` FROM `houses` WHERE `id`='". $house['id'] ."';");
|
mysql_update("
|
||||||
|
UPDATE `houses`
|
||||||
|
SET `last_bid`='$lastbid'
|
||||||
|
WHERE `id`='{$house['id']}' LIMIT 1;
|
||||||
|
");
|
||||||
|
|
||||||
|
$house = mysql_select_single("
|
||||||
|
SELECT
|
||||||
|
`id`, `owner`, `paid`, `name`, `rent`, `town_id`, `size`,
|
||||||
|
`beds`, `bid`, `bid_end`, `last_bid`, `highest_bidder`
|
||||||
|
FROM `houses`
|
||||||
|
WHERE `id`='{$house['id']}';
|
||||||
|
");
|
||||||
|
|
||||||
echo "<b><font color='orange'>Unfortunately your bid was not higher than previous bidder.</font></b>";
|
echo "<b><font color='orange'>Unfortunately your bid was not higher than previous bidder.</font></b>";
|
||||||
} else {
|
} else {
|
||||||
echo "<b><font color='orange'>You already have a higher pledge on this house.</font></b>";
|
echo "<b><font color='orange'>You already have a higher pledge on this house.</font></b>";
|
||||||
@ -103,8 +177,22 @@ if ($house !== false && $config['ServerEngine'] === 'TFS_10') {
|
|||||||
if ($account_points >= $house['points']) {
|
if ($account_points >= $house['points']) {
|
||||||
|
|
||||||
$bid_char = (int)$bid_char;
|
$bid_char = (int)$bid_char;
|
||||||
$player = mysql_select_single("SELECT `id`, `account_id`, `name`, `level` FROM `players` WHERE `id`='$bid_char' LIMIT 1;");
|
$player = mysql_select_single("
|
||||||
$pHouseCount = mysql_select_single("SELECT COUNT('id') AS `value` FROM `houses` WHERE ((`highest_bidder`='$bid_char' AND `owner`='$bid_char') OR (`highest_bidder`='$bid_char') OR (`owner`='$bid_char')) AND `id`!='".$house['id']."' LIMIT 1;");
|
SELECT `id`, `account_id`, `name`, `level`
|
||||||
|
FROM `players`
|
||||||
|
WHERE `id`='$bid_char' LIMIT 1;
|
||||||
|
");
|
||||||
|
|
||||||
|
$pHouseCount = mysql_select_single("
|
||||||
|
SELECT COUNT('id') AS `value`
|
||||||
|
FROM `houses`
|
||||||
|
WHERE (
|
||||||
|
(`highest_bidder`='$bid_char' AND `owner`='$bid_char')
|
||||||
|
OR (`highest_bidder`='$bid_char')
|
||||||
|
OR (`owner`='$bid_char')
|
||||||
|
)
|
||||||
|
AND `id`!='{$house['id']}' LIMIT 1;
|
||||||
|
");
|
||||||
|
|
||||||
if (user_logged_in() === true
|
if (user_logged_in() === true
|
||||||
&& $player['account_id'] == $session_user_id
|
&& $player['account_id'] == $session_user_id
|
||||||
@ -177,12 +265,12 @@ if ($house !== false && $config['ServerEngine'] === 'TFS_10') {
|
|||||||
<li><b>Town</b>:
|
<li><b>Town</b>:
|
||||||
<?php
|
<?php
|
||||||
$town_name = &$config['towns'][$house['town_id']];
|
$town_name = &$config['towns'][$house['town_id']];
|
||||||
echo "<a href='houses.php?id=". $house['town_id'] ."'>". ($town_name ? $town_name : 'Specify town id ' . $house['town_id'] . ' name in config.php first.') ."</a>";
|
echo "<a href='houses.php?id={$house['town_id']}'>". ($town_name ? $town_name : 'Specify town id ' . $house['town_id'] . ' name in config.php first.') ."</a>";
|
||||||
?></li>
|
?></li>
|
||||||
<li><b>Size</b>: <?php echo $house['size']; ?></li>
|
<li><b>Size</b>: <?php echo $house['size']; ?></li>
|
||||||
<li><b>Beds</b>: <?php echo $house['beds']; ?></li>
|
<li><b>Beds</b>: <?php echo $house['beds']; ?></li>
|
||||||
<li><b>Owner</b>: <?php
|
<li><b>Owner</b>: <?php
|
||||||
if ($house['owner'] > 0) echo "<a href='characterprofile.php?name=". $house['ownername'] ."' target='_BLANK'>". $house['ownername'] ."</a>";
|
if ($house['owner'] > 0) echo "<a href='characterprofile.php?name={$house['ownername']}' target='_BLANK'>{$house['ownername']}</a>";
|
||||||
else echo "Available for auction.";
|
else echo "Available for auction.";
|
||||||
?></li>
|
?></li>
|
||||||
<li><b>Rent</b>: <?php echo $house['rent']; ?></li>
|
<li><b>Rent</b>: <?php echo $house['rent']; ?></li>
|
||||||
@ -198,17 +286,17 @@ if ($house !== false && $config['ServerEngine'] === 'TFS_10') {
|
|||||||
<?php
|
<?php
|
||||||
if ($house['highest_bidder'] == 0) echo "<b>This house don't have any bidders yet.</b>";
|
if ($house['highest_bidder'] == 0) echo "<b>This house don't have any bidders yet.</b>";
|
||||||
else {
|
else {
|
||||||
$bidder = mysql_select_single("SELECT `name` FROM `players` WHERE `id`='". $house['highest_bidder'] ."' LIMIT 1;");
|
$bidder = mysql_select_single("SELECT `name` FROM `players` WHERE `id`='{$house['highest_bidder']}' LIMIT 1;");
|
||||||
echo "<b>This house have bidders! If you want this house, now is your chance!</b>";
|
echo "<b>This house have bidders! If you want this house, now is your chance!</b>";
|
||||||
echo "<br><b>Active bid:</b> ". $house['last_bid'] ."gp";
|
echo "<br><b>Active bid:</b> {$house['last_bid']}gp";
|
||||||
echo "<br><b>Active bid by:</b> <a href='characterprofile.php?name=". $bidder['name'] ."' target='_BLANK'>". $bidder['name'] ."</a>";
|
echo "<br><b>Active bid by:</b> <a href='characterprofile.php?name={$bidder['name']}' target='_BLANK'>{$bidder['name']}</a>";
|
||||||
echo "<br><b>Bid will end on:</b> ". getClock($house['bid_end'], true);
|
echo "<br><b>Bid will end on:</b> ". getClock($house['bid_end'], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($house['bid_end'] == 0 || $house['bid_end'] > time()) {
|
if ($house['bid_end'] == 0 || $house['bid_end'] > time()) {
|
||||||
if (user_logged_in()) {
|
if (user_logged_in()) {
|
||||||
// Your characters, indexed by char_id
|
// Your characters, indexed by char_id
|
||||||
$yourChars = mysql_select_multi("SELECT `id`, `name`, `balance` FROM `players` WHERE `account_id`='". $user_data['id'] ."';");
|
$yourChars = mysql_select_multi("SELECT `id`, `name`, `balance` FROM `players` WHERE `account_id`='{$user_data['id']}';");
|
||||||
if ($yourChars !== false) {
|
if ($yourChars !== false) {
|
||||||
$charData = array();
|
$charData = array();
|
||||||
foreach ($yourChars as $char) {
|
foreach ($yourChars as $char) {
|
||||||
@ -219,7 +307,7 @@ if ($house !== false && $config['ServerEngine'] === 'TFS_10') {
|
|||||||
<select name="char">
|
<select name="char">
|
||||||
<?php
|
<?php
|
||||||
foreach ($charData as $id => $char) {
|
foreach ($charData as $id => $char) {
|
||||||
echo "<option value='$id'>". $char['name'] ." [". $char['balance'] ."]</option>";
|
echo "<option value='$id'>{$char['name']} [{$char['balance']}]</option>";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
|
229
houses.php
229
houses.php
@ -5,193 +5,17 @@ include 'layout/overall/header.php';
|
|||||||
if ($config['log_ip'])
|
if ($config['log_ip'])
|
||||||
znote_visitor_insert_detailed_data(3);
|
znote_visitor_insert_detailed_data(3);
|
||||||
|
|
||||||
if (empty($_POST) === false && $config['ServerEngine'] === 'TFS_03') {
|
// Fetch values
|
||||||
|
$querystring_id = &$_GET['id'];
|
||||||
|
$townid = ($querystring_id) ? (int)$_GET['id'] : $config['houseConfig']['HouseListDefaultTown'];
|
||||||
|
$towns = $config['towns'];
|
||||||
|
|
||||||
/* Token used for cross site scripting security */
|
$order = &$_GET['order'];
|
||||||
if (isset($_POST['token']) && Token::isValid($_POST['token'])) {
|
$type = &$_GET['type'];
|
||||||
|
|
||||||
$townid = (int)$_POST['selected'];
|
// Create Search house box
|
||||||
$cache = new Cache('engine/cache/houses');
|
?>
|
||||||
$array = array();
|
<form action="" method="get" class="houselist">
|
||||||
if ($cache->hasExpired()) {
|
|
||||||
$tmp = fetchAllHouses_03();
|
|
||||||
$cache->setContent($tmp);
|
|
||||||
$cache->save();
|
|
||||||
|
|
||||||
foreach ($tmp as $t) {
|
|
||||||
if ($t['town'] == $townid) $array[] = $t;
|
|
||||||
}
|
|
||||||
$array = isset($array) ? $array : false;
|
|
||||||
} else {
|
|
||||||
$tmp = $cache->load();
|
|
||||||
foreach ($tmp as $t) {
|
|
||||||
if ($t['town'] == $townid) $array[] = $t;
|
|
||||||
}
|
|
||||||
$array = isset($array) ? $array : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Design and present the list
|
|
||||||
if ($array) {
|
|
||||||
$guild_support = (isset($array[0]['guild'])) ? true : false;
|
|
||||||
?>
|
|
||||||
<h2>
|
|
||||||
<?php echo ucfirst(town_id_to_name($townid)); ?> house list.
|
|
||||||
</h2>
|
|
||||||
<div class="well widget">
|
|
||||||
<div class="header">
|
|
||||||
Town list / houses
|
|
||||||
</div>
|
|
||||||
<div class="body">
|
|
||||||
<form action="houses.php" method="<?php if ($config['ServerEngine'] !== 'TFS_10') echo "post"; else echo "get" ;?>">
|
|
||||||
<select name="<?php if ($config['ServerEngine'] !== 'TFS_10') echo "selected"; else echo "id" ;?>">
|
|
||||||
<?php
|
|
||||||
foreach ($config['towns'] as $id => $name)
|
|
||||||
echo '<option value="'. $id .'">'. $name .'</option>';
|
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
<?php Token::create(); ?>
|
|
||||||
<input type="submit" value="Fetch houses">
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<table id="housesTable" class="table table-striped">
|
|
||||||
<tr class="yellow">
|
|
||||||
<th>Name:</th>
|
|
||||||
<th>Size:</th>
|
|
||||||
<th>Doors:</th>
|
|
||||||
<th>Beds:</th>
|
|
||||||
<th>Price:</th>
|
|
||||||
<th>Owner:</th>
|
|
||||||
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
foreach ($array as $value) {
|
|
||||||
echo '<tr>';
|
|
||||||
echo "<td>". $value['name'] ."</td>";
|
|
||||||
echo "<td>". $value['size'] ."</td>";
|
|
||||||
echo "<td>". $value['doors'] ."</td>";
|
|
||||||
echo "<td>". $value['beds'] ."</td>";
|
|
||||||
echo "<td>". $value['price'] ."</td>";
|
|
||||||
if ($value['owner'] == 0)
|
|
||||||
echo "<td>None</td>";
|
|
||||||
else {
|
|
||||||
if ($guild_support && $value['guild'] == 1) {
|
|
||||||
$guild_name = get_guild_name($value['owner']);
|
|
||||||
echo '<td><a href="guilds.php?name='. $guild_name .'">'. $guild_name .'</a></td>';
|
|
||||||
} else {
|
|
||||||
$data = user_character_data($value['owner'], 'name');
|
|
||||||
echo '<td><a href="characterprofile.php?name='. $data['name'] .'">'. $data['name'] .'</a></td>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
echo '</tr>';
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</table>
|
|
||||||
<?php
|
|
||||||
} else {
|
|
||||||
echo 'Empty list, it appears no houses are listed in this town.';
|
|
||||||
}
|
|
||||||
//Done.
|
|
||||||
} else {
|
|
||||||
echo 'Token appears to be incorrect.<br><br>';
|
|
||||||
//Token::debug($_POST['token']);
|
|
||||||
echo 'Please clear your web cache/cookies <b>OR</b> use another web browser<br>';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (empty($_POST) === true && $config['ServerEngine'] === 'TFS_03') {
|
|
||||||
?>
|
|
||||||
<div class="well widget">
|
|
||||||
<div class="header">
|
|
||||||
Town list / houses
|
|
||||||
</div>
|
|
||||||
<div class="body">
|
|
||||||
<form action="houses.php" method="<?php if ($config['ServerEngine'] !== 'TFS_10') echo "post"; else echo "get" ;?>">
|
|
||||||
<select name="<?php if ($config['ServerEngine'] !== 'TFS_10') echo "selected"; else echo "id" ;?>">
|
|
||||||
<?php
|
|
||||||
foreach ($config['towns'] as $id => $name)
|
|
||||||
echo '<option value="'. $id .'">'. $name .'</option>';
|
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
<?php Token::create(); ?>
|
|
||||||
<input type="submit" value="Fetch houses">
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php
|
|
||||||
} else if ($config['ServerEngine'] === 'TFS_02' || $config['ServerEngine'] == 'OTHIRE') {
|
|
||||||
$house = $config['house'];
|
|
||||||
if (!is_file($house['house_file'])) {
|
|
||||||
echo("<h3>House file not found</h3><p>FAILED TO LOCATE/READ FILE AT:<br><font color='red'>". $house['house_file'] ."</font><br><br>LINUX users: Make sure www-data have read access to file.<br>WINDOWS users: Learn to write correct file path.</p>");
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load and cache SQL house data:
|
|
||||||
$cache = new Cache('engine/cache/houses/sqldata');
|
|
||||||
if ($cache->hasExpired()) {
|
|
||||||
$house_query = mysql_select_multi('SELECT `players`.`name`, `houses`.`id` FROM `players`, `houses` WHERE `houses`.`owner` = `players`.`id`;');
|
|
||||||
|
|
||||||
$cache->setContent($house_query);
|
|
||||||
$cache->save();
|
|
||||||
} else
|
|
||||||
$house_query = $cache->load();
|
|
||||||
|
|
||||||
$sqmPrice = $house['price_sqm'];
|
|
||||||
$house_load = simplexml_load_file($house['house_file']);
|
|
||||||
if ($house_query !== false && $house_load !== false) {
|
|
||||||
?>
|
|
||||||
<h2>House list</h2>
|
|
||||||
<table>
|
|
||||||
<tr class="yellow">
|
|
||||||
<td><b>House</b></td>
|
|
||||||
<td><b>Location</b></td>
|
|
||||||
<td><b>Owner</b></td>
|
|
||||||
<td><b>Size</b></td>
|
|
||||||
<td><b>Rent</b></td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
//execute code.
|
|
||||||
foreach($house_query as $row)
|
|
||||||
$house_info[(int)$row['id']] = '<a href="characterprofile.php?name='. $row['name'] .'">'. $row['name'] .'</a>';
|
|
||||||
|
|
||||||
foreach ($house_load as $house_fetch){
|
|
||||||
$house_price = (int)$house_fetch['size'] * $sqmPrice;
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td><?php echo htmlspecialchars($house_fetch['name']); ?></td>
|
|
||||||
<td>
|
|
||||||
<?php
|
|
||||||
if (isset($config['towns'][(int)$house_fetch['townid']])) echo htmlspecialchars($config['towns'][(int)$house_fetch['townid']]);
|
|
||||||
else echo '(Missing town)';
|
|
||||||
?>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<?php
|
|
||||||
if (isset($house_info[(int)$house_fetch['houseid']])) echo $house_info[(int)$house_fetch['houseid']];
|
|
||||||
else echo 'None [Available]';
|
|
||||||
?>
|
|
||||||
</td>
|
|
||||||
<td><?php echo $house_fetch['size']; ?></td>
|
|
||||||
<td><?php echo $house_price; ?></td>
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</table>
|
|
||||||
<?php
|
|
||||||
} else echo '<p><font color="red">Something is wrong with the cache.</font></p>';
|
|
||||||
} else if ($config['ServerEngine'] === 'TFS_10') {
|
|
||||||
// Fetch values
|
|
||||||
$querystring_id = &$_GET['id'];
|
|
||||||
$townid = ($querystring_id) ? (int)$_GET['id'] : $config['houseConfig']['HouseListDefaultTown'];
|
|
||||||
$towns = $config['towns'];
|
|
||||||
|
|
||||||
$order = &$_GET['order'];
|
|
||||||
$type = &$_GET['type'];
|
|
||||||
|
|
||||||
// Create Search house box
|
|
||||||
?>
|
|
||||||
<form action="" method="get" class="houselist">
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Town</td>
|
<td>Town</td>
|
||||||
@ -232,19 +56,28 @@ if (empty($_POST) === false && $config['ServerEngine'] === 'TFS_03') {
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
<?php
|
<?php
|
||||||
if(!in_array($order, $order_allowed))
|
if(!in_array($order, $order_allowed))
|
||||||
$order = 'id';
|
$order = 'id';
|
||||||
|
|
||||||
if(!in_array($type, $type_allowed))
|
if(!in_array($type, $type_allowed))
|
||||||
$type = 'desc';
|
$type = 'desc';
|
||||||
|
|
||||||
// Create or fetch data from cache
|
// Create or fetch data from cache
|
||||||
$cache = new Cache('engine/cache/houses/houses-' . $order . '-' . $type);
|
$cache = new Cache('engine/cache/houses/houses-' . $order . '-' . $type);
|
||||||
$houses = array();
|
$houses = array();
|
||||||
if ($cache->hasExpired()) {
|
|
||||||
$houses = mysql_select_multi("SELECT `id`, `owner`, `paid`, `warnings`, `name`, `rent`, `town_id`, `size`, `beds`, `bid`, `bid_end`, `last_bid`, `highest_bidder` FROM `houses` ORDER BY {$order} {$type};");
|
if ($cache->hasExpired()) {
|
||||||
|
|
||||||
|
$houses = mysql_select_multi("
|
||||||
|
SELECT
|
||||||
|
`id`, `owner`, `paid`, `warnings`, `name`, `rent`, `town_id`,
|
||||||
|
`size`, `beds`, `bid`, `bid_end`, `last_bid`, `highest_bidder`
|
||||||
|
FROM `houses`
|
||||||
|
ORDER BY {$order} {$type};
|
||||||
|
");
|
||||||
|
|
||||||
if ($houses !== false) {
|
if ($houses !== false) {
|
||||||
// Fetch player names
|
// Fetch player names
|
||||||
$playerlist = array();
|
$playerlist = array();
|
||||||
@ -270,10 +103,10 @@ if (empty($_POST) === false && $config['ServerEngine'] === 'TFS_03') {
|
|||||||
$cache->setContent($houses);
|
$cache->setContent($houses);
|
||||||
$cache->save();
|
$cache->save();
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
$houses = $cache->load();
|
$houses = $cache->load();
|
||||||
|
|
||||||
if ($houses !== false || !empty($houses)) {
|
if ($houses !== false || !empty($houses)) {
|
||||||
// Intialize stuff
|
// Intialize stuff
|
||||||
//data_dump($houses, false, "House data");
|
//data_dump($houses, false, "House data");
|
||||||
?>
|
?>
|
||||||
@ -314,8 +147,8 @@ if (empty($_POST) === false && $config['ServerEngine'] === 'TFS_03') {
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
} else
|
} else {
|
||||||
echo "<h1>Failed to fetch data from sql->houses table.</h1><p>Is the table empty?</p>";
|
echo "<h1>Failed to fetch data from sql->houses table.</h1><p>Is the table empty?</p>";
|
||||||
} // End TFS 1.0 logic
|
|
||||||
}
|
}
|
||||||
|
|
||||||
include 'layout/overall/footer.php'; ?>
|
include 'layout/overall/footer.php'; ?>
|
||||||
|
@ -15,6 +15,7 @@ require_once 'engine/init.php'; include 'layout/overall/header.php';
|
|||||||
// Changelog ticker //
|
// Changelog ticker //
|
||||||
// Load from cache
|
// Load from cache
|
||||||
$changelogCache = new Cache('engine/cache/changelog');
|
$changelogCache = new Cache('engine/cache/changelog');
|
||||||
|
$changelogCache->useMemory(false);
|
||||||
$changelogs = $changelogCache->load();
|
$changelogs = $changelogCache->load();
|
||||||
|
|
||||||
if (isset($changelogs) && !empty($changelogs) && $changelogs !== false) {
|
if (isset($changelogs) && !empty($changelogs) && $changelogs !== false) {
|
||||||
|
@ -229,6 +229,9 @@ table, .header, .well, .smedia a {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Znote AAC */
|
/* Znote AAC */
|
||||||
|
.leftPane img {
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
/* adding button style to select */
|
/* adding button style to select */
|
||||||
select {
|
select {
|
||||||
background: rgb(15,17,20);
|
background: rgb(15,17,20);
|
||||||
|
@ -14,10 +14,57 @@
|
|||||||
<!--
|
<!--
|
||||||
Designed By <a href="https://otland.net/members/snavy.155163/" target="_blank">Snavy</a>
|
Designed By <a href="https://otland.net/members/snavy.155163/" target="_blank">Snavy</a>
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
|
||||||
</footer>
|
</footer>
|
||||||
</div><!-- Main container END -->
|
</div><!-- Main container END -->
|
||||||
|
|
||||||
|
<?php
|
||||||
|
// If you are logged in as an admin, display SQL queries admin overlay
|
||||||
|
if ($config['admin_show_queries'] && user_logged_in() && is_admin($user_data)): ?>
|
||||||
|
<div id="admin-queries">
|
||||||
|
<label for="admin-toggle">Admin: Toggle Queries</label>
|
||||||
|
<input id="admin-toggle" name="admin-toggle" type="checkbox">
|
||||||
|
<div id="admin-show-queries">
|
||||||
|
<?php data_dump($accQueriesData, false, "Logged in as Admin: Showing executed SQL queries:"); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<style type="text/css">
|
||||||
|
#admin-queries {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 9999;
|
||||||
|
background-color: rgb(30,33,40);
|
||||||
|
opacity: 0.94;
|
||||||
|
max-width: 95%;
|
||||||
|
max-height: 950px;
|
||||||
|
border: 1px solid #d1a233;
|
||||||
|
overflow: overlay;
|
||||||
|
}
|
||||||
|
#admin-queries pre {
|
||||||
|
margin: 0;
|
||||||
|
padding-right: 10px;
|
||||||
|
padding-bottom: 25px;
|
||||||
|
}
|
||||||
|
#admin-queries label {
|
||||||
|
user-select: none;
|
||||||
|
display: inline-block;
|
||||||
|
padding: 5px;
|
||||||
|
color: #b39062;
|
||||||
|
}
|
||||||
|
#admin-queries label:hover {
|
||||||
|
color: #e79424;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
#admin-queries input,
|
||||||
|
#admin-queries #admin-show-queries,
|
||||||
|
#admin-queries br:last-of-type {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
#admin-queries input:checked + #admin-show-queries {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<?php endif; ?>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
<!--
|
<!--
|
||||||
|
@ -4,6 +4,7 @@ if ($config['UseChangelogTicker']) {
|
|||||||
// Changelog ticker //
|
// Changelog ticker //
|
||||||
// Load from cache
|
// Load from cache
|
||||||
$changelogCache = new Cache('engine/cache/changelog');
|
$changelogCache = new Cache('engine/cache/changelog');
|
||||||
|
$changelogCache->useMemory(false);
|
||||||
$changelogs = $changelogCache->load();
|
$changelogs = $changelogCache->load();
|
||||||
|
|
||||||
if (isset($changelogs) && !empty($changelogs) && $changelogs !== false) {
|
if (isset($changelogs) && !empty($changelogs) && $changelogs !== false) {
|
||||||
|
@ -30,6 +30,8 @@
|
|||||||
</li>
|
</li>
|
||||||
<?php
|
<?php
|
||||||
$new = 0;
|
$new = 0;
|
||||||
|
$cache = new Cache('engine/cache/asideFeedbackCount');
|
||||||
|
if ($cache->hasExpired()) {
|
||||||
$cat = 4; //Category ID for feedback section
|
$cat = 4; //Category ID for feedback section
|
||||||
$threads = mysql_select_multi("SELECT `id`, `player_id` FROM `znote_forum_threads` WHERE `forum_id`='$cat' AND `closed`='0';");
|
$threads = mysql_select_multi("SELECT `id`, `player_id` FROM `znote_forum_threads` WHERE `forum_id`='$cat' AND `closed`='0';");
|
||||||
if ($threads !== false) {
|
if ($threads !== false) {
|
||||||
@ -49,6 +51,11 @@
|
|||||||
if (!$response) $new++;
|
if (!$response) $new++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$cache->setContent($new);
|
||||||
|
$cache->save();
|
||||||
|
} else {
|
||||||
|
$new = $cache->load();
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
<li>
|
<li>
|
||||||
<a href='forum.php?cat=4'>Feedback: [<?php echo $new; ?>] new</a>
|
<a href='forum.php?cat=4'>Feedback: [<?php echo $new; ?>] new</a>
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
window.searchNames = <?php echo json_encode($names)?>;
|
window.searchNames = <?php echo json_encode($names); ?>;
|
||||||
$(function() {
|
$(function() {
|
||||||
if (window.searchNames.length > 0) {
|
if (window.searchNames.length > 0) {
|
||||||
$('#src_name').keyup(function(e) {
|
$('#src_name').keyup(function(e) {
|
||||||
|
@ -3,17 +3,13 @@
|
|||||||
Town list / houses
|
Town list / houses
|
||||||
</div>
|
</div>
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<form action="houses.php" method="<?php if ($config['ServerEngine'] !== 'TFS_10') echo "post"; else echo "get" ;?>">
|
<form action="houses.php" method="get">
|
||||||
<select name="<?php if ($config['ServerEngine'] !== 'TFS_10') echo "selected"; else echo "id" ;?>">
|
<select name="id">
|
||||||
<?php
|
<?php
|
||||||
foreach ($config['towns'] as $id => $name)
|
foreach ($config['towns'] as $id => $name)
|
||||||
echo '<option value="'. $id .'">'. $name .'</option>';
|
echo '<option value="'. $id .'">'. $name .'</option>';
|
||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
<?php
|
|
||||||
/* Form file */
|
|
||||||
if ($config['ServerEngine'] !== 'TFS_10') Token::create();
|
|
||||||
?>
|
|
||||||
<input type="submit" value="Fetch houses">
|
<input type="submit" value="Fetch houses">
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<div class="well myaccount_widget widget" id="loginContainer">
|
<div class="well myaccount_widget widget" id="loginContainer">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
Welcome, <?php if ($config['ServerEngine'] !== 'OTHIRE') echo $user_data['name']; else echo $user_data['id'];?>.
|
Welcome, <?php echo $user_data['name']; ?>.
|
||||||
</div>
|
</div>
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<ul class="linkbuttons">
|
<ul class="linkbuttons">
|
||||||
|
@ -1,34 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
$cache = new Cache('engine/cache/asideServerInfo');
|
||||||
|
if ($cache->hasExpired()) {
|
||||||
|
$asideServerInfo = mysql_select_single("
|
||||||
|
SELECT
|
||||||
|
(SELECT COUNT(`id`) FROM `accounts`) as `accounts`,
|
||||||
|
(SELECT COUNT(`id`) FROM `players`) as `players`,
|
||||||
|
(SELECT COUNT(`player_id`) FROM `players_online`) as `online`
|
||||||
|
");
|
||||||
|
$cache->setContent($asideServerInfo);
|
||||||
|
$cache->save();
|
||||||
|
} else {
|
||||||
|
$asideServerInfo = $cache->load();
|
||||||
|
}
|
||||||
|
?>
|
||||||
<div class="well widget">
|
<div class="well widget">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
Server Information
|
Server Information
|
||||||
</div>
|
</div>
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<ul>
|
<ul>
|
||||||
<?php
|
<li><a href="onlinelist.php">Players online: <?php echo $asideServerInfo['online']; ?></a></li>
|
||||||
$status = true;
|
<li>Registered accounts: <?php echo $asideServerInfo['accounts'];?></li>
|
||||||
if ($config['status']['status_check']) {
|
<li>Registered players: <?php echo $asideServerInfo['players'];?></li>
|
||||||
@$sock = fsockopen ($config['status']['status_ip'], $config['status']['status_port'], $errno, $errstr, 1);
|
|
||||||
if(!$sock) {
|
|
||||||
echo "<span style='color:red;font-weight:bold;'><center>Server Offline!</center></span><br/>";
|
|
||||||
$status = false;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$info = chr(6).chr(0).chr(255).chr(255).'info';
|
|
||||||
fwrite($sock, $info);
|
|
||||||
$data='';
|
|
||||||
while (!feof($sock))$data .= fgets($sock, 1024);
|
|
||||||
fclose($sock);
|
|
||||||
echo "<span style='color:green;font-weight:bold;'><center>Server Online!</center></span><br />";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($status) {
|
|
||||||
?>
|
|
||||||
<li><a href="onlinelist.php">Players online:
|
|
||||||
<?php echo user_count_online(); ?></a></li>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<li>Registered accounts: <?php echo user_count_accounts();?></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -7,7 +7,11 @@
|
|||||||
<?php
|
<?php
|
||||||
$cache = new Cache('engine/cache/topPlayer');
|
$cache = new Cache('engine/cache/topPlayer');
|
||||||
if ($cache->hasExpired()) {
|
if ($cache->hasExpired()) {
|
||||||
$players = mysql_select_multi('SELECT `name`, `level`, `experience` FROM `players` WHERE `group_id` < ' . $config['highscore']['ignoreGroupId'] . ' ORDER BY `level` DESC, `experience` DESC LIMIT 5;');
|
$players = mysql_select_multi("
|
||||||
|
SELECT `name`, `level`, `experience`
|
||||||
|
FROM `players` WHERE `group_id` < {$config['highscore']['ignoreGroupId']}
|
||||||
|
ORDER BY `level` DESC, `experience` DESC LIMIT 5;
|
||||||
|
");
|
||||||
|
|
||||||
$cache->setContent($players);
|
$cache->setContent($players);
|
||||||
$cache->save();
|
$cache->save();
|
||||||
|
@ -154,7 +154,7 @@ if($_SERVER['HTTP_USER_AGENT'] == "Mozilla/5.0" && $config['ServerEngine'] === '
|
|||||||
$password = SHA1($client->password);
|
$password = SHA1($client->password);
|
||||||
$token = (isset($client->token)) ? sanitize($client->token) : false;
|
$token = (isset($client->token)) ? sanitize($client->token) : false;
|
||||||
|
|
||||||
$fields = '`id`, `premdays`';
|
$fields = '`id`, `premium_ends_at`';
|
||||||
if ($config['twoFactorAuthenticator']) $fields .= ', `secret`';
|
if ($config['twoFactorAuthenticator']) $fields .= ', `secret`';
|
||||||
|
|
||||||
$account = false;
|
$account = false;
|
||||||
@ -213,7 +213,8 @@ if($_SERVER['HTTP_USER_AGENT'] == "Mozilla/5.0" && $config['ServerEngine'] === '
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sessionKey = ($email !== false) ? $email."\n".$client->password : $username."\n".$client->password;
|
$sessionKey = ($email !== false) ? $email."\n".$client->password : $username."\n".$client->password;
|
||||||
if (isset($account['secret']) && strlen($account['secret']) > 5) $sessionKey .= "\n".$token."\n".floor(time() / 30);
|
$sessionKey .= (isset($account['secret']) && strlen($account['secret']) > 5) ? "\n".$token : "\n";
|
||||||
|
$sessionKey .= "\n".floor(time() / 30);
|
||||||
|
|
||||||
$response = array(
|
$response = array(
|
||||||
'session' => array(
|
'session' => array(
|
||||||
@ -226,8 +227,8 @@ if($_SERVER['HTTP_USER_AGENT'] == "Mozilla/5.0" && $config['ServerEngine'] === '
|
|||||||
'emailcoderequest' => false,
|
'emailcoderequest' => false,
|
||||||
'sessionkey' => $sessionKey,
|
'sessionkey' => $sessionKey,
|
||||||
'lastlogintime' => 0,
|
'lastlogintime' => 0,
|
||||||
'ispremium' => ($account['premdays'] > 0) ? true : false,
|
'ispremium' => ($account['premium_ends_at'] > time()) ? true : false,
|
||||||
'premiumuntil' => time() + ($account['premdays'] * 86400),
|
'premiumuntil' => $account['premium_ends_at'],
|
||||||
'status' => 'active'
|
'status' => 'active'
|
||||||
),
|
),
|
||||||
'playdata' => array(
|
'playdata' => array(
|
||||||
|
@ -5,7 +5,15 @@ include 'layout/overall/header.php';
|
|||||||
$undelete_id = @$_GET['cancel_delete_id'];
|
$undelete_id = @$_GET['cancel_delete_id'];
|
||||||
if($undelete_id) {
|
if($undelete_id) {
|
||||||
$undelete_id = (int)$undelete_id;
|
$undelete_id = (int)$undelete_id;
|
||||||
$undelete_q1 = mysql_select_single('SELECT `character_name` FROM `znote_deleted_characters` WHERE `done` = 0 AND `id` = ' . $undelete_id . ' AND `original_account_id` = ' . $session_user_id . ' AND NOW() < `time`');
|
$undelete_q1 = mysql_select_single("
|
||||||
|
SELECT
|
||||||
|
`character_name`
|
||||||
|
FROM `znote_deleted_characters`
|
||||||
|
WHERE `done` = 0
|
||||||
|
AND `id` = {$undelete_id}
|
||||||
|
AND `original_account_id` = {$session_user_id}
|
||||||
|
AND NOW() < `time`
|
||||||
|
");
|
||||||
if($undelete_q1) {
|
if($undelete_q1) {
|
||||||
mysql_delete('DELETE FROM `znote_deleted_characters` WHERE `id` = ' . $undelete_id);
|
mysql_delete('DELETE FROM `znote_deleted_characters` WHERE `id` = ' . $undelete_id);
|
||||||
echo 'Pending delete of ' . $undelete_q1['character_name'] . ' has been successfully canceled.<br/>';
|
echo 'Pending delete of ' . $undelete_q1['character_name'] . ' has been successfully canceled.<br/>';
|
||||||
@ -93,7 +101,7 @@ if (!empty($_POST['selected_character'])) {
|
|||||||
switch($action) {
|
switch($action) {
|
||||||
// Change character comment PAGE2 (Success).
|
// Change character comment PAGE2 (Success).
|
||||||
case 'update_comment':
|
case 'update_comment':
|
||||||
if (user_character_account_id($char_name) === $session_user_id) {
|
if ((int)user_character_account_id($char_name) === $session_user_id) {
|
||||||
user_update_comment(user_character_id($char_name), getValue($_POST['comment']));
|
user_update_comment(user_character_id($char_name), getValue($_POST['comment']));
|
||||||
echo 'Successfully updated comment.';
|
echo 'Successfully updated comment.';
|
||||||
}
|
}
|
||||||
@ -103,7 +111,7 @@ if (!empty($_POST['selected_character'])) {
|
|||||||
// Hide character
|
// Hide character
|
||||||
case 'toggle_hide':
|
case 'toggle_hide':
|
||||||
$hide = (user_character_hide($char_name) == 1 ? 0 : 1);
|
$hide = (user_character_hide($char_name) == 1 ? 0 : 1);
|
||||||
if (user_character_account_id($char_name) === $session_user_id) {
|
if ((int)user_character_account_id($char_name) === $session_user_id) {
|
||||||
user_character_set_hide(user_character_id($char_name), $hide);
|
user_character_set_hide(user_character_id($char_name), $hide);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -111,21 +119,13 @@ if (!empty($_POST['selected_character'])) {
|
|||||||
|
|
||||||
// DELETE character
|
// DELETE character
|
||||||
case 'delete_character':
|
case 'delete_character':
|
||||||
if (user_character_account_id($char_name) === $session_user_id) {
|
if ((int)user_character_account_id($char_name) === $session_user_id) {
|
||||||
$charid = user_character_id($char_name);
|
$charid = user_character_id($char_name);
|
||||||
if ($charid !== false) {
|
if ($charid !== false) {
|
||||||
if ($config['ServerEngine'] === 'TFS_10') {
|
|
||||||
if (!user_is_online_10($charid)) {
|
if (!user_is_online_10($charid)) {
|
||||||
if (guild_leader_gid($charid) === false) user_delete_character_soft($charid);
|
if (guild_leader_gid($charid) === false) user_delete_character_soft($charid);
|
||||||
else echo 'Character is leader of a guild, you must disband the guild or change leadership before deleting character.';
|
else echo 'Character is leader of a guild, you must disband the guild or change leadership before deleting character.';
|
||||||
} else echo 'Character must be offline first.';
|
} else echo 'Character must be offline first.';
|
||||||
} else {
|
|
||||||
$chr_data = user_character_data($charid, 'online');
|
|
||||||
if ($chr_data['online'] != 1) {
|
|
||||||
if (guild_leader_gid($charid) === false) user_delete_character_soft($charid);
|
|
||||||
else echo 'Character is leader of a guild, you must disband the guild or change leadership before deleting character.';
|
|
||||||
} else echo 'Character must be offline first.';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -137,10 +137,8 @@ if (!empty($_POST['selected_character'])) {
|
|||||||
$newname = isset($_POST['newName']) ? getValue($_POST['newName']) : '';
|
$newname = isset($_POST['newName']) ? getValue($_POST['newName']) : '';
|
||||||
|
|
||||||
$player = false;
|
$player = false;
|
||||||
if ($config['ServerEngine'] === 'TFS_10') {
|
|
||||||
$player = mysql_select_single("SELECT `id`, `account_id` FROM `players` WHERE `name` = '$oldname'");
|
$player = mysql_select_single("SELECT `id`, `account_id` FROM `players` WHERE `name` = '$oldname'");
|
||||||
$player['online'] = (user_is_online_10($player['id'])) ? 1 : 0;
|
$player['online'] = (user_is_online_10($player['id'])) ? 1 : 0;
|
||||||
} else $player = mysql_select_single("SELECT `id`, `account_id`, `online` FROM `players` WHERE `name` = '$oldname'");
|
|
||||||
|
|
||||||
// Check if user is online
|
// Check if user is online
|
||||||
if ($player['online'] == 1) {
|
if ($player['online'] == 1) {
|
||||||
@ -204,13 +202,11 @@ if (!empty($_POST['selected_character'])) {
|
|||||||
|
|
||||||
// Change character sex
|
// Change character sex
|
||||||
case 'change_gender':
|
case 'change_gender':
|
||||||
if (user_character_account_id($char_name) === $session_user_id) {
|
if ((int)user_character_account_id($char_name) === $session_user_id) {
|
||||||
$char_id = (int)user_character_id($char_name);
|
$char_id = (int)user_character_id($char_name);
|
||||||
$account_id = user_character_account_id($char_name);
|
$account_id = user_character_account_id($char_name);
|
||||||
|
|
||||||
if ($config['ServerEngine'] == 'TFS_10') {
|
|
||||||
$chr_data['online'] = user_is_online_10($char_id) ? 1 : 0;
|
$chr_data['online'] = user_is_online_10($char_id) ? 1 : 0;
|
||||||
} else $chr_data = user_character_data($char_id, 'online');
|
|
||||||
if ($chr_data['online'] != 1) {
|
if ($chr_data['online'] != 1) {
|
||||||
// Verify that we are not messing around with data
|
// Verify that we are not messing around with data
|
||||||
if ($account_id != $user_data['id']) die("wtf? Something went wrong, try relogging.");
|
if ($account_id != $user_data['id']) die("wtf? Something went wrong, try relogging.");
|
||||||
@ -254,7 +250,7 @@ if (!empty($_POST['selected_character'])) {
|
|||||||
// Change character comment PAGE1:
|
// Change character comment PAGE1:
|
||||||
case 'change_comment':
|
case 'change_comment':
|
||||||
$render_page = false; // Regular "myaccount" page should not render
|
$render_page = false; // Regular "myaccount" page should not render
|
||||||
if (user_character_account_id($char_name) === $session_user_id) {
|
if ((int)user_character_account_id($char_name) === $session_user_id) {
|
||||||
$comment_data = user_znote_character_data(user_character_id($char_name), 'comment');
|
$comment_data = user_znote_character_data(user_character_id($char_name), 'comment');
|
||||||
?>
|
?>
|
||||||
<!-- Changing comment MARKUP -->
|
<!-- Changing comment MARKUP -->
|
||||||
@ -303,21 +299,12 @@ if ($render_page) {
|
|||||||
?>
|
?>
|
||||||
<div id="myaccount">
|
<div id="myaccount">
|
||||||
<h1>My account</h1>
|
<h1>My account</h1>
|
||||||
<p>Welcome to your account page, <?php if ($config['ServerEngine'] !== 'OTHIRE') echo $user_data['name']; else echo $user_data['id']; ?><br>
|
<p>Welcome to your account page, <?php echo $user_data['name']; ?><br>
|
||||||
<?php if ($config['ServerEngine'] !== 'OTHIRE') {
|
<?php
|
||||||
if ($user_data['premdays'] != 0) {
|
// Todo: If premdays is less than 2, inform how many hours are left.
|
||||||
echo 'You have ' .$user_data['premdays']. ' remaining premium account days.';
|
if ($user_data['premdays'] != 0) echo "You have {$user_data['premdays']} remaining premium account days.";
|
||||||
} else {
|
else echo 'You are free account.';
|
||||||
echo 'You are free account.';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if ($user_data['premend'] != 0) {
|
|
||||||
echo 'Your premium account will last till ';
|
|
||||||
echo date("d/m/Y", $user_data['premend']);
|
|
||||||
} else {
|
|
||||||
echo 'You do not have premium account days.';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($config['mailserver']['myaccount_verify_email']):
|
if ($config['mailserver']['myaccount_verify_email']):
|
||||||
?><br>Email: <?php echo $user_data['email'];
|
?><br>Email: <?php echo $user_data['email'];
|
||||||
if ($user_znote_data['active_email'] == 1) {
|
if ($user_znote_data['active_email'] == 1) {
|
||||||
@ -328,7 +315,7 @@ if ($render_page) {
|
|||||||
endif; ?>
|
endif; ?>
|
||||||
</p>
|
</p>
|
||||||
<?php
|
<?php
|
||||||
if ($config['ServerEngine'] === 'TFS_10' && $config['twoFactorAuthenticator']) {
|
if ($config['twoFactorAuthenticator']) {
|
||||||
$query = mysql_select_single("SELECT `secret` FROM `accounts` WHERE `id`='".(int)$session_user_id."' LIMIT 1;");
|
$query = mysql_select_single("SELECT `secret` FROM `accounts` WHERE `id`='".(int)$session_user_id."' LIMIT 1;");
|
||||||
$status = ($query['secret'] === NULL) ? false : true;
|
$status = ($query['secret'] === NULL) ? false : true;
|
||||||
?><p>Account security with Two-factor Authentication: <a href="twofa.php"><?php echo ($status) ? 'Enabled' : 'Disabled'; ?></a></p><?php
|
?><p>Account security with Two-factor Authentication: <a href="twofa.php"><?php echo ($status) ? 'Enabled' : 'Disabled'; ?></a></p><?php
|
||||||
@ -343,17 +330,27 @@ if ($render_page) {
|
|||||||
?>
|
?>
|
||||||
<table id="myaccountTable" class="table table-striped table-hover">
|
<table id="myaccountTable" class="table table-striped table-hover">
|
||||||
<tr class="yellow">
|
<tr class="yellow">
|
||||||
<th>NAME</th><th>LEVEL</th><th>VOCATION</th><th>TOWN</th><th>LAST LOGIN</th><th>STATUS</th><th>HIDE</th>
|
<th>NAME</th>
|
||||||
|
<th>LEVEL</th>
|
||||||
|
<th>VOCATION</th>
|
||||||
|
<th>TOWN</th>
|
||||||
|
<th>LAST LOGIN</th>
|
||||||
|
<th>STATUS</th>
|
||||||
|
<th>HIDE</th>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
$characters = array();
|
foreach ($char_array as $value): ?>
|
||||||
foreach ($char_array as $value) {
|
<tr>
|
||||||
// characters: [0] = name, [1] = level, [2] = vocation, [3] = town_id, [4] = lastlogin, [5] = online
|
<td><a href="characterprofile.php?name=<?php echo $value['name']; ?>"><?php echo $value['name']; ?></a></td>
|
||||||
echo '<tr>';
|
<td><?php echo $value['level']; ?></td>
|
||||||
echo '<td><a href="characterprofile.php?name='. $value['name'] .'">'. $value['name'] .'</a></td><td>'. $value['level'] .'</td><td>'. $value['vocation'] .'</td><td>'. $value['town_id'] .'</td><td>'. $value['lastlogin'] .'</td><td>'. $value['online'] .'</td><td>'. hide_char_to_name(user_character_hide($value['name'])) .'</td>';
|
<td><?php echo $value['vocation']; ?></td>
|
||||||
echo '</tr>';
|
<td><?php echo $value['town_id']; ?></td>
|
||||||
$characters[] = $value['name'];
|
<td><?php echo $value['lastlogin']; ?></td>
|
||||||
}
|
<td><?php echo $value['online']; ?></td>
|
||||||
|
<td><?php echo hide_char_to_name($value['hide_char']); ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
endforeach;
|
||||||
?>
|
?>
|
||||||
</table>
|
</table>
|
||||||
<!-- FORMS TO EDIT CHARACTER-->
|
<!-- FORMS TO EDIT CHARACTER-->
|
||||||
@ -362,15 +359,9 @@ if ($render_page) {
|
|||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<select id="selected_character" name="selected_character" class="form-control">
|
<select id="selected_character" name="selected_character" class="form-control">
|
||||||
<?php
|
<?php foreach ($char_array as $character): ?>
|
||||||
for ($i = 0; $i < $char_count; $i++) {
|
<option value="<?php echo $character['name']; ?>"><?php echo $character['name']; ?></option>
|
||||||
if (user_character_hide($characters[$i]) == 1) {
|
<?php endforeach; ?>
|
||||||
echo '<option value="'. $characters[$i] . '">'. $characters[$i] .'</option>';
|
|
||||||
} else {
|
|
||||||
echo '<option value="'. $characters[$i] . '">'. $characters[$i] .'</option>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@ -395,7 +386,7 @@ if ($render_page) {
|
|||||||
</form>
|
</form>
|
||||||
<?php
|
<?php
|
||||||
} else {
|
} else {
|
||||||
echo 'You don\'t have any characters. Why don\'t you <a href="createcharacter.php">create one</a>?';
|
echo "You don't have any characters. Why don't you <a href='createcharacter.php'>create one</a>?";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
137
onlinelist.php
137
onlinelist.php
@ -1,20 +1,19 @@
|
|||||||
<?php require_once 'engine/init.php'; include 'layout/overall/header.php'; ?>
|
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
|
||||||
|
|
||||||
<h1>Who is online?</h1>
|
$history = array(
|
||||||
<?php
|
"enabled" => true,
|
||||||
|
"days" => 14,
|
||||||
|
"cache" => 300
|
||||||
|
);
|
||||||
|
|
||||||
// Returns a list of players online
|
// Returns a list of players online
|
||||||
$array = false;
|
$array = false;
|
||||||
$loadFlags = ($config['country_flags']['enabled'] && $config['country_flags']['onlinelist']) ? true : false;
|
$loadFlags = ($config['country_flags']['enabled'] && $config['country_flags']['onlinelist']) ? true : false;
|
||||||
$loadOutfits = ($config['show_outfits']['onlinelist']) ? true : false;
|
$loadOutfits = ($config['show_outfits']['onlinelist']) ? true : false;
|
||||||
if ($config['ServerEngine'] != 'OTHIRE') {
|
if ($config['client'] < 780) {
|
||||||
if ($config['client'] < 780) {
|
|
||||||
$outfitQuery = ($loadOutfits) ? ", `p`.`lookbody` AS `body`, `p`.`lookfeet` AS `feet`, `p`.`lookhead` AS `head`, `p`.`looklegs` AS `legs`, `p`.`looktype` AS `type`" : "";
|
$outfitQuery = ($loadOutfits) ? ", `p`.`lookbody` AS `body`, `p`.`lookfeet` AS `feet`, `p`.`lookhead` AS `head`, `p`.`looklegs` AS `legs`, `p`.`looktype` AS `type`" : "";
|
||||||
} else {
|
|
||||||
$outfitQuery = ($loadOutfits) ? ", `p`.`lookbody` AS `body`, `p`.`lookfeet` AS `feet`, `p`.`lookhead` AS `head`, `p`.`looklegs` AS `legs`, `p`.`looktype` AS `type`, `p`.`lookaddons` AS `addons`" : "";
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
$outfitQuery = ($loadOutfits) ? ", `p`.`lookbody` AS `body`, `p`.`lookfeet` AS `feet`, `p`.`lookhead` AS `head`, `p`.`looklegs` AS `legs`, `p`.`looktype` AS `type`" : "";
|
$outfitQuery = ($loadOutfits) ? ", `p`.`lookbody` AS `body`, `p`.`lookfeet` AS `feet`, `p`.`lookhead` AS `head`, `p`.`looklegs` AS `legs`, `p`.`looktype` AS `type`, `p`.`lookaddons` AS `addons`" : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Small 30 seconds players_online cache.
|
// Small 30 seconds players_online cache.
|
||||||
@ -22,11 +21,7 @@ $cache = new Cache('engine/cache/onlinelist');
|
|||||||
$cache->setExpiration(30);
|
$cache->setExpiration(30);
|
||||||
if ($cache->hasExpired()) {
|
if ($cache->hasExpired()) {
|
||||||
// Load online list data from SQL
|
// Load online list data from SQL
|
||||||
if ($config['ServerEngine'] == 'TFS_10') {
|
|
||||||
$array = ($loadFlags === true) ? mysql_select_multi("SELECT `p`.`name` AS `name`, `p`.`level` AS `level`, `p`.`vocation` AS `vocation`, `g`.`name` AS `gname`, `za`.`flag` AS `flag` $outfitQuery FROM `players_online` AS `o` INNER JOIN `players` AS `p` ON `o`.`player_id` = `p`.`id` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id` = `za`.`account_id` LEFT JOIN `guild_membership` AS `gm` ON `o`.`player_id` = `gm`.`player_id` LEFT JOIN `guilds` AS `g` ON `gm`.`guild_id` = `g`.`id`;") : mysql_select_multi("SELECT `p`.`name` AS `name`, `p`.`level` AS `level`, `p`.`vocation` AS `vocation`, `g`.`name` AS `gname` $outfitQuery FROM `players_online` AS `o` INNER JOIN `players` AS `p` ON `o`.`player_id` = `p`.`id` LEFT JOIN `guild_membership` AS `gm` ON `o`.`player_id` = `gm`.`player_id` LEFT JOIN `guilds` AS `g` ON `gm`.`guild_id` = `g`.`id`;");
|
$array = ($loadFlags === true) ? mysql_select_multi("SELECT `p`.`name` AS `name`, `p`.`level` AS `level`, `p`.`vocation` AS `vocation`, `g`.`name` AS `gname`, `za`.`flag` AS `flag` $outfitQuery FROM `players_online` AS `o` INNER JOIN `players` AS `p` ON `o`.`player_id` = `p`.`id` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id` = `za`.`account_id` LEFT JOIN `guild_membership` AS `gm` ON `o`.`player_id` = `gm`.`player_id` LEFT JOIN `guilds` AS `g` ON `gm`.`guild_id` = `g`.`id`;") : mysql_select_multi("SELECT `p`.`name` AS `name`, `p`.`level` AS `level`, `p`.`vocation` AS `vocation`, `g`.`name` AS `gname` $outfitQuery FROM `players_online` AS `o` INNER JOIN `players` AS `p` ON `o`.`player_id` = `p`.`id` LEFT JOIN `guild_membership` AS `gm` ON `o`.`player_id` = `gm`.`player_id` LEFT JOIN `guilds` AS `g` ON `gm`.`guild_id` = `g`.`id`;");
|
||||||
} else {
|
|
||||||
$array = ($loadFlags === true) ? mysql_select_multi("SELECT `p`.`name` as `name`, `p`.`level` as `level`, `p`.`vocation` as `vocation`, `g`.`name` as `gname`, `za`.`flag` as `flag` $outfitQuery FROM `players` as `p` INNER JOIN `znote_accounts` as `za` ON `za`.`account_id` = `p`.`account_id` LEFT JOIN `guild_ranks` as `gr` ON `gr`.`id` = `p`.`rank_id` LEFT JOIN `guilds` as `g` ON `gr`.`guild_id` = `g`.`id` WHERE `p`.`online` = '1' ORDER BY `p`.`name` DESC;") : mysql_select_multi("SELECT `p`.`name` as `name`, `p`.`level` as `level`, `p`.`vocation` as `vocation`, `g`.`name` as `gname` $outfitQuery FROM `players` as `p` LEFT JOIN `guild_ranks` as `gr` ON `gr`.`id` = `p`.`rank_id` LEFT JOIN `guilds` as `g` ON `gr`.`guild_id` = `g`.`id` WHERE `p`.`online` = '1' ORDER BY `p`.`name` DESC;");
|
|
||||||
}
|
|
||||||
// End loading data from SQL
|
// End loading data from SQL
|
||||||
$cache->setContent($array);
|
$cache->setContent($array);
|
||||||
$cache->save();
|
$cache->save();
|
||||||
@ -35,9 +30,63 @@ if ($cache->hasExpired()) {
|
|||||||
}
|
}
|
||||||
// End cache
|
// End cache
|
||||||
|
|
||||||
if (!empty($array) && $array !== false) {
|
// 5 minute logout history cache
|
||||||
?>
|
if ($history["enabled"]) {
|
||||||
|
$time = time();
|
||||||
|
$cache = new Cache('engine/cache/onlinelist_rec');
|
||||||
|
$cache->setExpiration($history['cache']);
|
||||||
|
if ($cache->hasExpired()) {
|
||||||
|
// Load online list data from SQL
|
||||||
|
$recents = ($loadFlags === true) ? mysql_select_multi("
|
||||||
|
SELECT
|
||||||
|
`p`.`name` AS `name`,
|
||||||
|
`p`.`level` AS `level`,
|
||||||
|
`p`.`vocation` AS `vocation`,
|
||||||
|
`p`.`lastlogout`,
|
||||||
|
`g`.`name` AS `gname`,
|
||||||
|
`za`.`flag` AS `flag`
|
||||||
|
$outfitQuery
|
||||||
|
FROM `players` AS `p`
|
||||||
|
INNER JOIN `znote_accounts` AS `za`
|
||||||
|
ON `p`.`account_id` = `za`.`account_id`
|
||||||
|
LEFT JOIN `guild_membership` AS `gm`
|
||||||
|
ON `p`.`id` = `gm`.`player_id`
|
||||||
|
LEFT JOIN `guilds` AS `g`
|
||||||
|
ON `gm`.`guild_id` = `g`.`id`
|
||||||
|
WHERE `p`.`lastlogout` >= $time - ({$history['days']} * 24 * 60 * 60)
|
||||||
|
ORDER BY `p`.`lastlogout` DESC;
|
||||||
|
") : mysql_select_multi("
|
||||||
|
SELECT
|
||||||
|
`p`.`name` AS `name`,
|
||||||
|
`p`.`level` AS `level`,
|
||||||
|
`p`.`vocation` AS `vocation`,
|
||||||
|
`p`.`lastlogout`,
|
||||||
|
`g`.`name` AS `gname`
|
||||||
|
$outfitQuery
|
||||||
|
FROM `players` AS `p`
|
||||||
|
LEFT JOIN `guild_membership` AS `gm`
|
||||||
|
ON `p`.`id` = `gm`.`player_id`
|
||||||
|
LEFT JOIN `guilds` AS `g`
|
||||||
|
ON `gm`.`guild_id` = `g`.`id`
|
||||||
|
WHERE `p`.`lastlogout` >= $time - ({$history['days']} * 24 * 60 * 60)
|
||||||
|
ORDER BY `p`.`lastlogout` DESC;
|
||||||
|
");
|
||||||
|
// End loading data from SQL
|
||||||
|
$cache->setContent($recents);
|
||||||
|
$cache->save();
|
||||||
|
} else {
|
||||||
|
$recents = $cache->load();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// End cache
|
||||||
|
|
||||||
|
?>
|
||||||
|
<h1>Who is online?</h1>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// Players currently logged in
|
||||||
|
if (!empty($array) && $array !== false): ?>
|
||||||
|
<h2>Currently online:</h2>
|
||||||
<table id="onlinelistTable" class="table table-striped table-hover">
|
<table id="onlinelistTable" class="table table-striped table-hover">
|
||||||
<tr class="yellow">
|
<tr class="yellow">
|
||||||
<?php if ($loadOutfits) echo "<th>Outfit</th>"; ?>
|
<?php if ($loadOutfits) echo "<th>Outfit</th>"; ?>
|
||||||
@ -47,12 +96,12 @@ if (!empty($array) && $array !== false) {
|
|||||||
<th>Vocation:</th>
|
<th>Vocation:</th>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
foreach ($array as $value) {
|
foreach ($array as $value):
|
||||||
$url = url("characterprofile.php?name=". $value['name']);
|
$url = url("characterprofile.php?name=". $value['name']);
|
||||||
$flag = ($loadFlags === true && strlen($value['flag']) > 1) ? '<img src="' . $config['country_flags']['server'] . '/' . $value['flag'] . '.png"> ' : '';
|
$flag = ($loadFlags === true && strlen($value['flag']) > 1) ? '<img src="' . $config['country_flags']['server'] . '/' . $value['flag'] . '.png"> ' : '';
|
||||||
$guildname = (!empty($value['gname'])) ? '<a href="guilds.php?name='. $value['gname'] .'">'. $value['gname'] .'</a>' : '';
|
$guildname = (!empty($value['gname'])) ? '<a href="guilds.php?name='. $value['gname'] .'">'. $value['gname'] .'</a>' : '';
|
||||||
?>
|
?>
|
||||||
<tr class="special" onclick="javascript:window.location.href='<?php echo $url; ?>'">
|
<tr class="special">
|
||||||
<?php if ($loadOutfits): ?>
|
<?php if ($loadOutfits): ?>
|
||||||
<td class="outfitColumn"><img src="<?php echo $config['show_outfits']['imageServer']; ?>?id=<?php echo $value['type']; ?>&addons=<?php echo $value['addons']; ?>&head=<?php echo $value['head']; ?>&body=<?php echo $value['body']; ?>&legs=<?php echo $value['legs']; ?>&feet=<?php echo $value['feet']; ?>" alt="img"></td>
|
<td class="outfitColumn"><img src="<?php echo $config['show_outfits']['imageServer']; ?>?id=<?php echo $value['type']; ?>&addons=<?php echo $value['addons']; ?>&head=<?php echo $value['head']; ?>&body=<?php echo $value['body']; ?>&legs=<?php echo $value['legs']; ?>&feet=<?php echo $value['feet']; ?>" alt="img"></td>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
@ -62,13 +111,53 @@ if (!empty($array) && $array !== false) {
|
|||||||
<td><?php echo vocation_id_to_name($value['vocation']); ?></td>
|
<td><?php echo vocation_id_to_name($value['vocation']); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
}
|
endforeach; ?>
|
||||||
?>
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
} else {
|
else:
|
||||||
echo 'Nobody is online.';
|
?>
|
||||||
|
<p>Nobody is online.</p>
|
||||||
|
<?php
|
||||||
|
endif;
|
||||||
|
|
||||||
|
// Players online logout history
|
||||||
|
if ($history["enabled"]) {
|
||||||
|
$time = time();
|
||||||
|
if (!empty($recents) && $recents !== false): ?>
|
||||||
|
<h2>Online past <?php echo $history['days']; ?> days:</h2>
|
||||||
|
<table id="recentlistTable" class="table table-striped table-hover">
|
||||||
|
<tr class="yellow">
|
||||||
|
<?php if ($loadOutfits) echo "<th>Outfit</th>"; ?>
|
||||||
|
<th>Name:</th>
|
||||||
|
<th>Guild:</th>
|
||||||
|
<th>Level:</th>
|
||||||
|
<th>Logout [days] - date</th>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
foreach ($recents as $value):
|
||||||
|
$days = floor(($time - $value['lastlogout']) / 86400);
|
||||||
|
$url = url("characterprofile.php?name=". $value['name']);
|
||||||
|
$flag = ($loadFlags === true && strlen($value['flag']) > 1) ? '<img src="' . $config['country_flags']['server'] . '/' . $value['flag'] . '.png"> ' : '';
|
||||||
|
$guildname = (!empty($value['gname'])) ? '<a href="guilds.php?name='. $value['gname'] .'">'. $value['gname'] .'</a>' : '';
|
||||||
|
?>
|
||||||
|
<tr class="special">
|
||||||
|
<?php if ($loadOutfits): ?>
|
||||||
|
<td class="outfitColumn"><img src="<?php echo $config['show_outfits']['imageServer']; ?>?id=<?php echo $value['type']; ?>&addons=<?php echo $value['addons']; ?>&head=<?php echo $value['head']; ?>&body=<?php echo $value['body']; ?>&legs=<?php echo $value['legs']; ?>&feet=<?php echo $value['feet']; ?>" alt="img"></td>
|
||||||
|
<?php endif; ?>
|
||||||
|
<td><?php echo $flag; ?><a href="characterprofile.php?name=<?php echo $value['name']; ?>"><?php echo $value['name']; ?></a></td>
|
||||||
|
<td><?php echo $guildname; ?></td>
|
||||||
|
<td><?php echo $value['level']; ?></td>
|
||||||
|
<td><?php echo "{$days}D: " . getClock($value['lastlogout'], true); ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
endforeach; ?>
|
||||||
|
</table>
|
||||||
|
<?php
|
||||||
|
else:
|
||||||
|
?>
|
||||||
|
<p>Nobody has logged in past <?php echo $history['days']; ?> days.</p>
|
||||||
|
<?php
|
||||||
|
endif;
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
<?php include 'layout/overall/footer.php'; ?>
|
include 'layout/overall/footer.php'; ?>
|
||||||
|
@ -27,6 +27,7 @@ function toYesNo($bool) {
|
|||||||
}
|
}
|
||||||
// Loading stage list
|
// Loading stage list
|
||||||
$cache = new Cache('engine/cache/stages');
|
$cache = new Cache('engine/cache/stages');
|
||||||
|
$cache->useMemory(false);
|
||||||
if (user_logged_in() && is_admin($user_data)) {
|
if (user_logged_in() && is_admin($user_data)) {
|
||||||
if (isset($_GET['loadStages'])) {
|
if (isset($_GET['loadStages'])) {
|
||||||
echo "<p><strong>Logged in as admin, loading engine/XML/stages.xml file and updating cache.</strong></p>";
|
echo "<p><strong>Logged in as admin, loading engine/XML/stages.xml file and updating cache.</strong></p>";
|
||||||
@ -35,12 +36,10 @@ if (user_logged_in() && is_admin($user_data)) {
|
|||||||
if ($stagesXML !== false) {
|
if ($stagesXML !== false) {
|
||||||
$stagesData = array();
|
$stagesData = array();
|
||||||
// Load config (stages enabled or disabled)
|
// Load config (stages enabled or disabled)
|
||||||
if ($config['ServerEngine'] == 'TFS_10')
|
|
||||||
foreach ($stagesXML->config->attributes() as $name => $value)
|
foreach ($stagesXML->config->attributes() as $name => $value)
|
||||||
$stagesData["$name"] = "$value";
|
$stagesData["$name"] = "$value";
|
||||||
// Load stage levels
|
// Load stage levels
|
||||||
// Each stage XML object
|
// Each stage XML object
|
||||||
if ($config['ServerEngine'] == 'TFS_10') {
|
|
||||||
foreach ($stagesXML->stage as $stage) {
|
foreach ($stagesXML->stage as $stage) {
|
||||||
$rowData = array();
|
$rowData = array();
|
||||||
// Each attribute name and values on current stage object
|
// Each attribute name and values on current stage object
|
||||||
@ -50,20 +49,6 @@ if (user_logged_in() && is_admin($user_data)) {
|
|||||||
// Populate XML assoc array
|
// Populate XML assoc array
|
||||||
$stagesData['stages'][] = $rowData;
|
$stagesData['stages'][] = $rowData;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// TFS 0.3/4
|
|
||||||
foreach ($stagesXML->world as $world) {
|
|
||||||
foreach ($world->stage as $stage) {
|
|
||||||
$rowData = array();
|
|
||||||
// Each attribute name and values on current stage object
|
|
||||||
foreach ($stage->attributes() as $name => $value) {
|
|
||||||
$rowData["$name"] = "$value";
|
|
||||||
}
|
|
||||||
// Populate XML assoc array
|
|
||||||
$stagesData['stages'][] = $rowData;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$cache->setContent($stagesData);
|
$cache->setContent($stagesData);
|
||||||
$cache->save();
|
$cache->save();
|
||||||
}
|
}
|
||||||
@ -83,6 +68,7 @@ if (user_logged_in() && is_admin($user_data)) {
|
|||||||
|
|
||||||
// Loading config.lua
|
// Loading config.lua
|
||||||
$cache = new Cache('engine/cache/luaconfig');
|
$cache = new Cache('engine/cache/luaconfig');
|
||||||
|
$cache->useMemory(false);
|
||||||
if (user_logged_in() && is_admin($user_data)) {
|
if (user_logged_in() && is_admin($user_data)) {
|
||||||
if (isset($_POST['loadConfig']) && isset($_POST['configData'])) {
|
if (isset($_POST['loadConfig']) && isset($_POST['configData'])) {
|
||||||
// Whitelist for values we are interested in
|
// Whitelist for values we are interested in
|
||||||
@ -120,19 +106,6 @@ if (user_logged_in() && is_admin($user_data)) {
|
|||||||
'staminaSystem',
|
'staminaSystem',
|
||||||
'experienceStages'
|
'experienceStages'
|
||||||
);
|
);
|
||||||
// TFS 0.3/4 compatibility, convert config value names to TFS 1.0 values
|
|
||||||
$tfs03to10 = array(
|
|
||||||
// TFS 0.3/4 TFS 1.0
|
|
||||||
'rateExperience' => 'rateExp',
|
|
||||||
'loginPort' => 'loginProtocolPort',
|
|
||||||
'rateExperienceFromPlayers' => 'experienceByKillingPlayers',
|
|
||||||
'dailyFragsToRedSkull' => 'killsToRedSkull',
|
|
||||||
'dailyFragsToBlackSkull' => 'killsToBlackSkull',
|
|
||||||
'removeRuneCharges' => 'removeChargesFromRunes',
|
|
||||||
'stairhopDelay' => 'stairJumpExhaustion',
|
|
||||||
'housePriceEachSquare' => 'housePriceEachSQM',
|
|
||||||
'idleKickTime' => 'kickIdlePlayerAfterMinutes',
|
|
||||||
);
|
|
||||||
// This will be the populated array with filtered relevant data
|
// This will be the populated array with filtered relevant data
|
||||||
$luaConfig = array();
|
$luaConfig = array();
|
||||||
|
|
||||||
@ -168,13 +141,7 @@ if (user_logged_in() && is_admin($user_data)) {
|
|||||||
// Remove unnecessary whitespace
|
// Remove unnecessary whitespace
|
||||||
$data[0] = trim($data[0]);
|
$data[0] = trim($data[0]);
|
||||||
$data[1] = trim($data[1]);
|
$data[1] = trim($data[1]);
|
||||||
// TFS 0.3/4 compatibility
|
|
||||||
if (isset($tfs03to10[$data[0]])) {
|
|
||||||
$data[0] = $tfs03to10[$data[0]];
|
|
||||||
if (isset($tfs03to10[$data[1]])) {
|
|
||||||
$data[1] = $tfs03to10[$data[1]];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (in_array($data[0], $whitelist)) {
|
if (in_array($data[0], $whitelist)) {
|
||||||
// Type cast: boolean
|
// Type cast: boolean
|
||||||
if (in_array(strtolower($data[1]), array('true', 'false'))) {
|
if (in_array(strtolower($data[1]), array('true', 'false'))) {
|
||||||
@ -227,7 +194,12 @@ $stages = false;
|
|||||||
<h1>Server Information</h1>
|
<h1>Server Information</h1>
|
||||||
<p>Here you will find all basic information about <b><?php echo $config['site_title']; ?></b></p>
|
<p>Here you will find all basic information about <b><?php echo $config['site_title']; ?></b></p>
|
||||||
|
|
||||||
<?php if (($stagesData && isset($stagesData['enabled']) && $stagesData['enabled']) || (isset($luaConfig['experienceStages']) && $luaConfig['experienceStages'] === true)): $stages = true; ?>
|
<?php
|
||||||
|
if (
|
||||||
|
($stagesData && isset($stagesData['enabled']) && $stagesData['enabled'])
|
||||||
|
|| (isset($luaConfig['experienceStages']) && $luaConfig['experienceStages'] === true)
|
||||||
|
):
|
||||||
|
$stages = true; ?>
|
||||||
<h2>Server rates</h2>
|
<h2>Server rates</h2>
|
||||||
<table class="table tbl-hover">
|
<table class="table tbl-hover">
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
// Loading spell list
|
// Loading spell list
|
||||||
$spellsCache = new Cache('engine/cache/spells');
|
$spellsCache = new Cache('engine/cache/spells');
|
||||||
|
$spellsCache->useMemory(false);
|
||||||
if (user_logged_in() && is_admin($user_data)) {
|
if (user_logged_in() && is_admin($user_data)) {
|
||||||
if (isset($_GET['update'])) {
|
if (isset($_GET['update'])) {
|
||||||
echo "<p><strong>Logged in as admin, loading engine/XML/spells.xml file and updating cache.</strong></p>";
|
echo "<p><strong>Logged in as admin, loading engine/XML/spells.xml file and updating cache.</strong></p>";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user