mirror of
https://github.com/slawkens/myaac.git
synced 2025-09-14 12:33:35 +02:00
Compare commits
181 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
e13bd879db | ||
![]() |
f696f74a06 | ||
![]() |
3b18e400c0 | ||
![]() |
d1c72b3240 | ||
![]() |
7abc3c7833 | ||
![]() |
c0c4fe33e9 | ||
![]() |
05827b7861 | ||
![]() |
c304a9ab43 | ||
![]() |
d390ea325e | ||
![]() |
37ba9c7366 | ||
![]() |
7c3ebf70fa | ||
![]() |
eda773cb55 | ||
![]() |
c5c266b023 | ||
![]() |
9483cfaad8 | ||
![]() |
b4ed68dfd7 | ||
![]() |
39b19ed4c8 | ||
![]() |
580b888b1d | ||
![]() |
19d3e15c11 | ||
![]() |
5a68d204bb | ||
![]() |
e09fe51774 | ||
![]() |
b2c9eb4745 | ||
![]() |
d96787ec21 | ||
![]() |
5df5c64e4f | ||
![]() |
3c4b19743f | ||
![]() |
0e25ce553c | ||
![]() |
2e4bbeb7f7 | ||
![]() |
cb6640343b | ||
![]() |
4658d1cb29 | ||
![]() |
b25feaadf6 | ||
![]() |
2693db5f6f | ||
![]() |
8195b44061 | ||
![]() |
035d0c1012 | ||
![]() |
5a953ce901 | ||
![]() |
01660bd2b4 | ||
![]() |
5b858c521a | ||
![]() |
d1c5a189c3 | ||
![]() |
de1bb37bcb | ||
![]() |
e0036a3e32 | ||
![]() |
7f4737631d | ||
![]() |
317505bf19 | ||
![]() |
55b8645d3f | ||
![]() |
ffb8f0879b | ||
![]() |
79f5614dce | ||
![]() |
2c347d0eac | ||
![]() |
d40178104b | ||
![]() |
55543ee881 | ||
![]() |
d39386cfab | ||
![]() |
b5bbae62b0 | ||
![]() |
71ef30d35e | ||
![]() |
263c7bed07 | ||
![]() |
1458b7a412 | ||
![]() |
3e00c52128 | ||
![]() |
d73aceb272 | ||
![]() |
1c55d4a220 | ||
![]() |
1edf8833c8 | ||
![]() |
0ffc5f68b4 | ||
![]() |
81b6652738 | ||
![]() |
e5b4d2c6b3 | ||
![]() |
da1830371f | ||
![]() |
6ba04967ed | ||
![]() |
f503e140f3 | ||
![]() |
f875f3cd20 | ||
![]() |
72632c7b45 | ||
![]() |
1f2e7bd72d | ||
![]() |
016138ab55 | ||
![]() |
77efb80a12 | ||
![]() |
02eea950e4 | ||
![]() |
2793c41655 | ||
![]() |
62d3c198d5 | ||
![]() |
ef62b53cec | ||
![]() |
7181b988e9 | ||
![]() |
8b0b123f42 | ||
![]() |
f98332c698 | ||
![]() |
b1660bf27a | ||
![]() |
191ad25eb2 | ||
![]() |
7469be6efb | ||
![]() |
47a3bfd265 | ||
![]() |
5ae0be2323 | ||
![]() |
42154d55a0 | ||
![]() |
9dcc08ee6e | ||
![]() |
ba537b42bb | ||
![]() |
9c318f9012 | ||
![]() |
a88103a956 | ||
![]() |
e26e6f3a1c | ||
![]() |
08d67a07e0 | ||
![]() |
6e9a89cb2e | ||
![]() |
e3aa3d4031 | ||
![]() |
156a68f8bd | ||
![]() |
6a28da5d33 | ||
![]() |
ee32384dca | ||
![]() |
19afd73e8a | ||
![]() |
eead6a2975 | ||
![]() |
11b11dd3ee | ||
![]() |
483155cf4c | ||
![]() |
55dbade8d5 | ||
![]() |
d1bc63d07a | ||
![]() |
83a91ec540 | ||
![]() |
7b43c972dd | ||
![]() |
3fdf1d3f44 | ||
![]() |
764db0c203 | ||
![]() |
538076bc45 | ||
![]() |
4327b66f91 | ||
![]() |
3f27724569 | ||
![]() |
9c0c2bbece | ||
![]() |
946144016b | ||
![]() |
5c3b01aca4 | ||
![]() |
50983a2b85 | ||
![]() |
765886f0c7 | ||
![]() |
8ea78a5852 | ||
![]() |
063cbab93e | ||
![]() |
f1670f4012 | ||
![]() |
6fcf0f7117 | ||
![]() |
7a07763625 | ||
![]() |
8d2172a649 | ||
![]() |
b8f65207b6 | ||
![]() |
ea675afe86 | ||
![]() |
cc1cebf359 | ||
![]() |
1e874c7027 | ||
![]() |
a338fd967c | ||
![]() |
8796ff7e72 | ||
![]() |
a8172a518f | ||
![]() |
559c2c7bd2 | ||
![]() |
7a546e5a41 | ||
![]() |
5f7a9154b7 | ||
![]() |
0d52978d9f | ||
![]() |
df48363ea4 | ||
![]() |
34725e0257 | ||
![]() |
df321154f6 | ||
![]() |
f2a3ec1185 | ||
![]() |
ce4aed0f17 | ||
![]() |
d0c82f6fb0 | ||
![]() |
89b76e721d | ||
![]() |
6091290efe | ||
![]() |
e4c4990e7f | ||
![]() |
4f1235bfe9 | ||
![]() |
bf9d440a95 | ||
![]() |
59a149c253 | ||
![]() |
563099f290 | ||
![]() |
3732bf988d | ||
![]() |
ab964fa1de | ||
![]() |
b5c694224e | ||
![]() |
23810345f6 | ||
![]() |
b574a29331 | ||
![]() |
6593e32d83 | ||
![]() |
b09adc836d | ||
![]() |
dcf9a45974 | ||
![]() |
21258313ef | ||
![]() |
f851fa3845 | ||
![]() |
2fdd507902 | ||
![]() |
b850e56ff1 | ||
![]() |
8d10082179 | ||
![]() |
996ae625c9 | ||
![]() |
467f7ef927 | ||
![]() |
fa015b8d39 | ||
![]() |
4b4864561c | ||
![]() |
475cea8549 | ||
![]() |
760214fdbd | ||
![]() |
9c5dcd7b19 | ||
![]() |
720e400f7c | ||
![]() |
c261c6ba48 | ||
![]() |
933d4e1d6f | ||
![]() |
1d08833726 | ||
![]() |
7cfca55e3c | ||
![]() |
7e13b62b8f | ||
![]() |
5ccfcd541e | ||
![]() |
ba4d2a9c48 | ||
![]() |
7a61f613ec | ||
![]() |
073d9da0bc | ||
![]() |
e081a67589 | ||
![]() |
37a27b8065 | ||
![]() |
d34f7eb2fc | ||
![]() |
f6c080cb5c | ||
![]() |
a983fd03b1 | ||
![]() |
5b651886a5 | ||
![]() |
6484ab75d9 | ||
![]() |
becad18465 | ||
![]() |
ec7e5a8838 | ||
![]() |
300c1b4ebc | ||
![]() |
4f0dd89eb9 | ||
![]() |
79f7c3dbd4 | ||
![]() |
f24fc75b12 |
16
.github/workflows/phplint.yml
vendored
Normal file
16
.github/workflows/phplint.yml
vendored
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
name: PHP Linting
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches: [master]
|
||||||
|
push:
|
||||||
|
branches: [master]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
phplint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: overtrue/phplint@3.4.0
|
||||||
|
with:
|
||||||
|
path: .
|
||||||
|
options: --exclude="system/libs/polyfill-mbstring/bootstrap80.php"
|
17
.gitignore
vendored
17
.gitignore
vendored
@@ -2,12 +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.env.json
|
||||||
|
cypress/e2e/2-advanced-examples
|
||||||
|
cypress/screenshots
|
||||||
|
|
||||||
# created by release.sh
|
# created by release.sh
|
||||||
releases
|
releases
|
||||||
@@ -28,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
|
||||||
@@ -37,7 +52,7 @@ system/cache/*
|
|||||||
|
|
||||||
# php sessions
|
# php sessions
|
||||||
system/php_sessions/*
|
system/php_sessions/*
|
||||||
!system/php_sessions//index.html
|
!system/php_sessions/index.html
|
||||||
|
|
||||||
# logs
|
# logs
|
||||||
system/logs/*
|
system/logs/*
|
||||||
|
176
CHANGELOG.md
176
CHANGELOG.md
@@ -1,5 +1,181 @@
|
|||||||
# 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]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
* new function from 0.9 - Cache::remember($key, $ttl, $callback)
|
||||||
|
* new characters page hooks
|
||||||
|
* line number & file to exception handler, to easier localize exceptions
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
* rename to .htaccess.dist, causes some problems on default setup
|
||||||
|
* removing unneccessary PHP closing tags to prevent potential issues (by @SRNT-GG)
|
||||||
|
* display warning if hook file does not exist
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
* important: Not allow create char if limit is exceeded (by @anyeor) could have been used to spam database
|
||||||
|
* deleted chars: cannot change comment, name, gender, cannot create guild, cannot be invited, cannot accept invite, cannot be passed leadership to
|
||||||
|
* forum: quote and edit post buttons not being shown
|
||||||
|
* twig exception thrown when player does not exist, on character change comment (thanks @anyeor)
|
||||||
|
* BASE_DIR when accessing /tools
|
||||||
|
* do not display warning if HTTP_ACCEPT_LANGUAGE is not set
|
||||||
|
|
||||||
|
## [0.8.10 - 18.05.2023]
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
* PHP 7.2.5 is now required, cause of Twig 2.x
|
||||||
|
* allow pages to be placed in templates folder, under pages/ subfolder
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
* Twig error with global variable on create account
|
||||||
|
* links/redirects from facebook, etc. like ?fbclid=x
|
||||||
|
* do not allow to continue install when there is no server database imported
|
||||||
|
* cannot go forward when config.local.php cannot be saved
|
||||||
|
* when server uses another items serializer
|
||||||
|
* small bug on install - please fill all input
|
||||||
|
|
||||||
## [0.8.9 - 16.03.2023]
|
## [0.8.9 - 16.03.2023]
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
38
README.md
38
README.md
@@ -1,24 +1,29 @@
|
|||||||
# [MyAAC](https://my-aac.org)
|
# [MyAAC](https://my-aac.org)
|
||||||
|
|
||||||
[](https://travis-ci.org/github/slawkens/myaac)
|
|
||||||
[](https://opensource.org/licenses/gpl-license)
|
|
||||||
[](https://github.com/slawkens/myaac/releases)
|
|
||||||
[](https://github.com/slawkens/myaac/blob/d8b3b4135827ee17e3c6d41f08a925e718c587ed/.travis.yml#L3)
|
|
||||||
[](https://discord.gg/2J39Wus)
|
|
||||||
[](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
|
||||||
|
|
||||||
|
[](https://github.com/slawkens/myaac/actions)
|
||||||
|
[](https://opensource.org/licenses/gpl-license)
|
||||||
|
[](https://github.com/slawkens/myaac/releases)
|
||||||
|
[](https://discord.gg/2J39Wus)
|
||||||
|
[](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 5.6 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.
|
||||||
|
|
||||||
|
[](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
16
SECURITY.md
Normal 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.
|
@@ -1 +1,2 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// nothing yet here
|
@@ -68,4 +68,4 @@ ob_end_clean();
|
|||||||
// template
|
// template
|
||||||
$template_path = 'template/';
|
$template_path = 'template/';
|
||||||
require ADMIN . $template_path . 'template.php';
|
require ADMIN . $template_path . 'template.php';
|
||||||
?>
|
|
||||||
|
@@ -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>
|
||||||
|
@@ -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');
|
||||||
|
|
||||||
|
@@ -196,5 +196,3 @@ class Pages
|
|||||||
return !count($errors);
|
return !count($errors);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
||||||
|
@@ -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>
|
||||||
|
@@ -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'])) {
|
||||||
|
@@ -36,4 +36,3 @@ $twig->display('admin.statistics.html.twig', array(
|
|||||||
'account_type' => (USE_ACCOUNT_NAME ? 'name' : 'number'),
|
'account_type' => (USE_ACCOUNT_NAME ? 'name' : 'number'),
|
||||||
'points' => $points
|
'points' => $points
|
||||||
));
|
));
|
||||||
?>
|
|
@@ -47,4 +47,3 @@ function version_revert($version)
|
|||||||
$release = $version;
|
$release = $version;
|
||||||
return $major . '.' . $minor . '.' . $release;
|
return $major . '.' . $minor . '.' . $release;
|
||||||
}*/
|
}*/
|
||||||
?>
|
|
||||||
|
@@ -13,4 +13,3 @@ if(!function_exists('phpinfo'))
|
|||||||
die('phpinfo() disabled on this web server.');
|
die('phpinfo() disabled on this web server.');
|
||||||
|
|
||||||
phpinfo();
|
phpinfo();
|
||||||
?>
|
|
||||||
|
25
common.php
25
common.php
@@ -23,10 +23,10 @@
|
|||||||
* @copyright 2019 MyAAC
|
* @copyright 2019 MyAAC
|
||||||
* @link https://my-aac.org
|
* @link https://my-aac.org
|
||||||
*/
|
*/
|
||||||
if (version_compare(phpversion(), '5.6', '<')) die('PHP version 5.6 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.9');
|
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));
|
||||||
@@ -97,9 +97,13 @@ $size = count($tmp) - 1;
|
|||||||
for($i = 1; $i < $size; $i++)
|
for($i = 1; $i < $size; $i++)
|
||||||
$basedir .= '/' . $tmp[$i];
|
$basedir .= '/' . $tmp[$i];
|
||||||
|
|
||||||
$basedir = str_replace(array('/admin', '/install'), '', $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);
|
||||||
|
}
|
||||||
|
@@ -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
|
||||||
|
0
images/gallery/index.html
Normal file
0
images/gallery/index.html
Normal file
50
index.php
50
index.php
@@ -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';
|
||||||
|
|
||||||
@@ -74,6 +75,14 @@ if((!isset($config['installed']) || !$config['installed']) && file_exists(BASE .
|
|||||||
throw new RuntimeException('Setup detected that <b>install/</b> directory exists. Please visit <a href="' . BASE_URL . 'install">this</a> url to start MyAAC Installation.<br/>Delete <b>install/</b> directory if you already installed MyAAC.<br/>Remember to REFRESH this page when you\'re done!');
|
throw new RuntimeException('Setup detected that <b>install/</b> directory exists. Please visit <a href="' . BASE_URL . 'install">this</a> url to start MyAAC Installation.<br/>Delete <b>install/</b> directory if you already installed MyAAC.<br/>Remember to REFRESH this page when you\'re done!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
require_once SYSTEM . 'init.php';
|
||||||
|
require_once SYSTEM . 'template.php';
|
||||||
|
|
||||||
|
// verify myaac tables exists in database
|
||||||
|
if(!$db->hasTable('myaac_account_actions')) {
|
||||||
|
throw new RuntimeException('Seems that the table <strong>myaac_account_actions</strong> of MyAAC doesn\'t exist in the database. This is a fatal error. You can try to reinstall MyAAC by visiting <a href="' . BASE_URL . 'install">this</a> url.');
|
||||||
|
}
|
||||||
|
|
||||||
$found = false;
|
$found = false;
|
||||||
if(empty($uri) || isset($_REQUEST['template'])) {
|
if(empty($uri) || isset($_REQUEST['template'])) {
|
||||||
$_REQUEST['p'] = 'news';
|
$_REQUEST['p'] = 'news';
|
||||||
@@ -81,7 +90,11 @@ if(empty($uri) || isset($_REQUEST['template'])) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$tmp = strtolower($uri);
|
$tmp = strtolower($uri);
|
||||||
if(!preg_match('/[^A-z0-9_\-]/', $uri) && file_exists(SYSTEM . 'pages/' . $tmp . '.php')) {
|
if (!preg_match('/[^A-z0-9_\-]/', $uri) && file_exists(TEMPLATES . $template_name . '/pages/' . $tmp . '.php')) {
|
||||||
|
$_REQUEST['p'] = $uri;
|
||||||
|
$found = true;
|
||||||
|
}
|
||||||
|
else if (!preg_match('/[^A-z0-9_\-]/', $uri) && file_exists(SYSTEM . 'pages/' . $tmp . '.php')) {
|
||||||
$_REQUEST['p'] = $uri;
|
$_REQUEST['p'] = $uri;
|
||||||
$found = true;
|
$found = true;
|
||||||
}
|
}
|
||||||
@@ -133,13 +146,13 @@ else {
|
|||||||
'/^houses\/view\/?$/' => array('subtopic' => 'houses', 'page' => 'view')
|
'/^houses\/view\/?$/' => array('subtopic' => 'houses', 'page' => 'view')
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach($rules as $rule => $redirect) {
|
foreach ($rules as $rule => $redirect) {
|
||||||
if (preg_match($rule, $uri)) {
|
if (preg_match($rule, $uri)) {
|
||||||
$tmp = explode('/', $uri);
|
$tmp = explode('/', $uri);
|
||||||
/* @var $redirect array */
|
/* @var $redirect array */
|
||||||
foreach($redirect as $key => $value) {
|
foreach ($redirect as $key => $value) {
|
||||||
|
|
||||||
if(strpos($value, '$') !== false) {
|
if (strpos($value, '$') !== false) {
|
||||||
$value = str_replace('$' . $value[1], $tmp[$value[1]], $value);
|
$value = str_replace('$' . $value[1], $tmp[$value[1]], $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,6 +167,12 @@ else {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// handle ?fbclid=x, etc. (show news page)
|
||||||
|
if (!$found && count($_GET) > 0 && !isset($_REQUEST['subtopic']) && !isset($_REQUEST['p']) && !in_array($_SERVER['QUERY_STRING'], getDatabasePages())) {
|
||||||
|
$_REQUEST['p'] = $_REQUEST['subtopic'] = 'news';
|
||||||
|
$found = true;
|
||||||
|
}
|
||||||
|
|
||||||
// define page visited, so it can be used within events system
|
// define page visited, so it can be used within events system
|
||||||
$page = isset($_REQUEST['subtopic']) ? $_REQUEST['subtopic'] : (isset($_REQUEST['p']) ? $_REQUEST['p'] : '');
|
$page = isset($_REQUEST['subtopic']) ? $_REQUEST['subtopic'] : (isset($_REQUEST['p']) ? $_REQUEST['p'] : '');
|
||||||
if(empty($page) || !preg_match('/^[A-z0-9\_\-]+$/', $page)) {
|
if(empty($page) || !preg_match('/^[A-z0-9\_\-]+$/', $page)) {
|
||||||
@@ -174,18 +193,10 @@ define('PAGE', $page);
|
|||||||
|
|
||||||
$template_place_holders = array();
|
$template_place_holders = array();
|
||||||
|
|
||||||
require_once SYSTEM . 'init.php';
|
|
||||||
|
|
||||||
// verify myaac tables exists in database
|
|
||||||
if(!$db->hasTable('myaac_account_actions')) {
|
|
||||||
throw new RuntimeException('Seems that the table <strong>myaac_account_actions</strong> of MyAAC doesn\'t exist in the database. This is a fatal error. You can try to reinstall MyAAC by visiting <a href="' . BASE_URL . 'install">this</a> url.');
|
|
||||||
}
|
|
||||||
|
|
||||||
// event system
|
// event system
|
||||||
require_once SYSTEM . 'hooks.php';
|
require_once SYSTEM . 'hooks.php';
|
||||||
$hooks = new Hooks();
|
$hooks = new Hooks();
|
||||||
$hooks->load();
|
$hooks->load();
|
||||||
require_once SYSTEM . 'template.php';
|
|
||||||
require_once SYSTEM . 'login.php';
|
require_once SYSTEM . 'login.php';
|
||||||
require_once SYSTEM . 'status.php';
|
require_once SYSTEM . 'status.php';
|
||||||
|
|
||||||
@@ -211,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 {
|
||||||
@@ -226,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -288,6 +299,7 @@ if($config['backward_support']) {
|
|||||||
$config['site'] = &$config;
|
$config['site'] = &$config;
|
||||||
$config['server'] = &$config['lua'];
|
$config['server'] = &$config['lua'];
|
||||||
$config['site']['shop_system'] = $config['gifts_system'];
|
$config['site']['shop_system'] = $config['gifts_system'];
|
||||||
|
$config['site']['gallery_page'] = true;
|
||||||
|
|
||||||
if(!isset($config['vdarkborder']))
|
if(!isset($config['vdarkborder']))
|
||||||
$config['vdarkborder'] = '#505050';
|
$config['vdarkborder'] = '#505050';
|
||||||
@@ -335,12 +347,10 @@ if($load_it)
|
|||||||
)) . $content;
|
)) . $content;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$file = TEMPLATES . $template_name . '/pages/' . $page . '.php';
|
$file = TEMPLATES . "$template_name/pages/$page.php";
|
||||||
if(!@file_exists($file) || preg_match('/[^A-z0-9_\-]/', $page))
|
if(!@file_exists($file) || preg_match('/[^A-z0-9_\-]/', $page)) {
|
||||||
{
|
$file = SYSTEM . "pages/$page.php";
|
||||||
$file = SYSTEM . 'pages/' . $page . '.php';
|
if(!@file_exists($file) || preg_match('/[^A-z0-9_\-]/', $page)) {
|
||||||
if(!@file_exists($file) || preg_match('/[^A-z0-9_\-]/', $page))
|
|
||||||
{
|
|
||||||
$page = '404';
|
$page = '404';
|
||||||
$file = SYSTEM . 'pages/404.php';
|
$file = SYSTEM . 'pages/404.php';
|
||||||
}
|
}
|
||||||
|
@@ -38,4 +38,3 @@ if(!isset($error) || !$error) {
|
|||||||
$error = true;
|
$error = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
@@ -70,7 +70,7 @@ if($step == 'database') {
|
|||||||
|
|
||||||
$key = str_replace('var_', '', $key);
|
$key = str_replace('var_', '', $key);
|
||||||
|
|
||||||
if(in_array($key, array('account', 'password', 'email', 'player_name'))) {
|
if(in_array($key, array('account', 'account_id', 'password', 'email', 'player_name'))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,14 +114,12 @@ if($step == 'database') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if($step == 'admin') {
|
else if($step == 'admin') {
|
||||||
$config_failed = true;
|
if(!file_exists(BASE . 'config.local.php') || !isset($config['installed']) || !$config['installed']) {
|
||||||
if(file_exists(BASE . 'config.local.php') && isset($config['installed']) && $config['installed'] && isset($_SESSION['saved'])) {
|
|
||||||
$config_failed = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($config_failed) {
|
|
||||||
$step = 'database';
|
$step = 'database';
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
$_SESSION['saved'] = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if($step == 'finish') {
|
else if($step == 'finish') {
|
||||||
$email = $_SESSION['var_email'];
|
$email = $_SESSION['var_email'];
|
||||||
@@ -191,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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -5,4 +5,3 @@ $twig->display('install.license.html.twig', array(
|
|||||||
'license' => file_get_contents(BASE . 'LICENSE'),
|
'license' => file_get_contents(BASE . 'LICENSE'),
|
||||||
'buttons' => next_buttons()
|
'buttons' => next_buttons()
|
||||||
));
|
));
|
||||||
?>
|
|
||||||
|
@@ -18,4 +18,3 @@ $twig->display('install.config.html.twig', array(
|
|||||||
'errors' => isset($errors) ? $errors : null,
|
'errors' => isset($errors) ? $errors : null,
|
||||||
'buttons' => next_buttons()
|
'buttons' => next_buttons()
|
||||||
));
|
));
|
||||||
?>
|
|
@@ -57,16 +57,35 @@ if(!$error) {
|
|||||||
error($database_error);
|
error($database_error);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$twig->display('install.installer.html.twig', array(
|
if(!$db->hasTable('accounts')) {
|
||||||
'url' => 'tools/5-database.php',
|
$tmp = str_replace('$TABLE$', 'accounts', $locale['step_database_error_table']);
|
||||||
'message' => $locale['loading_spinner']
|
error($tmp);
|
||||||
));
|
$error = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$db->hasTable('players')) {
|
||||||
|
$tmp = str_replace('$TABLE$', 'players', $locale['step_database_error_table']);
|
||||||
|
error($tmp);
|
||||||
|
$error = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$db->hasTable('guilds')) {
|
||||||
|
$tmp = str_replace('$TABLE$', 'guilds', $locale['step_database_error_table']);
|
||||||
|
error($tmp);
|
||||||
|
$error = true;
|
||||||
|
}
|
||||||
|
|
||||||
if(!$error) {
|
if(!$error) {
|
||||||
|
$twig->display('install.installer.html.twig', array(
|
||||||
|
'url' => 'tools/5-database.php',
|
||||||
|
'message' => $locale['loading_spinner']
|
||||||
|
));
|
||||||
|
|
||||||
if(!Validator::email($_SESSION['var_mail_admin'])) {
|
if(!Validator::email($_SESSION['var_mail_admin'])) {
|
||||||
error($locale['step_config_mail_admin_error']);
|
error($locale['step_config_mail_admin_error']);
|
||||||
$error = true;
|
$error = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!Validator::email($_SESSION['var_mail_address'])) {
|
if(!Validator::email($_SESSION['var_mail_address'])) {
|
||||||
error($locale['step_config_mail_address_error']);
|
error($locale['step_config_mail_address_error']);
|
||||||
$error = true;
|
$error = true;
|
||||||
@@ -92,7 +111,7 @@ if(!$error) {
|
|||||||
unset($_SESSION['saved']);
|
unset($_SESSION['saved']);
|
||||||
|
|
||||||
$locale['step_database_error_file'] = str_replace('$FILE$', '<b>' . BASE . 'config.local.php</b>', $locale['step_database_error_file']);
|
$locale['step_database_error_file'] = str_replace('$FILE$', '<b>' . BASE . 'config.local.php</b>', $locale['step_database_error_file']);
|
||||||
warning($locale['step_database_error_file'] . '<br/>
|
error($locale['step_database_error_file'] . '<br/>
|
||||||
<textarea cols="70" rows="10">' . $content . '</textarea>');
|
<textarea cols="70" rows="10">' . $content . '</textarea>');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -103,6 +122,6 @@ if(!$error) {
|
|||||||
|
|
||||||
<form action="<?php echo BASE_URL; ?>install/" method="post">
|
<form action="<?php echo BASE_URL; ?>install/" method="post">
|
||||||
<input type="hidden" name="step" id="step" value="admin" />
|
<input type="hidden" name="step" id="step" value="admin" />
|
||||||
<?php echo next_buttons(true, $error ? false : true);
|
<?php echo next_buttons(true, !$error);
|
||||||
?>
|
?>
|
||||||
</form>
|
</form>
|
@@ -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'))
|
||||||
|
@@ -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>
|
||||||
|
@@ -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) {
|
||||||
@@ -23,24 +25,6 @@ if(!$error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$db->hasTable('accounts')) {
|
|
||||||
$locale['step_database_error_table'] = str_replace('$TABLE$', 'accounts', $locale['step_database_error_table']);
|
|
||||||
error($locale['step_database_error_table']);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!$db->hasTable('players')) {
|
|
||||||
$locale['step_database_error_table'] = str_replace('$TABLE$', 'players', $locale['step_database_error_table']);
|
|
||||||
error($locale['step_database_error_table']);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!$db->hasTable('guilds')) {
|
|
||||||
$locale['step_database_error_table'] = str_replace('$TABLE$', 'guilds', $locale['step_database_error_table']);
|
|
||||||
error($locale['step_database_error_table']);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($db->hasTable(TABLE_PREFIX . 'account_actions')) {
|
if($db->hasTable(TABLE_PREFIX . 'account_actions')) {
|
||||||
$locale['step_database_error_table_exist'] = str_replace('$TABLE$', TABLE_PREFIX . 'account_actions', $locale['step_database_error_table_exist']);
|
$locale['step_database_error_table_exist'] = str_replace('$TABLE$', TABLE_PREFIX . 'account_actions', $locale['step_database_error_table_exist']);
|
||||||
warning($locale['step_database_error_table_exist']);
|
warning($locale['step_database_error_table_exist']);
|
||||||
|
@@ -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'])) {
|
||||||
|
@@ -10,28 +10,27 @@ 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$ {
|
||||||
include snippets/fastcgi-php.conf;
|
include snippets/fastcgi-php.conf;
|
||||||
fastcgi_read_timeout 240;
|
fastcgi_read_timeout 240;
|
||||||
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
|
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
|
||||||
# for ubuntu 22.04+ it will be php8.1-fpm.-sock
|
# for ubuntu 22.04+ it will be php8.1-fpm.sock
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -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
|
||||||
|
|
||||||
|
@@ -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;
|
||||||
|
@@ -99,4 +99,14 @@ $config['clients'] = [
|
|||||||
1291,
|
1291,
|
||||||
|
|
||||||
1300,
|
1300,
|
||||||
|
1310,
|
||||||
|
1311,
|
||||||
|
1312,
|
||||||
|
1316,
|
||||||
|
1320,
|
||||||
|
1321,
|
||||||
|
1322,
|
||||||
|
1330,
|
||||||
|
1332,
|
||||||
|
1340,
|
||||||
];
|
];
|
||||||
|
@@ -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 {}
|
||||||
|
@@ -10,6 +10,14 @@
|
|||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
switch($page)
|
switch($page)
|
||||||
{
|
{
|
||||||
|
case 'adminpanel':
|
||||||
|
header('Location: ' . ADMIN_URL);
|
||||||
|
die;
|
||||||
|
|
||||||
|
case 'archive':
|
||||||
|
$page = 'newsarchive';
|
||||||
|
break;
|
||||||
|
|
||||||
case 'whoisonline':
|
case 'whoisonline':
|
||||||
$page = 'online';
|
$page = 'online';
|
||||||
break;
|
break;
|
||||||
@@ -37,4 +45,3 @@ switch($page)
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
@@ -51,4 +51,3 @@ else
|
|||||||
updateDatabaseConfig('views_counter', $views_counter); // update counter
|
updateDatabaseConfig('views_counter', $views_counter); // update counter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
@@ -116,5 +116,4 @@ defined('MYAAC') or die('Direct access not allowed!');
|
|||||||
'<li>MySQL is not configured propertly in <i>config.lua</i>.</li>' .
|
'<li>MySQL is not configured propertly in <i>config.lua</i>.</li>' .
|
||||||
'<li>MySQL server is not running.</li>' .
|
'<li>MySQL server is not running.</li>' .
|
||||||
'</ul>' . $error->getMessage());
|
'</ul>' . $error->getMessage());
|
||||||
|
|
||||||
}
|
}
|
@@ -23,6 +23,8 @@ function exception_handler($exception) {
|
|||||||
|
|
||||||
$backtrace_formatted = nl2br($exception->getTraceAsString());
|
$backtrace_formatted = nl2br($exception->getTraceAsString());
|
||||||
|
|
||||||
|
$message = $message . "<br/><br/>File: {$exception->getFile()}<br/>Line: {$exception->getLine()}";
|
||||||
|
|
||||||
// display basic error message without template
|
// display basic error message without template
|
||||||
// template is missing, why? probably someone deleted templates dir, or it wasn't downloaded right
|
// template is missing, why? probably someone deleted templates dir, or it wasn't downloaded right
|
||||||
$template_file = SYSTEM . 'templates/exception.html.twig';
|
$template_file = SYSTEM . 'templates/exception.html.twig';
|
||||||
@@ -35,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -7,11 +7,10 @@
|
|||||||
* @copyright 2019 MyAAC
|
* @copyright 2019 MyAAC
|
||||||
* @link https://my-aac.org
|
* @link https://my-aac.org
|
||||||
*/
|
*/
|
||||||
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
|
||||||
use Twig\Loader\ArrayLoader as Twig_ArrayLoader;
|
use Twig\Loader\ArrayLoader as Twig_ArrayLoader;
|
||||||
|
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
|
||||||
|
|
||||||
function message($message, $type, $return)
|
function message($message, $type, $return)
|
||||||
{
|
{
|
||||||
if(IS_CLI) {
|
if(IS_CLI) {
|
||||||
@@ -757,10 +756,10 @@ function get_browser_languages()
|
|||||||
{
|
{
|
||||||
$ret = array();
|
$ret = array();
|
||||||
|
|
||||||
$acceptLang = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
|
if(empty($_SERVER['HTTP_ACCEPT_LANGUAGE']))
|
||||||
if(!isset($acceptLang[0]))
|
|
||||||
return $ret;
|
return $ret;
|
||||||
|
|
||||||
|
$acceptLang = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
|
||||||
$languages = strtolower($acceptLang);
|
$languages = strtolower($acceptLang);
|
||||||
// $languages = 'pl,en-us;q=0.7,en;q=0.3 ';
|
// $languages = 'pl,en-us;q=0.7,en;q=0.3 ';
|
||||||
// need to remove spaces from strings to avoid error
|
// need to remove spaces from strings to avoid error
|
||||||
@@ -798,7 +797,7 @@ function get_plugins()
|
|||||||
$ret = array();
|
$ret = array();
|
||||||
|
|
||||||
$path = PLUGINS;
|
$path = PLUGINS;
|
||||||
foreach(scandir($path, 0) as $file) {
|
foreach(scandir($path, SCANDIR_SORT_ASCENDING) as $file) {
|
||||||
$file_ext = pathinfo($file, PATHINFO_EXTENSION);
|
$file_ext = pathinfo($file, PATHINFO_EXTENSION);
|
||||||
$file_name = pathinfo($file, PATHINFO_FILENAME);
|
$file_name = pathinfo($file, PATHINFO_FILENAME);
|
||||||
if ($file === '.' || $file === '..' || $file === 'disabled' || $file === 'example.json' || $file_ext !== 'json' || is_dir($path . $file))
|
if ($file === '.' || $file === '..' || $file === 'disabled' || $file === 'example.json' || $file_ext !== 'json' || is_dir($path . $file))
|
||||||
@@ -924,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();
|
||||||
@@ -1147,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);
|
||||||
@@ -1245,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
|
||||||
|
@@ -9,45 +9,60 @@
|
|||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
|
||||||
define('HOOK_STARTUP', 1);
|
$i = 0;
|
||||||
define('HOOK_BEFORE_PAGE', 2);
|
define('HOOK_STARTUP', ++$i);
|
||||||
define('HOOK_AFTER_PAGE', 3);
|
define('HOOK_BEFORE_PAGE', ++$i);
|
||||||
define('HOOK_FINISH', 4);
|
define('HOOK_AFTER_PAGE', ++$i);
|
||||||
define('HOOK_TIBIACOM_ARTICLE', 5);
|
define('HOOK_FINISH', ++$i);
|
||||||
define('HOOK_TIBIACOM_BORDER_3', 6);
|
define('HOOK_TIBIACOM_ARTICLE', ++$i);
|
||||||
define('HOOK_CHARACTERS_BEFORE_INFORMATIONS', 7);
|
define('HOOK_TIBIACOM_BORDER_3', ++$i);
|
||||||
define('HOOK_CHARACTERS_AFTER_INFORMATIONS', 8);
|
define('HOOK_CHARACTERS_BEFORE_INFORMATIONS', ++$i);
|
||||||
define('HOOK_CHARACTERS_BEFORE_SIGNATURE', 9);
|
define('HOOK_CHARACTERS_AFTER_INFORMATIONS', ++$i);
|
||||||
define('HOOK_CHARACTERS_AFTER_SIGNATURE', 10);
|
define('HOOK_CHARACTERS_BEFORE_SKILLS', ++$i);
|
||||||
define('HOOK_CHARACTERS_AFTER_ACCOUNT', 11);
|
define('HOOK_CHARACTERS_AFTER_SKILLS', ++$i);
|
||||||
define('HOOK_CHARACTERS_AFTER_CHARACTERS', 12);
|
define('HOOK_CHARACTERS_AFTER_QUESTS', ++$i);
|
||||||
define('HOOK_LOGIN', 13);
|
define('HOOK_CHARACTERS_AFTER_EQUIPMENT', ++$i);
|
||||||
define('HOOK_LOGIN_ATTEMPT', 14);
|
define('HOOK_CHARACTERS_BEFORE_DEATHS', ++$i);
|
||||||
define('HOOK_LOGOUT', 15);
|
define('HOOK_CHARACTERS_BEFORE_SIGNATURE', ++$i);
|
||||||
define('HOOK_ACCOUNT_CREATE_BEFORE_FORM', 16);
|
define('HOOK_CHARACTERS_AFTER_SIGNATURE', ++$i);
|
||||||
define('HOOK_ACCOUNT_CREATE_BEFORE_BOXES', 17);
|
define('HOOK_CHARACTERS_AFTER_ACCOUNT', ++$i);
|
||||||
define('HOOK_ACCOUNT_CREATE_BETWEEN_BOXES_1', 18);
|
define('HOOK_CHARACTERS_AFTER_CHARACTERS', ++$i);
|
||||||
define('HOOK_ACCOUNT_CREATE_BETWEEN_BOXES_2', 19);
|
define('HOOK_LOGIN', ++$i);
|
||||||
define('HOOK_ACCOUNT_CREATE_AFTER_BOXES', 20);
|
define('HOOK_LOGIN_ATTEMPT', ++$i);
|
||||||
define('HOOK_ACCOUNT_CREATE_BEFORE_ACCOUNT', 21);
|
define('HOOK_LOGOUT', ++$i);
|
||||||
define('HOOK_ACCOUNT_CREATE_AFTER_ACCOUNT', 22);
|
define('HOOK_ACCOUNT_CREATE_BEFORE_FORM', ++$i);
|
||||||
define('HOOK_ACCOUNT_CREATE_AFTER_EMAIL', 23);
|
define('HOOK_ACCOUNT_CREATE_BEFORE_BOXES', ++$i);
|
||||||
define('HOOK_ACCOUNT_CREATE_AFTER_COUNTRY', 24);
|
define('HOOK_ACCOUNT_CREATE_BETWEEN_BOXES_1', ++$i);
|
||||||
define('HOOK_ACCOUNT_CREATE_AFTER_PASSWORDS', 25);
|
define('HOOK_ACCOUNT_CREATE_BETWEEN_BOXES_2', ++$i);
|
||||||
define('HOOK_ACCOUNT_CREATE_AFTER_RECAPTCHA', 26);
|
define('HOOK_ACCOUNT_CREATE_AFTER_BOXES', ++$i);
|
||||||
define('HOOK_ACCOUNT_CREATE_BEFORE_CHARACTER_NAME', 27);
|
define('HOOK_ACCOUNT_CREATE_BEFORE_ACCOUNT', ++$i);
|
||||||
define('HOOK_ACCOUNT_CREATE_AFTER_CHARACTER_NAME', 28);
|
define('HOOK_ACCOUNT_CREATE_AFTER_ACCOUNT', ++$i);
|
||||||
define('HOOK_ACCOUNT_CREATE_AFTER_SEX', 29);
|
define('HOOK_ACCOUNT_CREATE_AFTER_EMAIL', ++$i);
|
||||||
define('HOOK_ACCOUNT_CREATE_AFTER_VOCATION', 30);
|
define('HOOK_ACCOUNT_CREATE_AFTER_COUNTRY', ++$i);
|
||||||
define('HOOK_ACCOUNT_CREATE_AFTER_TOWNS', 31);
|
define('HOOK_ACCOUNT_CREATE_AFTER_PASSWORDS', ++$i);
|
||||||
define('HOOK_ACCOUNT_CREATE_BEFORE_SUBMIT_BUTTON', 32);
|
define('HOOK_ACCOUNT_CREATE_AFTER_RECAPTCHA', ++$i);
|
||||||
define('HOOK_ACCOUNT_CREATE_AFTER_FORM', 33);
|
define('HOOK_ACCOUNT_CREATE_BEFORE_CHARACTER_NAME', ++$i);
|
||||||
define('HOOK_ACCOUNT_CREATE_AFTER_SUBMIT', 34);
|
define('HOOK_ACCOUNT_CREATE_AFTER_CHARACTER_NAME', ++$i);
|
||||||
define('HOOK_EMAIL_CONFIRMED', 35);
|
define('HOOK_ACCOUNT_CREATE_AFTER_SEX', ++$i);
|
||||||
|
define('HOOK_ACCOUNT_CREATE_AFTER_VOCATION', ++$i);
|
||||||
|
define('HOOK_ACCOUNT_CREATE_AFTER_TOWNS', ++$i);
|
||||||
|
define('HOOK_ACCOUNT_CREATE_BEFORE_SUBMIT_BUTTON', ++$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_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_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;
|
||||||
@@ -68,9 +83,7 @@ class Hook
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
global $db, $config, $template_path, $ots, $content, $twig;
|
global $db, $config, $template_path, $ots, $content, $twig;
|
||||||
if(file_exists(BASE . $this->_file)) {
|
$ret = include BASE . $this->_file;
|
||||||
$ret = require BASE . $this->_file;
|
|
||||||
}
|
|
||||||
|
|
||||||
return !isset($ret) || $ret == 1 || $ret;
|
return !isset($ret) || $ret == 1 || $ret;
|
||||||
}
|
}
|
||||||
|
@@ -28,12 +28,10 @@ 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();
|
||||||
|
|
||||||
// twig
|
|
||||||
require_once SYSTEM . 'twig.php';
|
|
||||||
|
|
||||||
// trim values we receive
|
// trim values we receive
|
||||||
if(isset($_POST))
|
if(isset($_POST))
|
||||||
{
|
{
|
||||||
@@ -76,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);
|
||||||
@@ -114,18 +112,21 @@ if(!isset($foundValue)) {
|
|||||||
$config['data_path'] = $foundValue;
|
$config['data_path'] = $foundValue;
|
||||||
unset($foundValue);
|
unset($foundValue);
|
||||||
|
|
||||||
// new config values for compability
|
// new config values for compatibility
|
||||||
if(!isset($config['highscores_ids_hidden']) || count($config['highscores_ids_hidden']) == 0) {
|
if(!isset($config['highscores_ids_hidden']) || count($config['highscores_ids_hidden']) == 0) {
|
||||||
$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';
|
||||||
$ots = POT::getInstance();
|
$ots = POT::getInstance();
|
||||||
require_once SYSTEM . 'database.php';
|
require_once SYSTEM . 'database.php';
|
||||||
|
|
||||||
|
// twig
|
||||||
|
require_once SYSTEM . 'twig.php';
|
||||||
|
|
||||||
define('USE_ACCOUNT_NAME', $db->hasColumn('accounts', 'name'));
|
define('USE_ACCOUNT_NAME', $db->hasColumn('accounts', 'name'));
|
||||||
// load vocation names
|
// load vocation names
|
||||||
$tmp = '';
|
$tmp = '';
|
||||||
|
@@ -58,4 +58,3 @@ function outputItem($id = 100, $count = 1)
|
|||||||
$file_name = Items_Images::$outputDir . $file_name . '.gif';
|
$file_name = Items_Images::$outputDir . $file_name . '.gif';
|
||||||
readfile($file_name);
|
readfile($file_name);
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
@@ -138,7 +138,7 @@ class CreateCharacter
|
|||||||
|
|
||||||
if(empty($errors))
|
if(empty($errors))
|
||||||
{
|
{
|
||||||
$number_of_players_on_account = $account->getPlayersList(false)->count();
|
$number_of_players_on_account = $account->getPlayersList(true)->count();
|
||||||
if($number_of_players_on_account >= config('characters_per_account'))
|
if($number_of_players_on_account >= config('characters_per_account'))
|
||||||
$errors[] = 'You have too many characters on your account <b>('.$number_of_players_on_account.'/'.config('characters_per_account').')</b>!';
|
$errors[] = 'You have too many characters on your account <b>('.$number_of_players_on_account.'/'.config('characters_per_account').')</b>!';
|
||||||
}
|
}
|
||||||
@@ -252,10 +252,12 @@ class CreateCharacter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$loaded_items_to_copy = $db->query("SELECT * FROM player_items WHERE player_id = ".$char_to_copy->getId()."");
|
if ($db->hasTable('player_items') && $db->hasColumn('player_items', 'pid') && $db->hasColumn('player_items', 'sid') && $db->hasColumn('player_items', 'itemtype')) {
|
||||||
foreach($loaded_items_to_copy as $save_item) {
|
$loaded_items_to_copy = $db->query("SELECT * FROM player_items WHERE player_id = ".$char_to_copy->getId()."");
|
||||||
$blob = $db->quote($save_item['attributes']);
|
foreach($loaded_items_to_copy as $save_item) {
|
||||||
$db->query("INSERT INTO `player_items` (`player_id` ,`pid` ,`sid` ,`itemtype`, `count`, `attributes`) VALUES ('".$player->getId()."', '".$save_item['pid']."', '".$save_item['sid']."', '".$save_item['itemtype']."', '".$save_item['count']."', $blob);");
|
$blob = $db->quote($save_item['attributes']);
|
||||||
|
$db->query("INSERT INTO `player_items` (`player_id` ,`pid` ,`sid` ,`itemtype`, `count`, `attributes`) VALUES ('".$player->getId()."', '".$save_item['pid']."', '".$save_item['sid']."', '".$save_item['itemtype']."', '".$save_item['count']."', $blob);");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
global $twig;
|
global $twig;
|
||||||
|
36
system/libs/TwigTypeCastingExtension.php
Normal file
36
system/libs/TwigTypeCastingExtension.php
Normal 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;
|
||||||
|
}),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
@@ -110,4 +110,21 @@ class Cache
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function enabled() {return false;}
|
public function enabled() {return false;}
|
||||||
|
|
||||||
|
public static function remember($key, $ttl, $callback)
|
||||||
|
{
|
||||||
|
$cache = self::getInstance();
|
||||||
|
if(!$cache->enabled()) {
|
||||||
|
return $callback();
|
||||||
|
}
|
||||||
|
|
||||||
|
$value = null;
|
||||||
|
if ($cache->fetch($key, $value)) {
|
||||||
|
return unserialize($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
$value = $callback();
|
||||||
|
$cache->set($key, serialize($value),$ttl);
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -41,4 +41,3 @@ class Data
|
|||||||
return $db->update($this->table, $data, $where);
|
return $db->update($this->table, $data, $where);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
@@ -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)
|
||||||
|
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -32,5 +32,3 @@ class E_OTS_ErrorCode extends Exception
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
?>
|
|
||||||
|
@@ -36,5 +36,3 @@ class E_OTS_Generic extends E_OTS_ErrorCode
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
?>
|
|
||||||
|
@@ -22,5 +22,3 @@ class E_OTS_NotAContainer extends Exception
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
?>
|
|
||||||
|
@@ -32,5 +32,3 @@ class E_OTS_OTBMError extends E_OTS_ErrorCode
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
?>
|
|
||||||
|
@@ -22,5 +22,3 @@ class E_OTS_ReadOnly extends Exception
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
?>
|
|
||||||
|
@@ -37,5 +37,3 @@ interface IOTS_Cipher
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
?>
|
|
||||||
|
@@ -89,5 +89,3 @@ interface IOTS_DataDisplay
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
?>
|
|
||||||
|
@@ -96,5 +96,3 @@ interface IOTS_Display
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
?>
|
|
||||||
|
@@ -67,5 +67,3 @@ interface IOTS_GuildAction
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
?>
|
|
||||||
|
@@ -922,7 +922,7 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
$access = 0;
|
$access = 0;
|
||||||
|
|
||||||
// finds ranks of all characters
|
// finds ranks of all characters
|
||||||
foreach($this->getPlayersList() as $player)
|
foreach($this->getPlayersList(false) as $player)
|
||||||
{
|
{
|
||||||
$rank = $player->getRank();
|
$rank = $player->getRank();
|
||||||
|
|
||||||
@@ -1126,5 +1126,3 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
?>
|
|
||||||
|
@@ -34,5 +34,3 @@ class OTS_AccountBans_List extends OTS_Bans_List
|
|||||||
$this->setFilter($filter);
|
$this->setFilter($filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
||||||
|
@@ -735,5 +735,3 @@ class OTS_Admin
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
?>
|
|
||||||
|
@@ -100,5 +100,3 @@ class OTS_Bans_List extends OTS_Base_List
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
||||||
|
@@ -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.
|
||||||
*
|
*
|
||||||
@@ -248,5 +278,3 @@ abstract class OTS_Base_DB extends PDO implements IOTS_DB
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
?>
|
|
||||||
|
@@ -146,5 +146,3 @@ class OTS_BinaryTools
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
?>
|
|
||||||
|
@@ -149,5 +149,3 @@ class OTS_Container extends OTS_Item implements IteratorAggregate
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
?>
|
|
||||||
|
@@ -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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -357,5 +357,3 @@ class OTS_FileLoader
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
?>
|
|
||||||
|
@@ -671,5 +671,3 @@ class OTS_Group extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
?>
|
|
||||||
|
@@ -837,5 +837,3 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
?>
|
|
||||||
|
@@ -72,5 +72,3 @@ class OTS_GuildRanks_List extends OTS_Base_List
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
?>
|
|
||||||
|
@@ -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)
|
||||||
@@ -529,5 +524,3 @@ class OTS_House extends OTS_Row_DAO
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
?>
|
|
||||||
|
@@ -34,5 +34,3 @@ class OTS_IPBans_List extends OTS_Bans_List
|
|||||||
$this->setFilter($filter);
|
$this->setFilter($filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
||||||
|
@@ -387,5 +387,3 @@ class OTS_InfoRespond extends DOMDocument
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
?>
|
|
||||||
|
@@ -676,5 +676,3 @@ class OTS_ItemsList extends OTS_FileLoader implements IteratorAggregate, Countab
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
?>
|
|
||||||
|
@@ -130,5 +130,3 @@ class OTS_MapCoords
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
?>
|
|
||||||
|
@@ -129,20 +129,21 @@ class OTS_Monster extends DOMDocument
|
|||||||
* @return array Flags.
|
* @return array Flags.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
public function getFlags()
|
public function getFlags()
|
||||||
{
|
{
|
||||||
$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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns specified flag value.
|
* Returns specified flag value.
|
||||||
|
@@ -299,5 +299,3 @@ class OTS_MonstersList implements Iterator, Countable, ArrayAccess
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
?>
|
|
||||||
|
@@ -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.
|
||||||
*
|
*
|
||||||
@@ -763,21 +765,29 @@ class OTS_Player extends OTS_Row_DAO
|
|||||||
$this->data['deleted'] = (int) $deleted;
|
$this->data['deleted'] = (int) $deleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
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']) )
|
||||||
{
|
{
|
||||||
throw new E_OTS_NotLoaded();
|
throw new E_OTS_NotLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->data['online'] == 1;
|
return $this->data['online'] == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCreated()
|
public function getCreated()
|
||||||
{
|
{
|
||||||
@@ -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'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3627,5 +3632,3 @@ class OTS_Player extends OTS_Row_DAO
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
?>
|
|
||||||
|
@@ -34,5 +34,3 @@ class OTS_PlayerBans_List extends OTS_Bans_List
|
|||||||
$this->setFilter($filter);
|
$this->setFilter($filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
||||||
|
@@ -75,5 +75,3 @@ abstract class OTS_Row_DAO extends OTS_Base_DAO
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
?>
|
|
||||||
|
@@ -121,5 +121,3 @@ class OTS_SQLField
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
?>
|
|
||||||
|
@@ -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;
|
||||||
@@ -227,5 +227,3 @@ class OTS_ServerInfo
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
?>
|
|
||||||
|
@@ -482,5 +482,3 @@ class OTS_Spell
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
?>
|
|
||||||
|
@@ -113,5 +113,3 @@ class OTS_Toolbox
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
?>
|
|
||||||
|
@@ -151,5 +151,3 @@ class OTS_XTEA implements IOTS_Cipher
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
?>
|
|
||||||
|
@@ -282,4 +282,3 @@ class TokenAuth6238 {
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
5
system/libs/src/Cache.php
Normal file
5
system/libs/src/Cache.php
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace MyAAC;
|
||||||
|
|
||||||
|
class Cache extends \Cache {}
|
5
system/libs/src/Plugins.php
Normal file
5
system/libs/src/Plugins.php
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace MyAAC;
|
||||||
|
|
||||||
|
class Plugins extends \Plugins {}
|
@@ -432,4 +432,3 @@ class Validator
|
|||||||
return self::$lastError;
|
return self::$lastError;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
@@ -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
|
||||||
|
@@ -6,4 +6,3 @@
|
|||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
*/
|
*/
|
||||||
$locale['title'] = 'MyAAC Admin';
|
$locale['title'] = 'MyAAC Admin';
|
||||||
?>
|
|
||||||
|
@@ -12,4 +12,3 @@ $locale['direction']= 'ltr';
|
|||||||
|
|
||||||
$locale['error404'] = 'Diese Seite konnte nicht gefunden werden.';
|
$locale['error404'] = 'Diese Seite konnte nicht gefunden werden.';
|
||||||
$locale['news'] = 'Neuesten Nachrichten';
|
$locale['news'] = 'Neuesten Nachrichten';
|
||||||
?>
|
|
@@ -123,4 +123,3 @@ $locale['step_finish_title'] = 'Installation finished!';
|
|||||||
$locale['step_finish_desc'] = 'Congratulations! <b>MyAAC</b> is ready to use!<br/>You can now login to $ADMIN_PANEL$, or visit $HOMEPAGE$.<br/><br/>
|
$locale['step_finish_desc'] = 'Congratulations! <b>MyAAC</b> is ready to use!<br/>You can now login to $ADMIN_PANEL$, or visit $HOMEPAGE$.<br/><br/>
|
||||||
<span style="color: red">Please delete install/ directory.</span><br/><br/>
|
<span style="color: red">Please delete install/ directory.</span><br/><br/>
|
||||||
Post bugs and suggestions at $LINK$, thanks!';
|
Post bugs and suggestions at $LINK$, thanks!';
|
||||||
?>
|
|
||||||
|
@@ -6,4 +6,3 @@
|
|||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
*/
|
*/
|
||||||
$locale['title'] = 'MyAAC Admin';
|
$locale['title'] = 'MyAAC Admin';
|
||||||
?>
|
|
||||||
|
@@ -12,4 +12,3 @@ $locale['direction']= 'ltr';
|
|||||||
|
|
||||||
$locale['error404'] = 'Strona nie została odnaleziona.';
|
$locale['error404'] = 'Strona nie została odnaleziona.';
|
||||||
$locale['news'] = 'Ostatnie newsy';
|
$locale['news'] = 'Ostatnie newsy';
|
||||||
?>
|
|
@@ -121,4 +121,3 @@ $locale['step_finish'] = 'Finalizar';
|
|||||||
$locale['step_finish_title'] = 'Instalação terminada!';
|
$locale['step_finish_title'] = 'Instalação terminada!';
|
||||||
$locale['step_finish_desc'] = 'Parabéns! <b>MyAAC</b> está pronto para uso!<br/>Agora você pode fazer login em $ADMIN_PANEL$ ou visitar $HOMEPAGE$.<br/><br/>
|
$locale['step_finish_desc'] = 'Parabéns! <b>MyAAC</b> está pronto para uso!<br/>Agora você pode fazer login em $ADMIN_PANEL$ ou visitar $HOMEPAGE$.<br/><br/>
|
||||||
<span style = "color: red">Por favor remova a pasta install/.</span><br/><br/>Postar bugs e sugestões em $LINK$, obrigado!';
|
<span style = "color: red">Por favor remova a pasta install/.</span><br/><br/>Postar bugs e sugestões em $LINK$, obrigado!';
|
||||||
?>
|
|
||||||
|
@@ -6,4 +6,3 @@
|
|||||||
* @author Sizaro <sizaro@live.se>
|
* @author Sizaro <sizaro@live.se>
|
||||||
*/
|
*/
|
||||||
$locale['title'] = 'MyAAC Admin';
|
$locale['title'] = 'MyAAC Admin';
|
||||||
?>
|
|
||||||
|
@@ -12,4 +12,3 @@ $locale['direction']= 'ltr';
|
|||||||
|
|
||||||
$locale['error404'] = 'Sidan kunde inte hittas.';
|
$locale['error404'] = 'Sidan kunde inte hittas.';
|
||||||
$locale['news'] = 'Senaste nyheterna';
|
$locale['news'] = 'Senaste nyheterna';
|
||||||
?>
|
|
@@ -10,6 +10,7 @@
|
|||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
$logged = false;
|
$logged = false;
|
||||||
$logged_flags = 0;
|
$logged_flags = 0;
|
||||||
|
$account_logged = new OTS_Account();
|
||||||
|
|
||||||
$action = isset($_REQUEST['action']) ? strtolower($_REQUEST['action']) : '';
|
$action = isset($_REQUEST['action']) ? strtolower($_REQUEST['action']) : '';
|
||||||
if(!defined('ACTION')) {
|
if(!defined('ACTION')) {
|
||||||
@@ -20,7 +21,6 @@ if(!defined('ACTION')) {
|
|||||||
$current_session = getSession('account');
|
$current_session = getSession('account');
|
||||||
if($current_session !== false)
|
if($current_session !== false)
|
||||||
{
|
{
|
||||||
$account_logged = new OTS_Account();
|
|
||||||
$account_logged->load($current_session);
|
$account_logged->load($current_session);
|
||||||
if($account_logged->isLoaded() && $account_logged->getPassword() == getSession('password')
|
if($account_logged->isLoaded() && $account_logged->getPassword() == getSession('password')
|
||||||
//&& (!isset($_SESSION['admin']) || admin())
|
//&& (!isset($_SESSION['admin']) || admin())
|
||||||
@@ -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,11 +74,10 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
$account_logged = new OTS_Account();
|
|
||||||
if(USE_ACCOUNT_NAME)
|
if(USE_ACCOUNT_NAME)
|
||||||
$account_logged->find($login_account);
|
$account_logged->find($login_account);
|
||||||
else
|
else
|
||||||
@@ -95,27 +88,32 @@ else
|
|||||||
&& (!isset($t) || $t['attempts'] < 5)
|
&& (!isset($t) || $t['attempts'] < 5)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
setSession('account', $account_logged->getId());
|
if (config('mail_enabled') && config('account_mail_verify') && (int)$account_logged->getCustomField('email_verified') !== 1) {
|
||||||
setSession('password', encrypt(($config_salt_enabled ? $account_logged->getCustomField('salt') : '') . $login_password));
|
$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.';
|
||||||
if($remember_me) {
|
|
||||||
setSession('remember_me', true);
|
|
||||||
}
|
|
||||||
|
|
||||||
$logged = true;
|
|
||||||
$logged_flags = $account_logged->getWebFlags();
|
|
||||||
|
|
||||||
if(isset($_POST['admin']) && !admin()) {
|
|
||||||
$errors[] = 'This account has no admin privileges.';
|
|
||||||
unsetSession('account');
|
|
||||||
unsetSession('password');
|
|
||||||
unsetSession('remember_me');
|
|
||||||
$logged = false;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$account_logged->setCustomField('web_lastlogin', time());
|
session_regenerate_id();
|
||||||
}
|
setSession('account', $account_logged->getId());
|
||||||
|
setSession('password', encrypt(($config_salt_enabled ? $account_logged->getCustomField('salt') : '') . $login_password));
|
||||||
|
if ($remember_me) {
|
||||||
|
setSession('remember_me', true);
|
||||||
|
}
|
||||||
|
|
||||||
$hooks->trigger(HOOK_LOGIN, array('account' => $account_logged, 'password' => $login_password, 'remember_me' => $remember_me));
|
$logged = true;
|
||||||
|
$logged_flags = $account_logged->getWebFlags();
|
||||||
|
|
||||||
|
if (isset($_POST['admin']) && !admin()) {
|
||||||
|
$errors[] = 'This account has no admin privileges.';
|
||||||
|
unsetSession('account');
|
||||||
|
unsetSession('password');
|
||||||
|
unsetSession('remember_me');
|
||||||
|
$logged = false;
|
||||||
|
} else {
|
||||||
|
$account_logged->setCustomField('web_lastlogin', time());
|
||||||
|
}
|
||||||
|
|
||||||
|
$hooks->trigger(HOOK_LOGIN, array('account' => $account_logged, 'password' => $login_password, 'remember_me' => $remember_me));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -17,4 +17,3 @@
|
|||||||
'thumb' => str_replace('/screenshots/', '/gallery/', $item['thumb']),
|
'thumb' => str_replace('/screenshots/', '/gallery/', $item['thumb']),
|
||||||
), array('id' => $item['id']));
|
), array('id' => $item['id']));
|
||||||
}
|
}
|
||||||
?>
|
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user