Compare commits

..

131 Commits

Author SHA1 Message Date
slawkens
e13bd879db Fix branch 2025-01-27 22:04:54 +01:00
slawkens
f696f74a06 Release v0.8.22 2025-01-27 22:04:17 +01:00
slawkens
3b18e400c0 Update CHANGELOG.md 2025-01-27 22:03:55 +01:00
slawkens
d1c72b3240 Update exception.php 2025-01-27 21:45:59 +01:00
slawkens
7abc3c7833 Exception: better style - better showing of longer exceptions 2025-01-27 21:30:39 +01:00
slawkens
c0c4fe33e9 Secure template.php of direct access 2025-01-27 21:30:16 +01:00
slawkens
05827b7861 Typo 2025-01-27 21:29:57 +01:00
slawkens
c304a9ab43 Better exception handler, which clears the whole html output, so the message is better visible 2025-01-27 21:29:43 +01:00
slawkens
d390ea325e Fix exception $account->getName 2025-01-18 19:12:08 +01:00
slawkens
37ba9c7366 All $cache->set calls should have $ttl 2025-01-17 22:55:35 +01:00
slawkens
7c3ebf70fa Optimize $player->isOnline() function, thanks @gesior 2025-01-17 22:52:00 +01:00
slawkens
eda773cb55 Start v0.8.22-dev 2025-01-09 20:26:17 +01:00
slawkens
c5c266b023 Update CHANGELOG.md 2025-01-09 19:26:27 +01:00
slawkens
9483cfaad8 vendor should be accessible, cause of debugbar 2025-01-09 13:39:58 +01:00
slawkens
b4ed68dfd7 Prepare v0.8.21 release 2025-01-09 10:46:51 +01:00
slawkens
39b19ed4c8 Fix change sex price deducted 2025-01-09 09:42:09 +01:00
slawkens
580b888b1d Fix XSS in forum 2025-01-08 23:29:34 +01:00
slawkens
19d3e15c11 Fix move_thread by unauthorized user 2025-01-08 22:34:16 +01:00
slawkens
5a68d204bb Fix for TFS 1.4.2 where conditions is NULL 2024-12-29 15:38:02 +01:00
slawkens
e09fe51774 Set default_socket_timeout for ipinfo.io checkup 2024-12-26 08:53:40 +01:00
slawkens
b2c9eb4745 Support for button_color (red, green, blue) 2024-12-05 21:49:24 +01:00
slawkens
d96787ec21 Update to v0.8.21-defv 2024-11-26 19:00:20 +01:00
slawkens
5df5c64e4f Update to v0.8.20 2024-11-26 18:34:51 +01:00
slawkens
3c4b19743f Linux is case-sensitive, made a mistake here, sorry! 2024-11-26 18:25:01 +01:00
slawkens
0e25ce553c Set current version to 0.8.20-dev 2024-11-19 15:24:42 +01:00
slawkens
2e4bbeb7f7 Release v0.8.19 2024-11-19 14:10:25 +01:00
slawkens
cb6640343b Prepare 0.8.19 changelog 2024-11-19 14:09:49 +01:00
slawkens
4658d1cb29 More obvious name for parameter in -> installMenus 2024-11-19 14:03:49 +01:00
slawkens
b25feaadf6 Fix includes 2024-11-19 14:03:02 +01:00
slawkens
2693db5f6f images/news is in the main folder 2024-11-19 08:21:06 +01:00
slawkens
8195b44061 require src/plugins.php 2024-11-19 07:46:16 +01:00
slawkens
035d0c1012 Add forward-compatible MyAAC namespace 2024-11-19 07:15:26 +01:00
slawkens
5a953ce901 Do not clear menus by default 2024-11-19 07:05:40 +01:00
slawkens
01660bd2b4 Fix for console displaying REQUEST_URI 2024-11-18 23:47:31 +01:00
slawkens
5b858c521a target_blank in template menus links 2024-11-18 23:47:11 +01:00
slawkens
d1c5a189c3 Add Plugins::installMenus function 2024-11-18 23:46:37 +01:00
slawkens
de1bb37bcb getGuildNameById($id) + getGuildLogoById($id) 2024-11-18 23:46:04 +01:00
slawkens
e0036a3e32 Syntactic sugar for db structure changes 2024-11-08 14:38:00 +01:00
slawkens
7f4737631d Add none vocation to highscores 2024-10-10 15:33:25 +02:00
slawkens
317505bf19 Add missing Validator::characterName check 2024-09-12 09:40:36 +02:00
slawkens
55b8645d3f Set default encryption to sha1 2024-09-08 15:05:12 +02:00
slawkens
ffb8f0879b two hooks for compatibility 2024-09-08 15:03:45 +02:00
slawkens
79f5614dce Add more clients (13.22+) 2024-09-08 14:47:36 +02:00
slawkens
2c347d0eac Interesting update from opentibiabr (Uptime readable) 2024-09-08 14:47:21 +02:00
slawkens
d40178104b New hooks in account manage + create 2024-09-08 06:23:17 +02:00
slawkens
55543ee881 Fix title - should be account logs 2024-09-08 06:22:29 +02:00
slawkens
d39386cfab Fix bans page getPlayerNameByAccount + getPlayerNameById 2024-09-08 06:21:40 +02:00
slawkens
b5bbae62b0 Prefer get_browser_real_ip() over REMOTE_ADDR 2024-09-08 05:36:33 +02:00
slawkens
71ef30d35e Better tables.headline.html.twig (patched from 1.0) 2024-09-07 17:28:45 +02:00
anyeor
263c7bed07 fix: require login before create new thread (#261)
We have to login first to see new thread button.
2024-07-26 18:19:29 +02:00
slawkens
1458b7a412 Fix $db->update when there is null value 2024-07-24 17:30:33 +02:00
slawkens
3e00c52128 Optimize OTS_House::load function with appropriate FETCH_ASSOC 2024-07-24 17:30:03 +02:00
slawkens
d73aceb272 Better https detection (patched from develop) 2024-07-23 16:39:24 +02:00
slawkens
1c55d4a220 Set Admin Account verified by default 2024-07-12 22:19:36 +02:00
slawkens
1edf8833c8 Patching from develop
* Allow account_create_character_create even if account_mail_verify is activated
* Fixes to account verify - do not allow login without verified email (Thanks @anyeor)
2024-07-09 23:51:12 +02:00
slawkens
0ffc5f68b4 deny all is enough 2024-06-23 09:56:12 +02:00
slawkens
81b6652738 Fix if <flags> is not present in monster.xml 2024-06-05 21:58:44 +02:00
slawkens
e5b4d2c6b3 Fix warnings in basic.js 2024-05-30 09:49:06 +02:00
slawkens
da1830371f Fix blessings longer than 3 characters 2024-05-30 08:24:02 +02:00
slawkens
6ba04967ed Update to 0.8.19-dev 2024-05-29 21:55:15 +02:00
slawkens
f503e140f3 Release v0.8.18 2024-05-29 21:29:31 +02:00
slawkens
f875f3cd20 New hook for guild-wars-old (0.8) 2024-05-24 22:44:34 +02:00
slawkens
72632c7b45 Fix typo 2024-05-24 17:02:14 +02:00
slawkens
1f2e7bd72d Update to 0.8.18-dev 2024-05-23 23:45:01 +02:00
slawkens
016138ab55 Release v0.8.17 2024-05-18 21:39:50 +02:00
slawkens
77efb80a12 Update config.php 2024-05-15 22:20:31 +02:00
slawkens
02eea950e4 Fix XSS in creatures.php, thanks to @gesior
Closes #254
2024-05-15 22:15:36 +02:00
slawkens
2793c41655 Set default status_ip, most server are hosted locally anyway 2024-05-15 22:07:46 +02:00
slawkens
62d3c198d5 Fix change_info if account_country is disabled 2024-04-15 21:55:02 +02:00
slawkens
ef62b53cec Don't allow redirect to external website 2024-04-08 19:05:42 +02:00
slawkens
7181b988e9 Add TwigTypeCastingExtension
Useful for casting variables in Twig
2024-04-08 07:35:48 +02:00
slawkens
8b0b123f42 deny vendor, composer.json, changelog.md etc. in nginx config sample 2024-04-06 19:51:57 +02:00
slawkens
f98332c698 Update .gitignore 2024-02-18 12:01:22 +01:00
slawkens
b1660bf27a Update README.md
[skip ci]
2024-02-17 09:06:54 +01:00
slawkens
191ad25eb2 Use word-break: break-all in guilds description + character comment 2024-02-16 20:39:40 +01:00
slawkens
7469be6efb Fix date 2024-02-12 21:48:50 +01:00
slawkens
47a3bfd265 Release v0.8.16 2024-02-12 21:48:17 +01:00
slawkens
5ae0be2323 Revert "Fix installation"
This reverts commit 9c318f9012.
2024-02-12 21:43:55 +01:00
slawkens
42154d55a0 Fix broken installation I introduced in 0.8.15 2024-02-12 21:39:04 +01:00
slawkens
9dcc08ee6e Seems that this is better solution to the #245 (output buffering)
This works for both, when output_buffering is enabled, and disabled
2024-01-30 19:20:18 +01:00
slawkens
ba537b42bb Remove 31.php migration -> was for develop branch 2024-01-30 18:23:20 +01:00
slawkens
9c318f9012 Fix installation 2024-01-28 11:11:51 +01:00
Danilo Pucci
a88103a956 - adding check before flush buffer (#245) 2024-01-01 23:31:26 +01:00
slawkens
e26e6f3a1c Silently ignore if the hook does not exist 2023-12-28 19:12:47 +01:00
Slawomir Boczek
08d67a07e0 Create SECURITY.md 2023-12-15 20:56:06 +01:00
slawkens
6e9a89cb2e Update common.php 2023-12-14 16:34:44 +01:00
slawkens
e3aa3d4031 Release v 0.8.15 2023-12-09 00:14:16 +01:00
slawkens
156a68f8bd Update phplint.yml 2023-12-09 00:11:01 +01:00
slawkens
6a28da5d33 Update phplint.yml 2023-12-09 00:04:20 +01:00
slawkens
ee32384dca Seems there was more XSS in bugtracker 2023-12-08 23:45:13 +01:00
slawkens
19afd73e8a This is better 2023-11-29 15:48:03 +01:00
slawkens
eead6a2975 Fix exception showing 2023-11-28 17:11:04 +01:00
slawkens
11b11dd3ee Release v0.8.14 2023-11-27 23:31:45 +01:00
slawkens
483155cf4c Prevent session fixation 2023-11-27 23:16:51 +01:00
slawkens
55dbade8d5 Fix XSS in forum 2023-11-27 22:58:24 +01:00
slawkens
d1bc63d07a Fix forum XSS 2023-11-27 22:58:00 +01:00
slawkens
83a91ec540 Fix XSS in bugtracker.php 2023-11-27 20:28:43 +01:00
slawkens
7b43c972dd Fix missing query_string in nginx sample config
Causes missing parameters in $_GET query
2023-11-25 16:34:57 +01:00
slawkens
3fdf1d3f44 require_once is better 2023-11-05 20:13:31 +01:00
slawkens
764db0c203 Fix display ban info on account page
https://otland.net/threads/myacc-bans-display-problem.286825/
2023-11-02 22:06:07 +01:00
slawkens
538076bc45 My fault 2023-09-26 22:00:45 +02:00
slawkens
4327b66f91 Clear some additional cache keys 2023-09-26 20:45:50 +02:00
slawkens
3f27724569 Update common.php 2023-09-16 10:46:17 +02:00
slawkens
9c0c2bbece Update CHANGELOG.md 2023-09-16 10:45:54 +02:00
slawkens
946144016b Release v0.8.13 2023-09-16 10:35:10 +02:00
slawkens
5c3b01aca4 Fix XSS vulnerability 2023-09-16 10:31:33 +02:00
slawkens
50983a2b85 Fix error log when coins column does not exist 2023-09-14 16:29:31 +02:00
slawkens
765886f0c7 Add latest clients versions 2023-08-31 14:20:49 +02:00
slawkens
8ea78a5852 thanks @elsongabriel, seems str_contains is not available in php 7 2023-08-25 20:45:45 +02:00
slawkens
063cbab93e Allow hooks to be prefixed with HOOK_ 2023-08-23 12:00:03 +02:00
slawkens
f1670f4012 Patching from develop - twig context for hooks 2023-08-21 12:25:53 +02:00
slawkens
6fcf0f7117 Ignore gallery 2023-08-21 12:21:24 +02:00
slawkens
7a07763625 Update README.md 2023-08-11 22:21:54 +02:00
slawkens
8d2172a649 Added JetBrains logo + notice, thanks for support! 2023-08-11 22:17:17 +02:00
slawkens
b8f65207b6 Add version support table + fix badges 2023-08-11 22:11:29 +02:00
slawkens
ea675afe86 Start 0.8.13-dev 2023-08-07 22:53:02 +02:00
slawkens
cc1cebf359 Update CHANGELOG & release v0.8.12 2023-08-07 22:14:47 +02:00
slawkens
1e874c7027 Fixed not working links from database, introduced in 0.8.10 2023-08-07 21:45:56 +02:00
slawkens
a338fd967c Removed deprecated functions: utf8_encode & decode 2023-08-05 19:58:52 +02:00
slawkens
8796ff7e72 Remove whitespaces 2023-08-05 19:58:20 +02:00
slawkens
a8172a518f Add some functions to compatibility layer of gesioraac 2023-08-05 19:58:04 +02:00
slawkens
559c2c7bd2 Add .htaccess to .gitignore 2023-08-05 11:57:15 +02:00
slawkens
7a546e5a41 There is no more info. That never worked. 2023-07-29 07:26:03 +02:00
slawkens
5f7a9154b7 Thanks @anyeor for previous fix 2023-07-11 11:17:18 +02:00
slawkens
0d52978d9f Fix: cannot create topic on this board (check wasn't working) 2023-07-11 11:15:58 +02:00
slawkens
df48363ea4 Shorten some forum code about length 2023-07-07 17:15:13 +02:00
slawkens
34725e0257 Forum: better error messages (Suggested by @anyeor) 2023-07-07 14:34:26 +02:00
slawkens
df321154f6 Fix guild description on guilds page 2023-07-02 13:47:32 +02:00
slawkens
f2a3ec1185 Fix guild description not shown 2023-06-30 19:53:16 +02:00
slawkens
ce4aed0f17 Add word-break on forum thread & reply
When someone inserts long word, is will break into multiple lines
2023-06-30 19:32:47 +02:00
slawkens
d0c82f6fb0 Start 0.8.12-dev 2023-06-30 19:13:38 +02:00
84 changed files with 981 additions and 419 deletions

View File

@@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: overtrue/phplint@7.4 - uses: overtrue/phplint@3.4.0
with: with:
path: . path: .
options: --exclude="system/libs/polyfill-mbstring/bootstrap80.php" options: --exclude="system/libs/polyfill-mbstring/bootstrap80.php"

11
.gitignore vendored
View File

@@ -2,16 +2,21 @@ Thumbs.db
.DS_Store .DS_Store
.idea .idea
#
/.htaccess
# composer # composer
composer.lock composer.lock
vendor vendor
# npm # npm
node_modules node_modules
tools/ext
# cypress # cypress
cypress.env.json cypress.env.json
cypress/e2e/2-advanced-examples cypress/e2e/2-advanced-examples
cypress/screenshots
# created by release.sh # created by release.sh
releases releases
@@ -32,6 +37,12 @@ images/guilds/*
images/editor/* images/editor/*
!images/editor/index.html !images/editor/index.html
# gallery images
images/gallery/*
!images/gallery/index.html
!images/gallery/demon.jpg
!images/gallery/demon_thumb.gif
# cache # cache
system/cache/* system/cache/*
!system/cache/index.html !system/cache/index.html

View File

@@ -1,5 +1,147 @@
# Changelog # Changelog
## [0.8.22 - 27.01.2025]
### Changed
* Better exception handler, which clears the whole html output, so the message is better visible + better style (https://github.com/slawkens/myaac/commit/c304a9ab43bf0bda41907db3e6f65293350640a2 + https://github.com/slawkens/myaac/commit/7abc3c78334d44fb64684b26d8a305d0fe676caa)
* Optimize $player->isOnline() function, thanks @gesior (https://github.com/slawkens/myaac/commit/7c3ebf70fa4751af986be7b46ee3530d4875271e)
* All $cache->set calls should have $ttl (https://github.com/slawkens/myaac/commit/37ba9c7366139778d09d1316d7cb49a255165778)
### Fixed
* exception in lostaccount.php - $account->getName() (https://github.com/slawkens/myaac/commit/d390ea325e2dbfd87a830cfe40991f58e07a87a1)
## [0.8.21 - 09.01.2025]
### Added
* support for button_color (red, green, blue) (https://github.com/slawkens/myaac/commit/b2c9eb474513650a014352d820602b8007eb3bf3)
### Changed
* Set default_socket_timeout for ipinfo.io checkup (https://github.com/slawkens/myaac/commit/e09fe517747e4f462c72395ede39759bf308d171)
### Fixed
* XSS in forum (https://github.com/slawkens/myaac/commit/580b888b1dd1317d7ccf5f888536159c3bfe4324)
* move_thread by unauthorized user (https://github.com/slawkens/myaac/commit/19d3e15c114de65ef6c379e4da66d32138a0e7c4)
* change sex wrong price deducted (https://github.com/slawkens/myaac/commit/39b19ed4c8724385ee80f7d02219e84f6b3f5d95)
* fix for TFS 1.4.2 exception on creating character, where conditions column is NULL (https://github.com/slawkens/myaac/commit/5a68d204bb24392d424efde4133b0a3222e788bb)
## [0.8.20 - 26.11.2024]
Small fix regarding the latest release and the linux system.
Download this one, instead of the 0.8.19 if you are using linux.
If you are using 0.8.19, make this update:
The fix is to make this change in the system/libs/hooks.php
Change
```
require_once LIBS . 'src/plugins.php';
```
Into:
```
require_once LIBS . 'src/Plugins.php';
```
Yeah, we just changed 'p' to 'P' - that's just case-sensitive nature of linux.
## [0.8.19 - 19.11.2024]
### Added
* syntactic sugar for db structure changes (https://github.com/slawkens/myaac/commit/e0036a3e32e8c37c28665dd7ae18ac9b8fc167d9)
* add "None" vocation to highscores (https://github.com/slawkens/myaac/commit/7f4737631dfcb6ec255c6d9301304d3bf222a033)
* new hooks in account manage + create (https://github.com/slawkens/myaac/commit/d40178104b0f411b9672102c49a4b87ac16e1779)
* new functions: getGuildNameById($id) + getGuildLogoById($id) + Plugins::installMenus($templateName, $menus, $clearOld = false) (https://github.com/slawkens/myaac/commit/de1bb37bcb6d111fbdf185ef9c2fec7e7f05053e + https://github.com/slawkens/myaac/commit/d1c5a189c3b182a36933ed507c6ae36b61fe1d45 + https://github.com/slawkens/myaac/commit/5a953ce901522d080aa16fcfcd268e9544bf6e1a)
### Changed
* set default encryption to sha1 (https://github.com/slawkens/myaac/commit/55b8645d3f38c47f4aafc1906625b676c429cdd5)
* prefer get_browser_real_ip() over REMOTE_ADDR (cause of Cloudflare and similar services) (https://github.com/slawkens/myaac/commit/b5bbae62b09db50a73bfa3e288245ea718005aa9)
* allow account_create_character_create even if account_mail_verify is activated (https://github.com/slawkens/myaac/commit/1edf8833c844b25372017e4affaf12aa02cdce7a)
* better https detection (patched from develop) (https://github.com/slawkens/myaac/commit/d73aceb272d0615244fcfd0998d75e6c6c15d3fe)
* require login before create new thread (#261, @anyeor)
* better tables.headline.html.twig (patched from 1.0) (https://github.com/slawkens/myaac/commit/71ef30d35ecb2f876e9b861f211f737302bf408e)
### Fixed
* bans page fixed functions getPlayerNameByAccount + getPlayerNameById (https://github.com/slawkens/myaac/commit/d39386cfabfa13e5c916ead69e2f8f90fdc47f4f)
* account verify - do not allow login without verified email (https://github.com/slawkens/myaac/commit/1edf8833c844b25372017e4affaf12aa02cdce7a, Thanks @anyeor)
* if <flags> is not present in monster.xml (https://github.com/slawkens/myaac/commit/81b6652738a7b04be3980cbf55443a6fbe437b34)
* $db->update when there is null value (https://github.com/slawkens/myaac/commit/1458b7a412ff6875cebba1b88d380f7f959ee6be)
* error on $db __destruct saving current script name in CLI (https://github.com/slawkens/myaac/commit/01660bd2b4967315c0e16d2f83c6c39f0b78683d)
## [0.8.18 - 29.05.2024]
### Added
* hook in guilds page to support guild wars (https://github.com/slawkens/myaac/commit/f875f3cd2059fac5c23a08ce73dd8621a66613e0)
## [0.8.17 - 18.05.2024]
### Added
* TwigTypeCastingExtension (https://github.com/slawkens/myaac/commit/7181b988e9518320d57486670ca4e2d3b2fe1cfa)
### Fixed
* fix XSS in creatures.php (https://github.com/slawkens/myaac/commit/02eea950e4fd756e8d5c32e56181986d51f5ac70, @gesior)
* don't allow redirect to external website (https://github.com/slawkens/myaac/commit/ef62b53cec5a479cc85aa15940ad9ebbcefde876)
* change_info if account_country is disabled (https://github.com/slawkens/myaac/commit/62d3c198d567541a90900fe2d7ede070e7b1ff68)
### Changed
* use word-break: break-all in guilds description + character comment (https://github.com/slawkens/myaac/commit/191ad25eb2d4c1cec6f6668da7a345fec0ad2a7f)
* set default status_ip to 127.0.0.1, most server are hosted locally anyway (https://github.com/slawkens/myaac/commit/2793c41655b47f7db295143a298ccda70f11462b)
## [0.8.16 - 12.02.2024]
### Fixed
* broken installation
* database and finish step warnings/errors (https://github.com/slawkens/myaac/pull/245, @danilopucci)
* silently ignore if the hook does not exist
## [0.8.15 - 09.12.2023]
More security fixes, especially in bugtracker.
## [0-8.14 - 27.11.2023]
Security fixes.
### Fixed
* XSS vulnerability in bugtracker (https://github.com/slawkens/myaac/commit/83a91ec540072d319dd338abff45f8d5ebf48190)
* XSS vulnerability in forum (https://github.com/slawkens/myaac/commit/d1bc63d07ad88a143358cacd2c417891eea74dcc + https://github.com/slawkens/myaac/commit/55dbade8d5280c5baed45e5f7ebc3613b8e9b9e8)
* Session Fixation (https://github.com/slawkens/myaac/commit/483155cf4c1e3068aaee0d44541dfa61f6223379)
* displaying ban info on account page (https://github.com/slawkens/myaac/commit/764db0c203d1826ffce3a5a78f83a97e56bd0685)
### Changed
* Clear some additional cache keys - like database cache (https://github.com/slawkens/myaac/commit/4327b66f915d06dce504211692173606b9ef3b4e)
## [0.8.13 - 16.09.2023]
### Added
* latest client versions to config (https://github.com/slawkens/myaac/commit/765886f0c782807400c429577cde5e45bd7c308f)
* patching from develop - twig context for hooks (https://github.com/slawkens/myaac/commit/f1670f4012cc7595433fe0b1937c1f9b15a60b07)
### Fixed
* fixed XSS vulnerability in some pages (https://github.com/slawkens/myaac/commit/5c3b01aca4f3cfe8abc86b8ce48194b2da87b808)
Nothing more or less!
## [0.8.12 - 07.08.2023]
I've moved the repository back to my personal account. (Just so you know!)
I will also try to add git commits pointed to each change, lets see if you like it or not - you can comment in discussion, that will be created just after releasing this version :)
### Added
* forum: better error messages (Suggested by @anyeor) (https://github.com/slawkens/myaac/commit/34725e0257684fe5fa43875cc3a8f587ba04642e)
* more support for GesiorAAC classes, so some of them will work with MyAAC (https://github.com/slawkens/myaac/commit/a8172a518ff8939c4402349b16c064fcaf855d31)
* word-break on forum thread & reply (Suggested by @anyeor) (https://github.com/slawkens/myaac/commit/ce4aed0f1719d2aadc749e5238e883e3c10e2686)
### Fixed
* not working pages/links from database, introduced in 0.8.10 (Thanks to OtLand user - https://otland.net/members/0lo.99657/ for report) (https://github.com/slawkens/myaac/commit/1e874c7027769bd09e772a1cdac75d7e37991256)
* it was possible to create topic in board that was closed, ommiting the error check (Thanks to @anyeor for report) (https://github.com/slawkens/myaac/commit/0d52978d9fb99869500d35e7676f454ca5eaba14)
* PHP 8.2 compatibility - removed deprecated functions utf8_encode & utf8_decode (https://github.com/slawkens/myaac/commit/a338fd967cdbcc89e86be4e6b66b2cad2ff23251)
* guild description not being correctly shown (Reported by @anyeor) (https://github.com/slawkens/myaac/commit/f2a3ec1185df64ad9084d4ff55790ae4a5b3e5fd, https://github.com/slawkens/myaac/commit/df321154f63d458a4bc7d83bac5e3447b67317a4)
### Removed
* Some old code for verifying messages length (Reported by @anyeor) (https://github.com/slawkens/myaac/commit/df48363ea4ced4350fd90ffddf57d464ba5afa8b)
* some info about config failed to load, was never working (https://github.com/slawkens/myaac/commit/7a546e5a41036b0e9e926d337c6f2e3c41c591d2)
## [0.8.11 - 30.06.2023] ## [0.8.11 - 30.06.2023]
### Added ### Added

View File

@@ -1,24 +1,29 @@
# [MyAAC](https://my-aac.org) # [MyAAC](https://my-aac.org)
[![Build Status Master](https://img.shields.io/travis/slawkens/myaac/master)](https://travis-ci.org/github/slawkens/myaac)
[![License: GPL-3.0](https://img.shields.io/github/license/slawkens/myaac)](https://opensource.org/licenses/gpl-license)
[![Downloads Count](https://img.shields.io/github/downloads/slawkens/myaac/total)](https://github.com/slawkens/myaac/releases)
[![PHP Versions](https://img.shields.io/travis/php-v/slawkens/myaac/master)](https://github.com/slawkens/myaac/blob/d8b3b4135827ee17e3c6d41f08a925e718c587ed/.travis.yml#L3)
[![OpenTibia Discord](https://img.shields.io/discord/288399552581468162)](https://discord.gg/2J39Wus)
[![Closed Issues](https://img.shields.io/github/issues-closed-raw/slawkens/myaac)](https://github.com/slawkens/myaac/issues?q=is%3Aissue+is%3Aclosed)
MyAAC is a free and open-source Automatic Account Creator (AAC) written in PHP. It is a fork of the [Gesior](https://github.com/gesior/Gesior2012) project. It supports only MySQL databases. MyAAC is a free and open-source Automatic Account Creator (AAC) written in PHP. It is a fork of the [Gesior](https://github.com/gesior/Gesior2012) project. It supports only MySQL databases.
Official website: https://my-aac.org Official website: https://my-aac.org
[![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/slawkens/myaac/cypress.yml)](https://github.com/slawkens/myaac/actions)
[![License: GPL-3.0](https://img.shields.io/github/license/slawkens/myaac)](https://opensource.org/licenses/gpl-license)
[![Downloads Count](https://img.shields.io/github/downloads/slawkens/myaac/total)](https://github.com/slawkens/myaac/releases)
[![OpenTibia Discord](https://img.shields.io/discord/288399552581468162)](https://discord.gg/2J39Wus)
[![Closed Issues](https://img.shields.io/github/issues-closed-raw/slawkens/myaac)](https://github.com/slawkens/myaac/issues?q=is%3Aissue+is%3Aclosed)
| Version | Status | Branch | Requirements |
|:--------|:-----------------------|:--------|:---------------|
| **1.x** | **Active development** | develop | **PHP >= 8.1** |
| 0.9.x | Not developed anymore | 0.9 | PHP >= 7.2.5 |
| 0.8.x | Active support | master | PHP >= 7.2.5 |
| 0.7.x | End Of Life | 0.7 | PHP >= 5.3.3 |
### Requirements ### Requirements
- PHP 7.2.5 or later
- MySQL database - MySQL database
- PDO PHP Extension - PHP Extensions: pdo, xml, json
- XML PHP Extension - (optional) apache2 mod_rewrite (to use friendly_urls)
- ZIP PHP Extension - (optional) zip PHP Extension (to install plugins)
- (optional) mod_rewrite to use friendly_urls - (optional) gd PHP Extension (for generating signature images)
### Installation ### Installation
@@ -42,7 +47,8 @@ Official website: https://my-aac.org
### Configuration ### Configuration
Check *config.php* to get more informations. Check *config.php* to get more informations. (Notice: MyAAC 1.0+ doesn't use config.php anymore, it has been moved to Admin Panel - Settings page).
Use *config.local.php* for your local configuration changes. Use *config.local.php* for your local configuration changes.
### Branches ### Branches
@@ -73,6 +79,12 @@ Look: [Contributing](https://github.com/otsoft/myaac/wiki/Contributing) in our w
If you have a great idea or want contribute to the project - visit our website at https://www.my-aac.org If you have a great idea or want contribute to the project - visit our website at https://www.my-aac.org
## Project supported by JetBrains
Many thanks to Jetbrains for kindly providing a license for me to work on this and other open-source projects.
[![JetBrains](https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.svg)](https://www.jetbrains.com/?from=https://github.com/slawkens)
### License ### License
This program and all associated files are released under the GNU Public License. This program and all associated files are released under the GNU Public License.

16
SECURITY.md Normal file
View File

@@ -0,0 +1,16 @@
# Security Policy
## Supported Versions
| Version | Supported |
| ------- | ------------------ |
| 1.x.y | :white_check_mark: |
| 0.9.x | :x: |
| 0.8.x | :white_check_mark: |
| < 0.7 | :x: |
## Reporting a Vulnerability
If you found a security vulnerability, please write an email to security@my-aac.org
All reports will be taken very seriously, and a fix will be posted as soon as possible.

View File

@@ -426,7 +426,7 @@ else if ($id > 0 && isset($account) && $account->isLoaded()) {
<div class="box-body"> <div class="box-body">
<form action="<?php echo $base; ?>" method="post"> <form action="<?php echo $base; ?>" method="post">
<div class="input-group input-group-sm"> <div class="input-group input-group-sm">
<input type="text" class="form-control" name="search_name" value="<?php echo $search_account; ?>" <input type="text" class="form-control" name="search_name" value="<?php echo escapeHtml($search_account); ?>"
maxlength="32" size="32"> maxlength="32" size="32">
<span class="input-group-btn"> <span class="input-group-btn">
<button type="submit" type="button" class="btn btn-info btn-flat">Search</button> <button type="submit" type="button" class="btn btn-info btn-flat">Search</button>

View File

@@ -10,8 +10,8 @@
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
$title = 'Load items.xml'; $title = 'Load items.xml';
require LIBS . 'items.php'; require_once LIBS . 'items.php';
require LIBS . 'weapons.php'; require_once LIBS . 'weapons.php';
$twig->display('admin.items.html.twig'); $twig->display('admin.items.html.twig');

View File

@@ -210,7 +210,7 @@ if ($id > 0) {
if ($hasBlessingsColumn) { if ($hasBlessingsColumn) {
$blessings = $_POST['blessings']; $blessings = $_POST['blessings'];
verify_number($blessings, 'Blessings', 2); verify_number($blessings, 'Blessings', 3);
} }
$balance = $_POST['balance']; $balance = $_POST['balance'];
@@ -784,7 +784,7 @@ else if ($id > 0 && isset($player) && $player->isLoaded())
<div class="box-body"> <div class="box-body">
<form action="<?php echo $base; ?>" method="post"> <form action="<?php echo $base; ?>" method="post">
<div class="input-group input-group-sm"> <div class="input-group input-group-sm">
<input type="text" class="form-control" name="search_name" value="<?php echo $search_name; ?>" <input type="text" class="form-control" name="search_name" value="<?php echo escapeHtml($search_name); ?>"
maxlength="32" size="32"> maxlength="32" size="32">
<span class="input-group-btn"> <span class="input-group-btn">
<button type="submit" type="button" class="btn btn-info btn-flat">Search</button> <button type="submit" type="button" class="btn btn-info btn-flat">Search</button>

View File

@@ -10,8 +10,6 @@
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
$title = 'Plugin manager'; $title = 'Plugin manager';
require_once LIBS . 'plugins.php';
$twig->display('admin.plugins.form.html.twig'); $twig->display('admin.plugins.form.html.twig');
if (isset($_REQUEST['uninstall'])) { if (isset($_REQUEST['uninstall'])) {

View File

@@ -26,7 +26,7 @@
if (version_compare(phpversion(), '7.2.5', '<')) die('PHP version 7.2.5 or higher is required.'); if (version_compare(phpversion(), '7.2.5', '<')) die('PHP version 7.2.5 or higher is required.');
define('MYAAC', true); define('MYAAC', true);
define('MYAAC_VERSION', '0.8.11'); define('MYAAC_VERSION', '0.8.22');
define('DATABASE_VERSION', 33); define('DATABASE_VERSION', 33);
define('TABLE_PREFIX', 'myaac_'); define('TABLE_PREFIX', 'myaac_');
define('START_TIME', microtime(true)); define('START_TIME', microtime(true));
@@ -100,6 +100,10 @@ for($i = 1; $i < $size; $i++)
$basedir = str_replace(array('/admin', '/install', '/tools'), '', $basedir); $basedir = str_replace(array('/admin', '/install', '/tools'), '', $basedir);
define('BASE_DIR', $basedir); define('BASE_DIR', $basedir);
if (file_exists(BASE . 'config.local.php') && !defined('MYAAC_INSTALL')) {
require BASE . 'config.local.php';
}
if(!IS_CLI) { if(!IS_CLI) {
if (isset($_SERVER['HTTP_HOST'][0])) { if (isset($_SERVER['HTTP_HOST'][0])) {
$baseHost = $_SERVER['HTTP_HOST']; $baseHost = $_SERVER['HTTP_HOST'];
@@ -111,12 +115,21 @@ if(!IS_CLI) {
} }
} }
define('SERVER_URL', 'http' . (isset($_SERVER['HTTPS'][0]) && strtolower($_SERVER['HTTPS']) === 'on' ? 's' : '') . '://' . $baseHost); define('SERVER_URL', 'http' . (isHttps() ? 's' : '') . '://' . $baseHost);
define('BASE_URL', SERVER_URL . BASE_DIR . '/'); define('BASE_URL', SERVER_URL . BASE_DIR . '/');
define('ADMIN_URL', SERVER_URL . BASE_DIR . '/admin/'); define('ADMIN_URL', SERVER_URL . BASE_DIR . '/admin/');
//define('CURRENT_URL', BASE_URL . $_SERVER['REQUEST_URI']); //define('CURRENT_URL', BASE_URL . $_SERVER['REQUEST_URI']);
if(@$config['env'] === 'dev') {
require SYSTEM . 'exception.php'; require SYSTEM . 'exception.php';
}
} }
require SYSTEM . 'autoload.php'; require SYSTEM . 'autoload.php';
function isHttps(): bool
{
return
(!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) === 'https')
|| (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off')
|| (isset($_SERVER['SERVER_PORT']) && (int) $_SERVER['SERVER_PORT'] === 443);
}

View File

@@ -77,6 +77,7 @@ $config = array(
'database_log' => false, // should database queries be logged and and saved into system/logs/database.log? 'database_log' => false, // should database queries be logged and and saved into system/logs/database.log?
'database_socket' => '', // set if you want to connect to database through socket (example: /var/run/mysqld/mysqld.sock) 'database_socket' => '', // set if you want to connect to database through socket (example: /var/run/mysqld/mysqld.sock)
'database_persistent' => false, // use database permanent connection (like server), may speed up your site 'database_persistent' => false, // use database permanent connection (like server), may speed up your site
'database_encryption' => 'sha1',
// multiworld system (only TFS 0.3) // multiworld system (only TFS 0.3)
'multiworld' => false, // use multiworld system? 'multiworld' => false, // use multiworld system?
@@ -268,9 +269,9 @@ $config = array(
// status, took automatically from config file if empty // status, took automatically from config file if empty
'status_enabled' => true, // you can disable status checking by settings this to "false" 'status_enabled' => true, // you can disable status checking by settings this to "false"
'status_ip' => '', 'status_ip' => '127.0.0.1',
'status_port' => '', 'status_port' => '',
'status_timeout' => 2, // how long to wait for the initial response from the server (default: 2 seconds) 'status_timeout' => 1.0, // how long to wait for the initial response from the server (default: 1 second)
// how often to connect to server and update status (default: every minute) // how often to connect to server and update status (default: every minute)
// if your status timeout in config.lua is bigger, that it will be used instead // if your status timeout in config.lua is bigger, that it will be used instead

View File

View File

@@ -24,6 +24,7 @@
* @link https://my-aac.org * @link https://my-aac.org
*/ */
ob_start();
require_once 'common.php'; require_once 'common.php';
require_once SYSTEM . 'functions.php'; require_once SYSTEM . 'functions.php';
@@ -167,7 +168,7 @@ else {
} }
// handle ?fbclid=x, etc. (show news page) // handle ?fbclid=x, etc. (show news page)
if (!$found && count($_GET) > 0 && !isset($_REQUEST['subtopic']) && !isset($_REQUEST['p'])) { if (!$found && count($_GET) > 0 && !isset($_REQUEST['subtopic']) && !isset($_REQUEST['p']) && !in_array($_SERVER['QUERY_STRING'], getDatabasePages())) {
$_REQUEST['p'] = $_REQUEST['subtopic'] = 'news'; $_REQUEST['p'] = $_REQUEST['subtopic'] = 'news';
$found = true; $found = true;
} }
@@ -221,7 +222,7 @@ if(isset($config['anonymous_usage_statistics']) && $config['anonymous_usage_stat
if(fetchDatabaseConfig('last_usage_report', $value)) { if(fetchDatabaseConfig('last_usage_report', $value)) {
$should_report = time() > (int)$value + $report_time; $should_report = time() > (int)$value + $report_time;
if($cache->enabled()) { if($cache->enabled()) {
$cache->set('last_usage_report', $value); $cache->set('last_usage_report', $value, 60 * 60);
} }
} }
else { else {
@@ -236,7 +237,7 @@ if(isset($config['anonymous_usage_statistics']) && $config['anonymous_usage_stat
updateDatabaseConfig('last_usage_report', time()); updateDatabaseConfig('last_usage_report', time());
if($cache->enabled()) { if($cache->enabled()) {
$cache->set('last_usage_report', time()); $cache->set('last_usage_report', time(), 60 * 60);
} }
} }
} }

View File

@@ -189,14 +189,14 @@ clearstatcache();
if(is_writable(CACHE) && (MYAAC_OS != 'WINDOWS' || win_is_writable(CACHE))) { if(is_writable(CACHE) && (MYAAC_OS != 'WINDOWS' || win_is_writable(CACHE))) {
if(!file_exists(BASE . 'install/ip.txt')) { if(!file_exists(BASE . 'install/ip.txt')) {
$content = warning('AAC installation is disabled. To enable it make file <b>ip.txt</b> in install/ directory and put there your IP.<br/> $content = warning('AAC installation is disabled. To enable it make file <b>ip.txt</b> in install/ directory and put there your IP.<br/>
Your IP is:<br /><b>' . $_SERVER['REMOTE_ADDR'] . '</b>', true); Your IP is:<br /><b>' . get_browser_real_ip() . '</b>', true);
} }
else { else {
$file_content = trim(file_get_contents(BASE . 'install/ip.txt')); $file_content = trim(file_get_contents(BASE . 'install/ip.txt'));
$allow = false; $allow = false;
$listIP = preg_split('/\s+/', $file_content); $listIP = preg_split('/\s+/', $file_content);
foreach($listIP as $ip) { foreach($listIP as $ip) {
if($_SERVER['REMOTE_ADDR'] == $ip) { if(get_browser_real_ip() == $ip) {
$allow = true; $allow = true;
} }
} }

View File

@@ -79,6 +79,8 @@ else {
$account_used->setCustomField('web_flags', FLAG_ADMIN + FLAG_SUPER_ADMIN); $account_used->setCustomField('web_flags', FLAG_ADMIN + FLAG_SUPER_ADMIN);
$account_used->setCustomField('country', 'us'); $account_used->setCustomField('country', 'us');
$account_used->setCustomField('email_verified', 1);
if($db->hasColumn('accounts', 'group_id')) if($db->hasColumn('accounts', 'group_id'))
$account_used->setCustomField('group_id', $groups->getHighestId()); $account_used->setCustomField('group_id', $groups->getHighestId());
if($db->hasColumn('accounts', 'type')) if($db->hasColumn('accounts', 'type'))

View File

@@ -1,3 +1,4 @@
<?php defined('MYAAC') or die('Direct access not allowed!'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="<?php echo $locale['direction']; ?>" lang="<?php echo $locale['lang']; ?>" xml:lang="<?php echo $locale['lang']; ?>"> <html xmlns="http://www.w3.org/1999/xhtml" dir="<?php echo $locale['direction']; ?>" lang="<?php echo $locale['lang']; ?>" xml:lang="<?php echo $locale['lang']; ?>">
<head> <head>

View File

@@ -11,8 +11,10 @@ $error = false;
require BASE . 'install/includes/config.php'; require BASE . 'install/includes/config.php';
ini_set('max_execution_time', 300); ini_set('max_execution_time', 300);
@ob_end_flush();
ob_implicit_flush(); ob_implicit_flush();
ob_end_flush();
header('X-Accel-Buffering: no'); header('X-Accel-Buffering: no');
if(!$error) { if(!$error) {

View File

@@ -8,8 +8,10 @@ require BASE . 'install/includes/functions.php';
require BASE . 'install/includes/locale.php'; require BASE . 'install/includes/locale.php';
ini_set('max_execution_time', 300); ini_set('max_execution_time', 300);
@ob_end_flush();
ob_implicit_flush(); ob_implicit_flush();
ob_end_flush();
header('X-Accel-Buffering: no'); header('X-Accel-Buffering: no');
if(isset($config['installed']) && $config['installed'] && !isset($_SESSION['saved'])) { if(isset($config['installed']) && $config['installed'] && !isset($_SESSION['saved'])) {

View File

@@ -10,22 +10,21 @@ server {
# this is very important, be sure its in your nginx conf - it prevents access to logs etc. # this is very important, be sure its in your nginx conf - it prevents access to logs etc.
location ~ /system { location ~ /system {
deny all; deny all;
return 404;
} }
# block .htaccess # block .htaccess, CHANGELOG.md, composer.json etc.
location ~ /\.ht { # this is to prevent finding software versions
location ~\.(ht|md|json|dist)$ {
deny all; deny all;
} }
# block git files and folders # block git files and folders
location ~ /\.git { location ~ /\.git {
return 404;
deny all; deny all;
} }
location / { location / {
try_files $uri $uri/ /index.php; try_files $uri $uri/ /index.php?$query_string;;
} }
location ~ \.php$ { location ~ \.php$ {

View File

@@ -4,12 +4,12 @@ defined('MYAAC') or die('Direct access not allowed!');
$reward = config('account_mail_confirmed_reward'); $reward = config('account_mail_confirmed_reward');
$hasCoinsColumn = $db->hasColumn('accounts', 'coins'); $hasCoinsColumn = $db->hasColumn('accounts', 'coins');
if ($reward['coins'] > 0 && $hasCoinsColumn) { if ($reward['coins'] > 0 && !$hasCoinsColumn) {
log_append('email_confirm_error.log', 'accounts.coins column does not exist.'); log_append('email_confirm_error.log', 'accounts.coins column does not exist.');
} }
if (!isset($account) || !$account->isLoaded()) { if (!isset($account) || !$account->isLoaded()) {
log_append('email_confirm_error.log', 'Account not loaded.'); //log_append('email_confirm_error.log', 'Account not loaded.');
return; return;
} }

View File

@@ -22,7 +22,7 @@ if [ $1 = "prepare" ]; then
mkdir -p tmp mkdir -p tmp
# get myaac from git archive # get myaac from git archive
git archive --format zip --output tmp/myaac.zip master git archive --format zip --output tmp/myaac.zip 0.8
cd tmp/ || exit cd tmp/ || exit

View File

@@ -9,7 +9,6 @@ require_once __DIR__ . '/../../common.php';
require_once SYSTEM . 'functions.php'; require_once SYSTEM . 'functions.php';
require_once SYSTEM . 'init.php'; require_once SYSTEM . 'init.php';
require_once SYSTEM . 'hooks.php'; require_once SYSTEM . 'hooks.php';
require_once LIBS . 'plugins.php';
if($argc !== 2) { if($argc !== 2) {
echo 'This command expects one parameter: zip file name (plugin)' . PHP_EOL; echo 'This command expects one parameter: zip file name (plugin)' . PHP_EOL;

View File

@@ -99,4 +99,14 @@ $config['clients'] = [
1291, 1291,
1300, 1300,
1310,
1311,
1312,
1316,
1320,
1321,
1322,
1330,
1332,
1340,
]; ];

View File

@@ -9,7 +9,30 @@
*/ */
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
class Player extends OTS_Player {} class Account extends OTS_Account {
class Guild extends OTS_Guild {} public function loadById($id) {
$this->load($id);
}
public function loadByName($name) {
$this->find($name);
}
}
class Player extends OTS_Player {
public function loadById($id) {
$this->load($id);
}
public function loadByName($name) {
$this->find($name);
}
}
class Guild extends OTS_Guild {
public function loadById($id) {
$this->load($id);
}
public function loadByName($name) {
$this->find($name);
}
}
class GuildRank extends OTS_GuildRank {} class GuildRank extends OTS_GuildRank {}
class House extends OTS_House {} class House extends OTS_House {}

View File

@@ -37,12 +37,14 @@ function exception_handler($exception) {
} }
// display beautiful error message // display beautiful error message
// the file is .twig.html, but its not really parsed by Twig // the file is .twig.html, but it's not really parsed by Twig
// we just replace some values manually // we just replace some values manually
// cause in case Twig throws exception, we can show it too // cause in case Twig throws exception, we can show it too
$content = file_get_contents($template_file); $content = file_get_contents($template_file);
$content = str_replace(array('{{ BASE_URL }}', '{{ exceptionClass }}', '{{ message }}', '{{ backtrace }}', '{{ powered_by }}'), array(BASE_URL, get_class($exception), $message, $backtrace_formatted, base64_decode('UG93ZXJlZCBieSA8YSBocmVmPSJodHRwOi8vbXktYWFjLm9yZyIgdGFyZ2V0PSJfYmxhbmsiPk15QUFDLjwvYT4=')), $content); $content = str_replace(array('{{ BASE_URL }}', '{{ exceptionClass }}', '{{ message }}', '{{ backtrace }}', '{{ powered_by }}'), array(BASE_URL, get_class($exception), $message, $backtrace_formatted, base64_decode('UG93ZXJlZCBieSA8YSBocmVmPSJodHRwOi8vbXktYWFjLm9yZyIgdGFyZ2V0PSJfYmxhbmsiPk15QUFDLjwvYT4=')), $content);
@ob_clean();
echo $content; echo $content;
} }

View File

@@ -923,8 +923,8 @@ function load_config_lua($filename)
$config_file = $filename; $config_file = $filename;
if(!@file_exists($config_file)) if(!@file_exists($config_file))
{ {
log_append('error.log', '[load_config_file] Fatal error: Cannot load config.lua (' . $filename . '). Error: ' . print_r(error_get_last(), true)); log_append('error.log', '[load_config_file] Fatal error: Cannot load config.lua (' . $filename . ').');
throw new RuntimeException('ERROR: Cannot find ' . $filename . ' file. More info in system/logs/error.log'); throw new RuntimeException('ERROR: Cannot find ' . $filename . ' file.');
} }
$result = array(); $result = array();
@@ -1146,9 +1146,30 @@ function clearCache()
if ($cache->fetch('failed_logins', $tmp)) if ($cache->fetch('failed_logins', $tmp))
$cache->delete('failed_logins'); $cache->delete('failed_logins');
global $template_name; foreach (get_templates() as $template) {
if ($cache->fetch('template_ini' . $template_name, $tmp)) if ($cache->fetch('template_ini_' . $template, $tmp)) {
$cache->delete('template_ini' . $template_name); $cache->delete('template_ini_' . $template);
}
}
if ($cache->fetch('template_menus', $tmp)) {
$cache->delete('template_menus');
}
if ($cache->fetch('database_tables', $tmp)) {
$cache->delete('database_tables');
}
if ($cache->fetch('database_columns', $tmp)) {
$cache->delete('database_columns');
}
if ($cache->fetch('database_checksum', $tmp)) {
$cache->delete('database_checksum');
}
if ($cache->fetch('hooks', $tmp)) {
$cache->delete('hooks');
}
if ($cache->fetch('last_kills', $tmp)) {
$cache->delete('last_kills');
}
} }
deleteDirectory(CACHE . 'signatures', ['index.html'], true); deleteDirectory(CACHE . 'signatures', ['index.html'], true);
@@ -1244,7 +1265,70 @@ function getCustomPage($page, &$success)
} }
function escapeHtml($html) { function escapeHtml($html) {
return htmlentities($html, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); return htmlspecialchars($html);
}
function getGuildNameById($id)
{
global $db;
$guild = $db->query('SELECT `name` FROM `guilds` WHERE `id` = ' . (int)$id);
if ($guild->rowCount() > 0) {
return $guild->fetchColumn();
}
return false;
}
function getGuildLogoById($id)
{
global $db;
$logo = 'default.gif';
$query = $db->query('SELECT `logo_name` FROM `guilds` WHERE `id` = ' . (int)$id);
if ($query->rowCount() == 1) {
$query = $query->fetch(PDO::FETCH_ASSOC);
$guildLogo = $query['logo_name'];
if (!empty($guildLogo) && file_exists('images/guilds/' . $guildLogo)) {
$logo = $guildLogo;
}
}
return BASE_URL . 'images/guilds/' . $logo;
}
function displayErrorBoxWithBackButton($errors, $action = null) {
global $twig;
$twig->display('error_box.html.twig', ['errors' => $errors]);
$twig->display('account.back_button.html.twig', [
'action' => $action ?: getLink('')
]);
}
function getDatabasePages($withHidden = false): array
{
global $db, $logged_access;
if (!isset($logged_access)) {
$logged_access = 1;
}
$pages = $db->query('SELECT `name` FROM ' . TABLE_PREFIX . 'pages WHERE ' . ($withHidden ? '' : '`hidden` != 1 AND ') . '`access` <= ' . $db->quote($logged_access));
$ret = [];
if ($pages->rowCount() < 1) {
return $ret;
}
foreach($pages->fetchAll() as $page) {
$ret[] = $page['name'];
}
return $ret;
} }
// validator functions // validator functions

View File

@@ -48,12 +48,21 @@ define('HOOK_ACCOUNT_CREATE_AFTER_VOCATION', ++$i);
define('HOOK_ACCOUNT_CREATE_AFTER_TOWNS', ++$i); define('HOOK_ACCOUNT_CREATE_AFTER_TOWNS', ++$i);
define('HOOK_ACCOUNT_CREATE_BEFORE_SUBMIT_BUTTON', ++$i); define('HOOK_ACCOUNT_CREATE_BEFORE_SUBMIT_BUTTON', ++$i);
define('HOOK_ACCOUNT_CREATE_AFTER_FORM', ++$i); define('HOOK_ACCOUNT_CREATE_AFTER_FORM', ++$i);
define('HOOK_ACCOUNT_CREATE_POST', ++$i);
define('HOOK_ACCOUNT_CREATE_AFTER_SUBMIT', ++$i); define('HOOK_ACCOUNT_CREATE_AFTER_SUBMIT', ++$i);
define('HOOK_ACCOUNT_CREATE_AFTER_SAVED', ++$i);
define('HOOK_ACCOUNT_MANAGE_BEFORE_GENERAL_INFORMATION', ++$i);
define('HOOK_ACCOUNT_MANAGE_BEFORE_PUBLIC_INFORMATION', ++$i);
define('HOOK_ACCOUNT_MANAGE_BEFORE_ACCOUNT_LOGS', ++$i);
define('HOOK_ACCOUNT_MANAGE_BEFORE_CHARACTERS', ++$i);
define('HOOK_EMAIL_CONFIRMED', ++$i); define('HOOK_EMAIL_CONFIRMED', ++$i);
define('HOOK_GUILDS_AFTER_INVITED_CHARACTERS', ++$i);
define('HOOK_FIRST', HOOK_STARTUP); define('HOOK_FIRST', HOOK_STARTUP);
define('HOOK_LAST', HOOK_EMAIL_CONFIRMED); define('HOOK_LAST', HOOK_EMAIL_CONFIRMED);
require_once LIBS . 'plugins.php'; require_once LIBS . 'plugins.php';
require_once LIBS . 'src/Plugins.php';
class Hook class Hook
{ {
private $_name, $_type, $_file; private $_name, $_type, $_file;

View File

@@ -28,7 +28,8 @@ if($config['gzip_output'] && isset($_SERVER['HTTP_ACCEPT_ENCODING']) && strpos($
ob_start('ob_gzhandler'); ob_start('ob_gzhandler');
// cache // cache
require_once SYSTEM . 'libs/cache.php'; require_once LIBS . 'cache.php';
require_once LIBS . 'src/Cache.php';
$cache = Cache::getInstance(); $cache = Cache::getInstance();
// trim values we receive // trim values we receive
@@ -73,8 +74,8 @@ if($config_lua_reload) {
// cache config // cache config
if($cache->enabled()) { if($cache->enabled()) {
$cache->set('config_lua', serialize($config['lua']), 120); $cache->set('config_lua', serialize($config['lua']), 2 * 60);
$cache->set('server_path', $config['server_path']); $cache->set('server_path', $config['server_path'], 10 * 60);
} }
} }
unset($tmp); unset($tmp);
@@ -116,7 +117,7 @@ if(!isset($config['highscores_ids_hidden']) || count($config['highscores_ids_hid
$config['highscores_ids_hidden'] = array(0); $config['highscores_ids_hidden'] = array(0);
} }
$config['account_create_character_create'] = config('account_create_character_create') && (!config('mail_enabled') || !config('account_mail_verify')); $config['account_mail_verify'] = config('account_mail_verify') && config('mail_enabled');
// POT // POT
require_once SYSTEM . 'libs/pot/OTS.php'; require_once SYSTEM . 'libs/pot/OTS.php';

View File

@@ -0,0 +1,36 @@
<?php
declare(strict_types=1);
namespace MyAAC\Twig\Extension;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;
final class TwigTypeCastingExtension extends AbstractExtension
{
/** @return array<int, TwigFilter> */
public function getFilters(): array
{
return [
new TwigFilter('int', function ($value) {
return (int)$value;
}),
new TwigFilter('float', function ($value) {
return (float)$value;
}),
new TwigFilter('string', function ($value) {
return (string)$value;
}),
new TwigFilter('bool', function ($value) {
return (bool)$value;
}),
new TwigFilter('array', function (object $value) {
return (array)$value;
}),
new TwigFilter('object', function (array $value) {
return (object)$value;
}),
];
}
}

View File

@@ -71,7 +71,7 @@ class Forum
'post_smile' => 0, 'post_html' => 1, 'post_smile' => 0, 'post_html' => 1,
'post_date' => time(), 'post_date' => time(),
'last_edit_aid' => 0, 'edit_date' => 0, 'last_edit_aid' => 0, 'edit_date' => 0,
'post_ip' => $_SERVER['REMOTE_ADDR'] 'post_ip' => get_browser_real_ip()
))) { ))) {
$thread_id = $db->lastInsertId(); $thread_id = $db->lastInsertId();
$db->query("UPDATE `" . FORUM_TABLE_PREFIX . "forum` SET `first_post`=".(int) $thread_id." WHERE `id` = ".(int) $thread_id); $db->query("UPDATE `" . FORUM_TABLE_PREFIX . "forum` SET `first_post`=".(int) $thread_id." WHERE `id` = ".(int) $thread_id);
@@ -93,7 +93,7 @@ class Forum
'post_smile' => $smile, 'post_smile' => $smile,
'post_html' => $html, 'post_html' => $html,
'post_date' => time(), 'post_date' => time(),
'post_ip' => $_SERVER['REMOTE_ADDR'] 'post_ip' => get_browser_real_ip()
)); ));
} }
public static function add_board($name, $description, $access, $guild, &$errors) public static function add_board($name, $description, $access, $guild, &$errors)

View File

@@ -74,6 +74,10 @@ class Plugins {
if (isset($plugin['hooks'])) { if (isset($plugin['hooks'])) {
foreach ($plugin['hooks'] as $_name => $info) { foreach ($plugin['hooks'] as $_name => $info) {
if (defined('HOOK_'. $info['type'])) { if (defined('HOOK_'. $info['type'])) {
if (strpos($info['type'], 'HOOK_') !== false) {
$info['type'] = str_replace('HOOK_', '', $info['type']);
}
$hook = constant('HOOK_'. $info['type']); $hook = constant('HOOK_'. $info['type']);
$hooks[] = ['name' => $_name, 'type' => $hook, 'file' => $info['file']]; $hooks[] = ['name' => $_name, 'type' => $hook, 'file' => $info['file']];
} else { } else {
@@ -401,4 +405,60 @@ class Plugins {
return $string; return $string;
} }
/**
* Install menus
* Helper function for plugins
*
* @param string $templateName
* @param array $menus
*/
public static function installMenus($templateName, $menus, $clearOld = false)
{
global $db;
if ($clearOld) {
$db->query('DELETE FROM `' . TABLE_PREFIX . 'menu` WHERE `template` = ' . $db->quote($templateName));
}
// check if menus already exist
$query = $db->query('SELECT `id` FROM `' . TABLE_PREFIX . 'menu` WHERE `template` = ' . $db->quote($templateName) . ' LIMIT 1;');
if ($query->rowCount() > 0) {
return;
}
foreach ($menus as $category => $_menus) {
$i = 0;
foreach ($_menus as $name => $link) {
$color = '';
$blank = 0;
if (is_array($link)) {
if (isset($link['name'])) {
$name = $link['name'];
}
if (isset($link['color'])) {
$color = $link['color'];
}
if (isset($link['blank'])) {
$blank = $link['blank'] ? 1 : 0;
}
$link = $link['link'];
}
$insert_array = [
'template' => $templateName,
'name' => $name,
'link' => $link,
'category' => $category,
'ordering' => $i++,
'blank' => $blank,
'color' => $color,
];
$db->insert(TABLE_PREFIX . 'menu', $insert_array);
}
}
}
} }

View File

@@ -167,8 +167,14 @@ abstract class OTS_Base_DB extends PDO implements IOTS_DB
$query = 'UPDATE '.$this->tableName($table).' SET '; $query = 'UPDATE '.$this->tableName($table).' SET ';
$count = count($fields); $count = count($fields);
for ($i = 0; $i < $count; $i++) for ($i = 0; $i < $count; $i++) {
$query.= $this->fieldName($fields[$i]).' = '.$this->quote($values[$i]).', '; $value = 'NULL';
if ($values[$i] !== null) {
$value = $this->quote($values[$i]);
}
$query.= $this->fieldName($fields[$i]).' = '.$value.', ';
}
$query = substr($query, 0, -2); $query = substr($query, 0, -2);
$query.=' WHERE ('; $query.=' WHERE (';
@@ -212,6 +218,30 @@ abstract class OTS_Base_DB extends PDO implements IOTS_DB
$this->exec($query); $this->exec($query);
return true; return true;
} }
public function addColumn($table, $column, $definition): void {
$this->exec('ALTER TABLE ' . $this->tableName($table) . ' ADD ' . $this->fieldName($column) . ' ' . $definition . ';');
}
public function modifyColumn($table, $column, $definition): void {
$this->exec('ALTER TABLE ' . $this->tableName($table) . ' MODIFY ' . $this->fieldName($column) . ' ' . $definition . ';');
}
public function changeColumn($table, $from, $to, $definition): void {
$this->exec('ALTER TABLE ' . $this->tableName($table) . ' CHANGE ' . $this->fieldName($from) . ' ' . $this->fieldName($to) . ' ' . $definition . ';');
}
public function dropColumn($table, $column): void {
$this->exec('ALTER TABLE ' . $this->tableName($table) . ' DROP COLUMN ' . $this->fieldName($column) . ';');
}
public function renameTable($from, $to): void {
$this->exec('RENAME TABLE ' . $this->tableName($from) . ' TO ' . $this->tableName($to) . ';');
}
public function dropTable($table, $ifExists = true): void {
$this->exec('DROP TABLE ' . ($ifExists ? 'IF EXISTS' : '') . ' ' . $this->tableName($table) . ';');
}
/** /**
* LIMIT/OFFSET clause for queries. * LIMIT/OFFSET clause for queries.
* *

View File

@@ -151,7 +151,8 @@ class OTS_DB_MySQL extends OTS_Base_DB
} }
if($this->logged) { if($this->logged) {
log_append('database.log', $_SERVER['REQUEST_URI'] . PHP_EOL . $this->getLog()); $currentScript = $_SERVER['REQUEST_URI'] ?? $_SERVER['SCRIPT_FILENAME'];
log_append('database.log', $currentScript . PHP_EOL . $this->getLog());
} }
} }

View File

@@ -60,12 +60,7 @@ class OTS_House extends OTS_Row_DAO
private $tiles = array(); private $tiles = array();
public function load($id) { public function load($id) {
$this->data = $this->db->query('SELECT * FROM `houses` WHERE `id` = ' . $id )->fetch(); $this->data = $this->db->query('SELECT * FROM `houses` WHERE `id` = ' . $id )->fetch(PDO::FETCH_ASSOC);
foreach($this->data as $key => $value) {
if(is_numeric($key)) {
unset($this->data[$key]);
}
}
} }
public function find($name) public function find($name)

View File

@@ -133,13 +133,14 @@ class OTS_Monster extends DOMDocument
{ {
$flags = array(); $flags = array();
// read all flags if ($this->documentElement->getElementsByTagName('flags')->item(0)) {
foreach( $this->documentElement->getElementsByTagName('flags')->item(0)->getElementsByTagName('flag') as $flag) foreach( $this->documentElement->getElementsByTagName('flags')->item(0)->getElementsByTagName('flag') as $flag)
{ {
$flag = $flag->attributes->item(0); $flag = $flag->attributes->item(0);
$flags[$flag->nodeName] = (int) $flag->nodeValue; $flags[$flag->nodeName] = (int) $flag->nodeValue;
} }
}
return $flags; return $flags;
} }

View File

@@ -108,6 +108,8 @@ class OTS_Player extends OTS_Row_DAO
POT::SKILL_SHIELD => array('value' => 0, 'tries' => 0), POT::SKILL_SHIELD => array('value' => 0, 'tries' => 0),
POT::SKILL_FISH => array('value' => 0, 'tries' => 0) POT::SKILL_FISH => array('value' => 0, 'tries' => 0)
); );
private static array $playersOnline;
/** /**
* Magic PHP5 method. * Magic PHP5 method.
* *
@@ -765,10 +767,18 @@ class OTS_Player extends OTS_Row_DAO
public function isOnline() public function isOnline()
{ {
if($this->db->hasTable('players_online')) // tfs 1.0 if($this->db->hasTable('players_online')) {// tfs 1.0
{ if (!isset(self::$playersOnline)) {
$query = $this->db->query('SELECT `player_id` FROM `players_online` WHERE `player_id` = ' . $this->data['id']); self::$playersOnline = [];
return $query->rowCount() > 0;
$query = $this->db->query('SELECT `player_id` FROM `players_online`');
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $item) {
self::$playersOnline[$item['player_id']] = true;
}
}
return isset(self::$playersOnline[$this->data['id']]);
} }
if( !isset($this->data['online']) ) if( !isset($this->data['online']) )
@@ -1745,11 +1755,6 @@ class OTS_Player extends OTS_Row_DAO
*/ */
public function getConditions() public function getConditions()
{ {
if( !isset($this->data['conditions']) )
{
throw new E_OTS_NotLoaded();
}
return $this->data['conditions']; return $this->data['conditions'];
} }

View File

@@ -123,7 +123,7 @@ class OTS_ServerInfo
{ {
// loads respond XML // loads respond XML
$info = new OTS_InfoRespond(); $info = new OTS_InfoRespond();
if(!$info->loadXML( utf8_encode($status->getBuffer()))) if(!$info->loadXML( $status->getBuffer()))
return false; return false;
return $info; return $info;

View File

@@ -0,0 +1,5 @@
<?php
namespace MyAAC;
class Cache extends \Cache {}

View File

@@ -0,0 +1,5 @@
<?php
namespace MyAAC;
class Plugins extends \Plugins {}

View File

@@ -33,7 +33,7 @@ class Visitors
$this->sessionTime = $sessionTime; $this->sessionTime = $sessionTime;
$this->cleanVisitors(); $this->cleanVisitors();
$ip = $_SERVER['REMOTE_ADDR']; $ip = get_browser_real_ip();
if($this->visitorExists($ip)) if($this->visitorExists($ip))
$this->updateVisitor($ip, $_SERVER['REQUEST_URI']); $this->updateVisitor($ip, $_SERVER['REQUEST_URI']);
else else

View File

@@ -42,12 +42,6 @@ if(ACTION === 'logout' && !isset($_REQUEST['account_login'])) {
$logged = false; $logged = false;
unset($account_logged); unset($account_logged);
if(isset($_REQUEST['redirect']))
{
header('Location: ' . urldecode($_REQUEST['redirect']));
exit;
}
} }
} }
} }
@@ -80,7 +74,7 @@ else
else else
$tmp = array(); $tmp = array();
$ip = $_SERVER['REMOTE_ADDR']; $ip = get_browser_real_ip();
$t = isset($tmp[$ip]) ? $tmp[$ip] : NULL; $t = isset($tmp[$ip]) ? $tmp[$ip] : NULL;
} }
@@ -94,28 +88,33 @@ else
&& (!isset($t) || $t['attempts'] < 5) && (!isset($t) || $t['attempts'] < 5)
) )
{ {
if (config('mail_enabled') && config('account_mail_verify') && (int)$account_logged->getCustomField('email_verified') !== 1) {
$errors[] = 'Your account is not verified. Please verify your email address. If the message is not coming check the SPAM folder in your E-Mail client.';
}
else {
session_regenerate_id();
setSession('account', $account_logged->getId()); setSession('account', $account_logged->getId());
setSession('password', encrypt(($config_salt_enabled ? $account_logged->getCustomField('salt') : '') . $login_password)); setSession('password', encrypt(($config_salt_enabled ? $account_logged->getCustomField('salt') : '') . $login_password));
if($remember_me) { if ($remember_me) {
setSession('remember_me', true); setSession('remember_me', true);
} }
$logged = true; $logged = true;
$logged_flags = $account_logged->getWebFlags(); $logged_flags = $account_logged->getWebFlags();
if(isset($_POST['admin']) && !admin()) { if (isset($_POST['admin']) && !admin()) {
$errors[] = 'This account has no admin privileges.'; $errors[] = 'This account has no admin privileges.';
unsetSession('account'); unsetSession('account');
unsetSession('password'); unsetSession('password');
unsetSession('remember_me'); unsetSession('remember_me');
$logged = false; $logged = false;
} } else {
else {
$account_logged->setCustomField('web_lastlogin', time()); $account_logged->setCustomField('web_lastlogin', time());
} }
$hooks->trigger(HOOK_LOGIN, array('account' => $account_logged, 'password' => $login_password, 'remember_me' => $remember_me)); $hooks->trigger(HOOK_LOGIN, array('account' => $account_logged, 'password' => $login_password, 'remember_me' => $remember_me));
} }
}
else else
{ {
$hooks->trigger(HOOK_LOGIN_ATTEMPT, array('account' => $login_account, 'password' => $login_password, 'remember_me' => $remember_me)); $hooks->trigger(HOOK_LOGIN_ATTEMPT, array('account' => $login_account, 'password' => $login_password, 'remember_me' => $remember_me));

View File

@@ -1,18 +1,3 @@
<?php <?php
if(!$db->hasColumn(TABLE_PREFIX . 'monsters', 'elements')) { // removed, but kept for compatibility
$db->exec("ALTER TABLE `" . TABLE_PREFIX . "monsters` ADD `elements` TEXT NOT NULL AFTER `immunities`;");
$db->exec("ALTER TABLE `" . TABLE_PREFIX . "monsters` ADD `pushable` TINYINT(1) NOT NULL DEFAULT '0' AFTER `convinceable`;");
$db->exec("ALTER TABLE `" . TABLE_PREFIX . "monsters` ADD `canpushitems` TINYINT(1) NOT NULL DEFAULT '0' AFTER `pushable`;");
$db->exec("ALTER TABLE `" . TABLE_PREFIX . "monsters` ADD `canpushcreatures` TINYINT(1) NOT NULL DEFAULT '0' AFTER `canpushitems`;");
$db->exec("ALTER TABLE `" . TABLE_PREFIX . "monsters` ADD `canwalkonenergy` TINYINT(1) NOT NULL DEFAULT '0' AFTER `canpushitems`;");
$db->exec("ALTER TABLE `" . TABLE_PREFIX . "monsters` ADD `canwalkonpoison` TINYINT(1) NOT NULL DEFAULT '0' AFTER `canwalkonenergy`;");
$db->exec("ALTER TABLE `" . TABLE_PREFIX . "monsters` ADD `canwalkonfire` TINYINT(1) NOT NULL DEFAULT '0' AFTER `canwalkonpoison`;");
$db->exec("ALTER TABLE `" . TABLE_PREFIX . "monsters` ADD `runonhealth` TINYINT(1) NOT NULL DEFAULT '0' AFTER `canwalkonfire`;");
$db->exec("ALTER TABLE `" . TABLE_PREFIX . "monsters` ADD `hostile` TINYINT(1) NOT NULL DEFAULT '0' AFTER `runonhealth`;");
$db->exec("ALTER TABLE `" . TABLE_PREFIX . "monsters` ADD `attackable` TINYINT(1) NOT NULL DEFAULT '0' AFTER `hostile`;");
$db->exec("ALTER TABLE `" . TABLE_PREFIX . "monsters` ADD `rewardboss` TINYINT(1) NOT NULL DEFAULT '0' AFTER `attackable`;");
$db->exec("ALTER TABLE `" . TABLE_PREFIX . "monsters` ADD `defense` INT(11) NOT NULL DEFAULT '0' AFTER `rewardboss`;");
$db->exec("ALTER TABLE `" . TABLE_PREFIX . "monsters` ADD `armor` INT(11) NOT NULL DEFAULT '0' AFTER `defense`;");
$db->exec("ALTER TABLE `" . TABLE_PREFIX . "monsters` ADD `summons` TEXT NOT NULL AFTER `loot`;");
}

View File

@@ -11,19 +11,28 @@
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
$show_form = true; $show_form = true;
$new_rlname = isset($_POST['info_rlname']) ? htmlspecialchars(stripslashes($_POST['info_rlname'])) : NULL; $new_rlname = isset($_POST['info_rlname']) ? htmlspecialchars(stripslashes($_POST['info_rlname'])) : '';
$new_location = isset($_POST['info_location']) ? htmlspecialchars(stripslashes($_POST['info_location'])) : NULL; $new_location = isset($_POST['info_location']) ? htmlspecialchars(stripslashes($_POST['info_location'])) : '';
$new_country = isset($_POST['info_country']) ? htmlspecialchars(stripslashes($_POST['info_country'])) : NULL; $new_country = isset($_POST['info_country']) ? htmlspecialchars(stripslashes($_POST['info_country'])) : '';
if(isset($_POST['changeinfosave']) && $_POST['changeinfosave'] == 1) { if(isset($_POST['changeinfosave']) && $_POST['changeinfosave'] == 1) {
if(!isset($config['countries'][$new_country])) if(config('account_country') && !isset($config['countries'][$new_country])) {
$errors[] = 'Country is not correct.'; $errors[] = 'Country is not correct.';
}
if(empty($errors)) { if(empty($errors)) {
//save data from form //save data from form
$account_logged->setCustomField("rlname", $new_rlname); $account_logged->setCustomField("rlname", $new_rlname);
$account_logged->setCustomField("location", $new_location); $account_logged->setCustomField("location", $new_location);
$account_logged->setCustomField("country", $new_country); $account_logged->setCustomField("country", $new_country);
$account_logged->logAction('Changed Real Name to <b>' . $new_rlname . '</b>, Location to <b>' . $new_location . '</b> and Country to <b>' . $config['countries'][$new_country] . '</b>.');
$log = 'Changed Real Name to <b>' . $new_rlname . '</b>, Location to <b>' . $new_location . '</b>';
if (config('account_country')) {
$log .= ' and Country to <b>' . $config['countries'][$new_country] . '</b>';
}
$log .= '.';
$account_logged->logAction($log);
$twig->display('success.html.twig', array( $twig->display('success.html.twig', array(
'title' => 'Public Information Changed', 'title' => 'Public Information Changed',
'description' => 'Your public information has been changed.' 'description' => 'Your public information has been changed.'

View File

@@ -33,6 +33,10 @@ else
if(empty($errors)) if(empty($errors))
{ {
if(!Validator::characterName($name)) {
$errors[] = Validator::getLastError();
}
if(!admin() && !Validator::newCharacterName($name)) if(!admin() && !Validator::newCharacterName($name))
$errors[] = Validator::getLastError(); $errors[] = Validator::getLastError();
} }

View File

@@ -59,7 +59,7 @@ else
$new_sex_str = $config['genders'][$new_sex]; $new_sex_str = $config['genders'][$new_sex];
$player->save(); $player->save();
$account_logged->setCustomField("premium_points", $points - $config['account_change_character_name_points']); $account_logged->setCustomField('premium_points', $points - $config['account_change_character_sex_points']);
$account_logged->logAction('Changed sex on character <b>' . $player->getName() . '</b> from <b>' . $old_sex_str . '</b> to <b>' . $new_sex_str . '</b>.'); $account_logged->logAction('Changed sex on character <b>' . $player->getName() . '</b> from <b>' . $old_sex_str . '</b> to <b>' . $new_sex_str . '</b>.');
$twig->display('success.html.twig', array( $twig->display('success.html.twig', array(
'title' => 'Character Sex Changed', 'title' => 'Character Sex Changed',

View File

@@ -29,11 +29,13 @@ else
$account = new OTS_Account(); $account = new OTS_Account();
$account->load($query['id']); $account->load($query['id']);
if ($account->isLoaded()) { if ($account->isLoaded()) {
$db->update('accounts', ['email_verified' => '1'], ['email_hash' => $hash]);
success('You have now verified your e-mail, this will increase the security of your account. Thank you for doing this. You can now <a href=' . getLink('account/manage') . '>log in</a>.');
$hooks->trigger(HOOK_EMAIL_CONFIRMED, ['account' => $account]); $hooks->trigger(HOOK_EMAIL_CONFIRMED, ['account' => $account]);
} }
} }
else {
$db->update('accounts', array('email_verified' => '1'), array('email_hash' => $hash)); error('Link has expired.');
success('You have now verified your e-mail, this will increase the security of your account. Thank you for doing this.'); }
} }
?>

View File

@@ -52,9 +52,16 @@ $errors = array();
{ {
$redirect = urldecode($_REQUEST['redirect']); $redirect = urldecode($_REQUEST['redirect']);
// should never happen, unless hacker modify the URL
if (strpos($_REQUEST['redirect'], BASE_URL) === false) {
error('Fatal error: Cannot redirect outside the website.');
return;
}
$twig->display('account.redirect.html.twig', array( $twig->display('account.redirect.html.twig', array(
'redirect' => $redirect 'redirect' => $redirect
)); ));
return; return;
} }

View File

@@ -167,37 +167,31 @@ function getBanType($typeId)
function getPlayerNameByAccount($id) function getPlayerNameByAccount($id)
{ {
global $vowels, $ots, $db; global $db;
if(is_numeric($id)) if(!is_numeric($id)) {
{ return '';
$player = new OTS_Player();
$player->load($id);
if($player->isLoaded())
return $player->getName();
else
{
$playerQuery = $db->query('SELECT `id` FROM `players` WHERE `account_id` = ' . $id . ' ORDER BY `lastlogin` DESC LIMIT 1;')->fetch();
$tmp = "*Error*";
/*
$acco = new OTS_Account();
$acco->load($id);
if(!$acco->isLoaded())
return "Unknown name";
foreach($acco->getPlayersList() as $p)
{
$player= new OTS_Player();
$player->find($p);*/
$player->load($playerQuery['id']);
//echo 'id gracza = ' . $p . '<br/>';
if($player->isLoaded())
$tmp = $player->getName();
// break;
//}
return $tmp;
} }
$playerQuery = $db->query('SELECT `name` FROM `players` WHERE `account_id` = ' . $id . ' ORDER BY `lastlogin` DESC LIMIT 1;');
if ($playerQuery->rowCount() == 0) {
return "*Error*";
}
$playerQuery = $playerQuery->fetch();
return $playerQuery['name'];
}
function getPlayerNameById($id)
{
if (!is_numeric($id)) {
return '';
}
global $db;
$playerQuery = $db->query('SELECT `name` FROM `players` WHERE `id` = ' . $id);
if ($playerQuery->rowCount()) {
$player = $playerQuery->fetch(PDO::FETCH_ASSOC);
return $player['name'];
} }
return ''; return '';

View File

@@ -54,7 +54,7 @@ $showed = $post = $reply = false;
$value = '<span style="color: blue">[NEW ANSWER]</span>'; $value = '<span style="color: blue">[NEW ANSWER]</span>';
echo '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['vdarkborder'].'><TD COLSPAN=2 CLASS=white><B>Bug Tracker</B></TD></TR>'; echo '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['vdarkborder'].'><TD COLSPAN=2 CLASS=white><B>Bug Tracker</B></TD></TR>';
echo '<TR BGCOLOR="'.$dark.'"><td width=40%><i><b>Subject</b></i></td><td>'.$tags[$bug[2]['tag']].' '.$bug[2]['subject'].' '.$value.'</td></tr>'; echo '<TR BGCOLOR="'.$dark.'"><td width=40%><i><b>Subject</b></i></td><td>'.$tags[$bug[2]['tag']].' '.escapeHtml($bug[2]['subject']).' '.$value.'</td></tr>';
echo '<TR BGCOLOR="'.$light.'"><td><i><b>Posted by</b></i></td><td>'; echo '<TR BGCOLOR="'.$light.'"><td><i><b>Posted by</b></i></td><td>';
foreach($players as $player) foreach($players as $player)
@@ -64,7 +64,7 @@ $showed = $post = $reply = false;
echo '</td></tr>'; echo '</td></tr>';
echo '<TR BGCOLOR="'.$dark.'"><td colspan=2><i><b>Description</b></i></td></tr>'; echo '<TR BGCOLOR="'.$dark.'"><td colspan=2><i><b>Description</b></i></td></tr>';
echo '<TR BGCOLOR="'.$light.'"><td colspan=2>'.nl2br($bug[2]['text']).'</td></tr>'; echo '<TR BGCOLOR="'.$light.'"><td colspan=2>'.nl2br(escapeHtml($bug[2]['text'])).'</td></tr>';
echo '</TABLE>'; echo '</TABLE>';
$answers = $db->query('SELECT * FROM '.$db->tableName(TABLE_PREFIX . 'bugtracker').' where `account` = '.$_REQUEST['acc'].' and `id` = '.$_REQUEST['id'].' and `type` = 2 order by `reply`'); $answers = $db->query('SELECT * FROM '.$db->tableName(TABLE_PREFIX . 'bugtracker').' where `account` = '.$_REQUEST['acc'].' and `id` = '.$_REQUEST['id'].' and `type` = 2 order by `reply`');
@@ -75,10 +75,10 @@ $showed = $post = $reply = false;
else else
$who = '<span style="color: green">[PLAYER]</span>'; $who = '<span style="color: green">[PLAYER]</span>';
echo '<br><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['vdarkborder'].'><TD COLSPAN=2 CLASS=white><B>Answer #'.$answer['reply'].'</B></TD></TR>'; echo '<br><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['vdarkborder'].'><TD COLSPAN=2 CLASS=white><B>Answer #'.escapeHtml($answer['reply']).'</B></TD></TR>';
echo '<TR BGCOLOR="'.$dark.'"><td width=70%><i><b>Posted by</b></i></td><td>'.$who.'</td></tr>'; echo '<TR BGCOLOR="'.$dark.'"><td width=70%><i><b>Posted by</b></i></td><td>'.$who.'</td></tr>';
echo '<TR BGCOLOR="'.$light.'"><td colspan=2><i><b>Description</b></i></td></tr>'; echo '<TR BGCOLOR="'.$light.'"><td colspan=2><i><b>Description</b></i></td></tr>';
echo '<TR BGCOLOR="'.$dark.'"><td colspan=2>'.nl2br($answer['text']).'</td></tr>'; echo '<TR BGCOLOR="'.$dark.'"><td colspan=2>'.nl2br(escapeHtml($answer['text'])).'</td></tr>';
echo '</TABLE>'; echo '</TABLE>';
} }
if($bug[2]['status'] != 3) if($bug[2]['status'] != 3)
@@ -137,7 +137,7 @@ $showed = $post = $reply = false;
elseif($report['status'] == 1) elseif($report['status'] == 1)
$value = '<span style="color: blue">[NEW ANSWER]</span>'; $value = '<span style="color: blue">[NEW ANSWER]</span>';
echo '<TR BGCOLOR="' . getStyle($i) . '"><td width=75%><a href="?subtopic=bugtracker&control=true&id='.$report['id'].'&acc='.$report['account'].'">'.$tags[$report['tag']].' '.$report['subject'].'</a></td><td>'.$value.'</td></tr>'; echo '<TR BGCOLOR="' . getStyle($i) . '"><td width=75%><a href="?subtopic=bugtracker&control=true&id='.$report['id'].'&acc='.$report['account'].'">'.$tags[$report['tag']].' '.escapeHtml($report['subject']).'</a></td><td>'.$value.'</td></tr>';
$showed=true; $showed=true;
$i++; $i++;
@@ -181,9 +181,9 @@ $showed = $post = $reply = false;
$value = '<span style="color: red">[CLOSED]</span>'; $value = '<span style="color: red">[CLOSED]</span>';
echo '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['vdarkborder'].'><TD COLSPAN=2 CLASS=white><B>Bug Tracker</B></TD></TR>'; echo '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['vdarkborder'].'><TD COLSPAN=2 CLASS=white><B>Bug Tracker</B></TD></TR>';
echo '<TR BGCOLOR="'.$dark.'"><td width=40%><i><b>Subject</b></i></td><td>'.$tags[$bug[2]['tag']].' '.$bug[2]['subject'].' '.$value.'</td></tr>'; echo '<TR BGCOLOR="'.$dark.'"><td width=40%><i><b>Subject</b></i></td><td>'.$tags[$bug[2]['tag']].' '.escapeHtml($bug[2]['subject']).' '.$value.'</td></tr>';
echo '<TR BGCOLOR="'.$light.'"><td colspan=2><i><b>Description</b></i></td></tr>'; echo '<TR BGCOLOR="'.$light.'"><td colspan=2><i><b>Description</b></i></td></tr>';
echo '<TR BGCOLOR="'.$dark.'"><td colspan=2>'.nl2br($bug[2]['text']).'</td></tr>'; echo '<TR BGCOLOR="'.$dark.'"><td colspan=2>'.nl2br(escapeHtml($bug[2]['text'])).'</td></tr>';
echo '</TABLE>'; echo '</TABLE>';
$answers = $db->query('SELECT * FROM '.$db->tableName('myaac_bugtracker').' where `account` = '.$account_logged->getId().' and `id` = '.$id.' and `type` = 2 order by `reply`'); $answers = $db->query('SELECT * FROM '.$db->tableName('myaac_bugtracker').' where `account` = '.$account_logged->getId().' and `id` = '.$id.' and `type` = 2 order by `reply`');
@@ -194,10 +194,10 @@ $showed = $post = $reply = false;
else else
$who = '<span style="color: green">[YOU]</span>'; $who = '<span style="color: green">[YOU]</span>';
echo '<br><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['vdarkborder'].'><TD COLSPAN=2 CLASS=white><B>Answer #'.$answer['reply'].'</B></TD></TR>'; echo '<br><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['vdarkborder'].'><TD COLSPAN=2 CLASS=white><B>Answer #'.escapeHtml($answer['reply']).'</B></TD></TR>';
echo '<TR BGCOLOR="'.$dark.'"><td width=70%><i><b>Posted by</b></i></td><td>'.$who.'</td></tr>'; echo '<TR BGCOLOR="'.$dark.'"><td width=70%><i><b>Posted by</b></i></td><td>'.$who.'</td></tr>';
echo '<TR BGCOLOR="'.$light.'"><td colspan=2><i><b>Description</b></i></td></tr>'; echo '<TR BGCOLOR="'.$light.'"><td colspan=2><i><b>Description</b></i></td></tr>';
echo '<TR BGCOLOR="'.$dark.'"><td colspan=2>'.nl2br($answer['text']).'</td></tr>'; echo '<TR BGCOLOR="'.$dark.'"><td colspan=2>'.nl2br(escapeHtml($answer['text'])).'</td></tr>';
echo '</TABLE>'; echo '</TABLE>';
} }
if($bug[2]['status'] != 3) if($bug[2]['status'] != 3)
@@ -274,7 +274,7 @@ $showed = $post = $reply = false;
$bgcolor = $light; $bgcolor = $light;
} }
echo '<TR BGCOLOR="'.$bgcolor.'"><td width=75%><a href="?subtopic=bugtracker&id='.$report['id'].'">'.$tags[$report['tag']].' '.$report['subject'].'</a></td><td>'.$value.'</td></tr>'; echo '<TR BGCOLOR="'.$bgcolor.'"><td width=75%><a href="?subtopic=bugtracker&id='.$report['id'].'">'.$tags[$report['tag']].' '.escapeHtml($report['subject']).'</a></td><td>'.$value.'</td></tr>';
$showed=true; $showed=true;
} }

View File

@@ -400,7 +400,7 @@ WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, kil
'rank' => isset($guild_name) ? $rank_of_player->getName() : null, 'rank' => isset($guild_name) ? $rank_of_player->getName() : null,
'link' => isset($guild_name) ? getGuildLink($guild_name) : null 'link' => isset($guild_name) ? getGuildLink($guild_name) : null
), ),
'comment' => !empty($comment) ? wordwrap(nl2br($comment), 60, "<br/>", true) : null, 'comment' => !empty($comment) ? nl2br($comment) : null,
'skills' => isset($skills) ? $skills : null, 'skills' => isset($skills) ? $skills : null,
'quests_enabled' => $quests_enabled, 'quests_enabled' => $quests_enabled,
'quests' => isset($quests) ? $quests : null, 'quests' => isset($quests) ? $quests : null,

View File

@@ -137,7 +137,13 @@ if($save)
$params['account_id'] = $_POST['account']; $params['account_id'] = $_POST['account'];
} }
/**
* two hooks for compatibility
*/
$hooks->trigger(HOOK_ACCOUNT_CREATE_AFTER_SUBMIT, $params); $hooks->trigger(HOOK_ACCOUNT_CREATE_AFTER_SUBMIT, $params);
if (!$hooks->trigger(HOOK_ACCOUNT_CREATE_POST, $params)) {
return;
}
if(config('account_create_character_create')) { if(config('account_create_character_create')) {
$character_name = isset($_POST['name']) ? stripslashes(ucwords(strtolower($_POST['name']))) : null; $character_name = isset($_POST['name']) ? stripslashes(ucwords(strtolower($_POST['name']))) : null;
@@ -167,6 +173,8 @@ if($save)
$new_account->setEMail($email); $new_account->setEMail($email);
$new_account->save(); $new_account->save();
$hooks->trigger(HOOK_ACCOUNT_CREATE_AFTER_SAVED, ['account' => $new_account]);
if($config_salt_enabled) if($config_salt_enabled)
$new_account->setCustomField('salt', $salt); $new_account->setCustomField('salt', $salt);
@@ -211,6 +219,9 @@ if($save)
if(_mail($email, 'New account on ' . $config['lua']['serverName'], $body_html)) if(_mail($email, 'New account on ' . $config['lua']['serverName'], $body_html))
{ {
echo 'Your account has been created.<br/><br/>'; echo 'Your account has been created.<br/><br/>';
warning("Before you can login - you need to verify your E-Mail. The verification link has been sent to $email. If the message is not coming - remember to check the SPAM folder.");
$twig->display('success.html.twig', array( $twig->display('success.html.twig', array(
'title' => 'Account Created', 'title' => 'Account Created',
'description' => 'Your account ' . $account_type . ' is <b>' . $tmp_account . '</b><br/>You will need the account ' . $account_type . ' and your password to play on ' . configLua('serverName') . '. 'description' => 'Your account ' . $account_type . ' is <b>' . $tmp_account . '</b><br/>You will need the account ' . $account_type . ' and your password to play on ' . configLua('serverName') . '.
@@ -227,15 +238,6 @@ if($save)
} }
else else
{ {
if(config('account_create_character_create')) {
// character creation
$character_created = $createCharacter->doCreate($character_name, $character_sex, $character_vocation, $character_town, $new_account, $errors);
if (!$character_created) {
error('There was an error creating your character. Please create your character later in account management page.');
error(implode(' ', $errors));
}
}
if($config['account_create_auto_login']) { if($config['account_create_auto_login']) {
$_POST['account_login'] = USE_ACCOUNT_NAME ? $account_name : $account_id; $_POST['account_login'] = USE_ACCOUNT_NAME ? $account_name : $account_id;
$_POST['password_login'] = $password2; $_POST['password_login'] = $password2;
@@ -280,6 +282,15 @@ if($save)
} }
} }
if(config('account_create_character_create')) {
// character creation
$character_created = $createCharacter->doCreate($character_name, $character_sex, $character_vocation, $character_town, $new_account, $errors);
if (!$character_created) {
error('There was an error creating your character. Please create your character later in account management page.');
error(implode(' ', $errors));
}
}
return; return;
} }
} }
@@ -291,7 +302,9 @@ if($config['account_country_recognize']) {
$country_recognized = $country_session; $country_recognized = $country_session;
} }
else { else {
$info = json_decode(@file_get_contents('http://ipinfo.io/' . $_SERVER['REMOTE_ADDR'] . '/geo'), true); ini_set('default_socket_timeout', 5);
$info = json_decode(@file_get_contents('https://ipinfo.io/' . get_browser_real_ip() . '/geo'), true);
if(isset($info['country'])) { if(isset($info['country'])) {
$country_recognized = strtolower($info['country']); $country_recognized = strtolower($info['country']);
setSession('country', $country_recognized); setSession('country', $country_recognized);

View File

@@ -157,7 +157,7 @@ if (empty($_REQUEST['creature'])) {
echo '</td></tr>'; echo '</td></tr>';
echo '</TABLE>'; echo '</TABLE>';
} else { } else {
echo "Monster with name <b>" . $monster_name . "</b> doesn't exist."; echo "Monster with name <b>" . htmlspecialchars($monster_name) . "</b> doesn't exist.";
} }
//back button //back button

View File

@@ -191,12 +191,13 @@ if(!$logged)
} }
if(!ctype_alnum(str_replace(array('-', '_'), '', $action))) { if(!ctype_alnum(str_replace(array('-', '_'), '', $action))) {
error('Error: Action contains illegal characters.'); $errors[] = 'Error: Action contains illegal characters.';
displayErrorBoxWithBackButton($errors, getLink('forum'));
} }
else if(file_exists(PAGES . 'forum/' . $action . '.php')) { else if(file_exists(PAGES . 'forum/' . $action . '.php')) {
require PAGES . 'forum/' . $action . '.php'; require PAGES . 'forum/' . $action . '.php';
} }
else { else {
error('This page does not exists.'); $errors[] = 'This page does not exists.';
displayErrorBoxWithBackButton($errors, getLink('forum'));
} }
?>

View File

@@ -14,7 +14,8 @@ if(Forum::canPost($account_logged))
{ {
$post_id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : false; $post_id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : false;
if(!$post_id) { if(!$post_id) {
echo 'Please enter post id.'; $errors[] = 'Please enter post id.';
displayErrorBoxWithBackButton($errors, getLink('forum'));
return; return;
} }
@@ -22,7 +23,7 @@ if(Forum::canPost($account_logged))
if(isset($thread['id'])) if(isset($thread['id']))
{ {
$first_post = $db->query("SELECT `" . FORUM_TABLE_PREFIX . "forum`.`author_guid`, `" . FORUM_TABLE_PREFIX . "forum`.`author_aid`, `" . FORUM_TABLE_PREFIX . "forum`.`first_post`, `" . FORUM_TABLE_PREFIX . "forum`.`post_topic`, `" . FORUM_TABLE_PREFIX . "forum`.`post_text`, `" . FORUM_TABLE_PREFIX . "forum`.`post_smile`, `" . FORUM_TABLE_PREFIX . "forum`.`id`, `" . FORUM_TABLE_PREFIX . "forum`.`section` FROM `" . FORUM_TABLE_PREFIX . "forum` WHERE `" . FORUM_TABLE_PREFIX . "forum`.`id` = ".(int) $thread['first_post']." LIMIT 1")->fetch(); $first_post = $db->query("SELECT `" . FORUM_TABLE_PREFIX . "forum`.`author_guid`, `" . FORUM_TABLE_PREFIX . "forum`.`author_aid`, `" . FORUM_TABLE_PREFIX . "forum`.`first_post`, `" . FORUM_TABLE_PREFIX . "forum`.`post_topic`, `" . FORUM_TABLE_PREFIX . "forum`.`post_text`, `" . FORUM_TABLE_PREFIX . "forum`.`post_smile`, `" . FORUM_TABLE_PREFIX . "forum`.`id`, `" . FORUM_TABLE_PREFIX . "forum`.`section` FROM `" . FORUM_TABLE_PREFIX . "forum` WHERE `" . FORUM_TABLE_PREFIX . "forum`.`id` = ".(int) $thread['first_post']." LIMIT 1")->fetch();
echo '<a href="' . getLink('forum') . '">Boards</a> >> <a href="' . getForumBoardLink($thread['section']) . '">'.$sections[$thread['section']]['name'].'</a> >> <a href="' . getForumThreadLink($thread['first_post']) . '">'.$first_post['post_topic'].'</a> >> <b>Edit post</b>'; echo '<a href="' . getLink('forum') . '">Boards</a> >> <a href="' . getForumBoardLink($thread['section']) . '">'.$sections[$thread['section']]['name'].'</a> >> <a href="' . getForumThreadLink($thread['first_post']) . '">'.htmlspecialchars($first_post['post_topic']).'</a> >> <b>Edit post</b>';
if(Forum::hasAccess($thread['section'] && ($account_logged->getId() == $thread['author_aid'] || Forum::isModerator()))) if(Forum::hasAccess($thread['section'] && ($account_logged->getId() == $thread['author_aid'] || Forum::isModerator())))
{ {
$char_id = $post_topic = $text = $smile = $html = null; $char_id = $post_topic = $text = $smile = $html = null;
@@ -35,24 +36,22 @@ if(Forum::canPost($account_logged))
$post_topic = stripslashes(trim($_REQUEST['topic'])); $post_topic = stripslashes(trim($_REQUEST['topic']));
$smile = isset($_REQUEST['smile']) ? (int)$_REQUEST['smile'] : 0; $smile = isset($_REQUEST['smile']) ? (int)$_REQUEST['smile'] : 0;
$html = isset($_REQUEST['html']) ? (int)$_REQUEST['html'] : 0; $html = isset($_REQUEST['html']) ? (int)$_REQUEST['html'] : 0;
$lenght = 0;
for($i = 0; $i < strlen($post_topic); $i++) if (!superAdmin()) {
{ $html = 0;
if(ord($post_topic[$i]) >= 33 && ord($post_topic[$i]) <= 126)
$lenght++;
} }
if(($lenght < 1 || strlen($post_topic) > 60) && $thread['id'] == $thread['first_post'])
$errors[] = 'Too short or too long topic (short: '.$lenght.' long: '.strlen($post_topic).' letters). Minimum 1 letter, maximum 60 letters.'; $length = strlen($post_topic);
$lenght = 0; if(($length < 1 || $length > 60) && $thread['id'] == $thread['first_post'])
for($i = 0; $i < strlen($text); $i++) $errors[] = "Too short or too long topic (Length: $length letters). Minimum 1 letter, maximum 60 letters.";
{
if(ord($text[$i]) >= 33 && ord($text[$i]) <= 126) $length = strlen($text);
$lenght++; if($length < 1 || $length > 15000)
} $errors[] = "Too short or too long post (Length: $length letters). Minimum 1 letter, maximum 15000 letters.";
if($lenght < 1 || strlen($text) > 15000)
$errors[] = 'Too short or too long post (short: '.$lenght.' long: '.strlen($text).' letters). Minimum 1 letter, maximum 15000 letters.';
if($char_id == 0) if($char_id == 0)
$errors[] = 'Please select a character.'; $errors[] = 'Please select a character.';
if(empty($post_topic) && $thread['id'] == $thread['first_post']) if(empty($post_topic) && $thread['id'] == $thread['first_post'])
$errors[] = 'Thread topic can\'t be empty.'; $errors[] = 'Thread topic can\'t be empty.';
@@ -104,11 +103,17 @@ if(Forum::canPost($account_logged))
)); ));
} }
} }
else else {
echo '<br/>You are not an author of this post.'; $errors[] = 'You are not an author of this post.';
displayErrorBoxWithBackButton($errors, getLink('forum'));
}
}
else {
$errors[] = "Post with ID $post_id doesn't exist.";
displayErrorBoxWithBackButton($errors, getLink('forum'));
} }
else
echo "<br/>Post with ID " . $post_id . " doesn't exist.";
} }
else else {
echo "<br/>Your account is banned, deleted or you don't have any player with level " . $config['forum_level_required'] . " on your account. You can't post."; $errors[] = "Your account is banned, deleted or you don't have any player with level " . $config['forum_level_required'] . " on your account. You can't post.";
displayErrorBoxWithBackButton($errors, getLink('forum'));
}

View File

@@ -12,14 +12,16 @@ defined('MYAAC') or die('Direct access not allowed!');
if(!Forum::isModerator()) { if(!Forum::isModerator()) {
echo 'You are not logged in or you are not moderator.'; echo 'You are not logged in or you are not moderator.';
return;
} }
$save = isset($_REQUEST['save']) ? (int)$_REQUEST['save'] == 1 : false; $save = isset($_REQUEST['save']) && (int)$_REQUEST['save'] == 1;
if($save) { if($save) {
$post_id = (int)$_REQUEST['id']; $post_id = (int)$_REQUEST['id'];
$board = (int)$_REQUEST['section']; $board = (int)$_REQUEST['section'];
if(!Forum::hasAccess($board)) { if(!Forum::hasAccess($board)) {
echo "You don't have access to this board."; $errors[] = "You don't have access to this board.";
displayErrorBoxWithBackButton($errors, getLink('forum'));
return; return;
} }
@@ -31,8 +33,10 @@ if($save) {
header('Location: ' . getForumBoardLink($nPost['section'])); header('Location: ' . getForumBoardLink($nPost['section']));
} }
} }
else else {
echo 'Post with ID ' . $post_id . ' does not exist.'; $errors[] = 'Post with ID ' . $post_id . ' does not exist.';
displayErrorBoxWithBackButton($errors, getLink('forum'));
}
} }
else { else {
$post_id = (int)$_REQUEST['id']; $post_id = (int)$_REQUEST['id'];
@@ -58,7 +62,8 @@ else {
)); ));
} }
} }
else else {
echo 'Post with ID ' . $post_id . ' does not exist.'; $errors[] = 'Post with ID ' . $post_id . ' does not exist.';
displayErrorBoxWithBackButton($errors, getLink('forum'));
}
} }
?>

View File

@@ -15,21 +15,29 @@ if(Forum::canPost($account_logged))
$players_from_account = $db->query("SELECT `players`.`name`, `players`.`id` FROM `players` WHERE `players`.`account_id` = ".(int) $account_logged->getId())->fetchAll(); $players_from_account = $db->query("SELECT `players`.`name`, `players`.`id` FROM `players` WHERE `players`.`account_id` = ".(int) $account_logged->getId())->fetchAll();
$thread_id = isset($_REQUEST['thread_id']) ? (int) $_REQUEST['thread_id'] : 0; $thread_id = isset($_REQUEST['thread_id']) ? (int) $_REQUEST['thread_id'] : 0;
if($thread_id == 0) { if($thread_id == 0) {
echo "Thread with this id doesn't exist."; $errors[] = "Thread with this id doesn't exist.";
displayErrorBoxWithBackButton($errors, getLink('forum'));
return; return;
} }
$thread = $db->query("SELECT `" . FORUM_TABLE_PREFIX . "forum`.`post_topic`, `" . FORUM_TABLE_PREFIX . "forum`.`id`, `" . FORUM_TABLE_PREFIX . "forum`.`section` FROM `" . FORUM_TABLE_PREFIX . "forum` WHERE `" . FORUM_TABLE_PREFIX . "forum`.`id` = ".(int) $thread_id." AND `" . FORUM_TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread_id." LIMIT 1")->fetch(); $thread = $db->query("SELECT `" . FORUM_TABLE_PREFIX . "forum`.`post_topic`, `" . FORUM_TABLE_PREFIX . "forum`.`id`, `" . FORUM_TABLE_PREFIX . "forum`.`section` FROM `" . FORUM_TABLE_PREFIX . "forum` WHERE `" . FORUM_TABLE_PREFIX . "forum`.`id` = ".(int) $thread_id." AND `" . FORUM_TABLE_PREFIX . "forum`.`first_post` = ".$thread_id." LIMIT 1")->fetch();
echo '<a href="' . getLink('forum') . '">Boards</a> >> <a href="' . getForumBoardLink($thread['section']) . '">'.$sections[$thread['section']]['name'].'</a> >> <a href="' . getForumThreadLink($thread_id) . '">'.$thread['post_topic'].'</a> >> <b>Post new reply</b><br /><h3>'.$thread['post_topic'].'</h3>';
if(isset($thread['id']) && Forum::hasAccess($thread['section'])) if(isset($thread['id']) && Forum::hasAccess($thread['section']))
{ {
echo '<a href="' . getLink('forum') . '">Boards</a> >> <a href="' . getForumBoardLink($thread['section']) . '">'.$sections[$thread['section']]['name'].'</a> >> <a href="' . getForumThreadLink($thread_id) . '">'.htmlspecialchars($thread['post_topic']).'</a> >> <b>Post new reply</b><br /><h3>'.htmlspecialchars($thread['post_topic']).'</h3>';
$quote = isset($_REQUEST['quote']) ? (int) $_REQUEST['quote'] : NULL; $quote = isset($_REQUEST['quote']) ? (int) $_REQUEST['quote'] : NULL;
$text = isset($_REQUEST['text']) ? stripslashes(trim($_REQUEST['text'])) : NULL; $text = isset($_REQUEST['text']) ? stripslashes(trim($_REQUEST['text'])) : NULL;
$char_id = (int) (isset($_REQUEST['char_id']) ? $_REQUEST['char_id'] : 0); $char_id = (int) ($_REQUEST['char_id'] ?? 0);
$post_topic = isset($_REQUEST['topic']) ? stripslashes(trim($_REQUEST['topic'])) : ''; $post_topic = isset($_REQUEST['topic']) ? stripslashes(trim($_REQUEST['topic'])) : '';
$smile = (isset($_REQUEST['smile']) ? (int)$_REQUEST['smile'] : 0); $smile = (isset($_REQUEST['smile']) ? (int)$_REQUEST['smile'] : 0);
$html = (isset($_REQUEST['html']) ? (int)$_REQUEST['html'] : 0); $html = (isset($_REQUEST['html']) ? (int)$_REQUEST['html'] : 0);
$saved = false; $saved = false;
if (!superAdmin()) {
$html = 0;
}
if(isset($_REQUEST['quote'])) if(isset($_REQUEST['quote']))
{ {
$quoted_post = $db->query("SELECT `players`.`name`, `" . FORUM_TABLE_PREFIX . "forum`.`post_text`, `" . FORUM_TABLE_PREFIX . "forum`.`post_date` FROM `players`, `" . FORUM_TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . FORUM_TABLE_PREFIX . "forum`.`author_guid` AND `" . FORUM_TABLE_PREFIX . "forum`.`id` = ".(int) $quote)->fetchAll(); $quoted_post = $db->query("SELECT `players`.`name`, `" . FORUM_TABLE_PREFIX . "forum`.`post_text`, `" . FORUM_TABLE_PREFIX . "forum`.`post_date` FROM `players`, `" . FORUM_TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . FORUM_TABLE_PREFIX . "forum`.`author_guid` AND `" . FORUM_TABLE_PREFIX . "forum`.`id` = ".(int) $quote)->fetchAll();
@@ -38,14 +46,10 @@ if(Forum::canPost($account_logged))
} }
elseif(isset($_REQUEST['save'])) elseif(isset($_REQUEST['save']))
{ {
$lenght = 0; $length = strlen($text);
for($i = 0; $i < strlen($text); $i++) if($length < 1 || strlen($text) > 15000)
{ $errors[] = 'Too short or too long post (Length: $length letters). Minimum 1 letter, maximum 15000 letters.';
if(ord($text[$i]) >= 33 && ord($text[$i]) <= 126)
$lenght++;
}
if($lenght < 1 || strlen($text) > 15000)
$errors[] = 'Too short or too long post (short: '.$lenght.' long: '.strlen($text).' letters). Minimum 1 letter, maximum 15000 letters.';
if($char_id == 0) if($char_id == 0)
$errors[] = 'Please select a character.'; $errors[] = 'Please select a character.';
@@ -73,8 +77,8 @@ if(Forum::canPost($account_logged))
if(count($errors) == 0) if(count($errors) == 0)
{ {
$saved = true; $saved = true;
Forum::add_post($thread['id'], $thread['section'], $account_logged->getId(), (int) $char_id, $text, $post_topic, $smile, $html, time(), $_SERVER['REMOTE_ADDR']); Forum::add_post($thread['id'], $thread['section'], $account_logged->getId(), (int) $char_id, $text, $post_topic, $smile, $html);
$db->query("UPDATE `" . FORUM_TABLE_PREFIX . "forum` SET `replies`=`replies`+1, `last_post`=".time()." WHERE `id` = ".(int) $thread_id); $db->query("UPDATE `" . FORUM_TABLE_PREFIX . "forum` SET `replies`=`replies`+1, `last_post`=".time()." WHERE `id` = ".$thread_id);
$post_page = $db->query("SELECT COUNT(`" . FORUM_TABLE_PREFIX . "forum`.`id`) AS posts_count FROM `players`, `" . FORUM_TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . FORUM_TABLE_PREFIX . "forum`.`author_guid` AND `" . FORUM_TABLE_PREFIX . "forum`.`post_date` <= ".time()." AND `" . FORUM_TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread['id'])->fetch(); $post_page = $db->query("SELECT COUNT(`" . FORUM_TABLE_PREFIX . "forum`.`id`) AS posts_count FROM `players`, `" . FORUM_TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . FORUM_TABLE_PREFIX . "forum`.`author_guid` AND `" . FORUM_TABLE_PREFIX . "forum`.`post_date` <= ".time()." AND `" . FORUM_TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread['id'])->fetch();
$_page = (int) ceil($post_page['posts_count'] / $config['forum_threads_per_page']) - 1; $_page = (int) ceil($post_page['posts_count'] / $config['forum_threads_per_page']) - 1;
header('Location: ' . getForumThreadLink($thread_id, $_page)); header('Location: ' . getForumThreadLink($thread_id, $_page));
@@ -110,10 +114,14 @@ if(Forum::canPost($account_logged))
)); ));
} }
} }
else else {
echo "Thread with ID " . $thread_id . " doesn't exist."; $errors[] = "Thread with ID " . $thread_id . " doesn't exist.";
displayErrorBoxWithBackButton($errors, getLink('forum'));
}
}
else {
$errors[] = "Your account is banned, deleted or you don't have any player with level " . $config['forum_level_required'] . " on your account. You can't post.";
displayErrorBoxWithBackButton($errors, getLink('forum'));
} }
else
echo "Your account is banned, deleted or you don't have any player with level " . $config['forum_level_required'] . " on your account. You can't post.";
$twig->display('forum.fullscreen.html.twig'); $twig->display('forum.fullscreen.html.twig');

View File

@@ -13,7 +13,7 @@ defined('MYAAC') or die('Direct access not allowed!');
if(Forum::canPost($account_logged)) if(Forum::canPost($account_logged))
{ {
$players_from_account = $db->query('SELECT `players`.`name`, `players`.`id` FROM `players` WHERE `players`.`account_id` = '.(int) $account_logged->getId())->fetchAll(); $players_from_account = $db->query('SELECT `players`.`name`, `players`.`id` FROM `players` WHERE `players`.`account_id` = '.(int) $account_logged->getId())->fetchAll();
$section_id = isset($_REQUEST['section_id']) ? $_REQUEST['section_id'] : null; $section_id = $_REQUEST['section_id'] ?? null;
if($section_id !== null) { if($section_id !== null) {
echo '<a href="' . getLink('forum') . '">Boards</a> >> <a href="' . getForumBoardLink($section_id) . '">' . $sections[$section_id]['name'] . '</a> >> <b>Post new thread</b><br />'; echo '<a href="' . getLink('forum') . '">Boards</a> >> <a href="' . getForumBoardLink($section_id) . '">' . $sections[$section_id]['name'] . '</a> >> <b>Post new thread</b><br />';
if(isset($sections[$section_id]['name']) && Forum::hasAccess($section_id)) { if(isset($sections[$section_id]['name']) && Forum::hasAccess($section_id)) {
@@ -26,24 +26,20 @@ if(Forum::canPost($account_logged))
$post_topic = isset($_REQUEST['topic']) ? stripslashes($_REQUEST['topic']) : ''; $post_topic = isset($_REQUEST['topic']) ? stripslashes($_REQUEST['topic']) : '';
$smile = (isset($_REQUEST['smile']) ? (int)$_REQUEST['smile'] : 0); $smile = (isset($_REQUEST['smile']) ? (int)$_REQUEST['smile'] : 0);
$html = (isset($_REQUEST['html']) ? (int)$_REQUEST['html'] : 0); $html = (isset($_REQUEST['html']) ? (int)$_REQUEST['html'] : 0);
if (!superAdmin()) {
$html = 0;
}
$saved = false; $saved = false;
if (isset($_REQUEST['save'])) { if (isset($_REQUEST['save'])) {
$errors = array(); $length = strlen($post_topic);
if ($length < 1 || $length > 60)
$errors[] = "Too short or too long topic (Length: $length letters). Minimum 1 letter, maximum 60 letters.";
$lenght = 0; $length = strlen($text);
for ($i = 0; $i < strlen($post_topic); $i++) { if ($length < 1 || $length > 15000)
if (ord($post_topic[$i]) >= 33 && ord($post_topic[$i]) <= 126) $errors[] = "Too short or too long post (Length: $length letters). Minimum 1 letter, maximum 15000 letters.";
$lenght++;
}
if ($lenght < 1 || strlen($post_topic) > 60)
$errors[] = 'Too short or too long topic (short: ' . $lenght . ' long: ' . strlen($post_topic) . ' letters). Minimum 1 letter, maximum 60 letters.';
$lenght = 0;
for ($i = 0; $i < strlen($text); $i++) {
if (ord($text[$i]) >= 33 && ord($text[$i]) <= 126)
$lenght++;
}
if ($lenght < 1 || strlen($text) > 15000)
$errors[] = 'Too short or too long post (short: ' . $lenght . ' long: ' . strlen($text) . ' letters). Minimum 1 letter, maximum 15000 letters.';
if ($char_id == 0) if ($char_id == 0)
$errors[] = 'Please select a character.'; $errors[] = 'Please select a character.';
@@ -69,7 +65,7 @@ if(Forum::canPost($account_logged))
} }
if (count($errors) == 0) { if (count($errors) == 0) {
$saved = true; $saved = true;
$db->query("INSERT INTO `" . FORUM_TABLE_PREFIX . "forum` (`first_post` ,`last_post` ,`section` ,`replies` ,`views` ,`author_aid` ,`author_guid` ,`post_text` ,`post_topic` ,`post_smile`, `post_html` ,`post_date` ,`last_edit_aid` ,`edit_date`, `post_ip`) VALUES ('0', '" . time() . "', '" . (int)$section_id . "', '0', '0', '" . $account_logged->getId() . "', '" . (int)$char_id . "', " . $db->quote($text) . ", " . $db->quote($post_topic) . ", '" . (int)$smile . "', '" . (int)$html . "', '" . time() . "', '0', '0', '" . $_SERVER['REMOTE_ADDR'] . "')"); $db->query("INSERT INTO `" . FORUM_TABLE_PREFIX . "forum` (`first_post` ,`last_post` ,`section` ,`replies` ,`views` ,`author_aid` ,`author_guid` ,`post_text` ,`post_topic` ,`post_smile`, `post_html` ,`post_date` ,`last_edit_aid` ,`edit_date`, `post_ip`) VALUES ('0', '" . time() . "', '" . (int)$section_id . "', '0', '0', '" . $account_logged->getId() . "', '" . (int)$char_id . "', " . $db->quote($text) . ", " . $db->quote($post_topic) . ", '" . (int)$smile . "', '" . (int)$html . "', '" . time() . "', '0', '0', '" . get_browser_real_ip() . "')");
$thread_id = $db->lastInsertId(); $thread_id = $db->lastInsertId();
$db->query("UPDATE `" . FORUM_TABLE_PREFIX . "forum` SET `first_post`=" . (int)$thread_id . " WHERE `id` = " . (int)$thread_id); $db->query("UPDATE `" . FORUM_TABLE_PREFIX . "forum` SET `first_post`=" . (int)$thread_id . " WHERE `id` = " . (int)$thread_id);
header('Location: ' . getForumThreadLink($thread_id)); header('Location: ' . getForumThreadLink($thread_id));
@@ -93,11 +89,17 @@ if(Forum::canPost($account_logged))
)); ));
} }
} }
else else {
echo 'Board with ID ' . $board_id . ' doesn\'t exist.'; $errors[] = "Board with ID $section_id doesn't exist.";
displayErrorBoxWithBackButton($errors, getLink('forum'));
}
}
else {
$errors[] = 'Please enter section_id.';
displayErrorBoxWithBackButton($errors, getLink('forum'));
} }
else
echo 'Please enter section_id.';
} }
else else {
echo 'Your account is banned, deleted or you don\'t have any player with level '.$config['forum_level_required'].' on your account. You can\'t post.'; $errors[] = 'Your account is banned, deleted or you don\'t have any player with level '.$config['forum_level_required'].' on your account. You can\'t post.';
displayErrorBoxWithBackButton($errors, getLink('forum'));
}

View File

@@ -29,8 +29,12 @@ if(Forum::isModerator())
header('Location: ' . getForumThreadLink($post['first_post'], (int) $_page)); header('Location: ' . getForumThreadLink($post['first_post'], (int) $_page));
} }
} }
else else {
echo 'Post with ID ' . $id . ' does not exist.'; $errors[] = 'Post with ID ' . $id . ' does not exist.';
displayErrorBoxWithBackButton($errors, getLink('forum'));
}
}
else {
$errors[] = 'You are not logged in or you are not moderator.';
displayErrorBoxWithBackButton($errors, getLink('forum'));
} }
else
echo 'You are not logged in or you are not moderator.';

View File

@@ -14,12 +14,14 @@ $links_to_pages = '';
$section_id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : null; $section_id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : null;
if($section_id == null || !isset($sections[$section_id])) { if($section_id == null || !isset($sections[$section_id])) {
echo "Board with this id does't exist."; $errors[] = "Board with this id does't exist.";
displayErrorBoxWithBackButton($errors, getLink('forum'));
return; return;
} }
if(!Forum::hasAccess($section_id)) { if(!Forum::hasAccess($section_id)) {
echo "You don't have access to this board."; $errors[] = "You don't have access to this board.";
displayErrorBoxWithBackButton($errors, getLink('forum'));
return; return;
} }
@@ -33,7 +35,7 @@ for($i = 0; $i < $threads_count['threads_count'] / $config['forum_threads_per_pa
$links_to_pages .= '<b>'.($i + 1).' </b>'; $links_to_pages .= '<b>'.($i + 1).' </b>';
} }
echo '<a href="' . getLink('forum') . '">Boards</a> >> <b>'.$sections[$section_id]['name'].'</b>'; echo '<a href="' . getLink('forum') . '">Boards</a> >> <b>'.$sections[$section_id]['name'].'</b>';
if(!$sections[$section_id]['closed'] || Forum::isModerator()) if($logged && (!$sections[$section_id]['closed'] || Forum::isModerator()))
{ {
echo '<br /><br /> echo '<br /><br />
<a href="?subtopic=forum&action=new_thread&section_id='.$section_id.'"><img src="images/forum/topic.gif" border="0" /></a>'; <a href="?subtopic=forum&action=new_thread&section_id='.$section_id.'"><img src="images/forum/topic.gif" border="0" /></a>';
@@ -60,7 +62,7 @@ if(isset($last_threads[0]))
if(Forum::isModerator()) if(Forum::isModerator())
{ {
echo '<a href="?subtopic=forum&action=move_thread&id='.$thread['id'].'"\')"><span style="color:darkgreen">[MOVE]</span></a>'; echo '<a href="?subtopic=forum&action=move_thread&id='.$thread['id'].'"\')"><span style="color:darkgreen">[MOVE]</span></a>';
echo '<a href="?subtopic=forum&action=remove_post&id='.$thread['id'].'" onclick="return confirm(\'Are you sure you want remove thread > '.$thread['post_topic'].' <?\')"><span style="color: red">[REMOVE]</span></a> '; echo '<a href="?subtopic=forum&action=remove_post&id='.$thread['id'].'" onclick="return confirm(\'Are you sure you want remove thread > '.htmlspecialchars($thread['post_topic']).' <?\')"><span style="color: red">[REMOVE]</span></a> ';
} }
$player->load($thread['player_id']); $player->load($thread['player_id']);
@@ -71,7 +73,7 @@ if(isset($last_threads[0]))
$player_account = $player->getAccount(); $player_account = $player->getAccount();
$canEditForum = $player_account->hasFlag(FLAG_CONTENT_FORUM) || $player_account->isAdmin(); $canEditForum = $player_account->hasFlag(FLAG_CONTENT_FORUM) || $player_account->isAdmin();
echo '<a href="' . getForumThreadLink($thread['id']) . '">'.($canEditForum ? $thread['post_topic'] : htmlspecialchars($thread['post_topic'])) . '</a><br /><small>'.($canEditForum ? substr(strip_tags($thread['post_text']), 0, 50) : htmlspecialchars(substr($thread['post_text'], 0, 50))).'...</small></td><td>' . getPlayerLink($thread['name']) . '</td><td>'.(int) $thread['replies'].'</td><td>'.(int) $thread['views'].'</td><td>'; echo '<a href="' . getForumThreadLink($thread['id']) . '">'.htmlspecialchars($thread['post_topic']) . '</a><br /><small>'.($canEditForum ? substr(strip_tags($thread['post_text']), 0, 50) : htmlspecialchars(substr($thread['post_text'], 0, 50))).'...</small></td><td>' . getPlayerLink($thread['name']) . '</td><td>'.(int) $thread['replies'].'</td><td>'.(int) $thread['views'].'</td><td>';
if($thread['last_post'] > 0) if($thread['last_post'] > 0)
{ {
$last_post = $db->query("SELECT `players`.`name`, `" . FORUM_TABLE_PREFIX . "forum`.`post_date` FROM `players`, `" . FORUM_TABLE_PREFIX . "forum` WHERE `" . FORUM_TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread['id']." AND `players`.`id` = `" . FORUM_TABLE_PREFIX . "forum`.`author_guid` ORDER BY `post_date` DESC LIMIT 1")->fetch(); $last_post = $db->query("SELECT `players`.`name`, `" . FORUM_TABLE_PREFIX . "forum`.`post_date` FROM `players`, `" . FORUM_TABLE_PREFIX . "forum` WHERE `" . FORUM_TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread['id']." AND `players`.`id` = `" . FORUM_TABLE_PREFIX . "forum`.`author_guid` ORDER BY `post_date` DESC LIMIT 1")->fetch();
@@ -85,10 +87,8 @@ if(isset($last_threads[0]))
echo '</td></tr>'; echo '</td></tr>';
} }
echo '</table>'; echo '</table>';
if(!$sections[$section_id]['closed'] || Forum::isModerator()) if($logged && (!$sections[$section_id]['closed'] || Forum::isModerator()))
echo '<br /><a href="?subtopic=forum&action=new_thread&section_id='.$section_id.'"><img src="images/forum/topic.gif" border="0" /></a>'; echo '<br /><a href="?subtopic=forum&action=new_thread&section_id='.$section_id.'"><img src="images/forum/topic.gif" border="0" /></a>';
} }
else else
echo '<h3>No threads in this board.</h3>'; echo '<h3>No threads in this board.</h3>';
?>

View File

@@ -16,12 +16,14 @@ $_page = (int) (isset($_REQUEST['page']) ? $_REQUEST['page'] : 0);
$thread_starter = $db->query("SELECT `players`.`name`, `" . FORUM_TABLE_PREFIX . "forum`.`post_topic`, `" . FORUM_TABLE_PREFIX . "forum`.`section` FROM `players`, `" . FORUM_TABLE_PREFIX . "forum` WHERE `" . FORUM_TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread_id." AND `" . FORUM_TABLE_PREFIX . "forum`.`id` = `" . FORUM_TABLE_PREFIX . "forum`.`first_post` AND `players`.`id` = `" . FORUM_TABLE_PREFIX . "forum`.`author_guid` LIMIT 1")->fetch(); $thread_starter = $db->query("SELECT `players`.`name`, `" . FORUM_TABLE_PREFIX . "forum`.`post_topic`, `" . FORUM_TABLE_PREFIX . "forum`.`section` FROM `players`, `" . FORUM_TABLE_PREFIX . "forum` WHERE `" . FORUM_TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread_id." AND `" . FORUM_TABLE_PREFIX . "forum`.`id` = `" . FORUM_TABLE_PREFIX . "forum`.`first_post` AND `players`.`id` = `" . FORUM_TABLE_PREFIX . "forum`.`author_guid` LIMIT 1")->fetch();
if(empty($thread_starter['name'])) { if(empty($thread_starter['name'])) {
echo 'Thread with this ID does not exits.'; $errors[] = 'Thread with this ID does not exists.';
displayErrorBoxWithBackButton($errors, getLink('forum'));
return; return;
} }
if(!Forum::hasAccess($thread_starter['section'])) { if(!Forum::hasAccess($thread_starter['section'])) {
echo "You don't have access to view this thread."; $errors[] = "You don't have access to view this thread.";
displayErrorBoxWithBackButton($errors, getLink('forum'));
return; return;
} }

View File

@@ -25,7 +25,7 @@ if(count($guilds_list) > 0)
$description = $guild->getCustomField('description'); $description = $guild->getCustomField('description');
$description_with_lines = str_replace(array("\r\n", "\n", "\r"), '<br />', $description, $count); $description_with_lines = str_replace(array("\r\n", "\n", "\r"), '<br />', $description, $count);
if ($count < $config['guild_description_lines_limit']) if ($count < $config['guild_description_lines_limit'])
$description = wordwrap(nl2br($description), 60, "<br />", true); $description = nl2br($description);
$guildName = $guild->getName(); $guildName = $guild->getName();
$guilds[] = array('name' => $guildName, 'logo' => $guild_logo, 'link' => getGuildLink($guildName, false), 'description' => $description); $guilds[] = array('name' => $guildName, 'logo' => $guild_logo, 'link' => getGuildLink($guildName, false), 'description' => $description);

View File

@@ -83,7 +83,7 @@ if(empty($guild_logo) || !file_exists('images/guilds/' . $guild_logo))
$description = $guild->getCustomField('description'); $description = $guild->getCustomField('description');
$description_with_lines = str_replace(array("\r\n", "\n", "\r"), '<br />', $description, $count); $description_with_lines = str_replace(array("\r\n", "\n", "\r"), '<br />', $description, $count);
if($count < $config['guild_description_lines_limit']) if($count < $config['guild_description_lines_limit'])
$description = wordwrap(nl2br($description), 60, "<br />", true); $description = nl2br($description);
//$description = $description_with_lines; //$description = $description_with_lines;
$guild_owner = $guild->getOwner(); $guild_owner = $guild->getOwner();
@@ -144,6 +144,7 @@ if($db->hasColumn('players', 'guildnick'))
$useGuildNick = true; $useGuildNick = true;
$twig->display('guilds.view.html.twig', array( $twig->display('guilds.view.html.twig', array(
'guild' => $guild,
'logo' => $guild_logo, 'logo' => $guild_logo,
'guild_name' => $guild_name, 'guild_name' => $guild_name,
'description' => $description, 'description' => $description,

View File

@@ -30,11 +30,13 @@ if($config['highscores_vocation_box'] && isset($vocation))
if(strtolower($name) == $vocation) { if(strtolower($name) == $vocation) {
$add_vocs = array($id); $add_vocs = array($id);
if ($id !== 0) {
$i = $id + $config['vocations_amount']; $i = $id + $config['vocations_amount'];
while(isset($config['vocations'][$i])) { while(isset($config['vocations'][$i])) {
$add_vocs[] = $i; $add_vocs[] = $i;
$i += $config['vocations_amount']; $i += $config['vocations_amount'];
} }
}
$add_sql = 'AND `vocation` IN (' . implode(', ', $add_vocs) . ')'; $add_sql = 'AND `vocation` IN (' . implode(', ', $add_vocs) . ')';
break; break;
@@ -355,7 +357,7 @@ if($config['highscores_vocation_box'])
<tr bgcolor="'.$config['lightborder'].'"> <tr bgcolor="'.$config['lightborder'].'">
<td> <td>
<a href="' . getLink('highscores') . '/' . $list . '" class="size_xs">[ALL]</A><BR>'; <a href="' . getLink('highscores') . '/' . $list . '" class="size_xs">[ALL]</A><BR>';
for($i = 1; $i <= $config['vocations_amount']; $i++) { for($i = 0; $i <= $config['vocations_amount']; $i++) {
echo '<a href="' . getLink('highscores') . '/' . $list . '/' . strtolower($config_vocations[$i]) . '" class="size_xs">' . $config_vocations[$i] . '</a><br/>'; echo '<a href="' . getLink('highscores') . '/' . $list . '/' . strtolower($config_vocations[$i]) . '" class="size_xs">' . $config_vocations[$i] . '</a><br/>';
} }
echo ' echo '

View File

@@ -93,7 +93,7 @@ elseif($action == 'sendcode')
$newcode = generateRandomString(30, true, false, true); $newcode = generateRandomString(30, true, false, true);
$mailBody = ' $mailBody = '
You asked to reset your ' . $config['lua']['serverName'] . ' password.<br/> You asked to reset your ' . $config['lua']['serverName'] . ' password.<br/>
<p>Account name: '.$account->getName().'</p> <p>Account ' . (USE_ACCOUNT_NAME ? 'Name' : 'Number') . ' ' .(USE_ACCOUNT_NAME ? $account->getName() : $account->getId()).'</p>
<br /> <br />
To do so, please click this link: To do so, please click this link:
<p><a href="' . BASE_URL . '?subtopic=lostaccount&action=checkcode&code='.$newcode.'&character='.urlencode($nick).'">'.BASE_URL.'/?subtopic=lostaccount&action=checkcode&code='.$newcode.'&character='.urlencode($nick).'</a></p> <p><a href="' . BASE_URL . '?subtopic=lostaccount&action=checkcode&code='.$newcode.'&character='.urlencode($nick).'">'.BASE_URL.'/?subtopic=lostaccount&action=checkcode&code='.$newcode.'&character='.urlencode($nick).'</a></p>
@@ -150,7 +150,7 @@ elseif($action == 'step1' && $action_type == 'reckey')
$account_key = $account->getCustomField('key'); $account_key = $account->getCustomField('key');
if(!empty($account_key)) if(!empty($account_key))
{ {
echo 'If you enter right recovery key you will see form to set new e-mail and password to account. To this e-mail will be send your new password and account name.<BR> echo 'If you enter right recovery key you will see form to set new e-mail and password to account. To this e-mail will be send your new password and account ' . (USE_ACCOUNT_NAME ? 'Name' : 'Number') . '.<BR>
<FORM ACTION="?subtopic=lostaccount&action=step2" METHOD=post> <FORM ACTION="?subtopic=lostaccount&action=step2" METHOD=post>
<TABLE CELLSPACING=1 CELLPADDING=4 BORDER=0 WIDTH=100%> <TABLE CELLSPACING=1 CELLPADDING=4 BORDER=0 WIDTH=100%>
<TR><TD BGCOLOR="'.$config['vdarkborder'].'" class="white"><B>Please enter your recovery key</B></TD></TR> <TR><TD BGCOLOR="'.$config['vdarkborder'].'" class="white"><B>Please enter your recovery key</B></TD></TR>
@@ -304,21 +304,22 @@ elseif($action == 'step3')
if($config_salt_enabled) if($config_salt_enabled)
$account->setCustomField('salt', $salt); $account->setCustomField('salt', $salt);
echo 'Your account name, new password and new e-mail.<BR> echo 'Your account ' . (USE_ACCOUNT_NAME ? 'name' : 'number') . ', new password and new e-mail.<BR>
<FORM ACTION="?subtopic=accountmanagement" onsubmit="return validate_form(this)" METHOD=post> <FORM ACTION="?subtopic=accountmanagement" onsubmit="return validate_form(this)" METHOD=post>
<INPUT TYPE=hidden NAME="character" VALUE=""> <INPUT TYPE=hidden NAME="character" VALUE="">
<TABLE CELLSPACING=1 CELLPADDING=4 BORDER=0 WIDTH=100%> <TABLE CELLSPACING=1 CELLPADDING=4 BORDER=0 WIDTH=100%>
<TR><TD BGCOLOR="'.$config['vdarkborder'].'" class="white"><B>Your account name, new password and new e-mail</B></TD></TR> <TR><TD BGCOLOR="'.$config['vdarkborder'].'" class="white"><B>Your account ' . (USE_ACCOUNT_NAME ? 'Name' : 'Number') . ', new password and new e-mail</B></TD></TR>
<TR><TD BGCOLOR="'.$config['darkborder'].'"> <TR><TD BGCOLOR="'.$config['darkborder'].'">
Account name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>'.$account->getName().'</b><BR> Account ' . (USE_ACCOUNT_NAME ? 'Name' : 'Number') . ':&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>'.(USE_ACCOUNT_NAME ? $account->getName() : $account->getId()).'</b><BR>
New password:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>'.$new_pass.'</b><BR> New password:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>'.$new_pass.'</b><BR>
New e-mail address:&nbsp;<b>'.$new_email.'</b><BR>'; New e-mail address:&nbsp;<b>'.$new_email.'</b><BR>';
if($account->getCustomField('email_next') < time()) if($account->getCustomField('email_next') < time())
{ {
$mailBody = ' $mailBody = '
<h3>Your account name and new password!</h3> <h3>Your account ' . (USE_ACCOUNT_NAME ? 'name' : 'number') . ' and new password!</h3>
<p>Changed password and e-mail to your account in Lost Account Interface on server <a href="'.BASE_URL.'"><b>'.$config['lua']['serverName'].'</b></a></p> <p>Changed password and e-mail to your account in Lost Account Interface on server <a href="'.BASE_URL.'"><b>'.$config['lua']['serverName'].'</b></a></p>
<p>Account name: <b>'.$account->getName().'</b></p> <p>Account ' . (USE_ACCOUNT_NAME ? 'Name' : 'Number') . ': <b>'.(USE_ACCOUNT_NAME ? $account->getName() : $account->getId()).'</b></p>
<p>New password: <b>'.$new_pass.'</b></p> <p>New password: <b>'.$new_pass.'</b></p>
<p>E-mail: <b>'.$new_email.'</b> (this e-mail)</p> <p>E-mail: <b>'.$new_email.'</b> (this e-mail)</p>
<br /> <br />
@@ -326,7 +327,7 @@ elseif($action == 'step3')
if(_mail($account->getCustomField('email'), $config['lua']['serverName']." - New password to your account", $mailBody)) if(_mail($account->getCustomField('email'), $config['lua']['serverName']." - New password to your account", $mailBody))
{ {
echo '<br /><small>Sent e-mail with your account name and password to new e-mail. You should receive this e-mail in 15 minutes. You can login now with new password!</small>'; echo '<br /><small>Sent e-mail with your account ' . (USE_ACCOUNT_NAME ? 'Name' : 'Number') . ' and password to new e-mail. You should receive this e-mail in 15 minutes. You can login now with new password!</small>';
} }
else else
{ {
@@ -423,7 +424,7 @@ elseif($action == 'checkcode')
<INPUT TYPE=hidden NAME="character" VALUE="'.$character.'"> <INPUT TYPE=hidden NAME="character" VALUE="'.$character.'">
<INPUT TYPE=hidden NAME="code" VALUE="'.$code.'"> <INPUT TYPE=hidden NAME="code" VALUE="'.$code.'">
<TABLE CELLSPACING=1 CELLPADDING=4 BORDER=0 WIDTH=100%> <TABLE CELLSPACING=1 CELLPADDING=4 BORDER=0 WIDTH=100%>
<TR><TD BGCOLOR="'.$config['vdarkborder'].'" class="white"><B>Code & account name</B></TD></TR> <TR><TD BGCOLOR="'.$config['vdarkborder'].'" class="white"><B>Code & account ' . (USE_ACCOUNT_NAME ? 'Name' : 'Number') . '</B></TD></TR>
<TR><TD BGCOLOR="'.$config['darkborder'].'"> <TR><TD BGCOLOR="'.$config['darkborder'].'">
New password:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT TYPE=password ID="passor" NAME="passor" VALUE="" SIZE="40")><BR /> New password:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT TYPE=password ID="passor" NAME="passor" VALUE="" SIZE="40")><BR />
Repeat new password:&nbsp;<INPUT TYPE=password ID="passor2" NAME="passor2" VALUE="" SIZE="40")><BR /> Repeat new password:&nbsp;<INPUT TYPE=password ID="passor2" NAME="passor2" VALUE="" SIZE="40")><BR />
@@ -497,19 +498,19 @@ elseif($action == 'setnewpassword')
<TR><TD BGCOLOR="'.$config['vdarkborder'].'" class="white"><B>Changed password</B></TD></TR> <TR><TD BGCOLOR="'.$config['vdarkborder'].'" class="white"><B>Changed password</B></TD></TR>
<TR><TD BGCOLOR="'.$config['darkborder'].'"> <TR><TD BGCOLOR="'.$config['darkborder'].'">
New password:&nbsp;<b>'.$newpassword.'</b><BR /> New password:&nbsp;<b>'.$newpassword.'</b><BR />
Account name:&nbsp;&nbsp;&nbsp;<i>(Already on your e-mail)</i><BR />'; Account ' . (USE_ACCOUNT_NAME ? 'Name' : 'Number') . ':&nbsp;&nbsp;&nbsp;<i>(Already on your e-mail)</i><BR />';
$mailBody = ' $mailBody = '
<h3>Your account name and password!</h3> <h3>Your account ' . (USE_ACCOUNT_NAME ? 'Name' : 'Number') . ' and password!</h3>
<p>Changed password to your account in Lost Account Interface on server <a href="'.BASE_URL.'"><b>'.$config['lua']['serverName'].'</b></a></p> <p>Changed password to your account in Lost Account Interface on server <a href="'.BASE_URL.'"><b>'.$config['lua']['serverName'].'</b></a></p>
<p>Account name: <b>'.$account->getName().'</b></p> <p>Account ' . (USE_ACCOUNT_NAME ? 'Name' : 'Number') . ': <b>'.(USE_ACCOUNT_NAME ? $account->getName() : $account->getId()).'</b></p>
<p>New password: <b>'.$newpassword.'</b></p> <p>New password: <b>'.$newpassword.'</b></p>
<br /> <br />
<p><u>It\'s automatic e-mail from OTS Lost Account System. Do not reply!</u></p>'; <p><u>It\'s automatic e-mail from OTS Lost Account System. Do not reply!</u></p>';
if(_mail($account->getCustomField('email'), $config['lua']['serverName']." - Your new password", $mailBody)) if(_mail($account->getCustomField('email'), $config['lua']['serverName']." - Your new password", $mailBody))
{ {
echo '<br /><small>New password work! Sent e-mail with your password and account name. You should receive this e-mail in 15 minutes. You can login now with new password!'; echo '<br /><small>New password work! Sent e-mail with your password and account ' . (USE_ACCOUNT_NAME ? 'Name' : 'Number') . '. You should receive this e-mail in 15 minutes. You can login now with new password!';
} }
else else
{ {

View File

@@ -142,10 +142,14 @@ function updateStatus() {
} }
} }
$status['uptime'] = $serverStatus->getUptime(); $uptime = $status['uptime'] = $serverStatus->getUptime();
$h = floor($status['uptime'] / 3600); $m = date('m', $uptime);
$m = floor(($status['uptime'] - $h * 3600) / 60); $m = $m > 1 ? "$m months, " : ($m == 1 ? 'month, ' : '');
$status['uptimeReadable'] = $h . 'h ' . $m . 'm'; $d = date('d', $uptime);
$d = $d > 1 ? "$d days, " : ($d == 1 ? 'day, ' : '');
$h = date('H', $uptime);
$min = date('i', $uptime);
$status['uptimeReadable'] = "{$m}{$d}{$h}h {$min}m";
$status['monsters'] = $serverStatus->getMonstersCount(); $status['monsters'] = $serverStatus->getMonstersCount();
$status['motd'] = $serverStatus->getMOTD(); $status['motd'] = $serverStatus->getMOTD();

View File

@@ -83,7 +83,7 @@ else {
unset($file); unset($file);
if ($cache->enabled()) { if ($cache->enabled()) {
$cache->set('template_ini_' . $template_name, serialize($template_ini)); $cache->set('template_ini_' . $template_name, serialize($template_ini), 10 * 60);
} }
} }
} }
@@ -147,7 +147,7 @@ function get_template_menus() {
$menus = array(); $menus = array();
foreach($result as $menu) { foreach($result as $menu) {
$link_full = strpos(trim($menu['link']), 'http') === 0 ? $menu['link'] : getLink($menu['link']); $link_full = strpos(trim($menu['link']), 'http') === 0 ? $menu['link'] : getLink($menu['link']);
$menus[$menu['category']][] = array('name' => $menu['name'], 'link' => $menu['link'], 'link_full' => $link_full, 'blank' => $menu['blank'] == 1, 'color' => $menu['color']); $menus[$menu['category']][] = array('name' => $menu['name'], 'link' => $menu['link'], 'link_full' => $link_full, 'blank' => $menu['blank'] == 1, 'target_blank' => ($menu['blank'] == 1 ? ' target="blank"' : ''), 'color' => $menu['color']);
} }
$new_menus = array(); $new_menus = array();

View File

@@ -130,7 +130,7 @@
{{ hook('HOOK_ACCOUNT_CREATE_BETWEEN_BOXES_1') }} {{ hook('HOOK_ACCOUNT_CREATE_BETWEEN_BOXES_1') }}
{% if (not config.mail_enabled or not config.account_mail_verify) and config.account_create_character_create %} {% if config.account_create_character_create %}
<tr> <tr>
<td> <td>
<div class="TableShadowContainerRightTop"> <div class="TableShadowContainerRightTop">

View File

@@ -86,6 +86,7 @@
</div> </div>
<br/><br/> <br/><br/>
{% endif %} {% endif %}
{{ hook('HOOK_ACCOUNT_MANAGE_BEFORE_GENERAL_INFORMATION') }}
<a name="General+Information"></a> <a name="General+Information"></a>
<h2>General Information</h2> <h2>General Information</h2>
<table width="100%"> <table width="100%">
@@ -122,6 +123,7 @@
{% endautoescape %} {% endautoescape %}
</table> </table>
<br/> <br/>
{{ hook('HOOK_ACCOUNT_MANAGE_BEFORE_PUBLIC_INFORMATION') }}
<a name="Public+Information"></a> <a name="Public+Information"></a>
<h2>Public Information</h2> <h2>Public Information</h2>
<table width="100%"> <table width="100%">
@@ -139,8 +141,9 @@
{% include('buttons.base.html.twig') %} {% include('buttons.base.html.twig') %}
</form> </form>
<br/> <br/>
{{ hook('HOOK_ACCOUNT_MANAGE_BEFORE_ACCOUNT_LOGS') }}
<a name="Account+Logs" ></a> <a name="Account+Logs" ></a>
<h2>Action Log</h2> <h2>Account Logs</h2>
<table> <table>
<tr bgcolor="{{ config.vdarkborder }}" class="white"> <tr bgcolor="{{ config.vdarkborder }}" class="white">
<th>Action</th><th>Date</th><th>IP</th> <th>Action</th><th>Date</th><th>IP</th>
@@ -158,6 +161,7 @@
{% endautoescape %} {% endautoescape %}
</table> </table>
<br/> <br/>
{{ hook('HOOK_ACCOUNT_MANAGE_BEFORE_CHARACTERS') }}
<a name="Characters" ></a> <a name="Characters" ></a>
<h2>Character list: {{ players|length }} characters.</h2> <h2>Character list: {{ players|length }} characters.</h2>
<table> <table>

View File

@@ -7,7 +7,7 @@
</script> </script>
{% set rows = 0 %} {% set rows = 0 %}
<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr> <table border="0" cellpadding="0" cellspacing="0" width="100%"><tr>
<td><img src="<{{ template_path }}/images/general/blank.gif" width="10" height="1" border="0"></td> <td><img src="{{ template_path }}/images/general/blank.gif" width="10" height="1" border="0"></td>
<td> <td>
{{ hook(constant('HOOK_CHARACTERS_BEFORE_INFORMATIONS')) }} {{ hook(constant('HOOK_CHARACTERS_BEFORE_INFORMATIONS')) }}
{% if canEdit %} {% if canEdit %}
@@ -142,7 +142,7 @@
{% set rows = rows + 1 %} {% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}"> <tr bgcolor="{{ getStyle(rows) }}">
<td valign="top">Comment:</td> <td valign="top">Comment:</td>
<td>{{ comment|raw }}</td> <td style="word-break: break-all">{{ comment|raw }}</td>
</tr> </tr>
{% endif %} {% endif %}

View File

@@ -18,8 +18,6 @@
font-family: Verdana, Geneva, sans-serif; font-family: Verdana, Geneva, sans-serif;
} }
.center { .center {
height: 500px;
position: absolute;
top:0; top:0;
bottom: 0; bottom: 0;
left: 0; left: 0;
@@ -38,7 +36,7 @@
} }
#footer { #footer {
position: absolute; margin-top: 20px;
bottom: 15px; bottom: 15px;
width: 100%; width: 100%;

View File

@@ -49,12 +49,12 @@
<table width="100%"> <table width="100%">
<tr bgcolor="{{ config.vdarkborder }}"> <tr bgcolor="{{ config.vdarkborder }}">
<td colspan="2"> <td colspan="2">
<span style="color: white"><b>Last 5 posts from thread: {{ topic|raw }}</b></span> <span style="color: white"><b>Last 5 posts from thread: {{ topic }}</b></span>
</td> </td>
</tr> </tr>
{% set i = 0 %} {% set i = 0 %}
{% for thread in threads %} {% for thread in threads %}
<tr bgcolor="{{ getStyle(i) }}"><td>{{ thread.name }}</td><td>{{ thread.post|raw }}</td></tr> <tr bgcolor="{{ getStyle(i) }}"><td>{{ thread.name }}</td><td style="word-break: break-all">{{ thread.post|raw }}</td></tr>
{% set i = i + 1 %} {% set i = i + 1 %}
{% endfor %} {% endfor %}
</table> </table>

View File

@@ -40,7 +40,7 @@ Page: {{ links_to_pages|raw }}<br/>
<br />Posts: {{ post.author_posts_count }}<br /> <br />Posts: {{ post.author_posts_count }}<br />
</span> </span>
</td> </td>
<td valign="top">{{ post.content|raw }} </td></tr> <td valign="top" style="word-break: break-all">{{ post.content|raw }} </td></tr>
<tr bgcolor="{{ getStyle(i) }}"> <tr bgcolor="{{ getStyle(i) }}">
<td> <td>
<span style="font-size: 10px">{{ post.date|date('d.m.y H:i:s') }} <span style="font-size: 10px">{{ post.date|date('d.m.y H:i:s') }}

View File

@@ -44,7 +44,7 @@
<img src="images/guilds/{{ guild.logo }}" width="64" height="64"> <img src="images/guilds/{{ guild.logo }}" width="64" height="64">
</td> </td>
<td> <td style="word-break: break-all">
<span{% if guild.description is not empty %} valign="top"{% endif %}> <span{% if guild.description is not empty %} valign="top"{% endif %}>
<b>{{ guild.name }}</b>{% if isAdmin %}<a href="?subtopic=guilds&action=delete_by_admin&guild={{ guild.name }}"> - Delete this guild (for ADMIN only!)</a>{% endif %} <b>{{ guild.name }}</b>{% if isAdmin %}<a href="?subtopic=guilds&action=delete_by_admin&guild={{ guild.name }}"> - Delete this guild (for ADMIN only!)</a>{% endif %}
</span> </span>

View File

@@ -47,10 +47,10 @@
<table style="width:100%;"> <table style="width:100%;">
<tbody> <tbody>
<tr> <tr>
<td> <td style="word-break: break-all">
<div id="GuildInformationContainer"> <div id="GuildInformationContainer">
{% if descriptions is not empty %} {% if description is not empty %}
{{ description }} {{ description|raw }}
<br> <br>
<br> <br>
{% endif %} {% endif %}
@@ -265,6 +265,8 @@
</div> </div>
<br> <br>
{{ hook('HOOK_GUILDS_AFTER_INVITED_CHARACTERS', { 'guild': guild, 'isLeader': isLeader }) }}
<div class="TableContainer"> <div class="TableContainer">
<table class="Table3" cellpadding="0" cellspacing="0"> <table class="Table3" cellpadding="0" cellspacing="0">
<tbody> <tbody>

View File

@@ -1,6 +1,6 @@
<div class="NewsHeadline"> <div class="NewsHeadline">
<div class="NewsHeadlineBackground" style="background-image:url({{ template_path }}/images/news/newsheadline_background.gif)"> <div class="NewsHeadlineBackground" style="background-image:url({{ template_path }}/images/news/newsheadline_background.gif)">
<img src="{{ template_path }}/images/news/icon_{{ icon }}.gif" class="NewsHeadlineIcon" /> <img src="{{ constant('BASE_URL') }}images/news/icon_{{ icon }}.gif" class="NewsHeadlineIcon" />
<div class="NewsHeadlineDate">{{ date|date(config.news_date_format) }} - </div> <div class="NewsHeadlineDate">{{ date|date(config.news_date_format) }} - </div>
<div class="NewsHeadlineText">{{ title }}</div> <div class="NewsHeadlineText">{{ title }}</div>
{% if config.news_author and author is not empty %} {% if config.news_author and author is not empty %}

View File

@@ -5,7 +5,7 @@
{% set i = 0 %} {% set i = 0 %}
{% for ticker in tickers %} {% for ticker in tickers %}
<tr bgcolor="{{ getStyle(i) }}"> <tr bgcolor="{{ getStyle(i) }}">
<td style="width: 16px;"><img src="{{ template_path }}/images/news/icon_{{ ticker.icon }}_small.gif"/></td> <td style="width: 16px;"><img src="{{ constant('BASE_URL') }}images/news/icon_{{ ticker.icon }}_small.gif"/></td>
<td style="width: 80px;">{{ ticker.date|date("j M Y") }}</td> <td style="width: 80px;">{{ ticker.date|date("j M Y") }}</td>
<td>{{ ticker.body|raw }}</td> <td>{{ ticker.body|raw }}</td>
</tr> </tr>

View File

@@ -1,24 +1,14 @@
<div class="TableContainer"> <table border="0" cellspacing="1" cellpadding="4" width="100%">
<div class="CaptionContainer"> <thead>
<div class="CaptionInnerContainer"> <tr bgcolor="{{ config.vdarkborder }}">
<span class="CaptionEdgeLeftTop" style="background-image:url({{ template_path }}/images/content/box-frame-edge.gif);"></span> <td colspan="3" class="white"><b>{{ title|raw }}</b></td>
<span class="CaptionEdgeRightTop" style="background-image:url({{ template_path }}/images/content/box-frame-edge.gif);"></span> </tr>
<span class="CaptionBorderTop" style="background-image:url({{ template_path }}/images/content/table-headline-border.gif);"></span> </thead>
<span class="CaptionVerticalLeft" style="background-image:url({{ template_path }}/images/content/box-frame-vertical.gif);"></span> <tbody>
<div class="Text" >{{ title|raw }}</div> <tr style="background-color: {% if background is not null %}{{ background }}{% else %}{{ config.lightborder }}{% endif %}">
<span class="CaptionVerticalRight" style="background-image:url({{ template_path }}/images/content/box-frame-vertical.gif);"></span>
<span class="CaptionBorderBottom" style="background-image:url({{ template_path }}/images/content/table-headline-border.gif);"></span>
<span class="CaptionEdgeLeftBottom" style="background-image:url({{ template_path }}/images/content/box-frame-edge.gif);"></span>
<span class="CaptionEdgeRightBottom" style="background-image:url({{ template_path }}/images/content/box-frame-edge.gif);"></span>
</div>
</div>
<table class="Table5" cellpadding="0" cellspacing="0" style="background-color: {{ config.lightborder }}">
<tr>
<td> <td>
<div class="InnerTableContainer">
{{ content|raw }} {{ content|raw }}
</div>
</td> </td>
</tr> </tr>
</table> </tbody>
</div> </table>

View File

@@ -24,6 +24,9 @@ if($dev_mode) {
} }
unset($dev_mode); unset($dev_mode);
require LIBS . 'TwigTypeCastingExtension.php';
$twig->addExtension(new MyAAC\Twig\Extension\TwigTypeCastingExtension());
$function = new TwigFunction('getStyle', function ($i) { $function = new TwigFunction('getStyle', function ($i) {
return getStyle($i); return getStyle($i);
}); });
@@ -44,15 +47,23 @@ $function = new TwigFunction('getGuildLink', function ($s, $p) {
}); });
$twig->addFunction($function); $twig->addFunction($function);
$function = new TwigFunction('hook', function ($hook) { $function = new TwigFunction('hook', function ($context, $hook, array $params = []) {
global $hooks; global $hooks;
if(is_string($hook)) { if(is_string($hook)) {
if (defined($hook)) {
$hook = constant($hook); $hook = constant($hook);
} }
else {
// plugin/template has a hook that this version of myaac does not support
// just silently return
return;
}
}
$hooks->trigger($hook); $params['context'] = $context;
}); $hooks->trigger($hook, $params);
}, ['needs_context' => true]);
$twig->addFunction($function); $twig->addFunction($function);
$function = new TwigFunction('config', function ($key) { $function = new TwigFunction('config', function ($key) {

View File

@@ -35,7 +35,7 @@
<td> <td>
<img src="{{ template_path }}/images/content/headline-bracer-left.gif" /> <img src="{{ template_path }}/images/content/headline-bracer-left.gif" />
</td> </td>
<td style="text-align:center;vertical-align:middle;horizontal-align:center;font-size:17px;font-weight:bold;" >{{ welcome_message }}<br/></td> <td style="text-align:center;vertical-align:middle;horizontal-align:center;font-size:17px;font-weight:bold;" >{{ welcome_message|raw }}<br/></td>
<td><img src="{{ template_path }}/images/content/headline-bracer-right.gif" /></td> <td><img src="{{ template_path }}/images/content/headline-bracer-right.gif" /></td>
</tr> </tr>
</table> </table>
@@ -111,6 +111,7 @@
</div> </div>
<br/><br/> <br/><br/>
{% endif %} {% endif %}
{{ hook('HOOK_ACCOUNT_MANAGE_BEFORE_GENERAL_INFORMATION') }}
<a name="General+Information" ></a> <a name="General+Information" ></a>
<div class="TopButtonContainer"> <div class="TopButtonContainer">
<div class="TopButton"> <div class="TopButton">
@@ -236,6 +237,7 @@
</table> </table>
</div> </div>
<br/> <br/>
{{ hook('HOOK_ACCOUNT_MANAGE_BEFORE_PUBLIC_INFORMATION') }}
<a name="Public+Information"></a> <a name="Public+Information"></a>
<div class="TopButtonContainer"> <div class="TopButtonContainer">
<div class="TopButton"> <div class="TopButton">
@@ -313,6 +315,7 @@
</table> </table>
</div> </div>
<br/> <br/>
{{ hook('HOOK_ACCOUNT_MANAGE_BEFORE_ACCOUNT_LOGS') }}
<a name="Account+Logs" ></a> <a name="Account+Logs" ></a>
<div class="TopButtonContainer"> <div class="TopButtonContainer">
<div class="TopButton"> <div class="TopButton">
@@ -384,6 +387,7 @@
</table> </table>
</div> </div>
<br/> <br/>
{{ hook('HOOK_ACCOUNT_MANAGE_BEFORE_CHARACTERS') }}
<a name="Characters" ></a> <a name="Characters" ></a>
<div class="TopButtonContainer"> <div class="TopButtonContainer">
<div class="TopButton" > <div class="TopButton" >

View File

@@ -1,8 +1,19 @@
{% spaceless %} {% apply spaceless %}
<div class="BigButton" style="background-image:url({{ template_path }}/images/global/buttons/button_blue.gif)">
{% set tmp_image = 'sbutton' %}
{% if button_color is defined %}
{% if button_color == 'green' %}
{% set tmp_image = 'sbutton_green' %}
{% elseif button_color == 'red' %}
{% set tmp_image = 'sbutton_red' %}
{% endif %}
{% endif %}
<div class="BigButton" style="background-image:url({{ template_path }}/images/global/buttons/{{ tmp_image }}.gif)">
<div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);"> <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);">
<div class="BigButtonOver" style="background-image:url({{ template_path }}/images/global/buttons/{% if button_color is defined and button_color == 'green' %}button_green{% else %}button_blue_over{% endif %}.gif);" ></div> <div class="BigButtonOver" style="background-image:url({{ template_path }}/images/global/buttons/{{ tmp_image }}_over.gif);" ></div>
<input class="BigButtonText" type="submit" value="{{ button_name }}"> <input class="BigButtonText" type="submit" value="{{ button_name }}">
</div> </div>
</div> </div>
{% endspaceless %} {% endapply %}

View File

@@ -28,7 +28,7 @@ if(!@file_exists($page_file))
// set text // set text
$font = getenv('GDFONTPATH') . DIRECTORY_SEPARATOR . 'martel.ttf'; $font = getenv('GDFONTPATH') . DIRECTORY_SEPARATOR . 'martel.ttf';
imagettftext($image, 18, 0, 4, 20, imagecolorallocate($image, 240, 209, 164), $font, utf8_decode($_GET['t'])); imagettftext($image, 18, 0, 4, 20, imagecolorallocate($image, 240, 209, 164), $font, $_GET['t']);
// header mime type // header mime type
header('Content-type: image/gif'); header('Content-type: image/gif');

View File

@@ -21,7 +21,7 @@ if(isset($config['boxes']))
<?php <?php
if(PAGE !== 'news') { if(PAGE !== 'news') {
if(strpos(URI, 'subtopic=') !== false) { if(strpos(URI, 'subtopic=') !== false) {
$tmp = $_REQUEST['subtopic']; $tmp = escapeHtml($_REQUEST['subtopic']);
if($tmp === 'accountmanagement') { if($tmp === 'accountmanagement') {
$tmp = 'accountmanage'; $tmp = 'accountmanage';
} }

View File

@@ -0,0 +1,24 @@
<div class="TableContainer">
<div class="CaptionContainer">
<div class="CaptionInnerContainer">
<span class="CaptionEdgeLeftTop" style="background-image:url({{ template_path }}/images/content/box-frame-edge.gif);"></span>
<span class="CaptionEdgeRightTop" style="background-image:url({{ template_path }}/images/content/box-frame-edge.gif);"></span>
<span class="CaptionBorderTop" style="background-image:url({{ template_path }}/images/content/table-headline-border.gif);"></span>
<span class="CaptionVerticalLeft" style="background-image:url({{ template_path }}/images/content/box-frame-vertical.gif);"></span>
<div class="Text" >{{ title|raw }}</div>
<span class="CaptionVerticalRight" style="background-image:url({{ template_path }}/images/content/box-frame-vertical.gif);"></span>
<span class="CaptionBorderBottom" style="background-image:url({{ template_path }}/images/content/table-headline-border.gif);"></span>
<span class="CaptionEdgeLeftBottom" style="background-image:url({{ template_path }}/images/content/box-frame-edge.gif);"></span>
<span class="CaptionEdgeRightBottom" style="background-image:url({{ template_path }}/images/content/box-frame-edge.gif);"></span>
</div>
</div>
<table class="{% if tableClass is not null %}{{ tableClass }}{% else %}Table3{% endif %}" cellpadding="0" cellspacing="0" style="background-color: {% if background is not null %}{{ background }}{% else %}{{ config.lightborder }}{% endif %}">
<tr>
<td>
<div class="InnerTableContainer">
{{ content|raw }}
</div>
</td>
</tr>
</table>
</div>

View File

@@ -1,8 +1,12 @@
function MouseOverBigButton(source) { function MouseOverBigButton(source) {
if (source?.firstChild?.style) {
source.firstChild.style.visibility = "visible"; source.firstChild.style.visibility = "visible";
}
} }
function MouseOutBigButton(source) { function MouseOutBigButton(source) {
if (source?.firstChild?.style) {
source.firstChild.style.visibility = "hidden"; source.firstChild.style.visibility = "hidden";
}
} }
function BigButtonAction(path) { function BigButtonAction(path) {
window.location = path; window.location = path;