Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
2ec9cfb
guilds.php cleanup
Znote Jul 22, 2021
e40e811
Better guild validations
Znote Jul 22, 2021
8a71f19
guild validations
Znote Jul 22, 2021
400497b
Tag branch as Znote AAC 2.0_DEV, PHP requirement 7.2
Znote Jul 22, 2021
ac2b909
Cleanup houses
Znote Jul 22, 2021
9e790a7
Fix #371 - fast APCu memory caching support
Znote Jul 23, 2021
8f5487d
Admin - executed SQL queries overlay
Znote Jul 23, 2021
0e941b2
serverinfo cleanup, fix cache, query optimizations
Znote Jul 24, 2021
f896b59
Remove obsolete premium handling
Znote Jul 24, 2021
f011f78
layout aside cleanup
Znote Jul 24, 2021
9898bb2
minor adjustment to aside character search
Znote Jul 24, 2021
bc76e8c
Fix img clipping in news feed
Znote Jul 24, 2021
ae07a0f
tiny css adjustment
Znote Jul 25, 2021
f7445bb
myaccount - cleanup, optimize and fixes
Znote Jul 25, 2021
d914c93
Fix spells cache
Znote Jul 31, 2021
a7fed3b
paypal ipn cacert update
Znote Sep 22, 2021
b482b77
Add logout history to online list and cleanup
Znote Nov 22, 2021
9b6d8d9
Characterprofile cleanup
Znote Nov 22, 2021
ee351e7
TFS 1.5 protocol 12 support
Zbizu Dec 9, 2021
3d42e8a
Fixed variable type for powergamers script (#492)
Oct 13, 2021
e518cd1
Lowering the size of onlinetime_ table sizes (#495)
Nov 19, 2021
e26896f
Highscores cleanup
Znote Dec 13, 2021
13c0be7
SSL CA Root Certificates
Znote Dec 13, 2021
5866ec4
validate_ip bugfix
Znote Dec 15, 2021
9625654
Dont invoke IP validation if its disabled in config.php
Znote Dec 15, 2021
c49842a
register.php cleanup
Znote Dec 15, 2021
0cf1f0f
Fix #497 Protocol 12 freePremium
Znote Dec 16, 2021
0d15f5d
Fix #478 characterprofile message for pending deletions
Znote Dec 16, 2021
098d841
Let admins bypass character list count restriction
Znote Dec 16, 2021
fb6c391
Player history and powergamers rewrite
Znote Dec 20, 2021
61d0bfc
loginWebService correct pvptypes
Znote Dec 23, 2021
2e46507
Bugfix: Powergamers: Support negative values in first day changes
Znote Jan 2, 2022
7fb0916
updated image server with a more recent link/version
Jan 23, 2022
c2cdf5f
More accurate premium duration calculation.
Znote Jan 29, 2022
2c050da
Fix error in email authentication link
luanluciano93 Jun 27, 2022
5e67cf7
Fix error in helpdesk.php (#516)
luanluciano93 Jul 10, 2022
b7f241f
Update cacert.pem
Znote Feb 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions Lua/TFS_10/globalevent powergamers/powergamers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,23 @@ end

-- SQL Query to execute: --
--[[
ALTER TABLE `znote_players` ADD `exphist_lastexp` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `exphist1` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `exphist2` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `exphist3` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `exphist4` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `exphist5` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `exphist6` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `exphist7` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `onlinetimetoday` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetime1` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetime2` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetime3` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetime4` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetime5` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetime6` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetime7` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetimeall` BIGINT NOT NULL DEFAULT '0';
ALTER TABLE `znote_players` ADD `exphist_lastexp` BIGINT NOT NULL DEFAULT '0',
ADD `exphist1` BIGINT NOT NULL DEFAULT '0',
ADD `exphist2` BIGINT NOT NULL DEFAULT '0',
ADD `exphist3` BIGINT NOT NULL DEFAULT '0',
ADD `exphist4` BIGINT NOT NULL DEFAULT '0',
ADD `exphist5` BIGINT NOT NULL DEFAULT '0',
ADD `exphist6` BIGINT NOT NULL DEFAULT '0',
ADD `exphist7` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetimetoday` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
ADD `onlinetime1` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
ADD `onlinetime2` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
ADD `onlinetime3` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
ADD `onlinetime4` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
ADD `onlinetime5` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
ADD `onlinetime6` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
ADD `onlinetime7` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
ADD `onlinetimeall` INT UNSIGNED NOT NULL DEFAULT '0';
]]--

-- after that execute: --
Expand Down
229 changes: 229 additions & 0 deletions Lua/TFS_10/revscriptsys/player_history.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,229 @@
-- Auto install tables if we dont got them yet (first install)
db.query([[
CREATE TABLE IF NOT EXISTS `player_history_skill` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`player_id` int(11) NOT NULL,
`lastlogin` bigint(20) unsigned NOT NULL,
`lastlogout` bigint(20) unsigned NOT NULL,
`town_id` int(11) NOT NULL,
`lastip` int(10) unsigned NOT NULL,
`skull` tinyint(1) NOT NULL,
`blessings` tinyint(2) NOT NULL,
`onlinetime` int(11) NOT NULL,
`balance` bigint(20) unsigned NOT NULL,
`level` int(11) NOT NULL,
`experience` bigint(20) NOT NULL,
`maglevel` int(11) NOT NULL,
`skill_fist` int(10) unsigned NOT NULL,
`skill_club` int(10) unsigned NOT NULL,
`skill_sword` int(10) unsigned NOT NULL,
`skill_axe` int(10) unsigned NOT NULL,
`skill_dist` int(10) unsigned NOT NULL,
`skill_shielding` int(10) unsigned NOT NULL,
`skill_fishing` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`),
FOREIGN KEY (`player_id`) REFERENCES `players` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8;
]])


-- Auto populate table if it is empty
local resultId = db.storeQuery("SELECT `id` FROM `player_history_skill` LIMIT 1;")
if resultId == false then
db.asyncQuery([[
INSERT INTO `player_history_skill` (
`player_id`,
`lastlogin`,
`lastlogout`,
`town_id`,
`lastip`,
`skull`,
`blessings`,
`onlinetime`,
`balance`,
`level`,
`experience`,
`maglevel`,
`skill_fist`,
`skill_club`,
`skill_sword`,
`skill_axe`,
`skill_dist`,
`skill_shielding`,
`skill_fishing`
)
SELECT
`p`.`id` AS `player_id`,
`zp`.`created` AS `lastlogin`,
CASE WHEN `p`.`lastlogout` > 0
THEN `p`.`lastlogout`
ELSE `zp`.`created`
END AS `lastlogout`,
`p`.`town_id`,
`p`.`lastip`,
`p`.`skull`,
`p`.`blessings`,
`p`.`onlinetime`,
`p`.`balance`,
`p`.`level`,
`p`.`experience`,
`p`.`maglevel`,
`p`.`skill_fist`,
`p`.`skill_club`,
`p`.`skill_sword`,
`p`.`skill_axe`,
`p`.`skill_dist`,
`p`.`skill_shielding`,
`p`.`skill_fishing`
FROM `players` AS `p`
INNER JOIN `znote_players` AS `zp`
ON `p`.`id` = `zp`.`player_id`
ORDER BY `zp`.`created`
]])
else
result.free(resultId)
end


-- Logout event, triggered by logout, and death
function historyLogoutEvent(player)
local blessdec = 0
local i = 0
while player:hasBlessing(i+1) do
blessdec = blessdec+2^i
i = i+1
end

local playerGuid = player:getGuid()
db.query([[
INSERT INTO `player_history_skill` (
`player_id`,
`lastlogin`,
`lastlogout`,
`town_id`,
`lastip`,
`skull`,
`blessings`,
`onlinetime`,
`balance`,
`level`,
`experience`,
`maglevel`,
`skill_fist`,
`skill_club`,
`skill_sword`,
`skill_axe`,
`skill_dist`,
`skill_shielding`,
`skill_fishing`
) VALUES (
]]..table.concat({
playerGuid,
player:getLastLoginSaved(),
os.time(),
player:getTown():getId(),
player:getIp(),
player:getSkull(),
blessdec,
"(SELECT `onlinetime` FROM `players` WHERE `id`='"..playerGuid.."') + ".. os.time() - player:getLastLoginSaved(),
player:getBankBalance(),
player:getLevel(),
player:getExperience(),
player:getMagicLevel(),
player:getSkillLevel(SKILL_FIST),
player:getSkillLevel(SKILL_CLUB),
player:getSkillLevel(SKILL_SWORD),
player:getSkillLevel(SKILL_AXE),
player:getSkillLevel(SKILL_DISTANCE),
player:getSkillLevel(SKILL_SHIELD),
player:getSkillLevel(SKILL_FISHING)
}, ",")..[[
);
]])
end


-- Log player state on logout
local player_history_skill = CreatureEvent("player_history_skill")
function player_history_skill.onLogout(player)
--print("2-logout["..player:getName().."]")
historyLogoutEvent(player)
return true
end
player_history_skill:register()


-- And on death
local player_history_skill_death = CreatureEvent("player_history_skill_death")
function player_history_skill_death.onDeath(creature, corpse, killer, mostDamageKiller, lastHitUnjustified, mostDamageUnjustified)
--print("3-death["..creature:getName().."]")
historyLogoutEvent(Player(creature))
end
player_history_skill_death:register()


-- If this is first login, insert current progress
local player_history_skill_login = CreatureEvent("player_history_skill_login")
function player_history_skill_login.onLogin(player)
--print("1-login["..player:getName().."]")
player:registerEvent("player_history_skill_death")

local playerGuid = player:getGuid()
local resultId = db.storeQuery("SELECT `id` FROM `player_history_skill` WHERE `player_id`="..playerGuid.." LIMIT 1;")
if resultId == false then
db.query([[
INSERT INTO `player_history_skill` (
`player_id`,
`lastlogin`,
`lastlogout`,
`town_id`,
`lastip`,
`skull`,
`blessings`,
`onlinetime`,
`balance`,
`level`,
`experience`,
`maglevel`,
`skill_fist`,
`skill_club`,
`skill_sword`,
`skill_axe`,
`skill_dist`,
`skill_shielding`,
`skill_fishing`
)
SELECT
`p`.`id` AS `player_id`,
`zp`.`created` AS `lastlogin`,
CASE WHEN `p`.`lastlogout` > 0
THEN `p`.`lastlogout`
ELSE `zp`.`created`
END AS `lastlogout`,
`p`.`town_id`,
`p`.`lastip`,
`p`.`skull`,
`p`.`blessings`,
`p`.`onlinetime`,
`p`.`balance`,
`p`.`level`,
`p`.`experience`,
`p`.`maglevel`,
`p`.`skill_fist`,
`p`.`skill_club`,
`p`.`skill_sword`,
`p`.`skill_axe`,
`p`.`skill_dist`,
`p`.`skill_shielding`,
`p`.`skill_fishing`
FROM `players` AS `p`
INNER JOIN `znote_players` AS `zp`
ON `p`.`id` = `zp`.`player_id`
WHERE `p`.`id` = ]]..playerGuid..[[
]])
else
result.free(resultId)
end
return true
end
player_history_skill_login:register()
34 changes: 17 additions & 17 deletions Lua/TFS_10/revscriptsys/powergamers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,23 @@ end

-- SQL Query to execute: --
--[[
ALTER TABLE `znote_players` ADD `exphist_lastexp` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `exphist1` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `exphist2` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `exphist3` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `exphist4` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `exphist5` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `exphist6` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `exphist7` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `onlinetimetoday` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetime1` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetime2` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetime3` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetime4` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetime5` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetime6` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetime7` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetimeall` BIGINT NOT NULL DEFAULT '0';
ALTER TABLE `znote_players` ADD `exphist_lastexp` BIGINT NOT NULL DEFAULT '0',
ADD `exphist1` BIGINT NOT NULL DEFAULT '0',
ADD `exphist2` BIGINT NOT NULL DEFAULT '0',
ADD `exphist3` BIGINT NOT NULL DEFAULT '0',
ADD `exphist4` BIGINT NOT NULL DEFAULT '0',
ADD `exphist5` BIGINT NOT NULL DEFAULT '0',
ADD `exphist6` BIGINT NOT NULL DEFAULT '0',
ADD `exphist7` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetimetoday` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
ADD `onlinetime1` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
ADD `onlinetime2` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
ADD `onlinetime3` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
ADD `onlinetime4` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
ADD `onlinetime5` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
ADD `onlinetime6` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
ADD `onlinetime7` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
ADD `onlinetimeall` INT UNSIGNED NOT NULL DEFAULT '0';
]]--

-- after that execute: --
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
ZnoteAAC
========
[![CodeFactor](https://www.codefactor.io/repository/github/znote/znoteaac/badge)](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?

Znote AAC is a full-fledged website used together with an Open Tibia(OT) server.
Expand Down
7 changes: 6 additions & 1 deletion admin_helpdesk.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@
}

$ticketData = mysql_select_single("SELECT * FROM znote_tickets WHERE id='$view' LIMIT 1;");
if(!$ticketData) {
echo 'You can not view this ticket!';
include 'layout/overall/footer.php';
die;
}
?>
<h1>View Ticket #<?php echo $ticketData['id']; ?></h1>
<table class="znoteTable ThreadTable table table-striped">
Expand Down Expand Up @@ -144,4 +149,4 @@
} else echo 'No helpdesk tickets has been submitted.';
}
include 'layout/overall/footer.php';
?>
?>
6 changes: 4 additions & 2 deletions api/api.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<?php
// 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 = '../';

$version = '1.5_SVN';
$version = '2.0_DEV';
session_start();
ob_start();
require_once $filepath.'config.php';
$sessionPrefix = $config['session_prefix'];

require_once $filepath.'engine/database/connect.php';
require_once $filepath.'engine/function/general.php';
require_once $filepath.'engine/function/cache.php';
Expand Down
1 change: 1 addition & 0 deletions changelog.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
<h1>Changelog</h1>
<?php
$cache = new Cache('engine/cache/changelog');
$cache->useMemory(false);
if ($updateCache === true) {
$changelogs = mysql_select_multi("SELECT `id`, `text`, `time`, `report_id`, `status` FROM `znote_changelog` ORDER BY `id` DESC;");

Expand Down
Loading