Compare commits
43 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
a8a4efd39a | ||
![]() |
75aa62a113 | ||
![]() |
170eaec9b0 | ||
![]() |
0b315bfda6 | ||
![]() |
4bd4198e1c | ||
![]() |
1310a49729 | ||
![]() |
6658eb5f20 | ||
![]() |
ecd279453f | ||
![]() |
eda700c483 | ||
![]() |
bde265d79b | ||
![]() |
e5b5aaeaf5 | ||
![]() |
43162b6222 | ||
![]() |
648a655575 | ||
![]() |
7b23ffaf23 | ||
![]() |
449ce31ab4 | ||
![]() |
1a7dbec4c5 | ||
![]() |
9862272025 | ||
![]() |
29c8655aba | ||
![]() |
5c19651a6c | ||
![]() |
1946f56a49 | ||
![]() |
3abc7d8a4b | ||
![]() |
a177c93e97 | ||
![]() |
956e551872 | ||
![]() |
3270caf870 | ||
![]() |
4465da67e9 | ||
![]() |
187b70761c | ||
![]() |
729944006e | ||
![]() |
aa90a74145 | ||
![]() |
194d08f593 | ||
![]() |
870cc8f98b | ||
![]() |
8d7c694c61 | ||
![]() |
a93bd4a0fc | ||
![]() |
636a54c70d | ||
![]() |
ef9d5127a2 | ||
![]() |
f35a24b35b | ||
![]() |
82b60f78da | ||
![]() |
6e7a82b425 | ||
![]() |
08fce2ade4 | ||
![]() |
94b44a8d37 | ||
![]() |
769c2942a4 | ||
![]() |
d3395e2eaf | ||
![]() |
705831c8b3 | ||
![]() |
e808904f76 |
@@ -6,19 +6,23 @@ RewriteEngine On
|
|||||||
# Page parser
|
# Page parser
|
||||||
RewriteCond %{REQUEST_FILENAME} !-f
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
RewriteCond %{REQUEST_FILENAME} !-d
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
RewriteRule ^([A-Za-z0-9-_']+)\.png/?$ tools/signature/index.php?name=$1 [L]
|
RewriteRule ^([A-Za-z0-9-_+']+)\.png/?$ tools/signature/index.php?name=$1 [L]
|
||||||
RewriteRule ^images/items/([0-9]+)\.gif$ tools/item.php?id=$1
|
|
||||||
RewriteRule ^characters/([A-Za-z0-9-_+']+)$ index.php?subtopic=characters&name=$1
|
RewriteRule ^characters/([A-Za-z0-9-_+']+)$ index.php?subtopic=characters&name=$1
|
||||||
RewriteRule ^guilds/([A-Za-z0-9-_+']+)$ index.php?subtopic=guilds&action=show&guild=$1
|
RewriteRule ^guilds/([A-Za-z0-9-_+']+)$ index.php?subtopic=guilds&action=show&guild=$1
|
||||||
RewriteRule ^forum/board/([0-9]+)$ index.php?subtopic=forum&action=show_board&id=$1
|
RewriteRule ^forum/board/([0-9]+)$ index.php?subtopic=forum&action=show_board&id=$1
|
||||||
|
RewriteRule ^forum/board/([0-9]+)/([0-9]+)$ index.php?subtopic=forum&action=show_board&id=$1&page=$2
|
||||||
|
RewriteRule ^forum/thread/([0-9]+)$ index.php?subtopic=forum&action=show_thread&id=$1
|
||||||
|
RewriteRule ^forum/thread/([0-9]+)/([0-9]+)$ index.php?subtopic=forum&action=show_thread&id=$1&page=$2
|
||||||
|
RewriteRule ^forum/board/([0-9]+)/([0-9]+)$ index.php?subtopic=forum&action=show_thread&id=$1&page=$2
|
||||||
RewriteRule ^account/manage$ index.php?subtopic=accountmanagement
|
RewriteRule ^account/manage$ index.php?subtopic=accountmanagement
|
||||||
RewriteRule ^account/create$ index.php?subtopic=createaccount
|
RewriteRule ^account/create$ index.php?subtopic=createaccount
|
||||||
RewriteRule ^account/lost$ index.php?subtopic=lostaccount
|
RewriteRule ^account/lost$ index.php?subtopic=lostaccount
|
||||||
RewriteRule ^account/logout$ index.php?subtopic=accountmanagement&action=logout
|
RewriteRule ^account/logout$ index.php?subtopic=accountmanagement&action=logout
|
||||||
RewriteRule ^news/archive/([0-9]+)$ index.php?subtopic=news&archive=true&id=$1
|
RewriteRule ^news/archive/([0-9]+)$ index.php?subtopic=newsarchive&id=$1
|
||||||
RewriteRule ^news/archive$ index.php?subtopic=news&archive=true
|
RewriteRule ^news/archive$ index.php?subtopic=newsarchive
|
||||||
RewriteRule ^highscores/([A-Za-z0-9-_]+)/([A-Za-z0-9-_]+)?$ index.php?subtopic=highscores&list=$1&vocation=$2
|
RewriteRule ^highscores/([A-Za-z0-9-_]+)/([A-Za-z0-9-_]+)?$ index.php?subtopic=highscores&list=$1&vocation=$2
|
||||||
RewriteRule ^highscores/([A-Za-z0-9-_']+)$ index.php?subtopic=highscores&list=$1
|
RewriteRule ^highscores/([A-Za-z0-9-_']+)$ index.php?subtopic=highscores&list=$1
|
||||||
|
RewriteRule ^polls/([0-9]+)$ index.php?subtopic=polls&id=$1
|
||||||
RewriteRule ^admin/$ admin/index.php
|
RewriteRule ^admin/$ admin/index.php
|
||||||
RewriteRule ^install/$ install/index.php
|
RewriteRule ^install/$ install/index.php
|
||||||
|
|
112
CHANGELOG
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
[0.2.0 - 21.05.2017]
|
||||||
|
- added option to change character sex for premium points
|
||||||
|
- moved site_closed to database, now you can close your site through admin panel
|
||||||
|
- added option to admin panel: clear cache
|
||||||
|
- added experiencetable_rows configurable
|
||||||
|
- optimized OTS_Account->getGroupId(), now its using like 20 queries less
|
||||||
|
- optimized OTS_Player->load($id) function, should be much faster now
|
||||||
|
- fixed displaying on highscores special outfits
|
||||||
|
- fixed skull images displaying
|
||||||
|
- fixed displaying unlimited premium account
|
||||||
|
- fixed bug where players.lookaddons doesn't exist (OTHire etc.) (https://otland.net/threads/myaac-v0-0-1.251454/page-6#post-2442407)
|
||||||
|
- fixed signature tibian for OTHire and other servers that doesnt use accounts.premdays field
|
||||||
|
- fixed when player name in signature containst space
|
||||||
|
- don't show "Create forum thread" when editing
|
||||||
|
- fixed red color table after create account
|
||||||
|
- updated download links, as clients.halfaway.net isn't working anymore
|
||||||
|
- fixed some bugs while installing when field `email_next` or `hidden` already exist
|
||||||
|
- fixed movies unexpected comment
|
||||||
|
- added template_place_holder('center_top') to kathrine template
|
||||||
|
|
||||||
|
[0.1.5 - 13.05.2017]
|
||||||
|
- fixed bug with "Integrity constraint violation: 1048 Column 'ip' cannot be null"
|
||||||
|
|
||||||
|
[0.1.4 - 13.05.2017]
|
||||||
|
- added outfit shower, in characters, online, and highscores
|
||||||
|
- updated database to version 2
|
||||||
|
- fixed item images (now using item-images.ots.me host by default)
|
||||||
|
- fixed news ticket and posting long newses (https://otland.net/threads/myaac-v0-0-1.251454/page-5#post-2442026)
|
||||||
|
- news body limit increased to 65535 (mysql text field)
|
||||||
|
- removed some unused code from my old server
|
||||||
|
- added spells & monsters to kathrine template
|
||||||
|
|
||||||
|
[0.1.3 - 11.05.2017]
|
||||||
|
- this is just release to update version number
|
||||||
|
|
||||||
|
[0.1.2 - 11.05.2017]
|
||||||
|
- forgot to update CHANGELOG and MYAAC_VERSION
|
||||||
|
|
||||||
|
[0.1.1 - 11.05.2017]
|
||||||
|
- fixed updating myaac_config with database_version to 1
|
||||||
|
- fixed database updater
|
||||||
|
|
||||||
|
[0.1.0 - 11.05.2017]
|
||||||
|
- added new feature: change character name for premium points (disabled by default, you can enable it in config under account_change_character_name in config.php)
|
||||||
|
- added automatic database updater (data migrations)
|
||||||
|
- renamed events to hooks
|
||||||
|
- moved hooks to database
|
||||||
|
- now you can use hooks in plugins
|
||||||
|
- set account.type field to 5 on install, if TFS 1.0+
|
||||||
|
- added example plugin
|
||||||
|
- new, latest google analytics code
|
||||||
|
- fixed bug with loading account.name that has numbers in it
|
||||||
|
- fixed many bugs in player editor in admin panel
|
||||||
|
- added error handling to plugin manager and some more verification in
|
||||||
|
- file has been correctly unpacked/uploaded
|
||||||
|
- fixed Statistics page in admin panel when using account.number
|
||||||
|
- fixed bug when creating/recovering account on servers with
|
||||||
|
- account.salt field (TFS 0.3 for example)
|
||||||
|
- fixed forum showing thread with html tags (added from news manager)
|
||||||
|
- new, latest code for youtube videos in movies page
|
||||||
|
- fixed showing vocation images when using $config['online_vocations_images']
|
||||||
|
- many fixes in polls (also importing proper schema)
|
||||||
|
- fixed hovering on buttons in kathrine template (on accountmanagement page)
|
||||||
|
- fixed signatures (many fixes)
|
||||||
|
- added missing gesior signature system
|
||||||
|
|
||||||
|
[0.0.6 - 06.05.2017]
|
||||||
|
- fixed bug while installing (https://otland.net/threads/myaac-v0-0-1.251454/page-3#post-2440543)
|
||||||
|
- fixed bug when creating character (not showing errors) (one more time)
|
||||||
|
- fixed support for TFS 0.2 series
|
||||||
|
- added FAQ link
|
||||||
|
|
||||||
|
[0.0.5 - 05.05.2017]
|
||||||
|
- fixed bug when creating character (not showing errors)
|
||||||
|
- Fixed characters loading with names that has been created with other AAC
|
||||||
|
- fixed links to shop in default template
|
||||||
|
- fixed some weird PHP 7.1 warnings/notices
|
||||||
|
- Fixed config loading with some weird comments
|
||||||
|
- fixed bug with status info utf8 encoding (https://otland.net/threads/myaac-v0-0-1.251454/page-2#post-2440259)
|
||||||
|
- fixed when ip in log_action is NULL (https://otland.net/threads/myaac-v0-0-1.251454/page-2#post-2440357)
|
||||||
|
- fixed bug when guild doesn't exist on characters page (https://otland.net/threads/myaac-v0-0-1.251454/page-2#post-2440320)
|
||||||
|
- disabled friendly_urls by default
|
||||||
|
- fixes when $config['database_*'] is set
|
||||||
|
- added CHANGELOG
|
||||||
|
|
||||||
|
[0.0.3 - 03.05.2017]
|
||||||
|
- Full support for OTHire 0.0.3
|
||||||
|
- added support for otservers that doesn't use account.name field, instead just account number will be used
|
||||||
|
- fixed encryption detection on TFS 0.3
|
||||||
|
- fixed bug when server_config table doesn't exist
|
||||||
|
- (install) moved admin account creation to new step
|
||||||
|
- fixed news comment link
|
||||||
|
- by default, the installer creates now the Admin player, for admin account
|
||||||
|
- fixed installation errors
|
||||||
|
- fixed config.lua loading with some weird comments
|
||||||
|
|
||||||
|
[0.0.2 - 02.05.2017]
|
||||||
|
- updated forum links to use friendly_urls
|
||||||
|
- some more info will be shown when cannot connect to database
|
||||||
|
- show more error infos when creating character
|
||||||
|
- fixed forum link on newses
|
||||||
|
- fixed spells loading when there's vocation name instead of id
|
||||||
|
- fixed bug when you have changed template but it doesn't exist anymore
|
||||||
|
- fixed vocations with promotion loading
|
||||||
|
- fixed support for gesior pages and templates
|
||||||
|
- added function OTS_Acount:getGroupId()
|
||||||
|
|
||||||
|
[0.0.1 - 01.05.2017]
|
||||||
|
This is first official release of MyAAC.
|
||||||
|
Features are listed here
|
||||||
|
|
||||||
|
For more information, see the release announcement on OTLand: https://otland.net/threads/myaac-v0-0-1.251454/
|
41
README
@@ -1,41 +0,0 @@
|
|||||||
MyAAC 0.0.1 - http://www.my-aac.org
|
|
||||||
|
|
||||||
REQUIREMENTS
|
|
||||||
=====================================
|
|
||||||
- PHP 5.1.0 or later
|
|
||||||
- MySQL database
|
|
||||||
- (optional) mod_rewrite to use friendly_urls
|
|
||||||
|
|
||||||
INSTALLATION AND CONFIGURATION
|
|
||||||
=====================================
|
|
||||||
Just decompress and untar the source (which you should have done by now,
|
|
||||||
if you're reading this), into your webserver's document root.
|
|
||||||
|
|
||||||
MyAAC needs proper permissions to handle files correctly.
|
|
||||||
If you're using apache2, then your directory needs to have owner set to: www-data, you can do it by using following command:
|
|
||||||
chown -R www-data.www-data /var/www/*
|
|
||||||
(or any other path your MyAAC installation is located at..)
|
|
||||||
|
|
||||||
--------------------------
|
|
||||||
Note: Linux only
|
|
||||||
If you're under linux use these commands to set proper permissions:
|
|
||||||
chmod 660 config.local.php
|
|
||||||
chmod 660 images/guilds
|
|
||||||
chmod 660 images/houses
|
|
||||||
chmod 660 images/screenshots
|
|
||||||
--------------------------
|
|
||||||
|
|
||||||
Visit http://your_domain/install (http://localhost/install) and follow instructions in the browser.
|
|
||||||
|
|
||||||
KNOWN PROBLEMS
|
|
||||||
=====================================
|
|
||||||
- none -
|
|
||||||
|
|
||||||
OTHER NOTES
|
|
||||||
=====================================
|
|
||||||
If you have a great idea or want contribute to the project - visit our website at http://www.my-aac.org
|
|
||||||
|
|
||||||
LICENSING
|
|
||||||
=====================================
|
|
||||||
This program and all associated files are released under the GNU Public
|
|
||||||
License, see LICENSE for details.
|
|
@@ -7,6 +7,9 @@ Official website: http://my-aac.org
|
|||||||
|
|
||||||
- PHP 5.1.0 or later
|
- PHP 5.1.0 or later
|
||||||
- MySQL database
|
- MySQL database
|
||||||
|
- PDO PHP Extension
|
||||||
|
- XML PHP Extension
|
||||||
|
- ZIP PHP Extension
|
||||||
- (optional) mod_rewrite to use friendly_urls
|
- (optional) mod_rewrite to use friendly_urls
|
||||||
|
|
||||||
### INSTALLATION AND CONFIGURATION
|
### INSTALLATION AND CONFIGURATION
|
||||||
|
@@ -1 +1 @@
|
|||||||
<?php
|
<?php
|
@@ -40,6 +40,17 @@ h1, h2, h3, h4, h5, h6 {color: #313334; font-weight: bold;}
|
|||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.table, .table td, .table th{
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table th a:link {color: white; text-decoration: none;}
|
||||||
|
.table th a:link {color: white; text-decoration: none;}
|
||||||
|
.table th a:visited {color: white; text-decoration: none;}
|
||||||
|
.table th a:focus {color: white; text-decoration: none;}
|
||||||
|
.table th a:active {color: white; text-decoration: underline;}
|
||||||
|
.table th a:hover {color: white; text-decoration: underline;}
|
||||||
|
|
||||||
.table tr:nth-child(odd) {background-color: #d1d1d1}
|
.table tr:nth-child(odd) {background-color: #d1d1d1}
|
||||||
|
|
||||||
a.ico { color:#9d9c9a; font-size:10px; text-decoration: none; padding:0 0 0 14px; background-repeat:no-repeat; background-position:0 0; }
|
a.ico { color:#9d9c9a; font-size:10px; text-decoration: none; padding:0 0 0 14px; background-repeat:no-repeat; background-position:0 0; }
|
||||||
|
@@ -22,7 +22,7 @@
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
<div id="version">Version: <?php echo MYAAC_VERSION; ?> (<a id="update" href="?p=version">Check for updates</a>)<br/>
|
<div id="version">Version: <?php echo MYAAC_VERSION; ?> (<a id="update" href="?p=version">Check for updates</a>)<br/>
|
||||||
Logged in as: <b><?php echo $account_logged->getName(); ?></b><br/>
|
Logged in as: <b><?php echo (USE_ACCOUNT_NAME ? $account_logged->getName() : $account_logged->getId()); ?></b><br/>
|
||||||
<a href="<?php echo BASE_URL; ?>" target="_blank">Preview</a> <span class="separator">|</span> <a href="?action=logout">Log out<img src="<?php echo BASE_URL; ?>images/icons/logout.png" alt="" title="Log out" /></a>
|
<a href="<?php echo BASE_URL; ?>" target="_blank">Preview</a> <span class="separator">|</span> <a href="?action=logout">Log out<img src="<?php echo BASE_URL; ?>images/icons/logout.png" alt="" title="Log out" /></a>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
10
common.php
@@ -21,13 +21,14 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
define('MYAAC', true);
|
define('MYAAC', true);
|
||||||
define('MYAAC_VERSION', '0.0.1');
|
define('MYAAC_VERSION', '0.2.0');
|
||||||
|
define('DATABASE_VERSION', 3);
|
||||||
define('TABLE_PREFIX', 'myaac_');
|
define('TABLE_PREFIX', 'myaac_');
|
||||||
define('START_TIME', microtime(true));
|
define('START_TIME', microtime(true));
|
||||||
define('MYAAC_OS', (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? 'WINDOWS' : 'LINUX');
|
define('MYAAC_OS', (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? 'WINDOWS' : 'LINUX');
|
||||||
@@ -43,6 +44,11 @@ define('FLAG_CONTENT_COMMANDS', 64);
|
|||||||
define('FLAG_CONTENT_SPELLS', 128);
|
define('FLAG_CONTENT_SPELLS', 128);
|
||||||
define('FLAG_CONTENT_MONSTERS', 256);
|
define('FLAG_CONTENT_MONSTERS', 256);
|
||||||
|
|
||||||
|
// news
|
||||||
|
define('NEWS', 1);
|
||||||
|
define('TICKET', 2);
|
||||||
|
define('ARTICLE', 3);
|
||||||
|
|
||||||
// directories
|
// directories
|
||||||
define('BASE', dirname(__FILE__) . '/');
|
define('BASE', dirname(__FILE__) . '/');
|
||||||
define('ADMIN', BASE . 'admin/');
|
define('ADMIN', BASE . 'admin/');
|
||||||
|
38
config.php
@@ -13,7 +13,7 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ $config = array(
|
|||||||
// used for the Downloads page and some templates aswell
|
// used for the Downloads page and some templates aswell
|
||||||
'client' => 1098, // 954 = client 9.54
|
'client' => 1098, // 954 = client 9.54
|
||||||
|
|
||||||
'friendly_urls' => false, // mod_rewrite is required for this, it makes links looks more elegant to eye, and also are SEO friendly (example: http://my-aac.org/guilds/Testing instead of http://my-aac.org/?subtopic=guilds&name=Testing)
|
'friendly_urls' => false, // mod_rewrite is required for this, it makes links looks more elegant to eye, and also are SEO friendly (example: http://my-aac.org/guilds/Testing instead of http://my-aac.org/?subtopic=guilds&name=Testing). Remember to rename .htaccess.dist to .htaccess
|
||||||
'gzip_output' => false, // gzip page content before sending it to the browser, uses less bandwidth but more cpu cycles
|
'gzip_output' => false, // gzip page content before sending it to the browser, uses less bandwidth but more cpu cycles
|
||||||
|
|
||||||
// gesior backward support (templates & pages)
|
// gesior backward support (templates & pages)
|
||||||
@@ -43,12 +43,7 @@ $config = array(
|
|||||||
// footer
|
// footer
|
||||||
'footer' => ''/*'<br/>Your Server © 2016. All rights reserved.'*/,
|
'footer' => ''/*'<br/>Your Server © 2016. All rights reserved.'*/,
|
||||||
|
|
||||||
// site closed
|
'debug_level' => 0, // 0 - disabled, 1 - show load time, 2 - show db query counter, 3 - both, 4 - memory usage, 5 - load time & load time, 6 - queries & memory usage, 7 - all
|
||||||
'site_closed' => false,
|
|
||||||
'site_closed_title' => 'Closed',
|
|
||||||
'site_closed_message' => 'Server is under maintance, please visit later.<br/><br/>',
|
|
||||||
|
|
||||||
'debug_level' => 0, // 0 - disabled, 1 - show load time, 2 - show db query counter, 3 - both
|
|
||||||
|
|
||||||
'language' => 'en', // default language (currently only 'en' available)
|
'language' => 'en', // default language (currently only 'en' available)
|
||||||
'language_allow_change' => false,
|
'language_allow_change' => false,
|
||||||
@@ -59,7 +54,7 @@ $config = array(
|
|||||||
|
|
||||||
// cache system. by default file cache is used
|
// cache system. by default file cache is used
|
||||||
'cache_engine' => 'auto', // apc, eaccelerator, xcache, file, auto, or blank to disable.
|
'cache_engine' => 'auto', // apc, eaccelerator, xcache, file, auto, or blank to disable.
|
||||||
'cache_prefix' => 'myaac_', // have to be unique if running more MyAAC instances on the same server, ignored when using file cache.
|
'cache_prefix' => 'myaac_', // have to be unique if running more MyAAC instances on the same server
|
||||||
|
|
||||||
// database details (leave blank for auto detect from config.lua)
|
// database details (leave blank for auto detect from config.lua)
|
||||||
'database_host' => '',
|
'database_host' => '',
|
||||||
@@ -75,6 +70,10 @@ $config = array(
|
|||||||
//'2' => 'Your Second World Name'
|
//'2' => 'Your Second World Name'
|
||||||
),
|
),
|
||||||
|
|
||||||
|
// items
|
||||||
|
'outfit_images_url' => 'http://outfit-images.ots.me/outfit.php', // set to animoutfit.php for animated outfit
|
||||||
|
'item_images_url' => 'http://item-images.ots.me/960/', // set to images/items if you host your own items in images folder
|
||||||
|
|
||||||
// account
|
// account
|
||||||
'account_management' => true, // disable if you're using other method to manage users (fe. tfs account manager)
|
'account_management' => true, // disable if you're using other method to manage users (fe. tfs account manager)
|
||||||
'account_mail_verify' => false, // force users to confirm their email addresses when registering account
|
'account_mail_verify' => false, // force users to confirm their email addresses when registering account
|
||||||
@@ -84,14 +83,19 @@ $config = array(
|
|||||||
'account_welcome_mail' => true, // send welcome email when user registers
|
'account_welcome_mail' => true, // send welcome email when user registers
|
||||||
'account_mail_change' => 2, // how many days user need to change email to account - block hackers
|
'account_mail_change' => 2, // how many days user need to change email to account - block hackers
|
||||||
'account_country' => true, // user will be able to set country of origin when registering account, this information will be viewable in others places aswell
|
'account_country' => true, // user will be able to set country of origin when registering account, this information will be viewable in others places aswell
|
||||||
|
'account_change_character_name' => false, // can user change their character name for premium points?
|
||||||
|
'account_change_character_name_points' => 30, // cost of name change
|
||||||
|
'account_change_character_sex' => false, // can user change their character sex for premium points?
|
||||||
|
'account_change_character_sex_points' => 30, // cost of sex change
|
||||||
|
'characters_per_account' => 10, // max. number of characters per account
|
||||||
|
|
||||||
// mail
|
// mail
|
||||||
'mail_enabled' => false, // is aac maker configured to send e-mails?
|
'mail_enabled' => false, // is aac maker configured to send e-mails?
|
||||||
'mail_address' => 'no-reply@your-server.org', // server e-mail address (from:)
|
'mail_address' => 'no-reply@your-server.org', // server e-mail address (from:)
|
||||||
'mail_admin' => 'your-address@your-server.org', // admin email address, where mails from contact form will be sent
|
'mail_admin' => 'your-address@your-server.org', // admin email address, where mails from contact form will be sent
|
||||||
'mail_signature' => array( // signature that will be included at the end of every message sent using _mail function
|
'mail_signature' => array( // signature that will be included at the end of every message sent using _mail function
|
||||||
'plain' => "--\nMy Server,\nhttp://www.myserver.com",
|
'plain' => ''/*'--\nMy Server,\nhttp://www.myserver.com'*/,
|
||||||
'html' => '<br/>My Server,\n<a href="http://www.myserver.com">myserver.com</a>'
|
'html' => ''/*'<br/>My Server,\n<a href="http://www.myserver.com">myserver.com</a>'*/
|
||||||
),
|
),
|
||||||
'smtp_enabled' => false, // send by smtp or mail function (set false if use mail function)
|
'smtp_enabled' => false, // send by smtp or mail function (set false if use mail function)
|
||||||
'smtp_host' => '', // mail host
|
'smtp_host' => '', // mail host
|
||||||
@@ -131,8 +135,6 @@ $config = array(
|
|||||||
1 => 'Sample town'
|
1 => 'Sample town'
|
||||||
),
|
),
|
||||||
|
|
||||||
'characters_per_account' => 10, // max. number of characters per account
|
|
||||||
|
|
||||||
// guilds
|
// guilds
|
||||||
'guild_management' => true, // enable guild management system on the site?
|
'guild_management' => true, // enable guild management system on the site?
|
||||||
'guild_need_level' => 1, // min. level to form a guild
|
'guild_need_level' => 1, // min. level to form a guild
|
||||||
@@ -153,6 +155,7 @@ $config = array(
|
|||||||
'online_vocations' => false, // display vocation statistics?
|
'online_vocations' => false, // display vocation statistics?
|
||||||
'online_vocations_images' => false, // display vocation images?
|
'online_vocations_images' => false, // display vocation images?
|
||||||
'online_skulls' => false, // display skull images
|
'online_skulls' => false, // display skull images
|
||||||
|
'online_outfit' => true,
|
||||||
'online_afk' => false,
|
'online_afk' => false,
|
||||||
|
|
||||||
// support list page
|
// support list page
|
||||||
@@ -169,6 +172,7 @@ $config = array(
|
|||||||
'highscores_vocation_box' => true, // show 'Choose a vocation' box on the highscores (allowing peoples to sort highscores by vocation)?
|
'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_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)? Only 0.3
|
||||||
|
'highscores_outfit' => true, // show player outfit?
|
||||||
'highscores_country_box' => false, // doesnt work yet! (not implemented)
|
'highscores_country_box' => false, // doesnt work yet! (not implemented)
|
||||||
'highscores_groups_hidden' => 4, // this group id and higher won't be shown on the highscores
|
'highscores_groups_hidden' => 4, // this group id and higher won't be shown on the highscores
|
||||||
|
|
||||||
@@ -179,6 +183,7 @@ $config = array(
|
|||||||
'magic_level' => false,
|
'magic_level' => false,
|
||||||
'balance' => false,
|
'balance' => false,
|
||||||
'marriage_info' => true, // only 0.3
|
'marriage_info' => true, // only 0.3
|
||||||
|
'outfit' => true,
|
||||||
'creation_date' => true,
|
'creation_date' => true,
|
||||||
'quests' => true,
|
'quests' => true,
|
||||||
'skills' => true,
|
'skills' => true,
|
||||||
@@ -212,14 +217,15 @@ $config = array(
|
|||||||
// other
|
// other
|
||||||
'email_lai_sec_interval' => 60, // time in seconds between e-mails to one account from lost account interface, block spam
|
'email_lai_sec_interval' => 60, // time in seconds between e-mails to one account from lost account interface, block spam
|
||||||
'google_analytics_id' => '', // e.g.: UA-XXXXXXX-X
|
'google_analytics_id' => '', // e.g.: UA-XXXXXXX-X
|
||||||
'experiencetable_columns' => 5, // how many columns to display in experience table page. * 100, 5 = 500 (will show up to 500 level)
|
'experiencetable_columns' => 5, // how many columns to display in experience table page. * experiencetable_rows, 5 = 500 (will show up to 500 level)
|
||||||
|
'experiencetable_rows' => 100, // till how many levels in one column
|
||||||
|
|
||||||
'monsters' => array(),
|
'monsters' => array(),
|
||||||
'npc' => array()
|
'npc' => array()
|
||||||
);
|
);
|
||||||
|
|
||||||
// download link to client.
|
// download link to client.
|
||||||
$config['client_download'] = 'http://clients.halfaway.net/windows.php?tibia='. $config['client'] .'';
|
$config['client_download'] = 'http://tibia-clients.com/clients/download/'. $config['client'] .'/exe/windows';
|
||||||
$config['client_download_linux'] = 'http://clients.halfaway.net/linux.php?tibia='. $config['client'] .'';
|
$config['client_download_linux'] = 'http://tibia-clients.com/clients/download/'. $config['client'] .'/tar/linux';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
Before Width: | Height: | Size: 569 B After Width: | Height: | Size: 569 B |
BIN
images/buttons/_sbutton_change_name.gif
Normal file
After Width: | Height: | Size: 545 B |
BIN
images/buttons/_sbutton_change_sex.gif
Normal file
After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 906 B After Width: | Height: | Size: 906 B |
Before Width: | Height: | Size: 904 B After Width: | Height: | Size: 904 B |
36
install/includes/config.php
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
|
||||||
|
$config['server_path'] = $_SESSION['var_server_path'];
|
||||||
|
// take care of trailing slash at the end
|
||||||
|
if($config['server_path'][strlen($config['server_path']) - 1] != '/')
|
||||||
|
$config['server_path'] .= '/';
|
||||||
|
|
||||||
|
if(!file_exists($config['server_path'] . 'config.lua')) {
|
||||||
|
error($locale['step_database_error_config']);
|
||||||
|
$error = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($error) || !$error) {
|
||||||
|
$config['lua'] = load_config_lua($config['server_path'] . 'config.lua');
|
||||||
|
if(isset($config['lua']['sqlType'])) // tfs 0.3
|
||||||
|
$config['database_type'] = $config['lua']['sqlType'];
|
||||||
|
else if(isset($config['lua']['mysqlHost'])) // tfs 0.2/1.0
|
||||||
|
$config['database_type'] = 'mysql';
|
||||||
|
else if(isset($config['lua']['database_type'])) // otserv
|
||||||
|
$config['database_type'] = $config['lua']['database_type'];
|
||||||
|
else if(isset($config['lua']['sql_type'])) // otserv
|
||||||
|
$config['database_type'] = $config['lua']['sql_type'];
|
||||||
|
|
||||||
|
$config['database_type'] = strtolower($config['database_type']);
|
||||||
|
if(empty($config['database_type'])) {
|
||||||
|
error($locale['step_database_error_database_empty']);
|
||||||
|
$error = true;
|
||||||
|
}
|
||||||
|
else if($config['database_type'] != 'mysql') {
|
||||||
|
$locale['step_database_error_only_mysql'] = str_replace('$DATABASE_TYPE$', '<b>' . $config['database_type'] . '</b>', $locale['step_database_error_only_mysql']);
|
||||||
|
error($locale['step_database_error_only_mysql']);
|
||||||
|
$error = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
@@ -1,5 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
|
||||||
require(SYSTEM . 'libs/pot/OTS.php');
|
require(SYSTEM . 'libs/pot/OTS.php');
|
||||||
$ots = POT::getInstance();
|
$ots = POT::getInstance();
|
||||||
require(SYSTEM . 'database.php');
|
require(SYSTEM . 'database.php');
|
||||||
|
|
||||||
|
if(tableExist('accounts'))
|
||||||
|
define('USE_ACCOUNT_NAME', fieldExist('name', 'accounts'));
|
||||||
|
else
|
||||||
|
define('USE_ACCOUNT_NAME', false);
|
||||||
?>
|
?>
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
function query($query)
|
function query($query)
|
||||||
{
|
{
|
||||||
global $db, $error;
|
global $db, $error;
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
if(isset($_POST['lang']))
|
if(isset($_POST['lang']))
|
||||||
{
|
{
|
||||||
setcookie('locale', $_POST['lang']);
|
setcookie('locale', $_POST['lang']);
|
||||||
@@ -17,7 +18,7 @@ else
|
|||||||
// detect locale
|
// detect locale
|
||||||
$locale_s = get_browser_languages();
|
$locale_s = get_browser_languages();
|
||||||
if(!sizeof($locale_s))
|
if(!sizeof($locale_s))
|
||||||
$locale__ = 'en';
|
$locale_ = 'en';
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach($locale_s as $id => $tmp)
|
foreach($locale_s as $id => $tmp)
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
CREATE TABLE `myaac_account_actions`
|
CREATE TABLE `myaac_account_actions`
|
||||||
(
|
(
|
||||||
`account_id` INT(11) NOT NULL,
|
`account_id` INT(11) NOT NULL,
|
||||||
`ip` INT(11) NOT NULL,
|
`ip` INT(11) NOT NULL DEFAULT 0,
|
||||||
`date` INT(11) NOT NULL,
|
`date` INT(11) NOT NULL DEFAULT 0,
|
||||||
`action` VARCHAR(255) NOT NULL,
|
`action` VARCHAR(255) NOT NULL DEFAULT '',
|
||||||
KEY (`account_id`)
|
KEY (`account_id`)
|
||||||
) ENGINE = MyISAM;
|
) ENGINE = MyISAM;
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ CREATE TABLE `myaac_faq`
|
|||||||
(
|
(
|
||||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||||
`question` VARCHAR(255) NOT NULL DEFAULT '',
|
`question` VARCHAR(255) NOT NULL DEFAULT '',
|
||||||
`answer` VARCHAR(1020) NOT NULL,
|
`answer` VARCHAR(1020) NOT NULL DEFAULT '',
|
||||||
`ordering` INT(11) NOT NULL DEFAULT 0,
|
`ordering` INT(11) NOT NULL DEFAULT 0,
|
||||||
`hidden` TINYINT(1) NOT NULL DEFAULT 0,
|
`hidden` TINYINT(1) NOT NULL DEFAULT 0,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
@@ -105,6 +105,15 @@ CREATE TABLE `myaac_forum`
|
|||||||
KEY `section` (`section`)
|
KEY `section` (`section`)
|
||||||
) ENGINE = MyISAM;
|
) ENGINE = MyISAM;
|
||||||
|
|
||||||
|
CREATE TABLE `myaac_hooks`
|
||||||
|
(
|
||||||
|
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` VARCHAR(30) NOT NULL DEFAULT '',
|
||||||
|
`type` INT(2) NOT NULL DEFAULT 0,
|
||||||
|
`file` VARCHAR(100) NOT NULL,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE = MyISAM;
|
||||||
|
|
||||||
CREATE TABLE `myaac_monsters` (
|
CREATE TABLE `myaac_monsters` (
|
||||||
`hide_creature` tinyint(1) NOT NULL default '0',
|
`hide_creature` tinyint(1) NOT NULL default '0',
|
||||||
`name` varchar(255) NOT NULL,
|
`name` varchar(255) NOT NULL,
|
||||||
@@ -125,7 +134,7 @@ CREATE TABLE `myaac_monsters` (
|
|||||||
CREATE TABLE `myaac_movies`
|
CREATE TABLE `myaac_movies`
|
||||||
(
|
(
|
||||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||||
`title` VARCHAR(50) NOT NULL DEFAULT '',
|
`title` VARCHAR(100) NOT NULL DEFAULT '',
|
||||||
`youtube_id` VARCHAR(20) NOT NULL,
|
`youtube_id` VARCHAR(20) NOT NULL,
|
||||||
`author` VARCHAR(50) NOT NULL DEFAULT '',
|
`author` VARCHAR(50) NOT NULL DEFAULT '',
|
||||||
`ordering` INT(11) NOT NULL DEFAULT 0,
|
`ordering` INT(11) NOT NULL DEFAULT 0,
|
||||||
@@ -136,8 +145,8 @@ CREATE TABLE `myaac_movies`
|
|||||||
CREATE TABLE `myaac_news`
|
CREATE TABLE `myaac_news`
|
||||||
(
|
(
|
||||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||||
`title` VARCHAR(50) NOT NULL,
|
`title` VARCHAR(100) NOT NULL,
|
||||||
`body` VARCHAR(10000) NOT NULL,
|
`body` TEXT NOT NULL,
|
||||||
`type` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '1 - news, 2 - ticket, 3 - article',
|
`type` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '1 - news, 2 - ticket, 3 - article',
|
||||||
`date` INT(11) NOT NULL DEFAULT 0,
|
`date` INT(11) NOT NULL DEFAULT 0,
|
||||||
`category` TINYINT(1) NOT NULL DEFAULT 0,
|
`category` TINYINT(1) NOT NULL DEFAULT 0,
|
||||||
|
@@ -16,7 +16,7 @@ if(isset($_POST['vars']))
|
|||||||
$_SESSION['var_' . $key] = $value;
|
$_SESSION['var_' . $key] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
$steps = array(1 => 'welcome', 2 => 'license', 3 => 'requirements', 4 => 'config', 5 => 'database', 6 => 'finish');
|
$steps = array(1 => 'welcome', 2 => 'license', 3 => 'requirements', 4 => 'config', 5 => 'database', 6 => 'admin', 7 => 'finish');
|
||||||
if(!in_array($step, $steps)) // check if step is valid
|
if(!in_array($step, $steps)) // check if step is valid
|
||||||
die('ERROR: Unknown step.');
|
die('ERROR: Unknown step.');
|
||||||
|
|
||||||
@@ -33,6 +33,8 @@ if($step == 'database')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$error = false;
|
||||||
|
|
||||||
// step include
|
// step include
|
||||||
ob_start();
|
ob_start();
|
||||||
require('steps/' . $step . '.php');
|
require('steps/' . $step . '.php');
|
||||||
|
32
install/steps/admin.php
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
|
||||||
|
?>
|
||||||
|
<form action="<?php echo BASE_URL; ?>install/" method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="step" id="step" value="finish" />
|
||||||
|
<table>
|
||||||
|
<?php
|
||||||
|
require(BASE . 'install/includes/config.php');
|
||||||
|
if(!$error) {
|
||||||
|
require(BASE . 'install/includes/database.php');
|
||||||
|
|
||||||
|
foreach(array(USE_ACCOUNT_NAME ? 'account' : 'account_id', 'password') as $value)
|
||||||
|
echo '
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="vars_' . $value . '">
|
||||||
|
<span>' . $locale['step_admin_' . $value] . '</span>
|
||||||
|
</label>
|
||||||
|
<br>
|
||||||
|
<input type="text" name="vars[' . $value . ']" id="vars_' . $value . '"' . (isset($_SESSION['var_' . $value]) ? ' value="' . $_SESSION['var_' . $value] . '"' : '') . '/>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<em>' . $locale['step_admin_' . $value . '_desc'] . '</em>
|
||||||
|
</td>
|
||||||
|
</tr>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
<?php echo next_buttons(true, $error ? false : true);
|
||||||
|
?>
|
||||||
|
</form>
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
|
||||||
$clients = array(
|
$clients = array(
|
||||||
710,
|
710,
|
||||||
740,
|
740,
|
||||||
@@ -68,7 +70,7 @@ $clients = array(
|
|||||||
<input type="hidden" name="step" id="step" value="database" />
|
<input type="hidden" name="step" id="step" value="database" />
|
||||||
<table>
|
<table>
|
||||||
<?php
|
<?php
|
||||||
foreach(array('server_path', 'account', 'password', 'mail_admin', 'mail_address') as $value)
|
foreach(array('server_path', 'mail_admin', 'mail_address') as $value)
|
||||||
echo '
|
echo '
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
//ini_set('display_errors', false);
|
//ini_set('display_errors', false);
|
||||||
|
ini_set('max_execution_time', 300);
|
||||||
$error = false;
|
$error = false;
|
||||||
|
|
||||||
if(!isset($_SESSION['var_server_path'])) {
|
if(!isset($_SESSION['var_server_path'])) {
|
||||||
@@ -20,41 +22,16 @@ if(!$error) {
|
|||||||
$value .= "/";
|
$value .= "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
if($key != 'var_account' && $key != 'var_password') {
|
if($key != 'var_account' && $key != 'var_account_id' && $key != 'var_password') {
|
||||||
$content .= '$config[\'' . str_replace('var_', '', $key) . '\'] = \'' . $value . '\';';
|
$content .= '$config[\'' . str_replace('var_', '', $key) . '\'] = \'' . $value . '\';';
|
||||||
$content .= PHP_EOL;
|
$content .= PHP_EOL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$config['server_path'] = $_SESSION['var_server_path'];
|
require(BASE . 'install/includes/config.php');
|
||||||
// take care of trailing slash at the end
|
|
||||||
if($config['server_path'][strlen($config['server_path']) - 1] != '/')
|
|
||||||
$config['server_path'] .= '/';
|
|
||||||
|
|
||||||
if(!file_exists($config['server_path'] . 'config.lua')) {
|
|
||||||
error($locale['step_database_error_config']);
|
|
||||||
$error = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!$error) {
|
if(!$error) {
|
||||||
$config['lua'] = load_config_lua($config['server_path'] . 'config.lua');
|
|
||||||
if(isset($config['lua']['sqlType'])) // tfs 0.3
|
|
||||||
$config['database_type'] = $config['lua']['sqlType'];
|
|
||||||
else if(isset($config['lua']['mysqlHost'])) // tfs 0.2/1.0
|
|
||||||
$config['database_type'] = 'mysql';
|
|
||||||
else if(isset($config['lua']['database_type'])) // otserv
|
|
||||||
$config['database_type'] = $config['lua']['database_type'];
|
|
||||||
else if(isset($config['lua']['sql_type'])) // otserv
|
|
||||||
$config['database_type'] = $config['lua']['sql_type'];
|
|
||||||
|
|
||||||
$config['database_type'] = strtolower($config['database_type']);
|
|
||||||
if($config['database_type'] != 'mysql') {
|
|
||||||
$locale['step_database_error_only_mysql'] = str_replace('$DATABASE_TYPE$', '<b>' . $config['database_type'] . '</b>', $locale['step_database_error_only_mysql']);
|
|
||||||
error($locale['step_database_error_only_mysql']);
|
|
||||||
$error = true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
success($locale['step_database_importing']);
|
success($locale['step_database_importing']);
|
||||||
require(BASE . 'install/includes/database.php');
|
require(BASE . 'install/includes/database.php');
|
||||||
|
|
||||||
@@ -63,6 +40,16 @@ if(!$error) {
|
|||||||
error($locale['step_database_error_table']);
|
error($locale['step_database_error_table']);
|
||||||
$error = true;
|
$error = true;
|
||||||
}
|
}
|
||||||
|
else if(!tableExist('players')) {
|
||||||
|
$locale['step_database_error_table'] = str_replace('$TABLE$', 'players', $locale['step_database_error_table']);
|
||||||
|
error($locale['step_database_error_table']);
|
||||||
|
$error = true;
|
||||||
|
}
|
||||||
|
else if(!tableExist('guilds')) {
|
||||||
|
$locale['step_database_error_table'] = str_replace('$TABLE$', 'guilds', $locale['step_database_error_table']);
|
||||||
|
error($locale['step_database_error_table']);
|
||||||
|
$error = true;
|
||||||
|
}
|
||||||
|
|
||||||
if(tableExist(TABLE_PREFIX . 'account_actions')) {
|
if(tableExist(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']);
|
||||||
@@ -79,11 +66,13 @@ if(!$error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!$error) {
|
if(!$error) {
|
||||||
|
registerDatabaseConfig('database_version', DATABASE_VERSION);
|
||||||
$locale['step_database_success_schema'] = str_replace('$PREFIX$', TABLE_PREFIX, $locale['step_database_success_schema']);
|
$locale['step_database_success_schema'] = str_replace('$PREFIX$', TABLE_PREFIX, $locale['step_database_success_schema']);
|
||||||
success($locale['step_database_success_schema']);
|
success($locale['step_database_success_schema']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!$error) {
|
||||||
if(fieldExist('key', 'accounts')) {
|
if(fieldExist('key', 'accounts')) {
|
||||||
if(query("ALTER TABLE `accounts` MODIFY `key` VARCHAR(64) NOT NULL DEFAULT '';"))
|
if(query("ALTER TABLE `accounts` MODIFY `key` VARCHAR(64) NOT NULL DEFAULT '';"))
|
||||||
success($locale['step_database_modifying_field'] . ' accounts.key...');
|
success($locale['step_database_modifying_field'] . ' accounts.key...');
|
||||||
@@ -127,12 +116,12 @@ if(!$error) {
|
|||||||
}
|
}
|
||||||
else if(!fieldExist('web_lastlogin', 'accounts')) {
|
else if(!fieldExist('web_lastlogin', 'accounts')) {
|
||||||
if(query("ALTER TABLE `accounts` ADD `web_lastlogin` INT(11) NOT NULL DEFAULT 0 AFTER `country`;"))
|
if(query("ALTER TABLE `accounts` ADD `web_lastlogin` INT(11) NOT NULL DEFAULT 0 AFTER `country`;"))
|
||||||
success($locale['step_database_adding_field'] . ' accounts.created...');
|
success($locale['step_database_adding_field'] . ' accounts.web_lastlogin...');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!fieldExist('web_flags', 'accounts')) {
|
if(!fieldExist('web_flags', 'accounts')) {
|
||||||
if(query("ALTER TABLE `accounts` ADD `web_flags` INT(11) NOT NULL DEFAULT 0 AFTER `web_lastlogin`;"))
|
if(query("ALTER TABLE `accounts` ADD `web_flags` INT(11) NOT NULL DEFAULT 0 AFTER `web_lastlogin`;"))
|
||||||
success($locale['step_database_adding_field'] . ' accounts.country...');
|
success($locale['step_database_adding_field'] . ' accounts.web_flags...');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!fieldExist('email_hash', 'accounts')) {
|
if(!fieldExist('email_hash', 'accounts')) {
|
||||||
@@ -161,12 +150,14 @@ if(!$error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(fieldExist('next_email', 'accounts')) {
|
if(fieldExist('next_email', 'accounts')) {
|
||||||
|
if(!fieldExist('email_next', 'accounts')) {
|
||||||
if(query("ALTER TABLE `accounts` CHANGE `next_email` `email_next` INT(11) NOT NULL DEFAULT 0;")) {
|
if(query("ALTER TABLE `accounts` CHANGE `next_email` `email_next` INT(11) NOT NULL DEFAULT 0;")) {
|
||||||
$tmp = str_replace('$FIELD$', 'accounts.next_email', $locale['step_database_changing_field']);
|
$tmp = str_replace('$FIELD$', 'accounts.next_email', $locale['step_database_changing_field']);
|
||||||
$tmp = str_replace('$FIELD_NEW$', 'accounts.email_next', $tmp);
|
$tmp = str_replace('$FIELD_NEW$', 'accounts.email_next', $tmp);
|
||||||
success($tmp);
|
success($tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if(!fieldExist('email_next', 'accounts')) {
|
else if(!fieldExist('email_next', 'accounts')) {
|
||||||
if(query("ALTER TABLE `accounts` ADD `email_next` INT(11) NOT NULL DEFAULT 0 AFTER `email_code`;"))
|
if(query("ALTER TABLE `accounts` ADD `email_next` INT(11) NOT NULL DEFAULT 0 AFTER `email_code`;"))
|
||||||
success($locale['step_database_adding_field'] . ' accounts.email_next...');
|
success($locale['step_database_adding_field'] . ' accounts.email_next...');
|
||||||
@@ -199,15 +190,22 @@ if(!$error) {
|
|||||||
success($locale['step_database_adding_field'] . ' players.created...');
|
success($locale['step_database_adding_field'] . ' players.created...');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!fieldExist('deleted', 'players') && !fieldExist('deletion', 'players')) {
|
||||||
|
if(query("ALTER TABLE `players` ADD `deleted` TINYINT(1) NOT NULL DEFAULT 0;"))
|
||||||
|
success($locale['step_database_adding_field'] . ' players.comment...');
|
||||||
|
}
|
||||||
|
|
||||||
if(fieldExist('hide_char', 'players')) {
|
if(fieldExist('hide_char', 'players')) {
|
||||||
|
if(!fieldExist('hidden', 'players')) {
|
||||||
if(query("ALTER TABLE `players` CHANGE `hide_char` `hidden` TINYINT(1) NOT NULL DEFAULT 0;")) {
|
if(query("ALTER TABLE `players` CHANGE `hide_char` `hidden` TINYINT(1) NOT NULL DEFAULT 0;")) {
|
||||||
$tmp = str_replace('$FIELD$', 'players.hide_char', $locale['step_database_changing_field']);
|
$tmp = str_replace('$FIELD$', 'players.hide_char', $locale['step_database_changing_field']);
|
||||||
$tmp = str_replace('$FIELD_NEW$', 'players.hidden', $tmp);
|
$tmp = str_replace('$FIELD_NEW$', 'players.hidden', $tmp);
|
||||||
success($tmp);
|
success($tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if(!fieldExist('hidden', 'players')) {
|
else if(!fieldExist('hidden', 'players')) {
|
||||||
if(query("ALTER TABLE `players` ADD `hidden` VARCHAR( 255 ) TINYINT(1) NOT NULL DEFAULT 0;"))
|
if(query("ALTER TABLE `players` ADD `hidden` TINYINT(1) NOT NULL DEFAULT 0;"))
|
||||||
success($locale['step_database_adding_field'] . ' players.hidden...');
|
success($locale['step_database_adding_field'] . ' players.hidden...');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,90 +213,15 @@ if(!$error) {
|
|||||||
if(query("ALTER TABLE `players` ADD `comment` TEXT NOT NULL DEFAULT '';"))
|
if(query("ALTER TABLE `players` ADD `comment` TEXT NOT NULL DEFAULT '';"))
|
||||||
success($locale['step_database_adding_field'] . ' players.comment...');
|
success($locale['step_database_adding_field'] . ' players.comment...');
|
||||||
}
|
}
|
||||||
|
|
||||||
$account = $_SESSION['var_account'];
|
|
||||||
$password = $_SESSION['var_password'];
|
|
||||||
|
|
||||||
$config_salt_enabled = fieldExist('salt', 'accounts');
|
|
||||||
if($config_salt_enabled)
|
|
||||||
{
|
|
||||||
$salt = generateRandomString(10, false, true, true);
|
|
||||||
$password = $salt . $password;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$account_db = new OTS_Account();
|
if(!$error && (!isset($_SESSION['saved']))) {
|
||||||
$account_db->load(1);
|
|
||||||
if($account_db->isLoaded()) {
|
|
||||||
$account_db->setName('dummy_account');
|
|
||||||
$account_db->setPassword('for sample characters. ' . generateRandomString(10));
|
|
||||||
$account_db->save();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$new_account = $ots->createObject('Account');
|
|
||||||
$new_account->create('dummy_account', 1);
|
|
||||||
$account_db->setPassword('for sample characters. ' . generateRandomString(10));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$account_db = new OTS_Account();
|
|
||||||
$account_db->find($account);
|
|
||||||
if($account_db->isLoaded()) {
|
|
||||||
if($config_salt_enabled)
|
|
||||||
$account_db->setSalt($salt);
|
|
||||||
|
|
||||||
$account_db->setPassword(encrypt($password));
|
|
||||||
$account_db->setEMail($_SESSION['var_mail_admin']);
|
|
||||||
$account_db->save();
|
|
||||||
$account_db->setCustomField('web_flags', 3);
|
|
||||||
$account_db->setCustomField('country', 'us');
|
|
||||||
|
|
||||||
$_SESSION['account'] = $account_db->getId();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$new_account = $ots->createObject('Account');
|
|
||||||
$new_account->create($account);
|
|
||||||
|
|
||||||
if($config_salt_enabled)
|
|
||||||
$new_account->setSalt($salt);
|
|
||||||
|
|
||||||
$new_account->setPassword(encrypt($password));
|
|
||||||
$new_account->setEMail($_SESSION['var_mail_admin']);
|
|
||||||
$new_account->unblock();
|
|
||||||
$new_account->save();
|
|
||||||
$new_account->setCustomField('created', time());
|
|
||||||
$new_account->setCustomField('web_flags', 3);
|
|
||||||
$new_account->setCustomField('country', 'us');
|
|
||||||
$new_account->logAction('Account created.');
|
|
||||||
|
|
||||||
$_SESSION['account'] = $new_account->getId();
|
|
||||||
}
|
|
||||||
|
|
||||||
success($locale['step_database_created_account']);
|
|
||||||
$_SESSION['password'] = encrypt($password);
|
|
||||||
$_SESSION['remember_me'] = true;
|
|
||||||
|
|
||||||
$deleted = 'deleted';
|
|
||||||
if(fieldExist('deletion', 'players'))
|
|
||||||
$deleted = 'deletion';
|
|
||||||
|
|
||||||
$query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote('Rook Sample') . ' OR `name` = ' . $db->quote('Sorcerer Sample') . ' OR `name` = ' . $db->quote('Druid Sample') . ' OR `name` = ' . $db->quote('Paladin Sample') . ' OR `name` = ' . $db->quote('Knight Sample'));
|
|
||||||
if($query->rowCount() == 0) {
|
|
||||||
if(query("INSERT INTO `players` (`id`, `name`, `group_id`, `account_id`, `level`, `vocation`, `health`, `healthmax`, `experience`, `lookbody`, `lookfeet`, `lookhead`, `looklegs`, `looktype`, `lookaddons`, `maglevel`, `mana`, `manamax`, `manaspent`, `soul`, `town_id`, `posx`, `posy`, `posz`, `conditions`, `cap`, `sex`, `lastlogin`, `lastip`, `save`, `skull`, `skulltime`, `lastlogout`, `blessings`, `balance`, `stamina`, `$deleted`, `created`, `hidden`, `comment`) VALUES
|
|
||||||
(null, 'Rook Sample', 1, 1, 8, 0, 185, 185, 4200, 118, 114, 38, 57, 130, 0, 0, 35, 35, 0, 100, 11, 2200, 1298, 7, '', 470, 1, 1255179613, 2453925456, 1, 0, 0, 1255179614, 0, 0, 151200000, 1, UNIX_TIMESTAMP(), 1, ''),
|
|
||||||
(null, 'Sorcerer Sample', 1, 1, 8, 1, 185, 185, 4200, 118, 114, 38, 57, 130, 0, 0, 35, 35, 0, 100, 11, 2200, 1298, 7, '', 470, 1, 1255179571, 2453925456, 1, 0, 0, 1255179612, 0, 0, 151200000, 1, UNIX_TIMESTAMP(), 1, ''),
|
|
||||||
(null, 'Druid Sample', 1, 1, 8, 2, 185, 185, 4200, 118, 114, 38, 57, 130, 0, 0, 35, 35, 0, 100, 11, 2200, 1298, 7, '', 470, 1, 1255179655, 2453925456, 1, 0, 0, 1255179658, 0, 0, 151200000, 1, UNIX_TIMESTAMP(), 1, ''),
|
|
||||||
(null, 'Paladin Sample', 1, 1, 8, 3, 185, 185, 4200, 118, 114, 38, 57, 129, 0, 0, 35, 35, 0, 100, 11, 2200, 1298, 7, '', 470, 1, 1255179854, 2453925456, 1, 0, 0, 1255179858, 0, 0, 151200000, 1, UNIX_TIMESTAMP(), 1, ''),
|
|
||||||
(null, 'Knight Sample', 1, 1, 8, 4, 185, 185, 4200, 118, 114, 38, 57, 131, 0, 0, 35, 35, 0, 100, 11, 2200, 1298, 7, '', 470, 1, 1255179620, 2453925456, 1, 0, 0, 1255179654, 0, 0, 151200000, 1, UNIX_TIMESTAMP(), 1, '');"))
|
|
||||||
success($locale['step_database_imported_players']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!$error && !isset($_SESSION['saved'])) {
|
|
||||||
$content .= '$config[\'installed\'] = true;';
|
$content .= '$config[\'installed\'] = true;';
|
||||||
$content .= PHP_EOL;
|
$content .= PHP_EOL;
|
||||||
if(strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false) {
|
// if(strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false) {
|
||||||
$content .= '$config[\'friendly_urls\'] = true;';
|
// $content .= '$config[\'friendly_urls\'] = true;';
|
||||||
$content .= PHP_EOL;
|
// $content .= PHP_EOL;
|
||||||
}
|
// }
|
||||||
|
|
||||||
$content .= '$config[\'mail_enabled\'] = true;';
|
$content .= '$config[\'mail_enabled\'] = true;';
|
||||||
$content .= PHP_EOL;
|
$content .= PHP_EOL;
|
||||||
@@ -315,7 +238,8 @@ if(!$error) {
|
|||||||
$content .= PHP_EOL;
|
$content .= PHP_EOL;
|
||||||
$content .= '$config[\'client_download_linux\'] = \'http://clients.halfaway.net/linux.php?tibia=\'. $config[\'client\'];';
|
$content .= '$config[\'client_download_linux\'] = \'http://clients.halfaway.net/linux.php?tibia=\'. $config[\'client\'];';
|
||||||
$content .= PHP_EOL;
|
$content .= PHP_EOL;
|
||||||
|
$content .= '// place for your configuration directives, so you can later easily update myaac';
|
||||||
|
$content .= PHP_EOL;
|
||||||
$content .= "?>";
|
$content .= "?>";
|
||||||
$file = fopen(BASE . 'config.local.php', 'a+');
|
$file = fopen(BASE . 'config.local.php', 'a+');
|
||||||
if($file) {
|
if($file) {
|
||||||
@@ -332,11 +256,10 @@ 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="finish" />
|
<input type="hidden" name="step" id="step" value="admin" />
|
||||||
<?php echo next_buttons(true, $error ? false : true);
|
<?php echo next_buttons(true, $error ? false : true);
|
||||||
?>
|
?>
|
||||||
</form>
|
</form>
|
@@ -1,15 +1,153 @@
|
|||||||
<?php
|
<?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>';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
require(SYSTEM . 'init.php');
|
||||||
|
//require(BASE . 'install/includes/config.php');
|
||||||
|
if(!$error) {
|
||||||
|
//require(BASE . 'install/includes/database.php');
|
||||||
|
|
||||||
|
if(USE_ACCOUNT_NAME)
|
||||||
|
$account = isset($_SESSION['var_account']) ? $_SESSION['var_account'] : NULL;
|
||||||
|
else
|
||||||
|
$account_id = isset($_SESSION['var_account_id']) ? $_SESSION['var_account_id'] : NULL;
|
||||||
|
|
||||||
|
$password = $_SESSION['var_password'];
|
||||||
|
|
||||||
|
$config_salt_enabled = fieldExist('salt', 'accounts');
|
||||||
|
if($config_salt_enabled)
|
||||||
|
{
|
||||||
|
$salt = generateRandomString(10, false, true, true);
|
||||||
|
$password = $salt . $password;
|
||||||
|
}
|
||||||
|
|
||||||
|
$account_db = new OTS_Account();
|
||||||
|
$account_db->load(1);
|
||||||
|
if($account_db->isLoaded()) {
|
||||||
|
if(USE_ACCOUNT_NAME)
|
||||||
|
$account_db->setName('dummy_account');
|
||||||
|
|
||||||
|
$account_db->setPassword('for sample characters. ' . generateRandomString(10));
|
||||||
|
$account_db->save();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$new_account = new OTS_Account();
|
||||||
|
if(USE_ACCOUNT_NAME)
|
||||||
|
$new_account->create('dummy_account', 1);
|
||||||
|
else
|
||||||
|
$new_account->create(NULL, 1);
|
||||||
|
|
||||||
|
$new_account->setPassword('for sample characters. ' . generateRandomString(10));
|
||||||
|
$new_account->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
$account_db = new OTS_Account();
|
||||||
|
if(isset($account))
|
||||||
|
$account_db->find($account);
|
||||||
|
else
|
||||||
|
$account_db->load($account_id);
|
||||||
|
|
||||||
|
$player_db = $ots->createObject('Player');
|
||||||
|
$player_db->find('Admin');
|
||||||
|
$groups = new OTS_Groups_List();
|
||||||
|
if(!$player_db->isLoaded())
|
||||||
|
{
|
||||||
|
$player = $ots->createObject('Player');
|
||||||
|
$player->setName('Admin');
|
||||||
|
|
||||||
|
$player->setGroupId($groups->getHighestId());
|
||||||
|
}
|
||||||
|
|
||||||
|
if($account_db->isLoaded()) {
|
||||||
|
$account_db->setPassword(encrypt($password));
|
||||||
|
$account_db->setEMail($_SESSION['var_mail_admin']);
|
||||||
|
$account_db->save();
|
||||||
|
|
||||||
|
if($config_salt_enabled)
|
||||||
|
$account_db->setCustomField('salt', $salt);
|
||||||
|
|
||||||
|
$account_db->setCustomField('web_flags', 3);
|
||||||
|
$account_db->setCustomField('country', 'us');
|
||||||
|
if(fieldExist('group_id', 'accounts'))
|
||||||
|
$account_db->setCustomField('group_id', $groups->getHighestId());
|
||||||
|
if(fieldExist('type', 'accounts'))
|
||||||
|
$account_db->setCustomField('type', 5);
|
||||||
|
|
||||||
|
if(!$player_db->isLoaded())
|
||||||
|
$player->setAccountId($account_db->getId());
|
||||||
|
else
|
||||||
|
$player_db->setAccountId($account_db->getId());
|
||||||
|
|
||||||
|
$_SESSION['account'] = $account_db->getId();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$new_account = $ots->createObject('Account');
|
||||||
|
$new_account->create($account);
|
||||||
|
|
||||||
|
$new_account->setPassword(encrypt($password));
|
||||||
|
$new_account->setEMail($_SESSION['var_mail_admin']);
|
||||||
|
|
||||||
|
$new_account->unblock();
|
||||||
|
$new_account->save();
|
||||||
|
|
||||||
|
if($config_salt_enabled)
|
||||||
|
$new_account->setCustomField('salt', $salt);
|
||||||
|
|
||||||
|
$new_account->setCustomField('created', time());
|
||||||
|
$new_account->setCustomField('web_flags', 3);
|
||||||
|
$new_account->setCustomField('country', 'us');
|
||||||
|
if(fieldExist('group_id', 'accounts'))
|
||||||
|
$new_account->setCustomField('group_id', $groups->getHighestId());
|
||||||
|
if(fieldExist('type', 'accounts'))
|
||||||
|
$new_account->setCustomField('type', 5);
|
||||||
|
|
||||||
|
$new_account->logAction('Account created.');
|
||||||
|
|
||||||
|
if(!$player_db->isLoaded())
|
||||||
|
$player->setAccountId($new_account->getId());
|
||||||
|
else
|
||||||
|
$player_db->setAccountId($new_account->getId());
|
||||||
|
|
||||||
|
$_SESSION['account'] = $new_account->getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
if($player_db->isLoaded())
|
||||||
|
$player_db->save();
|
||||||
|
else
|
||||||
|
$player->save();
|
||||||
|
|
||||||
|
success($locale['step_database_created_account']);
|
||||||
|
$_SESSION['password'] = encrypt($password);
|
||||||
|
$_SESSION['remember_me'] = true;
|
||||||
|
|
||||||
|
$deleted = 'deleted';
|
||||||
|
if(fieldExist('deletion', 'players'))
|
||||||
|
$deleted = 'deletion';
|
||||||
|
|
||||||
|
$query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote('Rook Sample') . ' OR `name` = ' . $db->quote('Sorcerer Sample') . ' OR `name` = ' . $db->quote('Druid Sample') . ' OR `name` = ' . $db->quote('Paladin Sample') . ' OR `name` = ' . $db->quote('Knight Sample'));
|
||||||
|
if($query->rowCount() == 0) {
|
||||||
|
if(query("INSERT INTO `players` (`id`, `name`, `group_id`, `account_id`, `level`, `vocation`, `health`, `healthmax`, `experience`, `lookbody`, `lookfeet`, `lookhead`, `looklegs`, `looktype`, `maglevel`, `mana`, `manamax`, `manaspent`, `soul`, `town_id`, `posx`, `posy`, `posz`, `conditions`, `cap`, `sex`, `lastlogin`, `lastip`, `save`, `lastlogout`, `balance`, `$deleted`, `created`, `hidden`, `comment`) VALUES
|
||||||
|
(null, 'Rook Sample', 1, 1, 8, 0, 185, 185, 4200, 118, 114, 38, 57, 130, 0, 35, 35, 0, 100, 11, 2200, 1298, 7, '', 470, 1, 1255179613, 2453925456, 1, 1255179614, 0, 1, UNIX_TIMESTAMP(), 1, ''),
|
||||||
|
(null, 'Sorcerer Sample', 1, 1, 8, 1, 185, 185, 4200, 118, 114, 38, 57, 130, 0, 35, 35, 0, 100, 11, 2200, 1298, 7, '', 470, 1, 1255179571, 2453925456, 1, 1255179612, 0, 1, UNIX_TIMESTAMP(), 1, ''),
|
||||||
|
(null, 'Druid Sample', 1, 1, 8, 2, 185, 185, 4200, 118, 114, 38, 57, 130, 0, 35, 35, 0, 100, 11, 2200, 1298, 7, '', 470, 1, 1255179655, 2453925456, 1, 1255179658, 0, 1, UNIX_TIMESTAMP(), 1, ''),
|
||||||
|
(null, 'Paladin Sample', 1, 1, 8, 3, 185, 185, 4200, 118, 114, 38, 57, 129, 0, 35, 35, 0, 100, 11, 2200, 1298, 7, '', 470, 1, 1255179854, 2453925456, 1, 1255179858, 0, 1, UNIX_TIMESTAMP(), 1, ''),
|
||||||
|
(null, 'Knight Sample', 1, 1, 8, 4, 185, 185, 4200, 118, 114, 38, 57, 131, 0, 35, 35, 0, 100, 11, 2200, 1298, 7, '', 470, 1, 1255179620, 2453925456, 1, 1255179654, 0, 1, UNIX_TIMESTAMP(), 1, '');"))
|
||||||
|
success($locale['step_database_imported_players']);
|
||||||
|
}
|
||||||
|
|
||||||
$locale['step_finish_desc'] = str_replace('$ADMIN_PANEL$', generateLink(ADMIN_URL, $locale['step_finish_admin_panel'], true), $locale['step_finish_desc']);
|
$locale['step_finish_desc'] = str_replace('$ADMIN_PANEL$', generateLink(ADMIN_URL, $locale['step_finish_admin_panel'], true), $locale['step_finish_desc']);
|
||||||
$locale['step_finish_desc'] = str_replace('$HOMEPAGE$', generateLink(BASE_URL, $locale['step_finish_homepage'], true), $locale['step_finish_desc']);
|
$locale['step_finish_desc'] = str_replace('$HOMEPAGE$', generateLink(BASE_URL, $locale['step_finish_homepage'], true), $locale['step_finish_desc']);
|
||||||
$locale['step_finish_desc'] = str_replace('$LINK$', generateLink('http://my-aac.org', 'http://my-aac.org', true), $locale['step_finish_desc']);
|
$locale['step_finish_desc'] = str_replace('$LINK$', generateLink('http://my-aac.org', 'http://my-aac.org', true), $locale['step_finish_desc']);
|
||||||
?>
|
?>
|
||||||
<p class="success"><?php echo $locale['step_finish_desc']; ?></p>
|
<p class="success"><?php echo $locale['step_finish_desc']; ?></p>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if(!isset($_SESSION['installed'])) {
|
if(!isset($_SESSION['installed'])) {
|
||||||
file_get_contents('http://my-aac.org/report_install.php?v=' . MYAAC_VERSION);
|
file_get_contents('http://my-aac.org/report_install.php?v=' . MYAAC_VERSION . '&b=' . urlencode(BASE_URL));
|
||||||
$_SESSION['installed'] = false;
|
$_SESSION['installed'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($_SESSION as $key => $value) {
|
foreach($_SESSION as $key => $value) {
|
||||||
@@ -17,4 +155,6 @@ foreach($_SESSION as $key => $value) {
|
|||||||
unset($_SESSION[$key]);
|
unset($_SESSION[$key]);
|
||||||
}
|
}
|
||||||
unset($_SESSION['saved']);
|
unset($_SESSION['saved']);
|
||||||
|
}
|
||||||
|
}
|
||||||
?>
|
?>
|
@@ -1,3 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
?>
|
||||||
<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="requirements" />
|
<input type="hidden" name="step" id="step" value="requirements" />
|
||||||
<textarea rows="10" cols="80" readonly="1"><?php echo file_get_contents(BASE . 'LICENSE'); ?></textarea>
|
<textarea rows="10" cols="80" readonly="1"><?php echo file_get_contents(BASE . 'LICENSE'); ?></textarea>
|
||||||
|
@@ -1,16 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @param boolean $ok
|
* @param boolean $ok
|
||||||
* @param mixed $version
|
* @param mixed $info
|
||||||
*/
|
*/
|
||||||
function version_check($name, $ok, $version = '', $warning = false)
|
function version_check($name, $ok, $info = '', $warning = false)
|
||||||
{
|
{
|
||||||
global $failed;
|
global $failed;
|
||||||
echo '<p class="' . ($ok ? 'success' : ($warning ? 'warning' : 'error')) . '">' . $name;
|
echo '<p class="' . ($ok ? 'success' : ($warning ? 'warning' : 'error')) . '">' . $name;
|
||||||
if(!empty($version))
|
if(!empty($info))
|
||||||
echo ': <b>' . $version . '</b>';
|
echo ': <b>' . $info . '</b>';
|
||||||
|
|
||||||
echo '</p>';
|
echo '</p>';
|
||||||
if(!$ok && !$warning)
|
if(!$ok && !$warning)
|
||||||
@@ -33,8 +35,9 @@ version_check('register_long_arrays', !$ini_register_globals, $ini_register_glob
|
|||||||
$ini_safe_mode = ini_get_bool('safe_mode');
|
$ini_safe_mode = ini_get_bool('safe_mode');
|
||||||
version_check('safe_mode', !$ini_safe_mode, $ini_safe_mode ? $locale['on'] : $locale['off'], true);
|
version_check('safe_mode', !$ini_safe_mode, $ini_safe_mode ? $locale['on'] : $locale['off'], true);
|
||||||
|
|
||||||
version_check('PDO extension loaded', extension_loaded('pdo'), '', false);
|
version_check(str_replace('$EXTENSION$', 'PDO', $locale['step_requirements_extension']) , extension_loaded('pdo'), extension_loaded('pdo') ? $locale['loaded'] : $locale['not_loaded']);
|
||||||
version_check('zip extension loaded', extension_loaded('zip'), '', false);
|
version_check(str_replace('$EXTENSION$', 'XML', $locale['step_requirements_extension']), extension_loaded('xml'), extension_loaded('xml') ? $locale['loaded'] : $locale['not_loaded']);
|
||||||
|
version_check(str_replace('$EXTENSION$', 'ZIP', $locale['step_requirements_extension']), extension_loaded('zip'), extension_loaded('zip') ? $locale['loaded'] : $locale['not_loaded']);
|
||||||
|
|
||||||
if($failed)
|
if($failed)
|
||||||
{
|
{
|
||||||
|
@@ -1,8 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
if(isset($config['installed']) && $config['installed'])
|
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 '<p class="warning">' . $locale['already_installed'] . '</p>';
|
||||||
else
|
}
|
||||||
{
|
else {
|
||||||
|
unset($_SESSION['saved']);
|
||||||
?>
|
?>
|
||||||
<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="license" />
|
<input type="hidden" name="step" id="step" value="license" />
|
||||||
|
14
plugins/example.json
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"name": "Example Plugin",
|
||||||
|
"description": "This is just an example of a Plugin for MyAAC.",
|
||||||
|
"version": "1.0",
|
||||||
|
"author": "nobody",
|
||||||
|
"contact": "nobody@example.org",
|
||||||
|
"install": "plugins/example/install.php",
|
||||||
|
"hooks": {
|
||||||
|
"Example Hook": {
|
||||||
|
"type": "BEFORE_PAGE",
|
||||||
|
"file": "plugins/example/before.php"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -5,7 +5,7 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
@@ -1,8 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
|
||||||
if(isset($config['lua']['sqlType'])) // tfs 0.3
|
if(!isset($config['database_type'][0]) || !isset($config['database_user'][0]) || !isset($config['database_password'][0]) || !isset($config['database_name'][0]))
|
||||||
{
|
{
|
||||||
|
if(isset($config['lua']['sqlType'])) {// tfs 0.3
|
||||||
|
if(isset($config['lua']['mysqlHost'])) {// tfs 0.2
|
||||||
|
$config['otserv_version'] = TFS_02;
|
||||||
|
$config['database_type'] = 'mysql';
|
||||||
|
$config['database_host'] = $config['lua']['mysqlHost'];
|
||||||
|
$config['database_port'] = $config['lua']['mysqlPort'];
|
||||||
|
$config['database_user'] = $config['lua']['mysqlUser'];
|
||||||
|
$config['database_password'] = $config['lua']['mysqlPass'];
|
||||||
|
$config['database_name'] = $config['lua']['mysqlDatabase'];
|
||||||
|
$config['database_encryption'] = $config['lua']['passwordType'];
|
||||||
|
}
|
||||||
|
else {
|
||||||
$config['otserv_version'] = TFS_03;
|
$config['otserv_version'] = TFS_03;
|
||||||
$config['database_type'] = $config['lua']['sqlType'];
|
$config['database_type'] = $config['lua']['sqlType'];
|
||||||
$config['database_host'] = $config['lua']['sqlHost'];
|
$config['database_host'] = $config['lua']['sqlHost'];
|
||||||
@@ -12,10 +24,11 @@ defined('MYAAC') or die('Direct access not allowed!');
|
|||||||
$config['database_name'] = $config['lua']['sqlDatabase'];
|
$config['database_name'] = $config['lua']['sqlDatabase'];
|
||||||
|
|
||||||
$config['database_encryption'] = $config['lua']['encryptionType'];
|
$config['database_encryption'] = $config['lua']['encryptionType'];
|
||||||
if(!isset($encryptionType)/* || empty($encryptionType)*/) // before 0.3.6
|
if(!isset($config['database_encryption']) || empty($config['database_encryption'])) // before 0.3.6
|
||||||
$config['database_encryption'] = $config['lua']['passwordType'];
|
$config['database_encryption'] = $config['lua']['passwordType'];
|
||||||
}
|
}
|
||||||
else if(isset($config['lua']['mysqlHost'])) // tfs 0.2/1.0
|
}
|
||||||
|
else if(isset($config['lua']['mysqlHost'])) // tfs 1.0
|
||||||
{
|
{
|
||||||
$config['otserv_version'] = TFS_02;
|
$config['otserv_version'] = TFS_02;
|
||||||
$config['database_type'] = 'mysql';
|
$config['database_type'] = 'mysql';
|
||||||
@@ -50,6 +63,7 @@ defined('MYAAC') or die('Direct access not allowed!');
|
|||||||
$config['database_encryption'] = isset($config['lua']['passwordtype']) ? $config['lua']['passwordtype'] : $config['lua']['password_type'];
|
$config['database_encryption'] = isset($config['lua']['passwordtype']) ? $config['lua']['passwordtype'] : $config['lua']['password_type'];
|
||||||
$config['database_salt'] = isset($config['lua']['passwordsalt']) ? $config['lua']['passwordsalt'] : $config['lua']['password_salt'];
|
$config['database_salt'] = isset($config['lua']['passwordsalt']) ? $config['lua']['passwordsalt'] : $config['lua']['password_salt'];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($config['lua']['useMD5Passwords']) && getBoolean($config['lua']['useMD5Passwords']))
|
if(isset($config['lua']['useMD5Passwords']) && getBoolean($config['lua']['useMD5Passwords']))
|
||||||
$config['database_encryption'] = 'md5';
|
$config['database_encryption'] = 'md5';
|
||||||
@@ -65,12 +79,16 @@ defined('MYAAC') or die('Direct access not allowed!');
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
catch(PDOException $error) {
|
catch(PDOException $error) {
|
||||||
|
if(isset($cache) && $cache->enabled()) {
|
||||||
|
$cache->delete('config_lua');
|
||||||
|
}
|
||||||
die('ERROR: Cannot connect to MySQL database.<br/>' .
|
die('ERROR: Cannot connect to MySQL database.<br/>' .
|
||||||
'Possible reasons:' .
|
'Possible reasons:' .
|
||||||
'<ul>' .
|
'<ul>' .
|
||||||
'<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>');
|
'</ul>' . $error);
|
||||||
|
|
||||||
}
|
}
|
||||||
$db = POT::getInstance()->getDBHandle();
|
$db = POT::getInstance()->getDBHandle();
|
||||||
?>
|
?>
|
@@ -1,61 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* Events system
|
|
||||||
*
|
|
||||||
* @package MyAAC
|
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
|
||||||
* @copyright 2017 MyAAC
|
|
||||||
* @version 0.0.1
|
|
||||||
* @link http://my-aac.org
|
|
||||||
*/
|
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
|
||||||
class Event
|
|
||||||
{
|
|
||||||
private $_name, $_type, $_callback;
|
|
||||||
|
|
||||||
public function __construct($name, $type, $callback) {
|
|
||||||
$this->_name = $name;
|
|
||||||
$this->_type = $type;
|
|
||||||
$this->_callback = $callback;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function execute($params)
|
|
||||||
{
|
|
||||||
$ret = false;
|
|
||||||
if(is_callable($this->_callback))
|
|
||||||
{
|
|
||||||
$tmp = $this->_callback;
|
|
||||||
$ret = $tmp($params);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function name() {return $this->_name;}
|
|
||||||
public function type() {return $this->_type;}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Events
|
|
||||||
{
|
|
||||||
private static $_events = array();
|
|
||||||
|
|
||||||
public function register($event, $type = '', $callback = null) {
|
|
||||||
if(!($event instanceof Event))
|
|
||||||
$event = new Event($event, $type, $callback);
|
|
||||||
|
|
||||||
self::$_events[$event->type()][] = $event;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function trigger($type, $params = array())
|
|
||||||
{
|
|
||||||
$ret = true;
|
|
||||||
if(isset(self::$_events[$type]))
|
|
||||||
{
|
|
||||||
foreach(self::$_events[$type] as $name => $event)
|
|
||||||
$ret = $event->execute($params);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
@@ -5,7 +5,7 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
@@ -45,6 +45,32 @@ function getPageLink($page, $action = null)
|
|||||||
}
|
}
|
||||||
function internalLayoutLink($page, $action = null) {return getPageLink($page, $action);}
|
function internalLayoutLink($page, $action = null) {return getPageLink($page, $action);}
|
||||||
|
|
||||||
|
function getForumThreadLink($thread_id, $page = NULL)
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
$url = '';
|
||||||
|
if($config['friendly_urls'])
|
||||||
|
$url = BASE_URL . 'forum/thread/' . (int)$thread_id . (isset($page) ? '/' . $page : '');
|
||||||
|
else
|
||||||
|
$url = BASE_URL . '?subtopic=forum&action=show_thread&id=' . (int)$thread_id . (isset($page) ? '&page=' . $page : '');
|
||||||
|
|
||||||
|
return $url;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getForumBoardLink($board_id, $page = NULL)
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
$url = '';
|
||||||
|
if($config['friendly_urls'])
|
||||||
|
$url = BASE_URL . 'forum/board/' . (int)$board_id . (isset($page) ? '/' . $page : '');
|
||||||
|
else
|
||||||
|
$url = BASE_URL . '?subtopic=forum&action=show_board&id=' . (int)$board_id . (isset($page) ? '&page=' . $page : '');
|
||||||
|
|
||||||
|
return $url;
|
||||||
|
}
|
||||||
|
|
||||||
function getPlayerLink($name, $generate = true)
|
function getPlayerLink($name, $generate = true)
|
||||||
{
|
{
|
||||||
global $ots, $config;
|
global $ots, $config;
|
||||||
@@ -122,7 +148,7 @@ function getItemImage($id, $count = 1)
|
|||||||
$file_name .= '-' . $count;
|
$file_name .= '-' . $count;
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
return '<img src="images/items/' . $file_name . '.gif" width="32" height="32" border="0" alt=" ' .$id . '" />';
|
return '<img src="' . $config['item_images_url'] . $file_name . '.gif" width="32" height="32" border="0" alt=" ' .$id . '" />';
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFlagImage($country)
|
function getFlagImage($country)
|
||||||
@@ -229,7 +255,7 @@ function fetchDatabaseConfig($name, &$value)
|
|||||||
*/
|
*/
|
||||||
function getDatabaseConfig($name)
|
function getDatabaseConfig($name)
|
||||||
{
|
{
|
||||||
$value = '';
|
$value = NULL;
|
||||||
fetchDatabaseConfig($name, $value);
|
fetchDatabaseConfig($name, $value);
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
@@ -355,6 +381,8 @@ function delete_guild($id)
|
|||||||
foreach($rank_list as $rank_in_guild) {
|
foreach($rank_list as $rank_in_guild) {
|
||||||
if(fieldExist('rank_id', 'players'))
|
if(fieldExist('rank_id', 'players'))
|
||||||
$players_with_rank = $db->query('SELECT `id`, `rank_id` FROM `players` WHERE `rank_id` = ' . $rank->getId() . ' AND `deleted` = 0;');
|
$players_with_rank = $db->query('SELECT `id`, `rank_id` FROM `players` WHERE `rank_id` = ' . $rank->getId() . ' AND `deleted` = 0;');
|
||||||
|
else if(tableExist('guild_members'))
|
||||||
|
$players_with_rank = $db->query('SELECT `players`.`id` as `id`, `guild_members`.`rank_id` as `rank_id` FROM `players`, `guild_members` WHERE `guild_members`.`rank_id` = ' . $rank_in_guild->getId() . ' AND `players`.`id` = `guild_members`.`player_id` ORDER BY `name`;');
|
||||||
else
|
else
|
||||||
$players_with_rank = $db->query('SELECT `players`.`id` as `id`, `guild_membership`.`rank_id` as `rank_id` FROM `players`, `guild_membership` WHERE `guild_membership`.`rank_id` = ' . $rank_in_guild->getId() . ' AND `players`.`id` = `guild_membership`.`player_id` ORDER BY `name`;');
|
$players_with_rank = $db->query('SELECT `players`.`id` as `id`, `guild_membership`.`rank_id` as `rank_id` FROM `players`, `guild_membership` WHERE `guild_membership`.`rank_id` = ' . $rank_in_guild->getId() . ' AND `players`.`id` = `guild_membership`.`player_id` ORDER BY `name`;');
|
||||||
|
|
||||||
@@ -416,6 +444,43 @@ function check_name($name, &$error = '')
|
|||||||
return preg_match("/[A-z ']{1,25}/", $name);
|
return preg_match("/[A-z ']{1,25}/", $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate account id
|
||||||
|
* Id lenght must be 6-10 chars
|
||||||
|
*
|
||||||
|
* @param string $name Account name to check
|
||||||
|
* @param string $error Error description will be placed here
|
||||||
|
* @return bool Is account name valid?
|
||||||
|
*/
|
||||||
|
function check_account_id($id, &$error = '')
|
||||||
|
{
|
||||||
|
if(!isset($id[0]))
|
||||||
|
{
|
||||||
|
$error = 'Please enter an account.';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!check_number($id)) {
|
||||||
|
$error = 'Invalid account name format. Use only numbers 0-9.';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$length = strlen($id);
|
||||||
|
if($length < 6)
|
||||||
|
{
|
||||||
|
$error = 'Account is too short (min. 6 chars).';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($length > 10)
|
||||||
|
{
|
||||||
|
$error = 'Account is too long (max. 10 chars).';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate account name
|
* Validate account name
|
||||||
* Name lenght must be 3-32 chars
|
* Name lenght must be 3-32 chars
|
||||||
@@ -455,7 +520,7 @@ function check_account_name($name, &$error = '')
|
|||||||
}
|
}
|
||||||
|
|
||||||
//is it valid nick for new char?
|
//is it valid nick for new char?
|
||||||
function check_name_new_char($name)
|
function check_name_new_char($name, &$error = '')
|
||||||
{
|
{
|
||||||
global $db, $config;
|
global $db, $config;
|
||||||
|
|
||||||
@@ -464,92 +529,143 @@ function check_name_new_char($name)
|
|||||||
$first_words_blocked = array('admin ', 'administrator ', 'gm ', 'cm ', 'god ','tutor ', "'", '-');
|
$first_words_blocked = array('admin ', 'administrator ', 'gm ', 'cm ', 'god ','tutor ', "'", '-');
|
||||||
foreach($first_words_blocked as $word)
|
foreach($first_words_blocked as $word)
|
||||||
{
|
{
|
||||||
if($word == substr($name_lower, 0, strlen($word)))
|
if($word == substr($name_lower, 0, strlen($word))) {
|
||||||
|
$error = 'Your name contains blocked words.';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(substr($name_lower, -1) == "'" || substr($name_lower, -1) == "-") {
|
||||||
|
$error = 'Your name contains illegal characters.';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(substr($name_lower, -1) == "'" || substr($name_lower, -1) == "-")
|
if(substr($name_lower, 1, 1) == ' ') {
|
||||||
|
$error = 'Your name contains illegal space.';
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(substr($name_lower, 1, 1) == ' ')
|
if(substr($name_lower, -2, 1) == " ") {
|
||||||
|
$error = 'Your name contains illegal space.';
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(substr($name_lower, -2, 1) == " ")
|
if(strtolower($config['lua']['serverName']) == $name_lower) {
|
||||||
return false;
|
$error = 'Your name cannot be same as server name.';
|
||||||
|
|
||||||
if(strtolower($config['lua']['serverName']) == $name_lower)
|
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$names_blocked = array('admin', 'administrator', 'gm', 'cm', 'god', 'tutor');
|
$names_blocked = array('admin', 'administrator', 'gm', 'cm', 'god', 'tutor');
|
||||||
foreach($names_blocked as $word)
|
foreach($names_blocked as $word)
|
||||||
{
|
{
|
||||||
if($word == $name_lower)
|
if($word == $name_lower) {
|
||||||
|
$error = 'Your name contains blocked words.';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$name_length = strlen($name_lower);
|
|
||||||
for($i = 0; $i < $name_length; $i++)
|
|
||||||
{
|
|
||||||
if(isset($name_lower[$i - 1]) && $name_lower[$i - 1] == ' ' && isset($name_lower[$i + 1]) && $name_lower[$i + 1] == ' ')
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$words_blocked = array('admin', 'administrator', 'gamemaster', 'game master', 'game-master', "game'master", '--', "''","' ", " '", '- ', ' -', "-'", "'-", 'fuck', 'sux', 'suck', 'noob', 'tutor');
|
$words_blocked = array('admin', 'administrator', 'gamemaster', 'game master', 'game-master', "game'master", '--', "''","' ", " '", '- ', ' -', "-'", "'-", 'fuck', 'sux', 'suck', 'noob', 'tutor');
|
||||||
foreach($words_blocked as $word)
|
foreach($words_blocked as $word)
|
||||||
{
|
{
|
||||||
if(!(strpos($name_lower, $word) === false))
|
if(!(strpos($name_lower, $word) === false)) {
|
||||||
|
$error = 'Your name contains illegal words.';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$name_length = strlen($name_lower);
|
||||||
|
for($i = 0; $i < $name_length; $i++)
|
||||||
|
{
|
||||||
|
if(isset($name_lower[$i]) && isset($name_lower[$i + 1]) && $name_lower[$i] == $name_lower[$i + 1] && isset($name_lower[$i + 2]) && $name_lower[$i] == $name_lower[$i + 2]) {
|
||||||
|
$error = 'Your name is invalid.';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for($i = 0; $i < $name_length; $i++)
|
for($i = 0; $i < $name_length; $i++)
|
||||||
{
|
{
|
||||||
if(isset($name_lower[$i]) && isset($name_lower[$i + 1]) && $name_lower[$i] == $name_lower[$i + 1] && isset($name_lower[$i + 2]) && $name_lower[$i] == $name_lower[$i + 2])
|
if(isset($name_lower[$i - 1]) && $name_lower[$i - 1] == ' ' && isset($name_lower[$i + 1]) && $name_lower[$i + 1] == ' ') {
|
||||||
|
$error = 'Your name contains too many spaces.';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for($i = 0; $i < $name_length; $i++)
|
|
||||||
{
|
|
||||||
if(isset($name_lower[$i - 1]) && $name_lower[$i - 1] == ' ' && isset($name_lower[$i + 1]) && $name_lower[$i + 1] == ' ')
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($config['monsters']))
|
if(isset($config['monsters']))
|
||||||
{
|
{
|
||||||
if(in_array($name_lower, $config['monsters']))
|
if(in_array($name_lower, $config['monsters'])) {
|
||||||
|
$error = 'Your name cannot contains monster name.';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$player = new OTS_Player();
|
||||||
|
$player->find($name);
|
||||||
|
if($player->isLoaded()) {
|
||||||
|
$error = 'Player with this name already exist.';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//check if was namelocked previously
|
||||||
|
if(tableExist('player_namelocks') && fieldExist('name', 'player_namelocks')) {
|
||||||
|
$namelock = $db->query('SELECT `player_id` FROM `player_namelocks` WHERE `name` = ' . $db->quote($name));
|
||||||
|
if($namelock->rowCount() > 0) {
|
||||||
|
$error = 'Character with this name has been namelocked.';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$monsters = $db->query(
|
$monsters = $db->query(
|
||||||
'SELECT ' . $db->fieldName('name') .
|
'SELECT ' . $db->fieldName('name') .
|
||||||
' FROM ' . $db->tableName(TABLE_PREFIX . 'monsters') .
|
' FROM ' . $db->tableName(TABLE_PREFIX . 'monsters') .
|
||||||
' WHERE ' . $db->fieldName('name') . ' LIKE ' . $db->quote($name_lower));
|
' WHERE ' . $db->fieldName('name') . ' LIKE ' . $db->quote($name_lower));
|
||||||
if($monsters->rowCount() > 0)
|
if($monsters->rowCount() > 0) {
|
||||||
|
$error = 'Your name cannot contains monster name.';
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$spells_name = $db->query(
|
$spells_name = $db->query(
|
||||||
'SELECT ' . $db->fieldName('name') .
|
'SELECT ' . $db->fieldName('name') .
|
||||||
' FROM ' . $db->tableName(TABLE_PREFIX . 'spells') .
|
' FROM ' . $db->tableName(TABLE_PREFIX . 'spells') .
|
||||||
' WHERE ' . $db->fieldName('name') . ' LIKE ' . $db->quote($name_lower));
|
' WHERE ' . $db->fieldName('name') . ' LIKE ' . $db->quote($name_lower));
|
||||||
if($spells_name->rowCount() > 0)
|
if($spells_name->rowCount() > 0) {
|
||||||
|
$error = 'Your name cannot contains spell name.';
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$spells_words = $db->query(
|
$spells_words = $db->query(
|
||||||
'SELECT ' . $db->fieldName('words') .
|
'SELECT ' . $db->fieldName('words') .
|
||||||
' FROM ' . $db->tableName(TABLE_PREFIX . 'spells') .
|
' FROM ' . $db->tableName(TABLE_PREFIX . 'spells') .
|
||||||
' WHERE ' . $db->fieldName('words') . ' = ' . $db->quote($name_lower));
|
' WHERE ' . $db->fieldName('words') . ' = ' . $db->quote($name_lower));
|
||||||
if($spells_words->rowCount() > 0)
|
if($spells_words->rowCount() > 0) {
|
||||||
return false;
|
$error = 'Your name cannot contains spell name.';
|
||||||
|
|
||||||
if(isset($config['npc']))
|
|
||||||
{
|
|
||||||
if(in_array($name_lower, $config['npc']))
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strspn($name, "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM- '") != $name_length)
|
if(isset($config['npc']))
|
||||||
|
{
|
||||||
|
if(in_array($name_lower, $config['npc'])) {
|
||||||
|
$error = 'Your name cannot contains NPC name.';
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return preg_match("/[A-z ']{3,28}/", $name);
|
if(strspn($name, "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM- '") != $name_length) {
|
||||||
|
$error = 'This name contains invalid letters, words or format. Please use only a-Z, - , \' and space.';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($name_length < 3 || $name_length > 28) {
|
||||||
|
$error = 'Your name cannot be shorter than 3 characters and longer than 28 characters.';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(!preg_match("/[A-z ']{3,28}/", $name)) {
|
||||||
|
$error = 'Your name containst illegal characters.';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_rank_name($name)
|
function check_rank_name($name)
|
||||||
@@ -708,8 +824,8 @@ function template_header($is_admin = false)
|
|||||||
</noscript>
|
</noscript>
|
||||||
';
|
';
|
||||||
if(admin())
|
if(admin())
|
||||||
$ret .= '<script type="text/javascript" src="' . BASE_URL . 'tools/tiny_mce/tiny_mce.js"></script>
|
$ret .= '<!--script type="text/javascript" src="' . BASE_URL . 'tools/tiny_mce/tiny_mce.js"></script>
|
||||||
<!--script type="text/javascript" src="' . BASE_URL . 'tools/jquery.qtip.js" ></script>
|
<script type="text/javascript" src="' . BASE_URL . 'tools/jquery.qtip.js" ></script>
|
||||||
<script type="text/javascript" src="' . BASE_URL . 'tools/admin.js"></script-->
|
<script type="text/javascript" src="' . BASE_URL . 'tools/admin.js"></script-->
|
||||||
';
|
';
|
||||||
if($config['recaptcha_enabled'])
|
if($config['recaptcha_enabled'])
|
||||||
@@ -752,18 +868,17 @@ function template_ga_code()
|
|||||||
if(!isset($config['google_analytics_id'][0]))
|
if(!isset($config['google_analytics_id'][0]))
|
||||||
return '';
|
return '';
|
||||||
|
|
||||||
return '
|
return "
|
||||||
<script type="text/javascript">
|
<script>
|
||||||
var _gaq = _gaq || [];
|
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||||
_gaq.push([\'_setAccount\', \'' . $config['google_analytics_id'] . '\']);
|
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||||
_gaq.push([\'_trackPageview\']);
|
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||||
|
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
|
||||||
|
|
||||||
(function() {
|
ga('create', '" . $config['google_analytics_id'] . "', 'auto');
|
||||||
var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;
|
ga('send', 'pageview');
|
||||||
ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\';
|
|
||||||
var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(ga, s);
|
</script>";
|
||||||
})();
|
|
||||||
</script>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function template_form()
|
function template_form()
|
||||||
@@ -778,7 +893,7 @@ function template_form()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$templates = get_templates();
|
$templates = get_templates();
|
||||||
$cache->set('templates', serialize($templates), 120);
|
$cache->set('templates', serialize($templates), 30);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1099,7 +1214,7 @@ function load_config_lua($filename)
|
|||||||
if(!@file_exists($config_file))
|
if(!@file_exists($config_file))
|
||||||
die('ERROR: Cannot find ' . $filename . ' file.');
|
die('ERROR: Cannot find ' . $filename . ' file.');
|
||||||
|
|
||||||
$tempFile = tempnam('/tmp', 'lua');
|
$tempFile = @tempnam('/tmp', 'lua');
|
||||||
$file = fopen($tempFile, 'w');
|
$file = fopen($tempFile, 'w');
|
||||||
if(!$file) die('Cannot load server config!');
|
if(!$file) die('Cannot load server config!');
|
||||||
|
|
||||||
|
92
system/hooks.php
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Events system
|
||||||
|
*
|
||||||
|
* @package MyAAC
|
||||||
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
|
* @copyright 2017 MyAAC
|
||||||
|
* @version 0.2.0
|
||||||
|
* @link http://my-aac.org
|
||||||
|
*/
|
||||||
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
|
||||||
|
define('HOOK_STARTUP', 1);
|
||||||
|
define('HOOK_BEFORE_PAGE', 2);
|
||||||
|
define('HOOK_AFTER_PAGE', 3);
|
||||||
|
define('HOOK_FINISH', 4);
|
||||||
|
define('HOOK_TIBIACOM_ARTICLE', 5);
|
||||||
|
define('HOOK_TIBIACOM_BORDER_3', 6);
|
||||||
|
define('HOOK_FIRST', HOOK_STARTUP);
|
||||||
|
define('HOOK_LAST', HOOK_TIBIACOM_BORDER_3);
|
||||||
|
|
||||||
|
$hook_types = array(
|
||||||
|
'STARTUP' => HOOK_STARTUP,
|
||||||
|
'BEFORE_PAGE' => HOOK_BEFORE_PAGE,
|
||||||
|
'AFTER_PAGE' => HOOK_AFTER_PAGE,
|
||||||
|
'FINISH' => HOOK_FINISH,
|
||||||
|
'TIBIACOM_ARTICLE' => HOOK_TIBIACOM_ARTICLE,
|
||||||
|
'TIBIACOM_BORDER_3' => HOOK_TIBIACOM_BORDER_3
|
||||||
|
);
|
||||||
|
|
||||||
|
class Hook
|
||||||
|
{
|
||||||
|
private $_name, $_type, $_file;
|
||||||
|
|
||||||
|
public function __construct($name, $type, $file) {
|
||||||
|
$this->_name = $name;
|
||||||
|
$this->_type = $type;
|
||||||
|
$this->_file = $file;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function execute($params)
|
||||||
|
{
|
||||||
|
/*if(is_callable($this->_callback))
|
||||||
|
{
|
||||||
|
$tmp = $this->_callback;
|
||||||
|
$ret = $tmp($params);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
global $db, $config, $template_path, $ots;
|
||||||
|
if(file_exists(BASE . $this->_file)) {
|
||||||
|
require(BASE . $this->_file);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function name() {return $this->_name;}
|
||||||
|
public function type() {return $this->_type;}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Hooks
|
||||||
|
{
|
||||||
|
private static $_hooks = array();
|
||||||
|
|
||||||
|
public function register($hook, $type = '', $file = null) {
|
||||||
|
if(!($hook instanceof Hook))
|
||||||
|
$hook = new Hook($hook, $type, $file);
|
||||||
|
|
||||||
|
self::$_hooks[$hook->type()][] = $hook;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function trigger($type, $params = array())
|
||||||
|
{
|
||||||
|
$ret = true;
|
||||||
|
if(isset(self::$_hooks[$type]))
|
||||||
|
{
|
||||||
|
foreach(self::$_hooks[$type] as $name => $hook)
|
||||||
|
$ret = $hook->execute($params);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function load()
|
||||||
|
{
|
||||||
|
global $db;
|
||||||
|
$hooks = $db->query('SELECT `name`, `type`, `file` FROM `' . TABLE_PREFIX . 'hooks`;');
|
||||||
|
foreach($hooks as $hook)
|
||||||
|
$this->register($hook['name'], $hook['type'], $hook['file']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
@@ -5,7 +5,7 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
@@ -72,6 +72,10 @@ unset($tmp);
|
|||||||
if(isset($config['lua']['servername']))
|
if(isset($config['lua']['servername']))
|
||||||
$config['lua']['serverName'] = $config['lua']['servername'];
|
$config['lua']['serverName'] = $config['lua']['servername'];
|
||||||
|
|
||||||
|
|
||||||
|
if(isset($config['lua']['houserentperiod']))
|
||||||
|
$config['lua']['houseRentPeriod'] = $config['lua']['houserentperiod'];
|
||||||
|
|
||||||
// localize data/ directory
|
// localize data/ directory
|
||||||
if(isset($config['lua']['dataDirectory'][0]))
|
if(isset($config['lua']['dataDirectory'][0]))
|
||||||
{
|
{
|
||||||
@@ -91,6 +95,15 @@ else if(isset($config['lua']['data_directory'][0]))
|
|||||||
if($tmp[strlen($tmp) - 1] != '/') // do not forget about trailing slash
|
if($tmp[strlen($tmp) - 1] != '/') // do not forget about trailing slash
|
||||||
$tmp .= '/';
|
$tmp .= '/';
|
||||||
}
|
}
|
||||||
|
else if(isset($config['lua']['datadir'][0]))
|
||||||
|
{
|
||||||
|
$tmp = $config['lua']['datadir'];
|
||||||
|
if($tmp[0] != '/')
|
||||||
|
$tmp = $config['server_path'] . $tmp;
|
||||||
|
|
||||||
|
if($tmp[strlen($tmp) - 1] != '/') // do not forget about trailing slash
|
||||||
|
$tmp .= '/';
|
||||||
|
}
|
||||||
else
|
else
|
||||||
$tmp = $config['server_path'] . 'data/';
|
$tmp = $config['server_path'] . 'data/';
|
||||||
|
|
||||||
@@ -102,6 +115,7 @@ require_once(SYSTEM . 'libs/pot/OTS.php');
|
|||||||
$ots = POT::getInstance();
|
$ots = POT::getInstance();
|
||||||
require_once(SYSTEM . 'database.php');
|
require_once(SYSTEM . 'database.php');
|
||||||
|
|
||||||
|
define('USE_ACCOUNT_NAME', fieldExist('name', 'accounts'));
|
||||||
// load vocation names
|
// load vocation names
|
||||||
$tmp = '';
|
$tmp = '';
|
||||||
if($cache->enabled() && $cache->fetch('vocations', $tmp)) {
|
if($cache->enabled() && $cache->fetch('vocations', $tmp)) {
|
||||||
@@ -121,10 +135,10 @@ else {
|
|||||||
$config['vocations'] = array();
|
$config['vocations'] = array();
|
||||||
foreach($vocations->getElementsByTagName('vocation') as $vocation) {
|
foreach($vocations->getElementsByTagName('vocation') as $vocation) {
|
||||||
$id = $vocation->getAttribute('id');
|
$id = $vocation->getAttribute('id');
|
||||||
if($id == $vocation->getAttribute('fromvoc'))
|
//if($id == $vocation->getAttribute('fromvoc'))
|
||||||
$config['vocations'][$id] = $vocation->getAttribute('name');
|
$config['vocations'][$id] = $vocation->getAttribute('name');
|
||||||
else
|
//else
|
||||||
$config['vocations'][$id + 4] = $vocation->getAttribute('name');
|
// $config['vocations'][$id] = $vocation->getAttribute('name');
|
||||||
}
|
}
|
||||||
|
|
||||||
if($cache->enabled()) {
|
if($cache->enabled()) {
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @author Mark Samman (Talaturen) <marksamman@gmail.com>
|
* @author Mark Samman (Talaturen) <marksamman@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @author Mark Samman (Talaturen) <marksamman@gmail.com>
|
* @author Mark Samman (Talaturen) <marksamman@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
@@ -42,6 +42,10 @@ class Cache_APC
|
|||||||
return ($var = apc_fetch($this->prefix . $key)) !== false;
|
return ($var = apc_fetch($this->prefix . $key)) !== false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function delete($key) {
|
||||||
|
apc_delete($key);
|
||||||
|
}
|
||||||
|
|
||||||
public function enabled() {
|
public function enabled() {
|
||||||
return $this->enabled;
|
return $this->enabled;
|
||||||
}
|
}
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @author Mark Samman (Talaturen) <marksamman@gmail.com>
|
* @author Mark Samman (Talaturen) <marksamman@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
@@ -41,6 +41,10 @@ class Cache_eAccelerator
|
|||||||
return ($var = eaccelerator_get($this->prefix . $key)) !== null;
|
return ($var = eaccelerator_get($this->prefix . $key)) !== null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function delete($key) {
|
||||||
|
eaccelerator_rm($key);
|
||||||
|
}
|
||||||
|
|
||||||
public function enabled() {
|
public function enabled() {
|
||||||
return $this->enabled;
|
return $this->enabled;
|
||||||
}
|
}
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
@@ -51,12 +51,19 @@ class Cache_File
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function delete($key)
|
||||||
|
{
|
||||||
|
$file = $this->_name($key);
|
||||||
|
if(file_exists($file))
|
||||||
|
unlink($file);
|
||||||
|
}
|
||||||
|
|
||||||
public function enabled() {
|
public function enabled() {
|
||||||
return $this->enabled;
|
return $this->enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function _name($key) {
|
private function _name($key) {
|
||||||
return sprintf("%s/%s%s", $this->dir, $this->prefix, sha1($key));
|
return sprintf("%s%s%s", $this->dir, $this->prefix, sha1($key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @author Mark Samman (Talaturen) <marksamman@gmail.com>
|
* @author Mark Samman (Talaturen) <marksamman@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
@@ -47,6 +47,10 @@ class Cache_XCache
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function delete($key) {
|
||||||
|
xcache_unset($key);
|
||||||
|
}
|
||||||
|
|
||||||
public function enabled() {
|
public function enabled() {
|
||||||
return $this->enabled;
|
return $this->enabled;
|
||||||
}
|
}
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
@@ -134,10 +134,13 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
* @throws PDOException On PDO operation error.
|
* @throws PDOException On PDO operation error.
|
||||||
* @deprecated 0.1.5 Use createNamed().
|
* @deprecated 0.1.5 Use createNamed().
|
||||||
*/
|
*/
|
||||||
public function create($name, $id = NULL)
|
public function create($name = NULL, $id = NULL)
|
||||||
{
|
{
|
||||||
// saves blank account info
|
// saves blank account info
|
||||||
$this->db->query('INSERT INTO `accounts` (' . (isset($id) ? '`id`,' : '') . '`name`, `password`, `email`, `created`) VALUES (' . (isset($id) ? $id . ',' : '') . $this->db->quote($name) . ', \'\', \'\',' . time() . ')');
|
$this->db->query('INSERT INTO `accounts` (' . (isset($id) ? '`id`,' : '') . (isset($name) ? '`name`,' : '') . '`password`, `email`, `created`) VALUES (' . (isset($id) ? $id . ',' : '') . (isset($name) ? $this->db->quote($name) . ',' : '') . ' \'\', \'\',' . time() . ')');
|
||||||
|
|
||||||
|
if(isset($name))
|
||||||
|
$this->data['name'] = $name;
|
||||||
|
|
||||||
$this->data['id'] = $this->db->lastInsertId();
|
$this->data['id'] = $this->db->lastInsertId();
|
||||||
return $this->data['id'];
|
return $this->data['id'];
|
||||||
@@ -167,7 +170,7 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
public function load($id)
|
public function load($id)
|
||||||
{
|
{
|
||||||
// SELECT query on database
|
// SELECT query on database
|
||||||
$this->data = $this->db->query('SELECT ' . $this->db->fieldName('id') . ', ' . $this->db->fieldName('name') . ', ' . $this->db->fieldName('password') . ', ' . $this->db->fieldName('salt') . ', ' . $this->db->fieldName('email') . ', ' . $this->db->fieldName('blocked') . ', ' . $this->db->fieldName('rlname') . ', ' . $this->db->fieldName('location') . ', ' . $this->db->fieldName('web_flags') . ', ' . $this->db->fieldName('premdays') . ', ' . $this->db->fieldName('lastday') . ', ' . $this->db->fieldName('created') . ' FROM ' . $this->db->tableName('accounts') . ' WHERE ' . $this->db->fieldName('id') . ' = ' . (int) $id)->fetch();
|
$this->data = $this->db->query('SELECT `id`, ' . (fieldExist('name', 'accounts') ? '`name`,' : '') . '`password`, `email`, ' . $this->db->fieldName('blocked') . ', ' . $this->db->fieldName('rlname') . ', ' . $this->db->fieldName('location') . ', ' . $this->db->fieldName('web_flags') . ', ' . (fieldExist('premdays', 'accounts') ? $this->db->fieldName('premdays') . ',' : '') . (fieldExist('lastday', 'accounts') ? $this->db->fieldName('lastday') . ',' : (fieldExist('premend', 'accounts') ? $this->db->fieldName('premend') . ' as `lastday`,' : '')) . $this->db->fieldName('created') . ' FROM ' . $this->db->tableName('accounts') . ' WHERE ' . $this->db->fieldName('id') . ' = ' . (int) $id)->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -246,14 +249,12 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
throw new E_OTS_NotLoaded();
|
throw new E_OTS_NotLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$lastday = 'lastday';
|
||||||
|
if(fieldExist('premend', 'accounts'))
|
||||||
|
$lastday = 'premend';
|
||||||
|
|
||||||
// UPDATE query on database
|
// UPDATE query on database
|
||||||
<<<<<<< .mine
|
$this->db->query('UPDATE `accounts` SET ' . (fieldExist('name', 'accounts') ? '`name` = ' . $this->db->quote($this->data['name']) . ',' : '') . '`password` = ' . $this->db->quote($this->data['password']) . ', `email` = ' . $this->db->quote($this->data['email']) . ', `blocked` = ' . (int) $this->data['blocked'] . ', `rlname` = ' . $this->db->quote($this->data['rlname']) . ', `location` = ' . $this->db->quote($this->data['location']) . ', `web_flags` = ' . (int) $this->data['web_flags'] . ', ' . (fieldExist('premdays', 'accounts') ? '`premdays` = ' . (int) $this->data['premdays'] . ',' : '') . '`' . $lastday . '` = ' . (int) $this->data['lastday'] . ' WHERE `id` = ' . $this->data['id']);
|
||||||
$this->db->query('UPDATE `accounts` SET `name` = ' . $this->db->quote($this->data['name']) . ', `password` = ' . $this->db->quote($this->data['password']) . ', `email` = ' . $this->db->quote($this->data['email']) . ', `blocked` = ' . (int) $this->data['blocked'] . ', `rlname` = ' . $this->db->quote($this->data['rlname']) . ', `location` = ' . $this->db->quote($this->data['location']) . ', `web_flags` = ' . (int) $this->data['web_flags'] . ', `premdays` = ' . (int) $this->data['premdays'] . ', `lastday` = ' . (int) $this->data['lastday'] . ' WHERE `id` = ' . $this->data['id']);
|
|
||||||
||||||| .r19
|
|
||||||
$this->db->query('UPDATE ' . $this->db->tableName('accounts') . ' SET ' . $this->db->fieldName('password') . ' = ' . $this->db->quote($this->data['password']) . ', ' . $this->db->fieldName('email') . ' = ' . $this->db->quote($this->data['email']) . ', ' . $this->db->fieldName('blocked') . ' = ' . (int) $this->data['blocked'] . ', ' . $this->db->fieldName('rlname') . ' = ' . $this->db->quote($this->data['rlname']) . ', ' . $this->db->fieldName('location') . ' = ' . $this->db->quote($this->data['location']) . ', ' . $this->db->fieldName('web_flags') . ' = ' . (int) $this->data['web_flags'] . ', ' . $this->db->fieldName('premdays') . ' = ' . (int) $this->data['premdays'] . ', ' . $this->db->fieldName('lastday') . ' = ' . (int) $this->data['lastday'] . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']);
|
|
||||||
=======
|
|
||||||
$this->db->query('UPDATE ' . $this->db->tableName('accounts') . ' SET ' . $this->db->fieldName('password') . ' = ' . $this->db->quote($this->data['password']) . ', ' . $this->db->fieldName('salt') . ' = ' . $this->db->quote($this->data['salt']) . ', ' . $this->db->fieldName('email') . ' = ' . $this->db->quote($this->data['email']) . ', ' . $this->db->fieldName('blocked') . ' = ' . (int) $this->data['blocked'] . ', ' . $this->db->fieldName('rlname') . ' = ' . $this->db->quote($this->data['rlname']) . ', ' . $this->db->fieldName('location') . ' = ' . $this->db->quote($this->data['location']) . ', ' . $this->db->fieldName('web_flags') . ' = ' . (int) $this->data['web_flags'] . ', ' . $this->db->fieldName('premdays') . ' = ' . (int) $this->data['premdays'] . ', ' . $this->db->fieldName('lastday') . ' = ' . (int) $this->data['lastday'] . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']);
|
|
||||||
>>>>>>> .r40
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -307,14 +308,34 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
return $this->data['web_flags'];
|
return $this->data['web_flags'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function hasFlag($flag)
|
||||||
|
{
|
||||||
|
if(!isset($this->data['web_flags'])) {
|
||||||
|
throw new E_OTS_NotLoaded();
|
||||||
|
}
|
||||||
|
|
||||||
|
return ($this->data['web_flags'] & $flag) == $flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isAdmin()
|
||||||
|
{
|
||||||
|
return $this->hasFlag(FLAG_ADMIN) || $this->isSuperAdmin();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isSuperAdmin()
|
||||||
|
{
|
||||||
|
return $this->hasFlag(FLAG_SUPER_ADMIN);
|
||||||
|
}
|
||||||
|
|
||||||
public function getPremDays()
|
public function getPremDays()
|
||||||
{
|
{
|
||||||
if( !isset($this->data['premdays']) || !isset($this->data['lastday']) )
|
if( !isset($this->data['lastday']) )
|
||||||
{
|
{
|
||||||
throw new E_OTS_NotLoaded();
|
throw new E_OTS_NotLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->data['premdays'] - (date("z", time()) + (365 * (date("Y", time()) - date("Y", $this->data['lastday']))) - date("z", $this->data['lastday']));
|
return round(($this->data['lastday'] - time()) / (24 * 60 * 60), 3);
|
||||||
|
//return $this->data['premdays'] - (date("z", time()) + (365 * (date("Y", time()) - date("Y", $this->data['lastday']))) - date("z", $this->data['lastday']));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLastLogin()
|
public function getLastLogin()
|
||||||
@@ -331,7 +352,8 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
if(isset($config['lua']['freePremium']) && getBoolean($config['lua']['freePremium'])) return true;
|
if(isset($config['lua']['freePremium']) && getBoolean($config['lua']['freePremium'])) return true;
|
||||||
return ($this->data['premdays'] - (date("z", time()) + (365 * (date("Y", time()) - date("Y", $this->data['lastday']))) - date("z", $this->data['lastday'])) > 0);
|
return $this->data['lastday'] > time();
|
||||||
|
//return ($this->data['premdays'] - (date("z", time()) + (365 * (date("Y", time()) - date("Y", $this->data['lastday']))) - date("z", $this->data['lastday'])) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCreated()
|
public function getCreated()
|
||||||
@@ -449,16 +471,6 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
$this->data['password'] = (string) $password;
|
$this->data['password'] = (string) $password;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSalt()
|
|
||||||
{
|
|
||||||
if( !isset($this->data['salt']) )
|
|
||||||
{
|
|
||||||
throw new E_OTS_NotLoaded();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->data['salt'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setSalt($salt)
|
public function setSalt($salt)
|
||||||
{
|
{
|
||||||
$this->data['salt'] = (string) $salt;
|
$this->data['salt'] = (string) $salt;
|
||||||
@@ -760,11 +772,18 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
$this->data['banned'] = isset($ban['expires_at']);
|
$this->data['banned'] = isset($ban['expires_at']);
|
||||||
$this->data['banned_time'] = $ban['expires_at'];
|
$this->data['banned_time'] = $ban['expires_at'];
|
||||||
}
|
}
|
||||||
else {
|
else if(tableExist('bans')) {
|
||||||
|
if(fieldExist('active', 'bans')) {
|
||||||
$ban = $this->db->query('SELECT `active`, `expires` FROM `bans` WHERE (`type` = 3 OR `type` = 5) AND `active` = 1 AND `value` = ' . $this->data['id'] . ' AND (`expires` > ' . time() .' OR `expires` = -1) ORDER BY `expires` DESC')->fetch();
|
$ban = $this->db->query('SELECT `active`, `expires` FROM `bans` WHERE (`type` = 3 OR `type` = 5) AND `active` = 1 AND `value` = ' . $this->data['id'] . ' AND (`expires` > ' . time() .' OR `expires` = -1) ORDER BY `expires` DESC')->fetch();
|
||||||
$this->data['banned'] = $ban['active'];
|
$this->data['banned'] = $ban['active'];
|
||||||
$this->data['banned_time'] = $ban['expires'];
|
$this->data['banned_time'] = $ban['expires'];
|
||||||
}
|
}
|
||||||
|
else { // tfs 0.2
|
||||||
|
$ban = $this->db->query('SELECT `time` FROM `bans` WHERE (`type` = 3 OR `type` = 5) AND `account` = ' . $this->data['id'] . ' AND (`time` > ' . time() .' OR `time` = -1) ORDER BY `time` DESC')->fetch();
|
||||||
|
$this->data['banned'] = $ban['time'] == -1 || $ban['time'] > 0;
|
||||||
|
$this->data['banned_time'] = $ban['time'];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -801,21 +820,21 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
*/
|
*/
|
||||||
public function getAccess()
|
public function getAccess()
|
||||||
{
|
{
|
||||||
|
global $groups;
|
||||||
|
if(!isset($groups))
|
||||||
|
$groups = new OTS_Groups_List();
|
||||||
|
|
||||||
// by default
|
// by default
|
||||||
$access = 0;
|
$access = 0;
|
||||||
if(fieldExist('group_id', 'accounts')) {
|
if(fieldExist('group_id', 'accounts')) {
|
||||||
$query = $this->db->query('SELECT `group_id` FROM `accounts` WHERE `id` = ' . (int) $this->getId())->fetch();
|
$query = $this->db->query('SELECT `group_id` FROM `accounts` WHERE `id` = ' . (int) $this->getId())->fetch();
|
||||||
// if anything was found
|
// if anything was found
|
||||||
if(isset($query['group_id']))
|
|
||||||
$access = $query['group_id'];
|
|
||||||
|
|
||||||
return $access;
|
$group = $groups->getGroup($query['group_id']);
|
||||||
|
if(!$group) return 0;
|
||||||
|
return $group->getAccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
global $groups;
|
|
||||||
if(!isset($groups))
|
|
||||||
$groups = new OTS_Groups_List();
|
|
||||||
|
|
||||||
// finds groups of all characters
|
// finds groups of all characters
|
||||||
foreach( $this->getPlayersList() as $player)
|
foreach( $this->getPlayersList() as $player)
|
||||||
{
|
{
|
||||||
@@ -831,6 +850,23 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
return $access;
|
return $access;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getGroupId()
|
||||||
|
{
|
||||||
|
global $db;;
|
||||||
|
if(fieldExist('group_id', 'accounts')) {
|
||||||
|
$query = $this->db->query('SELECT `group_id` FROM `accounts` WHERE `id` = ' . (int) $this->getId())->fetch();
|
||||||
|
// if anything was found
|
||||||
|
if(isset($query['group_id']))
|
||||||
|
return $query['group_id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$db->query('SELECT `group_id` FROM `players` WHERE `account_id` = ' . $this->getId() . ' ORDER BY `group_id` DESC LIMIT 1')->fetch();
|
||||||
|
if(isset($query['group_id']))
|
||||||
|
return $query['group_id'];
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks highest access level of account in given guild.
|
* Checks highest access level of account in given guild.
|
||||||
*
|
*
|
||||||
@@ -860,15 +896,31 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
|
|
||||||
public function logAction($action)
|
public function logAction($action)
|
||||||
{
|
{
|
||||||
return $this->db->query('INSERT INTO ' . $this->db->tableName(TABLE_PREFIX . 'account_actions') . ' (' . $this->db->fieldName('account_id') . ', ' . $this->db->fieldName('ip') . ', ' . $this->db->fieldName('date') . ', ' . $this->db->fieldName('action') . ') VALUES (' . $this->db->quote($this->getId()).', INET_ATON(' . $this->db->quote($_SERVER['REMOTE_ADDR']) . '), UNIX_TIMESTAMP(NOW()), ' . $this->db->quote($action).')');
|
$ip = '0';
|
||||||
|
if(isset($_SERVER['REMOTE_ADDR']) && !empty($_SERVER['REMOTE_ADDR']))
|
||||||
|
$ip = $_SERVER['REMOTE_ADDR'];
|
||||||
|
else if(isset($_SERVER['HTTP_CLIENT_IP']) && !empty($_SERVER['HTTP_CLIENT_IP']))
|
||||||
|
$ip = $_SERVER['HTTP_CLIENT_IP'];
|
||||||
|
else if(isset($_SERVER['HTTP_X_FORWARDED_FOR']) && !empty($_SERVER['HTTP_X_FORWARDED_FOR']))
|
||||||
|
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||||
|
|
||||||
|
if(strpos($ip, ":") === false) {
|
||||||
|
$ipv6 = '0';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$ipv6 = $ip;
|
||||||
|
$ip = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->db->query('INSERT INTO `' . TABLE_PREFIX . 'account_actions` (`account_id`, `ip`, `ipv6`, `date`, `action`) VALUES (' . $this->db->quote($this->getId()).', (' . $this->db->quote(ip2long($ip)) . '), (' . ($ipv6 == '0' ? $this->db->quote('') : $this->db->quote(inet_pton($ipv6))) . '), UNIX_TIMESTAMP(NOW()), ' . $this->db->quote($action).')');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getActionsLog($limit1, $limit2)
|
public function getActionsLog($limit1, $limit2)
|
||||||
{
|
{
|
||||||
$actions = array();
|
$actions = array();
|
||||||
|
|
||||||
foreach($this->db->query('SELECT ' . $this->db->fieldName('ip') . ', ' . $this->db->fieldName('date') . ', ' . $this->db->fieldName('action') . ' FROM ' . $this->db->tableName(TABLE_PREFIX . 'account_actions') . ' WHERE ' . $this->db->fieldName('account_id') . ' = ' . $this->data['id'] . ' ORDER by ' . $this->db->fieldName('date') . ' DESC LIMIT ' . $limit1 . ', ' . $limit2 . '')->fetchAll() as $a)
|
foreach($this->db->query('SELECT `ip`, `ipv6`, `date`, `action` FROM `' . TABLE_PREFIX . 'account_actions` WHERE `account_id` = ' . $this->data['id'] . ' ORDER by `date` DESC LIMIT ' . $limit1 . ', ' . $limit2 . '')->fetchAll() as $a)
|
||||||
$actions[] = array('ip' => $a['ip'], 'date' => $a['date'], 'action' => $a['action']);
|
$actions[] = array('ip' => $a['ip'], 'ipv6' => $a['ipv6'], 'date' => $a['date'], 'action' => $a['action']);
|
||||||
|
|
||||||
return $actions;
|
return $actions;
|
||||||
}
|
}
|
||||||
|
@@ -97,6 +97,7 @@ abstract class OTS_Base_DB extends PDO implements IOTS_DB
|
|||||||
public function query($query)
|
public function query($query)
|
||||||
{
|
{
|
||||||
$this->queries++;
|
$this->queries++;
|
||||||
|
//echo $query . PHP_EOL;
|
||||||
return parent::query($query);
|
return parent::query($query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -92,17 +92,8 @@ class OTS_DB_MySQL extends OTS_Base_DB
|
|||||||
$this->prefix = $params['prefix'];
|
$this->prefix = $params['prefix'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// PDO constructor
|
|
||||||
try
|
|
||||||
{
|
|
||||||
parent::__construct('mysql:' . implode(';', $dns), $user, $password);
|
parent::__construct('mysql:' . implode(';', $dns), $user, $password);
|
||||||
}
|
}
|
||||||
catch(PDOException $error)
|
|
||||||
{
|
|
||||||
echo 'Can\'t connect to MySQL database.';
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query-quoted field name.
|
* Query-quoted field name.
|
||||||
|
@@ -1,110 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**#@+
|
|
||||||
* @version 0.0.4
|
|
||||||
* @since 0.0.4
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @package POT
|
|
||||||
* @version 0.1.3
|
|
||||||
* @author Wrzasq <wrzasq@gmail.com>
|
|
||||||
* @copyright 2007 - 2008 (C) by Wrzasq
|
|
||||||
* @license http://www.gnu.org/licenses/lgpl-3.0.txt GNU Lesser General Public License, Version 3
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ODBC connection interface.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* At all everything that you really need to read from this class documentation is list of parameters for driver's constructor.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @package POT
|
|
||||||
* @version 0.1.3
|
|
||||||
*/
|
|
||||||
class OTS_DB_ODBC extends OTS_Base_DB
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Creates database connection.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* Connects to ODBC data source on given arguments.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* List of parameters for this drivers:
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* <ul>
|
|
||||||
* <li><var>host</var> - database host.</li>
|
|
||||||
* <li><var>port</var> - ODBC driver.</li>
|
|
||||||
* <li><var>database</var> - database name.</li>
|
|
||||||
* <li><var>user</var> - user login.</li>
|
|
||||||
* <li><var>password</var> - user password.</li>
|
|
||||||
* <li><var>source</var> - ODBC data source.</li>
|
|
||||||
* </ul>
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* Note: Since 0.1.3 version <var>source</var> parameter was added.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @version 0.1.3
|
|
||||||
* @param array $params Connection parameters.
|
|
||||||
* @throws PDOException On PDO operation error.
|
|
||||||
*/
|
|
||||||
public function __construct($params)
|
|
||||||
{
|
|
||||||
$user = null;
|
|
||||||
$password = null;
|
|
||||||
$dns = array();
|
|
||||||
|
|
||||||
if( isset($params['host']) )
|
|
||||||
{
|
|
||||||
$dns[] = 'HOSTNAME={' . $params['host'] . '}';
|
|
||||||
}
|
|
||||||
|
|
||||||
if( isset($params['port']) )
|
|
||||||
{
|
|
||||||
$dns[] = 'DRIVER={' . $params['port'] . '}';
|
|
||||||
}
|
|
||||||
|
|
||||||
if( isset($params['database']) )
|
|
||||||
{
|
|
||||||
$dns[] = 'DATABASE={' . $params['database'] . '}';
|
|
||||||
}
|
|
||||||
|
|
||||||
if( isset($params['user']) )
|
|
||||||
{
|
|
||||||
$user = $params['user'];
|
|
||||||
$dns[] = 'UID={' . $user . '}';
|
|
||||||
}
|
|
||||||
|
|
||||||
if( isset($params['password']) )
|
|
||||||
{
|
|
||||||
$password = $params['password'];
|
|
||||||
$dns[] = 'PWD={' . $user . '}';
|
|
||||||
}
|
|
||||||
|
|
||||||
if( isset($params['prefix']) )
|
|
||||||
{
|
|
||||||
$this->prefix = $params['prefix'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// composes DNS
|
|
||||||
$dns = implode(';', $dns);
|
|
||||||
|
|
||||||
// source parameter overwrites all other params
|
|
||||||
if( isset($params['source']) )
|
|
||||||
{
|
|
||||||
$dns = $params['source'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// PDO constructor
|
|
||||||
parent::__construct('odbc:' . $dns, $user, $password);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**#@-*/
|
|
||||||
|
|
||||||
?>
|
|
@@ -1,103 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**#@+
|
|
||||||
* @version 0.0.4
|
|
||||||
* @since 0.0.4
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @package POT
|
|
||||||
* @version 0.1.3
|
|
||||||
* @author Wrzasq <wrzasq@gmail.com>
|
|
||||||
* @copyright 2007 (C) by Wrzasq
|
|
||||||
* @license http://www.gnu.org/licenses/lgpl-3.0.txt GNU Lesser General Public License, Version 3
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PostgreSQL connection interface.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* At all everything that you really need to read from this class documentation is list of parameters for driver's constructor.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @package POT
|
|
||||||
* @version 0.1.3
|
|
||||||
*/
|
|
||||||
class OTS_DB_PostgreSQL extends OTS_Base_DB
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Creates database connection.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* Connects to PgSQL (PostgreSQL) database on given arguments.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* List of parameters for this drivers:
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* <ul>
|
|
||||||
* <li><var>host</var> - database server.</li>
|
|
||||||
* <li><var>port</var> - port (optional, also it is possible to use host:port in <var>host</var> parameter).</li>
|
|
||||||
* <li><var>database</var> - database name.</li>
|
|
||||||
* <li><var>user</var> - user login.</li>
|
|
||||||
* <li><var>password</var> - user password.</li>
|
|
||||||
* </ul>
|
|
||||||
*
|
|
||||||
* @version 0.0.6
|
|
||||||
* @param array $params Connection parameters.
|
|
||||||
* @throws PDOException On PDO operation error.
|
|
||||||
*/
|
|
||||||
public function __construct($params)
|
|
||||||
{
|
|
||||||
$user = null;
|
|
||||||
$password = null;
|
|
||||||
$dns = array();
|
|
||||||
|
|
||||||
// host:port support
|
|
||||||
if( strpos(':', $params['host']) !== false)
|
|
||||||
{
|
|
||||||
$host = explode(':', $params['host'], 2);
|
|
||||||
|
|
||||||
$params['host'] = $host[0];
|
|
||||||
$params['port'] = $host[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
if( isset($params['host']) )
|
|
||||||
{
|
|
||||||
$dns[] = 'host=' . $params['host'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if( isset($params['port']) )
|
|
||||||
{
|
|
||||||
$dns[] = 'port=' . $params['port'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if( isset($params['database']) )
|
|
||||||
{
|
|
||||||
$dns[] = 'dbname=' . $params['database'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if( isset($params['user']) )
|
|
||||||
{
|
|
||||||
$user = $params['user'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if( isset($params['password']) )
|
|
||||||
{
|
|
||||||
$password = $params['password'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if( isset($params['prefix']) )
|
|
||||||
{
|
|
||||||
$this->prefix = $params['prefix'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// PDO constructor
|
|
||||||
parent::__construct('pgsql:' . implode(' ', $dns), $user, $password);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**#@-*/
|
|
||||||
|
|
||||||
?>
|
|
@@ -490,6 +490,9 @@ class OTS_Group extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
// creates filter
|
// creates filter
|
||||||
$filter = new OTS_SQLFilter();
|
$filter = new OTS_SQLFilter();
|
||||||
$filter->compareField('group_id', (int) $this->data['id']);
|
$filter->compareField('group_id', (int) $this->data['id']);
|
||||||
|
if(fieldExist('deletion', 'players'))
|
||||||
|
$filter->compareField('deletion', 0);
|
||||||
|
else
|
||||||
$filter->compareField('deleted', 0);
|
$filter->compareField('deleted', 0);
|
||||||
|
|
||||||
// creates list object
|
// creates list object
|
||||||
|
@@ -31,9 +31,9 @@ class OTS_Groups_List implements IteratorAggregate, Countable
|
|||||||
*/
|
*/
|
||||||
public function __construct($file = '')
|
public function __construct($file = '')
|
||||||
{
|
{
|
||||||
global $cache;
|
|
||||||
|
|
||||||
if(tableExist('groups')) { // read groups from database
|
if(tableExist('groups')) { // read groups from database
|
||||||
|
global $db;
|
||||||
|
|
||||||
foreach($db->query('SELECT `id`, `name`, `access` FROM `groups`;') as $group)
|
foreach($db->query('SELECT `id`, `name`, `access` FROM `groups`;') as $group)
|
||||||
{
|
{
|
||||||
$info = array();
|
$info = array();
|
||||||
@@ -52,6 +52,8 @@ class OTS_Groups_List implements IteratorAggregate, Countable
|
|||||||
$file = $config['data_path'] . 'XML/groups.xml';
|
$file = $config['data_path'] . 'XML/groups.xml';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
global $cache;
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
if($cache->enabled())
|
if($cache->enabled())
|
||||||
{
|
{
|
||||||
@@ -135,6 +137,17 @@ class OTS_Groups_List implements IteratorAggregate, Countable
|
|||||||
throw new OutOfBoundsException();
|
throw new OutOfBoundsException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getHighestId()
|
||||||
|
{
|
||||||
|
$group_id = 0;
|
||||||
|
foreach($this->groups as $id => $group) {
|
||||||
|
if($id > $group_id)
|
||||||
|
$group_id = $id;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $group_id;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns string representation of object.
|
* Returns string representation of object.
|
||||||
*
|
*
|
||||||
|
@@ -176,7 +176,7 @@ class OTS_GuildRank extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
{
|
{
|
||||||
if( !isset($this->data['guild_id']) )
|
if( !isset($this->data['guild_id']) )
|
||||||
{
|
{
|
||||||
throw new E_OTS_NotLoaded();
|
return new OTS_Guild();
|
||||||
}
|
}
|
||||||
|
|
||||||
$guild = new OTS_Guild();
|
$guild = new OTS_Guild();
|
||||||
|
@@ -1,4 +1,21 @@
|
|||||||
<?php
|
<?php
|
||||||
|
$__load = array();
|
||||||
|
/*
|
||||||
|
'loss_experience' => NULL,
|
||||||
|
'loss_items' => NULL,
|
||||||
|
'guild_info' => NULL,
|
||||||
|
'skull_type' => NULL,
|
||||||
|
'skull_time' => NULL,
|
||||||
|
'blessings' => NULL,
|
||||||
|
'direction' => NULL,
|
||||||
|
'stamina' => NULL,
|
||||||
|
'world_id' => NULL,
|
||||||
|
'online' => NULL,
|
||||||
|
'deletion' => NULL,
|
||||||
|
'promotion' => NULL,
|
||||||
|
'marriage' => NULL
|
||||||
|
);*/
|
||||||
|
|
||||||
/**#@+
|
/**#@+
|
||||||
* @version 0.0.1
|
* @version 0.0.1
|
||||||
*/
|
*/
|
||||||
@@ -91,7 +108,6 @@ class OTS_Player extends OTS_Row_DAO
|
|||||||
POT::SKILL_SHIELD => array('value' => 0, 'tries' => 0),
|
POT::SKILL_SHIELD => array('value' => 0, 'tries' => 0),
|
||||||
POT::SKILL_FISH => array('value' => 0, 'tries' => 0)
|
POT::SKILL_FISH => array('value' => 0, 'tries' => 0)
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Magic PHP5 method.
|
* Magic PHP5 method.
|
||||||
*
|
*
|
||||||
@@ -114,34 +130,91 @@ class OTS_Player extends OTS_Row_DAO
|
|||||||
* @throws PDOException On PDO operation error.
|
* @throws PDOException On PDO operation error.
|
||||||
*/
|
*/
|
||||||
public function load($id)
|
public function load($id)
|
||||||
|
{
|
||||||
|
global $__load;
|
||||||
|
|
||||||
|
if(!isset($__load['loss_experience']))
|
||||||
{
|
{
|
||||||
$loss = '';
|
$loss = '';
|
||||||
if(fieldExist('loss_experience', 'players')) {
|
if(fieldExist('loss_experience', 'players')) {
|
||||||
$loss = ', `loss_experience`, `loss_mana`, `loss_skills`, `loss_items`';
|
$loss = ', `loss_experience`, `loss_mana`, `loss_skills`';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$__load['loss_experience'] = $loss;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($__load['loss_items']))
|
||||||
|
{
|
||||||
|
$loss_items = '';
|
||||||
|
if(fieldExist('loss_items', 'players')) {
|
||||||
|
$loss_items = ', `loss_items`, `loss_containers`';
|
||||||
|
}
|
||||||
|
|
||||||
|
$__load['loss_items'] = $loss_items;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($__load['guild_info']))
|
||||||
|
{
|
||||||
$guild_info = '';
|
$guild_info = '';
|
||||||
if(fieldExist('guildnick', 'players')) {
|
if(!tableExist('guild_members') && fieldExist('guildnick', 'players')) {
|
||||||
$guild_info = ', `guildnick`, `rank_id`';
|
$guild_info = ', `guildnick`, `rank_id`';
|
||||||
}
|
}
|
||||||
|
|
||||||
$guild_info = '';
|
$__load['guild_info'] = $guild_info;
|
||||||
if(fieldExist('guildnick', 'players')) {
|
|
||||||
$guild_info = ', `guildnick`, `rank_id`';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!isset($__load['skull_type']))
|
||||||
|
{
|
||||||
$skull_type = 'skull';
|
$skull_type = 'skull';
|
||||||
if(fieldExist('skull_type', 'players')) {
|
if(fieldExist('skull_type', 'players')) {
|
||||||
$skull_type = 'skull_type';
|
$skull_type = 'skull_type';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$__load['skull_type'] = $skull_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($__load['skull_time']))
|
||||||
|
{
|
||||||
$skull_time = 'skulltime';
|
$skull_time = 'skulltime';
|
||||||
if(fieldExist('skull_time', 'players')) {
|
if(fieldExist('skull_time', 'players')) {
|
||||||
$skull_time = 'skull_time';
|
$skull_time = 'skull_time';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$__load['skull_time'] = $skull_time;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($__load['blessings'])) {
|
||||||
|
$__load['blessings'] = fieldExist('blessings', 'players');
|
||||||
|
}
|
||||||
|
if(!isset($__load['direction'])) {
|
||||||
|
$__load['direction'] = fieldExist('direction', 'players');
|
||||||
|
}
|
||||||
|
if(!isset($__load['stamina'])) {
|
||||||
|
$__load['stamina'] = fieldExist('stamina', 'players');
|
||||||
|
}
|
||||||
|
if(!isset($__load['world_id'])) {
|
||||||
|
$__load['world_id'] = fieldExist('world_id', 'players');
|
||||||
|
}
|
||||||
|
if(!isset($__load['online'])) {
|
||||||
|
$__load['online'] = fieldExist('online', 'players');
|
||||||
|
}
|
||||||
|
if(!isset($__load['deletion'])) {
|
||||||
|
$__load['deletion'] = fieldExist('deletion', 'players');
|
||||||
|
}
|
||||||
|
if(!isset($__load['promotion'])) {
|
||||||
|
$__load['promotion'] = fieldExist('promotion', 'players');
|
||||||
|
}
|
||||||
|
if(!isset($__load['marriage'])) {
|
||||||
|
$__load['marriage'] = fieldExist('marriage', 'players');
|
||||||
|
}
|
||||||
// SELECT query on database
|
// SELECT query on database
|
||||||
$this->data = $this->db->query('SELECT `id`, `name`, `account_id`, `group_id`, `sex`, `vocation`, `experience`, `level`, `maglevel`, `health`, `healthmax`, `mana`, `manamax`, `manaspent`, `soul`, `lookbody`, `lookfeet`, `lookhead`, `looklegs`, `looktype`, `lookaddons`, `posx`, `posy`, `posz`, `cap`, `lastlogin`, `lastlogout`, `lastip`, `save`, `conditions`, `' . $skull_time . '` as `skulltime`, `' . $skull_type . '` as `skull`' . $guild_info . ', `town_id`' . $loss . ', `balance`, `blessings`, `stamina`' . (fieldExist('world_id', 'players') ? ', `world_id`' : '') . (fieldExist('online', 'players') ? ', `online`, `' : '') . ', `' . (fieldExist('deletion', 'players') ? 'deletion' : 'deleted') . '`' . (fieldExist('promotion', 'players') ? ', `promotion`' : '') . (fieldExist('marriage', 'players') ? ', `marriage`' : '') . ', `comment`, `created`, `hidden` FROM `players` WHERE `id` = ' . (int) $id)->fetch();
|
$this->data = $this->db->query('SELECT `id`, `name`, `account_id`, `group_id`, `sex`, `vocation`, `experience`, `level`, `maglevel`, `health`, `healthmax`, `mana`, `manamax`, `manaspent`, `soul`, `lookbody`, `lookfeet`, `lookhead`, `looklegs`, `looktype`' . (fieldExist('lookaddons', 'players') ? ', `lookaddons`' : '') . ', `posx`, `posy`, `posz`, `cap`, `lastlogin`, `lastlogout`, `lastip`, `save`, `conditions`, `' . $__load['skull_time'] . '` as `skulltime`, `' . $__load['skull_type'] . '` as `skull`' . $__load['guild_info'] . ', `town_id`' . $__load['loss_experience'] . $__load['loss_items'] . ', `balance`' . ($__load['blessings'] ? ', `blessings`' : '') . ($__load['direction'] ? ', `direction`' : '') . ($__load['stamina'] ? ', `stamina`' : '') . ($__load['world_id'] ? ', `world_id`' : '') . ($__load['online'] ? ', `online`' : '') . ', `' . ($__load['deletion'] ? 'deletion' : 'deleted') . '`' . ($__load['promotion'] ? ', `promotion`' : '') . ($__load['marriage'] ? ', `marriage`' : '') . ', `comment`, `created`, `hidden` FROM `players` WHERE `id` = ' . (int)$id)->fetch();
|
||||||
|
|
||||||
|
if(!isset($this->data['guildnick']) || $this->data['guildnick'])
|
||||||
|
$this->data['guildnick'] = '';
|
||||||
|
|
||||||
|
if(!isset($this->data['rank_id']) || $this->data['rank_id'] == NULL)
|
||||||
|
$this->data['rank_id'] = 0;
|
||||||
|
|
||||||
if(isset($this->data['promotion'])) {
|
if(isset($this->data['promotion'])) {
|
||||||
if((int)$this->data['promotion'] > 0)
|
if((int)$this->data['promotion'] > 0)
|
||||||
@@ -239,16 +312,54 @@ class OTS_Player extends OTS_Row_DAO
|
|||||||
$skull_time = 'skull_time';
|
$skull_time = 'skull_time';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!isset($this->data['loss_experience']))
|
||||||
|
$this->data['loss_experience'] = 100;
|
||||||
|
|
||||||
|
if(!isset($this->data['loss_mana']))
|
||||||
|
$this->data['loss_mana'] = 100;
|
||||||
|
|
||||||
|
if(!isset($this->data['loss_skills']))
|
||||||
|
$this->data['loss_skills'] = 100;
|
||||||
|
|
||||||
|
if(!isset($this->data['loss_items']))
|
||||||
|
$this->data['loss_items'] = 10;
|
||||||
|
|
||||||
|
if(!isset($this->data['loss_containers']))
|
||||||
|
$this->data['loss_containers'] = 100;
|
||||||
|
|
||||||
|
if(!isset($this->data['guildnick']))
|
||||||
|
$this->data['guildnick'] = '';
|
||||||
|
|
||||||
|
if(!isset($this->data['rank_id']))
|
||||||
|
$this->data['rank_id'] = 0;
|
||||||
|
|
||||||
|
if(!isset($this->data['promotion']))
|
||||||
|
$this->data['promotion'] = 0;
|
||||||
|
|
||||||
|
if(!isset($this->data['direction']))
|
||||||
|
$this->data['direction'] = 0;
|
||||||
|
|
||||||
|
if(!isset($this->data['conditions']))
|
||||||
|
$this->data['conditions'] = '';
|
||||||
|
|
||||||
|
if(!isset($this->data['town_id']))
|
||||||
|
$this->data['town_id'] = 1;
|
||||||
|
|
||||||
// updates existing player
|
// updates existing player
|
||||||
if( isset($this->data['id']) )
|
if( isset($this->data['id']) )
|
||||||
{
|
{
|
||||||
$loss = '';
|
$loss = '';
|
||||||
if(fieldExist('loss_experience', 'players')) {
|
if(fieldExist('loss_experience', 'players')) {
|
||||||
$loss = ', `loss_experience` = ' . $this->data['loss_experience'] . ', `loss_mana` = ' . $this->data['loss_mana'] . ', `loss_skills` = ' . $this->data['loss_skills'] . ', `loss_items` = ' . $this->data['loss_items'];
|
$loss = ', `loss_experience` = ' . $this->data['loss_experience'] . ', `loss_mana` = ' . $this->data['loss_mana'] . ', `loss_skills` = ' . $this->data['loss_skills'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$loss_items = '';
|
||||||
|
if(fieldExist('loss_items', 'players')) {
|
||||||
|
$loss_items = ', `loss_items` = ' . $this->data['loss_items'] . ', `loss_containers` = ' . $this->data['loss_containers'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$guild_info = '';
|
$guild_info = '';
|
||||||
if(fieldExist('guildnick', 'players')) {
|
if(!tableExist('guild_members') && fieldExist('guildnick', 'players')) {
|
||||||
$guild_info = ', `guildnick` = ' . $this->db->quote($this->data['guildnick']) . ', ' . $this->db->fieldName('rank_id') . ' = ' . $this->data['rank_id'];
|
$guild_info = ', `guildnick` = ' . $this->db->quote($this->data['guildnick']) . ', ' . $this->db->fieldName('rank_id') . ' = ' . $this->data['rank_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -257,8 +368,23 @@ class OTS_Player extends OTS_Row_DAO
|
|||||||
$direction = ', `direction` = ' . $this->db->quote($this->data['direction']);
|
$direction = ', `direction` = ' . $this->db->quote($this->data['direction']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$blessings = '';
|
||||||
|
if(fieldExist('blessings', 'players')) {
|
||||||
|
$blessings = ', `blessings` = ' . $this->db->quote($this->data['blessings']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$stamina = '';
|
||||||
|
if(fieldExist('stamina', 'players')) {
|
||||||
|
$stamina = ', `stamina` = ' . $this->db->quote($this->data['stamina']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$lookaddons = '';
|
||||||
|
if(fieldExist('lookaddons', 'players')) {
|
||||||
|
$lookaddons = ', `lookaddons` = ' . $this->db->quote($this->data['lookaddons']);
|
||||||
|
}
|
||||||
|
|
||||||
// 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'] . ', ' . $this->db->fieldName('lookaddons') . ' = ' . $this->data['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 . ', ' . $this->db->fieldName('balance') . ' = ' . $this->data['balance'] . ', ' . $this->db->fieldName('blessings') . ' = ' . $this->data['blessings'] . ', ' . $this->db->fieldName('stamina') . ' = ' . $this->data['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->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
|
||||||
@@ -266,13 +392,20 @@ class OTS_Player extends OTS_Row_DAO
|
|||||||
$loss = '';
|
$loss = '';
|
||||||
$loss_data = '';
|
$loss_data = '';
|
||||||
if(fieldExist('loss_experience', 'players')) {
|
if(fieldExist('loss_experience', 'players')) {
|
||||||
$loss = ', `loss_experience`, `loss_mana`, `loss_skills`, `loss_items`';
|
$loss = ', `loss_experience`, `loss_mana`, `loss_skills`';
|
||||||
$loss_data = ', ' . $this->data['loss_experience'] . ', ' . $this->data['loss_mana'] . ', ' . $this->data['loss_skills'] . ', ' . $this->data['loss_items'];
|
$loss_data = ', ' . $this->data['loss_experience'] . ', ' . $this->data['loss_mana'] . ', ' . $this->data['loss_skills'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$loss_items = '';
|
||||||
|
$loss_items_data = '';
|
||||||
|
if(fieldExist('loss_items', 'players')) {
|
||||||
|
$loss_items = ', `loss_items`, `loss_containers`';
|
||||||
|
$loss_items_data = ', ' . $this->data['loss_items'] . ', ' . $this->data['loss_containers'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$guild_info = '';
|
$guild_info = '';
|
||||||
$guild_info_data = '';
|
$guild_info_data = '';
|
||||||
if(fieldExist('guildnick', 'players')) {
|
if(!tableExist('guild_members') && fieldExist('guildnick', 'players')) {
|
||||||
$guild_info = ', `guildnick`, `rank_id`';
|
$guild_info = ', `guildnick`, `rank_id`';
|
||||||
$guild_info_data = ', ' . $this->db->quote($this->data['guildnick']) . ', ' . $this->data['rank_id'];
|
$guild_info_data = ', ' . $this->db->quote($this->data['guildnick']) . ', ' . $this->data['rank_id'];
|
||||||
}
|
}
|
||||||
@@ -287,12 +420,33 @@ class OTS_Player extends OTS_Row_DAO
|
|||||||
$direction = '';
|
$direction = '';
|
||||||
$direction_data = '';
|
$direction_data = '';
|
||||||
if(fieldExist('direction', 'players')) {
|
if(fieldExist('direction', 'players')) {
|
||||||
$direction = ', `balance`';
|
$direction = ', `direction`';
|
||||||
$direction_data = ', ' . $this->data['balance'];
|
$direction_data = ', ' . $this->data['direction'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$blessings = '';
|
||||||
|
$blessings_data = '';
|
||||||
|
if(fieldExist('blessings', 'players')) {
|
||||||
|
$blessings = ', `blessings`';
|
||||||
|
$blessings_data = ', ' . $this->data['blessings'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$stamina = '';
|
||||||
|
$stamina_data = '';
|
||||||
|
if(fieldExist('stamina', 'players')) {
|
||||||
|
$stamina = ', `stamina`';
|
||||||
|
$stamina_data = ', ' . $this->data['stamina'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$lookaddons = '';
|
||||||
|
$lookaddons_data = '';
|
||||||
|
if(fieldExist('lookaddons', 'players')) {
|
||||||
|
$lookaddons = ', `lookaddons`';
|
||||||
|
$lookaddons_data = ', ' . $this->data['lookaddons'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// INSERT query on database
|
// INSERT query on database
|
||||||
$this->db->query('INSERT INTO ' . $this->db->tableName('players') . ' (' . $this->db->fieldName('name') . ', ' . $this->db->fieldName('account_id') . ', ' . $this->db->fieldName('group_id') . ', ' . $this->db->fieldName('sex') . ', ' . $this->db->fieldName('vocation') . ', ' . $this->db->fieldName('experience') . ', ' . $this->db->fieldName('level') . ', ' . $this->db->fieldName('maglevel') . ', ' . $this->db->fieldName('health') . ', ' . $this->db->fieldName('healthmax') . ', ' . $this->db->fieldName('mana') . ', ' . $this->db->fieldName('manamax') . ', ' . $this->db->fieldName('manaspent') . ', ' . $this->db->fieldName('soul') . ', ' . $this->db->fieldName('lookbody') . ', ' . $this->db->fieldName('lookfeet') . ', ' . $this->db->fieldName('lookhead') . ', ' . $this->db->fieldName('looklegs') . ', ' . $this->db->fieldName('looktype') . ', ' . $this->db->fieldName('lookaddons') . ', ' . $this->db->fieldName('posx') . ', ' . $this->db->fieldName('posy') . ', ' . $this->db->fieldName('posz') . ', ' . $this->db->fieldName('cap') . ', `lastlogin`, `lastlogout`, ' . $this->db->fieldName('lastip') . ', ' . $this->db->fieldName('save') . ', ' . $this->db->fieldName('conditions') . ', `' . $skull_time . '`, `' . $skull_type . '`' . $guild_info . ', ' . $this->db->fieldName('town_id') . $loss . ', `balance`, `blessings`, `stamina`' . $direction . ', ' . $this->db->fieldName('created') . $promotion . ') VALUES (' . $this->db->quote($this->data['name']) . ', ' . $this->data['account_id'] . ', ' . $this->data['group_id'] . ', ' . $this->data['sex'] . ', ' . $this->data['vocation'] . ', ' . $this->data['experience'] . ', ' . $this->data['level'] . ', ' . $this->data['maglevel'] . ', ' . $this->data['health'] . ', ' . $this->data['healthmax'] . ', ' . $this->data['mana'] . ', ' . $this->data['manamax'] . ', ' . $this->data['manaspent'] . ', ' . $this->data['soul'] . ', ' . $this->data['lookbody'] . ', ' . $this->data['lookfeet'] . ', ' . $this->data['lookhead'] . ', ' . $this->data['looklegs'] . ', ' . $this->data['looktype'] . ', ' . $this->data['lookaddons'] . ', ' . $this->data['posx'] . ', ' . $this->data['posy'] . ', ' . $this->data['posz'] . ', ' . $this->data['cap'] . ', ' . $this->data['lastlogin'] . ', ' . $this->data['lastlogout'] . ', ' . $this->data['lastip'] . ', ' . (int) $this->data['save'] . ', ' . $this->db->quote($this->data['conditions']) . ', ' . $this->data['skulltime'] . ', ' . (int) $this->data['skull'] . $guild_info_data . ', ' . $this->data['town_id'] . $loss_data . ', ' . $this->data['balance'] . ', ' . $this->data['blessings'] . ', ' . $this->data['stamina'] . $direction_data . ', ' . time() . $promotion_data . ')');
|
$this->db->query('INSERT INTO ' . $this->db->tableName('players') . ' (' . $this->db->fieldName('name') . ', ' . $this->db->fieldName('account_id') . ', ' . $this->db->fieldName('group_id') . ', ' . $this->db->fieldName('sex') . ', ' . $this->db->fieldName('vocation') . ', ' . $this->db->fieldName('experience') . ', ' . $this->db->fieldName('level') . ', ' . $this->db->fieldName('maglevel') . ', ' . $this->db->fieldName('health') . ', ' . $this->db->fieldName('healthmax') . ', ' . $this->db->fieldName('mana') . ', ' . $this->db->fieldName('manamax') . ', ' . $this->db->fieldName('manaspent') . ', ' . $this->db->fieldName('soul') . ', ' . $this->db->fieldName('lookbody') . ', ' . $this->db->fieldName('lookfeet') . ', ' . $this->db->fieldName('lookhead') . ', ' . $this->db->fieldName('looklegs') . ', ' . $this->db->fieldName('looktype') . $lookaddons . ', ' . $this->db->fieldName('posx') . ', ' . $this->db->fieldName('posy') . ', ' . $this->db->fieldName('posz') . ', ' . $this->db->fieldName('cap') . ', `lastlogin`, `lastlogout`, ' . $this->db->fieldName('lastip') . ', ' . $this->db->fieldName('save') . ', ' . $this->db->fieldName('conditions') . ', `' . $skull_time . '`, `' . $skull_type . '`' . $guild_info . ', ' . $this->db->fieldName('town_id') . $loss . $loss_items . ', `balance`' . $blessings . $stamina . $direction . ', ' . $this->db->fieldName('created') . $promotion . ') VALUES (' . $this->db->quote($this->data['name']) . ', ' . $this->data['account_id'] . ', ' . $this->data['group_id'] . ', ' . $this->data['sex'] . ', ' . $this->data['vocation'] . ', ' . $this->data['experience'] . ', ' . $this->data['level'] . ', ' . $this->data['maglevel'] . ', ' . $this->data['health'] . ', ' . $this->data['healthmax'] . ', ' . $this->data['mana'] . ', ' . $this->data['manamax'] . ', ' . $this->data['manaspent'] . ', ' . $this->data['soul'] . ', ' . $this->data['lookbody'] . ', ' . $this->data['lookfeet'] . ', ' . $this->data['lookhead'] . ', ' . $this->data['looklegs'] . ', ' . $this->data['looktype'] . $lookaddons_data . ', ' . $this->data['posx'] . ', ' . $this->data['posy'] . ', ' . $this->data['posz'] . ', ' . $this->data['cap'] . ', ' . $this->data['lastlogin'] . ', ' . $this->data['lastlogout'] . ', ' . $this->data['lastip'] . ', ' . (int) $this->data['save'] . ', ' . $this->db->quote($this->data['conditions']) . ', ' . $this->data['skulltime'] . ', ' . (int) $this->data['skull'] . $guild_info_data . ', ' . $this->data['town_id'] . $loss_data . $loss_items_data . ', ' . $this->data['balance'] . $blessings_data . $stamina_data . $direction_data . ', ' . time() . $promotion_data . ')');
|
||||||
// ID of new group
|
// ID of new group
|
||||||
$this->data['id'] = $this->db->lastInsertId();
|
$this->data['id'] = $this->db->lastInsertId();
|
||||||
}
|
}
|
||||||
@@ -454,6 +608,11 @@ class OTS_Player extends OTS_Row_DAO
|
|||||||
$this->data['account_id'] = $account->getId();
|
$this->data['account_id'] = $account->getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setAccountId($account_id)
|
||||||
|
{
|
||||||
|
$this->data['account_id'] = (int)$account_id;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns group of this player.
|
* Returns group of this player.
|
||||||
*
|
*
|
||||||
@@ -1672,7 +1831,11 @@ class OTS_Player extends OTS_Row_DAO
|
|||||||
*/
|
*/
|
||||||
public function loadRank()
|
public function loadRank()
|
||||||
{
|
{
|
||||||
$ranks = $this->db->query('SELECT `rank_id`, `nick` FROM `guild_membership` WHERE `player_id` = ' . $this->db->quote($this->getID()))->fetch();
|
$table = 'guild_membership';
|
||||||
|
if(tableExist('guild_members'))
|
||||||
|
$table = 'guild_members';
|
||||||
|
|
||||||
|
$ranks = $this->db->query('SELECT `rank_id`, `nick` FROM `' . $table . '` WHERE `player_id` = ' . $this->db->quote($this->getID()))->fetch();
|
||||||
if($ranks)
|
if($ranks)
|
||||||
{
|
{
|
||||||
$this->data['rank_id'] = new OTS_GuildRank($ranks['rank_id']);
|
$this->data['rank_id'] = new OTS_GuildRank($ranks['rank_id']);
|
||||||
@@ -1707,6 +1870,8 @@ class OTS_Player extends OTS_Row_DAO
|
|||||||
$this->data['guildnick'] = (string) $guildnick;
|
$this->data['guildnick'] = (string) $guildnick;
|
||||||
if(fieldExist('guildnick', 'players'))
|
if(fieldExist('guildnick', 'players'))
|
||||||
$this->db->query('UPDATE `players` SET `guildnick` = ' . $this->db->quote($this->data['guildnick']) . ' WHERE `id` = ' . $this->getId());
|
$this->db->query('UPDATE `players` SET `guildnick` = ' . $this->db->quote($this->data['guildnick']) . ' WHERE `id` = ' . $this->getId());
|
||||||
|
else if(tableExist('guild_members'))
|
||||||
|
$this->db->query('UPDATE `guild_members` SET `nick` = ' . $this->db->quote($this->data['guildnick']) . ' WHERE `player_id` = ' . $this->getId());
|
||||||
else
|
else
|
||||||
$this->db->query('UPDATE `guild_membership` SET `nick` = ' . $this->db->quote($this->data['guildnick']) . ' WHERE `player_id` = ' . $this->getId());
|
$this->db->query('UPDATE `guild_membership` SET `nick` = ' . $this->db->quote($this->data['guildnick']) . ' WHERE `player_id` = ' . $this->getId());
|
||||||
}
|
}
|
||||||
@@ -1746,7 +1911,11 @@ class OTS_Player extends OTS_Row_DAO
|
|||||||
$query = $this->db->query('SELECT `rank_id` FROM `players` WHERE `id`= ' . $this->data['id'] . ';')->fetch();
|
$query = $this->db->query('SELECT `rank_id` FROM `players` WHERE `id`= ' . $this->data['id'] . ';')->fetch();
|
||||||
$rank_id = $query['rank_id'];
|
$rank_id = $query['rank_id'];
|
||||||
} else {
|
} else {
|
||||||
$query = $this->db->query('SELECT `rank_id` FROM `guild_membership` WHERE `player_id`= ' . $this->data['id'] . ' LIMIT 1;');
|
$table = 'guild_membership';
|
||||||
|
if(tableExist('guild_members'))
|
||||||
|
$table = 'guild_members';
|
||||||
|
|
||||||
|
$query = $this->db->query('SELECT `rank_id` FROM `' . $table . '` WHERE `player_id`= ' . $this->data['id'] . ' LIMIT 1;');
|
||||||
if($query->rowCount() == 1) {
|
if($query->rowCount() == 1) {
|
||||||
$query = $query->fetch();
|
$query = $query->fetch();
|
||||||
$rank_id = $query['rank_id'];
|
$rank_id = $query['rank_id'];
|
||||||
@@ -1768,8 +1937,17 @@ class OTS_Player extends OTS_Row_DAO
|
|||||||
{
|
{
|
||||||
if( isset($rank_id) && isset($guild)) {
|
if( isset($rank_id) && isset($guild)) {
|
||||||
if($rank_id == 0) {
|
if($rank_id == 0) {
|
||||||
|
if(tableExist('guild_membership')) {
|
||||||
$this->db->query('DELETE FROM `guild_membership` WHERE `player_id` = ' . $this->getId());
|
$this->db->query('DELETE FROM `guild_membership` WHERE `player_id` = ' . $this->getId());
|
||||||
}
|
}
|
||||||
|
else if(tableExist('guild_members')) {
|
||||||
|
$this->db->query('DELETE FROM `guild_members` WHERE `player_id` = ' . $this->getId());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->data['rank_id'] = 0;
|
||||||
|
$this->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
if(tableExist('guild_membership')) {
|
if(tableExist('guild_membership')) {
|
||||||
$query = $this->db->query('SELECT `player_id` FROM `guild_membership` WHERE `player_id` = ' . $this->getId() . ' LIMIT 1;');
|
$query = $this->db->query('SELECT `player_id` FROM `guild_membership` WHERE `player_id` = ' . $this->getId() . ' LIMIT 1;');
|
||||||
@@ -1779,6 +1957,14 @@ class OTS_Player extends OTS_Row_DAO
|
|||||||
$this->db->query('INSERT INTO `guild_membership` (`player_id`, `guild_id`, `rank_id`, `nick`) VALUES (' . $this->db->quote($this->getId()) . ', ' . $this->db->quote($guild) . ', ' . $this->db->quote($rank_id) . ', ' . $this->db->quote('') . ')');
|
$this->db->query('INSERT INTO `guild_membership` (`player_id`, `guild_id`, `rank_id`, `nick`) VALUES (' . $this->db->quote($this->getId()) . ', ' . $this->db->quote($guild) . ', ' . $this->db->quote($rank_id) . ', ' . $this->db->quote('') . ')');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(tableExist('guild_members')) {
|
||||||
|
$query = $this->db->query('SELECT `player_id` FROM `guild_members` WHERE `player_id` = ' . $this->getId() . ' LIMIT 1;');
|
||||||
|
if($query->rowCount() == 1)
|
||||||
|
$this->db->query('UPDATE `guild_members` SET `rank_id` = ' . (int)$rank_id . ' WHERE `player_id` = ' . $this->getId());
|
||||||
|
else {
|
||||||
|
$this->db->query('INSERT INTO `guild_members` (`player_id`, `rank_id`, `nick`) VALUES (' . $this->db->quote($this->getId()) . ', ' . $this->db->quote($rank_id) . ', ' . $this->db->quote('') . ')');
|
||||||
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
$this->data['rank_id'] = (int) $rank_id;
|
$this->data['rank_id'] = (int) $rank_id;
|
||||||
$this->save();
|
$this->save();
|
||||||
@@ -1975,6 +2161,20 @@ class OTS_Player extends OTS_Row_DAO
|
|||||||
$this->data['loss_items'] = (int) $loss_items;
|
$this->data['loss_items'] = (int) $loss_items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getLossContainers()
|
||||||
|
{
|
||||||
|
if( !isset($this->data['loss_containers']) )
|
||||||
|
{
|
||||||
|
throw new E_OTS_NotLoaded();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->data['loss_items'];
|
||||||
|
}
|
||||||
|
public function setLossContainers($loss_containers)
|
||||||
|
{
|
||||||
|
$this->data['loss_containers'] = (int) $loss_containers;
|
||||||
|
}
|
||||||
|
|
||||||
public function getBlessings()
|
public function getBlessings()
|
||||||
{
|
{
|
||||||
if( !isset($this->data['blessings']) )
|
if( !isset($this->data['blessings']) )
|
||||||
@@ -3086,6 +3286,9 @@ class OTS_Player extends OTS_Row_DAO
|
|||||||
case 'lossItems':
|
case 'lossItems':
|
||||||
return $this->getLossItems();
|
return $this->getLossItems();
|
||||||
|
|
||||||
|
case 'lossContainers':
|
||||||
|
return $this->getLossContainers();
|
||||||
|
|
||||||
case 'balance':
|
case 'balance':
|
||||||
return $this->getBalance();
|
return $this->getBalance();
|
||||||
|
|
||||||
|
@@ -75,7 +75,10 @@ class OTS_ServerInfo
|
|||||||
fwrite($socket, $packet);
|
fwrite($socket, $packet);
|
||||||
|
|
||||||
// reads respond
|
// reads respond
|
||||||
$data = stream_get_contents($socket);
|
//$data = stream_get_contents($socket);
|
||||||
|
$data = '';
|
||||||
|
while (!feof($socket))
|
||||||
|
$data .= fgets($socket, 1024);
|
||||||
|
|
||||||
// closing connection to current server
|
// closing connection to current server
|
||||||
fclose($socket);
|
fclose($socket);
|
||||||
@@ -121,7 +124,9 @@ class OTS_ServerInfo
|
|||||||
{
|
{
|
||||||
// loads respond XML
|
// loads respond XML
|
||||||
$info = new OTS_InfoRespond();
|
$info = new OTS_InfoRespond();
|
||||||
$info->loadXML( $status->getBuffer() );
|
if(!$info->loadXML( utf8_encode($status->getBuffer())))
|
||||||
|
return false;
|
||||||
|
|
||||||
return $info;
|
return $info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
@@ -14,6 +14,9 @@ $locale['next'] = 'Next';
|
|||||||
$locale['on'] = 'On';
|
$locale['on'] = 'On';
|
||||||
$locale['off'] = 'Off';
|
$locale['off'] = 'Off';
|
||||||
|
|
||||||
|
$locale['loaded'] = 'Loaded';
|
||||||
|
$locale['not_loaded'] = 'Not loaded';
|
||||||
|
|
||||||
$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.';
|
$locale['already_installed'] = 'MyAAC has been already installed. Please delete <b>install/<b/> directory.';
|
||||||
|
|
||||||
@@ -32,16 +35,13 @@ $locale['step_requirements_title'] = 'Requirements check';
|
|||||||
$locale['step_requirements_php_version'] = 'PHP Version';
|
$locale['step_requirements_php_version'] = 'PHP Version';
|
||||||
$locale['step_requirements_write_perms'] = 'Write permissions';
|
$locale['step_requirements_write_perms'] = 'Write permissions';
|
||||||
$locale['step_requirements_failed'] = 'Installation will be disabled until these requirements will be passed.</b><br/>For more informations see <b>README</b> file.';
|
$locale['step_requirements_failed'] = 'Installation will be disabled until these requirements will be passed.</b><br/>For more informations see <b>README</b> file.';
|
||||||
|
$locale['step_requirements_extension'] = '$EXTENSION$ PHP extension';
|
||||||
|
|
||||||
// config
|
// config
|
||||||
$locale['step_config'] = 'Configuration';
|
$locale['step_config'] = 'Configuration';
|
||||||
$locale['step_config_title'] = 'Basic configuration';
|
$locale['step_config_title'] = 'Basic configuration';
|
||||||
$locale['step_config_server_path'] = 'Server path';
|
$locale['step_config_server_path'] = 'Server path';
|
||||||
$locale['step_config_server_path_desc'] = 'Path to your TFS main directory, where you have config.lua located.';
|
$locale['step_config_server_path_desc'] = 'Path to your TFS main directory, where you have config.lua located.';
|
||||||
$locale['step_config_account'] = 'Admin account name';
|
|
||||||
$locale['step_config_account_desc'] = 'Name of your admin account, which will be used to login to website and server.';
|
|
||||||
$locale['step_config_password'] = 'Admin account password';
|
|
||||||
$locale['step_config_password_desc'] = 'Password to your admin account.';
|
|
||||||
|
|
||||||
$locale['step_config_mail_admin'] = 'Admin E-Mail';
|
$locale['step_config_mail_admin'] = 'Admin E-Mail';
|
||||||
$locale['step_config_mail_admin_desc'] = 'Address where emails from contact form will be delivered, for example <i>admin@gmail.com</i>';
|
$locale['step_config_mail_admin_desc'] = 'Address where emails from contact form will be delivered, for example <i>admin@gmail.com</i>';
|
||||||
@@ -58,8 +58,9 @@ $locale['step_database_title'] = 'Import MySQL schema';
|
|||||||
$locale['step_database_importing'] = 'Your database is MySQL. Importing schema now...';
|
$locale['step_database_importing'] = 'Your database is MySQL. Importing schema now...';
|
||||||
$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 file. Is your server path correct? Go back and check again.';
|
$locale['step_database_error_config'] = 'Cannot find config 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_only_mysql'] = 'This AAC supports only MySQL. From your config file it seems that your OTS is using: $DATABASE_TYPE$ database. Please change your database to MySQL and then follow the installation again.';
|
$locale['step_database_error_only_mysql'] = 'This AAC supports only MySQL. From your config file it seems that your OTS is using: $DATABASE_TYPE$ database. Please change your database to MySQL and then follow the installation again.';
|
||||||
$locale['step_database_error_table'] = 'Table $TABLE$ doesn\'t exist. Please import your OTS database first.';
|
$locale['step_database_error_table'] = 'Table $TABLE$ doesn\'t exist. Please import your OTS database schema first.';
|
||||||
$locale['step_database_error_table_exist'] = 'Table $TABLE$ already exist. Seems AAC is already installed. Skipping importing MySQL schema..';
|
$locale['step_database_error_table_exist'] = 'Table $TABLE$ already exist. Seems AAC is already installed. Skipping importing MySQL schema..';
|
||||||
$locale['step_database_error_schema'] = 'Error while importing schema:';
|
$locale['step_database_error_schema'] = 'Error while importing schema:';
|
||||||
$locale['step_database_success_schema'] = 'Succesfully installed $PREFIX$ tables.';
|
$locale['step_database_success_schema'] = 'Succesfully installed $PREFIX$ tables.';
|
||||||
@@ -70,6 +71,16 @@ $locale['step_database_changing_field'] = 'Changing $FIELD$ to $FIELD_NEW$...';
|
|||||||
$locale['step_database_imported_players'] = 'Imported player samples...';
|
$locale['step_database_imported_players'] = 'Imported player samples...';
|
||||||
$locale['step_database_created_account'] = 'Created admin account...';
|
$locale['step_database_created_account'] = 'Created admin account...';
|
||||||
|
|
||||||
|
// admin account
|
||||||
|
$locale['step_admin'] = 'Admin Account';
|
||||||
|
$locale['step_admin_title'] = 'Create Admin Account';
|
||||||
|
$locale['step_admin_account'] = 'Admin account name';
|
||||||
|
$locale['step_admin_account_desc'] = 'Name of your admin account, which will be used to login to website and server.';
|
||||||
|
$locale['step_admin_account_id'] = 'Admin account id';
|
||||||
|
$locale['step_admin_account_id_desc'] = 'ID of your admin account, which will be used to login to website and server.';
|
||||||
|
$locale['step_admin_password'] = 'Admin account password';
|
||||||
|
$locale['step_admin_password_desc'] = 'Password to your admin account.';
|
||||||
|
|
||||||
// finish
|
// finish
|
||||||
$locale['step_finish_admin_panel'] = 'Admin Panel';
|
$locale['step_finish_admin_panel'] = 'Admin Panel';
|
||||||
$locale['step_finish_homepage'] = 'homepage';
|
$locale['step_finish_homepage'] = 'homepage';
|
||||||
|
@@ -14,6 +14,9 @@ $locale['next'] = 'Następny';
|
|||||||
$locale['on'] = 'Włączone';
|
$locale['on'] = 'Włączone';
|
||||||
$locale['off'] = 'Wyłączone';
|
$locale['off'] = 'Wyłączone';
|
||||||
|
|
||||||
|
$locale['loaded'] = 'Załadowane';
|
||||||
|
$locale['not_loaded'] = 'Nie załadowane';
|
||||||
|
|
||||||
$locale['please_fill_all'] = 'Proszę wypełnić wszystkie pola!';
|
$locale['please_fill_all'] = 'Proszę wypełnić wszystkie pola!';
|
||||||
$locale['already_installed'] = 'MyAAC został już zainstalowany. Proszę usunąć katalog <b>install/</b>.';
|
$locale['already_installed'] = 'MyAAC został już zainstalowany. Proszę usunąć katalog <b>install/</b>.';
|
||||||
|
|
||||||
@@ -32,6 +35,7 @@ $locale['step_requirements_title'] = 'Sprawdzanie wymagań';
|
|||||||
$locale['step_requirements_php_version'] = 'Wersja PHP';
|
$locale['step_requirements_php_version'] = 'Wersja PHP';
|
||||||
$locale['step_requirements_write_perms'] = 'Uprawnienia do zapisu';
|
$locale['step_requirements_write_perms'] = 'Uprawnienia do zapisu';
|
||||||
$locale['step_requirements_failed'] = 'Instalacja zostanie zablokowana dopóki te wymagania nie zostaną spełnione.</b><br/>Po więcej informacji zasięgnij do pliku <b>README</b>.';
|
$locale['step_requirements_failed'] = 'Instalacja zostanie zablokowana dopóki te wymagania nie zostaną spełnione.</b><br/>Po więcej informacji zasięgnij do pliku <b>README</b>.';
|
||||||
|
$locale['step_requirements_extension'] = 'Rozszerzenie PHP - $EXTENSION$';
|
||||||
|
|
||||||
// config
|
// config
|
||||||
$locale['step_config'] = 'Konfiguracja';
|
$locale['step_config'] = 'Konfiguracja';
|
||||||
@@ -59,7 +63,7 @@ $locale['step_database_importing'] = 'Twoja baza to MySQL. Importowanie schematu
|
|||||||
$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. Jest Twoja ścieżka do katalogu serwera poprawna? Wróć się i sprawdź ponownie.';
|
$locale['step_database_error_config'] = 'Nie można znaleźć pliku config. Jest Twoja ścieżka do katalogu serwera poprawna? Wróć się i sprawdź ponownie.';
|
||||||
$locale['step_database_error_only_mysql'] = 'Ten AAC wspiera tylko bazy danych MySQL. Z Twojego pliku config wynika, że Twój serwera używa bazy: $DATABASE_TYPE$. Proszę zmienić typ bazy na MySQL i ponownie przystąpić do instalacji.';
|
$locale['step_database_error_only_mysql'] = 'Ten AAC wspiera tylko bazy danych MySQL. Z Twojego pliku config wynika, że Twój serwera używa bazy: $DATABASE_TYPE$. Proszę zmienić typ bazy na MySQL i ponownie przystąpić do instalacji.';
|
||||||
$locale['step_database_error_table'] = 'Tabela $TABLE$ nie istnieje. Proszę najpierw zaimportować bazę danych serwera OTS.';
|
$locale['step_database_error_table'] = 'Tabela $TABLE$ nie istnieje. Proszę najpierw zaimportować schemat bazy danych serwera OTS.';
|
||||||
$locale['step_database_error_table_exist'] = 'Tabela $TABLE$ już istnieje. Wygląda na to, że AAC został już zainstalowany. Schemat MySQL nie zostanie zaimportowany..';
|
$locale['step_database_error_table_exist'] = 'Tabela $TABLE$ już istnieje. Wygląda na to, że AAC został już zainstalowany. Schemat MySQL nie zostanie zaimportowany..';
|
||||||
$locale['step_database_error_schema'] = 'Błąd podczas importowania struktury bazy danych:';
|
$locale['step_database_error_schema'] = 'Błąd podczas importowania struktury bazy danych:';
|
||||||
$locale['step_database_success_schema'] = 'Pomyślnie zainstalowano tabele $PREFIX$.';
|
$locale['step_database_success_schema'] = 'Pomyślnie zainstalowano tabele $PREFIX$.';
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
@@ -58,7 +58,10 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
$account_logged = $ots->createObject('Account');
|
$account_logged = $ots->createObject('Account');
|
||||||
|
if(USE_ACCOUNT_NAME)
|
||||||
$account_logged->find($login_account);
|
$account_logged->find($login_account);
|
||||||
|
else
|
||||||
|
$account_logged->load($login_account);
|
||||||
|
|
||||||
$config_salt_enabled = fieldExist('salt', 'accounts');
|
$config_salt_enabled = fieldExist('salt', 'accounts');
|
||||||
if($account_logged->isLoaded() && encrypt(($config_salt_enabled ? $account_logged->getCustomField('salt') : '') . $login_password) == $account_logged->getPassword()
|
if($account_logged->isLoaded() && encrypt(($config_salt_enabled ? $account_logged->getCustomField('salt') : '') . $login_password) == $account_logged->getPassword()
|
||||||
@@ -70,9 +73,6 @@ else
|
|||||||
if(isset($_POST['remember_me']))
|
if(isset($_POST['remember_me']))
|
||||||
$_SESSION['remember_me'] = true;
|
$_SESSION['remember_me'] = true;
|
||||||
|
|
||||||
//if(isset($_POST['admin']))
|
|
||||||
// $_SESSION['admin'] = true;
|
|
||||||
|
|
||||||
$logged = true;
|
$logged = true;
|
||||||
|
|
||||||
$logged_flags = $account_logged->getWebFlags();
|
$logged_flags = $account_logged->getWebFlags();
|
||||||
|
16
system/migrations/1.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
$db->query("ALTER TABLE `" . TABLE_PREFIX . "account_actions` MODIFY `ip` INT(11) NOT NULL DEFAULT 0;");
|
||||||
|
$db->query("ALTER TABLE `" . TABLE_PREFIX . "account_actions` MODIFY `date` INT(11) NOT NULL DEFAULT 0;");
|
||||||
|
$db->query("ALTER TABLE `" . TABLE_PREFIX . "account_actions` MODIFY `action` VARCHAR(255) NOT NULL DEFAULT '';");
|
||||||
|
$db->query("
|
||||||
|
CREATE TABLE `myaac_hooks`
|
||||||
|
(
|
||||||
|
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` VARCHAR(30) NOT NULL DEFAULT '',
|
||||||
|
`type` INT(2) NOT NULL DEFAULT 0,
|
||||||
|
`file` VARCHAR(100) NOT NULL,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE = MyISAM;
|
||||||
|
");
|
||||||
|
|
||||||
|
?>
|
6
system/migrations/2.php
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
$db->query("ALTER TABLE `" . TABLE_PREFIX . "faq` MODIFY `answer` VARCHAR(1020) 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 `body` TEXT NOT NULL DEFAULT '';");
|
||||||
|
?>
|
3
system/migrations/3.php
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<?php
|
||||||
|
$db->query("ALTER TABLE `" . TABLE_PREFIX . "account_actions` ADD `ipv6` BINARY(16) NOT NULL DEFAULT 0;");
|
||||||
|
?>
|
@@ -5,7 +5,7 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
* @author Gesior <jerzyskalski@wp.pl>
|
* @author Gesior <jerzyskalski@wp.pl>
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
@@ -80,7 +80,7 @@ Please enter your account name and your password.<br/><a href="?subtopic=createa
|
|||||||
<table style="width:100%;" >
|
<table style="width:100%;" >
|
||||||
<tr>
|
<tr>
|
||||||
<td class="LabelV" >
|
<td class="LabelV" >
|
||||||
<span<?php echo (isset($errors[0]) ? ' class="red"' : ''); ?>>Account Name:</span>
|
<span<?php echo (isset($errors[0]) ? ' class="red"' : ''); ?>>Account <?php echo (USE_ACCOUNT_NAME ? 'Name' : 'Number'); ?>:</span>
|
||||||
</td>
|
</td>
|
||||||
<td style="width:100%;" ><input type="password" name="account_login" id="account-name-input" size="30" maxlength="30" ></td>
|
<td style="width:100%;" ><input type="password" name="account_login" id="account-name-input" size="30" maxlength="30" ></td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -132,7 +132,7 @@ Please enter your account name and your password.<br/><a href="?subtopic=createa
|
|||||||
|
|
||||||
if(isset($_REQUEST['redirect']))
|
if(isset($_REQUEST['redirect']))
|
||||||
{
|
{
|
||||||
$redirect = urldecode(trim($_REQUEST['redirect']));
|
$redirect = urldecode($_REQUEST['redirect']);
|
||||||
?>
|
?>
|
||||||
<div class="TableContainer">
|
<div class="TableContainer">
|
||||||
<table class="Table1" cellpadding="0" cellspacing="0">
|
<table class="Table1" cellpadding="0" cellspacing="0">
|
||||||
@@ -177,11 +177,12 @@ Please enter your account name and your password.<br/><a href="?subtopic=createa
|
|||||||
|
|
||||||
if($action == "")
|
if($action == "")
|
||||||
{
|
{
|
||||||
|
$freePremium = isset($config['lua']['freePremium']) && getBoolean($config['lua']['freePremium']);
|
||||||
$account_reckey = $account_logged->getCustomField("key");
|
$account_reckey = $account_logged->getCustomField("key");
|
||||||
if(!$account_logged->isPremium())
|
if(!$account_logged->isPremium())
|
||||||
$account_status = '<b><font color="red">Free Account</font></b>';
|
$account_status = '<b><font color="red">Free Account</font></b>';
|
||||||
else
|
else
|
||||||
$account_status = '<b><font color="green">Premium Account, '.$account_logged->getPremDays().' days left</font></b>';
|
$account_status = '<b><font color="green">Premium Account, ' . ($freePremium ? 'Unlimited' : $account_logged->getPremDays() . ' days left') . '</font></b>';
|
||||||
if(empty($account_reckey))
|
if(empty($account_reckey))
|
||||||
$account_registred = '<b><font color="red">No</font></b>';
|
$account_registred = '<b><font color="red">No</font></b>';
|
||||||
else
|
else
|
||||||
@@ -222,7 +223,21 @@ Please enter your account name and your password.<br/><a href="?subtopic=createa
|
|||||||
echo '<div class="SmallBox" > <div class="MessageContainer" > <div class="BoxFrameHorizontal" style="background-image:url('.$template_path.'/images/content/box-frame-horizontal.gif);" /></div> <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></div> <div class="BoxFrameEdgeRightTop" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></div> <div class="Message" > <div class="BoxFrameVerticalLeft" style="background-image:url('.$template_path.'/images/content/box-frame-vertical.gif);" /></div> <div class="BoxFrameVerticalRight" style="background-image:url('.$template_path.'/images/content/box-frame-vertical.gif);" /></div><table><tr><td class="LabelV" >Note:</td><td style="width:100%;" >A request has been submitted to change the email address of this account to <b>'.$account_email_new.'</b>. After <b>'.date("j F Y, G:i:s", $account_email_new_time).'</b> you can accept the new email address and finish the process. Please cancel the request if you do not want your email address to be changed! Also cancel the request if you have no access to the new email address!</td></tr></table><div align="center" ><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement&action=changeemail" method="post" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$template_path.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$template_path.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Edit" alt="Edit" src="'.$template_path.'/images/buttons/_sbutton_edit.gif" ></div></div></td></tr></form></table></div> </div> <div class="BoxFrameHorizontal" style="background-image:url('.$template_path.'/images/content/box-frame-horizontal.gif);" /></div> <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></div> <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></div> </div></div><br/><br/>';
|
echo '<div class="SmallBox" > <div class="MessageContainer" > <div class="BoxFrameHorizontal" style="background-image:url('.$template_path.'/images/content/box-frame-horizontal.gif);" /></div> <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></div> <div class="BoxFrameEdgeRightTop" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></div> <div class="Message" > <div class="BoxFrameVerticalLeft" style="background-image:url('.$template_path.'/images/content/box-frame-vertical.gif);" /></div> <div class="BoxFrameVerticalRight" style="background-image:url('.$template_path.'/images/content/box-frame-vertical.gif);" /></div><table><tr><td class="LabelV" >Note:</td><td style="width:100%;" >A request has been submitted to change the email address of this account to <b>'.$account_email_new.'</b>. After <b>'.date("j F Y, G:i:s", $account_email_new_time).'</b> you can accept the new email address and finish the process. Please cancel the request if you do not want your email address to be changed! Also cancel the request if you have no access to the new email address!</td></tr></table><div align="center" ><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement&action=changeemail" method="post" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$template_path.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$template_path.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Edit" alt="Edit" src="'.$template_path.'/images/buttons/_sbutton_edit.gif" ></div></div></td></tr></form></table></div> </div> <div class="BoxFrameHorizontal" style="background-image:url('.$template_path.'/images/content/box-frame-horizontal.gif);" /></div> <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></div> <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></div> </div></div><br/><br/>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo '<a name="General+Information" ></a><div class="TopButtonContainer" ><div class="TopButton" ><a href="#top" > <img style="border:0px;" src="'.$template_path.'/images/content/back-to-top.gif" /></a></div></div><div class="TableContainer" ><table class="Table3" cellpadding="0" cellspacing="0" > <div class="CaptionContainer" > <div class="CaptionInnerContainer" > <span class="CaptionEdgeLeftTop" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span><span class="CaptionEdgeRightTop" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span><span class="CaptionBorderTop" style="background-image:url('.$template_path.'/images/content/table-headline-border.gif);" ></span><span class="CaptionVerticalLeft" style="background-image:url('.$template_path.'/images/content/box-frame-vertical.gif);" /></span><div class="Text" >General Information</div><span class="CaptionVerticalRight" style="background-image:url('.$template_path.'/images/content/box-frame-vertical.gif);" /></span><span class="CaptionBorderBottom" style="background-image:url('.$template_path.'/images/content/table-headline-border.gif);" ></span><span class="CaptionEdgeLeftBottom" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span><span class="CaptionEdgeRightBottom" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span></div> </div><tr> <td> <div class="InnerTableContainer" > <table style="width:100%;" ><tr><td><div class="TableShadowContainerRightTop" > <div class="TableShadowRightTop" style="background-image:url('.$template_path.'/images/content/table-shadow-rt.gif);" ></div></div><div class="TableContentAndRightShadow" style="background-image:url('.$template_path.'/images/content/table-shadow-rm.gif);" ><div class="TableContentContainer" > <table class="TableContent" width="100%" ><tr style="background-color:'.$config['darkborder'].';" ><td class="LabelV" >Email Address:</td><td style="width:90%;" >'.$account_email.''.$account_email_change.'</td></tr><tr style="background-color:'.$config['lightborder'].';" ><td class="LabelV" >Created:</td><td>'.date("j F Y, G:i:s", $account_created).'</td></td><tr style="background-color:'.$config['darkborder'].';" ><td class="LabelV" >Last Login:</td><td>'.date("j F Y, G:i:s", time()).'</td></tr><tr style="background-color:'.$config['lightborder'].';" ><td class="LabelV" >Account Status:</td><td>'.$account_status.'</td></tr><tr style="background-color:'.$config['darkborder'].';" ><td class="LabelV" >Registred:</td><td>'.$account_registred.'</td></tr></table></div></div><div class="TableShadowContainer" ><div class="TableBottomShadow" style="background-image:url('.$template_path.'/images/content/table-shadow-bm.gif);" ><div class="TableBottomLeftShadow" style="background-image:url('.$template_path.'/images/content/table-shadow-bl.gif);" ></div><div class="TableBottomRightShadow" style="background-image:url('.$template_path.'/images/content/table-shadow-br.gif);" ></div> </div></div></td></tr><tr><td><table class="InnerTableButtonRow" cellpadding="0" cellspacing="0" ><tr><td><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement&action=changepassword" method="post" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$template_path.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$template_path.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Change Password" alt="Change Password" src="'.$template_path.'/images/buttons/_sbutton_changepassword.gif" ></div></div></td></tr></form></table></td><td><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement&action=changeemail" method="post" ><tr><td style="border:0px;" ><input type="hidden" name=newemail value="" ><input type="hidden" name=newemaildate value=0 ><div class="BigButton" style="background-image:url('.$template_path.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$template_path.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Change Email" alt="Change Email" src="'.$template_path.'/images/buttons/_sbutton_changeemail.gif" ></div></div></td></tr></form> </table></td><td width="100%"></td>';
|
echo '<a name="General+Information" ></a><div class="TopButtonContainer" ><div class="TopButton" ><a href="#top" > <img style="border:0px;" src="'.$template_path.'/images/content/back-to-top.gif" /></a></div></div><div class="TableContainer" ><table class="Table3" cellpadding="0" cellspacing="0" > <div class="CaptionContainer" > <div class="CaptionInnerContainer" > <span class="CaptionEdgeLeftTop" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span><span class="CaptionEdgeRightTop" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span><span class="CaptionBorderTop" style="background-image:url('.$template_path.'/images/content/table-headline-border.gif);" ></span><span class="CaptionVerticalLeft" style="background-image:url('.$template_path.'/images/content/box-frame-vertical.gif);" /></span><div class="Text" >General Information</div><span class="CaptionVerticalRight" style="background-image:url('.$template_path.'/images/content/box-frame-vertical.gif);" /></span><span class="CaptionBorderBottom" style="background-image:url('.$template_path.'/images/content/table-headline-border.gif);" ></span><span class="CaptionEdgeLeftBottom" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span><span class="CaptionEdgeRightBottom" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span></div> </div><tr> <td> <div class="InnerTableContainer" > <table style="width:100%;" ><tr><td><div class="TableShadowContainerRightTop" > <div class="TableShadowRightTop" style="background-image:url('.$template_path.'/images/content/table-shadow-rt.gif);" ></div></div><div class="TableContentAndRightShadow" style="background-image:url('.$template_path.'/images/content/table-shadow-rm.gif);" ><div class="TableContentContainer" > <table class="TableContent" width="100%" >
|
||||||
|
<tr style="background-color:'.$config['lightborder'].';" >
|
||||||
|
<td class="LabelV" >Account ' . (USE_ACCOUNT_NAME ? 'Name' : 'Number') . ':</td>
|
||||||
|
<td style="width:90%;" >' . (USE_ACCOUNT_NAME ? $account_logged->getName() : $account_logged->getId()) . '</td>
|
||||||
|
</tr>
|
||||||
|
<tr style="background-color:'.$config['darkborder'].';" >
|
||||||
|
<td class="LabelV" >Email Address:</td>
|
||||||
|
<td style="width:90%;" >'.$account_email.''.$account_email_change.'</td>
|
||||||
|
</tr>
|
||||||
|
<tr style="background-color:'.$config['lightborder'].';" >
|
||||||
|
<td class="LabelV" >Created:</td>
|
||||||
|
<td>'.date("j F Y, G:i:s", $account_created).'</td>
|
||||||
|
</tr>
|
||||||
|
<tr style="background-color:'.$config['darkborder'].';" >
|
||||||
|
<td class="LabelV" >Last Login:</td><td>'.date("j F Y, G:i:s", time()).'</td></tr><tr style="background-color:'.$config['lightborder'].';" ><td class="LabelV" >Account Status:</td><td>'.$account_status.'</td></tr><tr style="background-color:'.$config['darkborder'].';" ><td class="LabelV" >Registred:</td><td>'.$account_registred.'</td></tr></table></div></div><div class="TableShadowContainer" ><div class="TableBottomShadow" style="background-image:url('.$template_path.'/images/content/table-shadow-bm.gif);" ><div class="TableBottomLeftShadow" style="background-image:url('.$template_path.'/images/content/table-shadow-bl.gif);" ></div><div class="TableBottomRightShadow" style="background-image:url('.$template_path.'/images/content/table-shadow-br.gif);" ></div> </div></div></td></tr><tr><td><table class="InnerTableButtonRow" cellpadding="0" cellspacing="0" ><tr><td><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement&action=changepassword" method="post" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$template_path.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$template_path.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Change Password" alt="Change Password" src="'.$template_path.'/images/buttons/_sbutton_changepassword.gif" ></div></div></td></tr></form></table></td><td><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement&action=changeemail" method="post" ><tr><td style="border:0px;" ><input type="hidden" name=newemail value="" ><input type="hidden" name=newemaildate value=0 ><div class="BigButton" style="background-image:url('.$template_path.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$template_path.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Change Email" alt="Change Email" src="'.$template_path.'/images/buttons/_sbutton_changeemail.gif" ></div></div></td></tr></form> </table></td><td width="100%"></td>';
|
||||||
//show button "register account"
|
//show button "register account"
|
||||||
if(empty($account_reckey))
|
if(empty($account_reckey))
|
||||||
echo '<td><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement&action=registeraccount" method="post" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$template_path.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$template_path.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Register Account" alt="Register Account" src="'.$template_path.'/images/buttons/_sbutton_registeraccount.gif" ></div></div></td></tr></form></table></td>';
|
echo '<td><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement&action=registeraccount" method="post" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$template_path.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$template_path.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Register Account" alt="Register Account" src="'.$template_path.'/images/buttons/_sbutton_registeraccount.gif" ></div></div></td></tr></form></table></td>';
|
||||||
@@ -234,7 +249,7 @@ Please enter your account name and your password.<br/><a href="?subtopic=createa
|
|||||||
foreach($account_logged->getActionsLog(0, 1000) as $action)
|
foreach($account_logged->getActionsLog(0, 1000) as $action)
|
||||||
{
|
{
|
||||||
echo '<tr style="background-color:' . getStyle($player_number_counter++) . '"><td>'.$action['action'] . '</td><td>' . date("jS F Y H:i:s",$action['date']) . '</td>
|
echo '<tr style="background-color:' . getStyle($player_number_counter++) . '"><td>'.$action['action'] . '</td><td>' . date("jS F Y H:i:s",$action['date']) . '</td>
|
||||||
<td>' . long2ip($action['ip']) . '</td></tr>';
|
<td>' . ($action['ip'] != 0 ? long2ip($action['ip']) : inet_ntop($action['ipv6'])) . '</td></tr>';
|
||||||
}
|
}
|
||||||
echo '</table>
|
echo '</table>
|
||||||
|
|
||||||
@@ -258,7 +273,52 @@ Please enter your account name and your password.<br/><a href="?subtopic=createa
|
|||||||
echo '<td><font color="green"><b>Online</b></font></td>';
|
echo '<td><font color="green"><b>Online</b></font></td>';
|
||||||
echo '<td>[<a href="?subtopic=accountmanagement&action=changecomment&name='.urlencode($account_player->getName()).'" >Edit</a>]</td></tr>';
|
echo '<td>[<a href="?subtopic=accountmanagement&action=changecomment&name='.urlencode($account_player->getName()).'" >Edit</a>]</td></tr>';
|
||||||
}
|
}
|
||||||
echo '</table> </div></div><div class="TableShadowContainer" > <div class="TableBottomShadow" style="background-image:url('.$template_path.'/images/content/table-shadow-bm.gif);" > <div class="TableBottomLeftShadow" style="background-image:url('.$template_path.'/images/content/table-shadow-bl.gif);" ></div> <div class="TableBottomRightShadow" style="background-image:url('.$template_path.'/images/content/table-shadow-br.gif);" ></div> </div></div></td></tr><tr><td><table class="InnerTableButtonRow" cellpadding="0" cellspacing="0" ><tr><td><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement&action=createcharacter" method="post" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$template_path.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$template_path.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Create Character" alt="Create Character" src="'.$template_path.'/images/buttons/_sbutton_createcharacter.gif" ></div></div></td></tr></form></table></td><td style="width:100%;" ></td><td><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement&action=deletecharacter" method="post" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$template_path.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$template_path.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Delete Character" alt="Delete Character" src="'.$template_path.'/images/buttons/_sbutton_deletecharacter.gif" ></div></div></td></tr></form></table></td></tr></table></td></tr> </table> </div> </table></td></div></tr><br/><br/>';
|
echo '</table> </div></div><div class="TableShadowContainer" > <div class="TableBottomShadow" style="background-image:url('.$template_path.'/images/content/table-shadow-bm.gif);" > <div class="TableBottomLeftShadow" style="background-image:url('.$template_path.'/images/content/table-shadow-bl.gif);" ></div> <div class="TableBottomRightShadow" style="background-image:url('.$template_path.'/images/content/table-shadow-br.gif);" ></div> </div></div></td></tr><tr><td><table class="InnerTableButtonRow" cellpadding="0" cellspacing="0" ><tr>
|
||||||
|
<td>
|
||||||
|
<table border="0" cellspacing="0" cellpadding="0" >
|
||||||
|
<form action="?subtopic=accountmanagement&action=createcharacter" method="post" >
|
||||||
|
<tr>
|
||||||
|
<td style="border:0px;" ><div class="BigButton" style="background-image:url('.$template_path.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$template_path.'/images/buttons/sbutton_over.gif);" ></div>
|
||||||
|
<input class="ButtonText" type="image" name="Create Character" alt="Create Character" src="'.$template_path.'/images/buttons/_sbutton_createcharacter.gif" ></div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</form>
|
||||||
|
</table>
|
||||||
|
</td>';
|
||||||
|
if($config['account_change_character_name']) {
|
||||||
|
echo '
|
||||||
|
<td>
|
||||||
|
<table border="0" cellspacing="0" cellpadding="0" >
|
||||||
|
<form action="?subtopic=accountmanagement&action=changename" method="post" >
|
||||||
|
<tr>
|
||||||
|
<td style="border:0px;" ><div class="BigButton" style="background-image:url('.$template_path.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$template_path.'/images/buttons/sbutton_over.gif);" ></div>
|
||||||
|
<input class="ButtonText" type="image" name="Change Name" alt="Change Name" src="images/buttons/_sbutton_change_name.gif" ></div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</form>
|
||||||
|
</table>
|
||||||
|
</td>';
|
||||||
|
}
|
||||||
|
if($config['account_change_character_sex']) {
|
||||||
|
echo '
|
||||||
|
<td>
|
||||||
|
<table border="0" cellspacing="0" cellpadding="0" >
|
||||||
|
<form action="?subtopic=accountmanagement&action=changesex" method="post" >
|
||||||
|
<tr>
|
||||||
|
<td style="border:0px;" ><div class="BigButton" style="background-image:url('.$template_path.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$template_path.'/images/buttons/sbutton_over.gif);" ></div>
|
||||||
|
<input class="ButtonText" type="image" name="Change Sex" alt="Change Sex" src="images/buttons/_sbutton_change_sex.gif" ></div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</form>
|
||||||
|
</table>
|
||||||
|
</td>';
|
||||||
|
}
|
||||||
|
echo '
|
||||||
|
<td style="width:100%;" ></td>
|
||||||
|
<td><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement&action=deletecharacter" method="post" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$template_path.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$template_path.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Delete Character" alt="Delete Character" src="'.$template_path.'/images/buttons/_sbutton_deletecharacter.gif" ></div></div></td></tr></form></table></td></tr></table></td></tr> </table> </div> </table></td></div></tr><br/><br/>';
|
||||||
}
|
}
|
||||||
//########### CHANGE PASSWORD ##########
|
//########### CHANGE PASSWORD ##########
|
||||||
if($action == "changepassword") {
|
if($action == "changepassword") {
|
||||||
@@ -652,14 +712,14 @@ Please enter your account name and your password.<br/><a href="?subtopic=createa
|
|||||||
{
|
{
|
||||||
echo 'Here you can see and edit the information about your character.<br/>If you do not want to specify a certain field, just leave it blank.<br/><br/><form action="?subtopic=accountmanagement&action=changecomment" method="post" ><div class="TableContainer" > <table class="Table5" cellpadding="0" cellspacing="0" > <div class="CaptionContainer" > <div class="CaptionInnerContainer" > <span class="CaptionEdgeLeftTop" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionEdgeRightTop" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionBorderTop" style="background-image:url('.$template_path.'/images/content/table-headline-border.gif);" ></span> <span class="CaptionVerticalLeft" style="background-image:url('.$template_path.'/images/content/box-frame-vertical.gif);" /></span> <div class="Text" >Edit Character Information</div> <span class="CaptionVerticalRight" style="background-image:url('.$template_path.'/images/content/box-frame-vertical.gif);" /></span> <span class="CaptionBorderBottom" style="background-image:url('.$template_path.'/images/content/table-headline-border.gif);" ></span> <span class="CaptionEdgeLeftBottom" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionEdgeRightBottom" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span> </div> </div> <tr> <td> <div class="InnerTableContainer" > <table style="width:100%;" ><tr><td><div class="TableShadowContainerRightTop" > <div class="TableShadowRightTop" style="background-image:url('.$template_path.'/images/content/table-shadow-rt.gif);" ></div></div><div class="TableContentAndRightShadow" style="background-image:url('.$template_path.'/images/content/table-shadow-rm.gif);" > <div class="TableContentContainer" > <table class="TableContent" width="100%" ><tr><td class="LabelV" >Name:</td><td style="width:80%;" >'.$player_name.'</td></tr><tr><td class="LabelV" >Hide Account:</td><td>';
|
echo 'Here you can see and edit the information about your character.<br/>If you do not want to specify a certain field, just leave it blank.<br/><br/><form action="?subtopic=accountmanagement&action=changecomment" method="post" ><div class="TableContainer" > <table class="Table5" cellpadding="0" cellspacing="0" > <div class="CaptionContainer" > <div class="CaptionInnerContainer" > <span class="CaptionEdgeLeftTop" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionEdgeRightTop" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionBorderTop" style="background-image:url('.$template_path.'/images/content/table-headline-border.gif);" ></span> <span class="CaptionVerticalLeft" style="background-image:url('.$template_path.'/images/content/box-frame-vertical.gif);" /></span> <div class="Text" >Edit Character Information</div> <span class="CaptionVerticalRight" style="background-image:url('.$template_path.'/images/content/box-frame-vertical.gif);" /></span> <span class="CaptionBorderBottom" style="background-image:url('.$template_path.'/images/content/table-headline-border.gif);" ></span> <span class="CaptionEdgeLeftBottom" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionEdgeRightBottom" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span> </div> </div> <tr> <td> <div class="InnerTableContainer" > <table style="width:100%;" ><tr><td><div class="TableShadowContainerRightTop" > <div class="TableShadowRightTop" style="background-image:url('.$template_path.'/images/content/table-shadow-rt.gif);" ></div></div><div class="TableContentAndRightShadow" style="background-image:url('.$template_path.'/images/content/table-shadow-rm.gif);" > <div class="TableContentContainer" > <table class="TableContent" width="100%" ><tr><td class="LabelV" >Name:</td><td style="width:80%;" >'.$player_name.'</td></tr><tr><td class="LabelV" >Hide Account:</td><td>';
|
||||||
if($player->getCustomField("hidden") == 1) {
|
if($player->getCustomField("hidden") == 1) {
|
||||||
echo '<input type="checkbox" name="accountvisible" value="1" checked="checked">';
|
echo '<input type="checkbox" name="accountvisible" id="accountvisible" value="1" checked="checked">';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo '<input type="checkbox" name="accountvisible" value="1" >';
|
echo '<input type="checkbox" name="accountvisible" id="accountvisible" value="1" >';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo ' check to hide your account information';
|
echo '<label for="accountvisible"> check to hide your account information</label>';
|
||||||
if((int)$player->getCustomField('group_id') > 1)
|
if((int)$player->getCustomField('group_id') > 1)
|
||||||
echo ' (you will be also hidden on the Team page!)';
|
echo ' (you will be also hidden on the Team page!)';
|
||||||
|
|
||||||
@@ -682,6 +742,191 @@ Please enter your account name and your password.<br/><a href="?subtopic=createa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($action == "changename") {
|
||||||
|
echo '<script type="text/javascript" src="tools/check_name.js"></script>';
|
||||||
|
|
||||||
|
$name_changed = false;
|
||||||
|
$player_id = isset($_POST['player_id']) ? (int)$_POST['player_id'] : NULL;
|
||||||
|
$newcharname = isset($_POST['newcharname']) ? stripslashes(ucwords(strtolower($_POST['newcharname']))) : NULL;
|
||||||
|
if((!$config['account_change_character_name']))
|
||||||
|
echo 'You cant change your character name';
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$points = $account_logged->getCustomField('premium_points');
|
||||||
|
if(isset($_POST['changenamesave']) && $_POST['changenamesave'] == 1) {
|
||||||
|
if($points < $config['account_change_character_name_points'])
|
||||||
|
$errors[] = 'You need ' . $config['account_change_character_name_points'] . ' premium points to change name. You have <b>'.$points.'<b> premium points.';
|
||||||
|
|
||||||
|
if(empty($errors) && empty($newcharname))
|
||||||
|
$errors[] = 'Please enter a name for your character!';
|
||||||
|
|
||||||
|
if(empty($errors) && strlen($newcharname) > 25)
|
||||||
|
$errors[] = 'Name is too long. Max. lenght <b>25</b> letters.';
|
||||||
|
else if(empty($errors) && strlen($newcharname) < 3)
|
||||||
|
$errors[] = 'Name is too short. Min. lenght <b>25</b> letters.';
|
||||||
|
|
||||||
|
if(empty($errors))
|
||||||
|
{
|
||||||
|
$error = '';
|
||||||
|
if(!admin() && !check_name_new_char($newcharname, $error))
|
||||||
|
$errors[] = $error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(empty($errors)) {
|
||||||
|
$player = $ots->createObject('Player');
|
||||||
|
$player->load($player_id);
|
||||||
|
if($player->isLoaded()) {
|
||||||
|
$player_account = $player->getAccount();
|
||||||
|
if($account_logged->getId() == $player_account->getId()) {
|
||||||
|
if($player->isOnline()) {
|
||||||
|
$errors[] = 'This character is online.';
|
||||||
|
}
|
||||||
|
|
||||||
|
if(empty($errors)) {
|
||||||
|
$name_changed = true;
|
||||||
|
$old_name = $player->getName();
|
||||||
|
$player->setName($newcharname);
|
||||||
|
$player->save();
|
||||||
|
$account_logged->setCustomField("premium_points", $points - $config['account_change_character_name_points']);
|
||||||
|
$account_logged->logAction('Changed name from <b>' . $old_name . '</b> to <b>' . $player->getName() . '</b>.');
|
||||||
|
echo '<div class="TableContainer" > <table class="Table1" cellpadding="0" cellspacing="0" > <div class="CaptionContainer" > <div class="CaptionInnerContainer" > <span class="CaptionEdgeLeftTop" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionEdgeRightTop" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionBorderTop" style="background-image:url('.$template_path.'/images/content/table-headline-border.gif);" ></span> <span class="CaptionVerticalLeft" style="background-image:url('.$template_path.'/images/content/box-frame-vertical.gif);" /></span> <div class="Text" >Character Name Changed</div> <span class="CaptionVerticalRight" style="background-image:url('.$template_path.'/images/content/box-frame-vertical.gif);" /></span> <span class="CaptionBorderBottom" style="background-image:url('.$template_path.'/images/content/table-headline-border.gif);" ></span> <span class="CaptionEdgeLeftBottom" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionEdgeRightBottom" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span> </div> </div> <tr> <td> <div class="InnerTableContainer" > <table style="width:100%;" ><tr><td>The character <b>'.$old_name.'</b> name has been changed to <b>' . $player->getName() . '</b>.</td></tr> </table> </div> </table></div></td></tr><br><center><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement" method="post" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$template_path.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$template_path.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$template_path.'/images/buttons/_sbutton_back.gif" ></div></div></td></tr></form></table></center>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$errors[] = 'Character <b>'.$player_name.'</b> is not on your account.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$errors[] = 'Character with this name doesn\'t exist.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$name_changed) {
|
||||||
|
if(!empty($errors)) {
|
||||||
|
echo '<div class="SmallBox" > <div class="MessageContainer" > <div class="BoxFrameHorizontal" style="background-image:url('.$template_path.'/images/content/box-frame-horizontal.gif);" /></div> <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></div> <div class="BoxFrameEdgeRightTop" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></div> <div class="ErrorMessage" > <div class="BoxFrameVerticalLeft" style="background-image:url('.$template_path.'/images/content/box-frame-vertical.gif);" /></div> <div class="BoxFrameVerticalRight" style="background-image:url('.$template_path.'/images/content/box-frame-vertical.gif);" /></div> <div class="AttentionSign" style="background-image:url('.$template_path.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
|
||||||
|
foreach($errors as $errors) {
|
||||||
|
echo '<li>'.$errors;
|
||||||
|
}
|
||||||
|
echo '</div> <div class="BoxFrameHorizontal" style="background-image:url('.$template_path.'/images/content/box-frame-horizontal.gif);" /></div> <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></div> <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></div> </div></div><br/>';
|
||||||
|
}
|
||||||
|
echo 'To change a name of character select player and choose a new name.<br/>
|
||||||
|
<font color="red">Change name cost ' . $config['account_change_character_name_points'] . ' premium points. You have ' . $points . ' premium points.</font><br/><br/><form action="?subtopic=accountmanagement&action=changename" method="post" ><input type="hidden" name="changenamesave" value="1"><div class="TableContainer" > <table class="Table1" cellpadding="0" cellspacing="0" > <div class="CaptionContainer" > <div class="CaptionInnerContainer" > <span class="CaptionEdgeLeftTop" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionEdgeRightTop" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionBorderTop" style="background-image:url('.$template_path.'/images/content/table-headline-border.gif);" ></span> <span class="CaptionVerticalLeft" style="background-image:url('.$template_path.'/images/content/box-frame-vertical.gif);" /></span> <div class="Text" >Change Name</div> <span class="CaptionVerticalRight" style="background-image:url('.$template_path.'/images/content/box-frame-vertical.gif);" /></span> <span class="CaptionBorderBottom" style="background-image:url('.$template_path.'/images/content/table-headline-border.gif);" ></span> <span class="CaptionEdgeLeftBottom" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionEdgeRightBottom" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span> </div> </div> <tr> <td> <div class="InnerTableContainer" >
|
||||||
|
<table style="width:100%;" >
|
||||||
|
<tr>
|
||||||
|
<td class="LabelV" ><span >Character:</td>
|
||||||
|
<td style="width:90%;" >
|
||||||
|
<select name="player_id">';
|
||||||
|
$players = $account_logged->getPlayersList();
|
||||||
|
foreach($players as $player)
|
||||||
|
echo '<option value="' . $player->getId() . '">' . $player->getName() . '</option>';
|
||||||
|
echo '
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="LabelV" ><span >New Name:</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="newcharname" id="newcharname" onkeyup="checkName();" size="25" maxlength="25" >
|
||||||
|
<font size="1" face="verdana,arial,helvetica">
|
||||||
|
<div id="name_check">Please enter your character name.</div>
|
||||||
|
</font>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table> </div> </table></div></td></tr><br/><table style="width:100%" ><tr align="center" ><td><table border="0" cellspacing="0" cellpadding="0" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$template_path.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$template_path.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$template_path.'/images/buttons/_sbutton_submit.gif" ></div></div></td><tr></form></table></td><td><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement" method="post" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$template_path.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$template_path.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$template_path.'/images/buttons/_sbutton_back.gif" ></div></div></td></tr></form></table></td></tr></table>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($action == "changesex") {
|
||||||
|
$sex_changed = false;
|
||||||
|
$player_id = isset($_POST['player_id']) ? (int)$_POST['player_id'] : NULL;
|
||||||
|
$new_sex = isset($_POST['new_sex']) ? (int)$_POST['new_sex'] : NULL;
|
||||||
|
if((!$config['account_change_character_sex']))
|
||||||
|
echo 'You cant change your character sex';
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$points = $account_logged->getCustomField('premium_points');
|
||||||
|
if(isset($_POST['changesexsave']) && $_POST['changesexsave'] == 1) {
|
||||||
|
if($points < $config['account_change_character_sex_points'])
|
||||||
|
$errors[] = 'You need ' . $config['account_change_character_sex_points'] . ' premium points to change sex. You have <b>'.$points.'<b> premium points.';
|
||||||
|
|
||||||
|
if(empty($errors) && $new_sex != 0 && $new_sex != 1)
|
||||||
|
$errors[] = 'This sex is invalid.';
|
||||||
|
|
||||||
|
if(empty($errors)) {
|
||||||
|
$player = $ots->createObject('Player');
|
||||||
|
$player->load($player_id);
|
||||||
|
if($player->isLoaded()) {
|
||||||
|
$player_account = $player->getAccount();
|
||||||
|
if($account_logged->getId() == $player_account->getId()) {
|
||||||
|
if($player->isOnline()) {
|
||||||
|
$errors[] = 'This character is online.';
|
||||||
|
}
|
||||||
|
|
||||||
|
if(empty($errors) && $player->getSex() == $new_sex)
|
||||||
|
$errors[] = 'Sex cannot be same';
|
||||||
|
|
||||||
|
if(empty($errors)) {
|
||||||
|
$sex_changed = true;
|
||||||
|
$old_sex = $player->getSex();
|
||||||
|
$player->setSex($new_sex);
|
||||||
|
$sexes = array(0 => 'Female', 1 => 'Male');
|
||||||
|
$player->save();
|
||||||
|
$account_logged->setCustomField("premium_points", $points - $config['account_change_character_name_points']);
|
||||||
|
$account_logged->logAction('Changed sex on character <b>' . $player->getName() . '</b> from <b>' . $sexes[$old_sex] . '</b> to <b>' . $sexes[$new_sex] . '</b>.');
|
||||||
|
echo '<div class="TableContainer" > <table class="Table1" cellpadding="0" cellspacing="0" > <div class="CaptionContainer" > <div class="CaptionInnerContainer" > <span class="CaptionEdgeLeftTop" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionEdgeRightTop" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionBorderTop" style="background-image:url('.$template_path.'/images/content/table-headline-border.gif);" ></span> <span class="CaptionVerticalLeft" style="background-image:url('.$template_path.'/images/content/box-frame-vertical.gif);" /></span> <div class="Text" >Character Sex Changed</div> <span class="CaptionVerticalRight" style="background-image:url('.$template_path.'/images/content/box-frame-vertical.gif);" /></span> <span class="CaptionBorderBottom" style="background-image:url('.$template_path.'/images/content/table-headline-border.gif);" ></span> <span class="CaptionEdgeLeftBottom" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionEdgeRightBottom" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span> </div> </div> <tr> <td> <div class="InnerTableContainer" > <table style="width:100%;" ><tr><td>The character <b>'.$player->getName().'</b> sex has been changed to <b>' . $sexes[$new_sex] . '</b>.</td></tr> </table> </div> </table></div></td></tr><br><center><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement" method="post" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$template_path.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$template_path.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$template_path.'/images/buttons/_sbutton_back.gif" ></div></div></td></tr></form></table></center>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$errors[] = 'Character <b>'.$player_name.'</b> is not on your account.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$errors[] = 'Character with this name doesn\'t exist.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$sex_changed) {
|
||||||
|
if(!empty($errors)) {
|
||||||
|
echo '<div class="SmallBox" > <div class="MessageContainer" > <div class="BoxFrameHorizontal" style="background-image:url('.$template_path.'/images/content/box-frame-horizontal.gif);" /></div> <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></div> <div class="BoxFrameEdgeRightTop" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></div> <div class="ErrorMessage" > <div class="BoxFrameVerticalLeft" style="background-image:url('.$template_path.'/images/content/box-frame-vertical.gif);" /></div> <div class="BoxFrameVerticalRight" style="background-image:url('.$template_path.'/images/content/box-frame-vertical.gif);" /></div> <div class="AttentionSign" style="background-image:url('.$template_path.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
|
||||||
|
foreach($errors as $errors) {
|
||||||
|
echo '<li>'.$errors;
|
||||||
|
}
|
||||||
|
echo '</div> <div class="BoxFrameHorizontal" style="background-image:url('.$template_path.'/images/content/box-frame-horizontal.gif);" /></div> <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></div> <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></div> </div></div><br/>';
|
||||||
|
}
|
||||||
|
echo 'To change a sex of character select player and choose a new sex.<br/>
|
||||||
|
<font color="red">Change sex cost ' . $config['account_change_character_sex_points'] . ' premium points. You have ' . $points . ' premium points.</font><br/><br/><form action="?subtopic=accountmanagement&action=changesex" method="post" ><input type="hidden" name="changesexsave" value="1"><div class="TableContainer" > <table class="Table1" cellpadding="0" cellspacing="0" > <div class="CaptionContainer" > <div class="CaptionInnerContainer" > <span class="CaptionEdgeLeftTop" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionEdgeRightTop" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionBorderTop" style="background-image:url('.$template_path.'/images/content/table-headline-border.gif);" ></span> <span class="CaptionVerticalLeft" style="background-image:url('.$template_path.'/images/content/box-frame-vertical.gif);" /></span> <div class="Text" >Change sex</div> <span class="CaptionVerticalRight" style="background-image:url('.$template_path.'/images/content/box-frame-vertical.gif);" /></span> <span class="CaptionBorderBottom" style="background-image:url('.$template_path.'/images/content/table-headline-border.gif);" ></span> <span class="CaptionEdgeLeftBottom" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionEdgeRightBottom" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span> </div> </div> <tr> <td> <div class="InnerTableContainer" >
|
||||||
|
<table style="width:100%;" >
|
||||||
|
<tr>
|
||||||
|
<td class="LabelV" ><span >Character:</td>
|
||||||
|
<td style="width:90%;" >
|
||||||
|
<select name="player_id">';
|
||||||
|
$players = $account_logged->getPlayersList();
|
||||||
|
foreach($players as $player)
|
||||||
|
echo '<option value="' . $player->getId() . '">' . $player->getName() . '</option>';
|
||||||
|
echo '
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="LabelV" ><span >New Sex:</td>
|
||||||
|
<td>
|
||||||
|
<select name="new_sex">
|
||||||
|
<option value="0"' . ($player->getSex() == 0 ? ' selected' : '') . '>Female</option>
|
||||||
|
<option value="1"' . ($player->getSex() == 1 ? ' selected' : '') . '>Male</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table> </div> </table></div></td></tr><br/><table style="width:100%" ><tr align="center" ><td><table border="0" cellspacing="0" cellpadding="0" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$template_path.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$template_path.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$template_path.'/images/buttons/_sbutton_submit.gif" ></div></div></td><tr></form></table></td><td><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement" method="post" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$template_path.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$template_path.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$template_path.'/images/buttons/_sbutton_back.gif" ></div></div></td></tr></form></table></td></tr></table>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
//### DELETE character from account ###
|
//### DELETE character from account ###
|
||||||
if($action == "deletecharacter") {
|
if($action == "deletecharacter") {
|
||||||
$player_name = isset($_POST['delete_name']) ? stripslashes($_POST['delete_name']) : NULL;
|
$player_name = isset($_POST['delete_name']) ? stripslashes($_POST['delete_name']) : NULL;
|
||||||
@@ -750,52 +995,14 @@ Please enter your account name and your password.<br/><a href="?subtopic=createa
|
|||||||
|
|
||||||
//## CREATE CHARACTER on account ###
|
//## CREATE CHARACTER on account ###
|
||||||
if($action == "createcharacter") {
|
if($action == "createcharacter") {
|
||||||
echo '<script type="text/javascript">
|
echo '<script type="text/javascript" src="tools/check_name.js"></script>';
|
||||||
eventId = 0;
|
|
||||||
lastSend = 0;
|
|
||||||
|
|
||||||
function checkName()
|
|
||||||
{
|
|
||||||
if(eventId != 0)
|
|
||||||
{
|
|
||||||
clearInterval(eventId)
|
|
||||||
eventId = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(document.getElementById("newcharname").value=="")
|
|
||||||
{
|
|
||||||
document.getElementById("name_check").innerHTML = \'<b><font color="red">Please enter new character name.</font></b>\';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//anti flood
|
|
||||||
var date = new Date;
|
|
||||||
var timeNow = parseInt(date.getTime());
|
|
||||||
|
|
||||||
if(lastSend != 0)
|
|
||||||
{
|
|
||||||
if(timeNow - lastSend < 1100)
|
|
||||||
{
|
|
||||||
eventId = setInterval(\'checkName()\', 1100)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var newcharname = document.getElementById("newcharname").value;
|
|
||||||
$.get("tools/validate.php", { name: newcharname, uid: Math.random() },
|
|
||||||
function(data){
|
|
||||||
document.getElementById("name_check").innerHTML = data;
|
|
||||||
lastSend = timeNow;
|
|
||||||
});
|
|
||||||
|
|
||||||
lastSend = timeNow;
|
|
||||||
}
|
|
||||||
</script>';
|
|
||||||
$newchar_name = isset($_POST['newcharname']) ? stripslashes(ucwords(strtolower($_POST['newcharname']))) : NULL;
|
$newchar_name = isset($_POST['newcharname']) ? stripslashes(ucwords(strtolower($_POST['newcharname']))) : NULL;
|
||||||
$newchar_sex = isset($_POST['newcharsex']) ? $_POST['newcharsex'] : NULL;
|
$newchar_sex = isset($_POST['newcharsex']) ? $_POST['newcharsex'] : NULL;
|
||||||
$newchar_vocation = isset($_POST['newcharvocation']) ? $_POST['newcharvocation'] : NULL;
|
$newchar_vocation = isset($_POST['newcharvocation']) ? $_POST['newcharvocation'] : NULL;
|
||||||
$newchar_town = isset($_POST['newchartown']) ? $_POST['newchartown'] : NULL;
|
$newchar_town = isset($_POST['newchartown']) ? $_POST['newchartown'] : NULL;
|
||||||
$newchar_errors = array();
|
$newchar_errors = array();
|
||||||
|
|
||||||
|
$newchar_created = false;
|
||||||
if(isset($_POST['savecharacter']) && $_POST['savecharacter'] == 1) {
|
if(isset($_POST['savecharacter']) && $_POST['savecharacter'] == 1) {
|
||||||
if(empty($newchar_name))
|
if(empty($newchar_name))
|
||||||
$newchar_errors[] = 'Please enter a name for your character!';
|
$newchar_errors[] = 'Please enter a name for your character!';
|
||||||
@@ -824,17 +1031,11 @@ function checkName()
|
|||||||
else
|
else
|
||||||
$newchar_town = $config['character_towns'][0];
|
$newchar_town = $config['character_towns'][0];
|
||||||
|
|
||||||
//check if was namelocked previously
|
|
||||||
if(tableExist('player_namelocks') && fieldExist('name', 'player_namelocks')) {
|
|
||||||
$namelockSQL = $db->query('SELECT `player_id` FROM `player_namelocks` WHERE `name` = ' . $db->quote($newchar_name));
|
|
||||||
if($namelockSQL->rowCount() > 0)
|
|
||||||
$newchar_errors[] = 'Character with this name has been namelocked.';
|
|
||||||
}
|
|
||||||
|
|
||||||
if(empty($newchar_errors))
|
if(empty($newchar_errors))
|
||||||
{
|
{
|
||||||
if(!check_name_new_char($newchar_name))
|
$error = '';
|
||||||
$newchar_errors[] = 'This name contains invalid letters, words or format. Please use only a-Z, - , \' and space.';
|
if(!admin() && !check_name_new_char($newchar_name, $error))
|
||||||
|
$newchar_errors[] = $error;
|
||||||
if($newchar_sex != 1 && $newchar_sex != "0")
|
if($newchar_sex != 1 && $newchar_sex != "0")
|
||||||
$newchar_errors[] = 'Sex must be equal <b>0 (female)</b> or <b>1 (male)</b>.';
|
$newchar_errors[] = 'Sex must be equal <b>0 (female)</b> or <b>1 (male)</b>.';
|
||||||
if(!in_array($newchar_town, $config['character_towns']))
|
if(!in_array($newchar_town, $config['character_towns']))
|
||||||
@@ -854,10 +1055,6 @@ function checkName()
|
|||||||
|
|
||||||
if(empty($newchar_errors))
|
if(empty($newchar_errors))
|
||||||
{
|
{
|
||||||
$check_name_in_database = $ots->createObject('Player');
|
|
||||||
$check_name_in_database->find($newchar_name);
|
|
||||||
if($check_name_in_database->isLoaded())
|
|
||||||
$newchar_errors[] .= 'This name is already used. Please choose another name!';
|
|
||||||
$number_of_players_on_account = $account_logged->getPlayersList()->count();
|
$number_of_players_on_account = $account_logged->getPlayersList()->count();
|
||||||
if($number_of_players_on_account >= $config['characters_per_account'])
|
if($number_of_players_on_account >= $config['characters_per_account'])
|
||||||
$newchar_errors[] .= 'You have too many characters on your account <b>('.$number_of_players_on_account.'/'.$config['characters_per_account'].')</b>!';
|
$newchar_errors[] .= 'You have too many characters on your account <b>('.$number_of_players_on_account.'/'.$config['characters_per_account'].')</b>!';
|
||||||
@@ -886,10 +1083,18 @@ function checkName()
|
|||||||
if(fieldExist('promotion', 'players'))
|
if(fieldExist('promotion', 'players'))
|
||||||
$player->setPromotion($char_to_copy->getPromotion());
|
$player->setPromotion($char_to_copy->getPromotion());
|
||||||
|
|
||||||
|
if(fieldExist('direction', 'players'))
|
||||||
|
$player->setDirection($char_to_copy->getDirection());
|
||||||
|
|
||||||
$player->setConditions($char_to_copy->getConditions());
|
$player->setConditions($char_to_copy->getConditions());
|
||||||
if(fieldExist('rank_id', 'players'))
|
$rank = $char_to_copy->getRank();
|
||||||
|
if($rank->isLoaded()) {
|
||||||
$player->setRank($char_to_copy->getRank());
|
$player->setRank($char_to_copy->getRank());
|
||||||
|
}
|
||||||
|
|
||||||
|
if(fieldExist('lookaddons', 'players'))
|
||||||
$player->setLookAddons($char_to_copy->getLookAddons());
|
$player->setLookAddons($char_to_copy->getLookAddons());
|
||||||
|
|
||||||
$player->setTownId($newchar_town);
|
$player->setTownId($newchar_town);
|
||||||
$player->setExperience($char_to_copy->getExperience());
|
$player->setExperience($char_to_copy->getExperience());
|
||||||
$player->setLevel($char_to_copy->getLevel());
|
$player->setLevel($char_to_copy->getLevel());
|
||||||
@@ -900,8 +1105,6 @@ function checkName()
|
|||||||
$player->setManaMax($char_to_copy->getManaMax());
|
$player->setManaMax($char_to_copy->getManaMax());
|
||||||
$player->setManaSpent($char_to_copy->getManaSpent());
|
$player->setManaSpent($char_to_copy->getManaSpent());
|
||||||
$player->setSoul($char_to_copy->getSoul());
|
$player->setSoul($char_to_copy->getSoul());
|
||||||
if(fieldExist('direction', 'players'))
|
|
||||||
$player->setDirection($char_to_copy->getDirection());
|
|
||||||
|
|
||||||
$player->setLookBody($char_to_copy->getLookBody());
|
$player->setLookBody($char_to_copy->getLookBody());
|
||||||
$player->setLookFeet($char_to_copy->getLookFeet());
|
$player->setLookFeet($char_to_copy->getLookFeet());
|
||||||
@@ -918,10 +1121,16 @@ function checkName()
|
|||||||
$player->setLossExperience($char_to_copy->getLossExperience());
|
$player->setLossExperience($char_to_copy->getLossExperience());
|
||||||
$player->setLossMana($char_to_copy->getLossMana());
|
$player->setLossMana($char_to_copy->getLossMana());
|
||||||
$player->setLossSkills($char_to_copy->getLossSkills());
|
$player->setLossSkills($char_to_copy->getLossSkills());
|
||||||
$player->setLossItems($char_to_copy->getLossItems());
|
|
||||||
}
|
}
|
||||||
|
if(fieldExist('loss_items', 'players')) {
|
||||||
|
$player->setLossItems($char_to_copy->getLossItems());
|
||||||
|
$player->setLossContainers($char_to_copy->getLossContainers());
|
||||||
|
}
|
||||||
|
|
||||||
$player->save();
|
$player->save();
|
||||||
$player->setCustomField("created", time());
|
$player->setCustomField("created", time());
|
||||||
|
|
||||||
|
$newchar_created = true;
|
||||||
$account_logged->logAction('Created character <b>' . $player->getName() . '</b>.');
|
$account_logged->logAction('Created character <b>' . $player->getName() . '</b>.');
|
||||||
unset($player);
|
unset($player);
|
||||||
$player = $ots->createObject('Player');
|
$player = $ots->createObject('Player');
|
||||||
@@ -951,8 +1160,7 @@ function checkName()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if(count($newchar_errors) > 0) {
|
if(count($newchar_errors) > 0) {
|
||||||
echo '<div class="SmallBox" > <div class="MessageContainer" > <div class="BoxFrameHorizontal" style="background-image:url('.$template_path.'/images/content/box-frame-horizontal.gif);" /></div> <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></div> <div class="BoxFrameEdgeRightTop" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></div> <div class="ErrorMessage" > <div class="BoxFrameVerticalLeft" style="background-image:url('.$template_path.'/images/content/box-frame-vertical.gif);" /></div> <div class="BoxFrameVerticalRight" style="background-image:url('.$template_path.'/images/content/box-frame-vertical.gif);" /></div> <div class="AttentionSign" style="background-image:url('.$template_path.'/images/content/attentionsign.gif);" /></div>';
|
echo '<div class="SmallBox" > <div class="MessageContainer" > <div class="BoxFrameHorizontal" style="background-image:url('.$template_path.'/images/content/box-frame-horizontal.gif);" /></div> <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></div> <div class="BoxFrameEdgeRightTop" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></div> <div class="ErrorMessage" > <div class="BoxFrameVerticalLeft" style="background-image:url('.$template_path.'/images/content/box-frame-vertical.gif);" /></div> <div class="BoxFrameVerticalRight" style="background-image:url('.$template_path.'/images/content/box-frame-vertical.gif);" /></div> <div class="AttentionSign" style="background-image:url('.$template_path.'/images/content/attentionsign.gif);" /></div>';
|
||||||
echo '<b>The Following Errors Have Occurred:</b><br/>';
|
echo '<b>The Following Errors Have Occurred:</b><br/>';
|
||||||
@@ -960,6 +1168,8 @@ function checkName()
|
|||||||
echo '<li>'.$newchar_error . '</li>';
|
echo '<li>'.$newchar_error . '</li>';
|
||||||
echo '</div> <div class="BoxFrameHorizontal" style="background-image:url('.$template_path.'/images/content/box-frame-horizontal.gif);" /></div> <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></div> <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></div> </div></div><br/>';
|
echo '</div> <div class="BoxFrameHorizontal" style="background-image:url('.$template_path.'/images/content/box-frame-horizontal.gif);" /></div> <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></div> <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></div> </div></div><br/>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!$newchar_created) {
|
||||||
echo 'Please choose a name';
|
echo 'Please choose a name';
|
||||||
if(count($config['character_samples']) > 1)
|
if(count($config['character_samples']) > 1)
|
||||||
echo ', vocation';
|
echo ', vocation';
|
||||||
@@ -967,7 +1177,14 @@ function checkName()
|
|||||||
if($account_logged->getPlayersList()->count() >= $config['characters_per_account']) {
|
if($account_logged->getPlayersList()->count() >= $config['characters_per_account']) {
|
||||||
echo '<b><font color="red"> You have maximum number of characters per account on your account. Delete one before you make new.</font></b>';
|
echo '<b><font color="red"> You have maximum number of characters per account on your account. Delete one before you make new.</font></b>';
|
||||||
}
|
}
|
||||||
echo '<br/><br/><form action="?subtopic=accountmanagement&action=createcharacter" method="post" ><input type="hidden" name=savecharacter value="1" ><div class="TableContainer" > <table class="Table3" cellpadding="0" cellspacing="0" > <div class="CaptionContainer" > <div class="CaptionInnerContainer" ><span class="CaptionEdgeLeftTop" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span><span class="CaptionEdgeRightTop" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span><span class="CaptionBorderTop" style="background-image:url('.$template_path.'/images/content/table-headline-border.gif);" ></span><span class="CaptionVerticalLeft" style="background-image:url('.$template_path.'/images/content/box-frame-vertical.gif);" /></span><div class="Text" >Create Character</div> <span class="CaptionVerticalRight" style="background-image:url('.$template_path.'/images/content/box-frame-vertical.gif);" /></span><span class="CaptionBorderBottom" style="background-image:url('.$template_path.'/images/content/table-headline-border.gif);" ></span><span class="CaptionEdgeLeftBottom" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span><span class="CaptionEdgeRightBottom" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span></div> </div><tr> <td> <div class="InnerTableContainer" > <table style="width:100%;" ><tr><td><div class="TableShadowContainerRightTop" > <div class="TableShadowRightTop" style="background-image:url('.$template_path.'/images/content/table-shadow-rt.gif);" ></div></div><div class="TableContentAndRightShadow" style="background-image:url('.$template_path.'/images/content/table-shadow-rm.gif);" > <div class="TableContentContainer" ><table class="TableContent" width="100%" ><tr class="LabelH" ><td style="width:50%;" ><span >Name</td><td><span >Sex</td></tr><tr class="Odd" ><td><input id="newcharname" name="newcharname" onkeyup="checkName();" value="'.$newchar_name.'" size="30" maxlength="29" ><BR><font size="1" face="verdana,arial,helvetica"><div id="name_check">Please enter your character name.</div></font></td><td>';
|
echo '<br/><br/><form action="?subtopic=accountmanagement&action=createcharacter" method="post" ><input type="hidden" name=savecharacter value="1" ><div class="TableContainer" > <table class="Table3" cellpadding="0" cellspacing="0" > <div class="CaptionContainer" > <div class="CaptionInnerContainer" ><span class="CaptionEdgeLeftTop" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span><span class="CaptionEdgeRightTop" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span><span class="CaptionBorderTop" style="background-image:url('.$template_path.'/images/content/table-headline-border.gif);" ></span><span class="CaptionVerticalLeft" style="background-image:url('.$template_path.'/images/content/box-frame-vertical.gif);" /></span><div class="Text" >Create Character</div> <span class="CaptionVerticalRight" style="background-image:url('.$template_path.'/images/content/box-frame-vertical.gif);" /></span><span class="CaptionBorderBottom" style="background-image:url('.$template_path.'/images/content/table-headline-border.gif);" ></span><span class="CaptionEdgeLeftBottom" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span><span class="CaptionEdgeRightBottom" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span></div> </div><tr> <td> <div class="InnerTableContainer" > <table style="width:100%;" ><tr><td><div class="TableShadowContainerRightTop" > <div class="TableShadowRightTop" style="background-image:url('.$template_path.'/images/content/table-shadow-rt.gif);" ></div></div><div class="TableContentAndRightShadow" style="background-image:url('.$template_path.'/images/content/table-shadow-rm.gif);" > <div class="TableContentContainer" ><table class="TableContent" width="100%" ><tr class="LabelH" ><td style="width:50%;" ><span >Name</td><td><span >Sex</td></tr><tr class="Odd" >
|
||||||
|
<td>
|
||||||
|
<input id="newcharname" name="newcharname" onkeyup="checkName();" value="'.$newchar_name.'" size="25" maxlength="25" ><br/>
|
||||||
|
<font size="1" face="verdana,arial,helvetica">
|
||||||
|
<div id="name_check">Please enter your character name.</div>
|
||||||
|
</font>
|
||||||
|
</td>
|
||||||
|
<td>';
|
||||||
echo '<input type="radio" name="newcharsex" id="newcharsex" value="1" ';
|
echo '<input type="radio" name="newcharsex" id="newcharsex" value="1" ';
|
||||||
if($newchar_sex == 1)
|
if($newchar_sex == 1)
|
||||||
echo 'checked="checked" ';
|
echo 'checked="checked" ';
|
||||||
|
@@ -1,27 +1,26 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Changelog
|
* CHANGELOG viewer
|
||||||
*
|
*
|
||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
$title = 'MyAAC - CHANGELOG';
|
$title = 'MyAAC Changelog';
|
||||||
|
|
||||||
$data = file_get_contents(SYSTEM . 'docs/CHANGELOG');
|
if(!file_exists(BASE . 'CHANGELOG')) {
|
||||||
|
echo 'File CHANGELOG doesn\'t exist.';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// replace special characters with HTML entities
|
$changelog = file_get_contents(BASE . 'CHANGELOG');
|
||||||
// replace line breaks with <br />
|
$changelog = nl2br(htmlspecialchars($changelog));
|
||||||
$data = nl2br(htmlspecialchars($data));
|
|
||||||
|
|
||||||
// replace multiple spaces with single spaces
|
|
||||||
$data = preg_replace('/\s\s+/', ' ', $data);
|
|
||||||
|
|
||||||
// replace URLs with <a href...> elements
|
// replace URLs with <a href...> elements
|
||||||
$data = preg_replace('/\s(\w+:\/\/)(\S+)/', ' <a href="\\1\\2" target="_blank">\\1\\2</a>', $data);
|
$changelog = preg_replace('/\s(\w+:\/\/)(\S+)/', ' <a href="\\1\\2" target="_blank">\\1\\2</a>', $changelog);
|
||||||
|
|
||||||
echo '<div>' . $data . '</div>';
|
echo '<div>' . $changelog . '</div>';
|
||||||
?>
|
?>
|
||||||
|
@@ -5,12 +5,85 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
$title = 'Dashboard';
|
$title = 'Dashboard';
|
||||||
|
|
||||||
|
if($cache->enabled()) {
|
||||||
|
if(isset($_GET['clear_cache'])) {
|
||||||
|
if(clearCache())
|
||||||
|
success('Cache cleared.');
|
||||||
|
else
|
||||||
|
error('Error while clearing cache.');
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
<table class="table">
|
||||||
|
<tr>
|
||||||
|
<th><a href="?p=dashboard&clear_cache" onclick="return confirm('Are you sure?');">Clear cache</a></th>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
if(isset($_GET['maintenance'])) {
|
||||||
|
$_status = (int)$_POST['status'];
|
||||||
|
$message = $_POST['message'];
|
||||||
|
if(empty($message)) {
|
||||||
|
error('Message cannot be empty.');
|
||||||
|
}
|
||||||
|
else if(strlen($message) > 255) {
|
||||||
|
error('Message is too long. Maximum length allowed is 255 chars.');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$tmp = '';
|
||||||
|
if(fetchDatabaseConfig('site_closed', $tmp))
|
||||||
|
updateDatabaseConfig('site_closed', $_status);
|
||||||
|
else
|
||||||
|
registerDatabaseConfig('site_closed', $_status);
|
||||||
|
|
||||||
|
if(fetchDatabaseConfig('site_closed_message', $tmp))
|
||||||
|
updateDatabaseConfig('site_closed_message', $message);
|
||||||
|
else
|
||||||
|
registerDatabaseConfig('site_closed_message', $message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$is_closed = getDatabaseConfig('site_closed') == '1';
|
||||||
|
|
||||||
|
$closed_message = 'Server is under maintenance, please visit later.';
|
||||||
|
$tmp = '';
|
||||||
|
if(fetchDatabaseConfig('site_closed_message', $tmp))
|
||||||
|
$closed_message = $tmp;
|
||||||
|
?>
|
||||||
|
<form action="?p=dashboard&maintenance" method="post">
|
||||||
|
<table class="table">
|
||||||
|
<tr>
|
||||||
|
<th colspan="2">Maintenance
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Site status:</td>
|
||||||
|
<td>
|
||||||
|
<select name="status">
|
||||||
|
<option value="0"<?php echo (!$is_closed ? ' selected' : ''); ?>>Open</option>
|
||||||
|
<option value="1"<?php echo ($is_closed ? ' selected' : ''); ?>>Closed</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Message: (only if closed)</td>
|
||||||
|
<td>
|
||||||
|
<textarea name="message" maxlength="255" cols="40" rows="5"><?php echo $closed_message; ?></textarea>
|
||||||
|
<td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<input type="submit" class="button" value="Update"/>
|
||||||
|
</td>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
<br/>
|
||||||
<div>
|
<div>
|
||||||
<?php if($status['online']): ?>
|
<?php if($status['online']): ?>
|
||||||
<p class="success" style="width: 150px; text-align: center;">Status: Online<br/>
|
<p class="success" style="width: 150px; text-align: center;">Status: Online<br/>
|
||||||
@@ -39,26 +112,69 @@ $title = 'Dashboard';
|
|||||||
</div-->
|
</div-->
|
||||||
<?php if($status['online']): ?>
|
<?php if($status['online']): ?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var hidden = false;
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$("#status-more").hide();
|
$("#status-more").hide();
|
||||||
$("#more-button").text("More");
|
$("#more-button").text("More");
|
||||||
hidden = true;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#more-button").click(function() {
|
$("#more-button").click(function() {
|
||||||
if(hidden) {
|
if($("#status-more").is(":hidden")) {
|
||||||
$("#more-button").text("Hide");
|
$("#more-button").text("Hide");
|
||||||
$("#status-more").show();
|
$("#status-more").show();
|
||||||
hidden = false;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$("#more-button").text("More");
|
$("#more-button").text("More");
|
||||||
$("#status-more").hide();
|
$("#status-more").hide();
|
||||||
hidden = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<?php endif; ?>
|
<?php endif;
|
||||||
|
|
||||||
|
function clearCache()
|
||||||
|
{
|
||||||
|
global $cache, $template_name;
|
||||||
|
|
||||||
|
$tmp = '';
|
||||||
|
if($cache->fetch('status', $tmp))
|
||||||
|
$cache->delete('status');
|
||||||
|
|
||||||
|
if($cache->fetch('templates', $tmp))
|
||||||
|
$cache->delete('templates');
|
||||||
|
|
||||||
|
if($cache->fetch('config_lua', $tmp))
|
||||||
|
$cache->delete('config_lua');
|
||||||
|
|
||||||
|
if($cache->fetch('vocations', $tmp))
|
||||||
|
$cache->delete('vocations');
|
||||||
|
|
||||||
|
if($cache->fetch('towns', $tmp))
|
||||||
|
$cache->delete('towns');
|
||||||
|
|
||||||
|
if($cache->fetch('groups', $tmp))
|
||||||
|
$cache->delete('groups');
|
||||||
|
|
||||||
|
if($cache->fetch('visitors', $tmp))
|
||||||
|
$cache->delete('visitors');
|
||||||
|
|
||||||
|
if($cache->fetch('views_counter', $tmp))
|
||||||
|
$cache->delete('views_counter');
|
||||||
|
|
||||||
|
if($cache->fetch('failed_logins', $tmp))
|
||||||
|
$cache->delete('failed_logins');
|
||||||
|
|
||||||
|
if($cache->fetch('news' . $template_name . '_' . NEWS, $tmp))
|
||||||
|
$cache->delete('news' . $template_name . '_' . NEWS);
|
||||||
|
|
||||||
|
if($cache->fetch('news' . $template_name . '_' . TICKET, $tmp))
|
||||||
|
$cache->delete('news' . $template_name . '_' . TICKET);
|
||||||
|
|
||||||
|
if($cache->fetch('news' . $template_name . '_' . ARTICLE, $tmp))
|
||||||
|
$cache->delete('news' . $template_name . '_' . ARTICLE);
|
||||||
|
|
||||||
|
if($cache->fetch('template_ini' . $template_name, $tmp))
|
||||||
|
$cache->delete('template_ini' . $template_name);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
@@ -5,7 +5,7 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
@@ -28,7 +28,15 @@ foreach(scandir($aac_path_logs) as $f) {
|
|||||||
$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)) {
|
||||||
|
echo '</table>Logs are not available on this server.';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
foreach(scandir($server_path_logs) as $f) {
|
foreach(scandir($server_path_logs) as $f) {
|
||||||
if($f[0] == '.' || $f == '..')
|
if($f[0] == '.' || $f == '..')
|
||||||
continue;
|
continue;
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
@@ -93,8 +93,8 @@ if($id > 0) {
|
|||||||
if(!check_name($name, $_error))
|
if(!check_name($name, $_error))
|
||||||
echo_error($_error);
|
echo_error($_error);
|
||||||
|
|
||||||
//if(!check_name_new_char($name))
|
//if(!check_name_new_char($name, $_error))
|
||||||
// echo_error('This name contains invalid letters, words or format. Please use only a-Z, - , \' and space.');
|
// echo_error($_error);
|
||||||
|
|
||||||
$player_db = $ots->createObject('Player');
|
$player_db = $ots->createObject('Player');
|
||||||
$player_db->find($name);
|
$player_db->find($name);
|
||||||
@@ -150,8 +150,10 @@ if($id > 0) {
|
|||||||
verify_number($look_legs, 'Look legs', 11);
|
verify_number($look_legs, 'Look legs', 11);
|
||||||
$look_type = $_POST['look_type'];
|
$look_type = $_POST['look_type'];
|
||||||
verify_number($look_type, 'Look type', 11);
|
verify_number($look_type, 'Look type', 11);
|
||||||
|
if(fieldExist('lookaddons', 'players')) {
|
||||||
$look_addons = $_POST['look_addons'];
|
$look_addons = $_POST['look_addons'];
|
||||||
verify_number($look_addons, 'Look addons', 11);
|
verify_number($look_addons, 'Look addons', 11);
|
||||||
|
}
|
||||||
|
|
||||||
// pos
|
// pos
|
||||||
$pos_x = $_POST['pos_x'];
|
$pos_x = $_POST['pos_x'];
|
||||||
@@ -200,12 +202,16 @@ if($id > 0) {
|
|||||||
verify_number($loss_items, 'Loss items', 11);
|
verify_number($loss_items, 'Loss items', 11);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(fieldExist('blessings', 'players')) {
|
||||||
$blessings = $_POST['blessings'];
|
$blessings = $_POST['blessings'];
|
||||||
verify_number($blessings, 'Blessings', 2);
|
verify_number($blessings, 'Blessings', 2);
|
||||||
|
}
|
||||||
$balance = $_POST['balance'];
|
$balance = $_POST['balance'];
|
||||||
verify_number($balance, 'Balance', 20);
|
verify_number($balance, 'Balance', 20);
|
||||||
|
if(fieldExist('stamina', 'players')) {
|
||||||
$stamina = $_POST['stamina'];
|
$stamina = $_POST['stamina'];
|
||||||
verify_number($stamina, 'Stamina', 20);
|
verify_number($stamina, 'Stamina', 20);
|
||||||
|
}
|
||||||
|
|
||||||
$deleted = (isset($_POST['deleted']) && $_POST['deleted'] == 'true');
|
$deleted = (isset($_POST['deleted']) && $_POST['deleted'] == 'true');
|
||||||
$hidden = (isset($_POST['hidden']) && $_POST['hidden'] == 'true');
|
$hidden = (isset($_POST['hidden']) && $_POST['hidden'] == 'true');
|
||||||
@@ -238,6 +244,7 @@ if($id > 0) {
|
|||||||
$player->setLookHead($look_head);
|
$player->setLookHead($look_head);
|
||||||
$player->setLookLegs($look_legs);
|
$player->setLookLegs($look_legs);
|
||||||
$player->setLookType($look_type);
|
$player->setLookType($look_type);
|
||||||
|
if(fieldExist('lookaddons', 'players'))
|
||||||
$player->setLookAddons($look_addons);
|
$player->setLookAddons($look_addons);
|
||||||
$player->setPosX($pos_x);
|
$player->setPosX($pos_x);
|
||||||
$player->setPosY($pos_y);
|
$player->setPosY($pos_y);
|
||||||
@@ -258,8 +265,10 @@ if($id > 0) {
|
|||||||
$player->setLossContainers($loss_containers);
|
$player->setLossContainers($loss_containers);
|
||||||
$player->setLossItems($loss_items);
|
$player->setLossItems($loss_items);
|
||||||
}
|
}
|
||||||
|
if(fieldExist('blessings', 'players'))
|
||||||
$player->setBlessings($blessings);
|
$player->setBlessings($blessings);
|
||||||
$player->setBalance($balance);
|
$player->setBalance($balance);
|
||||||
|
if(fieldExist('stamina', 'players'))
|
||||||
$player->setStamina($stamina);
|
$player->setStamina($stamina);
|
||||||
if(fieldExist('deletion', 'players'))
|
if(fieldExist('deletion', 'players'))
|
||||||
$player->setCustomField('deletion', $deleted ? '1' : '0');
|
$player->setCustomField('deletion', $deleted ? '1' : '0');
|
||||||
@@ -298,7 +307,7 @@ if(!isset($player) || !$player->isLoaded())
|
|||||||
|
|
||||||
$account = $player->getAccount();
|
$account = $player->getAccount();
|
||||||
?>
|
?>
|
||||||
<br/><br/>
|
<br/>
|
||||||
<form action="<?php echo $base . ((isset($id) && $id > 0) ? '&id=' . $id : ''); ?>" method="post">
|
<form action="<?php echo $base . ((isset($id) && $id > 0) ? '&id=' . $id : ''); ?>" method="post">
|
||||||
<table class="table" cellspacing="1" cellpadding="4">
|
<table class="table" cellspacing="1" cellpadding="4">
|
||||||
<tr><th colspan="2">Edit player</th></tr>
|
<tr><th colspan="2">Edit player</th></tr>
|
||||||
@@ -391,7 +400,9 @@ $account = $player->getAccount();
|
|||||||
Head:<input type="text" name="look_head" size="2" maxlength="11" value="<?php echo $player->getLookHead(); ?>" />
|
Head:<input type="text" name="look_head" size="2" maxlength="11" value="<?php echo $player->getLookHead(); ?>" />
|
||||||
Legs:<input type="text" name="look_legs" size="2" maxlength="11" value="<?php echo $player->getLookLegs(); ?>" />
|
Legs:<input type="text" name="look_legs" size="2" maxlength="11" value="<?php echo $player->getLookLegs(); ?>" />
|
||||||
Type:<input type="text" name="look_type" size="2" maxlength="11" value="<?php echo $player->getLookType(); ?>" />
|
Type:<input type="text" name="look_type" size="2" maxlength="11" value="<?php echo $player->getLookType(); ?>" />
|
||||||
|
<?php if(fieldExist('lookaddons', 'players')): ?>
|
||||||
Addons:<input type="text" name="look_addons" size="2" maxlength="11" value="<?php echo $player->getLookAddons(); ?>" />
|
Addons:<input type="text" name="look_addons" size="2" maxlength="11" value="<?php echo $player->getLookAddons(); ?>" />
|
||||||
|
<?php endif; ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -468,19 +479,19 @@ $account = $player->getAccount();
|
|||||||
<table>
|
<table>
|
||||||
<tr style="background-color: transparent;">
|
<tr style="background-color: transparent;">
|
||||||
<td>Loss experience:</td>
|
<td>Loss experience:</td>
|
||||||
<td><input type="text" name="lost_experience" size="8" maxlength="11" value="<?php echo $player->getLossExperience(); ?>" /></td>
|
<td><input type="text" name="loss_experience" size="8" maxlength="11" value="<?php echo $player->getLossExperience(); ?>" /></td>
|
||||||
|
|
||||||
<td>Loss mana:</td>
|
<td>Loss mana:</td>
|
||||||
<td><input type="text" name="lost_mana" size="8" maxlength="11" value="<?php echo $player->getLossMana(); ?>" /></td>
|
<td><input type="text" name="loss_mana" size="8" maxlength="11" value="<?php echo $player->getLossMana(); ?>" /></td>
|
||||||
|
|
||||||
<td>Loss skills:</td>
|
<td>Loss skills:</td>
|
||||||
<td><input type="text" name="lost_skills" size="8" maxlength="11" value="<?php echo $player->getLossSkills(); ?>" /></td>
|
<td><input type="text" name="loss_skills" size="8" maxlength="11" value="<?php echo $player->getLossSkills(); ?>" /></td>
|
||||||
|
|
||||||
<td>Loss containers:</td>
|
<td>Loss containers:</td>
|
||||||
<td><input type="text" name="lost_containers" size="8" maxlength="11" value="<?php echo $player->getLossContainers(); ?>" /></td>
|
<td><input type="text" name="loss_containers" size="8" maxlength="11" value="<?php echo $player->getLossContainers(); ?>" /></td>
|
||||||
|
|
||||||
<td>Loss items:</td>
|
<td>Loss items:</td>
|
||||||
<td><input type="text" name="lost_items" size="8" maxlength="11" value="<?php echo $player->getLossItems(); ?>" /></td>
|
<td><input type="text" name="loss_items" size="8" maxlength="11" value="<?php echo $player->getLossItems(); ?>" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
@@ -490,14 +501,17 @@ $account = $player->getAccount();
|
|||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<table>
|
<table>
|
||||||
<tr style="background-color: transparent;">
|
<tr style="background-color: transparent;">
|
||||||
|
<?php if(fieldExist('blessings', 'players')): ?>
|
||||||
<td>Blessings:</td>
|
<td>Blessings:</td>
|
||||||
<td><input type="text" name="blessings" size="2" maxlength="2" value="<?php echo $player->getBlessings(); ?>" /></td>
|
<td><input type="text" name="blessings" size="2" maxlength="2" value="<?php echo $player->getBlessings(); ?>" /></td>
|
||||||
|
<?php endif; ?>
|
||||||
<td>Balance:</td>
|
<td>Balance:</td>
|
||||||
<td><input type="text" name="balance" size="16" maxlength="20" value="<?php echo $player->getBalance(); ?>" /></td>
|
<td><input type="text" name="balance" size="16" maxlength="20" value="<?php echo $player->getBalance(); ?>" /></td>
|
||||||
|
|
||||||
|
<?php if(fieldExist('stamina', 'players')): ?>
|
||||||
<td>Stamina:</td>
|
<td>Stamina:</td>
|
||||||
<td><input type="text" name="stamina" size="16" maxlength="20" value="<?php echo $player->getStamina(); ?>" /></td>
|
<td><input type="text" name="stamina" size="16" maxlength="20" value="<?php echo $player->getStamina(); ?>" /></td>
|
||||||
|
<?php endif; ?>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
|
@@ -5,11 +5,13 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
$title = 'Plugin manager';
|
$title = 'Plugin manager';
|
||||||
|
|
||||||
|
require(SYSTEM . 'hooks.php');
|
||||||
?>
|
?>
|
||||||
<form enctype="multipart/form-data" method="post">
|
<form enctype="multipart/form-data" method="post">
|
||||||
<input type="hidden" name="upload_plugin" />
|
<input type="hidden" name="upload_plugin" />
|
||||||
@@ -41,6 +43,33 @@ if(isset($_FILES["plugin"]["name"]))
|
|||||||
$name = explode(".", $filename);
|
$name = explode(".", $filename);
|
||||||
$accepted_types = array('application/zip', 'application/x-zip-compressed', 'multipart/x-zip', 'application/x-compressed');
|
$accepted_types = array('application/zip', 'application/x-zip-compressed', 'multipart/x-zip', 'application/x-compressed');
|
||||||
|
|
||||||
|
if(isset($file['error'])) {
|
||||||
|
$error = 'Error uploading file';
|
||||||
|
switch( $file['error'] ) {
|
||||||
|
case UPLOAD_ERR_OK:
|
||||||
|
$error = false;
|
||||||
|
break;
|
||||||
|
case UPLOAD_ERR_INI_SIZE:
|
||||||
|
case UPLOAD_ERR_FORM_SIZE:
|
||||||
|
$error .= ' - file too large (limit of '.ini_get('upload_max_filesize').' bytes).';
|
||||||
|
break;
|
||||||
|
case UPLOAD_ERR_PARTIAL:
|
||||||
|
$error .= ' - file upload was not completed.';
|
||||||
|
break;
|
||||||
|
case UPLOAD_ERR_NO_FILE:
|
||||||
|
$error .= ' - zero-length file uploaded.';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$error .= ' - internal error #' . $file['error'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($error) && $error != false) {
|
||||||
|
error($error);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if(is_uploaded_file($file['tmp_name']) ) {
|
||||||
if(in_array($type, $accepted_types) && strtolower($name[1]) == 'zip') // check if it is zipped/compressed file
|
if(in_array($type, $accepted_types) && strtolower($name[1]) == 'zip') // check if it is zipped/compressed file
|
||||||
{
|
{
|
||||||
$targetdir = BASE;
|
$targetdir = BASE;
|
||||||
@@ -50,20 +79,60 @@ if(isset($_FILES["plugin"]["name"]))
|
|||||||
$zip = new ZipArchive();
|
$zip = new ZipArchive();
|
||||||
$x = $zip->open($targetzip); // open the zip file to extract
|
$x = $zip->open($targetzip); // open the zip file to extract
|
||||||
if ($x === true) {
|
if ($x === true) {
|
||||||
$zip->extractTo($targetdir); // place in the directory with same name
|
if($zip->extractTo($targetdir)) { // place in the directory with same name
|
||||||
|
$string = file_get_contents(BASE . 'plugins/' . $name[0] . '.json');
|
||||||
|
$plugin = json_decode($string, true);
|
||||||
|
if($plugin == NULL) {
|
||||||
|
warning('Cannot load ' . BASE . 'plugins/' . $name[0] . '.json. File might be not valid json code.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($plugin['install'])) {
|
||||||
|
if(file_exists(BASE . $plugin['install']))
|
||||||
|
require(BASE . $plugin['install']);
|
||||||
|
else
|
||||||
|
warning('Cannot load install script. Your plugin might be not working correctly.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($plugin['hooks'])) {
|
||||||
|
foreach($plugin['hooks'] as $_name => $info) {
|
||||||
|
if(isset($hook_types[$info['type']])) {
|
||||||
|
$query = $db->query('SELECT `id` FROM `' . TABLE_PREFIX . 'hooks` WHERE `name` = ' . $db->quote($_name) . ';');
|
||||||
|
if($query->rowCount() == 1) { // found something
|
||||||
|
$query = $query->fetch();
|
||||||
|
$db->query('UPDATE `' . TABLE_PREFIX . 'hooks` SET `type` = ' . $hook_types[$info['type']] . ', `file` = ' . $db->quote($info['file']) . ' WHERE `id` = ' . (int)$query['id'] . ';');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$db->query('INSERT INTO `' . TABLE_PREFIX . 'hooks` (`id`, `name`, `type`, `file`) VALUES (NULL, ' . $db->quote($_name) . ', ' . $hook_types[$info['type']] . ', ' . $db->quote($info['file']) . ');');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
warning('Unknown event type: ' . $info['type']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
success('<strong>' . $plugin['name'] . '</strong> plugin has been successfully installed.');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
error('There was a problem with extracting zip archive.');
|
||||||
|
}
|
||||||
|
|
||||||
$zip->close();
|
$zip->close();
|
||||||
unlink($targetzip); // delete the Zipped file
|
unlink($targetzip); // delete the Zipped file
|
||||||
|
}
|
||||||
$string = file_get_contents(BASE . 'plugins/' . $name[0] . '.json');
|
else {
|
||||||
$plugin_info = json_decode($string, true);
|
error('There was a problem with opening zip archive.');
|
||||||
$message = '<p class="success"><strong>' . $plugin_info['name'] . '</strong> plugin has been successfully installed.</p>';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$message = '<p class="error">There was a problem with the upload. Please try again.</p>';
|
error('There was a problem with the upload. Please try again.');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
error('The file you are trying to upload is not a .zip file. Please try again.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
error('Error uploading file - unknown error.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
$message = '<p class="error">The file you are trying to upload is not a .zip file. Please try again.</p>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo $message;
|
echo $message;
|
||||||
@@ -83,7 +152,7 @@ echo $message;
|
|||||||
foreach(scandir($path) as $file)
|
foreach(scandir($path) as $file)
|
||||||
{
|
{
|
||||||
$file_info = explode('.', $file);
|
$file_info = explode('.', $file);
|
||||||
if($file == '.' || $file == '..' || $file == 'disabled' || is_dir($file) || !$file_info[1] || $file_info[1] != 'json')
|
if($file == '.' || $file == '..' || $file == 'disabled' || $file == 'example.json' || is_dir($path . $file) || !$file_info[1] || $file_info[1] != 'json')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$string = file_get_contents(BASE . 'plugins/' . $file_info[0] . '.json');
|
$string = file_get_contents(BASE . 'plugins/' . $file_info[0] . '.json');
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
@@ -45,9 +45,9 @@ $title = 'Statistics';
|
|||||||
<td>
|
<td>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<tr><th colspan="3">TOP 10 - Most wealth accounts</th></tr>
|
<tr><th colspan="3">TOP 10 - Most wealth accounts</th></tr>
|
||||||
<tr><th>#</th><th>Account name</th><th>Premium points</th></tr>
|
<tr><th>#</th><th>Account <?php echo (USE_ACCOUNT_NAME ? 'name' : 'number'); ?></th><th>Premium points</th></tr>
|
||||||
<?php
|
<?php
|
||||||
$query = $db->query('SELECT premium_points, name FROM accounts ORDER BY premium_points DESC LIMIT 10;');
|
$query = $db->query('SELECT `premium_points`, `' . (USE_ACCOUNT_NAME ? 'name' : 'id') . '` as `name` FROM `accounts` ORDER BY `premium_points` DESC LIMIT 10;');
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach($query as $result)
|
foreach($query as $result)
|
||||||
{
|
{
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
@@ -18,7 +18,8 @@ $myaac_version = file_get_contents('http://my-aac.org/VERSION');
|
|||||||
|
|
||||||
// compare them
|
// compare them
|
||||||
if(version_compare($myaac_version, MYAAC_VERSION) <= 0)
|
if(version_compare($myaac_version, MYAAC_VERSION) <= 0)
|
||||||
echo '<p class="success">MyAAC latest version is ' . $myaac_version . '. You\'re using the latest version.</p>';
|
echo '<p class="success">MyAAC latest version is ' . $myaac_version . '. You\'re using the latest version.
|
||||||
|
<br/>View CHANGELOG ' . generateLink(ADMIN_URL . '?p=changelog', 'here') . '</p>';
|
||||||
else
|
else
|
||||||
echo '<p class="warning">You\'re using outdated version.<br/>
|
echo '<p class="warning">You\'re using outdated version.<br/>
|
||||||
Your version: <b>' . MYAAC_VERSION . '</b><br/>
|
Your version: <b>' . MYAAC_VERSION . '</b><br/>
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
* @author Gesior <jerzyskalski@wp.pl>
|
* @author Gesior <jerzyskalski@wp.pl>
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
* @author Gesior <jerzyskalski@wp.pl>
|
* @author Gesior <jerzyskalski@wp.pl>
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
@@ -5,14 +5,14 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
$title = 'Changelog';
|
$title = 'Changelog';
|
||||||
|
|
||||||
$_page = $_GET['page'];
|
$_page = isset($_GET['page']) ? $_GET['page'] : 0;
|
||||||
$id = $_GET['id'];
|
$id = isset($_GET['id']) ? $_GET['id'] : 0;
|
||||||
$limit = 30;
|
$limit = 30;
|
||||||
$offset = $_page * $limit;
|
$offset = $_page * $limit;
|
||||||
?>
|
?>
|
||||||
|
@@ -6,14 +6,13 @@
|
|||||||
* @author Gesior <jerzyskalski@wp.pl>
|
* @author Gesior <jerzyskalski@wp.pl>
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
$title = 'Characters';
|
$title = 'Characters';
|
||||||
|
|
||||||
require(SYSTEM . 'item.php');
|
require(SYSTEM . 'item.php');
|
||||||
|
|
||||||
$groups = new OTS_Groups_List();
|
$groups = new OTS_Groups_List();
|
||||||
function generate_search_table($script = false)
|
function generate_search_table($script = false)
|
||||||
{
|
{
|
||||||
@@ -60,29 +59,46 @@ function generate_player_lookup($player)
|
|||||||
$player_eq[$i] = $empty_slots[$i];
|
$player_eq[$i] = $empty_slots[$i];
|
||||||
}
|
}
|
||||||
|
|
||||||
//for($i = 1; $i < 11; $i++)
|
if(PHP_VERSION_ID == NULL || PHP_VERSION_ID < 70000) {
|
||||||
//{
|
for($i = 1; $i < 11; $i++)
|
||||||
//if(!itemImageExists($player_eq[$i]))
|
{
|
||||||
// Items::generate($player_eq[$i]);
|
if(!itemImageExists($player_eq[$i]))
|
||||||
//}
|
Items::generate($player_eq[$i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for($i = 1; $i < 11; $i++)
|
||||||
|
{
|
||||||
|
if(check_number($player_eq[$i]))
|
||||||
|
$player_eq[$i] = getItemImage($player_eq[$i]);
|
||||||
|
else
|
||||||
|
$player_eq[$i] = '<img src="images/items/' . $player_eq[$i] . '.gif" width="32" height="32" border="0" alt=" ' . $player_eq[$i] . '" />';
|
||||||
|
}
|
||||||
|
|
||||||
|
$skulls = array(
|
||||||
|
1 => 'yellow_skull',
|
||||||
|
2 => 'green_skull',
|
||||||
|
3 => 'white_skull',
|
||||||
|
4 => 'red_skull',
|
||||||
|
5 => 'black_skull'
|
||||||
|
);
|
||||||
|
|
||||||
return '<table width="100" align="center" cellspacing="0" cellpadding="0" style="background: #808080; border:1px solid #808080;">
|
return '<table width="100" align="center" cellspacing="0" cellpadding="0" style="background: #808080; border:1px solid #808080;">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<table cellspacing="0" style="background: #292929;">
|
<table cellspacing="0" style="background: #292929;">
|
||||||
<tr><td style="border:1px solid #808080;">'.getItemImage($player_eq[2]).'</td></tr><tr><td style="border:1px solid #808080;">'.getItemImage($player_eq[6]).'</td></tr><tr><td style="border:1px solid #808080;">'.getItemImage($player_eq[9]).'</td></tr>
|
<tr><td style="border:1px solid #808080;">'.$player_eq[2].'</td></tr><tr><td style="border:1px solid #808080;">'.$player_eq[6].'</td></tr><tr><td style="border:1px solid #808080;">'.$player_eq[9].'</td></tr>
|
||||||
<tr height="11px"><td>'.($player->getSkull() > 0 ? '<img src="images/red_skull.gif">' : '').'</td></tr>
|
<tr height="11px"><td>'.($player->getSkullTime() > 0 && ($player->getSkull() == 4 || $player->getSkull() == 5) ? '<img src="images/' . $skulls[$player->getSkull()] . '.gif">' : '').'</td></tr>
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<table cellspacing="0" style="background: #292929;">
|
<table cellspacing="0" style="background: #292929;">
|
||||||
<tr><td style="border:1px solid #808080;">'.getItemImage($player_eq[1]).'</td></tr><tr><td style="border:1px solid #808080;">'.getItemImage($player_eq[4]).'</td></tr><tr><td style="border:1px solid #808080;">'.getItemImage($player_eq[7]).'</td></tr><tr><td style="border:1px solid #808080;">'.getItemImage($player_eq[8]).'</td></tr>
|
<tr><td style="border:1px solid #808080;">'.$player_eq[1].'</td></tr><tr><td style="border:1px solid #808080;">'.$player_eq[4].'</td></tr><tr><td style="border:1px solid #808080;">'.$player_eq[7].'</td></tr><tr><td style="border:1px solid #808080;">'.$player_eq[8].'</td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<table cellspacing="0" style="background: #292929;">
|
<table cellspacing="0" style="background: #292929;">
|
||||||
<tr><td style="border:1px solid #808080;">'.getItemImage($player_eq[3]).'</td></tr><tr><td style="border:1px solid #808080;">'.getItemImage($player_eq[5]).'</td></tr><tr><td style="border:1px solid #808080;">'.getItemImage($player_eq[10]).'</td></tr>
|
<tr><td style="border:1px solid #808080;">'.$player_eq[3].'</td></tr><tr><td style="border:1px solid #808080;">'.$player_eq[5].'</td></tr><tr><td style="border:1px solid #808080;">'.$player_eq[10].'</td></tr>
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -120,8 +136,6 @@ if(empty($name))
|
|||||||
|
|
||||||
$name = str_replace('/', '', $name);
|
$name = str_replace('/', '', $name);
|
||||||
|
|
||||||
if(check_name($name))
|
|
||||||
{
|
|
||||||
$oldName = '';
|
$oldName = '';
|
||||||
|
|
||||||
$player = $ots->createObject('Player');
|
$player = $ots->createObject('Player');
|
||||||
@@ -150,6 +164,9 @@ if(check_name($name))
|
|||||||
<td><img src="<?php echo $template_path; ?>/images/general/blank.gif" width="10" height="1" border="0"></td>
|
<td><img src="<?php echo $template_path; ?>/images/general/blank.gif" width="10" height="1" border="0"></td>
|
||||||
<td>
|
<td>
|
||||||
<table border="0" cellspacing="1" cellpadding="4" width="100%">
|
<table border="0" cellspacing="1" cellpadding="4" width="100%">
|
||||||
|
<?php if($config['characters']['outfit']): ?>
|
||||||
|
<div style="width:64px;height:64px;border:2px solid #F1E0C6; border-radius:50px; padding:13px; margin-top:38px;margin-left:376px;position:absolute;"><img style="margin-left:<?php echo (in_array($player->getLookType(), array(75, 266, 302)) ? '-0px;margin-top:-0px;width:64px;height:64px;' : '-60px;margin-top:-60px;width:128px;height:128px;'); ?>" src="<?php echo $config['outfit_images_url'] . '?id=' . $player->getLookType() . (fieldExist('lookaddons', 'players') ? '&addons=' . $player->getLookAddons() : '') . '&head=' . $player->getLookHead() . '&body=' . $player->getLookBody() . '&legs=' . $player->getLookLegs() . '&feet=' . $player->getLookFeet() . '"';?>></div>
|
||||||
|
<?php endif; ?>
|
||||||
<tr bgcolor="<?php echo $config['vdarkborder']; ?>">
|
<tr bgcolor="<?php echo $config['vdarkborder']; ?>">
|
||||||
<td colspan="2" class="white"><b>Character Information</b></td>
|
<td colspan="2" class="white"><b>Character Information</b></td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -227,10 +244,16 @@ if(check_name($name))
|
|||||||
$town_field = 'town';
|
$town_field = 'town';
|
||||||
if(fieldExist('town_id', 'houses'))
|
if(fieldExist('town_id', 'houses'))
|
||||||
$town_field = 'town_id';
|
$town_field = 'town_id';
|
||||||
|
else if(fieldExist('townid', 'houses'))
|
||||||
|
$town_field = 'townid';
|
||||||
|
else if(!fieldExist('town', 'houses'))
|
||||||
|
$town_field = false;
|
||||||
|
|
||||||
$house = $db->query('SELECT `id`, `paid`, `name`, `' . $town_field . '` FROM `houses` WHERE `owner` = '.$player->getId())->fetch();
|
if(fieldExist('name', 'houses')) {
|
||||||
|
$house = $db->query('SELECT `id`, `paid`, `name`' . ($town_field != false ? ', `' . $town_field . '` as `town`' : '') . ' FROM `houses` WHERE `owner` = '.$player->getId())->fetch();
|
||||||
if(isset($house['id']))
|
if(isset($house['id']))
|
||||||
{
|
{
|
||||||
|
$add = '';
|
||||||
if($house['paid'] > 0)
|
if($house['paid'] > 0)
|
||||||
$add = ' is paid until '.date("M d Y", $house['paid']);
|
$add = ' is paid until '.date("M d Y", $house['paid']);
|
||||||
|
|
||||||
@@ -239,10 +262,10 @@ if(check_name($name))
|
|||||||
<TD>House:</TD>
|
<TD>House:</TD>
|
||||||
<TD>
|
<TD>
|
||||||
<TABLE BORDER=0><TR>
|
<TABLE BORDER=0><TR>
|
||||||
<TD>'.$house['name'].' ('.$config['towns'][$house[$town_field]].')'.$add.'</TD>
|
<TD>' . (isset($house['name']) ? $house['name'] : $house['id']) . (isset($house['town']) ? ' (' . $config['towns'][$house[$town_field]] . ')' : '') . $add . '</TD>
|
||||||
<TD>
|
<TD>
|
||||||
<FORM ACTION="?subtopic=houses&page=view" METHOD=post>
|
<FORM ACTION="?subtopic=houses&page=view" METHOD=post>
|
||||||
<INPUT TYPE=hidden NAME=house VALUE="'.$house['name'].'">
|
<INPUT TYPE=hidden NAME=house VALUE="'. (isset($house['name']) ? $house['name'] : $house['id']) . '">
|
||||||
<INPUT TYPE=image NAME="View" ALT="View" SRC="'.$template_path.'/images/buttons/sbutton_view.gif" BORDER=0 WIDTH=120>
|
<INPUT TYPE=image NAME="View" ALT="View" SRC="'.$template_path.'/images/buttons/sbutton_view.gif" BORDER=0 WIDTH=120>
|
||||||
</FORM>
|
</FORM>
|
||||||
</TD>
|
</TD>
|
||||||
@@ -250,16 +273,19 @@ if(check_name($name))
|
|||||||
</TD>
|
</TD>
|
||||||
</TR>';
|
</TR>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$rank_of_player = $player->getRank();
|
$rank_of_player = $player->getRank();
|
||||||
if($rank_of_player->isLoaded())
|
if($rank_of_player->isLoaded()) {
|
||||||
{
|
$guild = $rank_of_player->getGuild();
|
||||||
$guild_name = $rank_of_player->getGuild()->getName();
|
if($guild->isLoaded()) {
|
||||||
|
$guild_name = $guild->getName();
|
||||||
echo
|
echo
|
||||||
'<TR BGCOLOR="'.getStyle(++$rows).'">'.
|
'<TR BGCOLOR="'.getStyle(++$rows).'">'.
|
||||||
'<TD>Guild membership:</TD><TD>'.$rank_of_player->getName().' of the ' . getGuildLink($guild_name) . '</TD>'.
|
'<TD>Guild membership:</TD><TD>'.$rank_of_player->getName().' of the ' . getGuildLink($guild_name) . '</TD>'.
|
||||||
'</TR>';
|
'</TR>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
echo
|
echo
|
||||||
'<TR BGCOLOR="'.getStyle(++$rows).'"><TD>Last login:</TD><TD>';
|
'<TR BGCOLOR="'.getStyle(++$rows).'"><TD>Last login:</TD><TD>';
|
||||||
@@ -450,9 +476,11 @@ if(check_name($name))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
$mostdamage = '';
|
||||||
|
if(fieldExist('mostdamage_by', 'player_deaths'))
|
||||||
|
$mostdamage = ', `mostdamage_by`, `mostdamage_is_player`, `unjustified`, `mostdamage_unjustified`';
|
||||||
$deaths = $db->query('SELECT
|
$deaths = $db->query('SELECT
|
||||||
`player_id`, `time`, `level`, `killed_by`, `is_player`,
|
`player_id`, `time`, `level`, `killed_by`, `is_player`' . $mostdamage . '
|
||||||
`mostdamage_by`, `mostdamage_is_player`, `unjustified`, `mostdamage_unjustified`
|
|
||||||
FROM `player_deaths`
|
FROM `player_deaths`
|
||||||
WHERE `player_id` = ' . $player->getId() . ' ORDER BY `time` DESC LIMIT 10;');
|
WHERE `player_id` = ' . $player->getId() . ' ORDER BY `time` DESC LIMIT 10;');
|
||||||
|
|
||||||
@@ -611,13 +639,17 @@ if(check_name($name))
|
|||||||
'<TR BGCOLOR='.getStyle(++$rows).'>
|
'<TR BGCOLOR='.getStyle(++$rows).'>
|
||||||
<TD WIDTH=20%>Created:</TD>';
|
<TD WIDTH=20%>Created:</TD>';
|
||||||
$bannedUntil = '';
|
$bannedUntil = '';
|
||||||
|
$banned = array();
|
||||||
if(tableExist('account_bans'))
|
if(tableExist('account_bans'))
|
||||||
$banned = $db->query('SELECT `expires_at` as `expires` FROM `account_bans` WHERE `account_id` = '.$account->getId().' and `expires_at` > ' . time());
|
$banned = $db->query('SELECT `expires_at` as `expires` FROM `account_bans` WHERE `account_id` = '.$account->getId().' and `expires_at` > ' . time());
|
||||||
else
|
else if(tableExist('bans')) {
|
||||||
|
if(fieldExist('expires', 'bans'))
|
||||||
$banned = $db->query('SELECT `expires` FROM `bans` WHERE (`value` = '.$account->getId().' or `value` = '.$player->getId().') and `active` = 1 and `type` != 2 and `type` != 4 and `expires` > ' . time());
|
$banned = $db->query('SELECT `expires` FROM `bans` WHERE (`value` = '.$account->getId().' or `value` = '.$player->getId().') and `active` = 1 and `type` != 2 and `type` != 4 and `expires` > ' . time());
|
||||||
|
else
|
||||||
|
$banned = $db->query('SELECT `time` as `time` FROM `bans` WHERE (`account` = '.$account->getId().' or `player` = '.$player->getId().') and `type` != 2 and `type` != 4 and `time` > ' . time());
|
||||||
|
}
|
||||||
foreach($banned as $ban)
|
foreach($banned as $ban)
|
||||||
{
|
{
|
||||||
if($ban['type'] != 2 and $ban['type'] != 4)
|
|
||||||
$bannedUntil = ' <font color="red">[Banished '.($ban['expires'] == "-1" ? 'forever' : 'until '.date("d F Y, h:s", $ban['expires'])).']</font>';
|
$bannedUntil = ' <font color="red">[Banished '.($ban['expires'] == "-1" ? 'forever' : 'until '.date("d F Y, h:s", $ban['expires'])).']</font>';
|
||||||
}
|
}
|
||||||
echo '<TD>'.date("j F Y, g:i a", $account->getCustomField("created")).$bannedUntil.'</TD>
|
echo '<TD>'.date("j F Y, g:i a", $account->getCustomField("created")).$bannedUntil.'</TD>
|
||||||
@@ -688,9 +720,6 @@ if(check_name($name))
|
|||||||
|
|
||||||
echo generate_search_table(true);
|
echo generate_search_table(true);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
$search_errors[] = 'This name contains invalid letters. Please use only A-Z, a-z and space. Minimum length is 3 characters.';
|
|
||||||
|
|
||||||
if(!empty($search_errors))
|
if(!empty($search_errors))
|
||||||
output_errors($search_errors);
|
output_errors($search_errors);
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
* @author Gesior <jerzyskalski@wp.pl>
|
* @author Gesior <jerzyskalski@wp.pl>
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
@@ -24,17 +24,28 @@ if($logged)
|
|||||||
$step = isset($_POST['step']) ? $_POST['step'] : '';
|
$step = isset($_POST['step']) ? $_POST['step'] : '';
|
||||||
if($step == 'save')
|
if($step == 'save')
|
||||||
{
|
{
|
||||||
$account_name = $_POST['account_name'];
|
if(USE_ACCOUNT_NAME) {
|
||||||
|
$account_name = $_POST['account'];
|
||||||
$account_name_up = strtoupper($account_name);
|
$account_name_up = strtoupper($account_name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$account_id = $_POST['account'];
|
||||||
|
|
||||||
$email = $_POST['email'];
|
$email = $_POST['email'];
|
||||||
$password = $_POST['password'];
|
$password = $_POST['password'];
|
||||||
$password2 = $_POST['password2'];
|
$password2 = $_POST['password2'];
|
||||||
|
|
||||||
// account
|
// account
|
||||||
|
if(isset($account_id)) {
|
||||||
|
if(!check_number($account_id))
|
||||||
|
$errors['account'] = 'Invalid account number format. Please use only numbers 0-9.';
|
||||||
|
}
|
||||||
|
else {
|
||||||
if(empty($account_name))
|
if(empty($account_name))
|
||||||
$errors['account_name'] = 'Please enter your account name!';
|
$errors['account'] = 'Please enter your account name!';
|
||||||
elseif(!check_account_name($account_name_up))
|
elseif(!check_account_name($account_name_up))
|
||||||
$errors['account_name'] = 'Invalid account name format. Please use only A-Z and numbers 0-9.';
|
$errors['account'] = 'Invalid account name format. Please use only A-Z and numbers 0-9.';
|
||||||
|
}
|
||||||
|
|
||||||
// email
|
// email
|
||||||
if(empty($email))
|
if(empty($email))
|
||||||
@@ -81,7 +92,7 @@ if($step == 'save')
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check if account name is not equal to password
|
// check if account name is not equal to password
|
||||||
if($account_name_up == strtoupper($password))
|
if(USE_ACCOUNT_NAME && $account_name_up == strtoupper($password))
|
||||||
{
|
{
|
||||||
$errors['password'] = 'Password may not be the same as account name.';
|
$errors['password'] = 'Password may not be the same as account name.';
|
||||||
}
|
}
|
||||||
@@ -97,9 +108,17 @@ if($step == 'save')
|
|||||||
}
|
}
|
||||||
|
|
||||||
$account_db = new OTS_Account();
|
$account_db = new OTS_Account();
|
||||||
|
if(USE_ACCOUNT_NAME)
|
||||||
$account_db->find($account_name);
|
$account_db->find($account_name);
|
||||||
if($account_db->isLoaded())
|
else
|
||||||
$errors['account_name'] = 'Account with this name already exist.';
|
$account_db->load($account_id);
|
||||||
|
|
||||||
|
if($account_db->isLoaded()) {
|
||||||
|
if(USE_ACCOUNT_NAME)
|
||||||
|
$errors['account'] = 'Account with this name already exist.';
|
||||||
|
else
|
||||||
|
$errors['account'] = 'Account with this id already exist.';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isset($_POST['accept_rules']) || $_POST['accept_rules'] != 'true')
|
if(!isset($_POST['accept_rules']) || $_POST['accept_rules'] != 'true')
|
||||||
@@ -108,21 +127,27 @@ if($step == 'save')
|
|||||||
if(empty($errors))
|
if(empty($errors))
|
||||||
{
|
{
|
||||||
$new_account = $ots->createObject('Account');
|
$new_account = $ots->createObject('Account');
|
||||||
|
if(USE_ACCOUNT_NAME)
|
||||||
$new_account->create($account_name);
|
$new_account->create($account_name);
|
||||||
|
else
|
||||||
|
$new_account->create(NULL, $account_id);
|
||||||
|
|
||||||
$config_salt_enabled = fieldExist('salt', 'accounts');
|
$config_salt_enabled = fieldExist('salt', 'accounts');
|
||||||
if($config_salt_enabled)
|
if($config_salt_enabled)
|
||||||
{
|
{
|
||||||
$salt = generateRandomString(10, false, true, true);
|
$salt = generateRandomString(10, false, true, true);
|
||||||
$password = $salt . $password;
|
$password = $salt . $password;
|
||||||
$new_account->setSalt($salt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$new_account->setPassword(encrypt($password));
|
$new_account->setPassword(encrypt($password));
|
||||||
$new_account->setEMail($email);
|
$new_account->setEMail($email);
|
||||||
$new_account->unblock();
|
$new_account->unblock();
|
||||||
$new_account->save();
|
$new_account->save();
|
||||||
$new_account->setCustomField("created", time());
|
|
||||||
|
if($config_salt_enabled)
|
||||||
|
$new_account->setCustomField('salt', $salt);
|
||||||
|
|
||||||
|
$new_account->setCustomField('created', time());
|
||||||
$new_account->logAction('Account created.');
|
$new_account->logAction('Account created.');
|
||||||
|
|
||||||
if($config['account_country']) {
|
if($config['account_country']) {
|
||||||
@@ -138,6 +163,7 @@ if($step == 'save')
|
|||||||
$new_account->setCustomField('premium_points', $config['account_premium_points']);
|
$new_account->setCustomField('premium_points', $config['account_premium_points']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$tmp_account = (USE_ACCOUNT_NAME ? $account_name : $account_id);
|
||||||
if($config['mail_enabled'] && $config['account_mail_verify'])
|
if($config['mail_enabled'] && $config['account_mail_verify'])
|
||||||
{
|
{
|
||||||
$hash = md5(generateRandomString(16, true, true) . $email);
|
$hash = md5(generateRandomString(16, true, true) . $email);
|
||||||
@@ -145,12 +171,13 @@ if($step == 'save')
|
|||||||
|
|
||||||
$verify_url = BASE_URL . '?p=account&action=confirm_email&v=' . $hash;
|
$verify_url = BASE_URL . '?p=account&action=confirm_email&v=' . $hash;
|
||||||
$server_name = $config['lua']['serverName'];
|
$server_name = $config['lua']['serverName'];
|
||||||
|
|
||||||
$body_plain = "Hello!
|
$body_plain = "Hello!
|
||||||
|
|
||||||
Thank you for registering on $server_name!
|
Thank you for registering on $server_name!
|
||||||
|
|
||||||
Here are the details of your account:
|
Here are the details of your account:
|
||||||
Name: $account_name
|
Account" . (USE_ACCOUNT_NAME ? ' Name' : '') . ": $tmp_account
|
||||||
Password: ************ (hidden for security reasons)
|
Password: ************ (hidden for security reasons)
|
||||||
|
|
||||||
To verify your email address please click the link below:
|
To verify your email address please click the link below:
|
||||||
@@ -162,7 +189,7 @@ If you haven't registered on $server_name please ignore this email.";
|
|||||||
Thank you for registering on ' . $config['lua']['serverName'] . '!<br/>
|
Thank you for registering on ' . $config['lua']['serverName'] . '!<br/>
|
||||||
<br/>
|
<br/>
|
||||||
Here are the details of your account:<br/>
|
Here are the details of your account:<br/>
|
||||||
Name: ' . $account_name . '<br/>
|
Account' . (USE_ACCOUNT_NAME ? ' Name' : '') . ': ' . $tmp_account . '<br/>
|
||||||
Password: ************ (hidden for security reasons)<br/>
|
Password: ************ (hidden for security reasons)<br/>
|
||||||
<br/>
|
<br/>
|
||||||
To verify your email address please click the link below:<br/>
|
To verify your email address please click the link below:<br/>
|
||||||
@@ -175,13 +202,13 @@ If you haven\'t registered on ' . $config['lua']['serverName'] . ' please ignore
|
|||||||
Your account has been created.<br/><br/>
|
Your account has been created.<br/><br/>
|
||||||
<table width="100%" border="0" cellspacing="1" cellpadding="4">
|
<table width="100%" border="0" cellspacing="1" cellpadding="4">
|
||||||
<tr><td bgcolor="<?php echo $config['vdarkborder']; ?>" class="white"><b>Account Created</b></td></tr>
|
<tr><td bgcolor="<?php echo $config['vdarkborder']; ?>" class="white"><b>Account Created</b></td></tr>
|
||||||
<tr><td bgcolor="<?php echo $config['darkborder']; ?>'">
|
<tr><td bgcolor="<?php echo $config['darkborder']; ?>">
|
||||||
<table border="0" cellpadding="1"><tr><td>
|
<table border="0" cellpadding="1"><tr><td>
|
||||||
<br/>Your account name is <b><?php echo $account_name; ?></b>.
|
<br/>Your account<?php echo (USE_ACCOUNT_NAME ? 'name' : 'number'); ?> is <b><?php echo $tmp_account; ?></b>.
|
||||||
|
|
||||||
You will need the account name and your password to play on <?php echo $config['lua']['serverName']; ?>.
|
You will need the account <?php echo (USE_ACCOUNT_NAME ? 'name' : 'number'); ?> and your password to play on <?php echo $config['lua']['serverName']; ?>.
|
||||||
Please keep your account name and password in a safe place and
|
Please keep your account <?php echo (USE_ACCOUNT_NAME ? 'name' : 'number'); ?> and password in a safe place and
|
||||||
never give your account name or password to anybody.<br/><br/>
|
never give your account <?php echo (USE_ACCOUNT_NAME ? 'name' : 'number'); ?> or password to anybody.<br/><br/>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -197,9 +224,9 @@ If you haven\'t registered on ' . $config['lua']['serverName'] . ' please ignore
|
|||||||
<TR><TD BGCOLOR="'.$config['vdarkborder'].'" class="white"><B>Account Created</B></TD></TR>
|
<TR><TD BGCOLOR="'.$config['vdarkborder'].'" class="white"><B>Account Created</B></TD></TR>
|
||||||
<TR><TD BGCOLOR="'.$config['darkborder'].'">
|
<TR><TD BGCOLOR="'.$config['darkborder'].'">
|
||||||
<TABLE BORDER=0 CELLPADDING=1><TR><TD>
|
<TABLE BORDER=0 CELLPADDING=1><TR><TD>
|
||||||
<br/>Your account name is <b>'.$account_name.'</b><br/>You will need the account name and your password to play on '.$config['lua']['serverName'].'.
|
<br/>Your account ' . (USE_ACCOUNT_NAME ? 'name' : 'number') . ' is <b>'.$tmp_account.'</b><br/>You will need the account ' . (USE_ACCOUNT_NAME ? 'name' : 'number') . ' and your password to play on '.$config['lua']['serverName'].'.
|
||||||
Please keep your account name and password in a safe place and
|
Please keep your account ' . (USE_ACCOUNT_NAME ? 'name' : 'number') . ' and password in a safe place and
|
||||||
never give your account name or password to anybody.<br/><br/>';
|
never give your account ' . (USE_ACCOUNT_NAME ? 'name' : 'number') . ' or password to anybody.<br/><br/>';
|
||||||
|
|
||||||
if($config['mail_enabled'] && $config['account_welcome_mail'])
|
if($config['mail_enabled'] && $config['account_welcome_mail'])
|
||||||
{
|
{
|
||||||
@@ -208,7 +235,7 @@ If you haven\'t registered on ' . $config['lua']['serverName'] . ' please ignore
|
|||||||
<p>Thanks for your registration at <a href=" ' . BASE_URL . '"><b>' . $config['lua']['serverName'] . '</b></a></p>
|
<p>Thanks for your registration at <a href=" ' . BASE_URL . '"><b>' . $config['lua']['serverName'] . '</b></a></p>
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
Your login details:
|
Your login details:
|
||||||
<p>Account name: <b>' . $account_name . '</b></p>
|
<p>Account' . (USE_ACCOUNT_NAME ? ' name' : '') . ': <b>' . $tmp_account . '</b></p>
|
||||||
<p>Password: <b>' . str_repeat('*', strlen(trim($password))) . '</b> (hidden for security reasons)</p>
|
<p>Password: <b>' . str_repeat('*', strlen(trim($password))) . '</b> (hidden for security reasons)</p>
|
||||||
<p>Kind Regards,</p>';
|
<p>Kind Regards,</p>';
|
||||||
|
|
||||||
@@ -241,9 +268,9 @@ function checkAccount()
|
|||||||
eventId = 0;
|
eventId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(document.getElementById("account_name").value == "")
|
if(document.getElementById("account_input").value == "")
|
||||||
{
|
{
|
||||||
document.getElementById("acc_name_check").innerHTML = '<b><font color="red">Please enter account name.</font></b>';
|
document.getElementById("acc_check").innerHTML = '<b><font color="red">Please enter account<?php echo (USE_ACCOUNT_NAME ? ' name' : 'number'); ?>.</font></b>';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,10 +287,10 @@ function checkAccount()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
account = document.getElementById("account_name").value;
|
account = document.getElementById("account_input").value;
|
||||||
$.get("tools/validate.php", { account: account, uid: Math.random() },
|
$.get("tools/validate.php", { account: account, uid: Math.random() },
|
||||||
function(data){
|
function(data){
|
||||||
document.getElementById("acc_name_check").innerHTML = data;
|
document.getElementById("acc_check").innerHTML = data;
|
||||||
lastSend = timeNow;
|
lastSend = timeNow;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -296,7 +323,6 @@ function checkEmail()
|
|||||||
}
|
}
|
||||||
|
|
||||||
email = document.getElementById("email").value;
|
email = document.getElementById("email").value;
|
||||||
account = document.getElementById("account_name").value;
|
|
||||||
$.get("tools/validate.php", { email: email, uid: Math.random() },
|
$.get("tools/validate.php", { email: email, uid: Math.random() },
|
||||||
function(data){
|
function(data){
|
||||||
document.getElementById("email_check").innerHTML = data;
|
document.getElementById("email_check").innerHTML = data;
|
||||||
@@ -338,8 +364,8 @@ function validate_form(thisform)
|
|||||||
{
|
{
|
||||||
with (thisform)
|
with (thisform)
|
||||||
{
|
{
|
||||||
if (validate_required(account_name,"Please enter name of new account!")==false)
|
if (validate_required(account_input,"Please enter name of new account!")==false)
|
||||||
{account_name.focus();return false;}
|
{account_input.focus();return false;}
|
||||||
if (validate_required(email,"Please enter your e-mail!")==false)
|
if (validate_required(email,"Please enter your e-mail!")==false)
|
||||||
{email.focus();return false;}
|
{email.focus();return false;}
|
||||||
if (validate_email(email,"Invalid e-mail format!")==false)
|
if (validate_email(email,"Invalid e-mail format!")==false)
|
||||||
@@ -362,11 +388,11 @@ function validate_form(thisform)
|
|||||||
output_errors($errors);
|
output_errors($errors);
|
||||||
?>
|
?>
|
||||||
To play on <?php echo $config['lua']['serverName']; ?> you need an account.
|
To play on <?php echo $config['lua']['serverName']; ?> you need an account.
|
||||||
All you have to do to create your new account is to enter an account name, password<?php
|
All you have to do to create your new account is to enter an account <?php echo (USE_ACCOUNT_NAME ? 'name' : 'number'); ?>, password<?php
|
||||||
if($config['recaptcha_enabled']) echo ', confirm reCAPTCHA';
|
if($config['recaptcha_enabled']) echo ', confirm reCAPTCHA';
|
||||||
if($config['account_country']) echo ', country';
|
if($config['account_country']) echo ', country';
|
||||||
?> and your email address.
|
?> and your email address.
|
||||||
Also you have to agree to the terms presented below. If you have done so, your account name will be shown on the following page and your account password will be sent to your email address along with further instructions. If you do not receive the email with your password, please check your spam filter.<br/><br/>
|
Also you have to agree to the terms presented below. If you have done so, your account <?php echo (USE_ACCOUNT_NAME ? 'name' : 'number'); ?> will be shown on the following page and your account password will be sent to your email address along with further instructions. If you do not receive the email with your password, please check your spam filter.<br/><br/>
|
||||||
<form action="?subtopic=createaccount" method="post" >
|
<form action="?subtopic=createaccount" method="post" >
|
||||||
<div class="TableContainer" >
|
<div class="TableContainer" >
|
||||||
<table class="Table1" cellpadding="0" cellspacing="0" >
|
<table class="Table1" cellpadding="0" cellspacing="0" >
|
||||||
@@ -389,14 +415,14 @@ Also you have to agree to the terms presented below. If you have done so, your a
|
|||||||
<table style="width:100%;" >
|
<table style="width:100%;" >
|
||||||
<tr>
|
<tr>
|
||||||
<td class="LabelV" >
|
<td class="LabelV" >
|
||||||
<span<?php echo (isset($errors['account_name'][0]) ? ' class="red"' : ''); ?>>Account Name:</span>
|
<span<?php echo (isset($errors['account'][0]) ? ' class="red"' : ''); ?>>Account <?php echo (USE_ACCOUNT_NAME ? 'Name' : 'Number'); ?>:</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" name="account_name" id="account_name" onkeyup="checkAccount();" id="account-name-input" size="30" maxlength="30" value="<?php echo (isset($_POST['account_name']) ? $_POST['account_name'] : ''); ?>" />
|
<input type="text" name="account" id="account_input" onkeyup="checkAccount();" size="30" maxlength="<?php echo (USE_ACCOUNT_NAME ? '30' : '10'); ?>" value="<?php echo (isset($_POST['account']) ? $_POST['account'] : ''); ?>" />
|
||||||
<small id="acc_name_check"></small>
|
<small id="acc_check"></small>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php write_if_error('account_name'); ?>
|
<?php write_if_error('account'); ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="LabelV" >
|
<td class="LabelV" >
|
||||||
<span<?php echo (isset($errors['email'][0]) ? ' class="red"' : ''); ?>>Email Address:</span>
|
<span<?php echo (isset($errors['email'][0]) ? ' class="red"' : ''); ?>>Email Address:</span>
|
||||||
@@ -522,7 +548,7 @@ Also you have to agree to the terms presented below. If you have done so, your a
|
|||||||
</table>
|
</table>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function() {
|
$(function() {
|
||||||
$('#account-name-input').focus();
|
$('#account_input').focus();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
* @author Gesior <jerzyskalski@wp.pl>
|
* @author Gesior <jerzyskalski@wp.pl>
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
@@ -303,7 +303,7 @@ if(isset($monster['name']))
|
|||||||
echo '</TABLE></td></tr>';
|
echo '</TABLE></td></tr>';
|
||||||
|
|
||||||
echo '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>';
|
echo '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>';
|
||||||
$loot = simplexml_load_file($config['server_path'] . 'data/monster/' . $monster['file_path']);
|
$loot = simplexml_load_file($config['data_path'] . 'monster/' . $monster['file_path']);
|
||||||
if($loot)
|
if($loot)
|
||||||
{
|
{
|
||||||
if($item = $loot->loot->item)
|
if($item = $loot->loot->item)
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
* @author Gesior <jerzyskalski@wp.pl>
|
* @author Gesior <jerzyskalski@wp.pl>
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
$title = 'Downloads';
|
$title = 'Downloads';
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
* @author Gesior <jerzyskalski@wp.pl>
|
* @author Gesior <jerzyskalski@wp.pl>
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
@@ -16,12 +16,14 @@ if(!isset($config['lua']['experienceStages']) || !getBoolean($config['lua']['exp
|
|||||||
{
|
{
|
||||||
$enabled = false;
|
$enabled = false;
|
||||||
|
|
||||||
|
if(file_exists($config['data_path'] . 'XML/stages.xml')) {
|
||||||
$stages = new DOMDocument();
|
$stages = new DOMDocument();
|
||||||
$stages->load($config['data_path'] . 'XML/stages.xml');
|
$stages->load($config['data_path'] . 'XML/stages.xml');
|
||||||
foreach($stages->getElementsByTagName('config') as $node) {
|
foreach($stages->getElementsByTagName('config') as $node) {
|
||||||
if($node->getAttribute('enabled'))
|
if($node->getAttribute('enabled'))
|
||||||
$enabled = true;
|
$enabled = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!$enabled) {
|
if(!$enabled) {
|
||||||
$rate_exp = 'not set';
|
$rate_exp = 'not set';
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
* @author Gesior <jerzyskalski@wp.pl>
|
* @author Gesior <jerzyskalski@wp.pl>
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
@@ -33,7 +33,7 @@ Remember you can also check the respective skill bar in your skill window of the
|
|||||||
<td><b>Experience</b></td>
|
<td><b>Experience</b></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
for($level = $i * 100 + 1; $level < $i * 100 + 101; $level++)
|
for($level = $i * $config['experiencetable_rows'] + 1; $level < $i * $config['experiencetable_rows'] + ($config['experiencetable_rows'] + 1); $level++)
|
||||||
{
|
{
|
||||||
?>
|
?>
|
||||||
<tr bgcolor="<?php echo $config['lightborder']; ?>">
|
<tr bgcolor="<?php echo $config['lightborder']; ?>">
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
* @author Gesior <jerzyskalski@wp.pl>
|
* @author Gesior <jerzyskalski@wp.pl>
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
@@ -138,7 +138,7 @@ if(empty($action))
|
|||||||
foreach($sections as $id => $section)
|
foreach($sections as $id => $section)
|
||||||
{
|
{
|
||||||
$last_post = $db->query("SELECT `players`.`name`, `" . TABLE_PREFIX . "forum`.`post_date` FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `" . TABLE_PREFIX . "forum`.`section` = ".(int) $id." AND `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` ORDER BY `post_date` DESC LIMIT 1")->fetch();
|
$last_post = $db->query("SELECT `players`.`name`, `" . TABLE_PREFIX . "forum`.`post_date` FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `" . TABLE_PREFIX . "forum`.`section` = ".(int) $id." AND `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` ORDER BY `post_date` DESC LIMIT 1")->fetch();
|
||||||
echo '<tr bgcolor="'.getStyle(++$number_of_rows).'"><td><a href="?subtopic=forum&action=show_board&id='.$id.'">'.$section['name'].'</a><br /><small>'.$section['description'].'</small></td><td>'.(int) (isset($counters[$id]['posts']) ? $counters[$id]['posts'] : 0).'</td><td>'.(int) (isset($counters[$id]['threads']) ? $counters[$id]['threads'] : 0).'</td><td>';
|
echo '<tr bgcolor="'.getStyle(++$number_of_rows).'"><td><a href="' . getForumBoardLink($id) . '">'.$section['name'].'</a><br /><small>'.$section['description'].'</small></td><td>'.(int) (isset($counters[$id]['posts']) ? $counters[$id]['posts'] : 0).'</td><td>'.(int) (isset($counters[$id]['threads']) ? $counters[$id]['threads'] : 0).'</td><td>';
|
||||||
if(isset($last_post['name']))
|
if(isset($last_post['name']))
|
||||||
echo date('d.m.y H:i:s', $last_post['post_date']).'<br />by ' . getPlayerLink($last_post['name']);
|
echo date('d.m.y H:i:s', $last_post['post_date']).'<br />by ' . getPlayerLink($last_post['name']);
|
||||||
else
|
else
|
||||||
@@ -158,11 +158,11 @@ if($action == 'show_board')
|
|||||||
for($i = 0; $i < $threads_count['threads_count'] / $config['forum_threads_per_page']; $i++)
|
for($i = 0; $i < $threads_count['threads_count'] / $config['forum_threads_per_page']; $i++)
|
||||||
{
|
{
|
||||||
if($i != $_page)
|
if($i != $_page)
|
||||||
$links_to_pages .= '<a href="?subtopic=forum&action=show_board&id='.$section_id.'&page='.$i.'">'.($i + 1).'</a> ';
|
$links_to_pages .= '<a href="' . getForumBoardLink($section_id, $i) . '">'.($i + 1).'</a> ';
|
||||||
else
|
else
|
||||||
$links_to_pages .= '<b>'.($i + 1).' </b>';
|
$links_to_pages .= '<b>'.($i + 1).' </b>';
|
||||||
}
|
}
|
||||||
echo '<a href="?subtopic=forum">Boards</a> >> <b>'.$sections[$section_id]['name'].'</b>';
|
echo '<a href="' . getPageLink('forum') . '">Boards</a> >> <b>'.$sections[$section_id]['name'].'</b>';
|
||||||
if(!$sections[$section_id]['closed'] || Forum::isModerator())
|
if(!$sections[$section_id]['closed'] || Forum::isModerator())
|
||||||
{
|
{
|
||||||
echo '<br /><br />
|
echo '<br /><br />
|
||||||
@@ -170,10 +170,12 @@ if($action == 'show_board')
|
|||||||
}
|
}
|
||||||
|
|
||||||
echo '<br /><br />Page: '.$links_to_pages.'<br />';
|
echo '<br /><br />Page: '.$links_to_pages.'<br />';
|
||||||
$last_threads = $db->query("SELECT `players`.`name`, `" . TABLE_PREFIX . "forum`.`post_text`, `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`id`, `" . TABLE_PREFIX . "forum`.`last_post`, `" . TABLE_PREFIX . "forum`.`replies`, `" . TABLE_PREFIX . "forum`.`views`, `" . TABLE_PREFIX . "forum`.`post_date` FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` AND `" . TABLE_PREFIX . "forum`.`section` = ".(int) $section_id." AND `" . TABLE_PREFIX . "forum`.`first_post` = `" . TABLE_PREFIX . "forum`.`id` ORDER BY `" . TABLE_PREFIX . "forum`.`last_post` DESC LIMIT ".$config['forum_threads_per_page']." OFFSET ".($_page * $config['forum_threads_per_page']))->fetchAll();
|
$last_threads = $db->query("SELECT `players`.`id` as `player_id`, `players`.`name`, `" . TABLE_PREFIX . "forum`.`post_text`, `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`id`, `" . TABLE_PREFIX . "forum`.`last_post`, `" . TABLE_PREFIX . "forum`.`replies`, `" . TABLE_PREFIX . "forum`.`views`, `" . TABLE_PREFIX . "forum`.`post_date` FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` AND `" . TABLE_PREFIX . "forum`.`section` = ".(int) $section_id." AND `" . TABLE_PREFIX . "forum`.`first_post` = `" . TABLE_PREFIX . "forum`.`id` ORDER BY `" . TABLE_PREFIX . "forum`.`last_post` DESC LIMIT ".$config['forum_threads_per_page']." OFFSET ".($_page * $config['forum_threads_per_page']))->fetchAll();
|
||||||
if(isset($last_threads[0]))
|
if(isset($last_threads[0]))
|
||||||
{
|
{
|
||||||
echo '<table width="100%"><tr bgcolor="'.$config['vdarkborder'].'" align="center"><td><font color="white" size="1"><b>Thread</b></font></td><td><font color="white" size="1"><b>Thread Starter</b></font></td><td><font color="white" size="1"><b>Replies</b></font></td><td><font color="white" size="1"><b>Views</b></font></td><td><font color="white" size="1"><b>Last Post</b></font></td></tr>';
|
echo '<table width="100%"><tr bgcolor="'.$config['vdarkborder'].'" align="center"><td><font color="white" size="1"><b>Thread</b></font></td><td><font color="white" size="1"><b>Thread Starter</b></font></td><td><font color="white" size="1"><b>Replies</b></font></td><td><font color="white" size="1"><b>Views</b></font></td><td><font color="white" size="1"><b>Last Post</b></font></td></tr>';
|
||||||
|
|
||||||
|
$player = $ots->createObject('Player');
|
||||||
foreach($last_threads as $thread)
|
foreach($last_threads as $thread)
|
||||||
{
|
{
|
||||||
echo '<tr bgcolor="' . getStyle($number_of_rows++) . '"><td>';
|
echo '<tr bgcolor="' . getStyle($number_of_rows++) . '"><td>';
|
||||||
@@ -182,7 +184,17 @@ if($action == 'show_board')
|
|||||||
echo '<a href="?subtopic=forum&action=move_thread&id='.$thread['id'].'"\')"><span style="color:darkgreen">[MOVE]</span></a>';
|
echo '<a href="?subtopic=forum&action=move_thread&id='.$thread['id'].'"\')"><span style="color:darkgreen">[MOVE]</span></a>';
|
||||||
echo '<a href="?subtopic=forum&action=remove_post&id='.$thread['id'].'" onclick="return confirm(\'Are you sure you want remove thread > '.$thread['post_topic'].' <?\')"><font color="red">[REMOVE]</font></a> ';
|
echo '<a href="?subtopic=forum&action=remove_post&id='.$thread['id'].'" onclick="return confirm(\'Are you sure you want remove thread > '.$thread['post_topic'].' <?\')"><font color="red">[REMOVE]</font></a> ';
|
||||||
}
|
}
|
||||||
echo '<a href="?subtopic=forum&action=show_thread&id='.$thread['id'].'">'.htmlspecialchars($thread['post_topic']).'</a><br /><small>'.htmlspecialchars(substr($thread['post_text'], 0, 50)).'...</small></td><td>' . getPlayerLink($thread['name']) . '</td><td>'.(int) $thread['replies'].'</td><td>'.(int) $thread['views'].'</td><td>';
|
|
||||||
|
$player->load($thread['player_id']);
|
||||||
|
if(!$player->isLoaded()) {
|
||||||
|
error('Forum error: Player not loaded.');
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
$player_account = $player->getAccount();
|
||||||
|
$canEditForum = $player_account->hasFlag(FLAG_CONTENT_FORUM) || $player_account->isAdmin();
|
||||||
|
|
||||||
|
echo '<a href="' . getForumThreadLink($thread['id']) . '">'.($canEditForum ? $thread['post_topic'] : htmlspecialchars($thread['post_topic'])) . '</a><br /><small>'.($canEditForum ? substr(strip_tags($thread['post_text']), 0, 50) : htmlspecialchars(substr($thread['post_text'], 0, 50))).'...</small></td><td>' . getPlayerLink($thread['name']) . '</td><td>'.(int) $thread['replies'].'</td><td>'.(int) $thread['views'].'</td><td>';
|
||||||
if($thread['last_post'] > 0)
|
if($thread['last_post'] > 0)
|
||||||
{
|
{
|
||||||
$last_post = $db->query("SELECT `players`.`name`, `" . TABLE_PREFIX . "forum`.`post_date` FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread['id']." AND `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` ORDER BY `post_date` DESC LIMIT 1")->fetch();
|
$last_post = $db->query("SELECT `players`.`name`, `" . TABLE_PREFIX . "forum`.`post_date` FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread['id']." AND `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` ORDER BY `post_date` DESC LIMIT 1")->fetch();
|
||||||
@@ -214,30 +226,26 @@ if($action == 'show_thread')
|
|||||||
for($i = 0; $i < $posts_count['posts_count'] / $config['forum_threads_per_page']; $i++)
|
for($i = 0; $i < $posts_count['posts_count'] / $config['forum_threads_per_page']; $i++)
|
||||||
{
|
{
|
||||||
if($i != $_page)
|
if($i != $_page)
|
||||||
$links_to_pages .= '<a href="?subtopic=forum&action=show_thread&id='.$thread_id.'&page='.$i.'">'.($i + 1).'</a> ';
|
$links_to_pages .= '<a href="' . getForumThreadLink($thread_id, $i) . '">'.($i + 1).'</a> ';
|
||||||
else
|
else
|
||||||
$links_to_pages .= '<b>'.($i + 1).' </b>';
|
$links_to_pages .= '<b>'.($i + 1).' </b>';
|
||||||
}
|
}
|
||||||
$threads = $db->query("SELECT `players`.`id` as `player_id`, `players`.`name`, `players`.`account_id`, `players`.`vocation`" . (fieldExist('promotion', 'players') ? ", `players`.`promotion`" : "") . ", `players`.`level`, `" . TABLE_PREFIX . "forum`.`id`,`" . TABLE_PREFIX . "forum`.`first_post`, `" . TABLE_PREFIX . "forum`.`section`,`" . TABLE_PREFIX . "forum`.`post_text`, `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`post_date`, `" . TABLE_PREFIX . "forum`.`post_smile`, `" . TABLE_PREFIX . "forum`.`author_aid`, `" . TABLE_PREFIX . "forum`.`author_guid`, `" . TABLE_PREFIX . "forum`.`last_edit_aid`, `" . TABLE_PREFIX . "forum`.`edit_date` FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` AND `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread_id." ORDER BY `" . TABLE_PREFIX . "forum`.`post_date` LIMIT ".$config['forum_posts_per_page']." OFFSET ".($_page * $config['forum_posts_per_page']))->fetchAll();
|
$threads = $db->query("SELECT `players`.`id` as `player_id`, `players`.`name`, `players`.`account_id`, `players`.`vocation`" . (fieldExist('promotion', 'players') ? ", `players`.`promotion`" : "") . ", `players`.`level`, `" . TABLE_PREFIX . "forum`.`id`,`" . TABLE_PREFIX . "forum`.`first_post`, `" . TABLE_PREFIX . "forum`.`section`,`" . TABLE_PREFIX . "forum`.`post_text`, `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`post_date`, `" . TABLE_PREFIX . "forum`.`post_smile`, `" . TABLE_PREFIX . "forum`.`author_aid`, `" . TABLE_PREFIX . "forum`.`author_guid`, `" . TABLE_PREFIX . "forum`.`last_edit_aid`, `" . TABLE_PREFIX . "forum`.`edit_date` FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` AND `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread_id." ORDER BY `" . TABLE_PREFIX . "forum`.`post_date` LIMIT ".$config['forum_posts_per_page']." OFFSET ".($_page * $config['forum_posts_per_page']))->fetchAll();
|
||||||
if(isset($threads[0]['name']))
|
if(isset($threads[0]['name']))
|
||||||
$db->query("UPDATE `" . TABLE_PREFIX . "forum` SET `views`=`views`+1 WHERE `id` = ".(int) $thread_id);
|
$db->query("UPDATE `" . TABLE_PREFIX . "forum` SET `views`=`views`+1 WHERE `id` = ".(int) $thread_id);
|
||||||
echo '<a href="?subtopic=forum">Boards</a> >> <a href="?subtopic=forum&action=show_board&id='.$threads[0]['section'].'">'.$sections[$threads[0]['section']]['name'].'</a> >> <b>'.$thread_name['post_topic'].'</b>';
|
echo '<a href="' . getPageLink('forum') . '">Boards</a> >> <a href="' . getForumBoardLink($threads[0]['section']) . '">'.$sections[$threads[0]['section']]['name'].'</a> >> <b>'.$thread_name['post_topic'].'</b>';
|
||||||
echo '<br /><br /><a href="?subtopic=forum&action=new_post&thread_id='.$thread_id.'"><img src="images/forum/post.gif" border="0" /></a><br /><br />Page: '.$links_to_pages.'<br /><table width="100%"><tr bgcolor="'.$config['lightborder'].'" width="100%"><td colspan="2"><font size="4"><b>'.htmlspecialchars($thread_name['post_topic']).'</b></font><font size="1"><br />by ' . getPlayerLink($thread_name['name']) . '</font></td></tr><tr bgcolor="'.$config['vdarkborder'].'"><td width="200"><font color="white" size="1"><b>Author</b></font></td><td> </td></tr>';
|
echo '<br /><br /><a href="?subtopic=forum&action=new_post&thread_id='.$thread_id.'"><img src="images/forum/post.gif" border="0" /></a><br /><br />Page: '.$links_to_pages.'<br /><table width="100%"><tr bgcolor="'.$config['lightborder'].'" width="100%"><td colspan="2"><font size="4"><b>'.htmlspecialchars($thread_name['post_topic']).'</b></font><font size="1"><br />by ' . getPlayerLink($thread_name['name']) . '</font></td></tr><tr bgcolor="'.$config['vdarkborder'].'"><td width="200"><font color="white" size="1"><b>Author</b></font></td><td> </td></tr>';
|
||||||
$player = $ots->createObject('Player');
|
$player = $ots->createObject('Player');
|
||||||
foreach($threads as $thread)
|
foreach($threads as $thread)
|
||||||
{
|
{
|
||||||
if(isset($thread['promotion'])) {
|
|
||||||
if((int)$thread['promotion'] > 0)
|
|
||||||
$thread['vocation'] + ($thread['promotion'] * 4);
|
|
||||||
}
|
|
||||||
echo '<tr bgcolor="' . getStyle($number_of_rows++) . '"><td valign="top">' . getPlayerLink($thread['name']) . '<br /><br /><font size="1">Profession: '.$config['vocations'][$thread['vocation']].'<br />Level: '.$thread['level'].'<br />';
|
|
||||||
|
|
||||||
$player->load($thread['player_id']);
|
$player->load($thread['player_id']);
|
||||||
if(!$player->isLoaded()) {
|
if(!$player->isLoaded()) {
|
||||||
error('Player not loaded');
|
error('Forum error: Player not loaded.');
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo '<tr bgcolor="' . getStyle($number_of_rows++) . '"><td valign="top">' . getPlayerLink($thread['name']) . '<br /><br /><font size="1">Profession: '.$config['vocations'][$player->getVocation()].'<br />Level: '.$thread['level'].'<br />';
|
||||||
|
|
||||||
$rank = $player->getRank();
|
$rank = $player->getRank();
|
||||||
if($rank->isLoaded())
|
if($rank->isLoaded())
|
||||||
{
|
{
|
||||||
@@ -245,8 +253,11 @@ if($action == 'show_thread')
|
|||||||
if($guild->isLoaded())
|
if($guild->isLoaded())
|
||||||
echo $rank->getName().' of <a href="'.getGuildLink($guild->getName(), false).'">'.$guild->getName().'</a><br />';
|
echo $rank->getName().' of <a href="'.getGuildLink($guild->getName(), false).'">'.$guild->getName().'</a><br />';
|
||||||
}
|
}
|
||||||
|
$player_account = $player->getAccount();
|
||||||
|
$canEditForum = $player_account->hasFlag(FLAG_CONTENT_FORUM) || $player_account->isAdmin();
|
||||||
|
|
||||||
$posts = $db->query("SELECT COUNT(`id`) AS 'posts' FROM `" . TABLE_PREFIX . "forum` WHERE `author_aid`=".(int) $thread['account_id'])->fetch();
|
$posts = $db->query("SELECT COUNT(`id`) AS 'posts' FROM `" . TABLE_PREFIX . "forum` WHERE `author_aid`=".(int) $thread['account_id'])->fetch();
|
||||||
echo '<br />Posts: '.(int) $posts['posts'].'<br /></font></td><td valign="top">'.showPost(htmlspecialchars($thread['post_topic']), htmlspecialchars($thread['post_text']), $thread['post_smile']).'</td></tr>
|
echo '<br />Posts: '.(int) $posts['posts'].'<br /></font></td><td valign="top">'.showPost(($canEditForum ? $thread['post_topic'] : htmlspecialchars($thread['post_topic'])), ($canEditForum ? $thread['post_text'] : htmlspecialchars($thread['post_text'])), $thread['post_smile']).'</td></tr>
|
||||||
<tr bgcolor="'.getStyle($number_of_rows++).'"><td><font size="1">'.date('d.m.y H:i:s', $thread['post_date']);
|
<tr bgcolor="'.getStyle($number_of_rows++).'"><td><font size="1">'.date('d.m.y H:i:s', $thread['post_date']);
|
||||||
if($thread['edit_date'] > 0)
|
if($thread['edit_date'] > 0)
|
||||||
{
|
{
|
||||||
@@ -296,14 +307,14 @@ if($action == 'remove_post')
|
|||||||
if($post['id'] == $post['first_post'])
|
if($post['id'] == $post['first_post'])
|
||||||
{
|
{
|
||||||
$db->query("DELETE FROM `" . TABLE_PREFIX . "forum` WHERE `first_post` = ".$post['id']);
|
$db->query("DELETE FROM `" . TABLE_PREFIX . "forum` WHERE `first_post` = ".$post['id']);
|
||||||
header('Location: ?subtopic=forum&action=show_board&id='.$post['section']);
|
header('Location: ' . getForumBoardLink($post['section']));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$post_page = $db->query("SELECT COUNT(`" . TABLE_PREFIX . "forum`.`id`) AS posts_count FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` AND `" . TABLE_PREFIX . "forum`.`id` < ".$id." AND `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $post['first_post'])->fetch();
|
$post_page = $db->query("SELECT COUNT(`" . TABLE_PREFIX . "forum`.`id`) AS posts_count FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` AND `" . TABLE_PREFIX . "forum`.`id` < ".$id." AND `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $post['first_post'])->fetch();
|
||||||
$_page = (int) ceil($post_page['posts_count'] / $config['forum_threads_per_page']) - 1;
|
$_page = (int) ceil($post_page['posts_count'] / $config['forum_threads_per_page']) - 1;
|
||||||
$db->query("DELETE FROM `" . TABLE_PREFIX . "forum` WHERE `id` = ".$post['id']);
|
$db->query("DELETE FROM `" . TABLE_PREFIX . "forum` WHERE `id` = ".$post['id']);
|
||||||
header('Location: ?subtopic=forum&action=show_thread&id='.$post['first_post'].'&page='.(int) $_page);
|
header('Location: ' . getForumThreadLink($post['first_post'], (int) $_page));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -319,7 +330,7 @@ if($action == 'new_post')
|
|||||||
$players_from_account = $db->query("SELECT `players`.`name`, `players`.`id` FROM `players` WHERE `players`.`account_id` = ".(int) $account_logged->getId())->fetchAll();
|
$players_from_account = $db->query("SELECT `players`.`name`, `players`.`id` FROM `players` WHERE `players`.`account_id` = ".(int) $account_logged->getId())->fetchAll();
|
||||||
$thread_id = (int) $_REQUEST['thread_id'];
|
$thread_id = (int) $_REQUEST['thread_id'];
|
||||||
$thread = $db->query("SELECT `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`id`, `" . TABLE_PREFIX . "forum`.`section` FROM `" . TABLE_PREFIX . "forum` WHERE `" . TABLE_PREFIX . "forum`.`id` = ".(int) $thread_id." AND `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread_id." LIMIT 1")->fetch();
|
$thread = $db->query("SELECT `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`id`, `" . TABLE_PREFIX . "forum`.`section` FROM `" . TABLE_PREFIX . "forum` WHERE `" . TABLE_PREFIX . "forum`.`id` = ".(int) $thread_id." AND `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread_id." LIMIT 1")->fetch();
|
||||||
echo '<a href="?subtopic=forum">Boards</a> >> <a href="?subtopic=forum&action=show_board&id='.$thread['section'].'">'.$sections[$thread['section']]['name'].'</a> >> <a href="?subtopic=forum&action=show_thread&id='.$thread_id.'">'.$thread['post_topic'].'</a> >> <b>Post new reply</b><br /><h3>'.$thread['post_topic'].'</h3>';
|
echo '<a href="' . getPageLink('forum') . '">Boards</a> >> <a href="' . getForumBoardLink($thread['section']) . '">'.$sections[$thread['section']]['name'].'</a> >> <a href="' . getForumThreadLink($thread_id) . '">'.$thread['post_topic'].'</a> >> <b>Post new reply</b><br /><h3>'.$thread['post_topic'].'</h3>';
|
||||||
if(isset($thread['id']))
|
if(isset($thread['id']))
|
||||||
{
|
{
|
||||||
$quote = isset($_REQUEST['quote']) ? (int) $_REQUEST['quote'] : NULL;
|
$quote = isset($_REQUEST['quote']) ? (int) $_REQUEST['quote'] : NULL;
|
||||||
@@ -374,8 +385,8 @@ if($action == 'new_post')
|
|||||||
$db->query("UPDATE `" . TABLE_PREFIX . "forum` SET `replies`=`replies`+1, `last_post`=".time()." WHERE `id` = ".(int) $thread_id);
|
$db->query("UPDATE `" . TABLE_PREFIX . "forum` SET `replies`=`replies`+1, `last_post`=".time()." WHERE `id` = ".(int) $thread_id);
|
||||||
$post_page = $db->query("SELECT COUNT(`" . TABLE_PREFIX . "forum`.`id`) AS posts_count FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` AND `" . TABLE_PREFIX . "forum`.`post_date` <= ".time()." AND `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread['id'])->fetch();
|
$post_page = $db->query("SELECT COUNT(`" . TABLE_PREFIX . "forum`.`id`) AS posts_count FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` AND `" . TABLE_PREFIX . "forum`.`post_date` <= ".time()." AND `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread['id'])->fetch();
|
||||||
$_page = (int) ceil($post_page['posts_count'] / $config['forum_threads_per_page']) - 1;
|
$_page = (int) ceil($post_page['posts_count'] / $config['forum_threads_per_page']) - 1;
|
||||||
header('Location: ?subtopic=forum&action=show_thread&id='.$thread_id.'&page='.$_page);
|
header('Location: ' . getForumThreadLink($thread_id, $_page));
|
||||||
echo '<br />Thank you for posting.<br /><a href="?subtopic=forum&action=show_thread&id='.$thread_id.'">GO BACK TO LAST THREAD</a>';
|
echo '<br />Thank you for posting.<br /><a href="' . getForumThreadLink($thread_id, $_page) . '">GO BACK TO LAST THREAD</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!$saved)
|
if(!$saved)
|
||||||
@@ -435,7 +446,7 @@ if($action == 'edit_post')
|
|||||||
if(isset($thread['id']))
|
if(isset($thread['id']))
|
||||||
{
|
{
|
||||||
$first_post = $db->query("SELECT `" . TABLE_PREFIX . "forum`.`author_guid`, `" . TABLE_PREFIX . "forum`.`author_aid`, `" . TABLE_PREFIX . "forum`.`first_post`, `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`post_text`, `" . TABLE_PREFIX . "forum`.`post_smile`, `" . TABLE_PREFIX . "forum`.`id`, `" . TABLE_PREFIX . "forum`.`section` FROM `" . TABLE_PREFIX . "forum` WHERE `" . TABLE_PREFIX . "forum`.`id` = ".(int) $thread['first_post']." LIMIT 1")->fetch();
|
$first_post = $db->query("SELECT `" . TABLE_PREFIX . "forum`.`author_guid`, `" . TABLE_PREFIX . "forum`.`author_aid`, `" . TABLE_PREFIX . "forum`.`first_post`, `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`post_text`, `" . TABLE_PREFIX . "forum`.`post_smile`, `" . TABLE_PREFIX . "forum`.`id`, `" . TABLE_PREFIX . "forum`.`section` FROM `" . TABLE_PREFIX . "forum` WHERE `" . TABLE_PREFIX . "forum`.`id` = ".(int) $thread['first_post']." LIMIT 1")->fetch();
|
||||||
echo '<a href="?subtopic=forum">Boards</a> >> <a href="?subtopic=forum&action=show_board&id='.$thread['section'].'">'.$sections[$thread['section']]['name'].'</a> >> <a href="?subtopic=forum&action=show_thread&id='.$thread['first_post'].'">'.$first_post['post_topic'].'</a> >> <b>Edit post</b>';
|
echo '<a href="' . getPageLink('forum') . '">Boards</a> >> <a href="' . getForumBoardLink($thread['section']) . '">'.$sections[$thread['section']]['name'].'</a> >> <a href="' . getForumThreadLink($thread['first_post']) . '">'.$first_post['post_topic'].'</a> >> <b>Edit post</b>';
|
||||||
if($account_logged->getId() == $thread['author_aid'] || Forum::isModerator())
|
if($account_logged->getId() == $thread['author_aid'] || Forum::isModerator())
|
||||||
{
|
{
|
||||||
$players_from_account = $db->query("SELECT `players`.`name`, `players`.`id` FROM `players` WHERE `players`.`account_id` = ".(int) $account_logged->getId())->fetchAll();
|
$players_from_account = $db->query("SELECT `players`.`name`, `players`.`id` FROM `players` WHERE `players`.`account_id` = ".(int) $account_logged->getId())->fetchAll();
|
||||||
@@ -483,8 +494,8 @@ if($action == 'edit_post')
|
|||||||
$db->query("UPDATE `" . TABLE_PREFIX . "forum` SET `author_guid` = ".(int) $char_id.", `post_text` = ".$db->quote($text).", `post_topic` = ".$db->quote($post_topic).", `post_smile` = ".(int) $smile.", `last_edit_aid` = ".(int) $account_logged->getId().",`edit_date` = ".time()." WHERE `id` = ".(int) $thread['id']);
|
$db->query("UPDATE `" . TABLE_PREFIX . "forum` SET `author_guid` = ".(int) $char_id.", `post_text` = ".$db->quote($text).", `post_topic` = ".$db->quote($post_topic).", `post_smile` = ".(int) $smile.", `last_edit_aid` = ".(int) $account_logged->getId().",`edit_date` = ".time()." WHERE `id` = ".(int) $thread['id']);
|
||||||
$post_page = $db->query("SELECT COUNT(`" . TABLE_PREFIX . "forum`.`id`) AS posts_count FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` AND `" . TABLE_PREFIX . "forum`.`post_date` <= ".$thread['post_date']." AND `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread['first_post'])->fetch();
|
$post_page = $db->query("SELECT COUNT(`" . TABLE_PREFIX . "forum`.`id`) AS posts_count FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` AND `" . TABLE_PREFIX . "forum`.`post_date` <= ".$thread['post_date']." AND `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread['first_post'])->fetch();
|
||||||
$_page = (int) ceil($post_page['posts_count'] / $config['forum_threads_per_page']) - 1;
|
$_page = (int) ceil($post_page['posts_count'] / $config['forum_threads_per_page']) - 1;
|
||||||
header('Location: ?subtopic=forum&action=show_thread&id='.$thread['first_post'].'&page='.$_page);
|
header('Location: ' . getForumThreadLink($thread['first_post'], $_page));
|
||||||
echo '<br />Thank you for editing post.<br /><a href="?subtopic=forum&action=show_thread&id='.$thread['first_post'].'">GO BACK TO LAST THREAD</a>';
|
echo '<br />Thank you for editing post.<br /><a href="' . getForumThreadLink($thread['first_post'], $_page) . '">GO BACK TO LAST THREAD</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -531,7 +542,7 @@ if($action == 'new_topic')
|
|||||||
{
|
{
|
||||||
$players_from_account = $db->query("SELECT `players`.`name`, `players`.`id` FROM `players` WHERE `players`.`account_id` = ".(int) $account_logged->getId())->fetchAll();
|
$players_from_account = $db->query("SELECT `players`.`name`, `players`.`id` FROM `players` WHERE `players`.`account_id` = ".(int) $account_logged->getId())->fetchAll();
|
||||||
$section_id = (int) $_REQUEST['section_id'];
|
$section_id = (int) $_REQUEST['section_id'];
|
||||||
echo '<a href="?subtopic=forum">Boards</a> >> <a href="?subtopic=forum&action=show_board&id='.$section_id.'">'.$sections[$section_id]['name'].'</a> >> <b>Post new thread</b><br />';
|
echo '<a href="' . getPageLink('forum') . '">Boards</a> >> <a href="' . getForumBoardLink($section_id) . '">'.$sections[$section_id]['name'].'</a> >> <b>Post new thread</b><br />';
|
||||||
if(isset($sections[$section_id]['name']))
|
if(isset($sections[$section_id]['name']))
|
||||||
{
|
{
|
||||||
if($sections[$section_id]['closed'] && !Forum::isModerator())
|
if($sections[$section_id]['closed'] && !Forum::isModerator())
|
||||||
@@ -590,8 +601,8 @@ if($action == 'new_topic')
|
|||||||
$db->query("INSERT INTO `" . TABLE_PREFIX . "forum` (`id` ,`first_post` ,`last_post` ,`section` ,`replies` ,`views` ,`author_aid` ,`author_guid` ,`post_text` ,`post_topic` ,`post_smile` ,`post_date` ,`last_edit_aid` ,`edit_date`, `post_ip`) VALUES ('null', '0', '".time()."', '".(int) $section_id."', '0', '0', '".$account_logged->getId()."', '".(int) $char_id."', ".$db->quote($text).", ".$db->quote($post_topic).", '".(int) $smile."', '".time()."', '0', '0', '".$_SERVER['REMOTE_ADDR']."')");
|
$db->query("INSERT INTO `" . TABLE_PREFIX . "forum` (`id` ,`first_post` ,`last_post` ,`section` ,`replies` ,`views` ,`author_aid` ,`author_guid` ,`post_text` ,`post_topic` ,`post_smile` ,`post_date` ,`last_edit_aid` ,`edit_date`, `post_ip`) VALUES ('null', '0', '".time()."', '".(int) $section_id."', '0', '0', '".$account_logged->getId()."', '".(int) $char_id."', ".$db->quote($text).", ".$db->quote($post_topic).", '".(int) $smile."', '".time()."', '0', '0', '".$_SERVER['REMOTE_ADDR']."')");
|
||||||
$thread_id = $db->lastInsertId();
|
$thread_id = $db->lastInsertId();
|
||||||
$db->query("UPDATE `" . TABLE_PREFIX . "forum` SET `first_post`=".(int) $thread_id." WHERE `id` = ".(int) $thread_id);
|
$db->query("UPDATE `" . TABLE_PREFIX . "forum` SET `first_post`=".(int) $thread_id." WHERE `id` = ".(int) $thread_id);
|
||||||
header('Location: ?subtopic=forum&action=show_thread&id='.$thread_id);
|
header('Location: ' . getForumThreadLink($thread_id));
|
||||||
echo '<br />Thank you for posting.<br /><a href="?subtopic=forum&action=show_thread&id='.$thread_id.'">GO BACK TO LAST THREAD</a>';
|
echo '<br />Thank you for posting.<br /><a href="' . getForumThreadLink($thread_id) . '">GO BACK TO LAST THREAD</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!$saved)
|
if(!$saved)
|
||||||
@@ -648,7 +659,7 @@ if($action == 'move_thread')
|
|||||||
<br/><strong>Select the new board: </strong><SELECT NAME=sektion>';
|
<br/><strong>Select the new board: </strong><SELECT NAME=sektion>';
|
||||||
foreach($sections as $id => $section) { echo '<OPTION value="'.$id.'">'.$section['name'].'</OPTION>'; } echo '</SELECT>
|
foreach($sections as $id => $section) { echo '<OPTION value="'.$id.'">'.$section['name'].'</OPTION>'; } echo '</SELECT>
|
||||||
<INPUT TYPE="submit" VALUE="Move Thread"></FORM>
|
<INPUT TYPE="submit" VALUE="Move Thread"></FORM>
|
||||||
<form action="?subtopic=forum&action=show_board&id='.$post['section'].'" method="POST">
|
<form action="' . getForumBoardLink($post['section']) . '" method="POST">
|
||||||
<input type="submit" value="Cancel"></form></td></tr></table></td></tr></table>';
|
<input type="submit" value="Cancel"></form></td></tr></table></td></tr></table>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -672,7 +683,7 @@ if($action == 'moved_thread')
|
|||||||
{
|
{
|
||||||
$db->query("UPDATE `" . TABLE_PREFIX . "forum` SET `section` = ".$board." WHERE `id` = ".$post['id']."") or die(mysql_error());
|
$db->query("UPDATE `" . TABLE_PREFIX . "forum` SET `section` = ".$board." WHERE `id` = ".$post['id']."") or die(mysql_error());
|
||||||
$nPost = $db->query( 'SELECT `section` FROM `' . TABLE_PREFIX . 'forum` WHERE `id` = \''.$id.'\' LIMIT 1;' )->fetch();
|
$nPost = $db->query( 'SELECT `section` FROM `' . TABLE_PREFIX . 'forum` WHERE `id` = \''.$id.'\' LIMIT 1;' )->fetch();
|
||||||
header('Location: ?subtopic=forum&action=show_board&id='.$nPost['section']);
|
header('Location: ' . getForumBoardLink($nPost['section']));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -6,12 +6,17 @@
|
|||||||
* @author Gesior <jerzyskalski@wp.pl>
|
* @author Gesior <jerzyskalski@wp.pl>
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
$title = 'Guilds';
|
$title = 'Guilds';
|
||||||
|
|
||||||
|
if(tableExist('guild_members'))
|
||||||
|
define('GUILD_MEMBERS_TABLE', 'guild_members');
|
||||||
|
else
|
||||||
|
define('GUILD_MEMBERS_TABLE', 'guild_membership');
|
||||||
|
|
||||||
if($action == 'login')
|
if($action == 'login')
|
||||||
{
|
{
|
||||||
if(check_guild_name($_REQUEST['guild']))
|
if(check_guild_name($_REQUEST['guild']))
|
||||||
@@ -98,10 +103,16 @@ if($action == '')
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
echo '<TR BGCOLOR='.$config['lightborder'].'><TD ALIGN="CENTER">-</TD><TD><IMG SRC="images/guilds/' . 'default.gif" WIDTH=64 HEIGHT=64></TD>
|
echo '<TR BGCOLOR='.$config['lightborder'].'><TD ALIGN="CENTER">-</TD><TD><IMG SRC="images/guilds/' . 'default.gif" WIDTH=64 HEIGHT=64></TD>
|
||||||
<TD valign="top" align="center"><B>Create guild</B><BR/>Actually there is no guild on server. Create first! Press button "Create Guild".</TD>
|
<TD valign="top" align="center"><B>Create guild</B><BR/>Actually there is no guild on server.' . ($logged ? ' Create first! Press button "Create Guild".' : '') . '</TD>
|
||||||
<TD colspan="4"><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><FORM ACTION="?subtopic=guilds&action=createguild" METHOD=post><TR><TD>
|
<TD colspan="4">';
|
||||||
|
if($logged)
|
||||||
|
echo '
|
||||||
|
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><FORM ACTION="?subtopic=guilds&action=createguild" METHOD=post><TR><TD>
|
||||||
<INPUT TYPE=image NAME="Create Guild" ALT="Create Guild" SRC="'.$template_path.'/images/buttons/sbutton_createguild.png" BORDER=0 WIDTH=120 HEIGHT=18>
|
<INPUT TYPE=image NAME="Create Guild" ALT="Create Guild" SRC="'.$template_path.'/images/buttons/sbutton_createguild.png" BORDER=0 WIDTH=120 HEIGHT=18>
|
||||||
</TD></TR></FORM></TABLE></TD></TR>';
|
</TD></TR></FORM></TABLE>';
|
||||||
|
|
||||||
|
echo '
|
||||||
|
</TD></TR>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -130,10 +141,14 @@ if($action == '')
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
echo '<TR BGCOLOR='.$config['lightborder'].'><TD><IMG SRC="images/guilds/' . 'default.gif" WIDTH=64 HEIGHT=64></TD>
|
echo '<TR BGCOLOR='.$config['lightborder'].'><TD><IMG SRC="images/guilds/' . 'default.gif" WIDTH=64 HEIGHT=64></TD>
|
||||||
<TD valign="top"><B>Create guild</B><BR/>Actually there is no guild on server. Create first! Press button "Create Guild".</TD>
|
<TD valign="top"><B>Create guild</B><BR/>Actually there is no guild on server.' . ($logged ? ' Create first! Press button "Create Guild".' : '') . '</TD>
|
||||||
<TD><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><FORM ACTION="?subtopic=guilds&action=createguild" METHOD=post><TR><TD>
|
<TD>';
|
||||||
|
if($logged)
|
||||||
|
echo '<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><FORM ACTION="?subtopic=guilds&action=createguild" METHOD=post><TR><TD>
|
||||||
<INPUT TYPE=image NAME="Create Guild" ALT="Create Guild" SRC="'.$template_path.'/images/buttons/sbutton_createguild.png" BORDER=0 WIDTH=120 HEIGHT=18>
|
<INPUT TYPE=image NAME="Create Guild" ALT="Create Guild" SRC="'.$template_path.'/images/buttons/sbutton_createguild.png" BORDER=0 WIDTH=120 HEIGHT=18>
|
||||||
</TD></TR></FORM></TABLE></TD></TR>';
|
</TD></TR></FORM></TABLE>';
|
||||||
|
echo '
|
||||||
|
</TD></TR>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -146,7 +161,7 @@ if($action == '')
|
|||||||
<BR /><a href="?subtopic=guilds&action=cleanup_players">Cleanup players</a> - can\'t join guild/be invited? Can\'t create guild? Try cleanup players.
|
<BR /><a href="?subtopic=guilds&action=cleanup_players">Cleanup players</a> - can\'t join guild/be invited? Can\'t create guild? Try cleanup players.
|
||||||
<BR /><a href="?subtopic=guilds&action=cleanup_guilds">Cleanup guilds</a> - made guild, you are a leader, but you are not on players list? Cleanup guilds!';
|
<BR /><a href="?subtopic=guilds&action=cleanup_guilds">Cleanup guilds</a> - made guild, you are a leader, but you are not on players list? Cleanup guilds!';
|
||||||
else
|
else
|
||||||
echo 'Before you can create guild you must login.<br><TABLE BORDER=0 WIDTH=100%><TR><TD ALIGN=center><IMG SRC="'.$template_path.'/images/general/blank.gif" WIDTH=80 HEIGHT=1 BORDER=0<BR></TD><TD ALIGN=center><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><FORM ACTION="?subtopic=accountmanagement&redirect=' . BASE_URL . urlencode(getPageLink('guilds')) . '" METHOD=post><TR><TD>
|
echo 'Before you can create guild you must login.<br><TABLE BORDER=0 WIDTH=100%><TR><TD ALIGN=center><IMG SRC="'.$template_path.'/images/general/blank.gif" WIDTH=80 HEIGHT=1 BORDER=0<BR></TD><TD ALIGN=center><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><FORM ACTION="?subtopic=accountmanagement&redirect=' . getPageLink('guilds') . '" METHOD=post><TR><TD>
|
||||||
<INPUT TYPE=image NAME="Login" ALT="Login" SRC="'.$template_path.'/images/buttons/sbutton_login.gif" BORDER=0 WIDTH=120 HEIGHT=18>
|
<INPUT TYPE=image NAME="Login" ALT="Login" SRC="'.$template_path.'/images/buttons/sbutton_login.gif" BORDER=0 WIDTH=120 HEIGHT=18>
|
||||||
</TD></TR></FORM></TABLE></TD><TD ALIGN=center><IMG SRC="'.$template_path.'/images/general/blank.gif" WIDTH=80 HEIGHT=1 BORDER=0<BR></TD></TR></TABLE>';
|
</TD></TR></FORM></TABLE></TD><TD ALIGN=center><IMG SRC="'.$template_path.'/images/general/blank.gif" WIDTH=80 HEIGHT=1 BORDER=0<BR></TD></TR></TABLE>';
|
||||||
}
|
}
|
||||||
@@ -258,10 +273,10 @@ if($action == 'show')
|
|||||||
$showed_players = 1;
|
$showed_players = 1;
|
||||||
foreach($rank_list as $rank)
|
foreach($rank_list as $rank)
|
||||||
{
|
{
|
||||||
if(fieldExist('rank_id', 'players'))
|
if(tableExist(GUILD_MEMBERS_TABLE))
|
||||||
|
$players_with_rank = $db->query('SELECT `players`.`id` as `id`, `' . GUILD_MEMBERS_TABLE . '`.`rank_id` as `rank_id` FROM `players`, `' . GUILD_MEMBERS_TABLE . '` WHERE `' . GUILD_MEMBERS_TABLE . '`.`rank_id` = ' . $rank->getId() . ' AND `players`.`id` = `' . GUILD_MEMBERS_TABLE . '`.`player_id` ORDER BY `name`;');
|
||||||
|
else if(fieldExist('rank_id', 'players'))
|
||||||
$players_with_rank = $db->query('SELECT `id`, `rank_id` FROM `players` WHERE `rank_id` = ' . $rank->getId() . ' AND `deleted` = 0;');
|
$players_with_rank = $db->query('SELECT `id`, `rank_id` FROM `players` WHERE `rank_id` = ' . $rank->getId() . ' AND `deleted` = 0;');
|
||||||
else
|
|
||||||
$players_with_rank = $db->query('SELECT `players`.`id` as `id`, `guild_membership`.`rank_id` as `rank_id` FROM `players`, `guild_membership` WHERE `guild_membership`.`rank_id` = ' . $rank->getId() . ' AND `players`.`id` = `guild_membership`.`player_id` ORDER BY `name`;');
|
|
||||||
|
|
||||||
$players_with_rank_number = $players_with_rank->rowCount();
|
$players_with_rank_number = $players_with_rank->rowCount();
|
||||||
if($players_with_rank_number > 0)
|
if($players_with_rank_number > 0)
|
||||||
@@ -491,7 +506,7 @@ if($action == 'changerank')
|
|||||||
if(fieldExist('rank_id', 'players'))
|
if(fieldExist('rank_id', 'players'))
|
||||||
$players_with_rank = $db->query('SELECT `id`, `rank_id` FROM `players` WHERE `rank_id` = ' . $rank->getId() . ' AND `deleted` = 0;');
|
$players_with_rank = $db->query('SELECT `id`, `rank_id` FROM `players` WHERE `rank_id` = ' . $rank->getId() . ' AND `deleted` = 0;');
|
||||||
else
|
else
|
||||||
$players_with_rank = $db->query('SELECT `players`.`id` as `id`, `guild_membership`.`rank_id` as `rank_id` FROM `players`, `guild_membership` WHERE `guild_membership`.`rank_id` = ' . $rank->getId() . ' AND `players`.`id` = `guild_membership`.`player_id` ORDER BY `name`;');
|
$players_with_rank = $db->query('SELECT `players`.`id` as `id`, `' . GUILD_MEMBERS_TABLE . '`.`rank_id` as `rank_id` FROM `players`, `' . GUILD_MEMBERS_TABLE . '` WHERE `' . GUILD_MEMBERS_TABLE . '`.`rank_id` = ' . $rank->getId() . ' AND `players`.`id` = `' . GUILD_MEMBERS_TABLE . '`.`player_id` ORDER BY `name`;');
|
||||||
|
|
||||||
$players_with_rank_number = $players_with_rank->rowCount();
|
$players_with_rank_number = $players_with_rank->rowCount();
|
||||||
if(count($players_with_rank) > 0)
|
if(count($players_with_rank) > 0)
|
||||||
@@ -573,7 +588,7 @@ if($action == 'changerank')
|
|||||||
if(fieldExist('rank_id', 'players'))
|
if(fieldExist('rank_id', 'players'))
|
||||||
$players_with_rank = $db->query('SELECT `id`, `rank_id` FROM `players` WHERE `rank_id` = ' . $rank->getId() . ' AND `deleted` = 0;');
|
$players_with_rank = $db->query('SELECT `id`, `rank_id` FROM `players` WHERE `rank_id` = ' . $rank->getId() . ' AND `deleted` = 0;');
|
||||||
else
|
else
|
||||||
$players_with_rank = $db->query('SELECT `players`.`id` as `id`, `guild_membership`.`rank_id` as `rank_id` FROM `players`, `guild_membership` WHERE `guild_membership`.`rank_id` = ' . $rank->getId() . ' AND `players`.`id` = `guild_membership`.`player_id` ORDER BY `name`;');
|
$players_with_rank = $db->query('SELECT `players`.`id` as `id`, `' . GUILD_MEMBERS_TABLE . '`.`rank_id` as `rank_id` FROM `players`, `' . GUILD_MEMBERS_TABLE . '` WHERE `' . GUILD_MEMBERS_TABLE . '`.`rank_id` = ' . $rank->getId() . ' AND `players`.`id` = `' . GUILD_MEMBERS_TABLE . '`.`player_id` ORDER BY `name`;');
|
||||||
|
|
||||||
$players_with_rank_number = $players_with_rank->rowCount();
|
$players_with_rank_number = $players_with_rank->rowCount();
|
||||||
if(count($players_with_rank) > 0)
|
if(count($players_with_rank) > 0)
|
||||||
@@ -1011,7 +1026,7 @@ if($action == 'kickplayer') {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if($player->getRank()->isLoaded() && $player->getRank()->getGuild()->getName() != $guild->getName()) {
|
if($player->getRank()->isLoaded() && $player->getRank()->getGuild()->isLoaded() && $player->getRank()->getGuild()->getName() != $guild->getName()) {
|
||||||
$guild_errors[] = 'Character <b>'.$name.'</b> isn\'t from your guild.';
|
$guild_errors[] = 'Character <b>'.$name.'</b> isn\'t from your guild.';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1598,7 +1613,7 @@ else
|
|||||||
if(fieldExist('rank_id', 'players'))
|
if(fieldExist('rank_id', 'players'))
|
||||||
$players_with_rank = $db->query('SELECT `id`, `rank_id` FROM `players` WHERE `rank_id` = ' . $rank->getId() . ' AND `deleted` = 0;');
|
$players_with_rank = $db->query('SELECT `id`, `rank_id` FROM `players` WHERE `rank_id` = ' . $rank->getId() . ' AND `deleted` = 0;');
|
||||||
else
|
else
|
||||||
$players_with_rank = $db->query('SELECT `players`.`id` as `id`, `guild_membership`.`rank_id` as `rank_id` FROM `players`, `guild_membership` WHERE `guild_membership`.`rank_id` = ' . $rank->getId() . ' AND `players`.`id` = `guild_membership`.`player_id` ORDER BY `name`;');
|
$players_with_rank = $db->query('SELECT `players`.`id` as `id`, `' . GUILD_MEMBERS_TABLE . '`.`rank_id` as `rank_id` FROM `players`, `' . GUILD_MEMBERS_TABLE . '` WHERE `' . GUILD_MEMBERS_TABLE . '`.`rank_id` = ' . $rank->getId() . ' AND `players`.`id` = `' . GUILD_MEMBERS_TABLE . '`.`player_id` ORDER BY `name`;');
|
||||||
|
|
||||||
$players_with_rank_number = $players_with_rank->rowCount();
|
$players_with_rank_number = $players_with_rank->rowCount();
|
||||||
if($players_with_rank_number > 0) {
|
if($players_with_rank_number > 0) {
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
* @author Gesior <jerzyskalski@wp.pl>
|
* @author Gesior <jerzyskalski@wp.pl>
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.0.1
|
* @version 0.2.0
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
@@ -99,6 +99,16 @@ $deleted = 'deleted';
|
|||||||
if(fieldExist('deletion', 'players'))
|
if(fieldExist('deletion', 'players'))
|
||||||
$deleted = 'deletion';
|
$deleted = 'deletion';
|
||||||
|
|
||||||
|
$outfit_addons = false;
|
||||||
|
$outfit = '';
|
||||||
|
if($config['highscores_outfit']) {
|
||||||
|
$outfit = ', lookbody, lookfeet, lookhead, looklegs, looktype';
|
||||||
|
if(fieldExist('lookaddons', 'players')) {
|
||||||
|
$outfit .= ', lookaddons';
|
||||||
|
$outfit_addons = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$offset = $_page * 100;
|
$offset = $_page * 100;
|
||||||
if($skill <= POT::SKILL_LAST) { // skills
|
if($skill <= POT::SKILL_LAST) { // skills
|
||||||
if(fieldExist('skill_fist', 'players')) {// tfs 1.0
|
if(fieldExist('skill_fist', 'players')) {// tfs 1.0
|
||||||
@@ -112,14 +122,14 @@ if($skill <= POT::SKILL_LAST) { // skills
|
|||||||
POT::SKILL_FISH => 'skill_fishing',
|
POT::SKILL_FISH => 'skill_fishing',
|
||||||
);
|
);
|
||||||
|
|
||||||
$skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',level,vocation' . $promotion . ', ' . $skill_ids[$skill] . ' as value FROM accounts,players WHERE players.' . $deleted . ' = 0 AND players.group_id < '.$config['highscores_groups_hidden'].' '.$add_sql.' AND players.id > 6 AND accounts.id = players.account_id ORDER BY ' . $skill_ids[$skill] . ' DESC LIMIT 101 OFFSET '.$offset);
|
$skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',level,vocation' . $promotion . $outfit . ', ' . $skill_ids[$skill] . ' as value FROM accounts,players WHERE players.' . $deleted . ' = 0 AND players.group_id < '.$config['highscores_groups_hidden'].' '.$add_sql.' AND players.id > 6 AND accounts.id = players.account_id ORDER BY ' . $skill_ids[$skill] . ' DESC LIMIT 101 OFFSET '.$offset);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',value,level,vocation' . $promotion . ' FROM accounts,players,player_skills WHERE players.' . $deleted . ' = 0 AND players.group_id < '.$config['highscores_groups_hidden'].' '.$add_sql.' AND players.id > 6 AND players.id = player_skills.player_id AND player_skills.skillid = '.$skill.' AND accounts.id = players.account_id ORDER BY value DESC, count DESC LIMIT 101 OFFSET '.$offset);
|
$skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',value,level,vocation' . $promotion . $outfit . ' FROM accounts,players,player_skills WHERE players.' . $deleted . ' = 0 AND players.group_id < '.$config['highscores_groups_hidden'].' '.$add_sql.' AND players.id > 6 AND players.id = player_skills.player_id AND player_skills.skillid = '.$skill.' AND accounts.id = players.account_id ORDER BY value DESC, count DESC LIMIT 101 OFFSET '.$offset);
|
||||||
}
|
}
|
||||||
else if($skill == 666 && $config['otserv_version'] == TFS_03) // frags
|
else if($skill == 666 && $config['otserv_version'] == TFS_03) // frags
|
||||||
{
|
{
|
||||||
$skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',level,vocation' . $promotion . ',COUNT(`player_killers`.`player_id`) as value' .
|
$skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',level,vocation' . $promotion . $outfit . ',COUNT(`player_killers`.`player_id`) as value' .
|
||||||
' FROM `accounts`, `players`, `player_killers` ' .
|
' FROM `accounts`, `players`, `player_killers` ' .
|
||||||
' WHERE players.' . $deleted . ' = 0 AND players.group_id < '.$config['highscores_groups_hidden'].' '.$add_sql.' AND players.id = player_killers.player_id AND accounts.id = players.account_id' .
|
' WHERE players.' . $deleted . ' = 0 AND players.group_id < '.$config['highscores_groups_hidden'].' '.$add_sql.' AND players.id = player_killers.player_id AND accounts.id = players.account_id' .
|
||||||
' GROUP BY `player_id`' .
|
' GROUP BY `player_id`' .
|
||||||
@@ -129,10 +139,10 @@ else if($skill == 666 && $config['otserv_version'] == TFS_03) // frags
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if($skill == POT::SKILL__MAGLEVEL) {
|
if($skill == POT::SKILL__MAGLEVEL) {
|
||||||
$skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',maglevel,level,vocation' . $promotion . ' FROM accounts, players WHERE players.' . $deleted . ' = 0 '.$add_sql.' AND players.group_id < '.$config['highscores_groups_hidden'].' AND players.id > 6 AND accounts.id = players.account_id ORDER BY maglevel DESC, manaspent DESC LIMIT 101 OFFSET '.$offset);
|
$skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',maglevel,level,vocation' . $promotion . $outfit . ' FROM accounts, players WHERE players.' . $deleted . ' = 0 '.$add_sql.' AND players.group_id < '.$config['highscores_groups_hidden'].' AND players.id > 6 AND accounts.id = players.account_id ORDER BY maglevel DESC, manaspent DESC LIMIT 101 OFFSET '.$offset);
|
||||||
}
|
}
|
||||||
else { // level
|
else { // level
|
||||||
$skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',level,experience,vocation' . $promotion . ' FROM accounts, players WHERE players.' . $deleted . ' = 0 '.$add_sql.' AND players.group_id < '.$config['highscores_groups_hidden'].' AND players.id > 6 AND accounts.id = players.account_id ORDER BY level DESC, experience DESC LIMIT 101 OFFSET '.$offset);
|
$skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',level,experience,vocation' . $promotion . $outfit . ' FROM accounts, players WHERE players.' . $deleted . ' = 0 '.$add_sql.' AND players.group_id < '.$config['highscores_groups_hidden'].' AND players.id > 6 AND accounts.id = players.account_id ORDER BY level DESC, experience DESC LIMIT 101 OFFSET '.$offset);
|
||||||
$list = 'experience';
|
$list = 'experience';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -150,6 +160,9 @@ else
|
|||||||
<td width="11px" class="white">#</td>
|
<td width="11px" class="white">#</td>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<td width="10%" class="white"><b>Rank</b></td>
|
<td width="10%" class="white"><b>Rank</b></td>
|
||||||
|
<?php if($config['highscores_outfit']): ?>
|
||||||
|
<td class="white"><b>Outfit</b></td>
|
||||||
|
<?php endif; ?>
|
||||||
<td width="75%" class="white"><b>Name</b></td>
|
<td width="75%" class="white"><b>Name</b></td>
|
||||||
<td width="15%" class="white"><b><?php echo ($skill != 666 ? 'Level' : 'Frags'); ?></b></td>
|
<td width="15%" class="white"><b><?php echo ($skill != 666 ? 'Level' : 'Frags'); ?></b></td>
|
||||||
<?php if($skill == POT::SKILL__LEVEL): ?>
|
<?php if($skill == POT::SKILL__LEVEL): ?>
|
||||||
@@ -177,15 +190,18 @@ foreach($skills as $player)
|
|||||||
{
|
{
|
||||||
if($skill == POT::SKILL__MAGIC)
|
if($skill == POT::SKILL__MAGIC)
|
||||||
$player['value'] = $player['maglevel'];
|
$player['value'] = $player['maglevel'];
|
||||||
|
else if($skill == POT::SKILL__LEVEL)
|
||||||
if($skill == POT::SKILL__LEVEL)
|
|
||||||
$player['value'] = $player['level'];
|
$player['value'] = $player['level'];
|
||||||
echo '
|
echo '
|
||||||
<tr bgcolor="' . getStyle($i) . '">';
|
<tr bgcolor="' . getStyle($i) . '">';
|
||||||
if($config['account_country'])
|
if($config['account_country'])
|
||||||
echo '<td>' . getFlagImage($player['country']) . '</td>';
|
echo '<td>' . getFlagImage($player['country']) . '</td>';
|
||||||
echo '
|
echo '
|
||||||
<td>' . ($offset + $i) . '.</td>
|
<td>' . ($offset + $i) . '.</td>';
|
||||||
|
if($config['highscores_outfit'])
|
||||||
|
echo '<td><img style="position:absolute;margin-top:' . (in_array($player['looktype'], array(75, 266, 302)) ? '-15px;margin-left:5px' : '-45px;margin-left:-25px') . ';" src="' . $config['outfit_images_url'] . '?id=' . $player['looktype'] . ($outfit_addons ? '&addons=' . $player['lookaddons'] : '') . '&head=' . $player['lookhead'] . '&body=' . $player['lookbody'] . '&legs=' . $player['looklegs'] . '&feet=' . $player['lookfeet'] . '" alt="" /></td>';
|
||||||
|
|
||||||
|
echo '
|
||||||
<td>
|
<td>
|
||||||
<a href="' . getPlayerLink($player['name'], false) . '">
|
<a href="' . getPlayerLink($player['name'], false) . '">
|
||||||
<font color="' . ($player['online'] > 0 ? 'green' : 'red') . '">' . $player['name'] . '</font>
|
<font color="' . ($player['online'] > 0 ? 'green' : 'red') . '">' . $player['name'] . '</font>
|
||||||
|