Compare commits
403 Commits
v0.8.23
...
feature/ne
Author | SHA1 | Date | |
---|---|---|---|
![]() |
a8c65a7ab9 | ||
![]() |
b60f345ae5 | ||
![]() |
b82c021ff7 | ||
![]() |
d0c479d11d | ||
![]() |
577f9b7373 | ||
![]() |
3700875c47 | ||
![]() |
5747fb5723 | ||
![]() |
a846d8a7e7 | ||
![]() |
3fb30f6391 | ||
![]() |
91c6ef1ddf | ||
![]() |
098beb9d46 | ||
![]() |
fb17d2e060 | ||
![]() |
513ca3830b | ||
![]() |
17eb5426e3 | ||
![]() |
b918f88776 | ||
![]() |
4eb9bbbbcf | ||
![]() |
56bd2c86b7 | ||
![]() |
94719b45b2 | ||
![]() |
958681bdc9 | ||
![]() |
c1eb7d4f52 | ||
![]() |
ea09b6a91b | ||
![]() |
58bc0a7c28 | ||
![]() |
35a660be7d | ||
![]() |
07a03c38b3 | ||
![]() |
6b54ac65ca | ||
![]() |
070b04afa9 | ||
![]() |
039ddc7967 | ||
![]() |
9fa65ce7a4 | ||
![]() |
6aa28a3002 | ||
![]() |
938d01eb00 | ||
![]() |
e0347f252c | ||
![]() |
bf3362dc1b | ||
![]() |
ec38a79235 | ||
![]() |
eaec00122b | ||
![]() |
7e62bd74a3 | ||
![]() |
6c5215a8ed | ||
![]() |
eb4ea48641 | ||
![]() |
a0ccbbe8c2 | ||
![]() |
63d2c5c6b5 | ||
![]() |
7d38945e8d | ||
![]() |
53732005aa | ||
![]() |
c4a5cae988 | ||
![]() |
69a92fb859 | ||
![]() |
9fadba7d07 | ||
![]() |
a080b21408 | ||
![]() |
11768424a3 | ||
![]() |
a2fb9a183b | ||
![]() |
295c5de0d6 | ||
![]() |
d4650afa0e | ||
![]() |
07da4ca028 | ||
![]() |
feffdd1837 | ||
![]() |
979532d3df | ||
![]() |
3c77c54c8e | ||
![]() |
74d013049d | ||
![]() |
708aa2d72f | ||
![]() |
dd6581f7f7 | ||
![]() |
8c801dddec | ||
![]() |
9de8145f82 | ||
![]() |
77460b0832 | ||
![]() |
1fb1fb3ae9 | ||
![]() |
1d1e927d56 | ||
![]() |
036abf83e5 | ||
![]() |
e737cf612c | ||
![]() |
78622fb47a | ||
![]() |
9560494ab0 | ||
![]() |
8aac3ec2e5 | ||
![]() |
269ca501f1 | ||
![]() |
07887423c6 | ||
![]() |
35928fe576 | ||
![]() |
60f64e21d8 | ||
![]() |
20638f430a | ||
![]() |
7bfa21a239 | ||
![]() |
8af786902d | ||
![]() |
ba04536169 | ||
![]() |
c646dc124b | ||
![]() |
2eb9f4d284 | ||
![]() |
cdc06056c8 | ||
![]() |
acb551c5b0 | ||
![]() |
44a6400fcf | ||
![]() |
847c3db625 | ||
![]() |
f30181d485 | ||
![]() |
118e8c487e | ||
![]() |
c73e476e88 | ||
![]() |
ac5b864ea9 | ||
![]() |
42d531838c | ||
![]() |
1be1bc9178 | ||
![]() |
2321cf84b0 | ||
![]() |
a570363fe0 | ||
![]() |
48d561ac6f | ||
![]() |
616b8eb61a | ||
![]() |
e1d486c8c8 | ||
![]() |
b841c9f631 | ||
![]() |
e6c72efd18 | ||
![]() |
9693fd260c | ||
![]() |
731755f05a | ||
![]() |
717b5fdd15 | ||
![]() |
32cf487128 | ||
![]() |
a9941dea8a | ||
![]() |
5c9737f281 | ||
![]() |
87a98531d9 | ||
![]() |
6d142dcbfe | ||
![]() |
90f00e9960 | ||
![]() |
8711e178e9 | ||
![]() |
eb28b38709 | ||
![]() |
afea618867 | ||
![]() |
0abb9384a6 | ||
![]() |
2563583f84 | ||
![]() |
6acbbe3fa1 | ||
![]() |
6c157f3f6c | ||
![]() |
c4737eca72 | ||
![]() |
5428f5e2cf | ||
![]() |
7d6d77cfbc | ||
![]() |
87eacd17c5 | ||
![]() |
dd4420dcfd | ||
![]() |
b8843a29eb | ||
![]() |
de3eaacf60 | ||
![]() |
bb699ffef2 | ||
![]() |
a12262df55 | ||
![]() |
34fa672c0f | ||
![]() |
091828e8f1 | ||
![]() |
8bca099037 | ||
![]() |
a43d641b5f | ||
![]() |
46c058df25 | ||
![]() |
fa7c6497e6 | ||
![]() |
f74c1ac247 | ||
![]() |
82b41d4df5 | ||
![]() |
0af595a5a6 | ||
![]() |
10eb9e7ff0 | ||
![]() |
1d163279ce | ||
![]() |
8cac9af966 | ||
![]() |
7008c9f4d8 | ||
![]() |
468f59fbec | ||
![]() |
fd2c2d552a | ||
![]() |
78ae456b45 | ||
![]() |
7e5528b7e1 | ||
![]() |
a97f55e189 | ||
![]() |
50dd65c6de | ||
![]() |
16aeb12111 | ||
![]() |
96a7c43cb5 | ||
![]() |
ee20ee2ecd | ||
![]() |
efdd156d5e | ||
![]() |
be41023005 | ||
![]() |
d143f05bb1 | ||
![]() |
fdc229b196 | ||
![]() |
f6a5552296 | ||
![]() |
62a4b4d3ec | ||
![]() |
ef24d6739a | ||
![]() |
1831198349 | ||
![]() |
ddf764e308 | ||
![]() |
988c757ca6 | ||
![]() |
cedcd14550 | ||
![]() |
0ff290f868 | ||
![]() |
bebe6892d0 | ||
![]() |
1764ce0519 | ||
![]() |
f3b49d7cba | ||
![]() |
6d19d69d20 | ||
![]() |
9ad367370a | ||
![]() |
eb091e487d | ||
![]() |
a5ccc794bc | ||
![]() |
1427dc3ede | ||
![]() |
e47bb11883 | ||
![]() |
6f3ba9c34b | ||
![]() |
a8e65b72a4 | ||
![]() |
0f3d2424ce | ||
![]() |
8ecd8a10c0 | ||
![]() |
3cc3e3a8e9 | ||
![]() |
be1086bcba | ||
![]() |
f9abe9a8e3 | ||
![]() |
632ecb6d20 | ||
![]() |
db554df041 | ||
![]() |
e52a301d9e | ||
![]() |
cf04c1df02 | ||
![]() |
98f6b03747 | ||
![]() |
9d5665a476 | ||
![]() |
3eb5810526 | ||
![]() |
26d0c2a359 | ||
![]() |
073cf80812 | ||
![]() |
7300e4f1ad | ||
![]() |
9b84532e57 | ||
![]() |
14870d74df | ||
![]() |
9c7794fe13 | ||
![]() |
d9526d4021 | ||
![]() |
454e09ec3d | ||
![]() |
c687f64ced | ||
![]() |
80623580f2 | ||
![]() |
135f393fc4 | ||
![]() |
e03da2876c | ||
![]() |
44fff9dcd1 | ||
![]() |
02f993baea | ||
![]() |
f9302d4f9d | ||
![]() |
780f8d193f | ||
![]() |
4e85f857a4 | ||
![]() |
ea035136e1 | ||
![]() |
9d8f398d9f | ||
![]() |
31f0050f4e | ||
![]() |
7ce005341e | ||
![]() |
84447ef178 | ||
![]() |
b99d3b4960 | ||
![]() |
0fc64478e0 | ||
![]() |
e7a3d563aa | ||
![]() |
bda020ef93 | ||
![]() |
f0c136c421 | ||
![]() |
5fa1321619 | ||
![]() |
792ec17d18 | ||
![]() |
19ffd57b34 | ||
![]() |
ebda456862 | ||
![]() |
5bd5aa0edf | ||
![]() |
6b07d56627 | ||
![]() |
15d381adfd | ||
![]() |
23b44d6c8a | ||
![]() |
e3f2abc06e | ||
![]() |
3d73de13d8 | ||
![]() |
71f7bb2e75 | ||
![]() |
ebe900fca8 | ||
![]() |
5a8bcec014 | ||
![]() |
a1c7c2768c | ||
![]() |
565e6e3a3d | ||
![]() |
855e9aa3b9 | ||
![]() |
a271edec47 | ||
![]() |
81b293a5a6 | ||
![]() |
8b41e144f8 | ||
![]() |
a41f653e05 | ||
![]() |
f24ff295e8 | ||
![]() |
b399bee3ac | ||
![]() |
8f88c82a13 | ||
![]() |
d8ac88b7d9 | ||
![]() |
443c5a80b4 | ||
![]() |
ba56ef5e33 | ||
![]() |
b24370e7ed | ||
![]() |
b2b0b31168 | ||
![]() |
1e969f8d8a | ||
![]() |
bca098e074 | ||
![]() |
98bd51436b | ||
![]() |
1fa4b1e660 | ||
![]() |
04a36b1d11 | ||
![]() |
611d6f505d | ||
![]() |
62b485abf9 | ||
![]() |
61eae7d7c4 | ||
![]() |
af161b5143 | ||
![]() |
d5880eac8c | ||
![]() |
02d6ab5fe7 | ||
![]() |
5547ccffd6 | ||
![]() |
8c06bd1738 | ||
![]() |
469a8c1017 | ||
![]() |
bb3602073c | ||
![]() |
6c6af59b22 | ||
![]() |
a8a36c73e6 | ||
![]() |
98b1d854f9 | ||
![]() |
1ada2317fd | ||
![]() |
40722c8c30 | ||
![]() |
ff9e255f1b | ||
![]() |
fbe9c31d10 | ||
![]() |
0aed705a6a | ||
![]() |
06e864c954 | ||
![]() |
1d68d013df | ||
![]() |
8e6bc73ca6 | ||
![]() |
7e0fded595 | ||
![]() |
c8443228fb | ||
![]() |
64fe0062ee | ||
![]() |
3b78516ef2 | ||
![]() |
8f345126f7 | ||
![]() |
daaa472dfe | ||
![]() |
87f35da3b6 | ||
![]() |
6f42a60e59 | ||
![]() |
3beedc1747 | ||
![]() |
6603815a81 | ||
![]() |
c1027d3663 | ||
![]() |
6cec5ba5bf | ||
![]() |
d70b70b63c | ||
![]() |
7d73e3cd98 | ||
![]() |
5087fc4a00 | ||
![]() |
30cdb1ba73 | ||
![]() |
0f6612904e | ||
![]() |
e5b5b4d3ef | ||
![]() |
9bc63bb55c | ||
![]() |
dcf83d5608 | ||
![]() |
8fe82bb5c0 | ||
![]() |
6f74029d76 | ||
![]() |
01e3d366ba | ||
![]() |
41d5b4a22f | ||
![]() |
7814636caf | ||
![]() |
cf2c5e36bc | ||
![]() |
5d5875d540 | ||
![]() |
95c2adc02e | ||
![]() |
73f1ba10f9 | ||
![]() |
9fe419cfe7 | ||
![]() |
41e24ca535 | ||
![]() |
42a628731d | ||
![]() |
2ba702df21 | ||
![]() |
0171962306 | ||
![]() |
2daa42e124 | ||
![]() |
abfd2c94f5 | ||
![]() |
fd51fa7779 | ||
![]() |
1a36aa8904 | ||
![]() |
881a28138a | ||
![]() |
26fb1698b8 | ||
![]() |
13d7dd98bd | ||
![]() |
672a9f1712 | ||
![]() |
2e560ac081 | ||
![]() |
39d1127cf1 | ||
![]() |
13586e664f | ||
![]() |
6e6db543f7 | ||
![]() |
ea8ae2372e | ||
![]() |
928de13459 | ||
![]() |
e213c3e7d8 | ||
![]() |
65b4b2d183 | ||
![]() |
94b145b215 | ||
![]() |
6c9e6af154 | ||
![]() |
b5736ad559 | ||
![]() |
ab3912b378 | ||
![]() |
3090989dea | ||
![]() |
92314b8dac | ||
![]() |
a52396008d | ||
![]() |
ae7350e3a0 | ||
![]() |
c30300c368 | ||
![]() |
ed3d415c05 | ||
![]() |
bb353d617a | ||
![]() |
d7f41748ad | ||
![]() |
915ae47971 | ||
![]() |
40b151b4c5 | ||
![]() |
1992410a7b | ||
![]() |
48874f5b07 | ||
![]() |
2144a4eb7c | ||
![]() |
cbdbf11edc | ||
![]() |
515db04023 | ||
![]() |
d3811f1bf1 | ||
![]() |
815fedf8e7 | ||
![]() |
929a7b9cfa | ||
![]() |
f85361dbc5 | ||
![]() |
cb6509d09d | ||
![]() |
f09c129c6d | ||
![]() |
602a4aa835 | ||
![]() |
14d5c6311b | ||
![]() |
289dd3c170 | ||
![]() |
60eac97945 | ||
![]() |
de1d6b9629 | ||
![]() |
722264a083 | ||
![]() |
357d487af7 | ||
![]() |
1b802b040d | ||
![]() |
25afbd935c | ||
![]() |
e61bfd2722 | ||
![]() |
fe571cbef3 | ||
![]() |
a7c5cb8f5a | ||
![]() |
dedb96ef4a | ||
![]() |
ee49efd215 | ||
![]() |
56a35eb864 | ||
![]() |
d478fe0c71 | ||
![]() |
03467ea64e | ||
![]() |
3368fbd058 | ||
![]() |
e84c6f7a24 | ||
![]() |
a0006bad73 | ||
![]() |
2458393d22 | ||
![]() |
787416e552 | ||
![]() |
1c6b241239 | ||
![]() |
7469d520c9 | ||
![]() |
7e00e62427 | ||
![]() |
0e39a969c3 | ||
![]() |
0ad1647930 | ||
![]() |
d7fc45a72d | ||
![]() |
54dfb642b1 | ||
![]() |
40626d0f42 | ||
![]() |
523afccb51 | ||
![]() |
1087aefe0a | ||
![]() |
9b66edc148 | ||
![]() |
2c09b0ae86 | ||
![]() |
8de8ad13bf | ||
![]() |
70bd442bb0 | ||
![]() |
5250b3189b | ||
![]() |
2534651e20 | ||
![]() |
f46a42023f | ||
![]() |
e2ab301340 | ||
![]() |
700f835243 | ||
![]() |
9ce7162a04 | ||
![]() |
af85a8b711 | ||
![]() |
cd58008a0f | ||
![]() |
1f6bd975d0 | ||
![]() |
b3556c008e | ||
![]() |
dbe83f8a74 | ||
![]() |
d1c50f00a0 | ||
![]() |
bd9d3154db | ||
![]() |
1f0b4425a4 | ||
![]() |
47bfea4c56 | ||
![]() |
416de6b584 | ||
![]() |
3d3d141b25 | ||
![]() |
2ff56c17e3 | ||
![]() |
fb326d0354 | ||
![]() |
e84933cf26 | ||
![]() |
8e04328482 | ||
![]() |
d148b71f0f | ||
![]() |
4e68838172 | ||
![]() |
d281fc588b | ||
![]() |
1799ef42a7 | ||
![]() |
a0d5a863e0 | ||
![]() |
df59b104db | ||
![]() |
e7e327c238 | ||
![]() |
ee6e68d0bf | ||
![]() |
d7333b3f21 | ||
![]() |
375bd58a0c | ||
![]() |
cddd915adf | ||
![]() |
9e0ad271f6 | ||
![]() |
a0afeb2a7a | ||
![]() |
7c208b38ed | ||
![]() |
eaa11c68f3 |
@@ -11,4 +11,9 @@ insert_final_newline = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
indent_style = tab
|
||||
|
||||
[{composer.json,package.json}]
|
||||
indent_style = space
|
||||
|
||||
[package.json]
|
||||
indent_size = 2
|
1
.gitattributes
vendored
@@ -8,4 +8,3 @@ _config.yml export-ignore
|
||||
release.sh export-ignore
|
||||
|
||||
*.sh text eol=lf
|
||||
VERSION text eol=lf
|
||||
|
9
.github/workflows/phplint.yml
vendored
@@ -1,7 +1,7 @@
|
||||
name: PHP Linting
|
||||
on:
|
||||
pull_request:
|
||||
branches: [master]
|
||||
branches: [master, develop]
|
||||
push:
|
||||
branches: [master]
|
||||
|
||||
@@ -9,8 +9,5 @@ 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"
|
||||
- uses: actions/checkout@v1
|
||||
- uses: michaelw90/PHP-Lint@master
|
||||
|
27
.gitignore
vendored
@@ -2,22 +2,12 @@ Thumbs.db
|
||||
.DS_Store
|
||||
.idea
|
||||
|
||||
#
|
||||
/.htaccess
|
||||
lua
|
||||
|
||||
# composer
|
||||
composer.lock
|
||||
vendor
|
||||
|
||||
# npm
|
||||
node_modules
|
||||
tools/ext
|
||||
|
||||
# cypress
|
||||
cypress.env.json
|
||||
cypress/e2e/2-advanced-examples
|
||||
cypress/screenshots
|
||||
|
||||
# created by release.sh
|
||||
releases
|
||||
@@ -38,12 +28,6 @@ images/guilds/*
|
||||
images/editor/*
|
||||
!images/editor/index.html
|
||||
|
||||
# gallery images
|
||||
images/gallery/*
|
||||
!images/gallery/index.html
|
||||
!images/gallery/demon.jpg
|
||||
!images/gallery/demon_thumb.gif
|
||||
|
||||
# cache
|
||||
system/cache/*
|
||||
!system/cache/index.html
|
||||
@@ -51,10 +35,6 @@ system/cache/*
|
||||
!system/cache/signatures/index.html
|
||||
!system/cache/plugins/index.html
|
||||
|
||||
# php sessions
|
||||
system/php_sessions/*
|
||||
!system/php_sessions/index.html
|
||||
|
||||
# logs
|
||||
system/logs/*
|
||||
!system/logs/index.html
|
||||
@@ -63,6 +43,10 @@ system/logs/*
|
||||
system/data/*
|
||||
!system/data/index.html
|
||||
|
||||
# php sessions
|
||||
system/php_sessions/*
|
||||
!system/php_sessions/index.html
|
||||
|
||||
# plugins
|
||||
plugins/*
|
||||
!plugins/.htaccess
|
||||
@@ -73,5 +57,8 @@ plugins/*
|
||||
!plugins/email-confirmed-reward
|
||||
landing
|
||||
|
||||
# system
|
||||
system/functions_custom.php
|
||||
|
||||
# others/rest
|
||||
system/pages/downloads.php
|
||||
|
@@ -9,8 +9,6 @@
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
|
||||
# you can put here your myaac root folder
|
||||
# path relative to web root
|
||||
#RewriteBase /myaac/
|
||||
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
@@ -1,8 +1,6 @@
|
||||
|
||||
language: php
|
||||
php:
|
||||
- 5.6
|
||||
- 7.0
|
||||
- 7.1
|
||||
- 7.2
|
||||
- 7.3
|
||||
@@ -17,4 +15,4 @@ before_script:
|
||||
- composer require php-parallel-lint/php-parallel-lint --no-suggest --no-progress --no-interaction --no-ansi --quiet --optimize-autoloader
|
||||
|
||||
script:
|
||||
- php vendor/bin/parallel-lint --no-progress --no-colors --exclude vendor --exclude "system/libs/pot/OTS_DB_PDOQuery_PHP71.php" .
|
||||
- php vendor/bin/parallel-lint --no-progress --no-colors --exclude vendor --exclude "system/libs/pot/OTS_DB_PDOQuery.php" .
|
||||
|
1000
CHANGELOG.md
2
CREDITS
@@ -1,3 +1,3 @@
|
||||
* Gesior.pl (2007 - 2008)
|
||||
* Slawkens (2009 - 2023)
|
||||
* Slawkens (2009 - 2022)
|
||||
* Contributors listed in CONTRIBUTORS.txt
|
||||
|
55
README.md
@@ -1,36 +1,24 @@
|
||||
# [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.
|
||||
|
||||
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 |
|
||||
|:--------|:-----------------------|:--------|:---------------|
|
||||
| 2.x | Experimental features | develop | PHP >= 8.1 |
|
||||
| **1.x** | **Active development** | main | **PHP >= 8.1** |
|
||||
| 0.9.x | Not developed anymore | 0.9 | PHP >= 7.2.5 |
|
||||
| 0.8.x | Active support | 0.8 | PHP >= 7.2.5 |
|
||||
| 0.7.x | End Of Life | 0.7 | PHP >= 5.3.3 |
|
||||
|
||||
The recommended version to install is 1.x, which can be found at releases page - [https://github.com/slawkens/myaac/releases](https://github.com/slawkens/myaac/releases).
|
||||
|
||||
### Documentation
|
||||
* [docs.my-aac.org](https://docs.my-aac.org)
|
||||
* [my-aac.org - FAQ](https://my-aac.org/faqs/)
|
||||
|
||||
### Requirements
|
||||
|
||||
- PHP 5.6 or later
|
||||
- MySQL database
|
||||
- PHP Extensions: pdo, xml, json
|
||||
- (optional) apache2 mod_rewrite (to use friendly_urls)
|
||||
- (optional) zip PHP Extension (to install plugins)
|
||||
- (optional) gd PHP Extension (for generating signature images)
|
||||
- PDO PHP Extension
|
||||
- XML PHP Extension
|
||||
- ZIP PHP Extension
|
||||
- (optional) mod_rewrite to use friendly_urls
|
||||
|
||||
### Installation
|
||||
|
||||
@@ -48,29 +36,28 @@ The recommended version to install is 1.x, which can be found at releases page -
|
||||
chmod 660 images/guilds
|
||||
chmod 660 images/houses
|
||||
chmod 660 images/gallery
|
||||
chmod -R 760 system/cache
|
||||
chmod -R 770 system/cache
|
||||
|
||||
Visit http://your_domain/install (http://localhost/install) and follow instructions in the browser.
|
||||
|
||||
### Configuration
|
||||
|
||||
Check *config.php* to get more information. (Notice: MyAAC 1.0+ doesn't use config.php anymore, it has been moved to Admin Panel - Settings page).
|
||||
|
||||
Check *config.php* to get more informations.
|
||||
Use *config.local.php* for your local configuration changes.
|
||||
|
||||
### Branches
|
||||
|
||||
This repository follows the Git Flow Workflow.
|
||||
Cheatsheet: [Git-Flow-Cheatsheet](https://danielkummer.github.io/git-flow-cheatsheet)
|
||||
Cheatsheet: [Git-Flow-Cheetsheet](https://danielkummer.github.io/git-flow-cheatsheet)
|
||||
|
||||
That means, we use:
|
||||
* main branch, for current stable release
|
||||
* master branch, for current stable release
|
||||
* develop branch, for development version (next release)
|
||||
* feature branches, for features etc.
|
||||
|
||||
### Known Problems
|
||||
|
||||
- Some compatibility issues with some exotic distributions.
|
||||
- Some compatibility issues with some exotical distibutions.
|
||||
|
||||
### Contributing
|
||||
|
||||
@@ -84,13 +71,7 @@ Look: [Contributing](https://github.com/otsoft/myaac/wiki/Contributing) in our w
|
||||
|
||||
### Other Notes
|
||||
|
||||
If you have a great idea or want to 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)
|
||||
If you have a great idea or want contribute to the project - visit our website at https://www.my-aac.org
|
||||
|
||||
### License
|
||||
|
||||
|
16
SECURITY.md
@@ -1,16 +0,0 @@
|
||||
# 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.
|
BIN
admin/images/logo.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
@@ -1,2 +1 @@
|
||||
<?php
|
||||
// nothing yet here
|
||||
<?php
|
@@ -1,9 +1,10 @@
|
||||
<?php
|
||||
|
||||
// few things we'll need
|
||||
require '../common.php';
|
||||
|
||||
define('ADMIN_PANEL', true);
|
||||
define('MYAAC_ADMIN', true);
|
||||
const ADMIN_PANEL = true;
|
||||
const MYAAC_ADMIN = true;
|
||||
|
||||
if(file_exists(BASE . 'config.local.php')) {
|
||||
require_once BASE . 'config.local.php';
|
||||
@@ -18,8 +19,8 @@ if(file_exists(BASE . 'install') && (!isset($config['installed']) || !$config['i
|
||||
$content = '';
|
||||
|
||||
// validate page
|
||||
$page = isset($_GET['p']) ? $_GET['p'] : '';
|
||||
if(empty($page) || preg_match("/[^a-zA-Z0-9_\-]/", $page))
|
||||
$page = $_GET['p'] ?? '';
|
||||
if(empty($page) || preg_match("/[^a-zA-Z0-9_\-\/.]/", $page))
|
||||
$page = 'dashboard';
|
||||
|
||||
$page = strtolower($page);
|
||||
@@ -42,21 +43,30 @@ $hooks->load();
|
||||
require SYSTEM . 'status.php';
|
||||
require SYSTEM . 'login.php';
|
||||
require SYSTEM . 'migrate.php';
|
||||
require ADMIN . 'includes/functions.php';
|
||||
require __DIR__ . '/includes/functions.php';
|
||||
|
||||
$twig->addGlobal('config', $config);
|
||||
$twig->addGlobal('status', $status);
|
||||
|
||||
if (ACTION == 'logout') {
|
||||
require SYSTEM . 'logout.php';
|
||||
}
|
||||
|
||||
// if we're not logged in - show login box
|
||||
if(!$logged || !admin()) {
|
||||
$page = 'login';
|
||||
}
|
||||
|
||||
// include our page
|
||||
$file = ADMIN . 'pages/' . $page . '.php';
|
||||
$file = __DIR__ . '/pages/' . $page . '.php';
|
||||
if(!@file_exists($file)) {
|
||||
$page = '404';
|
||||
$file = SYSTEM . 'pages/404.php';
|
||||
if (strpos($page, 'plugins/') !== false) {
|
||||
$file = BASE . $page;
|
||||
}
|
||||
else {
|
||||
$page = '404';
|
||||
$file = SYSTEM . 'pages/404.php';
|
||||
}
|
||||
}
|
||||
|
||||
ob_start();
|
||||
@@ -67,5 +77,4 @@ ob_end_clean();
|
||||
|
||||
// template
|
||||
$template_path = 'template/';
|
||||
require ADMIN . $template_path . 'template.php';
|
||||
|
||||
require __DIR__ . '/' . $template_path . 'template.php';
|
||||
|
@@ -1,26 +1,139 @@
|
||||
<?php
|
||||
/**
|
||||
* CHANGELOG viewer
|
||||
* CHANGELOG modifier
|
||||
*
|
||||
* @package MyAAC
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
* @copyright 2019 MyAAC
|
||||
* @author Lee
|
||||
* @copyright 2020 MyAAC
|
||||
* @link https://my-aac.org
|
||||
*/
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'MyAAC Changelog';
|
||||
|
||||
if (!file_exists(BASE . 'CHANGELOG.md')) {
|
||||
echo 'File CHANGELOG.md doesn\'t exist.';
|
||||
if (!hasFlag(FLAG_CONTENT_PAGES) && !superAdmin()) {
|
||||
echo 'Access denied.';
|
||||
return;
|
||||
}
|
||||
|
||||
require LIBS . 'Parsedown.php';
|
||||
$title = 'Changelog';
|
||||
$use_datatable = true;
|
||||
const CL_LIMIT = 600; // maximum changelog body length
|
||||
?>
|
||||
|
||||
$changelog = file_get_contents(BASE . 'CHANGELOG.md');
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo BASE_URL; ?>tools/css/jquery.datetimepicker.css"/ >
|
||||
<script src="<?php echo BASE_URL; ?>tools/js/jquery.datetimepicker.js"></script>
|
||||
<?php
|
||||
$id = $_GET['id'] ?? 0;
|
||||
require_once LIBS . 'changelog.php';
|
||||
|
||||
$Parsedown = new Parsedown();
|
||||
if(!empty($action))
|
||||
{
|
||||
$id = $_REQUEST['id'] ?? null;
|
||||
$body = isset($_REQUEST['body']) ? stripslashes($_REQUEST['body']) : null;
|
||||
$create_date = isset($_REQUEST['createdate']) ? (int)strtotime($_REQUEST['createdate'] ): null;
|
||||
$player_id = isset($_REQUEST['player_id']) ? (int)$_REQUEST['player_id'] : null;
|
||||
$type = isset($_REQUEST['type']) ? (int)$_REQUEST['type'] : null;
|
||||
$where = isset($_REQUEST['where']) ? (int)$_REQUEST['where'] : null;
|
||||
|
||||
$changelog = $Parsedown->text($changelog); # prints: <p>Hello <em>Parsedown</em>!</p>
|
||||
$errors = array();
|
||||
|
||||
echo '<div>' . $changelog . '</div>';
|
||||
if($action == 'new') {
|
||||
|
||||
if(isset($body) && Changelog::add($body, $type, $where, $player_id, $create_date, $errors)) {
|
||||
$body = '';
|
||||
$type = $where = $player_id = $create_date = 0;
|
||||
|
||||
success("Added successful.");
|
||||
}
|
||||
}
|
||||
else if($action == 'delete') {
|
||||
Changelog::delete($id, $errors);
|
||||
success("Deleted successful.");
|
||||
}
|
||||
else if($action == 'edit')
|
||||
{
|
||||
if(isset($id) && !isset($body)) {
|
||||
$cl = Changelog::get($id);
|
||||
$body = $cl['body'];
|
||||
$type = $cl['type'];
|
||||
$where = $cl['where'];
|
||||
$create_date = $cl['date'];
|
||||
$player_id = $cl['player_id'];
|
||||
}
|
||||
else {
|
||||
if(Changelog::update($id, $body, $type, $where, $player_id, $create_date,$errors)) {
|
||||
$action = $body = '';
|
||||
$type = $where = $player_id = $create_date = 0;
|
||||
|
||||
success("Updated successful.");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if($action == 'hide') {
|
||||
Changelog::toggleHidden($id, $errors, $status);
|
||||
success(($status == 1 ? 'Show' : 'Hide') . " successful.");
|
||||
}
|
||||
|
||||
if(!empty($errors))
|
||||
error(implode(", ", $errors));
|
||||
}
|
||||
|
||||
$changelogs = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'changelog' . '` ORDER BY `id` DESC')->fetchAll();
|
||||
|
||||
$i = 0;
|
||||
|
||||
$log_type = [
|
||||
['id' => 1, 'icon' => 'added'],
|
||||
['id' => 2, 'icon' => 'removed'],
|
||||
['id' => 3, 'icon' => 'changed'],
|
||||
['id' => 4, 'icon' => 'fixed'],
|
||||
];
|
||||
|
||||
$log_where = [
|
||||
['id' => 1, 'icon' => 'server'],
|
||||
['id' => 2, 'icon' => 'website'],
|
||||
];
|
||||
|
||||
foreach($changelogs as $key => &$log)
|
||||
{
|
||||
$log['type'] = getChangelogType($log['type']);
|
||||
$log['where'] = getChangelogWhere($log['where']);
|
||||
}
|
||||
|
||||
if($action == 'edit' || $action == 'new') {
|
||||
if($action == 'edit') {
|
||||
$player = new OTS_Player();
|
||||
$player->load($player_id);
|
||||
}
|
||||
|
||||
$account_players = $account_logged->getPlayersList();
|
||||
$account_players->orderBy('group_id', POT::ORDER_DESC);
|
||||
$twig->display('admin.changelog.form.html.twig', array(
|
||||
'action' => $action,
|
||||
'cl_link_form' => constant('ADMIN_URL').'?p=changelog&action=' . ($action == 'edit' ? 'edit' : 'new'),
|
||||
'cl_id' => $id ?? null,
|
||||
'body' => isset($body) ? escapeHtml($body) : '',
|
||||
'create_date' => $create_date ?? '',
|
||||
'player_id' => $player_id ?? null,
|
||||
'account_players' => $account_players,
|
||||
'type' => $type ?? 0,
|
||||
'where' => $where ?? 0,
|
||||
'log_type' => $log_type,
|
||||
'log_where' => $log_where,
|
||||
));
|
||||
}
|
||||
$twig->display('admin.changelog.html.twig', array(
|
||||
'changelogs' => $changelogs,
|
||||
));
|
||||
|
||||
?>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('#createdate').datetimepicker({format: "M d Y, H:i:s",});
|
||||
|
||||
$('.tb_datatable').DataTable({
|
||||
"order": [[0, "desc"]],
|
||||
"columnDefs": [{targets: [1, 2,4,5],orderable: false}]
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
25
admin/pages/clmd.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* CHANGELOG viewer
|
||||
*
|
||||
* @package MyAAC
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
* @author Lee
|
||||
* @copyright 2020 MyAAC
|
||||
* @link https://my-aac.org
|
||||
*/
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'MyAAC Changelog';
|
||||
|
||||
if (!file_exists(BASE . 'CHANGELOG.md')) {
|
||||
echo 'File CHANGELOG.md doesn\'t exist.';
|
||||
return;
|
||||
}
|
||||
|
||||
$changelog = file_get_contents(BASE . 'CHANGELOG.md');
|
||||
|
||||
$Parsedown = new Parsedown();
|
||||
|
||||
$changelog = $Parsedown->text($changelog); # prints: <p>Hello <em>Parsedown</em>!</p>
|
||||
|
||||
echo '<div>' . $changelog . '</div>';
|
@@ -19,8 +19,10 @@ if (isset($_GET['clear_cache'])) {
|
||||
}
|
||||
|
||||
if (isset($_GET['maintenance'])) {
|
||||
$_status = (int)$_POST['status'];
|
||||
$message = $_POST['message'];
|
||||
$message = (!empty($_POST['message']) ? $_POST['message'] : null);
|
||||
$_status = (isset($_POST['status']) && $_POST['status'] == 'true');
|
||||
$_status = ($_status ? '0' : '1');
|
||||
|
||||
if (empty($message)) {
|
||||
error('Message cannot be empty.');
|
||||
} else if (strlen($message) > 255) {
|
||||
@@ -45,47 +47,16 @@ $tmp = '';
|
||||
if (fetchDatabaseConfig('site_closed_message', $tmp))
|
||||
$closed_message = $tmp;
|
||||
|
||||
$query = $db->query('SELECT count(*) as `how_much` FROM `accounts`;');
|
||||
$query = $query->fetch();
|
||||
$total_accounts = $query['how_much'];
|
||||
|
||||
$query = $db->query('SELECT count(*) as `how_much` FROM `players`;');
|
||||
$query = $query->fetch();
|
||||
$total_players = $query['how_much'];
|
||||
|
||||
$query = $db->query('SELECT count(*) as `how_much` FROM `guilds`;');
|
||||
$query = $query->fetch();
|
||||
$total_guilds = $query['how_much'];
|
||||
|
||||
$query = $db->query('SELECT count(*) as `how_much` FROM `houses`;');
|
||||
$query = $query->fetch();
|
||||
$total_houses = $query['how_much'];
|
||||
|
||||
$twig->display('admin.statistics.html.twig', array(
|
||||
'total_accounts' => $total_accounts,
|
||||
'total_players' => $total_players,
|
||||
'total_guilds' => $total_guilds,
|
||||
'total_houses' => $total_houses
|
||||
));
|
||||
|
||||
$twig->display('admin.dashboard.html.twig', array(
|
||||
'is_closed' => $is_closed,
|
||||
'closed_message' => $closed_message,
|
||||
'status' => $status,
|
||||
'account_type' => USE_ACCOUNT_NAME ? 'name' : 'number'
|
||||
));
|
||||
|
||||
echo '<div class="row">';
|
||||
|
||||
$configAdminPanelModules = config('admin_panel_modules');
|
||||
if(isset($configAdminPanelModules))
|
||||
if (isset($configAdminPanelModules)) {
|
||||
echo '<div class="row">';
|
||||
$configAdminPanelModules = explode(',', $configAdminPanelModules);
|
||||
|
||||
$twig_loader->prependPath(__DIR__ . '/modules/templates');
|
||||
foreach($configAdminPanelModules as $box) {
|
||||
$file = __DIR__ . '/modules/' . $box . '.php';
|
||||
if(file_exists($file)) {
|
||||
include($file);
|
||||
$twig_loader->prependPath(__DIR__ . '/modules/templates');
|
||||
foreach ($configAdminPanelModules as $box) {
|
||||
$file = __DIR__ . '/modules/' . $box . '.php';
|
||||
if (file_exists($file)) {
|
||||
include($file);
|
||||
}
|
||||
}
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
|
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Account confirm mail
|
||||
* Keept for compatibility
|
||||
* Load items.xml
|
||||
*
|
||||
* @package MyAAC
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
@@ -9,7 +8,6 @@
|
||||
* @link https://my-aac.org
|
||||
*/
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'Server Data';
|
||||
|
||||
if($action == 'confirm_email') {
|
||||
require_once PAGES . 'account/confirm_email.php';
|
||||
}
|
||||
$twig->display('admin.data.html.twig');
|
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Load items.xml
|
||||
*
|
||||
* @package MyAAC
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
* @copyright 2019 MyAAC
|
||||
* @link https://my-aac.org
|
||||
*/
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'Load items.xml';
|
||||
|
||||
require_once LIBS . 'items.php';
|
||||
require_once LIBS . 'weapons.php';
|
||||
|
||||
$twig->display('admin.items.html.twig');
|
||||
|
||||
$reload = isset($_REQUEST['reload']) && (int)$_REQUEST['reload'] === 1;
|
||||
if ($reload) {
|
||||
$items_start_time = microtime(true);
|
||||
if (Items::loadFromXML(true)) {
|
||||
success('Successfully loaded items (in ' . round(microtime(true) - $items_start_time, 4) . ' seconds).');
|
||||
}
|
||||
else {
|
||||
error(Items::getError());
|
||||
}
|
||||
|
||||
$weapons_start_time = microtime(true);
|
||||
if (Weapons::loadFromXML(true)) {
|
||||
success('Successfully loaded weapons (in ' . round(microtime(true) - $weapons_start_time, 4) . ' seconds).');
|
||||
}
|
||||
else {
|
||||
error(Weapons::getError());
|
||||
}
|
||||
}
|
@@ -9,18 +9,10 @@
|
||||
*/
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'Login';
|
||||
$logout = '';
|
||||
if ($action == 'logout') {
|
||||
$logout = "You have been logged out!";
|
||||
}
|
||||
|
||||
if (isset($errors)) {
|
||||
foreach ($errors as $error) {
|
||||
error($error);
|
||||
}
|
||||
}
|
||||
|
||||
$twig->display('admin.login.html.twig', array(
|
||||
'logout' => $logout,
|
||||
$twig->display('admin.login.html.twig', [
|
||||
'logout' => (ACTION == 'logout' ? 'You have been logged out!' : ''),
|
||||
'account' => USE_ACCOUNT_NAME ? 'Name' : 'Number',
|
||||
));
|
||||
'account_login_by' => getAccountLoginByLabel(),
|
||||
'errors' => $errors ?? ''
|
||||
]);
|
||||
|
@@ -4,56 +4,56 @@
|
||||
*
|
||||
* @package MyAAC
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
* @copyright 2019 MyAAC
|
||||
* @copyright 2020 MyAAC
|
||||
* @link https://my-aac.org
|
||||
*/
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'Logs Viewer';
|
||||
$use_datatable = true;
|
||||
|
||||
$files = array();
|
||||
$aac_path_logs = BASE . 'system/logs/';
|
||||
foreach (scandir($aac_path_logs, SCANDIR_SORT_ASCENDING) as $f) {
|
||||
if ($f[0] === '.' || is_dir($aac_path_logs . $f)) {
|
||||
continue;
|
||||
}
|
||||
if ($f[0] === '.' || is_dir($aac_path_logs . $f) || $f === 'index.html') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$files[] = array($f, $aac_path_logs);
|
||||
$files[] = array($f, $aac_path_logs);
|
||||
}
|
||||
|
||||
$server_path_logs = $config['server_path'] . 'logs/';
|
||||
if (!file_exists($server_path_logs)) {
|
||||
$server_path_logs = $config['data_path'] . 'logs/';
|
||||
$server_path_logs = $config['data_path'] . 'logs/';
|
||||
}
|
||||
|
||||
if (file_exists($server_path_logs)) {
|
||||
foreach (scandir($server_path_logs, SCANDIR_SORT_ASCENDING) as $f) {
|
||||
if ($f[0] === '.') {
|
||||
continue;
|
||||
}
|
||||
foreach (scandir($server_path_logs, SCANDIR_SORT_ASCENDING) as $f) {
|
||||
if ($f[0] === '.') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (is_dir($server_path_logs . $f)) {
|
||||
foreach (scandir($server_path_logs . $f, SCANDIR_SORT_ASCENDING) as $f2) {
|
||||
if ($f2[0] === '.') {
|
||||
continue;
|
||||
}
|
||||
if (is_dir($server_path_logs . $f)) {
|
||||
foreach (scandir($server_path_logs . $f, SCANDIR_SORT_ASCENDING) as $f2) {
|
||||
if ($f2[0] === '.') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$files[] = array($f . '/' . $f2, $server_path_logs);
|
||||
}
|
||||
$files[] = array($f . '/' . $f2, $server_path_logs);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
$files[] = array($f, $server_path_logs);
|
||||
}
|
||||
$files[] = array($f, $server_path_logs);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($files as &$f) {
|
||||
$f['mtime'] = filemtime($f[1] . $f[0]);
|
||||
$f['name'] = $f[0];
|
||||
$f['mtime'] = filemtime($f[1] . $f[0]);
|
||||
$f['name'] = $f[0];
|
||||
}
|
||||
unset($f);
|
||||
|
||||
$twig->display('admin.logs.html.twig', array('files' => $files));
|
||||
|
||||
define('EXIST_NONE', 0);
|
||||
define('EXIST_SERVER_LOG', 1);
|
||||
@@ -72,10 +72,12 @@ if (!empty($file)) {
|
||||
}
|
||||
|
||||
if ($exist !== EXIST_NONE) {
|
||||
$content = nl2br(file_get_contents(($exist === EXIST_SERVER_LOG ? $server_path_logs : $aac_path_logs) . $file));
|
||||
$twig->display('admin.logs.view.html.twig', array('file' => $file, 'content' => $content));
|
||||
$file_content = nl2br(file_get_contents(($exist === EXIST_SERVER_LOG ? $server_path_logs : $aac_path_logs) . $file));
|
||||
$twig->display('admin.logs.view.html.twig', array('file' => $file, 'content' => $file_content));
|
||||
}
|
||||
} else {
|
||||
echo 'Invalid file name specified.';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$twig->display('admin.logs.html.twig', array('files' => $files));
|
||||
|
@@ -15,55 +15,69 @@ if (!hasFlag(FLAG_CONTENT_MAILER) && !superAdmin()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$config['mail_enabled']) {
|
||||
if (!config('mail_enabled')) {
|
||||
echo 'Mail support disabled.';
|
||||
return;
|
||||
}
|
||||
|
||||
$mail_content = isset($_POST['mail_content']) ? stripslashes($_POST['mail_content']) : NULL;
|
||||
$mail_subject = isset($_POST['mail_subject']) ? stripslashes($_POST['mail_subject']) : NULL;
|
||||
$preview = isset($_REQUEST['preview']);
|
||||
$mail_to = isset($_REQUEST['mail_to']) ? stripslashes(trim($_REQUEST['mail_to'])) : null;
|
||||
$mail_subject = isset($_POST['mail_subject']) ? stripslashes($_POST['mail_subject']) : null;
|
||||
$mail_content = isset($_POST['mail_content']) ? stripslashes($_POST['mail_content']) : null;
|
||||
|
||||
$preview_done = false;
|
||||
if ($preview) {
|
||||
if (!empty($mail_content) && !empty($mail_subject)) {
|
||||
$preview_done = _mail($account_logged->getCustomField('email'), $mail_subject, $mail_content);
|
||||
if (isset($_POST['submit'])) {
|
||||
if (empty($mail_subject)) {
|
||||
warning('Please enter subject of the message.');
|
||||
}
|
||||
|
||||
if (!$preview_done)
|
||||
error('Error while sending preview mail. More info can be found in system/logs/mailer-error.log');
|
||||
if (empty($mail_content)) {
|
||||
warning('Please enter content of the message.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$twig->display('admin.mailer.html.twig', array(
|
||||
'mail_subject' => $mail_subject,
|
||||
'mail_content' => $mail_content,
|
||||
'preview_done' => $preview_done
|
||||
));
|
||||
|
||||
if (empty($mail_content) || empty($mail_subject) || $preview)
|
||||
return;
|
||||
|
||||
$success = 0;
|
||||
$failed = 0;
|
||||
|
||||
$add = '';
|
||||
if ($config['account_mail_verify']) {
|
||||
note('Note: Sending only to users with verified E-Mail.');
|
||||
$add = ' AND ' . $db->fieldName('email_verified') . ' = 1';
|
||||
}
|
||||
|
||||
$query = $db->query('SELECT ' . $db->fieldName('email') . ' FROM ' . $db->tableName('accounts') . ' WHERE ' . $db->fieldName('email') . ' != ""' . $add);
|
||||
foreach ($query as $email) {
|
||||
if (_mail($email['email'], $mail_subject, $mail_content))
|
||||
$success++;
|
||||
if (!empty($mail_to)) {
|
||||
if(!Validator::email($mail_to)) {
|
||||
warning('E-Mail is invalid.');
|
||||
}
|
||||
else {
|
||||
$failed++;
|
||||
echo '<br />';
|
||||
error('An error occorred while sending email to <b>' . $email['email'] . '</b>. For Admin: More info can be found in system/logs/mailer-error.log');
|
||||
if (!empty($mail_content) && !empty($mail_subject)) {
|
||||
if (_mail($mail_to, $mail_subject, $mail_content)) {
|
||||
success("Successfully mailed <strong>$mail_to</strong>");
|
||||
}
|
||||
else {
|
||||
error("Error while sending mail to <strong>$mail_to</strong>. More info can be found in system/logs/mailer-error.log");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success('Mailing finished.');
|
||||
success("$success emails delivered.");
|
||||
warning("$failed emails failed.");
|
||||
if (!empty($mail_content) && !empty($mail_subject) && empty($mail_to)) {
|
||||
$success = 0;
|
||||
$failed = 0;
|
||||
|
||||
$add = '';
|
||||
if (config('account_mail_verify')) {
|
||||
note('Note: Sending only to users with verified E-Mail.');
|
||||
$add = ' AND `email_verified` = 1';
|
||||
}
|
||||
|
||||
$query = $db->query('SELECT `email` FROM `accounts` WHERE `email` != ""' . $add);
|
||||
foreach ($query as $email) {
|
||||
if (_mail($email['email'], $mail_subject, $mail_content)) {
|
||||
$success++;
|
||||
}
|
||||
else {
|
||||
$failed++;
|
||||
echo '<br />';
|
||||
error('An error occorred while sending email to <b>' . $email['email'] . '</b>. For Admin: More info can be found in system/logs/mailer-error.log');
|
||||
}
|
||||
}
|
||||
|
||||
success('Mailing finished.');
|
||||
success("$success emails delivered.");
|
||||
warning("$failed emails failed.");
|
||||
}
|
||||
|
||||
$twig->display('admin.mailer.html.twig', [
|
||||
'mail_to' => $mail_to,
|
||||
'mail_subject' => $mail_subject,
|
||||
'mail_content' => $mail_content
|
||||
]);
|
||||
|
215
admin/pages/mass_account.php
Normal file
@@ -0,0 +1,215 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Account Admin Tool
|
||||
*
|
||||
* @package MyAAC
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
* @author Lee
|
||||
* @copyright 2020 MyAAC
|
||||
* @link https://my-aac.org
|
||||
*/
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
|
||||
$title = 'Mass Account Actions';
|
||||
|
||||
$hasCoinsColumn = $db->hasColumn('accounts', 'coins');
|
||||
$hasPointsColumn = $db->hasColumn('accounts', 'premium_points');
|
||||
$freePremium = $config['lua']['freePremium'];
|
||||
|
||||
function admin_give_points($points)
|
||||
{
|
||||
global $db, $hasPointsColumn;
|
||||
|
||||
if (!$hasPointsColumn) {
|
||||
displayMessage('Points not supported.');
|
||||
return;
|
||||
}
|
||||
|
||||
$statement = $db->prepare('UPDATE `accounts` SET `premium_points` = `premium_points` + :points');
|
||||
if (!$statement) {
|
||||
displayMessage('Failed to prepare query statement.');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$statement->execute([
|
||||
'points' => $points
|
||||
])) {
|
||||
displayMessage('Failed to add points.');
|
||||
return;
|
||||
}
|
||||
displayMessage($points . ' points added to all accounts.', true);
|
||||
}
|
||||
|
||||
function admin_give_coins($coins)
|
||||
{
|
||||
global $db, $hasCoinsColumn;
|
||||
|
||||
if (!$hasCoinsColumn) {
|
||||
displayMessage('Coins not supported.');
|
||||
return;
|
||||
}
|
||||
|
||||
$statement = $db->prepare('UPDATE `accounts` SET `coins` = `coins` + :coins');
|
||||
if (!$statement) {
|
||||
displayMessage('Failed to prepare query statement.');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$statement->execute([
|
||||
'coins' => $coins
|
||||
])) {
|
||||
displayMessage('Failed to add coins.');
|
||||
return;
|
||||
}
|
||||
|
||||
displayMessage($coins . ' coins added to all accounts.', true);
|
||||
}
|
||||
|
||||
function query_add_premium($column, $value_query, $condition_query = '1=1', $params = [])
|
||||
{
|
||||
global $db;
|
||||
|
||||
$statement = $db->prepare("UPDATE `accounts` SET `{$column}` = $value_query WHERE $condition_query");
|
||||
if (!$statement) {
|
||||
displayMessage('Failed to prepare query statement.');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$statement->execute($params)) {
|
||||
displayMessage('Failed to add premium days.');
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function admin_give_premdays($days)
|
||||
{
|
||||
global $db, $freePremium;
|
||||
|
||||
if ($freePremium) {
|
||||
displayMessage('Premium days not supported. Free Premium enabled.');
|
||||
return;
|
||||
}
|
||||
|
||||
$value = $days * 86400;
|
||||
$now = time();
|
||||
// othire
|
||||
if ($db->hasColumn('accounts', 'premend')) {
|
||||
// append premend
|
||||
if (query_add_premium('premend', '`premend` + :value', '`premend` > :now', ['value' => $value, 'now' => $now])) {
|
||||
// set premend
|
||||
if (query_add_premium('premend', ':value', '`premend` <= :now', ['value' => $now + $value, 'now' => $now])) {
|
||||
displayMessage($days . ' premium days added to all accounts.', true);
|
||||
return;
|
||||
} else {
|
||||
displayMessage('Failed to execute set query.');
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
displayMessage('Failed to execute append query.');
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// tfs 0.x
|
||||
if ($db->hasColumn('accounts', 'premdays')) {
|
||||
// append premdays
|
||||
if (query_add_premium('premdays', '`premdays` + :value', '1=1', ['value' => $days])) {
|
||||
// append lastday
|
||||
if (query_add_premium('lastday', '`lastday` + :value', '`lastday` > :now', ['value' => $value, 'now' => $now])) {
|
||||
// set lastday
|
||||
if (query_add_premium('lastday', ':value', '`lastday` <= :now', ['value' => $now + $value, 'now' => $now])) {
|
||||
displayMessage($days . ' premium days added to all accounts.', true);
|
||||
return;
|
||||
} else {
|
||||
displayMessage('Failed to execute set query.');
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
} else {
|
||||
displayMessage('Failed to execute append query.');
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
displayMessage('Failed to execute set days query.');
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// tfs 1.x
|
||||
if ($db->hasColumn('accounts', 'premium_ends_at')) {
|
||||
// append premium_ends_at
|
||||
if (query_add_premium('premium_ends_at', '`premium_ends_at` + :value', '`premium_ends_at` > :now', ['value' => $value, 'now' => $now])) {
|
||||
// set premium_ends_at
|
||||
if (query_add_premium('premium_ends_at', ':value', '`premium_ends_at` <= :now', ['value' => $now + $value, 'now' => $now])) {
|
||||
displayMessage($days . ' premium days added to all accounts.', true);
|
||||
return;
|
||||
} else {
|
||||
displayMessage('Failed to execute set query.');
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
displayMessage('Failed to execute append query.');
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
displayMessage('Premium Days not supported.');
|
||||
}
|
||||
|
||||
if (isset($_POST['action']) && $_POST['action']) {
|
||||
|
||||
$action = $_POST['action'];
|
||||
|
||||
if (preg_match("/[^A-z0-9_\-]/", $action)) {
|
||||
displayMessage('Invalid action.');
|
||||
} else {
|
||||
$value = isset($_POST['value']) ? intval($_POST['value']) : 0;
|
||||
|
||||
if (!$value) {
|
||||
displayMessage('Please fill all inputs');
|
||||
} else {
|
||||
switch ($action) {
|
||||
case 'give-points':
|
||||
admin_give_points($value);
|
||||
break;
|
||||
case 'give-coins':
|
||||
admin_give_coins($value);
|
||||
break;
|
||||
case 'give-premdays':
|
||||
admin_give_premdays($value);
|
||||
break;
|
||||
default:
|
||||
displayMessage('Action ' . $action . 'not found.');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$twig->display('admin.tools.account.html.twig', array(
|
||||
'hasCoinsColumn' => $hasCoinsColumn,
|
||||
'hasPointsColumn' => $hasPointsColumn,
|
||||
'freePremium' => $freePremium,
|
||||
));
|
||||
}
|
||||
|
||||
function displayMessage($message, $success = false) {
|
||||
global $twig, $hasCoinsColumn, $hasPointsColumn, $freePremium;
|
||||
|
||||
$success ? success($message): error($message);
|
||||
|
||||
$twig->display('admin.tools.account.html.twig', array(
|
||||
'hasCoinsColumn' => $hasCoinsColumn,
|
||||
'hasPointsColumn' => $hasPointsColumn,
|
||||
'freePremium' => $freePremium,
|
||||
));
|
||||
}
|
116
admin/pages/mass_teleport.php
Normal file
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
/**
|
||||
* Teleport Admin Tool
|
||||
*
|
||||
* @package MyAAC
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
* @author Lee
|
||||
* @copyright 2020 MyAAC
|
||||
* @link https://my-aac.org
|
||||
*/
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
|
||||
$title = 'Mass Teleport Actions';
|
||||
|
||||
function admin_teleport_position($x, $y, $z) {
|
||||
global $db;
|
||||
$statement = $db->prepare('UPDATE `players` SET `posx` = :x, `posy` = :y, `posz` = :z');
|
||||
if (!$statement) {
|
||||
displayMessage('Failed to prepare query statement.');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$statement->execute([
|
||||
'x' => $x, 'y' => $y, 'z' => $z
|
||||
])) {
|
||||
displayMessage('Failed to execute query.');
|
||||
return;
|
||||
}
|
||||
|
||||
displayMessage('Player\'s position updated.', true);
|
||||
}
|
||||
|
||||
function admin_teleport_town($town_id) {
|
||||
global $db;
|
||||
$statement = $db->prepare('UPDATE `players` SET `town_id` = :town_id');
|
||||
if (!$statement) {
|
||||
displayMessage('Failed to prepare query statement.');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$statement->execute([
|
||||
'town_id' => $town_id
|
||||
])) {
|
||||
displayMessage('Failed to execute query.');
|
||||
return;
|
||||
}
|
||||
|
||||
displayMessage('Player\'s town updated.', true);
|
||||
}
|
||||
|
||||
if (isset($_POST['action']) && $_POST['action']) {
|
||||
|
||||
$action = $_POST['action'];
|
||||
|
||||
if (preg_match("/[^A-z0-9_\-]/", $action)) {
|
||||
displayMessage('Invalid action.');
|
||||
} else {
|
||||
|
||||
$playersOnline = 0;
|
||||
if($db->hasTable('players_online')) {// tfs 1.0
|
||||
$query = $db->query('SELECT count(*) AS `count` FROM `players_online`');
|
||||
} else {
|
||||
$query = $db->query('SELECT count(*) AS `count` FROM `players` WHERE `players`.`online` > 0');
|
||||
}
|
||||
|
||||
$playersOnline = $query->fetch(PDO::FETCH_ASSOC);
|
||||
if ($playersOnline['count'] > 0) {
|
||||
displayMessage('Please, close the server before execute this action otherwise players will not be affected.');
|
||||
return;
|
||||
}
|
||||
|
||||
$town_id = isset($_POST['town_id']) ? intval($_POST['town_id']) : null;
|
||||
$posx = isset($_POST['posx']) ? intval($_POST['posx']) : null;
|
||||
$posy = isset($_POST['posy']) ? intval($_POST['posy']) : null;
|
||||
$posz = isset($_POST['posz']) ? intval($_POST['posz']) : null;
|
||||
$to_temple = $_POST['to_temple'] ?? null;
|
||||
|
||||
switch ($action) {
|
||||
case 'set-town':
|
||||
if (!$town_id) {
|
||||
displayMessage('Please fill all inputs');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isset($config['towns'][$town_id])) {
|
||||
displayMessage('Specified town does not exist');
|
||||
return;
|
||||
}
|
||||
|
||||
admin_teleport_town($town_id);
|
||||
break;
|
||||
case 'set-position':
|
||||
if (!$to_temple && ($posx < 0 || $posx > 65535 || $posy < 0 || $posy > 65535|| $posz < 0 || $posz > 16)) {
|
||||
displayMessage('Invalid Position');
|
||||
return;
|
||||
}
|
||||
|
||||
admin_teleport_position($posx, $posy, $posz);
|
||||
break;
|
||||
default:
|
||||
displayMessage('Action ' . $action . 'not found.');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
$twig->display('admin.tools.teleport.html.twig', array());
|
||||
}
|
||||
|
||||
|
||||
function displayMessage($message, $success = false) {
|
||||
global $twig;
|
||||
|
||||
$success ? success($message): error($message);
|
||||
$twig->display('admin.tools.teleport.html.twig', array());
|
||||
}
|
@@ -46,7 +46,6 @@ if (isset($_REQUEST['template'])) {
|
||||
if ($cache->enabled()) {
|
||||
$cache->delete('template_menus');
|
||||
}
|
||||
|
||||
success('Saved at ' . date('H:i'));
|
||||
}
|
||||
|
||||
@@ -57,70 +56,73 @@ if (isset($_REQUEST['template'])) {
|
||||
echo 'Cannot find template config.php file.';
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isset($config['menu_categories'])) {
|
||||
echo "No menu categories set in template config.php.<br/>This template doesn't support dynamic menus.";
|
||||
return;
|
||||
}
|
||||
|
||||
echo 'Hint: You can drag menu items.<br/>
|
||||
Hint: Add links to external sites using: <b>http://</b> or <b>https://</b> prefix.<br/>
|
||||
Not all templates support blank and colorful links.<br/><br/>
|
||||
<div class="row">';
|
||||
$title = 'Menus - ' . $template;
|
||||
?>
|
||||
<div align="center" class="text-center">
|
||||
<p class="note">You are editing: <?= $template ?><br/><br/>
|
||||
Hint: You can drag menu items.<br/>
|
||||
Hint: Add links to external sites using: <b>http://</b> or <b>https://</b> prefix.<br/>
|
||||
Not all templates support blank and colorful links.
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
||||
$menus = array();
|
||||
$menus_db = $db->query('SELECT `name`, `link`, `blank`, `color`, `category`, `ordering` FROM `' . TABLE_PREFIX . 'menu` WHERE `enabled` = 1 AND `template` = ' . $db->quote($template) . ' ORDER BY `ordering` ASC;')->fetchAll();
|
||||
foreach ($menus_db as $menu) {
|
||||
$menus[$menu['category']][] = array('name' => $menu['name'], 'link' => $menu['link'], 'blank' => $menu['blank'], 'color' => $menu['color'], 'ordering' => $menu['ordering']);
|
||||
}
|
||||
|
||||
$last_id = array();
|
||||
echo '<form method="post" id="menus-form" action="?p=menus">';
|
||||
echo '<input type="hidden" name="template" value="' . $template . '"/>';
|
||||
foreach ($config['menu_categories'] as $id => $cat) {
|
||||
echo ' <div class="col-md-12 col-lg-6">
|
||||
<div class="box box-danger">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">' . $cat['name'] . ' <img class="add-button" id="add-button-' . $id . '" src="' . BASE_URL . 'images/plus.png" width="16" height="16"/></h3>
|
||||
</div>
|
||||
<div class="box-body">';
|
||||
|
||||
|
||||
echo '<ul class="sortable" id="sortable-' . $id . '">';
|
||||
if (isset($menus[$id])) {
|
||||
$i = 0;
|
||||
foreach ($menus[$id] as $menu) {
|
||||
echo '<li class="ui-state-default" id="list-' . $id . '-' . $i . '"><label>Name:</label><input type="text" name="menu[' . $id . '][]" value="' . escapeHtml($menu['name']) . '"/>
|
||||
<label>Link:</label><input type="text" name="menu_link[' . $id . '][]" value="' . $menu['link'] . '"/>
|
||||
<input type="hidden" name="menu_blank[' . $id . '][]" value="0" />
|
||||
<label><input class="blank-checkbox" type="checkbox" ' . ($menu['blank'] == 1 ? 'checked' : '') . '/><span title="Open in New Window">Open in New Window</span></label>
|
||||
|
||||
<input class="color-picker" type="text" name="menu_color[' . $id . '][]" value="#' . $menu['color'] . '" />
|
||||
|
||||
<a class="remove-button" id="remove-button-' . $id . '-' . $i . '"><img src="' . BASE_URL . 'images/del.png"/></a></li>';
|
||||
|
||||
$i++;
|
||||
$last_id[$id] = $i;
|
||||
}
|
||||
}
|
||||
|
||||
echo '</ul>';
|
||||
echo ' </div>
|
||||
</div>
|
||||
</div>
|
||||
';
|
||||
}
|
||||
echo ' </div><div class="row"><div class="col-md-6">';
|
||||
echo '<input type="submit" class="btn btn-info" value="Save">';
|
||||
echo '<input type="button" class="btn btn-default pull-right" value="Cancel" onclick="window.location = \'' . ADMIN_URL . '?p=menus&template=' . $template . '\';">';
|
||||
echo '</div></div>';
|
||||
echo '</form>';
|
||||
|
||||
?>
|
||||
<form method="post" id="menus-form" action="?p=menus">
|
||||
<input type="hidden" name="template" value="<?php echo $template ?>"/>
|
||||
<div class="row">
|
||||
<?php foreach ($config['menu_categories'] as $id => $cat): ?>
|
||||
<div class="col-md-12 col-lg-6">
|
||||
<div class="card card-info card-outline">
|
||||
<div class="card-header">
|
||||
<h5 class="m-0"><?php echo $cat['name'] ?> <i class="far fa-plus-square add-button" id="add-button-<?php echo $id ?>"></i></h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<ul class="sortable" id="sortable-<?php echo $id ?>">
|
||||
<?php
|
||||
if (isset($menus[$id])) {
|
||||
foreach ($menus[$id] as $i => $menu):
|
||||
?>
|
||||
<li class="ui-state-default" id="list-<?php echo $id ?>-<?php echo $i ?>"><label>Name:</label> <input type="text" name="menu[<?php echo $id ?>][]" value="<?php echo escapeHtml($menu['name']); ?>"/>
|
||||
<label>Link:</label> <input type="text" name="menu_link[<?php echo $id ?>][]" value="<?php echo $menu['link'] ?>"/>
|
||||
<input type="hidden" name="menu_blank[<?php echo $id ?>][]" value="0"/>
|
||||
<label><input class="blank-checkbox" type="checkbox" <?php echo($menu['blank'] == 1 ? 'checked' : '') ?>/><span title="Open in New Window">New Window</span></label>
|
||||
<input class="color-picker" type="text" name="menu_color[<?php echo $id ?>][]" value="#<?php echo $menu['color'] ?>"/>
|
||||
<a class="remove-button" id="remove-button-<?php echo $id ?>-<?php echo $i ?>"><i class="fas fa-trash"></a></i></li>
|
||||
<?php $last_id[$id] = $i;
|
||||
endforeach;
|
||||
} ?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
<div class="row pb-2">
|
||||
<div class="col-md-12">
|
||||
<button type="submit" class="btn btn-info"><i class="fas fa-update"></i> Save</button>
|
||||
<?php
|
||||
echo '<button type="button" class="btn btn-danger float-right" value="Cancel" onclick="window.location = \'' . ADMIN_URL . '?p=menus\';"><i class="fas fa-cancel"></i> Cancel</button>';
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<?php
|
||||
$twig->display('admin.menus.js.html.twig', array(
|
||||
'menus' => $menus,
|
||||
'last_id' => $last_id
|
||||
));
|
||||
?>
|
||||
|
||||
<?php
|
||||
} else {
|
||||
$templates = $db->query('SELECT `template` FROM `' . TABLE_PREFIX . 'menu` GROUP BY `template`;')->fetchAll();
|
||||
|
6
admin/pages/modules/balance.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
$balance = ($db->hasColumn('players', 'balance') ? $db->query('SELECT `balance`, `id`, `name`,`level` FROM `players` ORDER BY `balance` DESC LIMIT 10;') : 0);
|
||||
|
||||
$twig->display('balance.html.twig', array(
|
||||
'balance' => $balance
|
||||
));
|
@@ -1,11 +1,6 @@
|
||||
<?php
|
||||
|
||||
if ($db->hasColumn('accounts', 'coins')) {
|
||||
$coins = $db->query('SELECT `coins`, `' . (USE_ACCOUNT_NAME ? 'name' : 'id') . '` as `name` FROM `accounts` ORDER BY `coins` DESC LIMIT 10;');
|
||||
} else {
|
||||
$coins = 0;
|
||||
}
|
||||
$coins = ($db->hasColumn('accounts', 'coins') ? $db->query('SELECT `coins`, `' . (USE_ACCOUNT_NAME ? 'name' : 'id') . '` as `name` FROM `accounts` ORDER BY `coins` DESC LIMIT 10;') : 0);
|
||||
|
||||
$twig->display('coins.html.twig', array(
|
||||
'coins' => $coins
|
||||
));
|
||||
));
|
||||
|
6
admin/pages/modules/created.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
$players = ($db->hasColumn('accounts', 'created') ? $db->query('SELECT `created`, `' . (USE_ACCOUNT_NAME ? 'name' : 'id') . '` as `name` FROM `accounts` ORDER BY `created` DESC LIMIT 10;') : 0);
|
||||
|
||||
$twig->display('created.html.twig', array(
|
||||
'players' => $players,
|
||||
));
|
@@ -1,11 +1,5 @@
|
||||
<?php
|
||||
|
||||
if ($db->hasColumn('players', 'lastlogin')) {
|
||||
$players = $db->query('SELECT name, level, lastlogin FROM players ORDER BY lastlogin DESC LIMIT 10;');
|
||||
} else {
|
||||
$players = 0;
|
||||
}
|
||||
|
||||
$players = ($db->hasColumn('players', 'lastlogin') ? $db->query('SELECT name, level, lastlogin FROM players ORDER BY lastlogin DESC LIMIT 10;') : 0);
|
||||
$twig->display('lastlogin.html.twig', array(
|
||||
'players' => $players,
|
||||
));
|
||||
));
|
||||
|
@@ -1,10 +1,6 @@
|
||||
<?php
|
||||
if ($db->hasColumn('accounts', 'premium_points')) {
|
||||
$points = $db->query('SELECT `premium_points`, `' . (USE_ACCOUNT_NAME ? 'name' : 'id') . '` as `name` FROM `accounts` ORDER BY `premium_points` DESC LIMIT 10;');
|
||||
} else {
|
||||
$points = 0;
|
||||
}
|
||||
$points = ($db->hasColumn('accounts', 'premium_points') ? $db->query('SELECT `premium_points`, `' . (USE_ACCOUNT_NAME ? 'name' : 'id') . '` as `name` FROM `accounts` ORDER BY `premium_points` DESC LIMIT 10;') : 0);
|
||||
|
||||
$twig->display('points.html.twig', array(
|
||||
'points' => $points,
|
||||
));
|
||||
));
|
||||
|
46
admin/pages/modules/server_status.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
if (isset($status)) {
|
||||
|
||||
$error_icon = '<i class="fas fa-exclamation-circle text-danger"></i>'; ?>
|
||||
<div class=" col-md-6 col-lg-6">
|
||||
<div class="card card-info card-outline">
|
||||
<div class="card-header border-bottom-0">
|
||||
<span class="font-weight-bold m-0">Server Status</span> <span class="float-right small"><b>Last checked</b>: <?php echo(isset($status['lastCheck']) ? date("l, d.m.Y H:i:s", $status['lastCheck']) : $error_icon); ?></span>
|
||||
</div>
|
||||
<div class="card-body p-0 ">
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th width="30%">Server</th>
|
||||
<td><?php echo(isset($status['server']) & isset($status['serverVersion']) ? $status['server'] . ' x ' . $status['serverVersion'] : $error_icon) ?></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Client</th>
|
||||
<td><?php echo(isset($status['clientVersion']) ? $status['clientVersion'] : $error_icon) ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Map</th>
|
||||
<td>
|
||||
<?php if (isset($status['mapName']) & isset($status['mapAuthor']) & isset($status['mapWidth']) & isset($status['mapHeight'])) {
|
||||
echo $status['mapName'] . ' by <b>' . $status['mapAuthor'] . '</b><br/>' . $status['mapWidth'] . ' x ' . $status['mapHeight'];
|
||||
} else {
|
||||
echo $error_icon;
|
||||
} ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Monsters</th>
|
||||
<td><?php echo (isset($status['monsters']) ? $status['monsters'] : $error_icon); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>MOTD:</th>
|
||||
<td><?php echo(isset($status['motd']) ? $status['motd'] : $error_icon); ?></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
12
admin/pages/modules/statistics.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
$count = $db->query('SELECT
|
||||
(SELECT COUNT(*) FROM `accounts`) as total_accounts,
|
||||
(SELECT COUNT(*) FROM `players`) as total_players,
|
||||
(SELECT COUNT(*) FROM `guilds`) as total_guilds,
|
||||
(SELECT COUNT(*) FROM `' . TABLE_PREFIX . 'monsters`) as total_monsters,
|
||||
(SELECT COUNT(*) FROM `houses`) as total_houses;')->fetch();
|
||||
|
||||
$twig->display('statistics.html.twig', array(
|
||||
'count' => $count,
|
||||
));
|
31
admin/pages/modules/templates/balance.html.twig
Normal file
@@ -0,0 +1,31 @@
|
||||
{% if balance is iterable %}
|
||||
<div class=" col-md-6 col-lg-3">
|
||||
<div class="card card-info card-outline">
|
||||
<div class="card-header">
|
||||
<h5 class="m-0">Top 10 - Balance</h5>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<table class="table table-striped table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Player</th>
|
||||
<th>Balance</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% set i = 0 %}
|
||||
{% for result in balance %}
|
||||
{% set i = i + 1 %}
|
||||
<tr>
|
||||
<th>{{ i }}</th>
|
||||
<td><a href="?p=players&search_name={{ result.name }}">{{ result.name }}</a></td>
|
||||
<td>{{ result.balance }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
@@ -1,23 +1,25 @@
|
||||
{% if coins is iterable %}
|
||||
<div class="col-md-3">
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title">Top 10 - Most coins</h3>
|
||||
<div class=" col-md-6 col-lg-3">
|
||||
<div class="card card-info card-outline">
|
||||
<div class="card-header">
|
||||
<h5 class="m-0">Top 10 - Most coins</h5>
|
||||
</div>
|
||||
<div class="box-body no-padding">
|
||||
<table class="table table-condensed">
|
||||
<tbody>
|
||||
<div class="card-body p-0">
|
||||
<table class="table table-striped table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Account {{ account_type }}</th>
|
||||
<th>Account</th>
|
||||
<th>Tibia coins</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% set i = 0 %}
|
||||
{% for result in coins %}
|
||||
{% set i = i + 1 %}
|
||||
<tr>
|
||||
<td>{{ i }}</td>
|
||||
<td>{{ result.name }}</td>
|
||||
<th>{{ i }}</th>
|
||||
<td><a href="?p=accounts&search_name={{ result.name }}">{{ result.name }}</a></td>
|
||||
<td>{{ result.coins }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
@@ -26,4 +28,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
31
admin/pages/modules/templates/created.html.twig
Normal file
@@ -0,0 +1,31 @@
|
||||
{% if players is iterable %}
|
||||
<div class=" col-md-6 col-lg-3">
|
||||
<div class="card card-info card-outline">
|
||||
<div class="card-header">
|
||||
<h5 class="m-0">Last 10 created</h5>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<table class="table table-striped table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Account</th>
|
||||
<th>Creation Date</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% set i = 0 %}
|
||||
{% for result in players %}
|
||||
{% set i = i + 1 %}
|
||||
<tr>
|
||||
<th>{{ i }}</th>
|
||||
<td><a href="?p=accounts&search_name={{ result.name }}">{{ result.name }}</a></td>
|
||||
<td>{{ result.created|date("M d Y, H:i:s") }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
@@ -1,23 +1,25 @@
|
||||
{% if players is iterable %}
|
||||
<div class="col-md-3">
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title">Last 10 Logins</h3>
|
||||
<div class=" col-md-6 col-lg-3">
|
||||
<div class="card card-info card-outline">
|
||||
<div class="card-header">
|
||||
<h5 class="m-0">Last 10 logins</h5>
|
||||
</div>
|
||||
<div class="box-body no-padding">
|
||||
<table class="table table-condensed">
|
||||
<tbody>
|
||||
<div class="card-body p-0">
|
||||
<table class="table table-striped table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Player</th>
|
||||
<th>Login Date</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% set i = 0 %}
|
||||
{% for result in players %}
|
||||
{% set i = i + 1 %}
|
||||
<tr>
|
||||
<td>{{ i }}</td>
|
||||
<td>{{ result.name }}</td>
|
||||
<th>{{ i }}</th>
|
||||
<td><a href="?p=players&search_name={{ result.name }}">{{ result.name }}</a></td>
|
||||
<td>{{ result.lastlogin|date("M d Y, H:i:s") }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
@@ -26,4 +28,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
@@ -1,23 +1,25 @@
|
||||
{% if points is iterable %}
|
||||
<div class="col-md-3">
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title">Top 10 - Most premium points</h3>
|
||||
<div class=" col-md-6 col-lg-3">
|
||||
<div class="card card-info card-outline">
|
||||
<div class="card-header">
|
||||
<h5 class="m-0">Top 10 - Most premium points</h5>
|
||||
</div>
|
||||
<div class="box-body no-padding">
|
||||
<table class="table table-condensed">
|
||||
<tbody>
|
||||
<div class="card-body p-0">
|
||||
<table class="table table-striped table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Account {{ account_type }}</th>
|
||||
<th>Account</th>
|
||||
<th>Premium points</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% set i = 0 %}
|
||||
{% for result in points %}
|
||||
{% set i = i + 1 %}
|
||||
<tr>
|
||||
<td>{{ i }}</td>
|
||||
<td>{{ result.name }}</td>
|
||||
<th>{{ i }}</th>
|
||||
<td><a href="?p=accounts&search_name={{ result.name }}">{{ result.name }}</a></td>
|
||||
<td>{{ result.premium_points }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
@@ -26,4 +28,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
45
admin/pages/modules/templates/statistics.html.twig
Normal file
@@ -0,0 +1,45 @@
|
||||
<div class="col">
|
||||
<div class="info-box">
|
||||
<span class="info-box-icon bg-info elevation-1"><i class="fas fa-user-plus"></i></span>
|
||||
<div class="info-box-content">
|
||||
<span class="info-box-text">Accounts:</span>
|
||||
<span class="info-box-number">{{ count.total_accounts }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="info-box">
|
||||
<span class="info-box-icon bg-red elevation-1"><i class="fas fa-user-plus"></i></span>
|
||||
<div class="info-box-content">
|
||||
<span class="info-box-text">Players:</span>
|
||||
<span class="info-box-number">{{ count.total_players }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="info-box">
|
||||
<span class="info-box-icon bg-teal elevation-1"><i class="fas fa-pastafarianism"></i></span>
|
||||
<div class="info-box-content">
|
||||
<span class="info-box-text">Monsters:</span>
|
||||
<span class="info-box-number">{{ count.total_monsters }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="info-box">
|
||||
<span class="info-box-icon bg-green elevation-1"><i class="fas fa-chart-pie"></i></span>
|
||||
<div class="info-box-content">
|
||||
<span class="info-box-text">Guilds:</span>
|
||||
<span class="info-box-number">{{ count.total_guilds }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="info-box">
|
||||
<span class="info-box-icon bg-yellow elevation-1"><i class="fas fa-home"></i></span>
|
||||
<div class="info-box-content">
|
||||
<span class="info-box-text">Houses:</span>
|
||||
<span class="info-box-number">{{ count.total_houses }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
39
admin/pages/modules/templates/web_status.twig
Normal file
@@ -0,0 +1,39 @@
|
||||
<div class="col-12 col-md-6">
|
||||
<div class="card card-warning card-outline">
|
||||
<form action="?p=dashboard&maintenance" method="post" class="form-horizontal">
|
||||
<div class="card-header">
|
||||
<span class="m-0">Website Status<span class="float-right">
|
||||
<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
|
||||
<input type="checkbox" class="custom-control-input" name="status" id="status" value="true" {% if not is_closed %} checked{% endif %}>
|
||||
<label id="status-label" class="custom-control-label" for="status"> {% if is_closed %}Closed{% else %}Open{% endif %}</label>
|
||||
</div></span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="card-body p-2">
|
||||
<div class="col-sm-12">
|
||||
<label for="message" class="col-form-label">Maintenance Message</label>
|
||||
<textarea name="message" class="form-control" cols="40" rows="3" maxlength="255" placeholder="Enter ...">{{ closed_message }}</textarea>
|
||||
<small>(only visible if closed)</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<button type="submit" class="btn btn-info"><i class="far fa-update"></i> Update</button>
|
||||
<a href="?p=dashboard&clear_cache" onclick="return confirm('Are you sure?');" class="float-right">
|
||||
<span class="btn btn-danger"><i class="fas fa-clear"></i>Clear cache</span>
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$("#status").change(function() {
|
||||
$statusLabel = $("#status-label");
|
||||
$statusLabel.html("Closed");
|
||||
if ($(this).is(':checked')) {
|
||||
$statusLabel.html("Open");
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
10
admin/pages/modules/web_status.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
|
||||
$twig->display('web_status.twig', array(
|
||||
'is_closed' => $is_closed,
|
||||
'closed_message' => $closed_message,
|
||||
'status' => $status,
|
||||
'account_type' => USE_ACCOUNT_NAME ? 'name' : 'number'
|
||||
));
|
||||
?>
|
@@ -13,6 +13,7 @@ require_once LIBS . 'forum.php';
|
||||
require_once LIBS . 'news.php';
|
||||
|
||||
$title = 'News Panel';
|
||||
$use_datatable = true;
|
||||
|
||||
if (!hasFlag(FLAG_CONTENT_PAGES) && !superAdmin()) {
|
||||
echo 'Access denied.';
|
||||
@@ -22,8 +23,8 @@ if (!hasFlag(FLAG_CONTENT_PAGES) && !superAdmin()) {
|
||||
header('X-XSS-Protection:0');
|
||||
|
||||
// some constants, used mainly by database (cannot by modified without schema changes)
|
||||
define('TITLE_LIMIT', 100);
|
||||
define('BODY_LIMIT', 65535); // maximum news body length
|
||||
define('NEWS_TITLE_LIMIT', 100);
|
||||
define('NEWS_BODY_LIMIT', 65535); // maximum news body length
|
||||
define('ARTICLE_TEXT_LIMIT', 300);
|
||||
define('ARTICLE_IMAGE_LIMIT', 100);
|
||||
|
||||
@@ -42,12 +43,12 @@ if(!empty($action))
|
||||
$forum_section = isset($_REQUEST['forum_section']) ? $_REQUEST['forum_section'] : null;
|
||||
$errors = array();
|
||||
|
||||
if($action == 'add') {
|
||||
if($action == 'new') {
|
||||
if(isset($forum_section) && $forum_section != '-1') {
|
||||
$forum_add = Forum::add_thread($p_title, $body, $forum_section, $player_id, $account_logged->getId(), $errors);
|
||||
}
|
||||
|
||||
if(News::add($p_title, $body, $type, $category, $player_id, isset($forum_add) && $forum_add != 0 ? $forum_add : 0, $article_text, $article_image, $errors)) {
|
||||
if(isset($p_title) && News::add($p_title, $body, $type, $category, $player_id, isset($forum_add) && $forum_add != 0 ? $forum_add : 0, $article_text, $article_image, $errors)) {
|
||||
$p_title = $body = $comments = $article_text = $article_image = '';
|
||||
$type = $category = $player_id = 0;
|
||||
|
||||
@@ -114,21 +115,21 @@ if($action == 'edit' || $action == 'new') {
|
||||
$twig->display('admin.news.form.html.twig', array(
|
||||
'action' => $action,
|
||||
'news_link' => getLink(PAGE),
|
||||
'news_link_form' => '?p=news&action=' . ($action == 'edit' ? 'edit' : 'add'),
|
||||
'news_id' => isset($id) ? $id : null,
|
||||
'title' => isset($p_title) ? $p_title : '',
|
||||
'news_link_form' => '?p=news&action=' . ($action == 'edit' ? 'edit' : 'new'),
|
||||
'news_id' => $id ?? null,
|
||||
'title' => $p_title ?? '',
|
||||
'body' => isset($body) ? escapeHtml($body) : '',
|
||||
'type' => isset($type) ? $type : null,
|
||||
'type' => $type ?? null,
|
||||
'player' => isset($player) && $player->isLoaded() ? $player : null,
|
||||
'player_id' => isset($player_id) ? $player_id : null,
|
||||
'player_id' => $player_id ?? null,
|
||||
'account_players' => $account_players,
|
||||
'category' => isset($category) ? $category : 0,
|
||||
'category' => $category ?? 0,
|
||||
'categories' => $categories,
|
||||
'forum_boards' => getForumBoards(),
|
||||
'forum_section' => isset($forum_section) ? $forum_section : null,
|
||||
'comments' => isset($comments) ? $comments : null,
|
||||
'article_text' => isset($article_text) ? $article_text : null,
|
||||
'article_image' => isset($article_image) ? $article_image : null
|
||||
'forum_section' => $forum_section ?? null,
|
||||
'comments' => $comments ?? null,
|
||||
'article_text' => $article_text ?? null,
|
||||
'article_image' => $article_image ?? null
|
||||
));
|
||||
}
|
||||
|
||||
|
14
admin/pages/open_source.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* Open Source libraries
|
||||
*
|
||||
* @package MyAAC
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
* @copyright 2023 MyAAC
|
||||
* @link https://my-aac.org
|
||||
*/
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
|
||||
$title = 'Open Source';
|
||||
|
||||
$twig->display('admin.open_source.html.twig');
|
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'Pages';
|
||||
$use_datatable = true;
|
||||
|
||||
if (!hasFlag(FLAG_CONTENT_PAGES) && !superAdmin()) {
|
||||
echo 'Access denied.';
|
||||
@@ -17,13 +18,18 @@ if (!hasFlag(FLAG_CONTENT_PAGES) && !superAdmin()) {
|
||||
|
||||
header('X-XSS-Protection:0');
|
||||
|
||||
$name = $p_title = '';
|
||||
$name = $p_title = null;
|
||||
$groups = new OTS_Groups_List();
|
||||
|
||||
$php = false;
|
||||
$enable_tinymce = true;
|
||||
$access = 0;
|
||||
|
||||
// some constants, used mainly by database (cannot by modified without schema changes)
|
||||
define('PAGE_TITLE_LIMIT', 30);
|
||||
define('PAGE_NAME_LIMIT', 30);
|
||||
define('PAGE_BODY_LIMIT', 65535); // maximum page body length
|
||||
|
||||
if (!empty($action)) {
|
||||
if ($action == 'delete' || $action == 'edit' || $action == 'hide')
|
||||
$id = $_REQUEST['id'];
|
||||
@@ -49,12 +55,13 @@ if (!empty($action)) {
|
||||
$errors = array();
|
||||
$player_id = 1;
|
||||
|
||||
if ($action == 'add') {
|
||||
if (Pages::add($name, $p_title, $body, $player_id, $php, $enable_tinymce, $access, $errors)) {
|
||||
if ($action == 'new') {
|
||||
if (isset($p_title) && Pages::add($name, $p_title, $body, $player_id, $php, $enable_tinymce, $access, $errors)) {
|
||||
$name = $p_title = $body = '';
|
||||
$player_id = $access = 0;
|
||||
$php = false;
|
||||
$enable_tinymce = true;
|
||||
success('Added successful.');
|
||||
}
|
||||
} else if ($action == 'delete') {
|
||||
if (Pages::delete($id, $errors))
|
||||
@@ -69,15 +76,18 @@ if (!empty($action)) {
|
||||
$enable_tinymce = $_page['enable_tinymce'] == '1';
|
||||
$access = $_page['access'];
|
||||
} else {
|
||||
Pages::update($id, $name, $p_title, $body, $player_id, $php, $enable_tinymce, $access);
|
||||
$action = $name = $p_title = $body = '';
|
||||
$player_id = 1;
|
||||
$access = 0;
|
||||
$php = false;
|
||||
$enable_tinymce = true;
|
||||
if(Pages::update($id, $name, $p_title, $body, $player_id, $php, $enable_tinymce, $access)) {
|
||||
$action = $name = $p_title = $body = '';
|
||||
$player_id = 1;
|
||||
$access = 0;
|
||||
$php = false;
|
||||
$enable_tinymce = true;
|
||||
success("Updated successful.");
|
||||
}
|
||||
}
|
||||
} else if ($action == 'hide') {
|
||||
Pages::toggleHidden($id, $errors);
|
||||
Pages::toggleHidden($id, $errors, $status);
|
||||
success(($status == 1 ? 'Show' : 'Hide') . " successful.");
|
||||
}
|
||||
|
||||
if (!empty($errors))
|
||||
@@ -116,6 +126,44 @@ $twig->display('admin.pages.html.twig', array(
|
||||
|
||||
class Pages
|
||||
{
|
||||
static public function verify($name, $title, $body, $player_id, $php, $enable_tinymce, $access, &$errors)
|
||||
{
|
||||
if(!isset($title[0]) || !isset($body[0])) {
|
||||
$errors[] = 'Please fill all inputs.';
|
||||
return false;
|
||||
}
|
||||
if(strlen($name) > PAGE_NAME_LIMIT) {
|
||||
$errors[] = 'Page name cannot be longer than ' . PAGE_NAME_LIMIT . ' characters.';
|
||||
return false;
|
||||
}
|
||||
if(strlen($title) > PAGE_TITLE_LIMIT) {
|
||||
$errors[] = 'Page title cannot be longer than ' . PAGE_TITLE_LIMIT . ' characters.';
|
||||
return false;
|
||||
}
|
||||
if(strlen($body) > PAGE_BODY_LIMIT) {
|
||||
$errors[] = 'Page content cannot be longer than ' . PAGE_BODY_LIMIT . ' characters.';
|
||||
return false;
|
||||
}
|
||||
if(!isset($player_id) || $player_id == 0) {
|
||||
$errors[] = 'Player ID is wrong.';
|
||||
return false;
|
||||
}
|
||||
if(!isset($php) || ($php != 0 && $php != 1)) {
|
||||
$errors[] = 'Enable PHP is wrong.';
|
||||
return false;
|
||||
}
|
||||
if(!isset($enable_tinymce) || ($enable_tinymce != 0 && $enable_tinymce != 1)) {
|
||||
$errors[] = 'Enable TinyMCE is wrong.';
|
||||
return false;
|
||||
}
|
||||
if(!isset($access) || $access < 0 || $access > PHP_INT_MAX) {
|
||||
$errors[] = 'Access is wrong.';
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static public function get($id)
|
||||
{
|
||||
global $db;
|
||||
@@ -128,31 +176,36 @@ class Pages
|
||||
|
||||
static public function add($name, $title, $body, $player_id, $php, $enable_tinymce, $access, &$errors)
|
||||
{
|
||||
if(!self::verify($name, $title, $body, $player_id, $php, $enable_tinymce, $access, $errors)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
global $db;
|
||||
if (isset($name[0]) && isset($title[0]) && isset($body[0]) && $player_id != 0) {
|
||||
$query = $db->select(TABLE_PREFIX . 'pages', array('name' => $name));
|
||||
if ($query === false)
|
||||
$db->insert(TABLE_PREFIX . 'pages',
|
||||
array(
|
||||
'name' => $name,
|
||||
'title' => $title,
|
||||
'body' => $body,
|
||||
'player_id' => $player_id,
|
||||
'php' => $php ? '1' : '0',
|
||||
'enable_tinymce' => $enable_tinymce ? '1' : '0',
|
||||
'access' => $access
|
||||
)
|
||||
);
|
||||
else
|
||||
$errors[] = 'Page with this link already exists.';
|
||||
} else
|
||||
$errors[] = 'Please fill all inputs.';
|
||||
$query = $db->select(TABLE_PREFIX . 'pages', array('name' => $name));
|
||||
if ($query === false)
|
||||
$db->insert(TABLE_PREFIX . 'pages',
|
||||
array(
|
||||
'name' => $name,
|
||||
'title' => $title,
|
||||
'body' => $body,
|
||||
'player_id' => $player_id,
|
||||
'php' => $php ? '1' : '0',
|
||||
'enable_tinymce' => $enable_tinymce ? '1' : '0',
|
||||
'access' => $access
|
||||
)
|
||||
);
|
||||
else
|
||||
$errors[] = 'Page with this link already exists.';
|
||||
|
||||
return !count($errors);
|
||||
}
|
||||
|
||||
static public function update($id, $name, $title, $body, $player_id, $php, $enable_tinymce, $access)
|
||||
{
|
||||
if(!self::verify($name, $title, $body, $player_id, $php, $enable_tinymce, $access, $errors)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
global $db;
|
||||
$db->update(TABLE_PREFIX . 'pages',
|
||||
array(
|
||||
@@ -165,6 +218,8 @@ class Pages
|
||||
'access' => $access
|
||||
),
|
||||
array('id' => $id));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static public function delete($id, &$errors)
|
||||
@@ -181,18 +236,23 @@ class Pages
|
||||
return !count($errors);
|
||||
}
|
||||
|
||||
static public function toggleHidden($id, &$errors)
|
||||
static public function toggleHidden($id, &$errors, &$status)
|
||||
{
|
||||
global $db;
|
||||
if (isset($id)) {
|
||||
$query = $db->select(TABLE_PREFIX . 'pages', array('id' => $id));
|
||||
if ($query !== false)
|
||||
if ($query !== false) {
|
||||
$db->update(TABLE_PREFIX . 'pages', array('hidden' => ($query['hidden'] == 1 ? 0 : 1)), array('id' => $id));
|
||||
else
|
||||
$status = $query['hidden'];
|
||||
}
|
||||
else {
|
||||
$errors[] = 'Page with id ' . $id . ' does not exists.';
|
||||
}
|
||||
} else
|
||||
$errors[] = 'id not set';
|
||||
|
||||
return !count($errors);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -16,4 +16,4 @@ if (!function_exists('phpinfo')) { ?>
|
||||
<?php return;
|
||||
}
|
||||
?>
|
||||
<iframe src="<?php echo BASE_URL; ?>admin/tools/phpinfo.php" width="1024" height="550"/>
|
||||
<iframe src="<?php echo BASE_URL; ?>admin/tools/phpinfo.php" width="1024" height="550"></iframe>
|
||||
|
@@ -9,6 +9,9 @@
|
||||
*/
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'Plugin manager';
|
||||
$use_datatable = true;
|
||||
|
||||
require_once LIBS . 'plugins.php';
|
||||
|
||||
$twig->display('admin.plugins.form.html.twig');
|
||||
|
||||
|
@@ -4,35 +4,36 @@
|
||||
*
|
||||
* @package MyAAC
|
||||
* @author Lee
|
||||
* @copyright 2019 MyAAC
|
||||
* @copyright 2020 MyAAC
|
||||
* @link https://my-aac.org
|
||||
*/
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'Report Viewer';
|
||||
$use_datatable = true;
|
||||
|
||||
$files = array();
|
||||
$server_path_reports = $config['data_path'] . 'reports/';
|
||||
|
||||
if (file_exists($server_path_reports)) {
|
||||
foreach (scandir($server_path_reports, SCANDIR_SORT_ASCENDING) as $f) {
|
||||
if ($f[0] === '.') {
|
||||
continue;
|
||||
}
|
||||
foreach (scandir($server_path_reports, SCANDIR_SORT_ASCENDING) as $f) {
|
||||
if ($f[0] === '.') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (is_dir($server_path_reports . $f)) {
|
||||
foreach (scandir($server_path_reports . $f, SCANDIR_SORT_ASCENDING) as $f2) {
|
||||
if ($f2[0] === '.') {
|
||||
continue;
|
||||
}
|
||||
if (is_dir($server_path_reports . $f)) {
|
||||
foreach (scandir($server_path_reports . $f, SCANDIR_SORT_ASCENDING) as $f2) {
|
||||
if ($f2[0] === '.') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$files[] = array($f . '/' . $f2, $server_path_reports);
|
||||
}
|
||||
$files[] = array($f . '/' . $f2, $server_path_reports);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
$files[] = array($f, $server_path_reports);
|
||||
}
|
||||
$files[] = array($f, $server_path_reports);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($files as &$f) {
|
||||
@@ -42,20 +43,19 @@ foreach ($files as &$f) {
|
||||
|
||||
unset($f);
|
||||
|
||||
$twig->display('admin.reports.html.twig', array('files' => $files));
|
||||
|
||||
|
||||
$file = isset($_GET['file']) ? $_GET['file'] : NULL;
|
||||
if (!empty($file)) {
|
||||
if (!preg_match('/[^A-z0-9\' _\/\-\.]/', $file)) {
|
||||
if (file_exists($server_path_reports . $file)) {
|
||||
$content = nl2br(file_get_contents($server_path_reports . $file));
|
||||
$file_content = nl2br(file_get_contents($server_path_reports . $file));
|
||||
|
||||
$twig->display('admin.logs.view.html.twig', array('file' => $file, 'content' => $content));
|
||||
$twig->display('admin.logs.view.html.twig', array('file' => $file, 'content' => $file_content));
|
||||
} else {
|
||||
echo 'Specified file does not exist.';
|
||||
}
|
||||
} else {
|
||||
echo 'Invalid file name specified.';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$twig->display('admin.reports.html.twig', array('files' => $files));
|
||||
|
@@ -36,3 +36,4 @@ $twig->display('admin.statistics.html.twig', array(
|
||||
'account_type' => (USE_ACCOUNT_NAME ? 'name' : 'number'),
|
||||
'points' => $points
|
||||
));
|
||||
?>
|
@@ -10,18 +10,24 @@
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'Tools';
|
||||
|
||||
$tool = $_GET['tool'];
|
||||
if (!isset($tool)) {
|
||||
if (!isset($_GET['tool'])) {
|
||||
echo 'Tool not set.';
|
||||
return;
|
||||
}
|
||||
|
||||
$tool = $_GET['tool'];
|
||||
if (preg_match("/[^A-z0-9_\-]/", $tool)) {
|
||||
echo 'Invalid tool.';
|
||||
return;
|
||||
}
|
||||
|
||||
$file = BASE . 'admin/pages/tools/' . $tool . '.php';
|
||||
if (!@file_exists($file))
|
||||
$file = ADMIN . 'tools/' . $tool . '.php';
|
||||
|
||||
if (@file_exists($file)) {
|
||||
require $file;
|
||||
return;
|
||||
}
|
||||
|
||||
echo 'Tool <strong>' . $tool . '</strong> not found.';
|
||||
|
||||
?>
|
||||
|
@@ -24,10 +24,10 @@ if (!$myaac_version) {
|
||||
$version_compare = version_compare($myaac_version, MYAAC_VERSION);
|
||||
if ($version_compare == 0) {
|
||||
success('MyAAC latest version is ' . $myaac_version . '. You\'re using the latest version.
|
||||
<br/>View CHANGELOG ' . generateLink(ADMIN_URL . '?p=changelog', 'here'));
|
||||
<br/>View CHANGELOG ' . generateLink(ADMIN_URL . '?p=clmd', 'here'));
|
||||
} else if ($version_compare < 0) {
|
||||
success('Woah, seems you\'re using newer version as latest released one! MyAAC latest released version is ' . $myaac_version . ', and you\'re using version ' . MYAAC_VERSION . '.
|
||||
<br/>View CHANGELOG ' . generateLink(ADMIN_URL . '?p=changelog', 'here'));
|
||||
<br/>View CHANGELOG ' . generateLink(ADMIN_URL . '?p=clmd', 'here'));
|
||||
} else {
|
||||
warning('You\'re using outdated version.<br/>
|
||||
Your version: <b>' . MYAAC_VERSION . '</b><br/>
|
||||
@@ -47,3 +47,4 @@ function version_revert($version)
|
||||
$release = $version;
|
||||
return $major . '.' . $minor . '.' . $release;
|
||||
}*/
|
||||
?>
|
||||
|
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'Visitors';
|
||||
$use_datatable = true;
|
||||
|
||||
if (!$config['visitors_counter']): ?>
|
||||
Visitors counter is disabled.<br/>
|
||||
|
66
admin/template/menus.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
$menus = [
|
||||
['name' => 'Dashboard', 'icon' => 'tachometer-alt', 'order' => 10, 'link' => 'dashboard'],
|
||||
['name' => 'News', 'icon' => 'newspaper', 'order' => 20, 'link' =>
|
||||
[
|
||||
['name' => 'View', 'link' => 'news', 'icon' => 'list', 'order' => 10],
|
||||
['name' => 'Add news', 'link' => 'news&action=new&type=1', 'icon' => 'plus', 'order' => 20],
|
||||
['name' => 'Add ticker', 'link' => 'news&action=new&type=2', 'icon' => 'plus', 'order' => 30],
|
||||
['name' => 'Add article', 'link' => 'news&action=new&type=3', 'icon' => 'plus', 'order' => 40],
|
||||
],
|
||||
],
|
||||
['name' => 'Changelogs', 'icon' => 'newspaper', 'order' => 30, 'link' =>
|
||||
[
|
||||
['name' => 'View', 'link' => 'changelog', 'icon' => 'list', 'order' => 10],
|
||||
['name' => 'Add', 'link' => 'changelog&action=new', 'icon' => 'plus', 'order' => 20],
|
||||
],
|
||||
],
|
||||
['name' => 'Mailer', 'icon' => 'envelope', 'order' => 40, 'link' => 'mailer', 'disabled' => !config('mail_enabled')],
|
||||
['name' => 'Pages', 'icon' => 'book', 'order' => 50, 'link' =>
|
||||
[
|
||||
['name' => 'View', 'link' => 'pages', 'icon' => 'list', 'order' => 10],
|
||||
['name' => 'Add', 'link' => 'pages&action=new', 'icon' => 'plus', 'order' => 20],
|
||||
],
|
||||
],
|
||||
['name' => 'Menus', 'icon' => 'list', 'order' => 60, 'link' => 'menus'],
|
||||
['name' => 'Plugins', 'icon' => 'plug', 'order' => 70, 'link' => 'plugins'],
|
||||
['name' => 'Server Data', 'icon' => 'gavel', 'order' => 80, 'link' => 'data'],
|
||||
['name' => 'Editor', 'icon' => 'edit', 'order' => 90, 'link' =>
|
||||
[
|
||||
['name' => 'Accounts', 'link' => 'accounts', 'icon' => 'users', 'order' => 10],
|
||||
['name' => 'Players', 'link' => 'players', 'icon' => 'user-astronaut', 'order' => 20],
|
||||
],
|
||||
],
|
||||
['name' => 'Tools', 'icon' => 'tools', 'order' => 100, 'link' =>
|
||||
[
|
||||
['name' => 'Mass Account Actions', 'link' => 'mass_account', 'icon' => 'globe', 'order' => 10],
|
||||
['name' => 'Mass Teleport Actions', 'link' => 'mass_teleport', 'icon' => 'globe', 'order' => 20],
|
||||
['name' => 'Notepad', 'link' => 'notepad', 'icon' => 'marker', 'order' => 30],
|
||||
['name' => 'phpinfo', 'link' => 'phpinfo', 'icon' => 'server', 'order' => 40],
|
||||
],
|
||||
],
|
||||
['name' => 'Logs', 'icon' => 'bug', 'order' => 110, 'link' =>
|
||||
[
|
||||
['name' => 'Logs', 'link' => 'logs', 'icon' => 'book', 'order' => 10],
|
||||
['name' => 'Reports', 'link' => 'reports', 'icon' => 'book', 'order' => 20],
|
||||
['name' => 'Visitors', 'link' => 'visitors', 'icon' => 'user', 'order' => 30],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$hooks->trigger(HOOK_ADMIN_MENU);
|
||||
|
||||
usort($menus, function ($a, $b) {
|
||||
return $a['order'] - $b['order'];
|
||||
});
|
||||
|
||||
foreach ($menus as $i => $menu) {
|
||||
if (isset($menu['link']) && is_array($menu['link'])) {
|
||||
usort($menus[$i]['link'], function ($a, $b) {
|
||||
return $a['order'] - $b['order'];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return $menus;
|
@@ -1,44 +1,10 @@
|
||||
.slidecontainer {
|
||||
width: 100%;
|
||||
.menu-text-li {color: #4b646f; background: #1a2226;}
|
||||
.menu-text {
|
||||
display: block;
|
||||
padding: .5rem 1rem;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.slider {
|
||||
-webkit-appearance: none;
|
||||
width: 100%;
|
||||
|
||||
outline: none;
|
||||
opacity: 0.7;
|
||||
-webkit-transition: .2s;
|
||||
transition: opacity .2s;
|
||||
}
|
||||
|
||||
.slider:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.slider::-webkit-slider-thumb {
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
width: 15px;
|
||||
height: 25px;
|
||||
background: #3c8dbc;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.slider::-moz-range-thumb {
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
background: #3c8dbc;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
td.details-control {
|
||||
text-align: center;
|
||||
color: forestgreen;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
tr.shown td.details-control {
|
||||
text-align: center;
|
||||
color: red;
|
||||
.sidebar-mini.sidebar-collapse .menu-text {
|
||||
display: none;
|
||||
}
|
@@ -1,229 +1,199 @@
|
||||
<?php defined('MYAAC') or die('Direct access not allowed!'); ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<?php echo template_header(true);
|
||||
$title_full = (isset($title) ? $title . $config['title_separator'] : '') . $config['lua']['serverName'];
|
||||
?>
|
||||
|
||||
<title><?php echo $title_full ?></title>
|
||||
<link rel="shortcut icon" href="<?php echo BASE_URL; ?>images/favicon.ico" type="image/x-icon" />
|
||||
<link rel="icon" href="<?php echo BASE_URL; ?>images/favicon.ico" type="image/x-icon" />
|
||||
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
|
||||
|
||||
<link rel="stylesheet" href="<?php echo BASE_URL; ?>tools/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="<?php echo BASE_URL; ?>tools/css/AdminLTE.min.css">
|
||||
<link rel="stylesheet" href="<?php echo BASE_URL; ?>tools/css/skins/skin-blue.min.css">
|
||||
<?php echo template_header(true); ?>
|
||||
<title><?php echo (isset($title) ? $title . ' - ' : '') . $config['lua']['serverName'];?></title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<link rel="stylesheet" href="<?php echo BASE_URL; ?>tools/css/adminlte.min.css">
|
||||
<link rel="stylesheet" href="<?php echo BASE_URL; ?>tools/css/font-awesome.min.css">
|
||||
<link rel="stylesheet" href="<?php echo BASE_URL; ?>tools/css/ionicons.min.css">
|
||||
<link rel="stylesheet" href="<?php echo BASE_URL; ?>tools/css/jquery.dataTables.min.css">
|
||||
<?php if (isset($use_datatable)) { ?>
|
||||
<link rel="stylesheet" href="<?php echo BASE_URL; ?>tools/css/datatables.bs.min.css">
|
||||
<?php } ?>
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo $template_path; ?>style.css"/>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
|
||||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||
<script src="<?php echo BASE_URL; ?>tools/js/html5shiv.min.js"></script>
|
||||
<script src="<?php echo BASE_URL; ?>tools/js/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<link rel="stylesheet"
|
||||
href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
|
||||
</head>
|
||||
<body class="hold-transition skin-blue sidebar-mini">
|
||||
<div class="wrapper">
|
||||
<?php
|
||||
if ($logged && admin()) {
|
||||
?>
|
||||
<header class="main-header">
|
||||
<a href="." class="logo">
|
||||
<span class="logo-mini"><b>M</b>A</span>
|
||||
<span class="logo-lg"><b>My</b>AAC</span>
|
||||
</a>
|
||||
|
||||
<nav class="navbar navbar-static-top" role="navigation">
|
||||
<a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
</a>
|
||||
<div class="navbar-custom-menu">
|
||||
<ul class="nav navbar-nav">
|
||||
<li>
|
||||
<a href="#" data-toggle="control-sidebar"><i class="fa fa-gears"></i></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<body class="sidebar-mini ">
|
||||
<?php if ($logged && admin()) { ?>
|
||||
<div class="wrapper">
|
||||
<nav class="main-header navbar navbar-expand navbar-white navbar-light">
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-widget="pushmenu" href="#"><i class="fas fa-bars"></i></a>
|
||||
</li>
|
||||
<li class="nav-item d-none d-sm-inline-block">
|
||||
<a href="<?php echo ADMIN_URL; ?>" class="nav-link">Home</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="navbar-nav ml-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-widget="control-sidebar" data-slide="true" href="#"><i class="fas fa-th-large"></i></a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
<aside class="main-sidebar">
|
||||
<section class="sidebar">
|
||||
<ul class="sidebar-menu" data-widget="tree">
|
||||
<li class="header">MyAAC</li>
|
||||
<aside class="main-sidebar sidebar-dark-info elevation-4">
|
||||
<a href="<?php echo ADMIN_URL; ?>" class="brand-link navbar-info">
|
||||
<img src="<?php echo ADMIN_URL; ?>images/logo.png" class="brand-image img-circle elevation-3" style="opacity: .8">
|
||||
<span class="brand-text"><b>My</b>AAC</span>
|
||||
</a>
|
||||
<div class="sidebar">
|
||||
<nav class="mt-1">
|
||||
<ul class="nav nav-pills nav-sidebar flex-column nav-legacy nav-child-indent" data-widget="treeview" data-accordion="false">
|
||||
<li class="menu-text-li">
|
||||
<span class="menu-text">
|
||||
<a class="text-info" href="<?php echo BASE_URL; ?>" target="_blank">
|
||||
<?php echo $config['lua']['serverName'] ?>
|
||||
</a>
|
||||
</span>
|
||||
</li>
|
||||
<?php
|
||||
// name = Display name of link
|
||||
// icon = fontawesome icon name without "fas fa-"
|
||||
// link = Page link or use as array for sub items
|
||||
$menus = require __DIR__ . '/menus.php';
|
||||
|
||||
<?php
|
||||
$icons_a = array(
|
||||
'dashboard','newspaper-o', 'envelope',
|
||||
'book', 'list',
|
||||
'plug', 'user',
|
||||
'edit', 'gavel',
|
||||
'wrench', 'edit', 'book', 'book',
|
||||
);
|
||||
|
||||
$menus = array(
|
||||
'Dashboard' => 'dashboard',
|
||||
'News' => 'news',
|
||||
'Mailer' => 'mailer',
|
||||
'Pages' => 'pages',
|
||||
'Menus' => 'menus',
|
||||
'Plugins' => 'plugins',
|
||||
'Visitors' => 'visitors',
|
||||
'Editor' => array(
|
||||
'Accounts' => 'accounts',
|
||||
'Players' => 'players',
|
||||
),
|
||||
'Items' => 'items',
|
||||
'Tools' => array(
|
||||
'Notepad' => 'notepad',
|
||||
'phpinfo' => 'phpinfo',
|
||||
),
|
||||
'Logs' => array(
|
||||
'Logs' => 'logs',
|
||||
'Reports' => 'reports',
|
||||
),
|
||||
);
|
||||
|
||||
$i = 0;
|
||||
foreach ($menus as $_name => $_page) {
|
||||
$has_child = is_array($_page);
|
||||
if (!$has_child) {
|
||||
echo '<li ';
|
||||
if ($page == $_page) echo ' class="active"';
|
||||
echo ">";
|
||||
echo '<a href="?p=' . $_page . '"><i class="fa fa-' . (isset($icons_a[$i]) ? $icons_a[$i] : 'link') . '"></i> <span>' . $_name . '</span></a></li>';
|
||||
}
|
||||
|
||||
if ($has_child) {
|
||||
$used_menu = "";
|
||||
$nav_construct = '';
|
||||
foreach ($_page as $__name => $__page) {
|
||||
$nav_construct = $nav_construct . '<li';
|
||||
|
||||
if ($page == $__page) {
|
||||
$nav_construct = $nav_construct . ' class="active"';
|
||||
$used_menu = true;
|
||||
foreach ($menus as $category => $menu) {
|
||||
if (isset($menu['disabled']) && $menu['disabled']) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$has_child = is_array($menu['link']);
|
||||
if (!$has_child) { ?>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link<?php echo(strpos($menu['link'], $page) !== false ? ' active' : '') ?>" href="?p=<?php echo $menu['link'] ?>">
|
||||
<i class="nav-icon fas fa-<?php echo(isset($menu['icon']) ? $menu['icon'] : 'link') ?>"></i>
|
||||
<p><?php echo $menu['name'] ?></p>
|
||||
</a>
|
||||
</li>
|
||||
<?php
|
||||
} else if ($has_child) {
|
||||
$used_menu = null;
|
||||
$nav_construct = '';
|
||||
foreach ($menu['link'] as $category => $sub_menu) {
|
||||
$nav_construct .= '<li class="nav-item"><a href="?p=' . $sub_menu['link'] . '" class="nav-link';
|
||||
if ($page == $sub_menu['link']) {
|
||||
$nav_construct .= ' active';
|
||||
$used_menu = true;
|
||||
}
|
||||
$nav_construct .= '"><i class="fas fa-' . ($sub_menu['icon'] ?? 'circle') . ' nav-icon"></i><p>' . $sub_menu['name'] . '</p></a></li>';
|
||||
}
|
||||
?>
|
||||
<li class="nav-item has-treeview<?php echo($used_menu ? ' menu-open' : '') ?>">
|
||||
<a href="#" class="nav-link<?php echo($used_menu ? ' active' : '') ?>">
|
||||
<i class="nav-icon fas fa-<?php echo($menu['icon'] ?? 'link') ?>"></i>
|
||||
<p><?php echo $menu['name'] ?></p><i class="right fas fa-angle-left"></i>
|
||||
</a>
|
||||
<ul class="nav nav-treeview">
|
||||
<?php echo $nav_construct; ?>
|
||||
</ul>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
$nav_construct = $nav_construct . '><a href="?p=' . $__page . '"><i class="fa fa-circle-o"></i> ' . $__name . '</a></li>';
|
||||
}
|
||||
|
||||
echo '<li class="treeview' . (($used_menu) ? ' menu-open' : '') . '">
|
||||
<a href="#"><i class="fa fa-' . (isset($icons_a[$i]) ? $icons_a[$i] : 'link') . '"></i> <span>' . $_name . '</span>
|
||||
<span class="pull-right-container"><i class="fa fa-angle-left pull-right"></i></span></a>
|
||||
<ul class="treeview-menu" style="' . (($used_menu) ? ' display: block' : ' display: none') . '">';
|
||||
echo $nav_construct;
|
||||
echo '</ul>
|
||||
</li>';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$query = $db->query('SELECT `name`, `page`, `flags` FROM `' . TABLE_PREFIX . 'admin_menu` ORDER BY `ordering`');
|
||||
$menu_db = $query->fetchAll();
|
||||
foreach ($menu_db as $item) {
|
||||
if ($item['flags'] == 0 || hasFlag($item['flags'])) { ?>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link<?php echo($page == $item['page'] ? ' active' : '') ?>" href="?p=<?php echo $item['page'] ?>">
|
||||
<i class="nav-icon fas fa-link"></i>
|
||||
<p><?php echo $item['name'] ?></p>
|
||||
</a>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
$query = $db->query('SELECT `name`, `page`, `flags` FROM `' . TABLE_PREFIX . 'admin_menu` ORDER BY `ordering`');
|
||||
$menu_db = $query->fetchAll();
|
||||
foreach ($menu_db as $item) {
|
||||
if ($item['flags'] == 0 || hasFlag($item['flags'])) {
|
||||
echo '<li ';
|
||||
if ($page == $item['page']) echo ' class="active"';
|
||||
echo ">";
|
||||
echo '<a href="?p=' . $item['page'] . '"><i class="fa fa-link"></i> <span>' . $item['name'] . '</span></a></li>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</section>
|
||||
</aside>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<section class="content-header">
|
||||
<h1><?php echo(isset($title) ? $title : ''); ?>
|
||||
<small> - Admin Panel</small>
|
||||
<div class="pull-right">
|
||||
<span class="label label-<?php echo(($status['online']) ? 'success' : 'danger'); ?>"><?php echo $config['lua']['serverName'] ?></span>
|
||||
<div class="content-wrapper" style="min-height: 823px;">
|
||||
<div class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-6">
|
||||
<h3 class="m-0 text-dark"><?php echo(isset($title) ? $title : ''); ?><small> - Admin Panel</small></h3>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="float-sm-right d-none d-sm-inline">
|
||||
<span class="p-2 right badge badge-<?php echo((isset($status['online']) and $status['online']) ? 'success' : 'danger'); ?>"><?php echo $config['lua']['serverName'] ?></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</h1>
|
||||
</section>
|
||||
<section class="content">
|
||||
<?php echo $content; ?>
|
||||
</section>
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="container-fluid">
|
||||
<?php echo $content; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<aside class="control-sidebar control-sidebar-dark">
|
||||
<div class="p-3">
|
||||
<h4>Account:</h4>
|
||||
<p><h5><a href="?action=logout"><i class="fas fa-sign-out-alt text-danger"></i> Log out</h5></a>
|
||||
<small>This will log you out</small></p>
|
||||
</div>
|
||||
<div class="p-3">
|
||||
<h4>Site:</h4>
|
||||
<p><h5><a href="<?php echo BASE_URL; ?>" target="_blank"><i class="far fa-eye text-blue"></i> Preview</a></h5>
|
||||
<small>This will open a new tab</small></p>
|
||||
</div>
|
||||
<div class="p-3">
|
||||
<h4>Version:</h4>
|
||||
<p><h5><a href="?p=version"><i class="fas fa-code-branch"></i> <?php echo MYAAC_VERSION; ?></a></h5>
|
||||
<small>Check for updates</small></p>
|
||||
</div>
|
||||
<div class="p-3">
|
||||
<h4>Site:</h4>
|
||||
<p><h5><a href="https://github.com/slawkens/myaac" target="_blank"><i class="fab fa-github"></i> Github</a></h5>
|
||||
<small>Goto GitHub Page</small></p>
|
||||
|
||||
<p><h5><a href="http://my-aac.org/" target="_blank"><i class="fas fa-shoe-prints"></i> MyAAC Official</a></h5>
|
||||
<small>Goto MyAAC Official Website</small></p>
|
||||
|
||||
<p><h5><a href="?p=open_source"><i class="fas fa-wrench"></i> Open Source</a></h5>
|
||||
<small>View Open Source Software MyAAC is using</small></p>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<footer class="main-footer">
|
||||
<div class="float-sm-right d-none d-sm-inline">
|
||||
<span class="p-2 right badge badge-<?php echo((isset($status['online']) and $status['online']) ? 'success' : 'danger'); ?>"><?php echo $config['lua']['serverName'] ?></span>
|
||||
</div>
|
||||
<?php echo base64_decode('UG93ZXJlZCBieSA8YSBocmVmPSJodHRwOi8vbXktYWFjLm9yZyIgdGFyZ2V0PSJfYmxhbmsiPk15QUFDLjwvYT4='); ?>
|
||||
</footer>
|
||||
<div id="sidebar-overlay"></div>
|
||||
</div>
|
||||
|
||||
<footer class="main-footer">
|
||||
|
||||
<div class="pull-right hidden-xs">
|
||||
<div id="status">
|
||||
<?php if ($status['online']): ?>
|
||||
<p class="success" style="width: 120px; text-align: center;">Server Online</p>
|
||||
<?php else: ?>
|
||||
<p class="error" style="width: 120px; text-align: center;">Server Offline</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo base64_decode('UG93ZXJlZCBieSA8YSBocmVmPSJodHRwOi8vbXktYWFjLm9yZyIgdGFyZ2V0PSJfYmxhbmsiPk15QUFDLjwvYT4='); ?>
|
||||
</footer>
|
||||
|
||||
<aside class="control-sidebar control-sidebar-dark">
|
||||
<ul class="nav nav-tabs nav-justified control-sidebar-tabs">
|
||||
<li class="active"><a href="#control-sidebar-home-tab" data-toggle="tab"><i class="fa fa-home"></i></a></li>
|
||||
<li><a href="#control-sidebar-settings-tab" data-toggle="tab"><i class="fa fa-gears"></i></a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="control-sidebar-home-tab">
|
||||
<h3 class="control-sidebar-heading">Account</h3>
|
||||
<ul class="control-sidebar-menu">
|
||||
<li>
|
||||
<a href="?action=logout">
|
||||
<i class="menu-icon fa fa-sign-out bg-red"></i>
|
||||
<div class="menu-info">
|
||||
<h4 class="control-sidebar-subheading">Log out</h4>
|
||||
<p>This will log you out
|
||||
of <?php echo(USE_ACCOUNT_NAME ? $account_logged->getName() : $account_logged->getId()); ?></p>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<h3 class="control-sidebar-heading">Site</h3>
|
||||
<ul class="control-sidebar-menu">
|
||||
<li>
|
||||
<a href="<?php echo BASE_URL; ?>" target="_blank">
|
||||
<i class="menu-icon fa fa-eye bg-blue"></i>
|
||||
<div class="menu-info">
|
||||
<h4 class="control-sidebar-subheading">Preview</h4>
|
||||
<p>This will open a new tab</p>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="tab-pane" id="control-sidebar-settings-tab">
|
||||
<form method="post">
|
||||
<h3 class="control-sidebar-heading">Version</h3>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-sidebar-subheading">
|
||||
<?php echo MYAAC_VERSION; ?> (<a href="?p=version">Check for updates</a>)<br/>
|
||||
</label>
|
||||
<label class="control-sidebar-subheading">
|
||||
<p><a href="https://github.com/slawkens/myaac" target="_blank">Github</a></p>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
<div class="control-sidebar-bg"></div>
|
||||
</div>
|
||||
|
||||
<?php }
|
||||
if (!$logged && !admin()) {
|
||||
<?php } else if (!$logged && !admin()) {
|
||||
echo $content;
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* @var OTS_Account $account_logged
|
||||
*/
|
||||
if ($logged && admin()) {
|
||||
$twig->display('admin-bar.html.twig', [
|
||||
'username' => USE_ACCOUNT_NAME ? $account_logged->getName() : $account_logged->getId()
|
||||
]);
|
||||
}
|
||||
?>
|
||||
<script src="<?php echo BASE_URL; ?>tools/js/bootstrap.min.js"></script>
|
||||
<script src="<?php echo BASE_URL; ?>tools/js/jquery-ui.min.js"></script>
|
||||
<script src="<?php echo BASE_URL; ?>tools/js/jquery.dataTables.min.js"></script>
|
||||
<?php if (isset($use_datatable)) { ?>
|
||||
<script src="<?php echo BASE_URL; ?>tools/js/datatables.min.js"></script>
|
||||
<script src="<?php echo BASE_URL; ?>tools/js/datatables.bs.min.js"></script>
|
||||
<?php } ?>
|
||||
<script src="<?php echo BASE_URL; ?>tools/js/adminlte.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
@@ -13,3 +13,4 @@ if(!function_exists('phpinfo'))
|
||||
die('phpinfo() disabled on this web server.');
|
||||
|
||||
phpinfo();
|
||||
?>
|
||||
|
46
admin/tools/reload_data.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* Project: MyAAC
|
||||
* Automatic Account Creator for Open Tibia Servers
|
||||
*
|
||||
* This is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* @package MyAAC
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
* @copyright 2020 MyAAC
|
||||
* @link https://my-aac.org
|
||||
*/
|
||||
define('MYAAC_ADMIN', true);
|
||||
|
||||
require '../../common.php';
|
||||
require SYSTEM . 'functions.php';
|
||||
require SYSTEM . 'init.php';
|
||||
require SYSTEM . 'login.php';
|
||||
|
||||
if (!admin())
|
||||
die('Access denied.');
|
||||
|
||||
ini_set('max_execution_time', 300);
|
||||
ob_implicit_flush();
|
||||
ob_end_flush();
|
||||
header('X-Accel-Buffering: no');
|
||||
|
||||
require LIBS . 'DataLoader.php';
|
||||
|
||||
require LOCALE . 'en/main.php';
|
||||
require LOCALE . 'en/install.php';
|
||||
|
||||
DataLoader::setLocale($locale);
|
||||
DataLoader::load();
|
53
admin/tools/upload_image.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
define('MYAAC_ADMIN', true);
|
||||
|
||||
require '../../common.php';
|
||||
require SYSTEM . 'functions.php';
|
||||
require SYSTEM . 'init.php';
|
||||
require SYSTEM . 'login.php';
|
||||
|
||||
if(!admin())
|
||||
die('Access denied.');
|
||||
|
||||
// Don't attempt to process the upload on an OPTIONS request
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
|
||||
header('Access-Control-Allow-Methods: POST, OPTIONS');
|
||||
return;
|
||||
}
|
||||
|
||||
$imageFolder = BASE . EDITOR_IMAGES_DIR;
|
||||
|
||||
reset ($_FILES);
|
||||
$temp = current($_FILES);
|
||||
if (is_uploaded_file($temp['tmp_name'])) {
|
||||
header('Access-Control-Allow-Credentials: true');
|
||||
header('P3P: CP="There is no P3P policy."');
|
||||
|
||||
// Sanitize input
|
||||
if (preg_match("/([^\w\s\d\-_~,;:\[\]\(\).])|([\.]{2,})/", $temp['name'])) {
|
||||
header('HTTP/1.1 400 Invalid file name.');
|
||||
return;
|
||||
}
|
||||
|
||||
// Verify extension
|
||||
$ext = strtolower(pathinfo($temp['name'], PATHINFO_EXTENSION));
|
||||
if (!in_array($ext, ['gif', 'jpg', 'png'])) {
|
||||
header('HTTP/1.1 400 Invalid extension.');
|
||||
return;
|
||||
}
|
||||
|
||||
do {
|
||||
$randomName = generateRandomString(8). ".$ext";
|
||||
$fileToWrite = $imageFolder . $randomName;
|
||||
} while (file_exists($fileToWrite));
|
||||
|
||||
move_uploaded_file($temp['tmp_name'], $fileToWrite);
|
||||
|
||||
$returnPathToImage = BASE_URL . EDITOR_IMAGES_DIR . $randomName;
|
||||
echo json_encode(['location' => $returnPathToImage]);
|
||||
} else {
|
||||
// Notify editor that the upload failed
|
||||
header('HTTP/1.1 500 Server Error');
|
||||
}
|
||||
|
||||
|
146
common.php
@@ -25,68 +25,93 @@
|
||||
*/
|
||||
if (version_compare(phpversion(), '7.2.5', '<')) die('PHP version 7.2.5 or higher is required.');
|
||||
|
||||
define('MYAAC', true);
|
||||
define('MYAAC_VERSION', '0.8.23');
|
||||
define('DATABASE_VERSION', 33);
|
||||
define('TABLE_PREFIX', 'myaac_');
|
||||
const MYAAC = true;
|
||||
const MYAAC_VERSION = '0.9.0-dev';
|
||||
const DATABASE_VERSION = 33;
|
||||
const TABLE_PREFIX = 'myaac_';
|
||||
define('START_TIME', microtime(true));
|
||||
define('MYAAC_OS', stripos(PHP_OS, 'WIN') === 0 ? 'WINDOWS' : (strtoupper(PHP_OS) === 'DARWIN' ? 'MAC' : 'LINUX'));
|
||||
define('IS_CLI', in_array(php_sapi_name(), ['cli', 'phpdb']));
|
||||
|
||||
// account flags
|
||||
define('FLAG_ADMIN', 1);
|
||||
define('FLAG_SUPER_ADMIN', 2);
|
||||
define('FLAG_CONTENT_PAGES', 4);
|
||||
define('FLAG_CONTENT_MAILER', 8);
|
||||
define('FLAG_CONTENT_NEWS', 16);
|
||||
define('FLAG_CONTENT_FORUM', 32);
|
||||
define('FLAG_CONTENT_COMMANDS', 64);
|
||||
define('FLAG_CONTENT_SPELLS', 128);
|
||||
define('FLAG_CONTENT_MONSTERS', 256);
|
||||
define('FLAG_CONTENT_GALLERY', 512);
|
||||
define('FLAG_CONTENT_VIDEOS', 1024);
|
||||
define('FLAG_CONTENT_FAQ', 2048);
|
||||
define('FLAG_CONTENT_MENUS', 4096);
|
||||
define('FLAG_CONTENT_PLAYERS', 8192);
|
||||
const FLAG_NONE = 0;
|
||||
const FLAG_ADMIN = 1;
|
||||
const FLAG_SUPER_ADMIN = 2;
|
||||
const FLAG_SUPER_BOTH = 3;
|
||||
const FLAG_CONTENT_PAGES = 4;
|
||||
const FLAG_CONTENT_MAILER = 8;
|
||||
const FLAG_CONTENT_NEWS = 16;
|
||||
const FLAG_CONTENT_FORUM = 32;
|
||||
const FLAG_CONTENT_COMMANDS = 64;
|
||||
const FLAG_CONTENT_SPELLS = 128;
|
||||
const FLAG_CONTENT_MONSTERS = 256;
|
||||
const FLAG_CONTENT_GALLERY = 512;
|
||||
const FLAG_CONTENT_VIDEOS = 1024;
|
||||
const FLAG_CONTENT_FAQ = 2048;
|
||||
const FLAG_CONTENT_MENUS = 4096;
|
||||
const FLAG_CONTENT_PLAYERS = 8192;
|
||||
|
||||
// account access types
|
||||
const ACCOUNT_WEB_FLAGS = [
|
||||
FLAG_NONE => 'None',
|
||||
FLAG_ADMIN =>'Admin',
|
||||
FLAG_SUPER_ADMIN => 'Super Admin',
|
||||
FLAG_SUPER_BOTH =>'(Admin + Super Admin)',
|
||||
];
|
||||
|
||||
// news
|
||||
define('NEWS', 1);
|
||||
define('TICKER', 2);
|
||||
define('ARTICLE', 3);
|
||||
const NEWS = 1;
|
||||
const TICKER = 2;
|
||||
const ARTICLE = 3;
|
||||
|
||||
// here you can change location of admin panel
|
||||
// you need also to rename folder "admin"
|
||||
// this may improve security
|
||||
const ADMIN_PANEL_FOLDER = 'admin';
|
||||
|
||||
// directories
|
||||
define('BASE', __DIR__ . '/');
|
||||
define('ADMIN', BASE . 'admin/');
|
||||
define('SYSTEM', BASE . 'system/');
|
||||
define('CACHE', SYSTEM . 'cache/');
|
||||
define('LOCALE', SYSTEM . 'locale/');
|
||||
define('LIBS', SYSTEM . 'libs/');
|
||||
define('LOGS', SYSTEM . 'logs/');
|
||||
define('PAGES', SYSTEM . 'pages/');
|
||||
define('PLUGINS', BASE . 'plugins/');
|
||||
define('TEMPLATES', BASE . 'templates/');
|
||||
define('TOOLS', BASE . 'tools/');
|
||||
const BASE = __DIR__ . '/';
|
||||
const ADMIN = BASE . ADMIN_PANEL_FOLDER . '/';
|
||||
const SYSTEM = BASE . 'system/';
|
||||
const CACHE = SYSTEM . 'cache/';
|
||||
const LOCALE = SYSTEM . 'locale/';
|
||||
const LIBS = SYSTEM . 'libs/';
|
||||
const LOGS = SYSTEM . 'logs/';
|
||||
const PAGES = SYSTEM . 'pages/';
|
||||
const PLUGINS = BASE . 'plugins/';
|
||||
const TEMPLATES = BASE . 'templates/';
|
||||
const TOOLS = BASE . 'tools/';
|
||||
const VENDOR = BASE . 'vendor/';
|
||||
|
||||
// other dirs
|
||||
const SESSIONS_DIR = SYSTEM . 'php_sessions';
|
||||
const GUILD_IMAGES_DIR = 'images/guilds/';
|
||||
const EDITOR_IMAGES_DIR = 'images/editor/';
|
||||
const GALLERY_DIR = 'images/gallery/';
|
||||
|
||||
// menu categories
|
||||
define('MENU_CATEGORY_NEWS', 1);
|
||||
define('MENU_CATEGORY_ACCOUNT', 2);
|
||||
define('MENU_CATEGORY_COMMUNITY', 3);
|
||||
define('MENU_CATEGORY_FORUM', 4);
|
||||
define('MENU_CATEGORY_LIBRARY', 5);
|
||||
define('MENU_CATEGORY_SHOP', 6);
|
||||
const MENU_CATEGORY_NEWS = 1;
|
||||
const MENU_CATEGORY_ACCOUNT = 2;
|
||||
const MENU_CATEGORY_COMMUNITY = 3;
|
||||
const MENU_CATEGORY_FORUM = 4;
|
||||
const MENU_CATEGORY_LIBRARY = 5;
|
||||
const MENU_CATEGORY_SHOP = 6;
|
||||
|
||||
// otserv versions
|
||||
define('OTSERV', 1);
|
||||
define('OTSERV_06', 2);
|
||||
define('OTSERV_FIRST', OTSERV);
|
||||
define('OTSERV_LAST', OTSERV_06);
|
||||
define('TFS_02', 3);
|
||||
define('TFS_03', 4);
|
||||
define('TFS_FIRST', TFS_02);
|
||||
define('TFS_LAST', TFS_03);
|
||||
const OTSERV = 1;
|
||||
const OTSERV_06 = 2;
|
||||
const OTSERV_FIRST = OTSERV;
|
||||
const OTSERV_LAST = OTSERV_06;
|
||||
const TFS_02 = 3;
|
||||
const TFS_03 = 4;
|
||||
const TFS_FIRST = TFS_02;
|
||||
const TFS_LAST = TFS_03;
|
||||
|
||||
// other definitions
|
||||
const ACCOUNT_NUMBER_LENGTH = 8;
|
||||
|
||||
if (!IS_CLI) {
|
||||
session_save_path(SYSTEM . 'php_sessions');
|
||||
session_save_path(SESSIONS_DIR);
|
||||
session_start();
|
||||
}
|
||||
|
||||
@@ -97,13 +122,9 @@ $size = count($tmp) - 1;
|
||||
for($i = 1; $i < $size; $i++)
|
||||
$basedir .= '/' . $tmp[$i];
|
||||
|
||||
$basedir = str_replace(array('/admin', '/install', '/tools'), '', $basedir);
|
||||
$basedir = str_replace(['/' . ADMIN_PANEL_FOLDER, '/install', '/tools'], '', $basedir);
|
||||
define('BASE_DIR', $basedir);
|
||||
|
||||
if (file_exists(BASE . 'config.local.php') && !defined('MYAAC_INSTALL')) {
|
||||
require BASE . 'config.local.php';
|
||||
}
|
||||
|
||||
if(!IS_CLI) {
|
||||
if (isset($_SERVER['HTTP_HOST'][0])) {
|
||||
$baseHost = $_SERVER['HTTP_HOST'];
|
||||
@@ -115,21 +136,18 @@ if(!IS_CLI) {
|
||||
}
|
||||
}
|
||||
|
||||
define('SERVER_URL', 'http' . (isHttps() ? 's' : '') . '://' . $baseHost);
|
||||
define('SERVER_URL', 'http' . (isset($_SERVER['HTTPS'][0]) && strtolower($_SERVER['HTTPS']) === 'on' ? 's' : '') . '://' . $baseHost);
|
||||
define('BASE_URL', SERVER_URL . BASE_DIR . '/');
|
||||
define('ADMIN_URL', SERVER_URL . BASE_DIR . '/admin/');
|
||||
|
||||
//define('CURRENT_URL', BASE_URL . $_SERVER['REQUEST_URI']);
|
||||
if(@$config['env'] === 'dev') {
|
||||
require SYSTEM . 'exception.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);
|
||||
require SYSTEM . 'exception.php';
|
||||
}
|
||||
|
||||
$autoloadFile = VENDOR . 'autoload.php';
|
||||
if (!is_file($autoloadFile)) {
|
||||
throw new RuntimeException('The vendor folder is missing. Please download Composer: <a href="https://getcomposer.org/download">https://getcomposer.org/download</a>, install it and execute in the main MyAAC directory this command: <b>composer install</b>. Or download MyAAC from <a href="https://github.com/slawkens/myaac/releases">GitHub releases</a>, which includes Vendor folder.');
|
||||
}
|
||||
|
||||
require $autoloadFile;
|
||||
|
15
composer.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"require": {
|
||||
"php": "^7.2.5 || ^8.0",
|
||||
"ext-pdo": "*",
|
||||
"ext-pdo_mysql": "*",
|
||||
"ext-json": "*",
|
||||
"ext-xml": "*",
|
||||
"ext-dom": "*",
|
||||
"phpmailer/phpmailer": "^6.1",
|
||||
"composer/semver": "^3.2",
|
||||
"twig/twig": "^2.0",
|
||||
"erusev/parsedown": "^1.7",
|
||||
"nikic/fast-route": "^1.3"
|
||||
}
|
||||
}
|
68
config.php
@@ -52,7 +52,6 @@ $config = array(
|
||||
// head options (html)
|
||||
'meta_description' => 'Tibia is a free massive multiplayer online role playing game (MMORPG).', // description of the site
|
||||
'meta_keywords' => 'free online game, free multiplayer game, ots, open tibia server', // keywords list separated by commas
|
||||
'title_separator' => ' - ',
|
||||
|
||||
// footer
|
||||
'footer' => ''/*'<br/>Your Server © 2016. All rights reserved.'*/,
|
||||
@@ -74,10 +73,9 @@ $config = array(
|
||||
'database_user' => '',
|
||||
'database_password' => '',
|
||||
'database_name' => '',
|
||||
'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 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_persistent' => false, // use database permanent connection (like server), may speed up your site
|
||||
'database_encryption' => 'sha1',
|
||||
|
||||
// multiworld system (only TFS 0.3)
|
||||
'multiworld' => false, // use multiworld system?
|
||||
@@ -88,10 +86,21 @@ $config = array(
|
||||
|
||||
// images
|
||||
'outfit_images_url' => 'https://outfit-images.ots.me/outfit.php', // set to animoutfit.php for animated outfit
|
||||
'outfit_images_wrong_looktypes' => [75, 126, 127, 266, 302], // this looktypes needs to have different margin-top and margin-left because they are wrong positioned
|
||||
'item_images_url' => 'https://item-images.ots.me/1092/', // set to images/items if you host your own items in images folder
|
||||
'item_images_extension' => '.gif',
|
||||
|
||||
// creatures
|
||||
'creatures_images_url' => 'images/monsters/', // set to images/monsters if you host your own creatures in images folder
|
||||
'creatures_images_extension' => '.gif',
|
||||
'creatures_images_preview' => false, // set to true to allow picture previews for creatures
|
||||
'creatures_items_url' => 'https://tibia.fandom.com/wiki/', // set to website which shows details about items.
|
||||
'creatures_loot_percentage' => true, // set to true to show the loot tooltip percent
|
||||
|
||||
// account
|
||||
'account_management' => true, // disable if you're using other method to manage users (fe. tfs account manager)
|
||||
'account_login_by_email' => false, // use email instead of Account Name like in latest Tibia
|
||||
'account_login_by_email_fallback' => false, // allow also additionally login by Account Name/Number (for users that might forget their email)
|
||||
'account_create_auto_login' => false, // auto login after creating account?
|
||||
'account_create_character_create' => true, // allow directly to create character on create account page?
|
||||
'account_mail_verify' => false, // force users to confirm their email addresses when registering
|
||||
@@ -103,6 +112,7 @@ $config = array(
|
||||
'message' => 'You received %d %s for confirming your E-Mail address.' // example: You received 20 premium points for confirming your E-Mail address.
|
||||
],
|
||||
'account_mail_unique' => true, // email addresses cannot be duplicated? (one account = one email)
|
||||
'account_mail_block_plus_sign' => true, // block email with '+' signs like test+box@gmail.com (help protect against spamming accounts)
|
||||
'account_premium_days' => 0, // default premium days on new account
|
||||
'account_premium_points' => 0, // default premium points on new account
|
||||
'account_welcome_mail' => true, // send welcome email when user registers
|
||||
@@ -132,11 +142,17 @@ $config = array(
|
||||
'smtp_secure' => '', // What kind of encryption to use on the SMTP connection. Options: '', 'ssl' (GMail) or 'tls' (Microsoft Outlook)
|
||||
'smtp_debug' => false, // set true to debug (you will see more info in error.log)
|
||||
|
||||
// reCAPTCHA (prevent spam bots)
|
||||
// Google reCAPTCHA (prevent spam bots)
|
||||
'recaptcha_enabled' => false, // enable recaptcha verification code
|
||||
'recaptcha_type' => 'v3', // 'v2-checkbox', 'v2-invisible', 'v3'
|
||||
'recaptcha_site_key' => '', // get your own site and secret keys at https://www.google.com/recaptcha
|
||||
'recaptcha_secret_key' => '',
|
||||
'recaptcha_theme' => 'light', // light, dark
|
||||
// following option apply only for ReCaptcha v2-checkbox
|
||||
'recaptcha_v2_theme' => 'light', // light, dark
|
||||
// following option apply only for ReCaptcha v3
|
||||
// min score for validation, between 0 - 1.0
|
||||
// https://developers.google.com/recaptcha/docs/v3#interpreting_the_score
|
||||
'recaptcha_v3_min_score' => 0.5,
|
||||
|
||||
//
|
||||
'generate_new_reckey' => true, // let player generate new recovery key, he will receive e-mail with new rec key (not display on page, hacker can't generate rec key)
|
||||
@@ -144,6 +160,18 @@ $config = array(
|
||||
'send_mail_when_change_password' => true, // send e-mail with new password when change password to account
|
||||
'send_mail_when_generate_reckey' => true, // send e-mail with rec key (key is displayed on page anyway when generate)
|
||||
|
||||
// you may need to adjust this for older tfs versions
|
||||
// by removing Community Manager
|
||||
'account_types' => [
|
||||
'None',
|
||||
'Normal',
|
||||
'Tutor',
|
||||
'Senior Tutor',
|
||||
'Gamemaster',
|
||||
'Community Manager',
|
||||
'God',
|
||||
],
|
||||
|
||||
// genders (aka sex)
|
||||
'genders' => array(
|
||||
0 => 'Female',
|
||||
@@ -172,9 +200,12 @@ $config = array(
|
||||
// This is the minimum and the maximum length that a player can create a character. It is highly recommend the maximum length to be 21.
|
||||
'character_name_min_length' => 4,
|
||||
'character_name_max_length' => 21,
|
||||
'character_name_npc_check' => true,
|
||||
|
||||
// list of towns
|
||||
// if you use TFS 1.3 with support for 'towns' table in database, then you can ignore this - it will be configured automatically (generated from your .OTBM map)
|
||||
// if you use TFS 1.3 with support for 'towns' table in database, then you can ignore this - it will be configured automatically (from MySQL database - Table - towns)
|
||||
// otherwise it will try to load from your .OTBM map file
|
||||
// if you don't see towns on website, then you need to fill this out
|
||||
'towns' => array(
|
||||
0 => 'No town',
|
||||
1 => 'Sample town'
|
||||
@@ -185,6 +216,7 @@ $config = array(
|
||||
'guild_need_level' => 1, // min. level to form a guild
|
||||
'guild_need_premium' => true, // require premium account to form a guild?
|
||||
'guild_image_size_kb' => 80, // maximum size of the guild logo image in KB (kilobytes)
|
||||
'guild_description_default' => 'New guild. Leader must edit this text :)',
|
||||
'guild_description_chars_limit' => 1000, // limit of guild description
|
||||
'guild_description_lines_limit' => 6, // limit of lines, if description has more lines it will be showed as long text, without 'enters'
|
||||
'guild_motd_chars_limit' => 150, // limit of MOTD (message of the day) that is shown later in the game on the guild channel
|
||||
@@ -205,19 +237,19 @@ $config = array(
|
||||
'team_display_outfit' => true,
|
||||
|
||||
// bans page
|
||||
'bans_limit' => 50,
|
||||
'bans_display_all' => true, // should all bans be displayed? (sorted page by page)
|
||||
'bans_per_page' => 20,
|
||||
|
||||
// highscores page
|
||||
'highscores_vocation_box' => true, // show 'Choose a vocation' box on the highscores (allowing peoples to sort highscores by vocation)?
|
||||
'highscores_vocation' => true, // show player vocation under his nickname?
|
||||
'highscores_frags' => false, // show 'Frags' tab (best fraggers on the server)? Only 0.3
|
||||
'highscores_frags' => false, // show 'Frags' tab (best fraggers on the server)?
|
||||
'highscores_balance' => false, // show 'Balance' tab (richest players on the server)
|
||||
'highscores_outfit' => true, // show player outfit?
|
||||
'highscores_country_box' => false, // doesnt work yet! (not implemented)
|
||||
'highscores_groups_hidden' => 3, // this group id and higher won't be shown on the highscores
|
||||
'highscores_ids_hidden' => array(0), // this ids of players will be hidden on the highscores (should be ids of samples)
|
||||
'highscores_length' => 100, // how many records per page on highscores
|
||||
'highscores_per_page' => 100, // how many records per page on highscores
|
||||
'highscores_cache_ttl' => 15, // how often to update highscores from database in minutes (default 15 minutes)
|
||||
|
||||
// characters page
|
||||
'characters' => array( // what things to display on character view page (true/false in each option)
|
||||
@@ -269,9 +301,9 @@ $config = array(
|
||||
|
||||
// status, took automatically from config file if empty
|
||||
'status_enabled' => true, // you can disable status checking by settings this to "false"
|
||||
'status_ip' => '127.0.0.1',
|
||||
'status_ip' => '',
|
||||
'status_port' => '',
|
||||
'status_timeout' => 1.0, // how long to wait for the initial response from the server (default: 1 second)
|
||||
'status_timeout' => 2.0, // how long to wait for the initial response from the server (default: 2 seconds)
|
||||
|
||||
// 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
|
||||
@@ -279,7 +311,7 @@ $config = array(
|
||||
'status_interval' => 60,
|
||||
|
||||
// admin panel
|
||||
'admin_panel_modules' => 'lastlogin,points,coins',
|
||||
'admin_panel_modules' => 'statistics,web_status,server_status,lastlogin,created,points,coins,balance', // default - statistics,web_status,server_status,lastlogin,created,points,coins,balance
|
||||
|
||||
// other
|
||||
'anonymous_usage_statistics' => true,
|
||||
@@ -290,13 +322,5 @@ $config = array(
|
||||
'date_timezone' => 'Europe/Berlin', // more info at http://php.net/manual/en/timezones.php
|
||||
'footer_show_load_time' => true, // display load time of the page in the footer
|
||||
|
||||
'npc' => array(),
|
||||
|
||||
// character name blocked
|
||||
'character_name_blocked' => array(
|
||||
'prefix' => array(),
|
||||
'names' => array(),
|
||||
'words' => array(),
|
||||
),
|
||||
|
||||
'npc' => array()
|
||||
);
|
||||
|
BIN
images/del.png
Before Width: | Height: | Size: 433 B After Width: | Height: | Size: 318 B |
BIN
images/druid.png
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 10 KiB |
BIN
images/edit.png
Before Width: | Height: | Size: 450 B After Width: | Height: | Size: 363 B |
BIN
images/error.png
Before Width: | Height: | Size: 706 B After Width: | Height: | Size: 592 B |
BIN
images/false.png
Before Width: | Height: | Size: 1004 B After Width: | Height: | Size: 845 B |
BIN
images/hist.png
Before Width: | Height: | Size: 117 B After Width: | Height: | Size: 110 B |
BIN
images/info.png
Before Width: | Height: | Size: 783 B After Width: | Height: | Size: 631 B |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 1005 B |
Before Width: | Height: | Size: 789 B After Width: | Height: | Size: 735 B |
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 8.2 KiB |
BIN
images/plus.png
Before Width: | Height: | Size: 9.1 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 615 B After Width: | Height: | Size: 463 B |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 816 B After Width: | Height: | Size: 633 B |
BIN
images/trash.png
Before Width: | Height: | Size: 476 B After Width: | Height: | Size: 474 B |
BIN
images/true.png
Before Width: | Height: | Size: 809 B After Width: | Height: | Size: 709 B |
242
index.php
@@ -24,23 +24,26 @@
|
||||
* @link https://my-aac.org
|
||||
*/
|
||||
|
||||
ob_start();
|
||||
require_once 'common.php';
|
||||
require_once SYSTEM . 'functions.php';
|
||||
|
||||
$uri = $_SERVER['REQUEST_URI'];
|
||||
if(false !== strpos($uri, 'index.php')) {
|
||||
$uri = str_replace_first('/index.php', '', $uri);
|
||||
}
|
||||
|
||||
$tmp = BASE_DIR;
|
||||
if(!empty($tmp))
|
||||
$uri = str_replace(BASE_DIR . '/', '', $uri);
|
||||
else
|
||||
if(0 === strpos($uri, '/')) {
|
||||
$uri = str_replace_first('/', '', $uri);
|
||||
}
|
||||
|
||||
$uri = str_replace(array('index.php/', '?'), '', $uri);
|
||||
define('URI', $uri);
|
||||
if(preg_match("/^[A-Za-z0-9-_%'+\/]+\.png$/i", $uri)) {
|
||||
if (!empty(BASE_DIR)) {
|
||||
$tmp = explode('.', str_replace_first(str_replace_first('/', '', BASE_DIR) . '/', '', $uri));
|
||||
}
|
||||
else {
|
||||
$tmp = explode('.', $uri);
|
||||
}
|
||||
|
||||
if(preg_match("/^[A-Za-z0-9-_%'+]+\.png$/i", $uri)) {
|
||||
$tmp = explode('.', $uri);
|
||||
$_REQUEST['name'] = urldecode($tmp[0]);
|
||||
|
||||
chdir(TOOLS . 'signature');
|
||||
@@ -48,7 +51,7 @@ if(preg_match("/^[A-Za-z0-9-_%'+]+\.png$/i", $uri)) {
|
||||
exit();
|
||||
}
|
||||
|
||||
if(preg_match("/^(.*)\.(gif|jpg|png|jpeg|tiff|bmp|css|js|less|map|html|php|zip|rar|gz|ttf|woff|ico)$/i", $_SERVER['REQUEST_URI'])) {
|
||||
if(preg_match("/^(.*)\.(gif|jpg|png|jpeg|tiff|bmp|css|js|less|map|html|zip|rar|gz|ttf|woff|ico)$/i", $_SERVER['REQUEST_URI'])) {
|
||||
http_response_code(404);
|
||||
exit;
|
||||
}
|
||||
@@ -75,134 +78,28 @@ 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!');
|
||||
}
|
||||
|
||||
$template_place_holders = array();
|
||||
|
||||
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;
|
||||
if(empty($uri) || isset($_REQUEST['template'])) {
|
||||
$_REQUEST['p'] = 'news';
|
||||
$found = true;
|
||||
}
|
||||
else {
|
||||
$tmp = strtolower($uri);
|
||||
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;
|
||||
$found = true;
|
||||
}
|
||||
else {
|
||||
$rules = array(
|
||||
'/^account\/manage\/?$/' => array('subtopic' => 'accountmanagement'),
|
||||
'/^account\/create\/?$/' => array('subtopic' => 'createaccount'),
|
||||
'/^account\/lost\/?$/' => array('subtopic' => 'lostaccount'),
|
||||
'/^account\/logout\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'logout'),
|
||||
'/^account\/password\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_password'),
|
||||
'/^account\/register\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'register'),
|
||||
'/^account\/register\/new\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'register_new'),
|
||||
'/^account\/email\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_email'),
|
||||
'/^account\/info\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_info'),
|
||||
'/^account\/character\/create\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'create_character'),
|
||||
'/^account\/character\/name\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_name'),
|
||||
'/^account\/character\/sex\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_sex'),
|
||||
'/^account\/character\/delete\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'delete_character'),
|
||||
'/^account\/character\/comment\/[A-Za-z0-9-_%+\']+\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_comment', 'name' => '$3'),
|
||||
'/^account\/character\/comment\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_comment'),
|
||||
'/^account\/confirm_email\/[A-Za-z0-9-_]+\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'confirm_email', 'v' => '$2'),
|
||||
'/^characters\/[A-Za-z0-9-_%+\']+$/' => array('subtopic' => 'characters', 'name' => '$1'),
|
||||
'/^changelog\/[0-9]+\/?$/' => array('subtopic' => 'changelog', 'page' => '$1'),
|
||||
'/^commands\/add\/?$/' => array('subtopic' => 'commands', 'action' => 'add'),
|
||||
'/^commands\/edit\/?$/' => array('subtopic' => 'commands', 'action' => 'edit'),
|
||||
'/^faq\/add\/?$/' => array('subtopic' => 'faq', 'action' => 'add'),
|
||||
'/^faq\/edit\/?$/' => array('subtopic' => 'faq', 'action' => 'edit'),
|
||||
'/^forum\/add_board\/?$/' => array('subtopic' => 'forum', 'action' => 'add_board'),#
|
||||
'/^forum\/edit_board\/?$/' => array('subtopic' => 'forum', 'action' => 'edit_board'),
|
||||
'/^forum\/board\/[0-9]+\/?$/' => array('subtopic' => 'forum', 'action' => 'show_board', 'id' => '$2'),
|
||||
'/^forum\/board\/[0-9]+\/[0-9]+\/?$/' => array('subtopic' => 'forum', 'action' => 'show_board', 'id' => '$2', 'page' => '$3'),
|
||||
'/^forum\/thread\/[0-9]+\/?$/' => array('subtopic' => 'forum', 'action' => 'show_thread', 'id' => '$2'),
|
||||
'/^forum\/thread\/[0-9]+\/[0-9]+\/?$/' => array('subtopic' => 'forum', 'action' => 'show_thread', 'id' => '$2', 'page' => '$3'),
|
||||
'/^gallery\/add\/?$/' => array('subtopic' => 'gallery', 'action' => 'add'),
|
||||
'/^gallery\/edit\/?$/' => array('subtopic' => 'gallery', 'action' => 'edit'),
|
||||
'/^gallery\/[0-9]+\/?$/' => array('subtopic' => 'gallery', 'image' => '$1'),
|
||||
'/^gifts\/history\/?$/' => array('subtopic' => 'gifts', 'action' => 'show_history'),
|
||||
'/^guilds\/[A-Za-z0-9-_%+\']+$/' => array('subtopic' => 'guilds', 'action' => 'show', 'guild' => '$1'),
|
||||
'/^highscores\/[A-Za-z0-9-_]+\/[A-Za-z0-9-_]+\/[0-9]+\/?$/' => array('subtopic' => 'highscores', 'list' => '$1', 'vocation' => '$2', 'page' => '$3'),
|
||||
'/^highscores\/[A-Za-z0-9-_]+\/[0-9]+\/?$/' => array('subtopic' => 'highscores', 'list' => '$1', 'page' => '$2'),
|
||||
'/^highscores\/[A-Za-z0-9-_]+\/[A-Za-z0-9-_]+\/?$/' => array('subtopic' => 'highscores', 'list' => '$1', 'vocation' => '$2'),
|
||||
'/^highscores\/[A-Za-z0-9-_\']+\/?$/' => array('subtopic' => 'highscores', 'list' => '$1'),
|
||||
'/^news\/add\/?$/' => array('subtopic' => 'news', 'action' => 'add'),
|
||||
'/^news\/edit\/?$/' => array('subtopic' => 'news', 'action' => 'edit'),
|
||||
'/^news\/archive\/?$/' => array('subtopic' => 'newsarchive'),
|
||||
'/^news\/archive\/[0-9]+\/?$/' => array('subtopic' => 'newsarchive', 'id' => '$2'),
|
||||
'/^polls\/[0-9]+\/?$/' => array('subtopic' => 'polls', 'id' => '$1'),
|
||||
'/^spells\/[A-Za-z0-9-_%]+\/[A-Za-z0-9-_]+\/?$/' => array('subtopic' => 'spells', 'vocation' => '$1', 'order' => '$2'),
|
||||
'/^houses\/view\/?$/' => array('subtopic' => 'houses', 'page' => 'view')
|
||||
);
|
||||
|
||||
foreach ($rules as $rule => $redirect) {
|
||||
if (preg_match($rule, $uri)) {
|
||||
$tmp = explode('/', $uri);
|
||||
/* @var $redirect array */
|
||||
foreach ($redirect as $key => $value) {
|
||||
|
||||
if (strpos($value, '$') !== false) {
|
||||
$value = str_replace('$' . $value[1], $tmp[$value[1]], $value);
|
||||
}
|
||||
|
||||
$_REQUEST[$key] = $value;
|
||||
$_GET[$key] = $value;
|
||||
}
|
||||
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
$page = isset($_REQUEST['subtopic']) ? $_REQUEST['subtopic'] : (isset($_REQUEST['p']) ? $_REQUEST['p'] : '');
|
||||
if(empty($page) || !preg_match('/^[A-z0-9\_\-]+$/', $page)) {
|
||||
$tmp = URI;
|
||||
if(!empty($tmp)) {
|
||||
$page = $tmp;
|
||||
}
|
||||
else {
|
||||
if(!$found)
|
||||
$page = '404';
|
||||
else
|
||||
$page = 'news';
|
||||
}
|
||||
}
|
||||
|
||||
$page = strtolower($page);
|
||||
define('PAGE', $page);
|
||||
|
||||
$template_place_holders = array();
|
||||
|
||||
// event system
|
||||
require_once SYSTEM . 'hooks.php';
|
||||
$hooks = new Hooks();
|
||||
$hooks->load();
|
||||
require_once SYSTEM . 'template.php';
|
||||
require_once SYSTEM . 'login.php';
|
||||
require_once SYSTEM . 'status.php';
|
||||
|
||||
$twig->addGlobal('config', $config);
|
||||
$twig->addGlobal('status', $status);
|
||||
|
||||
require_once SYSTEM . 'router.php';
|
||||
|
||||
require SYSTEM . 'migrate.php';
|
||||
|
||||
$hooks->trigger(HOOK_STARTUP);
|
||||
@@ -222,7 +119,7 @@ if(isset($config['anonymous_usage_statistics']) && $config['anonymous_usage_stat
|
||||
if(fetchDatabaseConfig('last_usage_report', $value)) {
|
||||
$should_report = time() > (int)$value + $report_time;
|
||||
if($cache->enabled()) {
|
||||
$cache->set('last_usage_report', $value, 60 * 60);
|
||||
$cache->set('last_usage_report', $value);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -237,7 +134,7 @@ if(isset($config['anonymous_usage_statistics']) && $config['anonymous_usage_stat
|
||||
|
||||
updateDatabaseConfig('last_usage_report', time());
|
||||
if($cache->enabled()) {
|
||||
$cache->set('last_usage_report', time(), 60 * 60);
|
||||
$cache->set('last_usage_report', time());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -251,35 +148,6 @@ if($config['visitors_counter'])
|
||||
$visitors = new Visitors($config['visitors_counter_ttl']);
|
||||
}
|
||||
|
||||
// page content loading
|
||||
if(!isset($content[0]))
|
||||
$content = '';
|
||||
$load_it = true;
|
||||
|
||||
// check if site has been closed
|
||||
$site_closed = false;
|
||||
if(fetchDatabaseConfig('site_closed', $site_closed)) {
|
||||
$site_closed = ($site_closed == 1);
|
||||
if($site_closed) {
|
||||
if(!admin())
|
||||
{
|
||||
$title = getDatabaseConfig('site_closed_title');
|
||||
$content .= '<p class="note">' . getDatabaseConfig('site_closed_message') . '</p><br/>';
|
||||
$load_it = false;
|
||||
}
|
||||
|
||||
if(!$logged)
|
||||
{
|
||||
ob_start();
|
||||
require SYSTEM . 'pages/accountmanagement.php';
|
||||
$content .= ob_get_contents();
|
||||
ob_end_clean();
|
||||
$load_it = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
define('SITE_CLOSED', $site_closed);
|
||||
|
||||
// backward support for gesior
|
||||
if($config['backward_support']) {
|
||||
define('INITIALIZED', true);
|
||||
@@ -288,7 +156,6 @@ if($config['backward_support']) {
|
||||
$layout_name = $template_path;
|
||||
$news_content = '';
|
||||
$tickers_content = '';
|
||||
$subtopic = PAGE;
|
||||
$main_content = '';
|
||||
|
||||
$config['access_admin_panel'] = 2;
|
||||
@@ -299,7 +166,6 @@ if($config['backward_support']) {
|
||||
$config['site'] = &$config;
|
||||
$config['server'] = &$config['lua'];
|
||||
$config['site']['shop_system'] = $config['gifts_system'];
|
||||
$config['site']['gallery_page'] = true;
|
||||
|
||||
if(!isset($config['vdarkborder']))
|
||||
$config['vdarkborder'] = '#505050';
|
||||
@@ -319,67 +185,15 @@ if($config['backward_support']) {
|
||||
$config['status']['serverStatus_' . $key] = $value;
|
||||
}
|
||||
|
||||
if($load_it)
|
||||
{
|
||||
if(SITE_CLOSED && admin())
|
||||
$content .= '<p class="note">Site is under maintenance (closed mode). Only privileged users can see it.</p>';
|
||||
|
||||
if($config['backward_support']) {
|
||||
require SYSTEM . 'compat/pages.php';
|
||||
require SYSTEM . 'compat/classes.php';
|
||||
}
|
||||
|
||||
$ignore = false;
|
||||
|
||||
$logged_access = 1;
|
||||
if($logged && $account_logged && $account_logged->isLoaded()) {
|
||||
$logged_access = $account_logged->getAccess();
|
||||
}
|
||||
|
||||
$success = false;
|
||||
$tmp_content = getCustomPage($page, $success);
|
||||
if($success) {
|
||||
$content .= $tmp_content;
|
||||
if(hasFlag(FLAG_CONTENT_PAGES) || superAdmin()) {
|
||||
$pageInfo = getCustomPageInfo($page);
|
||||
$content = $twig->render('admin.pages.links.html.twig', array(
|
||||
'page' => array('id' => $pageInfo !== null ? $pageInfo['id'] : 0, 'hidden' => $pageInfo !== null ? $pageInfo['hidden'] : '0')
|
||||
)) . $content;
|
||||
}
|
||||
} else {
|
||||
$file = TEMPLATES . "$template_name/pages/$page.php";
|
||||
if(!@file_exists($file) || preg_match('/[^A-z0-9_\-]/', $page)) {
|
||||
$file = SYSTEM . "pages/$page.php";
|
||||
if(!@file_exists($file) || preg_match('/[^A-z0-9_\-]/', $page)) {
|
||||
$page = '404';
|
||||
$file = SYSTEM . 'pages/404.php';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ob_start();
|
||||
if($hooks->trigger(HOOK_BEFORE_PAGE)) {
|
||||
if(!$ignore)
|
||||
require $file;
|
||||
}
|
||||
|
||||
if($config['backward_support'] && isset($main_content[0]))
|
||||
$content .= $main_content;
|
||||
|
||||
$content .= ob_get_contents();
|
||||
ob_end_clean();
|
||||
$hooks->trigger(HOOK_AFTER_PAGE);
|
||||
/**
|
||||
* @var OTS_Account $account_logged
|
||||
*/
|
||||
if ($logged && admin()) {
|
||||
$content .= $twig->render('admin-bar.html.twig', [
|
||||
'username' => USE_ACCOUNT_NAME ? $account_logged->getName() : $account_logged->getId()
|
||||
]);
|
||||
}
|
||||
|
||||
if($config['backward_support']) {
|
||||
$main_content = $content;
|
||||
if(!isset($title))
|
||||
$title = ucfirst($page);
|
||||
|
||||
$topic = $title;
|
||||
}
|
||||
|
||||
$title_full = (isset($title) ? $title . $config['title_separator'] : '') . $config['lua']['serverName'];
|
||||
$title_full = (isset($title) ? $title . ' - ' : '') . $config['lua']['serverName'];
|
||||
require $template_path . '/' . $template_index;
|
||||
|
||||
echo base64_decode('PCEtLSBQb3dlcmVkIGJ5IE15QUFDIDo6IGh0dHBzOi8vd3d3Lm15LWFhYy5vcmcvIC0tPg==') . PHP_EOL;
|
||||
|
@@ -38,3 +38,4 @@ if(!isset($error) || !$error) {
|
||||
$error = true;
|
||||
}
|
||||
}
|
||||
?>
|
@@ -6,12 +6,18 @@ $ots = POT::getInstance();
|
||||
require SYSTEM . 'database.php';
|
||||
|
||||
if(!isset($db)) {
|
||||
$database_error = $locale['step_database_error_mysql_connect'] . '<br/>' .
|
||||
$locale['step_database_error_mysql_connect_2'] .
|
||||
'<ul>' .
|
||||
'<li>' . $locale['step_database_error_mysql_connect_3'] . '</li>' .
|
||||
'<li>' . $locale['step_database_error_mysql_connect_4'] . '</li>' .
|
||||
'</ul>' . '<br/>' . $error;
|
||||
$database_error = '<p class="lead">' . $locale['step_database_error_mysql_connect'] . '</p>';
|
||||
|
||||
$database_error .= '<p>' . $locale['step_database_error_mysql_connect_2'] . '</p>';
|
||||
|
||||
$database_error .= '<ul class="list-group">' .
|
||||
'<li class="list-group-item list-group-item-warning">' . $locale['step_database_error_mysql_connect_3'] . '</li>' .
|
||||
'<li class="list-group-item list-group-item-warning">' . $locale['step_database_error_mysql_connect_4'] . '</li>' .
|
||||
'</ul>';
|
||||
|
||||
$database_error .= '<div class="alert alert-danger mt-4">
|
||||
<span>' . $error . '</span>
|
||||
</div>';
|
||||
}
|
||||
else {
|
||||
if($db->hasTable('accounts'))
|
||||
|
@@ -62,9 +62,9 @@ function next_buttons($previous = true, $next = true)
|
||||
$ret .= '<input class="button" type="submit" onclick="document.getElementById(\'step\').value=\'' . $steps[$i + 1] . '\';" value="' . $locale['next'] . '" />';
|
||||
*/
|
||||
if($previous)
|
||||
$ret .= '<input type="button" class="button" onclick="document.getElementById(\'step\').value=\'' . $steps[$i - 1] . '\'; this.form.submit();" value="« ' . $locale['previous'] . '" />';
|
||||
$ret .= '<input type="button" class="button btn btn-primary m-2" onclick="document.getElementById(\'step\').value=\'' . $steps[$i - 1] . '\'; this.form.submit();" value="« ' . $locale['previous'] . '" />';
|
||||
if($next)
|
||||
$ret .= '<input type="button" class="button" onclick="document.getElementById(\'step\').value=\'' . $steps[$i + 1] . '\'; this.form.submit(); " value="' . $locale['next'] . ' »" />';
|
||||
$ret .= '<input type="button" class="button btn btn-primary m-2" onclick="document.getElementById(\'step\').value=\'' . $steps[$i + 1] . '\'; this.form.submit(); " value="' . $locale['next'] . ' »" />';
|
||||
|
||||
$ret .= '</div>';
|
||||
return $ret;
|
||||
|
@@ -207,21 +207,24 @@ CREATE TABLE `myaac_monsters` (
|
||||
`use_haste` tinyint(1) NOT NULL,
|
||||
`voices` text NOT NULL,
|
||||
`immunities` varchar(255) NOT NULL,
|
||||
`elements` TEXT NOT NULL,
|
||||
`summonable` tinyint(1) NOT NULL,
|
||||
`convinceable` tinyint(1) NOT NULL,
|
||||
`pushable` TINYINT(1) NOT NULL DEFAULT '0',
|
||||
`canpushitems` TINYINT(1) NOT NULL DEFAULT '0',
|
||||
`canwalkonenergy` TINYINT(1) NOT NULL DEFAULT '0',
|
||||
`canwalkonpoison` TINYINT(1) NOT NULL DEFAULT '0',
|
||||
`canwalkonfire` TINYINT(1) NOT NULL DEFAULT '0',
|
||||
`runonhealth` TINYINT(1) NOT NULL DEFAULT '0',
|
||||
`hostile` TINYINT(1) NOT NULL DEFAULT '0',
|
||||
`attackable` TINYINT(1) NOT NULL DEFAULT '0',
|
||||
`rewardboss` TINYINT(1) NOT NULL DEFAULT '0',
|
||||
`defense` INT(11) NOT NULL DEFAULT '0',
|
||||
`armor` INT(11) NOT NULL DEFAULT '0',
|
||||
`canpushcreatures` TINYINT(1) NOT NULL DEFAULT '0',
|
||||
`race` varchar(255) NOT NULL,
|
||||
`loot` text NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8;
|
||||
|
||||
CREATE TABLE `myaac_videos`
|
||||
(
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`title` VARCHAR(100) NOT NULL DEFAULT '',
|
||||
`youtube_id` VARCHAR(20) NOT NULL,
|
||||
`author` VARCHAR(50) NOT NULL DEFAULT '',
|
||||
`ordering` INT(11) NOT NULL DEFAULT 0,
|
||||
`hidden` TINYINT(1) NOT NULL DEFAULT 0,
|
||||
`summons` TEXT NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8;
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
We have detected that you don't have access to write to the system/cache directory. Under linux you can fix it by using this two command, where first one should be enough (for apache):<br/><br/><span class="console">chown -R www-data.www-data /var/www/*</span><br/><span class="console">chmod -R 760 system/cache</span>
|
||||
We have detected that you don't have access to write to the system/cache directory. Under linux you can fix it by using this two command, where first one should be enough (for apache):<br/><br/><span class="console">chown -R www-data.www-data /var/www/*</span><br/><span class="console">chmod -R 660 system/cache</span>
|
||||
|
||||
<style type="text/css">
|
||||
.console {
|
||||
@@ -8,4 +8,4 @@ We have detected that you don't have access to write to the system/cache directo
|
||||
border: 3px double #CCCCCC;
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
@@ -70,7 +70,7 @@ if($step == 'database') {
|
||||
|
||||
$key = str_replace('var_', '', $key);
|
||||
|
||||
if(in_array($key, array('account', 'account_id', 'password', 'email', 'player_name'))) {
|
||||
if(in_array($key, array('account', 'password', 'password_confirm', 'email', 'player_name'))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -95,10 +95,6 @@ if($step == 'database') {
|
||||
$errors[] = $locale['step_config_mail_admin_error'];
|
||||
break;
|
||||
}
|
||||
else if($key == 'mail_address' && !Validator::email($value)) {
|
||||
$errors[] = $locale['step_config_mail_address_error'];
|
||||
break;
|
||||
}
|
||||
else if($key == 'timezone' && !in_array($value, DateTimeZone::listIdentifiers())) {
|
||||
$errors[] = $locale['step_config_timezone_error'];
|
||||
break;
|
||||
@@ -114,16 +110,19 @@ if($step == 'database') {
|
||||
}
|
||||
}
|
||||
else if($step == 'admin') {
|
||||
if(!file_exists(BASE . 'config.local.php') || !isset($config['installed']) || !$config['installed']) {
|
||||
$step = 'database';
|
||||
$config_failed = true;
|
||||
if(file_exists(BASE . 'config.local.php') && isset($config['installed']) && $config['installed'] && isset($_SESSION['saved'])) {
|
||||
$config_failed = false;
|
||||
}
|
||||
else {
|
||||
$_SESSION['saved'] = true;
|
||||
|
||||
if($config_failed) {
|
||||
$step = 'database';
|
||||
}
|
||||
}
|
||||
else if($step == 'finish') {
|
||||
$email = $_SESSION['var_email'];
|
||||
$password = $_SESSION['var_password'];
|
||||
$password_confirm = $_SESSION['var_password_confirm'];
|
||||
$player_name = $_SESSION['var_player_name'];
|
||||
|
||||
// email check
|
||||
@@ -165,6 +164,9 @@ else if($step == 'finish') {
|
||||
else if(!Validator::password($password)) {
|
||||
$errors[] = $locale['step_admin_password_error_format'];
|
||||
}
|
||||
else if($password != $password_confirm) {
|
||||
$errors[] = $locale['step_admin_password_confirm_error_not_same'];
|
||||
}
|
||||
|
||||
// player name check
|
||||
if(empty($player_name)) {
|
||||
@@ -189,14 +191,14 @@ clearstatcache();
|
||||
if(is_writable(CACHE) && (MYAAC_OS != 'WINDOWS' || win_is_writable(CACHE))) {
|
||||
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/>
|
||||
Your IP is:<br /><b>' . get_browser_real_ip() . '</b>', true);
|
||||
Your IP is:<br /><b>' . $_SERVER['REMOTE_ADDR'] . '</b>', true);
|
||||
}
|
||||
else {
|
||||
$file_content = trim(file_get_contents(BASE . 'install/ip.txt'));
|
||||
$allow = false;
|
||||
$listIP = preg_split('/\s+/', $file_content);
|
||||
foreach($listIP as $ip) {
|
||||
if(get_browser_real_ip() == $ip) {
|
||||
if($_SERVER['REMOTE_ADDR'] == $ip) {
|
||||
$allow = true;
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
if(isset($config['installed']) && $config['installed'] && !isset($_SESSION['saved'])) {
|
||||
echo '<p class="warning">' . $locale['already_installed'] . '</p>';
|
||||
echo '<div class="alert alert-warning"><span>' . $locale['already_installed'] . '</span></div>';
|
||||
}
|
||||
else {
|
||||
unset($_SESSION['saved']);
|
||||
|
@@ -5,3 +5,4 @@ $twig->display('install.license.html.twig', array(
|
||||
'license' => file_get_contents(BASE . 'LICENSE'),
|
||||
'buttons' => next_buttons()
|
||||
));
|
||||
?>
|
||||
|
@@ -2,8 +2,21 @@
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
|
||||
// configuration
|
||||
$dirs_required = [
|
||||
'system/logs',
|
||||
'system/cache',
|
||||
];
|
||||
$dirs_optional = [
|
||||
GUILD_IMAGES_DIR => $locale['step_requirements_warning_images_guilds'],
|
||||
GALLERY_DIR => $locale['step_requirements_warning_images_gallery'],
|
||||
];
|
||||
|
||||
$extensions_required = [
|
||||
'pdo', 'pdo_mysql', 'xml', 'zip'
|
||||
'pdo', 'pdo_mysql', 'json', 'xml'
|
||||
];
|
||||
$extensions_optional = [
|
||||
'gd' => $locale['step_requirements_warning_player_signatures'],
|
||||
'zip' => $locale['step_requirements_warning_install_plugins'],
|
||||
];
|
||||
/*
|
||||
*
|
||||
@@ -14,11 +27,11 @@ $extensions_required = [
|
||||
function version_check($name, $ok, $info = '', $warning = false)
|
||||
{
|
||||
global $failed;
|
||||
echo '<p class="' . ($ok ? 'success' : ($warning ? 'warning' : 'error')) . '">' . $name;
|
||||
echo '<div class="alert alert-' . ($ok ? 'success' : ($warning ? 'warning' : 'danger')) . '">' . $name;
|
||||
if(!empty($info))
|
||||
echo ': <b>' . $info . '</b>';
|
||||
|
||||
echo '</p>';
|
||||
echo '</div>';
|
||||
if(!$ok && !$warning)
|
||||
$failed = true;
|
||||
}
|
||||
@@ -27,12 +40,18 @@ $failed = false;
|
||||
|
||||
// start validating
|
||||
version_check($locale['step_requirements_php_version'], (PHP_VERSION_ID >= 50500), PHP_VERSION);
|
||||
foreach(array('images/guilds', 'images/houses', 'images/gallery') as $value)
|
||||
|
||||
foreach ($dirs_required as $value)
|
||||
{
|
||||
$is_writable = is_writable(BASE . $value);
|
||||
$is_writable = is_writable(BASE . $value) && (MYAAC_OS != 'WINDOWS' || win_is_writable(BASE . $value));
|
||||
version_check($locale['step_requirements_write_perms'] . ': ' . $value, $is_writable);
|
||||
}
|
||||
|
||||
foreach ($dirs_optional as $dir => $errorMsg) {
|
||||
$is_writable = is_writable(BASE . $dir) && (MYAAC_OS != 'WINDOWS' || win_is_writable(BASE . $dir));
|
||||
version_check($locale['step_requirements_write_perms'] . ': ' . $dir, $is_writable, $is_writable ? '' : $errorMsg, true);
|
||||
}
|
||||
|
||||
$ini_register_globals = ini_get_bool('register_globals');
|
||||
version_check('register_long_arrays', !$ini_register_globals, $ini_register_globals ? $locale['on'] : $locale['off']);
|
||||
|
||||
@@ -44,12 +63,19 @@ foreach ($extensions_required as $ext) {
|
||||
version_check(str_replace('$EXTENSION$', strtoupper($ext), $locale['step_requirements_extension']) , $loaded, $loaded ? $locale['loaded'] : $locale['not_loaded']);
|
||||
}
|
||||
|
||||
|
||||
if($failed)
|
||||
{
|
||||
echo '<br/><b>' . $locale['step_requirements_failed'];
|
||||
echo next_form(true, false);
|
||||
foreach ($extensions_optional as $ext => $errorMsg) {
|
||||
$loaded = extension_loaded($ext);
|
||||
version_check(str_replace('$EXTENSION$', strtoupper($ext), $locale['step_requirements_extension']) , $loaded, $loaded ? $locale['loaded'] : $locale['not_loaded'] . '. ' . $errorMsg, true);
|
||||
}
|
||||
else
|
||||
|
||||
echo '<div class="text-center m-3">';
|
||||
|
||||
if($failed) {
|
||||
echo '<div class="alert alert-warning"><span>' . $locale['step_requirements_failed'] . '</span></div>';
|
||||
echo next_form(true, false);
|
||||
}else {
|
||||
echo next_form(true, true);
|
||||
?>
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
?>
|
||||
|
@@ -18,3 +18,4 @@ $twig->display('install.config.html.twig', array(
|
||||
'errors' => isset($errors) ? $errors : null,
|
||||
'buttons' => next_buttons()
|
||||
));
|
||||
?>
|
@@ -21,8 +21,6 @@ if(!$error) {
|
||||
// user can disable when he wants
|
||||
$content .= '$config[\'env\'] = \'prod\'; // dev or prod';
|
||||
$content .= PHP_EOL;
|
||||
$content .= '$config[\'mail_enabled\'] = true;';
|
||||
$content .= PHP_EOL;
|
||||
foreach($_SESSION as $key => $value)
|
||||
{
|
||||
if(strpos($key, 'var_') !== false)
|
||||
@@ -57,40 +55,17 @@ if(!$error) {
|
||||
error($database_error);
|
||||
}
|
||||
else {
|
||||
if(!$db->hasTable('accounts')) {
|
||||
$tmp = str_replace('$TABLE$', 'accounts', $locale['step_database_error_table']);
|
||||
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;
|
||||
}
|
||||
$twig->display('install.installer.html.twig', array(
|
||||
'url' => 'tools/5-database.php',
|
||||
'message' => $locale['loading_spinner']
|
||||
));
|
||||
|
||||
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'])) {
|
||||
error($locale['step_config_mail_admin_error']);
|
||||
$error = true;
|
||||
}
|
||||
|
||||
if(!Validator::email($_SESSION['var_mail_address'])) {
|
||||
error($locale['step_config_mail_address_error']);
|
||||
$error = true;
|
||||
}
|
||||
|
||||
$content .= '$config[\'session_prefix\'] = \'myaac_' . generateRandomString(8, true, false, true, false) . '_\';';
|
||||
$content .= PHP_EOL;
|
||||
$content .= '$config[\'cache_prefix\'] = \'myaac_' . generateRandomString(8, true, false, true, false) . '_\';';
|
||||
@@ -111,7 +86,7 @@ if(!$error) {
|
||||
unset($_SESSION['saved']);
|
||||
|
||||
$locale['step_database_error_file'] = str_replace('$FILE$', '<b>' . BASE . 'config.local.php</b>', $locale['step_database_error_file']);
|
||||
error($locale['step_database_error_file'] . '<br/>
|
||||
warning($locale['step_database_error_file'] . '<br/>
|
||||
<textarea cols="70" rows="10">' . $content . '</textarea>');
|
||||
}
|
||||
}
|
||||
@@ -120,8 +95,10 @@ if(!$error) {
|
||||
}
|
||||
?>
|
||||
|
||||
<form action="<?php echo BASE_URL; ?>install/" method="post">
|
||||
<input type="hidden" name="step" id="step" value="admin" />
|
||||
<?php echo next_buttons(true, !$error);
|
||||
?>
|
||||
</form>
|
||||
<div class="text-center m-3">
|
||||
<form action="<?php echo BASE_URL; ?>install/" method="post">
|
||||
<input type="hidden" name="step" id="step" value="admin" />
|
||||
<?php echo next_buttons(true, $error ? false : true);
|
||||
?>
|
||||
</form>
|
||||
</div>
|
@@ -15,8 +15,7 @@ else {
|
||||
|
||||
$password = $_SESSION['var_password'];
|
||||
|
||||
$config_salt_enabled = $db->hasColumn('accounts', 'salt');
|
||||
if($config_salt_enabled)
|
||||
if(USE_ACCOUNT_SALT)
|
||||
{
|
||||
$salt = generateRandomString(10, false, true, true);
|
||||
$password = $salt . $password;
|
||||
@@ -66,6 +65,7 @@ else {
|
||||
$new_account->setPassword(encrypt($password));
|
||||
$new_account->setEMail($email);
|
||||
|
||||
$new_account->unblock();
|
||||
$new_account->save();
|
||||
|
||||
$new_account->setCustomField('created', time());
|
||||
@@ -74,13 +74,11 @@ else {
|
||||
$account_used = &$new_account;
|
||||
}
|
||||
|
||||
if($config_salt_enabled)
|
||||
if(USE_ACCOUNT_SALT)
|
||||
$account_used->setCustomField('salt', $salt);
|
||||
|
||||
$account_used->setCustomField('web_flags', FLAG_ADMIN + FLAG_SUPER_ADMIN);
|
||||
$account_used->setCustomField('country', 'us');
|
||||
$account_used->setCustomField('email_verified', 1);
|
||||
|
||||
if($db->hasColumn('accounts', 'group_id'))
|
||||
$account_used->setCustomField('group_id', $groups->getHighestId());
|
||||
if($db->hasColumn('accounts', 'type'))
|
||||
|
@@ -1,299 +1,13 @@
|
||||
* {
|
||||
margin: 0; padding: 0;
|
||||
}
|
||||
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@100;300;400&display=swap');
|
||||
|
||||
body {
|
||||
text-align: center;
|
||||
font: 12px Verdana;
|
||||
color: #000000;
|
||||
background-color: #000000;
|
||||
}
|
||||
img {
|
||||
border: 0;
|
||||
font-family: 'Roboto', sans-serif;
|
||||
}
|
||||
|
||||
.break {
|
||||
font-size: 0;
|
||||
width: 0; height: 0;
|
||||
clear: both;
|
||||
}
|
||||
.alignleft {
|
||||
float: left;
|
||||
margin: 4px 10px 5px 0;
|
||||
}
|
||||
.alignright {
|
||||
float: right;
|
||||
margin: 4px 0 5px 10px;
|
||||
}
|
||||
.aligncenter {
|
||||
text-align: center;
|
||||
h1{
|
||||
font-weight: 100 !important;
|
||||
}
|
||||
|
||||
/** BEGIN wrapper **/
|
||||
#wrapper {
|
||||
background: #ffffff url(images/background.jpg) repeat-x 0 0;
|
||||
width: 980px;
|
||||
}
|
||||
|
||||
#header {
|
||||
margin-bottom: 10px;
|
||||
border-bottom: 1px solid #eee;
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
|
||||
#footer {
|
||||
padding-top: 15px;
|
||||
border-top: 1px solid #eee;
|
||||
margin-top: 10px;
|
||||
text-align: right;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
#header h1 {
|
||||
font-weight: bold;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#header span {
|
||||
font-size: 25px;
|
||||
color: #000;
|
||||
font-weight: bold;
|
||||
padding-left: 40px;
|
||||
line-height: 80px;
|
||||
}
|
||||
|
||||
#version {
|
||||
float: right;
|
||||
color: #000;
|
||||
font-size: 17px;
|
||||
padding-top: 25px;
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
/** BEGIN body **/
|
||||
#body {
|
||||
background: url(images/wrapper.gif) repeat-y 0 0;
|
||||
}
|
||||
/** END body **/
|
||||
|
||||
/** BEGIN content **/
|
||||
#content {
|
||||
width: 642px;
|
||||
float: left;
|
||||
padding: 20px 18px 20px 20px;
|
||||
color: #434242;
|
||||
}
|
||||
|
||||
/** begin headers **/
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
font-family: Tahoma;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
h2, h3, h4, h5, h6 {
|
||||
margin-top: 30px;
|
||||
}
|
||||
h1 { font-size: 2em; }
|
||||
h2 { font-size: 1.6em; }
|
||||
h3 { font-size: 1.3em; }
|
||||
h4, h5, h6 { font-size: 1em; }
|
||||
/** end headers **/
|
||||
|
||||
/** begin messages **/
|
||||
.error, .success, .note, .warning {
|
||||
font-weight: bold;
|
||||
font-size: 0.9em;
|
||||
padding: 4px 10px 4px 24px;
|
||||
background-repeat: no-repeat;
|
||||
background-position: 5px 6px;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
line-height: 1.6em;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.error {
|
||||
background-color: #FDD9D9;
|
||||
background-image: url(images/error.gif);
|
||||
border-color: #FBA3A3;
|
||||
color: #D80303;
|
||||
}
|
||||
.success {
|
||||
background-color: #E4FCD9;
|
||||
background-image: url(images/success.gif);
|
||||
border-color: #BFFDA3;
|
||||
color: #35A502;
|
||||
}
|
||||
.note {
|
||||
background-color: #DDEAFA;
|
||||
background-image: url(images/note.gif);
|
||||
border-color: #A3D8FD;
|
||||
color: #026DA5;
|
||||
}
|
||||
.warning {
|
||||
background-color: #FBF0B3;
|
||||
background-image: url(images/warning.gif);
|
||||
border-color: #FBBB95;
|
||||
color: #FD6002;
|
||||
}
|
||||
/** end messages **/
|
||||
|
||||
/** begin form **/
|
||||
form {
|
||||
border: 1px solid #DDDDDD;
|
||||
padding: 16px;
|
||||
}
|
||||
form .input {
|
||||
padding-top: 12px;
|
||||
clear: both;
|
||||
}
|
||||
form .first {
|
||||
padding-top: 0;
|
||||
}
|
||||
form .input p {
|
||||
margin-bottom: 7px !important;
|
||||
}
|
||||
form input {
|
||||
margin-right: 5px;
|
||||
}
|
||||
form label {
|
||||
margin-right: 10px;
|
||||
color: #8B8B8B;
|
||||
}
|
||||
form input.text, form textarea {
|
||||
border: 1px solid #BEBDBD;
|
||||
font-size: 1em;
|
||||
font-family: Verdana;
|
||||
background-color: #F3F3F3;
|
||||
color: #808080;
|
||||
padding: 2px;
|
||||
max-width: 100%;
|
||||
}
|
||||
.positive, .negative {
|
||||
font-size: 0.9em;
|
||||
font-weight: bold;
|
||||
padding: 1px 0 0 20px;
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 0;
|
||||
display: inline;
|
||||
margin-top: 2px;
|
||||
}
|
||||
.positive {
|
||||
background-image: url(images/positive.gif);
|
||||
color: #35A502;
|
||||
}
|
||||
.negative {
|
||||
background-image: url(images/negative.gif);
|
||||
color: #D80303;
|
||||
}
|
||||
form textarea {
|
||||
line-height: 1.6em;
|
||||
}
|
||||
form button, form input.button {
|
||||
font-size: 0.9em;
|
||||
font-family: Verdana;
|
||||
font-weight: bold;
|
||||
color: #ffffff;
|
||||
background: #B6B4B4 url(images/button.gif) repeat-x 0 0;
|
||||
border: 1px solid #B6B4B4;
|
||||
padding: 5px 10px;
|
||||
}
|
||||
/** end form **/
|
||||
|
||||
/** begin table **/
|
||||
table {
|
||||
|
||||
}
|
||||
table th {
|
||||
font-size: 0.9em;
|
||||
color: #ffffff;
|
||||
background-color: #679BC5;
|
||||
padding: 2px 4px;
|
||||
line-height: 1.6em;
|
||||
}
|
||||
table td {
|
||||
line-height: 1.6em;
|
||||
padding: 2px 4px;
|
||||
}
|
||||
table tr.odd td { background-color: #EEEEEE; }
|
||||
table tr.even td { background-color: #E5E5E5; }
|
||||
|
||||
/** end table **/
|
||||
|
||||
/** begin paragraphs, lists, etc. **/
|
||||
#content p {
|
||||
line-height: 1.6em;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
#content ul, #content ol {
|
||||
list-style-position: inside;
|
||||
}
|
||||
#content li {
|
||||
line-height: 1.6em;
|
||||
padding: 2px 0 2px 0;
|
||||
}
|
||||
a {
|
||||
color: #679BC5;
|
||||
}
|
||||
a:hover {
|
||||
color: #ff0000;
|
||||
text-decoration: none;
|
||||
}
|
||||
blockquote {
|
||||
padding: 10px;
|
||||
background-color: #eeeeee;
|
||||
line-height: 1.6em;
|
||||
border-width: 2px 0 1px;
|
||||
border-style: solid;
|
||||
border-color: #e0e0e0;
|
||||
}
|
||||
/** end paragraphs, lists, etc. **/
|
||||
|
||||
/** END content **/
|
||||
|
||||
/** BEGIN sidebar **/
|
||||
#sidebar {
|
||||
width: 300px;
|
||||
float: right;
|
||||
padding: 10px 0;
|
||||
}
|
||||
#sidebar h2 {
|
||||
background: green url(images/sidehead.gif) no-repeat 0 0;
|
||||
margin: 0 10px;
|
||||
font-size: 1em;
|
||||
color: #ffffff;
|
||||
padding: 7px 10px;
|
||||
}
|
||||
#sidebar ul {
|
||||
list-style-type: none;
|
||||
background: #E0E0E0 url(images/sidebody.gif) no-repeat 0 bottom;
|
||||
padding: 10px;
|
||||
margin: 0 10px 10px;
|
||||
}
|
||||
#sidebar ul li {
|
||||
padding: 4px 0 4px 14px;
|
||||
background: none;
|
||||
line-height: 1.6em;
|
||||
font-size: 0.9em;
|
||||
font-weight: bold;
|
||||
}
|
||||
#sidebar ul li a {
|
||||
color: #000000;
|
||||
text-decoration: none;
|
||||
}
|
||||
#sidebar ul li a:hover {
|
||||
text-decoration: none;
|
||||
color: #ff0000;
|
||||
}
|
||||
|
||||
#sidebar ul li a:active {
|
||||
text-decoration: none;
|
||||
color: #ff0000;
|
||||
}
|
||||
|
||||
#sidebar ul li current {
|
||||
text-decoration: none;
|
||||
color: #ff0000;
|
||||
}
|
||||
.current {
|
||||
text-decoration: none;
|
||||
color: #ff0000;
|
||||
}
|
||||
h3 {
|
||||
font-weight: 300 !important;
|
||||
}
|
@@ -1,49 +1,74 @@
|
||||
<?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">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" dir="<?php echo $locale['direction']; ?>" lang="<?php echo $locale['lang']; ?>" xml:lang="<?php echo $locale['lang']; ?>">
|
||||
<!DOCTYPE html>
|
||||
<html dir="<?php echo $locale['direction']; ?>" lang="<?php echo $locale['lang']; ?>" xml:lang="<?php echo $locale['lang']; ?>">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $locale['encoding']; ?>" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>MyAAC - <?php echo $locale['installation']; ?></title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">
|
||||
<link rel="stylesheet" type="text/css" href="template/style.css" />
|
||||
<script type="text/javascript" src="<?php echo BASE_URL; ?>tools/js/jquery.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="wrapper">
|
||||
<!--div class="buffer"-->
|
||||
<div id="header">
|
||||
<h1>MyAAC <?php echo $locale['installation']; ?></h1>
|
||||
</div>
|
||||
|
||||
<div id="body">
|
||||
<div id="body" class="container">
|
||||
|
||||
<header id="header" class="pt-5 pb-4 pb-sm-5">
|
||||
<h1>MyAAC <?php echo $locale['installation']; ?></h1>
|
||||
</header>
|
||||
|
||||
<div id="sidebar">
|
||||
<h2><?php echo $locale['steps']; ?></h2>
|
||||
<ul>
|
||||
<?php
|
||||
$i = 0;
|
||||
foreach($steps as $key => $value)
|
||||
echo '<li' . ($step == $value ? ' class="current"' : '') . '>' . ++$i . '. ' . $locale['step_' . $value] . '</li>';
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
<div id="content">
|
||||
<div id="sidebar" class="col-md-3">
|
||||
<h3><?php echo $locale['steps']; ?></h3>
|
||||
<ul class="list-group mt-4">
|
||||
<?php
|
||||
if(isset($locale['step_' . $step . '_title']))
|
||||
echo '<h1>' . $locale['step_' . $step . '_title'] . '</h1>';
|
||||
else
|
||||
echo '<h1>' . $locale['step_' . $step] . '</h1>';
|
||||
echo $content;
|
||||
$i = 0;
|
||||
foreach($steps as $key => $value){
|
||||
|
||||
if ($step == $value) {
|
||||
$progress = ($i == 6) ? 100 : $i * 16;
|
||||
}
|
||||
|
||||
echo '<li' . ($step == $value ? ' class="list-group-item active"' : ' class="list-group-item"') . '>' . ++$i . '. ' . $locale['step_' . $value] . '</li>';
|
||||
}
|
||||
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div class="break"></div>
|
||||
</ul>
|
||||
</div>
|
||||
<!--/div-->
|
||||
|
||||
<div id="content" class="col-md-9">
|
||||
|
||||
<?php
|
||||
if(isset($locale['step_' . $step . '_title']))
|
||||
echo '<h3 class="mb-4 mt-4 mt-md-0">' . $locale['step_' . $step . '_title'] . '</h3>';
|
||||
else
|
||||
echo '<h3 class="mb-4 mt-4 mt-md-0">' . $locale['step_' . $step] . '</h3>';
|
||||
?>
|
||||
|
||||
<?php
|
||||
if(!isset($config['installed'])):
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="progress mb-2">
|
||||
<div class="progress-bar progress-bar-striped progress-bar-animated" style="width: <?php echo $progress; ?>%" role="progressbar" aria-valuenow="<?php echo $progress; ?>" aria-valuemin="0" aria-valuemax="100"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php echo $content; ?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
|
||||
</div>
|
||||
|
||||
<div id="footer">
|
||||
<footer id="footer" class="p-4">
|
||||
<p style="text-align: center;"><?php echo base64_decode('UG93ZXJlZCBieSA8YSBocmVmPSJodHRwOi8vbXktYWFjLm9yZyIgdGFyZ2V0PSJfYmxhbmsiPk15QUFDLjwvYT4='); ?></p>
|
||||
</div>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
@@ -11,10 +11,8 @@ $error = false;
|
||||
require BASE . 'install/includes/config.php';
|
||||
|
||||
ini_set('max_execution_time', 300);
|
||||
|
||||
@ob_end_flush();
|
||||
ob_implicit_flush();
|
||||
|
||||
ob_end_flush();
|
||||
header('X-Accel-Buffering: no');
|
||||
|
||||
if(!$error) {
|
||||
@@ -25,6 +23,24 @@ 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')) {
|
||||
$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']);
|
||||
@@ -57,8 +73,13 @@ else {
|
||||
success($locale['step_database_adding_field'] . ' accounts.key...');
|
||||
}
|
||||
|
||||
if(!$db->hasColumn('accounts', 'blocked')) {
|
||||
if(query("ALTER TABLE `accounts` ADD `blocked` TINYINT(1) NOT NULL DEFAULT FALSE COMMENT 'internal usage' AFTER `key`;"))
|
||||
success($locale['step_database_adding_field'] . ' accounts.blocked...');
|
||||
}
|
||||
|
||||
if(!$db->hasColumn('accounts', 'created')) {
|
||||
if(query("ALTER TABLE `accounts` ADD `created` INT(11) NOT NULL DEFAULT 0 AFTER `" . ($db->hasColumn('accounts', 'group_id') ? 'group_id' : 'email') . "`;"))
|
||||
if(query("ALTER TABLE `accounts` ADD `created` INT(11) NOT NULL DEFAULT 0 AFTER `" . ($db->hasColumn('accounts', 'group_id') ? 'group_id' : 'blocked') . "`;"))
|
||||
success($locale['step_database_adding_field'] . ' accounts.created...');
|
||||
}
|
||||
|
||||
|
@@ -8,10 +8,8 @@ require BASE . 'install/includes/functions.php';
|
||||
require BASE . 'install/includes/locale.php';
|
||||
|
||||
ini_set('max_execution_time', 300);
|
||||
|
||||
@ob_end_flush();
|
||||
ob_implicit_flush();
|
||||
|
||||
ob_end_flush();
|
||||
header('X-Accel-Buffering: no');
|
||||
|
||||
if(isset($config['installed']) && $config['installed'] && !isset($_SESSION['saved'])) {
|
||||
@@ -47,38 +45,9 @@ if($success) {
|
||||
success($locale['step_database_imported_players']);
|
||||
}
|
||||
|
||||
require LIBS . 'items.php';
|
||||
if(Items::loadFromXML())
|
||||
success($locale['step_database_loaded_items']);
|
||||
else
|
||||
error(Items::getError());
|
||||
|
||||
require LIBS . 'weapons.php';
|
||||
if(Weapons::loadFromXML())
|
||||
success($locale['step_database_loaded_weapons']);
|
||||
else
|
||||
error(Weapons::getError());
|
||||
|
||||
require LIBS . 'creatures.php';
|
||||
if(Creatures::loadFromXML()) {
|
||||
success($locale['step_database_loaded_monsters']);
|
||||
|
||||
if(Creatures::getMonstersList()->hasErrors()) {
|
||||
$locale['step_database_error_monsters'] = str_replace('$LOG$', 'system/logs/error.log', $locale['step_database_error_monsters']);
|
||||
warning($locale['step_database_error_monsters']);
|
||||
}
|
||||
}
|
||||
else {
|
||||
error(Creatures::getLastError());
|
||||
}
|
||||
|
||||
require LIBS . 'spells.php';
|
||||
if(Spells::loadFromXML()) {
|
||||
success($locale['step_database_loaded_spells']);
|
||||
}
|
||||
else {
|
||||
error(Spells::getLastError());
|
||||
}
|
||||
require LIBS . 'DataLoader.php';
|
||||
DataLoader::setLocale($locale);
|
||||
DataLoader::load();
|
||||
|
||||
// update config.highscores_ids_hidden
|
||||
require_once SYSTEM . 'migrations/20.php';
|
||||
@@ -101,4 +70,4 @@ $locale['step_finish_desc'] = str_replace('$ADMIN_PANEL$', generateLink(str_repl
|
||||
$locale['step_finish_desc'] = str_replace('$HOMEPAGE$', generateLink(str_replace('tools/', '', BASE_URL), $locale['step_finish_homepage'], true), $locale['step_finish_desc']);
|
||||
$locale['step_finish_desc'] = str_replace('$LINK$', generateLink('https://my-aac.org', 'https://my-aac.org', true), $locale['step_finish_desc']);
|
||||
|
||||
success($locale['step_finish_desc']);
|
||||
success($locale['step_finish_desc']);
|
||||
|
@@ -127,8 +127,7 @@ switch ($action) {
|
||||
$account->find($inputAccountName);
|
||||
}
|
||||
|
||||
$config_salt_enabled = fieldExist('salt', 'accounts');
|
||||
$current_password = encrypt(($config_salt_enabled ? $account->getCustomField('salt') : '') . $request->password);
|
||||
$current_password = encrypt((USE_ACCOUNT_SALT ? $account->getCustomField('salt') : '') . $request->password);
|
||||
|
||||
if (!$account->isLoaded() || $account->getPassword() != $current_password) {
|
||||
sendError(($inputEmail != false ? 'Email' : 'Account name') . ' or password is not correct.');
|
||||
|
@@ -7,30 +7,23 @@ server {
|
||||
# increase max file upload
|
||||
client_max_body_size 10M;
|
||||
|
||||
# this is very important, be sure its in your nginx conf - it prevents access to logs etc.
|
||||
location ~ /system {
|
||||
deny all;
|
||||
}
|
||||
|
||||
# block .htaccess, CHANGELOG.md, composer.json etc.
|
||||
# this is to prevent finding software versions
|
||||
location ~\.(ht|md|json|dist)$ {
|
||||
deny all;
|
||||
}
|
||||
|
||||
# block git files and folders
|
||||
location ~ /\.git {
|
||||
deny all;
|
||||
}
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$query_string;;
|
||||
try_files $uri $uri/ /index.php;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
include snippets/fastcgi-php.conf;
|
||||
fastcgi_read_timeout 240;
|
||||
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-sock
|
||||
}
|
||||
|
||||
location ~ /\.ht {
|
||||
deny all;
|
||||
}
|
||||
|
||||
location /system {
|
||||
deny all;
|
||||
return 404;
|
||||
}
|
||||
}
|
||||
|
@@ -1,3 +1,11 @@
|
||||
<IfModule mod_autoindex.c>
|
||||
Options -Indexes
|
||||
</IfModule>
|
||||
|
||||
<IfVersion < 2.4>
|
||||
order allow,deny
|
||||
deny from all
|
||||
</IfVersion>
|
||||
<IfVersion >= 2.4>
|
||||
Require all denied
|
||||
</IfVersion>
|
||||
|
@@ -4,12 +4,12 @@ defined('MYAAC') or die('Direct access not allowed!');
|
||||
$reward = config('account_mail_confirmed_reward');
|
||||
|
||||
$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.');
|
||||
}
|
||||
|
||||
if (!isset($account) || !$account->isLoaded()) {
|
||||
//log_append('email_confirm_error.log', 'Account not loaded.');
|
||||
log_append('email_confirm_error.log', 'Account not loaded.');
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -6,31 +6,38 @@
|
||||
"author": "nobody",
|
||||
"contact": "nobody@example.org",
|
||||
"require": {
|
||||
"myaac": "0.4.3",
|
||||
"myaac_": ">=0.7,<1.0", // support for defining versions like in composer (since 0.8)
|
||||
"php": "5.2.0",
|
||||
"php_": ">5.4,<7.0", // support for defining versions like in composer (since 0.8)
|
||||
"myaac": "0.9.0",
|
||||
"myaac_": ">=0.9,<1.0",
|
||||
"php": "7.4",
|
||||
"php_": ">7.4,<8.0",
|
||||
"database": "21",
|
||||
"php-ext": "curl", // php extension needs to be installed (since 0.8)
|
||||
"ext-curl": ">5.0", // php extension with version specifiec (since 0.8)
|
||||
"table": "accounts", // table need to exist in database (since 0.8)
|
||||
"column": "players.online" // column need to exist in database (since 0.8)
|
||||
"php-ext": "curl",
|
||||
"ext-curl": ">5.0",
|
||||
"table": "accounts",
|
||||
"column": "players.online"
|
||||
},
|
||||
"install": "plugins/example/install.php",
|
||||
"uninstall": [
|
||||
"plugins/example.json",
|
||||
"plugins/example-directory",
|
||||
"templates/other-directory"
|
||||
/***
|
||||
this is example of multi line comment
|
||||
1. list example
|
||||
2. something
|
||||
****/
|
||||
],
|
||||
"hooks": {
|
||||
"Example Hook": {
|
||||
"type": "BEFORE_PAGE",
|
||||
"file": "plugins/example/before.php"
|
||||
}
|
||||
}
|
||||
},
|
||||
"routes": {
|
||||
"First Route": {
|
||||
"pattern": "/YourAwesomePage/{name:string}/{page:int}",
|
||||
"file": "plugins/your-plugin/your-awesome-page.php",
|
||||
"method": "GET",
|
||||
"priority": "130"
|
||||
},
|
||||
"Redirect Example": {
|
||||
"redirect_from": "/redirectExample",
|
||||
"redirect_to": "account/manage"
|
||||
}
|
||||
}
|
||||
}
|
||||
|