Compare commits

...

81 Commits

Author SHA1 Message Date
slawkens
cc1cebf359 Update CHANGELOG & release v0.8.12 2023-08-07 22:14:47 +02:00
slawkens
1e874c7027 Fixed not working links from database, introduced in 0.8.10 2023-08-07 21:45:56 +02:00
slawkens
a338fd967c Removed deprecated functions: utf8_encode & decode 2023-08-05 19:58:52 +02:00
slawkens
8796ff7e72 Remove whitespaces 2023-08-05 19:58:20 +02:00
slawkens
a8172a518f Add some functions to compatibility layer of gesioraac 2023-08-05 19:58:04 +02:00
slawkens
559c2c7bd2 Add .htaccess to .gitignore 2023-08-05 11:57:15 +02:00
slawkens
7a546e5a41 There is no more info. That never worked. 2023-07-29 07:26:03 +02:00
slawkens
5f7a9154b7 Thanks @anyeor for previous fix 2023-07-11 11:17:18 +02:00
slawkens
0d52978d9f Fix: cannot create topic on this board (check wasn't working) 2023-07-11 11:15:58 +02:00
slawkens
df48363ea4 Shorten some forum code about length 2023-07-07 17:15:13 +02:00
slawkens
34725e0257 Forum: better error messages (Suggested by @anyeor) 2023-07-07 14:34:26 +02:00
slawkens
df321154f6 Fix guild description on guilds page 2023-07-02 13:47:32 +02:00
slawkens
f2a3ec1185 Fix guild description not shown 2023-06-30 19:53:16 +02:00
slawkens
ce4aed0f17 Add word-break on forum thread & reply
When someone inserts long word, is will break into multiple lines
2023-06-30 19:32:47 +02:00
slawkens
d0c82f6fb0 Start 0.8.12-dev 2023-06-30 19:13:38 +02:00
slawkens
89b76e721d Release 0.8.11 2023-06-30 17:12:38 +02:00
slawkens
6091290efe Update CHANGELOG.md 2023-06-30 17:12:02 +02:00
slawkens
e4c4990e7f Forum: Fix quote and edit post buttons not being shown 2023-06-30 15:46:25 +02:00
slawkens
4f1235bfe9 Fix twig exception thrown when player does not exist 2023-06-28 15:15:14 +02:00
slawkens
bf9d440a95 Fix BASE_DIR when accessing /tools 2023-06-27 18:17:37 +02:00
slawkens
59a149c253 Move <base href> above, so it works, thanks @Leesneaks 2023-06-27 18:15:54 +02:00
slawkens
563099f290 Revert "<base> is not working properly, use full URL instead"
This reverts commit fa015b8d39.
2023-06-27 17:44:19 +02:00
slawkens
3732bf988d More changes to deleted characters (Account, guilds)
Account: Cannot change name, comment, gender
+ Cannot be deleted if owns a guild
Guilds: Cannot create, cannot be invited, cannot accept invite, cannot be passed leadership to
2023-06-27 17:41:04 +02:00
slawkens
ab964fa1de Important fix: Not allow create char if limit is exceeded (by @anyeor )
Could have been used to spam database, now it doesn't ignore deleted characters

He is not my brother :P Just same last name
2023-06-27 15:02:28 +02:00
slawkens
b5c694224e code formatting 2023-06-27 14:50:44 +02:00
slawkens
23810345f6 small adjustments 2023-06-25 08:38:45 +02:00
slawkens
b574a29331 Better Gesior support 2023-06-22 22:15:18 +02:00
slawkens
6593e32d83 Change title to "Support in game" 2023-06-19 08:04:46 +02:00
slawkens
b09adc836d Nothing important, just some comments and small code style fixes 2023-06-19 08:03:47 +02:00
slawkens
dcf9a45974 Do not display warning if HTTP_ACCEPT_LANGUAGE is not set 2023-06-19 08:01:35 +02:00
slawkens
21258313ef New function Cache::remember($key, $ttl, $callback) 2023-06-19 08:01:11 +02:00
slawkens
f851fa3845 New characters page hooks
HOOK_CHARACTERS_BEFORE_SKILLS
HOOK_CHARACTERS_AFTER_SKILLS
HOOK_CHARACTERS_AFTER_QUESTS
HOOK_CHARACTERS_AFTER_EQUIPMENT
HOOK_CHARACTERS_BEFORE_DEATHS
2023-06-19 08:00:54 +02:00
slawkens
2fdd507902 Display warning if hook file does not exist 2023-06-19 08:00:11 +02:00
slawkens
b850e56ff1 Use $i for hooks, easier compare 2023-06-19 07:47:49 +02:00
SRNT-GG
8d10082179 WIP - Removing unneccessary closing tags to prevent potential issues. (#223)
* Part 1

Removing closing tags when no HTML or other output comes after the last PHP codeblock.

* Further removals

* nothing

---------

Co-authored-by: slawkens <slawkens@gmail.com>
2023-06-15 20:53:55 +02:00
SRNT-GG
996ae625c9 Update README.md (#224)
updated required php version
2023-06-11 18:41:47 +02:00
slawkens
467f7ef927 Rename to .htaccess.dist
Causes problems on default setup
2023-06-03 09:04:41 +02:00
slawkens
fa015b8d39 <base> is not working properly, use full URL instead 2023-06-02 15:26:09 +02:00
slawkens
4b4864561c Better news back button 2023-06-01 11:23:28 +02:00
slawkens
475cea8549 Change button style (characters - view)
was causing issues in other templates
2023-06-01 09:57:20 +02:00
slawkens
760214fdbd Init $account_logged, if no logged 2023-06-01 08:52:22 +02:00
slawkens
9c5dcd7b19 Add cypress/e2e/2-advanced-examples to .gitignore 2023-05-29 08:20:56 +02:00
slawkens
720e400f7c Add cypress.env.json to .gitignore 2023-05-29 08:20:33 +02:00
slawkens
c261c6ba48 Add line & file to exception handler 2023-05-29 08:19:58 +02:00
slawkens
933d4e1d6f Release 0.8.10 2023-05-18 19:29:53 +02:00
slawkens
1d08833726 Update CHANGELOG.md 2023-05-18 19:25:50 +02:00
slawkens
7cfca55e3c PHP 7.2.5 is now required, cause of Twig 2.x 2023-05-18 19:21:13 +02:00
slawkens
7e13b62b8f Fix Twig error on create account 2023-05-18 19:06:50 +02:00
slawkens
5ccfcd541e Allow pages to be placed in templates folder (second attempt) 2023-05-14 08:59:34 +02:00
slawkens
ba4d2a9c48 Dirty workaround for fb links 2023-05-14 08:38:20 +02:00
slawkens
7a61f613ec Revert "Workaround for links from fb, like ?fbclid=x"
This reverts commit 073d9da0bc.
2023-05-14 08:15:44 +02:00
slawkens
073d9da0bc Workaround for links from fb, like ?fbclid=x
Now shows news page, instead of "not found".
For 0.9 there is better solution
2023-05-13 10:20:58 +02:00
slawkens
e081a67589 Print more info if character cannot be created 2023-04-12 12:52:05 +02:00
slawkens
37a27b8065 Add check for player_deaths columns 2023-04-01 15:09:10 +02:00
slawkens
d34f7eb2fc Exclude polyfill-mbstring/bootstrap80.php 2023-03-31 11:18:58 +02:00
slawkens
f6c080cb5c Add overtrue/phplint@7.4 2023-03-31 10:26:16 +02:00
slawkens
a983fd03b1 Revert "test github actions"
This reverts commit 5b651886a5.
2023-03-31 09:34:21 +02:00
slawkens
5b651886a5 test github actions 2023-03-31 09:30:28 +02:00
slawkens
6484ab75d9 Do not allow to continue install when there is no server database imported 2023-03-26 00:17:55 +01:00
slawkens
becad18465 fix small bug on install - please fill all input 2023-03-26 00:02:25 +01:00
slawkens
ec7e5a8838 Fix when server uses another items serializer 2023-03-25 21:59:13 +01:00
slawkens
300c1b4ebc Fix cannot go forward when config.local.php cannot be saved 2023-03-19 14:46:57 +01:00
slawkens
4f0dd89eb9 Change from warning to error (config.local.php save error) 2023-03-19 14:46:15 +01:00
slawkens
79f7c3dbd4 nothing important 2023-03-19 14:34:29 +01:00
slawkens
f24fc75b12 Bump version to 0.8.10-dev 2023-03-16 10:41:57 +01:00
slawkens
4fcc71e127 Update CHANGELOG.md 2023-03-16 09:55:05 +01:00
slawkens
403b4aa89b Release v0.8.9 2023-03-16 09:44:26 +01:00
slawkens
613bcf379b Update CHANGELOG.md 2023-03-16 09:44:06 +01:00
slawkens
8f2cc2ca38 fix rel path 2023-03-16 09:03:45 +01:00
slawkens
cdae11226d add PLUGINS dir to twig paths 2023-03-15 18:05:24 +01:00
slawkens
79fd97ad78 plugins folder should be accessible from public 2023-03-15 18:03:24 +01:00
slawkens
b477d4c821 fix installer hang on 2023-03-07 09:28:52 +01:00
slawkens
289f82ad23 Update nginx-sample.conf 2023-03-06 08:27:26 +01:00
slawkens
92569b7965 patch some changes
add contributors
2023-03-01 10:36:38 +01:00
slawkens
c03b041f40 add .git to denied folders in nginx 2023-02-28 19:05:34 +01:00
slawkens
2ac8ed7411 more php 8.x compatibility 2023-02-18 21:23:21 +01:00
slawkens
3280b3b9df Update tables.headline.html.twig 2023-02-18 21:10:02 +01:00
slawkens
05c37b94bb Create account.back_button.html.twig 2023-02-18 21:09:56 +01:00
slawkens
a91e7226dc new buttons code for tibiacom template, can create button with any text 2023-02-18 21:09:51 +01:00
slawkens
a39600efe2 fix player save on tfs 1.5 with new ipv6 2023-02-18 20:57:55 +01:00
slawkens
4fd5922784 You can now disable status checking for testing purposes
Useful for local testing when there is no server running
2023-02-18 11:44:32 +01:00
160 changed files with 650 additions and 456 deletions

16
.github/workflows/phplint.yml vendored Normal file
View File

@@ -0,0 +1,16 @@
name: PHP Linting
on:
pull_request:
branches: [master]
push:
branches: [master]
jobs:
phplint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: overtrue/phplint@7.4
with:
path: .
options: --exclude="system/libs/polyfill-mbstring/bootstrap80.php"

9
.gitignore vendored
View File

@@ -2,6 +2,9 @@ Thumbs.db
.DS_Store .DS_Store
.idea .idea
#
/.htaccess
# composer # composer
composer.lock composer.lock
vendor vendor
@@ -9,6 +12,10 @@ vendor
# npm # npm
node_modules node_modules
# cypress
cypress.env.json
cypress/e2e/2-advanced-examples
# created by release.sh # created by release.sh
releases releases
tmp tmp
@@ -37,7 +44,7 @@ system/cache/*
# php sessions # php sessions
system/php_sessions/* system/php_sessions/*
!system/php_sessions//index.html !system/php_sessions/index.html
# logs # logs
system/logs/* system/logs/*

View File

@@ -1,5 +1,78 @@
# Changelog # Changelog
## [0.8.12 - 07.08.2023]
I've moved the repository back to my personal account. (Just so you know!)
I will also try to add git commits pointed to each change, lets see if you like it or not - you can comment in discussion, that will be created just after releasing this version :)
### Added
* forum: better error messages (Suggested by @anyeor) (https://github.com/slawkens/myaac/commit/34725e0257684fe5fa43875cc3a8f587ba04642e)
* more support for GesiorAAC classes, so some of them will work with MyAAC (https://github.com/slawkens/myaac/commit/a8172a518ff8939c4402349b16c064fcaf855d31)
* word-break on forum thread & reply (Suggested by @anyeor) (https://github.com/slawkens/myaac/commit/ce4aed0f1719d2aadc749e5238e883e3c10e2686)
### Fixed
* not working pages/links from database, introduced in 0.8.10 (Thanks to OtLand user - https://otland.net/members/0lo.99657/ for report) (https://github.com/slawkens/myaac/commit/1e874c7027769bd09e772a1cdac75d7e37991256)
* it was possible to create topic in board that was closed, ommiting the error check (Thanks to @anyeor for report) (https://github.com/slawkens/myaac/commit/0d52978d9fb99869500d35e7676f454ca5eaba14)
* PHP 8.2 compatibility - removed deprecated functions utf8_encode & utf8_decode (https://github.com/slawkens/myaac/commit/a338fd967cdbcc89e86be4e6b66b2cad2ff23251)
* guild description not being correctly shown (Reported by @anyeor) (https://github.com/slawkens/myaac/commit/f2a3ec1185df64ad9084d4ff55790ae4a5b3e5fd, https://github.com/slawkens/myaac/commit/df321154f63d458a4bc7d83bac5e3447b67317a4)
### Removed
* Some old code for verifying messages length (Reported by @anyeor) (https://github.com/slawkens/myaac/commit/df48363ea4ced4350fd90ffddf57d464ba5afa8b)
* some info about config failed to load, was never working (https://github.com/slawkens/myaac/commit/7a546e5a41036b0e9e926d337c6f2e3c41c591d2)
## [0.8.11 - 30.06.2023]
### Added
* new function from 0.9 - Cache::remember($key, $ttl, $callback)
* new characters page hooks
* line number & file to exception handler, to easier localize exceptions
### Changed
* rename to .htaccess.dist, causes some problems on default setup
* removing unneccessary PHP closing tags to prevent potential issues (by @SRNT-GG)
* display warning if hook file does not exist
### Fixed
* important: Not allow create char if limit is exceeded (by @anyeor) could have been used to spam database
* deleted chars: cannot change comment, name, gender, cannot create guild, cannot be invited, cannot accept invite, cannot be passed leadership to
* forum: quote and edit post buttons not being shown
* twig exception thrown when player does not exist, on character change comment (thanks @anyeor)
* BASE_DIR when accessing /tools
* do not display warning if HTTP_ACCEPT_LANGUAGE is not set
## [0.8.10 - 18.05.2023]
### Changed
* PHP 7.2.5 is now required, cause of Twig 2.x
* allow pages to be placed in templates folder, under pages/ subfolder
### Fixed
* Twig error with global variable on create account
* links/redirects from facebook, etc. like ?fbclid=x
* do not allow to continue install when there is no server database imported
* cannot go forward when config.local.php cannot be saved
* when server uses another items serializer
* small bug on install - please fill all input
## [0.8.9 - 16.03.2023]
### Added
* You can now disable server status checking for testing purposes, useful for local testing when there is no server running
* with this, the page won't need 2 seconds to load
* set status_enabled to false in config.php
* new buttons code for tibiacom template, can create button with any text
* patched some small changes from develop branch
### Changed
* add .git to denied folders in nginx-sample.conf
* plugins folder is now accessible from outside
* add plugins folder to twig search paths
### Fixed
* player save on tfs 1.5 with new ipv6
* more php 8.x compatibility
* rel path for exception message, causing message to be not in red background
## [0.8.8 - 18.02.2023] ## [0.8.8 - 18.02.2023]
### Added ### Added

14
CONTRIBUTORS.txt Normal file
View File

@@ -0,0 +1,14 @@
# automatically exported using this script:
# git log --all --format='%cN <%cE>' | sort -u > contributors
# in no particular order
# cleaned for readability
Evil Puncker <EPuncker@users.noreply.github.com>
Fernando Matos <fernando@pixele.com.br>
Lee <42119604+Leesneaks@users.noreply.github.com>
caio <caio.zucoli@gmail.com>
slawkens <slawkens@gmail.com>
tobi132 <52947952+tobi132@users.noreply.github.com>
vankk <nwtr.otland@hotmail.com>
whiteblXK <krzys16001@gmail.com>
xitobuh <jonas.hockert92@gmail.com>

View File

@@ -1,2 +1,3 @@
* Gesior.pl (2007 - 2008) * Gesior.pl (2007 - 2008)
* Slawkens (2009 - 2020) * Slawkens (2009 - 2023)
* Contributors listed in CONTRIBUTORS.txt

View File

@@ -9,9 +9,11 @@
MyAAC is a free and open-source Automatic Account Creator (AAC) written in PHP. It is a fork of the [Gesior](https://github.com/gesior/Gesior2012) project. It supports only MySQL databases. MyAAC is a free and open-source Automatic Account Creator (AAC) written in PHP. It is a fork of the [Gesior](https://github.com/gesior/Gesior2012) project. It supports only MySQL databases.
Official website: https://my-aac.org
### Requirements ### Requirements
- PHP 5.6 or later - PHP 7.2.5 or later
- MySQL database - MySQL database
- PDO PHP Extension - PDO PHP Extension
- XML PHP Extension - XML PHP Extension
@@ -57,12 +59,13 @@ That means, we use:
- Some compatibility issues with some exotical distibutions. - Some compatibility issues with some exotical distibutions.
### Contributing ### Contributing
Contributions are more than welcome. Contributions are more than welcome.
Pull requests should be made to the Dev branch as that is the working branch, master is for release code. Pull requests should be made to the *develop* branch as that is the working branch, master is for release code.
Bug fixes to current release should be done to master branch.
Look: [Contributing](https://github.com/otsoft/myaac/wiki/Contributing) in our wiki. Look: [Contributing](https://github.com/otsoft/myaac/wiki/Contributing) in our wiki.

View File

@@ -1 +1,2 @@
<?php <?php
// nothing yet here

View File

@@ -2,6 +2,9 @@
// few things we'll need // few things we'll need
require '../common.php'; require '../common.php';
define('ADMIN_PANEL', true);
define('MYAAC_ADMIN', true);
if(file_exists(BASE . 'config.local.php')) { if(file_exists(BASE . 'config.local.php')) {
require_once BASE . 'config.local.php'; require_once BASE . 'config.local.php';
} }
@@ -12,8 +15,6 @@ if(file_exists(BASE . 'install') && (!isset($config['installed']) || !$config['i
throw new RuntimeException('Setup detected that <b>install/</b> directory exists. Please visit <a href="' . BASE_URL . 'install">this</a> url to start MyAAC Installation.<br/>Delete <b>install/</b> directory if you already installed MyAAC.<br/>Remember to REFRESH this page when you\'re done!'); throw new RuntimeException('Setup detected that <b>install/</b> directory exists. Please visit <a href="' . BASE_URL . 'install">this</a> url to start MyAAC Installation.<br/>Delete <b>install/</b> directory if you already installed MyAAC.<br/>Remember to REFRESH this page when you\'re done!');
} }
define('ADMIN_PANEL', true);
$content = ''; $content = '';
// validate page // validate page
@@ -67,4 +68,4 @@ ob_end_clean();
// template // template
$template_path = 'template/'; $template_path = 'template/';
require ADMIN . $template_path . 'template.php'; require ADMIN . $template_path . 'template.php';
?>

View File

@@ -196,5 +196,3 @@ class Pages
return !count($errors); return !count($errors);
} }
} }
?>

View File

@@ -36,4 +36,3 @@ $twig->display('admin.statistics.html.twig', array(
'account_type' => (USE_ACCOUNT_NAME ? 'name' : 'number'), 'account_type' => (USE_ACCOUNT_NAME ? 'name' : 'number'),
'points' => $points 'points' => $points
)); ));
?>

View File

@@ -47,4 +47,3 @@ function version_revert($version)
$release = $version; $release = $version;
return $major . '.' . $minor . '.' . $release; return $major . '.' . $minor . '.' . $release;
}*/ }*/
?>

View File

@@ -1,4 +1,6 @@
<?php <?php
define('MYAAC_ADMIN', true);
require '../../common.php'; require '../../common.php';
require SYSTEM . 'functions.php'; require SYSTEM . 'functions.php';
require SYSTEM . 'init.php'; require SYSTEM . 'init.php';
@@ -11,4 +13,3 @@ if(!function_exists('phpinfo'))
die('phpinfo() disabled on this web server.'); die('phpinfo() disabled on this web server.');
phpinfo(); phpinfo();
?>

View File

@@ -1,4 +1,6 @@
<?php <?php
define('MYAAC_ADMIN', true);
require '../../common.php'; require '../../common.php';
require SYSTEM . 'init.php'; require SYSTEM . 'init.php';
require SYSTEM . 'functions.php'; require SYSTEM . 'functions.php';

View File

@@ -23,10 +23,10 @@
* @copyright 2019 MyAAC * @copyright 2019 MyAAC
* @link https://my-aac.org * @link https://my-aac.org
*/ */
if (version_compare(phpversion(), '5.6', '<')) die('PHP version 5.6 or higher is required.'); if (version_compare(phpversion(), '7.2.5', '<')) die('PHP version 7.2.5 or higher is required.');
define('MYAAC', true); define('MYAAC', true);
define('MYAAC_VERSION', '0.8.8'); define('MYAAC_VERSION', '0.8.12');
define('DATABASE_VERSION', 33); define('DATABASE_VERSION', 33);
define('TABLE_PREFIX', 'myaac_'); define('TABLE_PREFIX', 'myaac_');
define('START_TIME', microtime(true)); define('START_TIME', microtime(true));
@@ -97,7 +97,7 @@ $size = count($tmp) - 1;
for($i = 1; $i < $size; $i++) for($i = 1; $i < $size; $i++)
$basedir .= '/' . $tmp[$i]; $basedir .= '/' . $tmp[$i];
$basedir = str_replace(array('/admin', '/install'), '', $basedir); $basedir = str_replace(array('/admin', '/install', '/tools'), '', $basedir);
define('BASE_DIR', $basedir); define('BASE_DIR', $basedir);
if(!IS_CLI) { if(!IS_CLI) {

View File

@@ -267,6 +267,7 @@ $config = array(
'last_kills_limit' => 50, // max. number of deaths shown on the last kills page 'last_kills_limit' => 50, // max. number of deaths shown on the last kills page
// status, took automatically from config file if empty // status, took automatically from config file if empty
'status_enabled' => true, // you can disable status checking by settings this to "false"
'status_ip' => '', 'status_ip' => '',
'status_port' => '', 'status_port' => '',
'status_timeout' => 2, // how long to wait for the initial response from the server (default: 2 seconds) 'status_timeout' => 2, // how long to wait for the initial response from the server (default: 2 seconds)

View File

@@ -74,6 +74,14 @@ if((!isset($config['installed']) || !$config['installed']) && file_exists(BASE .
throw new RuntimeException('Setup detected that <b>install/</b> directory exists. Please visit <a href="' . BASE_URL . 'install">this</a> url to start MyAAC Installation.<br/>Delete <b>install/</b> directory if you already installed MyAAC.<br/>Remember to REFRESH this page when you\'re done!'); throw new RuntimeException('Setup detected that <b>install/</b> directory exists. Please visit <a href="' . BASE_URL . 'install">this</a> url to start MyAAC Installation.<br/>Delete <b>install/</b> directory if you already installed MyAAC.<br/>Remember to REFRESH this page when you\'re done!');
} }
require_once SYSTEM . 'init.php';
require_once SYSTEM . 'template.php';
// verify myaac tables exists in database
if(!$db->hasTable('myaac_account_actions')) {
throw new RuntimeException('Seems that the table <strong>myaac_account_actions</strong> of MyAAC doesn\'t exist in the database. This is a fatal error. You can try to reinstall MyAAC by visiting <a href="' . BASE_URL . 'install">this</a> url.');
}
$found = false; $found = false;
if(empty($uri) || isset($_REQUEST['template'])) { if(empty($uri) || isset($_REQUEST['template'])) {
$_REQUEST['p'] = 'news'; $_REQUEST['p'] = 'news';
@@ -81,7 +89,11 @@ if(empty($uri) || isset($_REQUEST['template'])) {
} }
else { else {
$tmp = strtolower($uri); $tmp = strtolower($uri);
if(!preg_match('/[^A-z0-9_\-]/', $uri) && file_exists(SYSTEM . 'pages/' . $tmp . '.php')) { if (!preg_match('/[^A-z0-9_\-]/', $uri) && file_exists(TEMPLATES . $template_name . '/pages/' . $tmp . '.php')) {
$_REQUEST['p'] = $uri;
$found = true;
}
else if (!preg_match('/[^A-z0-9_\-]/', $uri) && file_exists(SYSTEM . 'pages/' . $tmp . '.php')) {
$_REQUEST['p'] = $uri; $_REQUEST['p'] = $uri;
$found = true; $found = true;
} }
@@ -154,6 +166,12 @@ else {
} }
} }
// handle ?fbclid=x, etc. (show news page)
if (!$found && count($_GET) > 0 && !isset($_REQUEST['subtopic']) && !isset($_REQUEST['p']) && !in_array($_SERVER['QUERY_STRING'], getDatabasePages())) {
$_REQUEST['p'] = $_REQUEST['subtopic'] = 'news';
$found = true;
}
// define page visited, so it can be used within events system // define page visited, so it can be used within events system
$page = isset($_REQUEST['subtopic']) ? $_REQUEST['subtopic'] : (isset($_REQUEST['p']) ? $_REQUEST['p'] : ''); $page = isset($_REQUEST['subtopic']) ? $_REQUEST['subtopic'] : (isset($_REQUEST['p']) ? $_REQUEST['p'] : '');
if(empty($page) || !preg_match('/^[A-z0-9\_\-]+$/', $page)) { if(empty($page) || !preg_match('/^[A-z0-9\_\-]+$/', $page)) {
@@ -174,18 +192,10 @@ define('PAGE', $page);
$template_place_holders = array(); $template_place_holders = array();
require_once SYSTEM . 'init.php';
// verify myaac tables exists in database
if(!$db->hasTable('myaac_account_actions')) {
throw new RuntimeException('Seems that the table <strong>myaac_account_actions</strong> of MyAAC doesn\'t exist in the database. This is a fatal error. You can try to reinstall MyAAC by visiting <a href="' . BASE_URL . 'install">this</a> url.');
}
// event system // event system
require_once SYSTEM . 'hooks.php'; require_once SYSTEM . 'hooks.php';
$hooks = new Hooks(); $hooks = new Hooks();
$hooks->load(); $hooks->load();
require_once SYSTEM . 'template.php';
require_once SYSTEM . 'login.php'; require_once SYSTEM . 'login.php';
require_once SYSTEM . 'status.php'; require_once SYSTEM . 'status.php';
@@ -288,6 +298,7 @@ if($config['backward_support']) {
$config['site'] = &$config; $config['site'] = &$config;
$config['server'] = &$config['lua']; $config['server'] = &$config['lua'];
$config['site']['shop_system'] = $config['gifts_system']; $config['site']['shop_system'] = $config['gifts_system'];
$config['site']['gallery_page'] = true;
if(!isset($config['vdarkborder'])) if(!isset($config['vdarkborder']))
$config['vdarkborder'] = '#505050'; $config['vdarkborder'] = '#505050';
@@ -335,12 +346,10 @@ if($load_it)
)) . $content; )) . $content;
} }
} else { } else {
$file = TEMPLATES . $template_name . '/pages/' . $page . '.php'; $file = TEMPLATES . "$template_name/pages/$page.php";
if(!@file_exists($file) || preg_match('/[^A-z0-9_\-]/', $page)) if(!@file_exists($file) || preg_match('/[^A-z0-9_\-]/', $page)) {
{ $file = SYSTEM . "pages/$page.php";
$file = SYSTEM . 'pages/' . $page . '.php'; if(!@file_exists($file) || preg_match('/[^A-z0-9_\-]/', $page)) {
if(!@file_exists($file) || preg_match('/[^A-z0-9_\-]/', $page))
{
$page = '404'; $page = '404';
$file = SYSTEM . 'pages/404.php'; $file = SYSTEM . 'pages/404.php';
} }

View File

@@ -38,4 +38,3 @@ if(!isset($error) || !$error) {
$error = true; $error = true;
} }
} }
?>

View File

@@ -2,10 +2,10 @@ We have detected that you don't have access to write to the system/cache directo
<style type="text/css"> <style type="text/css">
.console { .console {
font-family:Courier; font-family: Courier,serif;
color: #CCCCCC; color: #CCCCCC;
background: #000000; background: #000000;
border: 3px double #CCCCCC; border: 3px double #CCCCCC;
padding: 0px; padding: 0;
} }
</style> </style>

View File

@@ -70,7 +70,7 @@ if($step == 'database') {
$key = str_replace('var_', '', $key); $key = str_replace('var_', '', $key);
if(in_array($key, array('account', 'password', 'email', 'player_name'))) { if(in_array($key, array('account', 'account_id', 'password', 'email', 'player_name'))) {
continue; continue;
} }
@@ -114,14 +114,12 @@ if($step == 'database') {
} }
} }
else if($step == 'admin') { else if($step == 'admin') {
$config_failed = true; if(!file_exists(BASE . 'config.local.php') || !isset($config['installed']) || !$config['installed']) {
if(file_exists(BASE . 'config.local.php') && isset($config['installed']) && $config['installed'] && isset($_SESSION['saved'])) {
$config_failed = false;
}
if($config_failed) {
$step = 'database'; $step = 'database';
} }
else {
$_SESSION['saved'] = true;
}
} }
else if($step == 'finish') { else if($step == 'finish') {
$email = $_SESSION['var_email']; $email = $_SESSION['var_email'];

View File

@@ -5,4 +5,3 @@ $twig->display('install.license.html.twig', array(
'license' => file_get_contents(BASE . 'LICENSE'), 'license' => file_get_contents(BASE . 'LICENSE'),
'buttons' => next_buttons() 'buttons' => next_buttons()
)); ));
?>

View File

@@ -18,4 +18,3 @@ $twig->display('install.config.html.twig', array(
'errors' => isset($errors) ? $errors : null, 'errors' => isset($errors) ? $errors : null,
'buttons' => next_buttons() 'buttons' => next_buttons()
)); ));
?>

View File

@@ -57,16 +57,35 @@ if(!$error) {
error($database_error); error($database_error);
} }
else { 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;
}
if(!$error) {
$twig->display('install.installer.html.twig', array( $twig->display('install.installer.html.twig', array(
'url' => 'tools/5-database.php', 'url' => 'tools/5-database.php',
'message' => $locale['loading_spinner'] 'message' => $locale['loading_spinner']
)); ));
if(!$error) {
if(!Validator::email($_SESSION['var_mail_admin'])) { if(!Validator::email($_SESSION['var_mail_admin'])) {
error($locale['step_config_mail_admin_error']); error($locale['step_config_mail_admin_error']);
$error = true; $error = true;
} }
if(!Validator::email($_SESSION['var_mail_address'])) { if(!Validator::email($_SESSION['var_mail_address'])) {
error($locale['step_config_mail_address_error']); error($locale['step_config_mail_address_error']);
$error = true; $error = true;
@@ -82,6 +101,7 @@ if(!$error) {
} }
if($saved) { if($saved) {
success($locale['step_database_config_saved']);
if(!$error) { if(!$error) {
$_SESSION['saved'] = true; $_SESSION['saved'] = true;
} }
@@ -91,7 +111,7 @@ if(!$error) {
unset($_SESSION['saved']); unset($_SESSION['saved']);
$locale['step_database_error_file'] = str_replace('$FILE$', '<b>' . BASE . 'config.local.php</b>', $locale['step_database_error_file']); $locale['step_database_error_file'] = str_replace('$FILE$', '<b>' . BASE . 'config.local.php</b>', $locale['step_database_error_file']);
warning($locale['step_database_error_file'] . '<br/> error($locale['step_database_error_file'] . '<br/>
<textarea cols="70" rows="10">' . $content . '</textarea>'); <textarea cols="70" rows="10">' . $content . '</textarea>');
} }
} }
@@ -102,6 +122,6 @@ if(!$error) {
<form action="<?php echo BASE_URL; ?>install/" method="post"> <form action="<?php echo BASE_URL; ?>install/" method="post">
<input type="hidden" name="step" id="step" value="admin" /> <input type="hidden" name="step" id="step" value="admin" />
<?php echo next_buttons(true, $error ? false : true); <?php echo next_buttons(true, !$error);
?> ?>
</form> </form>

View File

@@ -1,4 +1,6 @@
<?php <?php
define('MYAAC_INSTALL', true);
require_once '../../common.php'; require_once '../../common.php';
require SYSTEM . 'functions.php'; require SYSTEM . 'functions.php';
@@ -21,24 +23,6 @@ if(!$error) {
} }
} }
if(!$db->hasTable('accounts')) {
$locale['step_database_error_table'] = str_replace('$TABLE$', 'accounts', $locale['step_database_error_table']);
error($locale['step_database_error_table']);
return;
}
if(!$db->hasTable('players')) {
$locale['step_database_error_table'] = str_replace('$TABLE$', 'players', $locale['step_database_error_table']);
error($locale['step_database_error_table']);
return;
}
if(!$db->hasTable('guilds')) {
$locale['step_database_error_table'] = str_replace('$TABLE$', 'guilds', $locale['step_database_error_table']);
error($locale['step_database_error_table']);
return;
}
if($db->hasTable(TABLE_PREFIX . 'account_actions')) { if($db->hasTable(TABLE_PREFIX . 'account_actions')) {
$locale['step_database_error_table_exist'] = str_replace('$TABLE$', TABLE_PREFIX . 'account_actions', $locale['step_database_error_table_exist']); $locale['step_database_error_table_exist'] = str_replace('$TABLE$', TABLE_PREFIX . 'account_actions', $locale['step_database_error_table_exist']);
warning($locale['step_database_error_table_exist']); warning($locale['step_database_error_table_exist']);

View File

@@ -1,4 +1,6 @@
<?php <?php
define('MYAAC_INSTALL', true);
require_once '../../common.php'; require_once '../../common.php';
require SYSTEM . 'functions.php'; require SYSTEM . 'functions.php';

View File

@@ -4,15 +4,26 @@ server {
index index.php; index index.php;
server_name your-domain.com; server_name your-domain.com;
# 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 { location ~ /system {
deny all; deny all;
return 404; return 404;
} }
# block .htaccess
location ~ /\.ht { location ~ /\.ht {
deny all; deny all;
} }
# block git files and folders
location ~ /\.git {
return 404;
deny all;
}
location / { location / {
try_files $uri $uri/ /index.php; try_files $uri $uri/ /index.php;
} }
@@ -20,6 +31,7 @@ server {
location ~ \.php$ { location ~ \.php$ {
include snippets/fastcgi-php.conf; include snippets/fastcgi-php.conf;
fastcgi_read_timeout 240; fastcgi_read_timeout 240;
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock; fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
# for ubuntu 22.04+ it will be php8.1-fpm.sock
} }
} }

View File

@@ -1,11 +1,3 @@
<IfModule mod_autoindex.c> <IfModule mod_autoindex.c>
Options -Indexes Options -Indexes
</IfModule> </IfModule>
<IfVersion < 2.4>
order allow,deny
deny from all
</IfVersion>
<IfVersion >= 2.4>
Require all denied
</IfVersion>

View File

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

View File

@@ -10,6 +10,14 @@
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
switch($page) switch($page)
{ {
case 'adminpanel':
header('Location: ' . ADMIN_URL);
die;
case 'archive':
$page = 'newsarchive';
break;
case 'whoisonline': case 'whoisonline':
$page = 'online'; $page = 'online';
break; break;
@@ -37,4 +45,3 @@ switch($page)
default: default:
break; break;
} }
?>

View File

@@ -51,4 +51,3 @@ else
updateDatabaseConfig('views_counter', $views_counter); // update counter updateDatabaseConfig('views_counter', $views_counter); // update counter
} }
} }
?>

View File

@@ -116,5 +116,4 @@ defined('MYAAC') or die('Direct access not allowed!');
'<li>MySQL is not configured propertly in <i>config.lua</i>.</li>' . '<li>MySQL is not configured propertly in <i>config.lua</i>.</li>' .
'<li>MySQL server is not running.</li>' . '<li>MySQL server is not running.</li>' .
'</ul>' . $error->getMessage()); '</ul>' . $error->getMessage());
} }

View File

@@ -23,6 +23,8 @@ function exception_handler($exception) {
$backtrace_formatted = nl2br($exception->getTraceAsString()); $backtrace_formatted = nl2br($exception->getTraceAsString());
$message = $message . "<br/><br/>File: {$exception->getFile()}<br/>Line: {$exception->getLine()}";
// display basic error message without template // display basic error message without template
// template is missing, why? probably someone deleted templates dir, or it wasn't downloaded right // template is missing, why? probably someone deleted templates dir, or it wasn't downloaded right
$template_file = SYSTEM . 'templates/exception.html.twig'; $template_file = SYSTEM . 'templates/exception.html.twig';

View File

@@ -7,11 +7,10 @@
* @copyright 2019 MyAAC * @copyright 2019 MyAAC
* @link https://my-aac.org * @link https://my-aac.org
*/ */
defined('MYAAC') or die('Direct access not allowed!');
use Twig\Loader\ArrayLoader as Twig_ArrayLoader; use Twig\Loader\ArrayLoader as Twig_ArrayLoader;
defined('MYAAC') or die('Direct access not allowed!');
function message($message, $type, $return) function message($message, $type, $return)
{ {
if(IS_CLI) { if(IS_CLI) {
@@ -757,10 +756,10 @@ function get_browser_languages()
{ {
$ret = array(); $ret = array();
$acceptLang = $_SERVER['HTTP_ACCEPT_LANGUAGE']; if(empty($_SERVER['HTTP_ACCEPT_LANGUAGE']))
if(!isset($acceptLang[0]))
return $ret; return $ret;
$acceptLang = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
$languages = strtolower($acceptLang); $languages = strtolower($acceptLang);
// $languages = 'pl,en-us;q=0.7,en;q=0.3 '; // $languages = 'pl,en-us;q=0.7,en;q=0.3 ';
// need to remove spaces from strings to avoid error // need to remove spaces from strings to avoid error
@@ -798,7 +797,7 @@ function get_plugins()
$ret = array(); $ret = array();
$path = PLUGINS; $path = PLUGINS;
foreach(scandir($path, 0) as $file) { foreach(scandir($path, SCANDIR_SORT_ASCENDING) as $file) {
$file_ext = pathinfo($file, PATHINFO_EXTENSION); $file_ext = pathinfo($file, PATHINFO_EXTENSION);
$file_name = pathinfo($file, PATHINFO_FILENAME); $file_name = pathinfo($file, PATHINFO_FILENAME);
if ($file === '.' || $file === '..' || $file === 'disabled' || $file === 'example.json' || $file_ext !== 'json' || is_dir($path . $file)) if ($file === '.' || $file === '..' || $file === 'disabled' || $file === 'example.json' || $file_ext !== 'json' || is_dir($path . $file))
@@ -924,8 +923,8 @@ function load_config_lua($filename)
$config_file = $filename; $config_file = $filename;
if(!@file_exists($config_file)) if(!@file_exists($config_file))
{ {
log_append('error.log', '[load_config_file] Fatal error: Cannot load config.lua (' . $filename . '). Error: ' . print_r(error_get_last(), true)); log_append('error.log', '[load_config_file] Fatal error: Cannot load config.lua (' . $filename . ').');
throw new RuntimeException('ERROR: Cannot find ' . $filename . ' file. More info in system/logs/error.log'); throw new RuntimeException('ERROR: Cannot find ' . $filename . ' file.');
} }
$result = array(); $result = array();
@@ -1248,6 +1247,36 @@ function escapeHtml($html) {
return htmlentities($html, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); return htmlentities($html, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
} }
function displayErrorBoxWithBackButton($errors, $action = null) {
global $twig;
$twig->display('error_box.html.twig', ['errors' => $errors]);
$twig->display('account.back_button.html.twig', [
'action' => $action ?: getLink('')
]);
}
function getDatabasePages($withHidden = false): array
{
global $db, $logged_access;
if (!isset($logged_access)) {
$logged_access = 1;
}
$pages = $db->query('SELECT `name` FROM ' . TABLE_PREFIX . 'pages WHERE ' . ($withHidden ? '' : '`hidden` != 1 AND ') . '`access` <= ' . $db->quote($logged_access));
$ret = [];
if ($pages->rowCount() < 1) {
return $ret;
}
foreach($pages->fetchAll() as $page) {
$ret[] = $page['name'];
}
return $ret;
}
// validator functions // validator functions
require_once LIBS . 'validator.php'; require_once LIBS . 'validator.php';
require_once SYSTEM . 'compat/base.php'; require_once SYSTEM . 'compat/base.php';

View File

@@ -9,41 +9,47 @@
*/ */
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
define('HOOK_STARTUP', 1); $i = 0;
define('HOOK_BEFORE_PAGE', 2); define('HOOK_STARTUP', ++$i);
define('HOOK_AFTER_PAGE', 3); define('HOOK_BEFORE_PAGE', ++$i);
define('HOOK_FINISH', 4); define('HOOK_AFTER_PAGE', ++$i);
define('HOOK_TIBIACOM_ARTICLE', 5); define('HOOK_FINISH', ++$i);
define('HOOK_TIBIACOM_BORDER_3', 6); define('HOOK_TIBIACOM_ARTICLE', ++$i);
define('HOOK_CHARACTERS_BEFORE_INFORMATIONS', 7); define('HOOK_TIBIACOM_BORDER_3', ++$i);
define('HOOK_CHARACTERS_AFTER_INFORMATIONS', 8); define('HOOK_CHARACTERS_BEFORE_INFORMATIONS', ++$i);
define('HOOK_CHARACTERS_BEFORE_SIGNATURE', 9); define('HOOK_CHARACTERS_AFTER_INFORMATIONS', ++$i);
define('HOOK_CHARACTERS_AFTER_SIGNATURE', 10); define('HOOK_CHARACTERS_BEFORE_SKILLS', ++$i);
define('HOOK_CHARACTERS_AFTER_ACCOUNT', 11); define('HOOK_CHARACTERS_AFTER_SKILLS', ++$i);
define('HOOK_CHARACTERS_AFTER_CHARACTERS', 12); define('HOOK_CHARACTERS_AFTER_QUESTS', ++$i);
define('HOOK_LOGIN', 13); define('HOOK_CHARACTERS_AFTER_EQUIPMENT', ++$i);
define('HOOK_LOGIN_ATTEMPT', 14); define('HOOK_CHARACTERS_BEFORE_DEATHS', ++$i);
define('HOOK_LOGOUT', 15); define('HOOK_CHARACTERS_BEFORE_SIGNATURE', ++$i);
define('HOOK_ACCOUNT_CREATE_BEFORE_FORM', 16); define('HOOK_CHARACTERS_AFTER_SIGNATURE', ++$i);
define('HOOK_ACCOUNT_CREATE_BEFORE_BOXES', 17); define('HOOK_CHARACTERS_AFTER_ACCOUNT', ++$i);
define('HOOK_ACCOUNT_CREATE_BETWEEN_BOXES_1', 18); define('HOOK_CHARACTERS_AFTER_CHARACTERS', ++$i);
define('HOOK_ACCOUNT_CREATE_BETWEEN_BOXES_2', 19); define('HOOK_LOGIN', ++$i);
define('HOOK_ACCOUNT_CREATE_AFTER_BOXES', 20); define('HOOK_LOGIN_ATTEMPT', ++$i);
define('HOOK_ACCOUNT_CREATE_BEFORE_ACCOUNT', 21); define('HOOK_LOGOUT', ++$i);
define('HOOK_ACCOUNT_CREATE_AFTER_ACCOUNT', 22); define('HOOK_ACCOUNT_CREATE_BEFORE_FORM', ++$i);
define('HOOK_ACCOUNT_CREATE_AFTER_EMAIL', 23); define('HOOK_ACCOUNT_CREATE_BEFORE_BOXES', ++$i);
define('HOOK_ACCOUNT_CREATE_AFTER_COUNTRY', 24); define('HOOK_ACCOUNT_CREATE_BETWEEN_BOXES_1', ++$i);
define('HOOK_ACCOUNT_CREATE_AFTER_PASSWORDS', 25); define('HOOK_ACCOUNT_CREATE_BETWEEN_BOXES_2', ++$i);
define('HOOK_ACCOUNT_CREATE_AFTER_RECAPTCHA', 26); define('HOOK_ACCOUNT_CREATE_AFTER_BOXES', ++$i);
define('HOOK_ACCOUNT_CREATE_BEFORE_CHARACTER_NAME', 27); define('HOOK_ACCOUNT_CREATE_BEFORE_ACCOUNT', ++$i);
define('HOOK_ACCOUNT_CREATE_AFTER_CHARACTER_NAME', 28); define('HOOK_ACCOUNT_CREATE_AFTER_ACCOUNT', ++$i);
define('HOOK_ACCOUNT_CREATE_AFTER_SEX', 29); define('HOOK_ACCOUNT_CREATE_AFTER_EMAIL', ++$i);
define('HOOK_ACCOUNT_CREATE_AFTER_VOCATION', 30); define('HOOK_ACCOUNT_CREATE_AFTER_COUNTRY', ++$i);
define('HOOK_ACCOUNT_CREATE_AFTER_TOWNS', 31); define('HOOK_ACCOUNT_CREATE_AFTER_PASSWORDS', ++$i);
define('HOOK_ACCOUNT_CREATE_BEFORE_SUBMIT_BUTTON', 32); define('HOOK_ACCOUNT_CREATE_AFTER_RECAPTCHA', ++$i);
define('HOOK_ACCOUNT_CREATE_AFTER_FORM', 33); define('HOOK_ACCOUNT_CREATE_BEFORE_CHARACTER_NAME', ++$i);
define('HOOK_ACCOUNT_CREATE_AFTER_SUBMIT', 34); define('HOOK_ACCOUNT_CREATE_AFTER_CHARACTER_NAME', ++$i);
define('HOOK_EMAIL_CONFIRMED', 35); define('HOOK_ACCOUNT_CREATE_AFTER_SEX', ++$i);
define('HOOK_ACCOUNT_CREATE_AFTER_VOCATION', ++$i);
define('HOOK_ACCOUNT_CREATE_AFTER_TOWNS', ++$i);
define('HOOK_ACCOUNT_CREATE_BEFORE_SUBMIT_BUTTON', ++$i);
define('HOOK_ACCOUNT_CREATE_AFTER_FORM', ++$i);
define('HOOK_ACCOUNT_CREATE_AFTER_SUBMIT', ++$i);
define('HOOK_EMAIL_CONFIRMED', ++$i);
define('HOOK_FIRST', HOOK_STARTUP); define('HOOK_FIRST', HOOK_STARTUP);
define('HOOK_LAST', HOOK_EMAIL_CONFIRMED); define('HOOK_LAST', HOOK_EMAIL_CONFIRMED);
@@ -68,9 +74,7 @@ class Hook
}*/ }*/
global $db, $config, $template_path, $ots, $content, $twig; global $db, $config, $template_path, $ots, $content, $twig;
if(file_exists(BASE . $this->_file)) { $ret = include BASE . $this->_file;
$ret = require BASE . $this->_file;
}
return !isset($ret) || $ret == 1 || $ret; return !isset($ret) || $ret == 1 || $ret;
} }

View File

@@ -31,9 +31,6 @@ if($config['gzip_output'] && isset($_SERVER['HTTP_ACCEPT_ENCODING']) && strpos($
require_once SYSTEM . 'libs/cache.php'; require_once SYSTEM . 'libs/cache.php';
$cache = Cache::getInstance(); $cache = Cache::getInstance();
// twig
require_once SYSTEM . 'twig.php';
// trim values we receive // trim values we receive
if(isset($_POST)) if(isset($_POST))
{ {
@@ -114,7 +111,7 @@ if(!isset($foundValue)) {
$config['data_path'] = $foundValue; $config['data_path'] = $foundValue;
unset($foundValue); unset($foundValue);
// new config values for compability // new config values for compatibility
if(!isset($config['highscores_ids_hidden']) || count($config['highscores_ids_hidden']) == 0) { if(!isset($config['highscores_ids_hidden']) || count($config['highscores_ids_hidden']) == 0) {
$config['highscores_ids_hidden'] = array(0); $config['highscores_ids_hidden'] = array(0);
} }
@@ -126,6 +123,9 @@ require_once SYSTEM . 'libs/pot/OTS.php';
$ots = POT::getInstance(); $ots = POT::getInstance();
require_once SYSTEM . 'database.php'; require_once SYSTEM . 'database.php';
// twig
require_once SYSTEM . 'twig.php';
define('USE_ACCOUNT_NAME', $db->hasColumn('accounts', 'name')); define('USE_ACCOUNT_NAME', $db->hasColumn('accounts', 'name'));
// load vocation names // load vocation names
$tmp = ''; $tmp = '';

View File

@@ -58,4 +58,3 @@ function outputItem($id = 100, $count = 1)
$file_name = Items_Images::$outputDir . $file_name . '.gif'; $file_name = Items_Images::$outputDir . $file_name . '.gif';
readfile($file_name); readfile($file_name);
} }
?>

View File

@@ -138,7 +138,7 @@ class CreateCharacter
if(empty($errors)) if(empty($errors))
{ {
$number_of_players_on_account = $account->getPlayersList(false)->count(); $number_of_players_on_account = $account->getPlayersList(true)->count();
if($number_of_players_on_account >= config('characters_per_account')) if($number_of_players_on_account >= config('characters_per_account'))
$errors[] = 'You have too many characters on your account <b>('.$number_of_players_on_account.'/'.config('characters_per_account').')</b>!'; $errors[] = 'You have too many characters on your account <b>('.$number_of_players_on_account.'/'.config('characters_per_account').')</b>!';
} }
@@ -252,11 +252,13 @@ class CreateCharacter
} }
} }
if ($db->hasTable('player_items') && $db->hasColumn('player_items', 'pid') && $db->hasColumn('player_items', 'sid') && $db->hasColumn('player_items', 'itemtype')) {
$loaded_items_to_copy = $db->query("SELECT * FROM player_items WHERE player_id = ".$char_to_copy->getId().""); $loaded_items_to_copy = $db->query("SELECT * FROM player_items WHERE player_id = ".$char_to_copy->getId()."");
foreach($loaded_items_to_copy as $save_item) { foreach($loaded_items_to_copy as $save_item) {
$blob = $db->quote($save_item['attributes']); $blob = $db->quote($save_item['attributes']);
$db->query("INSERT INTO `player_items` (`player_id` ,`pid` ,`sid` ,`itemtype`, `count`, `attributes`) VALUES ('".$player->getId()."', '".$save_item['pid']."', '".$save_item['sid']."', '".$save_item['itemtype']."', '".$save_item['count']."', $blob);"); $db->query("INSERT INTO `player_items` (`player_id` ,`pid` ,`sid` ,`itemtype`, `count`, `attributes`) VALUES ('".$player->getId()."', '".$save_item['pid']."', '".$save_item['sid']."', '".$save_item['itemtype']."', '".$save_item['count']."', $blob);");
} }
}
global $twig; global $twig;
$twig->display('success.html.twig', array( $twig->display('success.html.twig', array(

View File

@@ -110,4 +110,21 @@ class Cache
* @return bool * @return bool
*/ */
public function enabled() {return false;} public function enabled() {return false;}
public static function remember($key, $ttl, $callback)
{
$cache = self::getInstance();
if(!$cache->enabled()) {
return $callback();
}
$value = null;
if ($cache->fetch($key, $value)) {
return unserialize($value);
}
$value = $callback();
$cache->set($key, serialize($value),$ttl);
return $value;
}
} }

View File

@@ -41,4 +41,3 @@ class Data
return $db->update($this->table, $data, $where); return $db->update($this->table, $data, $where);
} }
} }
?>

View File

@@ -32,5 +32,3 @@ class E_OTS_ErrorCode extends Exception
} }
/**#@-*/ /**#@-*/
?>

View File

@@ -36,5 +36,3 @@ class E_OTS_Generic extends E_OTS_ErrorCode
} }
/**#@-*/ /**#@-*/
?>

View File

@@ -22,5 +22,3 @@ class E_OTS_NotAContainer extends Exception
} }
/**#@-*/ /**#@-*/
?>

View File

@@ -32,5 +32,3 @@ class E_OTS_OTBMError extends E_OTS_ErrorCode
} }
/**#@-*/ /**#@-*/
?>

View File

@@ -22,5 +22,3 @@ class E_OTS_ReadOnly extends Exception
} }
/**#@-*/ /**#@-*/
?>

View File

@@ -37,5 +37,3 @@ interface IOTS_Cipher
} }
/**#@-*/ /**#@-*/
?>

View File

@@ -89,5 +89,3 @@ interface IOTS_DataDisplay
} }
/**#@-*/ /**#@-*/
?>

View File

@@ -96,5 +96,3 @@ interface IOTS_Display
} }
/**#@-*/ /**#@-*/
?>

View File

@@ -67,5 +67,3 @@ interface IOTS_GuildAction
} }
/**#@-*/ /**#@-*/
?>

View File

@@ -922,7 +922,7 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
$access = 0; $access = 0;
// finds ranks of all characters // finds ranks of all characters
foreach($this->getPlayersList() as $player) foreach($this->getPlayersList(false) as $player)
{ {
$rank = $player->getRank(); $rank = $player->getRank();
@@ -1126,5 +1126,3 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
} }
/**#@-*/ /**#@-*/
?>

View File

@@ -34,5 +34,3 @@ class OTS_AccountBans_List extends OTS_Bans_List
$this->setFilter($filter); $this->setFilter($filter);
} }
} }
?>

View File

@@ -735,5 +735,3 @@ class OTS_Admin
} }
/**#@-*/ /**#@-*/
?>

View File

@@ -100,5 +100,3 @@ class OTS_Bans_List extends OTS_Base_List
} }
} }
} }
?>

View File

@@ -248,5 +248,3 @@ abstract class OTS_Base_DB extends PDO implements IOTS_DB
} }
/**#@-*/ /**#@-*/
?>

View File

@@ -146,5 +146,3 @@ class OTS_BinaryTools
} }
/**#@-*/ /**#@-*/
?>

View File

@@ -149,5 +149,3 @@ class OTS_Container extends OTS_Item implements IteratorAggregate
} }
/**#@-*/ /**#@-*/
?>

View File

@@ -357,5 +357,3 @@ class OTS_FileLoader
} }
/**#@-*/ /**#@-*/
?>

View File

@@ -671,5 +671,3 @@ class OTS_Group extends OTS_Row_DAO implements IteratorAggregate, Countable
} }
/**#@-*/ /**#@-*/
?>

View File

@@ -837,5 +837,3 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
} }
/**#@-*/ /**#@-*/
?>

View File

@@ -72,5 +72,3 @@ class OTS_GuildRanks_List extends OTS_Base_List
} }
/**#@-*/ /**#@-*/
?>

View File

@@ -529,5 +529,3 @@ class OTS_House extends OTS_Row_DAO
} }
/**#@-*/ /**#@-*/
?>

View File

@@ -34,5 +34,3 @@ class OTS_IPBans_List extends OTS_Bans_List
$this->setFilter($filter); $this->setFilter($filter);
} }
} }
?>

View File

@@ -387,5 +387,3 @@ class OTS_InfoRespond extends DOMDocument
} }
/**#@-*/ /**#@-*/
?>

View File

@@ -676,5 +676,3 @@ class OTS_ItemsList extends OTS_FileLoader implements IteratorAggregate, Countab
} }
/**#@-*/ /**#@-*/
?>

View File

@@ -130,5 +130,3 @@ class OTS_MapCoords
} }
/**#@-*/ /**#@-*/
?>

View File

@@ -61,8 +61,8 @@ class OTS_MonstersList implements Iterator, Countable, ArrayAccess
// check if monsters.xml exist // check if monsters.xml exist
if(!@file_exists($this->monstersPath . 'monsters.xml')) { if(!@file_exists($this->monstersPath . 'monsters.xml')) {
log_append('error.log', '[OTS_MonstersList.php] Fatal error: Cannot load monsters.xml. File does not exist. (' . $this->monstersPath . 'monsters.xml' . '). Error: ' . print_r(error_get_last(), true)); log_append('error.log', '[OTS_MonstersList.php] Fatal error: Cannot load monsters.xml. File does not exist. (' . $this->monstersPath . 'monsters.xml' . ').');
throw new Exception('Error: Cannot load monsters.xml. File not found. More info in system/logs/error.log file.'); throw new Exception('Error: Cannot load monsters.xml. File not found.');
} }
// loads monsters mapping file // loads monsters mapping file
@@ -174,6 +174,7 @@ class OTS_MonstersList implements Iterator, Countable, ArrayAccess
* @return OTS_Monster Monster. * @return OTS_Monster Monster.
* @throws DOMException On DOM operation error. * @throws DOMException On DOM operation error.
*/ */
#[\ReturnTypeWillChange]
public function current() public function current()
{ {
return $this->getMonster( key($this->monsters) ); return $this->getMonster( key($this->monsters) );
@@ -187,7 +188,7 @@ class OTS_MonstersList implements Iterator, Countable, ArrayAccess
/** /**
* Moves to next iterator monster. * Moves to next iterator monster.
*/ */
public function next() public function next(): void
{ {
next($this->monsters); next($this->monsters);
} }
@@ -197,6 +198,7 @@ class OTS_MonstersList implements Iterator, Countable, ArrayAccess
* *
* @return string Current position key. * @return string Current position key.
*/ */
#[\ReturnTypeWillChange]
public function key() public function key()
{ {
return key($this->monsters); return key($this->monsters);
@@ -207,7 +209,7 @@ class OTS_MonstersList implements Iterator, Countable, ArrayAccess
* *
* @return bool If iterator has anything more. * @return bool If iterator has anything more.
*/ */
public function valid() public function valid(): bool
{ {
return key($this->monsters) !== null; return key($this->monsters) !== null;
} }
@@ -215,7 +217,7 @@ class OTS_MonstersList implements Iterator, Countable, ArrayAccess
/** /**
* Resets iterator index. * Resets iterator index.
*/ */
public function rewind() public function rewind(): void
{ {
reset($this->monsters); reset($this->monsters);
} }
@@ -226,6 +228,7 @@ class OTS_MonstersList implements Iterator, Countable, ArrayAccess
* @param string $offset Array key. * @param string $offset Array key.
* @return bool True if it's set. * @return bool True if it's set.
*/ */
#[\ReturnTypeWillChange]
public function offsetExists($offset) public function offsetExists($offset)
{ {
return isset($this->monsters[$offset]); return isset($this->monsters[$offset]);
@@ -239,6 +242,7 @@ class OTS_MonstersList implements Iterator, Countable, ArrayAccess
* @return OTS_Monster Monster instance. * @return OTS_Monster Monster instance.
* @throws DOMException On DOM operation error. * @throws DOMException On DOM operation error.
*/ */
#[\ReturnTypeWillChange]
public function offsetGet($offset) public function offsetGet($offset)
{ {
return $this->getMonster($offset); return $this->getMonster($offset);
@@ -251,6 +255,7 @@ class OTS_MonstersList implements Iterator, Countable, ArrayAccess
* @param mixed $value Field value. * @param mixed $value Field value.
* @throws E_OTS_ReadOnly Always - this class is read-only. * @throws E_OTS_ReadOnly Always - this class is read-only.
*/ */
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value) public function offsetSet($offset, $value)
{ {
throw new E_OTS_ReadOnly(); throw new E_OTS_ReadOnly();
@@ -262,6 +267,7 @@ class OTS_MonstersList implements Iterator, Countable, ArrayAccess
* @param string|int $offset Array key. * @param string|int $offset Array key.
* @throws E_OTS_ReadOnly Always - this class is read-only. * @throws E_OTS_ReadOnly Always - this class is read-only.
*/ */
#[\ReturnTypeWillChange]
public function offsetUnset($offset) public function offsetUnset($offset)
{ {
throw new E_OTS_ReadOnly(); throw new E_OTS_ReadOnly();
@@ -293,5 +299,3 @@ class OTS_MonstersList implements Iterator, Countable, ArrayAccess
} }
/**#@-*/ /**#@-*/
?>

View File

@@ -398,7 +398,7 @@ class OTS_Player extends OTS_Row_DAO
} }
// UPDATE query on database // UPDATE query on database
$this->db->query('UPDATE ' . $this->db->tableName('players') . ' SET ' . $this->db->fieldName('name') . ' = ' . $this->db->quote($this->data['name']) . ', ' . $this->db->fieldName('account_id') . ' = ' . $this->data['account_id'] . ', ' . $this->db->fieldName('group_id') . ' = ' . $this->data['group_id'] . ', ' . $this->db->fieldName('sex') . ' = ' . $this->data['sex'] . ', ' . $this->db->fieldName('vocation') . ' = ' . $this->data['vocation'] . ', ' . $this->db->fieldName('experience') . ' = ' . $this->data['experience'] . ', ' . $this->db->fieldName('level') . ' = ' . $this->data['level'] . ', ' . $this->db->fieldName('maglevel') . ' = ' . $this->data['maglevel'] . ', ' . $this->db->fieldName('health') . ' = ' . $this->data['health'] . ', ' . $this->db->fieldName('healthmax') . ' = ' . $this->data['healthmax'] . ', ' . $this->db->fieldName('mana') . ' = ' . $this->data['mana'] . ', ' . $this->db->fieldName('manamax') . ' = ' . $this->data['manamax'] . ', ' . $this->db->fieldName('manaspent') . ' = ' . $this->data['manaspent'] . ', ' . $this->db->fieldName('soul') . ' = ' . $this->data['soul'] . ', ' . $this->db->fieldName('lookbody') . ' = ' . $this->data['lookbody'] . ', ' . $this->db->fieldName('lookfeet') . ' = ' . $this->data['lookfeet'] . ', ' . $this->db->fieldName('lookhead') . ' = ' . $this->data['lookhead'] . ', ' . $this->db->fieldName('looklegs') . ' = ' . $this->data['looklegs'] . ', ' . $this->db->fieldName('looktype') . ' = ' . $this->data['looktype'] . $lookaddons . ', ' . $this->db->fieldName('posx') . ' = ' . $this->data['posx'] . ', ' . $this->db->fieldName('posy') . ' = ' . $this->data['posy'] . ', ' . $this->db->fieldName('posz') . ' = ' . $this->data['posz'] . ', ' . $this->db->fieldName('cap') . ' = ' . $this->data['cap'] . ', ' . $this->db->fieldName('lastlogin') . ' = ' . $this->data['lastlogin'] . ', ' . $this->db->fieldName('lastlogout') . ' = ' . $this->data['lastlogout'] . ', ' . $this->db->fieldName('lastip') . ' = ' . $this->data['lastip'] . ', ' . $this->db->fieldName('save') . ' = ' . (int) $this->data['save'] . ', ' . $this->db->fieldName('conditions') . ' = ' . $this->db->quote($this->data['conditions']) . ', `' . $skull_time . '` = ' . $this->data['skulltime'] . ', `' . $skull_type . '` = ' . (int) $this->data['skull'] . $guild_info . ', ' . $this->db->fieldName('town_id') . ' = ' . $this->data['town_id'] . $loss . $loss_items . ', ' . $this->db->fieldName('balance') . ' = ' . $this->data['balance'] . $blessings . $stamina . $direction . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']); $this->db->query('UPDATE ' . $this->db->tableName('players') . ' SET ' . $this->db->fieldName('name') . ' = ' . $this->db->quote($this->data['name']) . ', ' . $this->db->fieldName('account_id') . ' = ' . $this->data['account_id'] . ', ' . $this->db->fieldName('group_id') . ' = ' . $this->data['group_id'] . ', ' . $this->db->fieldName('sex') . ' = ' . $this->data['sex'] . ', ' . $this->db->fieldName('vocation') . ' = ' . $this->data['vocation'] . ', ' . $this->db->fieldName('experience') . ' = ' . $this->data['experience'] . ', ' . $this->db->fieldName('level') . ' = ' . $this->data['level'] . ', ' . $this->db->fieldName('maglevel') . ' = ' . $this->data['maglevel'] . ', ' . $this->db->fieldName('health') . ' = ' . $this->data['health'] . ', ' . $this->db->fieldName('healthmax') . ' = ' . $this->data['healthmax'] . ', ' . $this->db->fieldName('mana') . ' = ' . $this->data['mana'] . ', ' . $this->db->fieldName('manamax') . ' = ' . $this->data['manamax'] . ', ' . $this->db->fieldName('manaspent') . ' = ' . $this->data['manaspent'] . ', ' . $this->db->fieldName('soul') . ' = ' . $this->data['soul'] . ', ' . $this->db->fieldName('lookbody') . ' = ' . $this->data['lookbody'] . ', ' . $this->db->fieldName('lookfeet') . ' = ' . $this->data['lookfeet'] . ', ' . $this->db->fieldName('lookhead') . ' = ' . $this->data['lookhead'] . ', ' . $this->db->fieldName('looklegs') . ' = ' . $this->data['looklegs'] . ', ' . $this->db->fieldName('looktype') . ' = ' . $this->data['looktype'] . $lookaddons . ', ' . $this->db->fieldName('posx') . ' = ' . $this->data['posx'] . ', ' . $this->db->fieldName('posy') . ' = ' . $this->data['posy'] . ', ' . $this->db->fieldName('posz') . ' = ' . $this->data['posz'] . ', ' . $this->db->fieldName('cap') . ' = ' . $this->data['cap'] . ', ' . $this->db->fieldName('lastlogin') . ' = ' . $this->data['lastlogin'] . ', ' . $this->db->fieldName('lastlogout') . ' = ' . $this->data['lastlogout'] . ', ' . $this->db->fieldName('lastip') . ' = ' . $this->db->quote($this->data['lastip']) . ', ' . $this->db->fieldName('save') . ' = ' . (int) $this->data['save'] . ', ' . $this->db->fieldName('conditions') . ' = ' . $this->db->quote($this->data['conditions']) . ', `' . $skull_time . '` = ' . $this->data['skulltime'] . ', `' . $skull_type . '` = ' . (int) $this->data['skull'] . $guild_info . ', ' . $this->db->fieldName('town_id') . ' = ' . $this->data['town_id'] . $loss . $loss_items . ', ' . $this->db->fieldName('balance') . ' = ' . $this->data['balance'] . $blessings . $stamina . $direction . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']);
} }
// creates new player // creates new player
else else
@@ -3627,5 +3627,3 @@ class OTS_Player extends OTS_Row_DAO
} }
/**#@-*/ /**#@-*/
?>

View File

@@ -34,5 +34,3 @@ class OTS_PlayerBans_List extends OTS_Bans_List
$this->setFilter($filter); $this->setFilter($filter);
} }
} }
?>

View File

@@ -75,5 +75,3 @@ abstract class OTS_Row_DAO extends OTS_Base_DAO
} }
/**#@-*/ /**#@-*/
?>

View File

@@ -121,5 +121,3 @@ class OTS_SQLField
} }
/**#@-*/ /**#@-*/
?>

View File

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

View File

@@ -482,5 +482,3 @@ class OTS_Spell
} }
/**#@-*/ /**#@-*/
?>

View File

@@ -95,8 +95,8 @@ class OTS_SpellsList implements IteratorAggregate, Countable
{ {
// check if spells.xml exist // check if spells.xml exist
if(!@file_exists($file)) { if(!@file_exists($file)) {
log_append('error.log', '[OTS_SpellsList.php] Fatal error: Cannot load spells.xml. File does not exist. (' . $file . '). Error: ' . print_r(error_get_last(), true)); log_append('error.log', '[OTS_SpellsList.php] Fatal error: Cannot load spells.xml. File does not exist. (' . $file . ').');
throw new Exception('Error: Cannot load spells.xml. File not found. More info in system/logs/error.log file.'); throw new Exception('Error: Cannot load spells.xml. File not found.');
} }
// loads monsters mapping file // loads monsters mapping file
@@ -308,7 +308,7 @@ class OTS_SpellsList implements IteratorAggregate, Countable
* @since 0.1.5 * @since 0.1.5
* @return AppendIterator Iterator for all spells. * @return AppendIterator Iterator for all spells.
*/ */
public function getIterator() public function getIterator(): Traversable
{ {
$iterator = new AppendIterator(); $iterator = new AppendIterator();
$iterator->append( new ArrayIterator($this->runes) ); $iterator->append( new ArrayIterator($this->runes) );

View File

@@ -113,5 +113,3 @@ class OTS_Toolbox
} }
/**#@-*/ /**#@-*/
?>

View File

@@ -151,5 +151,3 @@ class OTS_XTEA implements IOTS_Cipher
} }
/**#@-*/ /**#@-*/
?>

View File

@@ -282,4 +282,3 @@ class TokenAuth6238 {
return $result; return $result;
} }
} }
?>

View File

@@ -432,4 +432,3 @@ class Validator
return self::$lastError; return self::$lastError;
} }
} }
?>

View File

@@ -6,4 +6,3 @@
* @author Slawkens <slawkens@gmail.com> * @author Slawkens <slawkens@gmail.com>
*/ */
$locale['title'] = 'MyAAC Admin'; $locale['title'] = 'MyAAC Admin';
?>

View File

@@ -12,4 +12,3 @@ $locale['direction']= 'ltr';
$locale['error404'] = 'Diese Seite konnte nicht gefunden werden.'; $locale['error404'] = 'Diese Seite konnte nicht gefunden werden.';
$locale['news'] = 'Neuesten Nachrichten'; $locale['news'] = 'Neuesten Nachrichten';
?>

View File

@@ -20,7 +20,7 @@ $locale['not_loaded'] = 'Not loaded';
$locale['loading_spinner'] = 'Please wait, installing...'; $locale['loading_spinner'] = 'Please wait, installing...';
$locale['importing_spinner'] = 'Please wait, importing data...'; $locale['importing_spinner'] = 'Please wait, importing data...';
$locale['please_fill_all'] = 'Please fill all inputs!'; $locale['please_fill_all'] = 'Please fill all inputs!';
$locale['already_installed'] = 'MyAAC has been already installed. Please delete <b>install/<b/> directory. If you want to reinstall MyAAC - please delete <strong>config.local.php</strong> file from the main directory and refresh the page.'; $locale['already_installed'] = 'MyAAC has been already installed. Please delete <b>install/</b> directory. If you want to reinstall MyAAC - please delete <strong>config.local.php</strong> file from the main directory and refresh the page.';
// welcome // welcome
$locale['step_welcome'] = 'Welcome'; $locale['step_welcome'] = 'Welcome';
@@ -63,6 +63,7 @@ $locale['step_config_usage_desc'] = 'Allow MyAAC to report anonymous usage stati
$locale['step_database'] = 'Import schema'; $locale['step_database'] = 'Import schema';
$locale['step_database_title'] = 'Import MySQL schema'; $locale['step_database_title'] = 'Import MySQL schema';
$locale['step_database_importing'] = 'Your database is MySQL. Database name is: "$DATABASE_NAME$". Importing schema now...'; $locale['step_database_importing'] = 'Your database is MySQL. Database name is: "$DATABASE_NAME$". Importing schema now...';
$locale['step_database_config_saved'] = 'Local configuration has been saved into file: config.local.php';
$locale['step_database_error_path'] = 'Please specify server path.'; $locale['step_database_error_path'] = 'Please specify server path.';
$locale['step_database_error_config'] = 'Cannot find config.lua file. Is your server path correct? Go back and check again.'; $locale['step_database_error_config'] = 'Cannot find config.lua file. Is your server path correct? Go back and check again.';
$locale['step_database_error_database_empty'] = 'Cannot determine database type from config.lua. Your OTS is unsupported by this AAC.'; $locale['step_database_error_database_empty'] = 'Cannot determine database type from config.lua. Your OTS is unsupported by this AAC.';
@@ -122,4 +123,3 @@ $locale['step_finish_title'] = 'Installation finished!';
$locale['step_finish_desc'] = 'Congratulations! <b>MyAAC</b> is ready to use!<br/>You can now login to $ADMIN_PANEL$, or visit $HOMEPAGE$.<br/><br/> $locale['step_finish_desc'] = 'Congratulations! <b>MyAAC</b> is ready to use!<br/>You can now login to $ADMIN_PANEL$, or visit $HOMEPAGE$.<br/><br/>
<span style="color: red">Please delete install/ directory.</span><br/><br/> <span style="color: red">Please delete install/ directory.</span><br/><br/>
Post bugs and suggestions at $LINK$, thanks!'; Post bugs and suggestions at $LINK$, thanks!';
?>

View File

@@ -6,4 +6,3 @@
* @author Slawkens <slawkens@gmail.com> * @author Slawkens <slawkens@gmail.com>
*/ */
$locale['title'] = 'MyAAC Admin'; $locale['title'] = 'MyAAC Admin';
?>

View File

@@ -59,6 +59,7 @@ $locale['step_config_usage_desc'] = 'Zezwalaj MyAAC na raportowanie anonimowych
$locale['step_database'] = 'Baza Danych'; $locale['step_database'] = 'Baza Danych';
$locale['step_database_title'] = 'Baza MySQL'; $locale['step_database_title'] = 'Baza MySQL';
$locale['step_database_importing'] = 'Twoja baza to MySQL. Nazwa bazy danych to: "$DATABASE_NAME$". Importowanie schematu...'; $locale['step_database_importing'] = 'Twoja baza to MySQL. Nazwa bazy danych to: "$DATABASE_NAME$". Importowanie schematu...';
$locale['step_database_config_saved'] = 'Lokalna konfiguracja została zapisana do pliku: config.local.php';
$locale['step_database_error_path'] = 'Proszę podać ścieżkę do serwera.'; $locale['step_database_error_path'] = 'Proszę podać ścieżkę do serwera.';
$locale['step_database_error_config'] = 'Nie można znaleźć pliku config.lua. Czy ścieżka do katalogu serwera jest poprawna? Wróć się i sprawdź ponownie.'; $locale['step_database_error_config'] = 'Nie można znaleźć pliku config.lua. Czy ścieżka do katalogu serwera jest poprawna? Wróć się i sprawdź ponownie.';
$locale['step_database_error_database_empty'] = 'Nie można wykryć typu bazy danych z pliku config.lua. Prawdopodobnie Twój OTS nie jest wspierany przez ten AAC.'; $locale['step_database_error_database_empty'] = 'Nie można wykryć typu bazy danych z pliku config.lua. Prawdopodobnie Twój OTS nie jest wspierany przez ten AAC.';

View File

@@ -12,4 +12,3 @@ $locale['direction']= 'ltr';
$locale['error404'] = 'Strona nie została odnaleziona.'; $locale['error404'] = 'Strona nie została odnaleziona.';
$locale['news'] = 'Ostatnie newsy'; $locale['news'] = 'Ostatnie newsy';
?>

View File

@@ -121,4 +121,3 @@ $locale['step_finish'] = 'Finalizar';
$locale['step_finish_title'] = 'Instalação terminada!'; $locale['step_finish_title'] = 'Instalação terminada!';
$locale['step_finish_desc'] = 'Parabéns! <b>MyAAC</b> está pronto para uso!<br/>Agora você pode fazer login em $ADMIN_PANEL$ ou visitar $HOMEPAGE$.<br/><br/> $locale['step_finish_desc'] = 'Parabéns! <b>MyAAC</b> está pronto para uso!<br/>Agora você pode fazer login em $ADMIN_PANEL$ ou visitar $HOMEPAGE$.<br/><br/>
<span style = "color: red">Por favor remova a pasta install/.</span><br/><br/>Postar bugs e sugestões em $LINK$, obrigado!'; <span style = "color: red">Por favor remova a pasta install/.</span><br/><br/>Postar bugs e sugestões em $LINK$, obrigado!';
?>

View File

@@ -6,4 +6,3 @@
* @author Sizaro <sizaro@live.se> * @author Sizaro <sizaro@live.se>
*/ */
$locale['title'] = 'MyAAC Admin'; $locale['title'] = 'MyAAC Admin';
?>

View File

@@ -42,13 +42,12 @@ $locale['step_config'] = 'Konfiguration';
$locale['step_config_title'] = 'Grundläggande konfiguration'; $locale['step_config_title'] = 'Grundläggande konfiguration';
$locale['step_config_server_path'] = 'Server mapp'; $locale['step_config_server_path'] = 'Server mapp';
$locale['step_config_server_path_desc'] = 'Mappen som innhåller exe filen till The Forgotten Server, där du har din config.lua.'; $locale['step_config_server_path_desc'] = 'Mappen som innhåller exe filen till The Forgotten Server, där du har din config.lua.';
$locale['step_config_mail_admin'] = 'Admin E-Post'; $locale['step_config_mail_admin'] = 'Admin E-Post';
$locale['step_config_mail_admin_desc'] = 'Adress där E-Post från kontaktförmolär kommer att leveraras, till exempel admin@gmail.com'; $locale['step_config_mail_admin_desc'] = 'Adress där E-Post från kontaktförmolär kommer att leveraras, till exempel admin@gmail.com';
$locale['step_config_mail_admin_error'] = 'Admin E-Post är inte korrekt.'; $locale['step_config_mail_admin_error'] = 'Admin E-Post är inte korrekt.';
$locale['step_config_mail_address'] = 'Server E-Post'; $locale['step_config_mail_address'] = 'Server E-Post';
$locale['step_config_mail_address_desc'] = 'Adress som kommer att användas för utgående email (från:), till exempel no-reply@your-server.org'; $locale['step_config_mail_address_desc'] = 'Adress som kommer att användas för utgående email (från:), till exempel no-reply@your-server.org';
$locale['step_config_mail_address_error'] = 'Server E-Post är inte korrekt.'; $locale['step_config_mail_address_error'] = 'Server E-Post är inte korrekt.';
$locale['step_config_client'] = 'Klientversion'; $locale['step_config_client'] = 'Klientversion';
$locale['step_config_client_desc'] = 'Används för nerladdningssidan och teman.'; $locale['step_config_client_desc'] = 'Används för nerladdningssidan och teman.';

View File

@@ -12,4 +12,3 @@ $locale['direction']= 'ltr';
$locale['error404'] = 'Sidan kunde inte hittas.'; $locale['error404'] = 'Sidan kunde inte hittas.';
$locale['news'] = 'Senaste nyheterna'; $locale['news'] = 'Senaste nyheterna';
?>

View File

@@ -10,6 +10,7 @@
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
$logged = false; $logged = false;
$logged_flags = 0; $logged_flags = 0;
$account_logged = new OTS_Account();
$action = isset($_REQUEST['action']) ? strtolower($_REQUEST['action']) : ''; $action = isset($_REQUEST['action']) ? strtolower($_REQUEST['action']) : '';
if(!defined('ACTION')) { if(!defined('ACTION')) {
@@ -20,7 +21,6 @@ if(!defined('ACTION')) {
$current_session = getSession('account'); $current_session = getSession('account');
if($current_session !== false) if($current_session !== false)
{ {
$account_logged = new OTS_Account();
$account_logged->load($current_session); $account_logged->load($current_session);
if($account_logged->isLoaded() && $account_logged->getPassword() == getSession('password') if($account_logged->isLoaded() && $account_logged->getPassword() == getSession('password')
//&& (!isset($_SESSION['admin']) || admin()) //&& (!isset($_SESSION['admin']) || admin())
@@ -84,7 +84,6 @@ else
$t = isset($tmp[$ip]) ? $tmp[$ip] : NULL; $t = isset($tmp[$ip]) ? $tmp[$ip] : NULL;
} }
$account_logged = new OTS_Account();
if(USE_ACCOUNT_NAME) if(USE_ACCOUNT_NAME)
$account_logged->find($login_account); $account_logged->find($login_account);
else else

View File

@@ -17,4 +17,3 @@
'thumb' => str_replace('/screenshots/', '/gallery/', $item['thumb']), 'thumb' => str_replace('/screenshots/', '/gallery/', $item['thumb']),
), array('id' => $item['id'])); ), array('id' => $item['id']));
} }
?>

View File

@@ -1,4 +1,3 @@
<?php <?php
if($db->hasColumn(TABLE_PREFIX . 'spells', 'spell')) if($db->hasColumn(TABLE_PREFIX . 'spells', 'spell'))
$db->query("ALTER TABLE `" . TABLE_PREFIX . "spells` DROP COLUMN `spell`;"); $db->query("ALTER TABLE `" . TABLE_PREFIX . "spells` DROP COLUMN `spell`;");
?>

View File

@@ -8,4 +8,3 @@ if(!$db->hasColumn(TABLE_PREFIX . 'forum_boards', 'guild')) {
if(!$db->hasColumn(TABLE_PREFIX . 'forum_boards', 'access')) { if(!$db->hasColumn(TABLE_PREFIX . 'forum_boards', 'access')) {
$db->query("ALTER TABLE `" . TABLE_PREFIX . "forum_boards` ADD `access` TINYINT(1) NOT NULL DEFAULT 0 AFTER `guild`;"); $db->query("ALTER TABLE `" . TABLE_PREFIX . "forum_boards` ADD `access` TINYINT(1) NOT NULL DEFAULT 0 AFTER `guild`;");
} }
?>

View File

@@ -86,4 +86,3 @@ INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VA
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Shop History', 'gifts/history', 6, 2); INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Shop History', 'gifts/history', 6, 2);
"); ");
} }
?>

View File

@@ -1,3 +1,2 @@
<?php <?php
// this migration has been removed, but file kept for compability // this migration has been removed, but file kept for compatibility
?>

View File

@@ -3,4 +3,3 @@
$db->query("ALTER TABLE `" . TABLE_PREFIX . "movies` MODIFY `title` VARCHAR(100) NOT NULL DEFAULT '';"); $db->query("ALTER TABLE `" . TABLE_PREFIX . "movies` MODIFY `title` VARCHAR(100) NOT NULL DEFAULT '';");
$db->query("ALTER TABLE `" . TABLE_PREFIX . "news` MODIFY `title` VARCHAR(100) NOT NULL DEFAULT '';"); $db->query("ALTER TABLE `" . TABLE_PREFIX . "news` MODIFY `title` VARCHAR(100) NOT NULL DEFAULT '';");
$db->query("ALTER TABLE `" . TABLE_PREFIX . "news` MODIFY `body` TEXT NOT NULL DEFAULT '';"); $db->query("ALTER TABLE `" . TABLE_PREFIX . "news` MODIFY `body` TEXT NOT NULL DEFAULT '';");
?>

View File

@@ -45,4 +45,3 @@ function databaseMigration20(&$content = '') {
file_put_contents($config_file, $content, FILE_APPEND); file_put_contents($config_file, $content, FILE_APPEND);
return true; return true;
} }
?>

View File

@@ -1,4 +1,3 @@
<?php <?php
if(!$db->hasColumn(TABLE_PREFIX . 'monsters', 'id')) if(!$db->hasColumn(TABLE_PREFIX . 'monsters', 'id'))
$db->query("ALTER TABLE `" . TABLE_PREFIX . "monsters` ADD `id` int(11) NOT NULL AUTO_INCREMENT primary key FIRST;"); $db->query("ALTER TABLE `" . TABLE_PREFIX . "monsters` ADD `id` int(11) NOT NULL AUTO_INCREMENT primary key FIRST;");
?>

View File

@@ -1,4 +1,3 @@
<?php <?php
if(!$db->hasColumn(TABLE_PREFIX . 'hooks', 'enabled')) if(!$db->hasColumn(TABLE_PREFIX . 'hooks', 'enabled'))
$db->query("ALTER TABLE `" . TABLE_PREFIX . "hooks` ADD `enabled` INT(1) NOT NULL DEFAULT 1;"); $db->query("ALTER TABLE `" . TABLE_PREFIX . "hooks` ADD `enabled` INT(1) NOT NULL DEFAULT 1;");
?>

View File

@@ -15,4 +15,3 @@
foreach($boards as $id => $board) foreach($boards as $id => $board)
$db->query('UPDATE `' . TABLE_PREFIX . 'forum_boards` SET `ordering` = ' . $id . ' WHERE `name` = ' . $db->quote($board)); $db->query('UPDATE `' . TABLE_PREFIX . 'forum_boards` SET `ordering` = ' . $id . ' WHERE `name` = ' . $db->quote($board));
} }
?>

View File

@@ -1,7 +1,7 @@
<?php <?php
/** /**
* Account confirm mail * Account confirm mail
* Keept for compability * Keept for compatibility
* *
* @package MyAAC * @package MyAAC
* @author Slawkens <slawkens@gmail.com> * @author Slawkens <slawkens@gmail.com>
@@ -13,4 +13,3 @@ defined('MYAAC') or die('Direct access not allowed!');
if($action == 'confirm_email') { if($action == 'confirm_email') {
require_once PAGES . 'account/confirm_email.php'; require_once PAGES . 'account/confirm_email.php';
} }
?>

View File

@@ -21,7 +21,13 @@ if($player_name != null) {
if ($player->isLoaded()) { if ($player->isLoaded()) {
$player_account = $player->getAccount(); $player_account = $player->getAccount();
if ($account_logged->getId() == $player_account->getId()) { if ($account_logged->getId() == $player_account->getId()) {
if ($player->isDeleted()) {
$errors[] = 'This character is deleted.';
$player = null;
}
if (isset($_POST['changecommentsave']) && $_POST['changecommentsave'] == 1) { if (isset($_POST['changecommentsave']) && $_POST['changecommentsave'] == 1) {
if(empty($errors)) {
$player->setCustomField("hidden", $new_hideacc); $player->setCustomField("hidden", $new_hideacc);
$player->setCustomField("comment", $new_comment); $player->setCustomField("comment", $new_comment);
$account_logged->logAction('Changed comment for character <b>' . $player->getName() . '</b>.'); $account_logged->logAction('Changed comment for character <b>' . $player->getName() . '</b>.');
@@ -31,6 +37,7 @@ if($player_name != null) {
)); ));
$show_form = false; $show_form = false;
} }
}
} else { } else {
$errors[] = 'Error. Character <b>' . $player_name . '</b> is not on your account.'; $errors[] = 'Error. Character <b>' . $player_name . '</b> is not on your account.';
} }
@@ -50,7 +57,7 @@ if($show_form) {
$twig->display('error_box.html.twig', array('errors' => $errors)); $twig->display('error_box.html.twig', array('errors' => $errors));
} }
if(isset($player)) { if(isset($player) && $player->isLoaded()) {
$twig->display('account.change_comment.html.twig', array( $twig->display('account.change_comment.html.twig', array(
'player' => $player 'player' => $player
)); ));

View File

@@ -159,4 +159,3 @@ if(isset($_POST['emailchangecancel']) && $_POST['emailchangecancel'] == 1) {
'custom_buttons' => $custom_buttons 'custom_buttons' => $custom_buttons
)); ));
} }
?>

Some files were not shown because too many files have changed in this diff Show More