Compare commits

...

119 Commits
v0.7.1 ... 0.7

Author SHA1 Message Date
slawkens
a708abce03 add mostdamage killer 2022-11-05 07:15:32 +01:00
slawkens
f46f7d61e7 Update .gitignore 2021-12-28 07:22:58 +01:00
slawkens
1578d186c2 Ignore arrays in config.lua (fixes experienceStages loading)
Also change version to 0.7.13-dev
2021-12-16 20:24:34 +01:00
slawkens
af1ec6722b Update README.md 2021-10-23 13:44:30 +02:00
slawkens
5202298b60 Add notice about 0.7 being discontinued 2021-10-23 13:43:32 +02:00
slawkens
ed2f325ce1 Add some notice 2020-02-25 20:52:35 +01:00
slawkens
a467b55054 Fix class name in highscores
(cherry picked from commit b8130d3fd3)
2020-02-25 20:49:56 +01:00
slawkens
f9458da291 Move TODO to wiki 2020-02-24 22:22:54 +01:00
slawkens
e6b16cd420 Update to 0.7.12 2020-02-18 18:33:36 +01:00
slawkens
6bc14fb44f Fix #51 in 0.7 branch 2020-02-16 00:11:51 +01:00
slawkens
c37f593eda Temp fix for a space that Twig cuts.. 2020-02-15 03:54:20 +01:00
slawkens
5d499bc5e6 Patch some changes/fixes from 0.8 branch
Fix Gesior signature double dollar $$
Add some missing <br/> to online page
Use  $config['last_kills_limit'] in lastkills.php
Fix save_ranks.php: getLastError();
Fix PHPMailer autoloader
Fix leaking sensitive informations on MySQL Connection Fail
Add nginx-sample.conf
Change myaac_monsters.loot to text
Add more files to ignore file
2020-02-15 03:37:18 +01:00
slawkens
a7105d33f2 Fix some 7.4 notices about OTS_Account bans
Example: Notice: Trying to access array offset on value of type bool in C:\UniServerZ\www\system\libs\pot\OTS_Account.php on line 784
(cherry picked from commit 259cda150d)
2020-02-13 01:01:27 +01:00
slawkens
8af9186098 Update CHANGELOG.md 2019-05-04 08:19:01 +02:00
slawkens
2d427601ee * release 0.7.11 2019-05-04 00:20:37 +02:00
slawkens
454d4b088d * Update CHANGELOG.md 2019-04-27 17:39:41 +02:00
slawkens
738bfbfa5c Fixed guilds "Add new rank function"
Exception thrown in OTS_GuildRank::__toString() method

https://otland.net/threads/myaac-bug-guild-new-rank.263953/

(cherry picked from commit 4d56650)
2019-04-09 00:50:56 +02:00
slawkens
03223c1c30 Fix something that Open Tibia developers don't think about 2018-11-07 21:15:47 +01:00
slawkens
3c6f44d6ee Fix database_name in Usage_Statistics 2018-10-31 07:46:35 +01:00
slawkens
dacc5b9dab Fix bug where server_config table does not exist (OTHire as an example)
Happened in Usage_Statistics class
Thanks for reporting the OtLand user - Olddies
2018-10-31 07:45:50 +01:00
slawkens
a4bccbaa34 * change config.lua.ownerEmail to config.mail_address 2018-10-22 09:27:46 +02:00
slawkens
174054237b * fixed the mystical defect where "Create Account" button was not highlighted (on the account/manage page) 2018-10-22 09:16:53 +02:00
slawkens
bcc81fa34f (Nothing important) just remove a minus in a word "re-install"
(cherry picked from commit a81824a)
2018-10-18 08:25:20 +02:00
slawkens
ba1c5e9b2e * add fatal error message when myaac tables in database do not exist 2018-10-18 08:22:37 +02:00
slawkens
0129c79580 * add an additional text to the install page informing that user can reinstall MyAAC by deleting config.local.php 2018-10-18 08:20:13 +02:00
slawkens
c863ad460a * fixed multiple mail recipients when using admin mailer function
It resulted in mail being sent to all users multiple times..
2018-06-08 21:08:31 +02:00
slawkens
cb08e53103 * fix XSS in forum show_thread 2018-06-01 20:27:34 +02:00
slawkens
d5cc2a1090 * Fixed missing prefix for cache get() and delete() functions
Cause those functions to not work correctly..

(cherry picked from commit b3625df)
2018-06-01 15:06:30 +02:00
slawkens
6ba8d2c9cb * forgot to open <head> in install template
(cherry picked from commit 050f596)
2018-05-29 20:33:15 +02:00
slawkens
668e4688c4 * remove whitespaces (IDE formatting) 2018-05-29 20:18:19 +02:00
slawkens
bd19b8665a * do not display software version 2018-05-29 20:17:39 +02:00
slawkens
c5980f2350 * add .gitattributes
(cherry picked from commit 15da31d)
2018-05-29 20:05:21 +02:00
slawkens1
6c03984f53 * support for some old servers, where arrays are used in config.lua 2018-04-16 20:52:50 +02:00
slawkens1
ecd865f275 * fix #47 2018-03-24 01:25:24 +01:00
Sławek
5f1392e9f4 Updated CHANGELOG.md (format) 2018-03-03 11:35:34 +01:00
slawkens1
d6c10d277d * add .md extension to CHANGELOG 2018-03-03 11:31:51 +01:00
slawkens1
815b1f9b5b * update to 0.7.10 2018-03-03 11:31:01 +01:00
slawkens1
66568fbaf1 * fixed saving long ip addresses (unsigned) 2018-02-06 03:55:34 +01:00
slawkens1
18b6404e75 * added robots.txt 2018-02-05 21:32:53 +01:00
slawkens1
17b1f9a391 * fixed default accounts.vote value 2018-02-05 08:21:24 +01:00
Sławek
14137221fd * minimum PHP is now 5.3.3
* added command to change permissions of system/cache directory
2018-02-05 00:01:11 +01:00
slawkens1
ed4a166d6c * fixed chrome bug on save ERR_BLOCKED_BY_XSS_AUDITOR 2018-02-04 23:39:56 +01:00
slawkens1
8df12e3d9c * fixed edit page with php enabled 2018-02-04 23:39:32 +01:00
slawkens1
e2a625efd2 * new configurable: smtp_secure
* as described in #43 by miqueiaspenha
2018-01-29 23:12:07 +01:00
Sławek
5b3237770b Merge pull request #44 from miqueiaspenha/patch-1
Update admin.dashboard.html.twig (GH-44)
2018-01-29 22:58:56 +01:00
slawkens1
4ffb6cf8eb * fixed #42
* changed mb_strtolower functions to strtolower() - was useless in this
case
* attemp to fix some bug with PHPMailer not finding its language file
* added .idea (phpstorm) to .gitignore
2018-01-26 08:09:55 +01:00
slawkens
2c12ef93aa * twig requires php 5.3.3 2018-01-23 10:51:19 +01:00
slawkens1
d17c18cabc * auto add z_polls table on install 2018-01-14 09:45:16 +01:00
slawkens1
eeb09ddce6 * forgot closing curly brace 2018-01-14 09:30:56 +01:00
slawkens1
28683d66ee * update from master branch
* update config.highscores_ids_hidden on install when there are samples
already in database
2018-01-14 09:29:41 +01:00
slawkens1
7d2e522d2b * fixed plugin "You don't have rights to delete" 2018-01-14 09:16:24 +01:00
slawkens1
3fc2bef7c9 * added some names links to the account.management page 2018-01-14 09:00:48 +01:00
slawkens1
fade78efc1 * fixed hooks return value
* (internal) added new function: $hooks->exist($type)
2018-01-14 09:00:39 +01:00
slawkens1
d04f2b7965 * update to 0.7.10-dev 2018-01-13 22:07:08 +01:00
slawkens1
a9f205f047 * fixed installation (damn me..) 2018-01-13 22:03:28 +01:00
slawkens1
956f631750 * update to 0.7.9 2018-01-13 21:55:47 +01:00
slawkens1
f01428da48 * deleted more useless files 2018-01-13 21:44:06 +01:00
slawkens1
7351ab4436 * changed highscores_groups_hidden to 3 (for TFS 1.x) 2018-01-13 21:19:23 +01:00
slawkens1
d9510b01ba * fixed default stamina on otserv 0.6.x engine 2018-01-13 19:57:55 +01:00
slawkens1
79589ed1f4 * install: change permission check to is_writable 2018-01-13 19:43:23 +01:00
slawkens1
67590e13a6 * fixes to the latest commit (removed some files)
* otserv 0.6.3: fixed some warning (on the characters page) and fatal
mysql error (on the mango signature)
2018-01-13 19:43:08 +01:00
slawkens1
1e3aef211e * removed Thumbs.db 2018-01-13 19:20:46 +01:00
slawkens1
cda8191f79 * removed 6mb of trash (some useless things)
* updated background-artwork to the latest version, removed other ones
* removed signature background.PSD (instead of an empty background.jpg
is provided - almost the same)
* removed arial.ttf font, instead arialbd.ttf is used for mango template
* added .gitignore file
2018-01-13 19:14:45 +01:00
slawkens1
b91d3e70cc * (fix) TFS 1.x not showing promoted vocations in highscores 2018-01-12 18:16:50 +01:00
slawkens1
94e4ff313c * update to 0.7.8 2018-01-12 01:42:14 +01:00
slawkens1
2295d270f5 * fixed installation error " call to undefined method OTS_DB_MySQL::hasColumn()" 2018-01-12 01:26:48 +01:00
slawkens1
a4a829a7c2 * enabled emoticons plugin in tinymce :) 2018-01-08 20:02:50 +01:00
slawkens
f5aae3361f * uninstall: do not allow directories outside BASE
* uninstall: do not allow absolute paths
2018-01-08 17:26:29 +01:00
slawkens
736ec61f85 * some fixes regarding migrations 2018-01-08 14:02:49 +01:00
slawkens
1385189838 * updated tinymce to the latest (4.7.4) version 2018-01-08 13:10:59 +01:00
slawkens
bfa563285a * some typos in CHANGELOG 2018-01-08 11:51:12 +01:00
slawkens
d0f6670e98 * added some notice to the CHANGELOG 2018-01-08 11:50:34 +01:00
slawkens
ac701696d3 * update CHANGELOG 2018-01-08 11:47:28 +01:00
slawkens
702e29a5cb * fixed PHP warning about country not existing on online and characteres pages 2018-01-08 11:47:02 +01:00
slawkens
f26c334d47 * fixed characters page - config.characters.frags "Notice: Use of undefined constant" 2018-01-08 11:40:24 +01:00
slawkens
75e55bfaee * update to 0.7.7 2018-01-08 11:23:21 +01:00
slawkens
0d85b63d5d * fixed displaying special outfits (GM, CM) in online page 2018-01-08 11:22:46 +01:00
slawkens
14920a7193 * use Forum::isModerator() function 2018-01-08 11:00:11 +01:00
slawkens
5547fd7895 * added new forum option: "Enable HTML"
* will be by default enabled for newses
* fixed bbcode parsing
2018-01-08 10:41:33 +01:00
slawkens1
34cb1b1ffa * fixed tr bgcolor (#38) 2018-01-08 08:11:35 +01:00
slawkens1
4ffe4ab9b7 * update to 0.7.7-dev 2018-01-08 01:10:17 +01:00
slawkens1
bcf054104c * applied changes from master
* important fix for servers with promotion column
* caused player.vocation to be resetted when saving player, for example:
on change name, accept invite to guild, leave guild
* fixed empty success message on leave guild
* (internal) using $player->getVocationName() where possible instead of
older method
* fixed some warning in guild show
2018-01-08 01:05:19 +01:00
slawkens1
9fafa110bb * nothing important 2018-01-08 00:19:41 +01:00
slawkens1
35acec1be5 * fixed displaying Premium Account days v2 2018-01-08 00:18:11 +01:00
slawkens1
f157402fa3 * fixed displaying premium account days
* function OTS_Account:getPremDays will now return -1 if there's
freePremium configurable enabled on the server
2018-01-08 00:08:49 +01:00
slawkens1
513e8f4b30 * fixed getBoolean function when boolean is passed 2018-01-08 00:01:32 +01:00
slawkens1
35a5aafbb5 * fixed othire default column value (#26) 2018-01-07 23:21:41 +01:00
slawkens1
73a5e13006 * fixed warning in highscores when vocation doesn't exist 2018-01-07 12:06:26 +01:00
slawkens1
bcb0feea1a * fixed saving custom vocations in admin panel (#36) 2018-01-07 11:58:09 +01:00
slawkens1
774e789c8a * immediately reload config.lua when there's change in config.server_path detected 2018-01-06 03:08:27 +01:00
slawkens1
db25d38f4b * some fixes regarding latest commit 2018-01-05 23:43:15 +01:00
slawkens1
4b81213662 * dont add extra <br/> to the TinyMCE news forum posts 2018-01-05 21:45:38 +01:00
slawkens
a860c95975 * update to 0.7.6 2018-01-05 12:02:49 +01:00
slawkens
e2de0b1440 * fixed othire account creating/installation
* fixed unexpected error logging about email fail
* added max_execution_time to the install finish step
2018-01-05 09:31:11 +01:00
slawkens1
8b2ad2cf2f * fixed table name players -> players_online 2018-01-05 00:36:30 +01:00
slawkens1
88a320530c * some small fix regarding highscores vocation box 2018-01-04 00:28:16 +01:00
slawkens1
6e221fe469 * update to 0.7.5 2018-01-04 00:17:57 +01:00
slawkens1
679e08ec11 * fixed displaying article_text when it was empty saved 2018-01-04 00:09:35 +01:00
slawkens1
603495ca97 * small fix related to warning about news
* fixed template path finding
* fixed news adding when type != ARTICLE
2018-01-03 23:56:07 +01:00
slawkens1
4c6af13574 * save detected country on create account in session
* warning about leaving news page with changes
2018-01-03 22:04:33 +01:00
slawkens1
3fcbd42445 * added player status to tibiacom top 5 highscores box
* fix when there are no changelogs or highscores yet
2018-01-03 21:28:31 +01:00
slawkens1
e6d2e363d5 * fiedx bug on othire with config.account_premium_days
* fixed getPremDays and isPremium functions (newest 11.x engines are
bugged when it comes to PACC, its not fault of MyAAC)
2018-01-03 21:04:05 +01:00
slawkens1
0a067577a3 * fixed bug on TFS 1.x when online_afk is enabled 2018-01-03 01:11:34 +01:00
slawkens
a5b599088a * small fix regarding getTopPlayers function which was ignoring $limit variable 2018-01-02 10:32:08 +01:00
slawkens1
51ba514d2a * update to 0.7.5-dev
* fixed faq containing html code
* update item_images_url config to 1092
* added ttf, woff and ico to the list of ignored files
* fixed infinite loop in init.php
2017-12-29 11:07:43 +01:00
slawkens1
b83fb05b82 * update to 0.7.4 2017-12-24 09:50:53 +01:00
slawkens1
cf12265cd8 * fixed displaying of percent bar on tibian signature 2017-12-24 09:37:28 +01:00
slawkens1
e4110a6981 * automatically update highscores_ids_hidden for users who installed myaac before
* update TODO
2017-12-21 22:08:47 +01:00
slawkens1
412908026d * inform user about Twig cache failure on installation, instead of http 500 error
* when dir system/cache is not writable by the webserver, then show some
nice notice to the user about it instead of http 500 error
* remember client version and usage stats checkbox in session on install
* fixed some small warning introducted yesterday about
highscores_ids_hidden
* updated TODO
2017-12-19 23:32:30 +01:00
slawkens1
8a7887cf06 * for compability 2017-12-19 00:05:49 +01:00
slawkens1
779dd003dd * update to 0.7.3
* better solution for hidding samples (configurable)
* removed players.is_sample field
2017-12-19 00:01:59 +01:00
slawkens1
0b2895dc56 * fixed some warnings on install on servers using account.id
* added version 772 constant to install client choose (OTHire)
* forgot to add is_sample to samples on install
2017-12-18 23:30:18 +01:00
slawkens1
fed5d08703 * updated TODO 2017-12-18 16:07:12 +01:00
slawkens1
f131f27ac3 * forgot something with latest commit 2017-12-18 09:56:43 +01:00
slawkens1
19dbbdcf4f * auto generate myaac cache & session prefix on install to be unique accross installations
* prevent adding duplicated newses with installation
* players.is_sample to prevent displaying on highscores
2017-12-18 09:54:42 +01:00
slawkens1
d650035980 * fixed last menu closing in tibiacom template 2017-12-18 09:09:24 +01:00
slawkens1
fbc803d09f * updated polish locale (translation) on install
* fixed hidding shop system menu on tibiacom template when disabled in
config
* some changes to sample characters: chanced town_id to 1, posx: 1000,
posy: 1000, posz: 1000 and default group_id to 1 so you can change
in-game outfits and they will be used
* fixed account.login redirect not working on tibiacom template
* installation: warn about wrong admin account name/id and password
* (internal) removed some duplicated code on install finish
* (internal) renamed installation step files to be in correct order
* added TODO file
* bumped version to 0.7.3
2017-12-18 09:01:54 +01:00
Slawomir Boczek
df4c594d4f * forgot to update CHANGELOG in 0.7.1 release 2017-12-15 16:36:51 +01:00
slawkens1
482445cb98 * switch to 0.7.2-dev 2017-12-13 19:21:11 +01:00
179 changed files with 2135 additions and 1404 deletions

4
.gitattributes vendored Normal file
View File

@@ -0,0 +1,4 @@
* text=auto
.gitattributes export-ignore
.gitignore export-ignore
_config.yml export-ignore

37
.gitignore vendored Normal file
View File

@@ -0,0 +1,37 @@
Thumbs.db
.DS_Store
.idea
node_modules
vendor
composer.lock
releases
config.local.php
PERSONAL_NOTES
# all custom templates
templates/*
!templates/tibiacom
!templates/kathrine
# guild images
images/guilds/*
!images/guilds/default.gif
# cache
system/cache/*
!system/cache/index.html
!system/cache/twig/index.html
!system/cache/signatures/index.html
# logs
system/logs/*
!system/logs/index.html
# plugins
plugins/*
!plugins/.htaccess
!plugins/example.json
!plugins/account-create-hint.json
!plugins/account-create-hint
landing

346
CHANGELOG
View File

@@ -1,346 +0,0 @@
[0.7.0 - 20.11.2017]
- moved template menus to database, they're now dynamically loaded
- added anonymous usage statistics reporting (only if user agrees, first usage report will be send after 7 days)
- you can edit them in Admin Panel under 'Menus' option
- you can also add custom links, like http://google.pl
- added networks (facebook and twitter) and highscores (top 5) boxes to tibiacom template, configurable in templates/tibiacom/config.php
- added news ticker for kathrine template
- added featured article to tibiacom template (you can add them with add news button)
- added tinymce editor to 'Pages' in admin panel
- added links to edit/delete/hide custom page directly from page
- update forum post after editing news (when forum post has been created)
- enabled code plugin for tinymce which enabled raw html code editing
- removed videos pages, as it can be easily added using custom Menus and Pages with insert Media
- removed bug_report configurable, its now enabled by default
- log some error info when mail cannot be send on account create
- twig getLink function will now return with full url (BASE_URL included)
- verify install post values directly on config page and display error
- updated tinymce to version 4.7.2 (from 4.7.0)
- updated phpmailer to version 5.2.26 (from 5.2.23)
- (#30) (fix) recovering account on servers that doesn't support salts
- (fix) account email confirm function
- (fix) showing changelog with urls in Admin Panel
- (fix) uninstalling plugin
- (fix) polls box in tibiacom template
- (fix) remove hooks from db on plugin deinstall
- (fix) some weird include possibilities with forum and account actions (verify action name)
- (fix) loading hooks from plugin installed from command line
- (fix) some changelog PHP Notice warning
- (internal) moved uninstall logic to Plugins class
- (internal) moved tibiacom boxes to separate directory
- (internal) moved news tickers to twig template
- (internal) moved Forum class to separate file
- (internal) moved deprecated functions to compat.php
- (internal) added some compat functions that are used by shop system
- (internal) renamed constant TICKET -> TICKER
- (internal) shortened message functions
[0.6.6 - 22.10.2017]
- fixed some php fatal error on spells page
- changed spells.vocations field in db size to 300
- please reload your spells after this update!
[0.6.5 - 21.10.2017]
- fixed displaying custom pages
- fixed adding new group forum board
[0.6.4 - 20.10.2017]
- reverted OTS_Account::getLastLogin() cause its used by tibia11-login plugin
[0.6.3 - 20.10.2017]
- fixed creating account
- fixed viewing thread without being logged
- fixed showing premium account status
[0.6.2 - 20.10.2017]
- added forums for guilds and groups
- added nice looking menu for my account page in default template
- new command line tool: install_plugin.php - can be used to install plugins from command line. Usage: "php install_plugin.php path_to_file"
- added new tooltip to view characters equipment item name and monster loot
- added items.xml loader class and weapons.xml loader class
- minimum PHP version to install AAC is now 5.3.0 cause of Anonymous functions used by Twig
- Added 'Are you sure?' popup when uninstalling plugin
- added some warnings when plugin json file is incomplete
- fixed showing in characters ban expires when is unlimited
- fixed displaying monster loot when item.name in loot is used instead of item.id
- load also runes into spells table
- display plugin uninstall option only if its possible
- after changing template you will be redirected to latest viewed page
- display gallery add image form only on main gallery page
- (internal) moved most of guilds html-in-php code to twig
- (internal) moved spells page to twig template
- (internal) removed useless spells.spell column that was duplicate of spells.words
- (internal) save monster loot in database in json format instead loading it every time from xml file
- (internal) store monster voices and immunities in json format
- (internal) moved buttons to separate template
- (internal) moved online search form to twig
- (internal) added new function getItemNameById($id)
- (internal) Moved plugin install logic to a new class: Plugins
- (internal) changed spells.vocations database field to store json data instead of comma separated
- (internal) removed $hook_types array, using defined() and constant() functions now
- (internal) removed useless monsters.gfx_name field from database
- (internal) renamed database field monsters.hide_creature to hidden
- (internal) renamed existing Items class to Items_Images
- (internal) optimized Spells class
- (internal) new function: OTS_Guild::hasMember(OTS_Player $player)
- (internal) new function: Forum::hasAccess($board_id)
[0.6.1 - 17.10.2017]
- fixed signatures loading
- new configurable: session_prefix, to allow more websites on one machine (must be unique for every website on your dedicated server!)
- better error handling for monsters and spells loader (save errors to system/logs/error.log)
- check if file exist before loading (monsters and spells)
- (internal) Account::getAccess() = Account::getGroupId()
- (internal) moved account actions (pages) to account/ directory
- (internal) moved forum actions (pages) to forum/ directory
- (internal) moved forum.edit_post to twig templates
[0.6.0 - 16.10.2017]
- added faq management - add/edit/move/hide/delete from website
- new account.login view for tibiacom template
- monsters and spells are now being loaded at the installation of the AAC
- fix for php versions under 5.5 where empty() function supported only variables
- added missing change email and change info buttons to account.management default template
- added new indicator icons for create account, create character and change character name
- fixed config loader when some inline comments are present
- fixed editing page in admin panel that contains some html code
- fixed forum new post on mac os and some specific mysql versions
- attempt to fix incorrect views counter behavior (its resetting to 0 in some cases)
- enabled cache http headers for signatures
- check if monster file exist before loading it
- fixed if plugin zip file name contains dot (.)
- renamed screenshots to gallery and movies to videos
- moved install pages to twig
- fixed Account::getGuildAccess function
- removed never used library from sources - dwoo
- moved check_* functions to class Validator
- from now all validators ajax requests will fire onblur instead of onkeyup
- ajax requests returns now json instead of xml
- added 404 response when file is not found
[0.5.1 - 11.10.2017]
- fixed forum add/edit board
- new configurable: highscores_length, how much highscores to display
- fixed highscores links (ALL, previous and next page)
- update templates cache when installing/uninstalling plugin
- moved character deaths and frags table generation to twig
- fixed some bug when you uninstall plugin and then try to install again on the same page
- check if plugin exist before uninstalling
- fixed some warning in OTS_Base_DB
[0.5.0 - 10.10.2017]
- moved .htaccess rules to plain php (index.php)
- updated tinymce to the latest (4.7.0) version, you can now embed code, for example youtube videos
- added option to uninstall plugin
- added option to require specified myaac, php or database version for plugins, without that plugin won't be installed
- change accountmanagement links to use friendly_urls
- fixed creating new forum thread
- sample characters are now assigned to admin account and have group_id 4 to not be shown on highscores
- added links loaded from database to admin panel - for future plugins
- print some info to error.log when can't find config.lua
- some fixes in account changecomment action
- show info when account name/number or password is empty on login
- fixed showing account login errors
- added few characters hooks
- fixed some kathrine template js bug when shop is disabled
- you can now use slash '/' in custom pages loaded from database
- added new twig function getLink that convert link taking into account config.friendly_urls
- internalLayoutLink -> getLink
[0.4.3 - 05.10.2017]
- better config loader taken from latest gesior, you can now include files in your config by doing dofile('config.local.lua')
- fixed country detection in create account
- fixed showing of character deaths and frags
- fixed https://otland.net/threads/myaac-v0-0-1.251454/page-13#post-2466303
- fixed https://otland.net/threads/myaac-v0-0-1.251454/page-13#post-2466313
- fixed rook sample, which will now have level 1, 150 health, 0 mana, and 400 cap.
- fixed samples being deleted by tfs 1.0+ cause of 'deletion' field set to 1
- pages loaded from database have higher priority than normal .php pages, so they will be loaded first if they exist
- moved many pages to twig templates
- change download client links from clients.halfaway.net to tibia-clients.com
- added bugtracker to kathrine template
- added CREDITS file
[0.4.2 - 14.09.2017]
- updated version number
[0.4.1 - 13.09.2017]
- fixed log in to admin panel
- fixed File is not .zip plugin upload error
[0.4.0 - 13.09.2017
- added option to add/edit/delete/hide/move forum boards
- moved some of HTML-in-PHP code to Twig templates
- added bug_report configurable which can enable/disable bug tracker
- log errors instead of showing them to users with system directories
- fix when $_SERVER['HTTP_ACCEPT_ENCODING'] is not set
- when it fails to load config.lua it will output error also to error.log
- automatically detect json file in .zip instead of basing on filename (admin panel - plugins)
- hopefully fixed the error with "The file you are trying to upload is not a .zip file. Please try again."
- fixed wrong name of table in bugtracker
- fixed some bugs in bugtracker
- added report bug link in templates
- fixed some rare error when user is logged in for longer than 15 minutes and tries to login again
- fixed some grammar errors
- some small improvements
- fixed some separators in kathrine template
[0.3.0 - 28.08.2017]
- added administration panel for screenshots management with auto thumbnail generator and image auto-resizing
- added Twig template engine and moved some html-in-php code to it
- automatically detect player country based on user location (IP) on create account
- player sex (gender) is now configurable at $config['genders']
- fixed recovering account and changing password when salt is enabled
- fixed installing samples when for example Rook Sample already exist and other samples not
- fixed some mysql error when character you trying to create already exist
- fixed some warning when you select nonexistent country
- password change minimal/maximal length notice is now more precise
- added 'enabled' field in myaac_hooks table, which can enable or disable specified hook
- removed DEFAULT '' for TEXT field. It didn't worked under some systems like MAC OS X.
- minimum PHP version to install the MyAAC is now 5.2.0 cause of pathinfo (extension) function
- removed unused admin stylish template
- removed some unused cities field from myaac_spells table
- moved news adding at installation from schema.sql to finish.php
- some optimizations
[0.2.4 - 09.06.2017]
- fixed invite to guild
- added id field on monsters, so you can delete them in phpmyadmin
- fixed adding some creatures with ' and "
- fixed when there are spaces at beginning of the file (creatures)
- fixed when file is unable to parse (creatures)
- fixed typo loss_items => loss_containers
- more elegant way of showing message on reload creatures and spells
[0.2.3 - 31.05.2017]
- fixed guild management on OTHire 0.0.3
- set default skills to 10 when creating new character
- fixed displaying of "Create forum thread" in newses
- fixed deleting guild on servers that use players.rank_id field
- fixed phpmailer class loading (https://otland.net/threads/myaac-v0-0-1.251454/page-8#post-2445222)
- fixed displaying vocation amount on online page
- better support for custom vocations, you just need to set in config vocations_amount to yours.
- fixed huge space in player name (https://otland.net/threads/myaac-v0-0-1.251454/page-7#post-2444328)
- fixed Undefined variable (https://otland.net/threads/myaac-v0-0-1.251454/page-7#post-2444034)
- fixed Undefined offset (https://otland.net/threads/myaac-v0-0-1.251454/page-7#post-2444035)
[0.2.2 - 22.05.2017]
- added missing cache/signature directory
- fixed https://otland.net/threads/myaac-v0-0-1.251454/page-7#post-2443868
[0.2.1 - 21.05.2017]
- added Swedish translation by Sizaro
- fixed some bugs with installlation & characters & houses
[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/

492
CHANGELOG.md Normal file
View File

@@ -0,0 +1,492 @@
# Changelog
## [0.7.13 - not-release-yet]
### Fixed
* Ignore arrays in config.lua (fixes experienceStages loading)
## [0.7.12 - 18.02.2020]
### Fixed
* change guild nick function causing crash on TFS 1.x because of invalid characters being accepted
* PHP Mailer autoload function on newer PHP
* gesior signature guild rank loading
* leaking database password when cannot connect
* config.last_kills_limit being ignored
* monster.loot being cutted off cause of too short column (changed to TEXT)
### Added
* nginx-sample.conf
## [0.7.11 - 04.05.2019]
### Added:
* support for some old servers, where arrays are used in config.lua
* an additional text to the install page informing that user can reinstall MyAAC by deleting config.local.php
### Fixed:
* XSS in forum show_thread
* guilds - "Add new rank" function
* multiple mail recipients when using admin mailer function
* Admin Panel - MyAAC logs not shown if servers logs directory doesn't exist (#47)
* missing prefix for cache get() and delete() functions
* add fatal error message when myaac tables in database do not exist
* the mystical defect where "Create Account" button was not highlighted (on the account/manage page)
* bug where server_config table does not exist (OTHire as an example)
* database_name in Usage_Statistics
* forgot to open <head> in install template
### Changed:
* do not display software version
## [0.7.10 - 03.03.2018]
### Added:
* new configurable: smtp_secure
* robots.txt
### Fixed:
* editing an existing page that had php enabled
* chrome bug on save (when editing page) ERR_BLOCKED_BY_XSS_AUDITOR
* showing IP and Port in admin panel (#44, by miqueiaspenha)
* deleting plugin showing "You don't have rights to delete"
* some bug with PHPMailer not finding its language file
* default accounts.vote value
* saving some really high long ip addresses
### Changed:
* update config.highscores_ids_hidden on install when there are samples already in database
* auto add z_polls table on install
### Internal:
* changed mb_strtolower functions to strtolower()
* added new function: $hooks->exist($type)
## [0.7.9 - 13.01.2018]
* removed 6mb of trash (some useless things)
* (fix) TFS 1.x not showing promoted vocations in highscores
* otserv 0.6.x: fixed some warning (on the characters page) and fatal mysql error (on the mango signature)
* fixed default stamina on otserv 0.6.x engine (and some others perhaps)
* install: change permission check to is_writable
* changed highscores_groups_hidden to 3 (for TFS 1.x)
* updated background-artwork (tibiacom template) to the latest version, removed other ones
## [0.7.8 - 12.01.2018]
* fixed installation error " call to undefined method OTS_DB_MySQL::hasColumn()"
* updated tinymce to the latest (4.7.4) version
* enabled emoticons plugin in tinymce :)
* some security fixes
## [0.7.7 - 08.01.2018]
* important fix for servers with promotion column (caused player.vocation to be resetted when saving player, for example: on change name, accept invite to guild, leave guild)
* immediately reload config.lua when there's change in config.server_path detected
* added new forum option: "Enable HTML" (only for moderators)
* fixed othire default column value (#26)
* fixed saving custom vocations in admin panel (#36)
* fixed warning in highscores when vocation doesn't exist
* fixed characters page - config.characters.frags "Notice: Use of undefined constant"
* fixed getBoolean function when boolean is passed
* fixed empty success message on leave guild
* fixed displaying premium account days
* function OTS_Account:getPremDays will now return -1 if there's freePremium configurable enabled on the server
* fixed tr bgcolor in characters view (Frags) (#38)
* fixed some warning in guild show
* fixed PHP warning about country not existing on online and characters pages
* fixed forum bbcode parsing
* don't add extra <br/> to the TinyMCE news forum posts
* (internal) using $player->getVocationName() where possible instead of older method
## [0.7.6 - 05.01.2017]
* fixed othire account creating/installation
* fixed table name players -> players_online
* fixed unexpected error logging about email fail
* added max_execution_time to the install finish step
* some small fix regarding highscores vocation box
## [0.7.5 - 04.01.2017]
* fixed bug on othire with config.account_premium_days
* fixed bug on TFS 1.x when online_afk is enabled
* warning about leaving news page with changes
* added player status to tibiacom top 5 highscores box
* save detected country on create account in session
* fixed getPremDays and isPremium functions (newest 11.x engines are bugged when it comes to PACC, its not fault of MyAAC)
* fix when there are no changelogs or highscores yet
* small fix regarding getTopPlayers function which was ignoring $limit variable
* fixed news adding when type != ARTICLE
* fixed template path finding
* fixed displaying article_text when it was empty saved
## [0.7.4 - 24.12.2017]
* fixed mysql fatal error on tibiacom template - top 5 box
* fixed displaying of level percent bar on tibian signature
* inform user about Twig cache failure on installation, instead of http 500 error
* when dir system/cache is not writable by the webserver, then show some nice notice to the user about it instead of http 500 error
* remember client version select and usage stats checkbox in session on install
* automatically update highscores_ids_hidden for users who installed myaac before (migration)
## [0.7.3 - 18.12.2017]
* auto generate myaac cache & session prefix on install to be unique across installations
* fixed hiding shop system menu on tibiacom template when disabled in config
* prevent adding duplicated newses with installation
* some changes to sample characters: chanced town_id to 1, posx: 1000, posy: 1000, posz: 1000 and default group_id to 1 so you can change in-game outfits and they will be used
* added version 772 constant to install client choose (OTHire)
* better solution for hidding samples (configurable) - highscores_ids_hidden
* fixed account.login redirect not working on tibiacom template
* installation: warn about wrong admin account name/id and password
* fixed last menu closing in tibiacom template
* updated polish locale (translation) on install
* (internal) removed some duplicated code on install finish
* (internal) renamed installation step files to be in correct order
* added TODO file
## [0.7.1 - 13.12.2017]
* added changelog menu item to kathrine template
* fixed some php short tag in changelogs page
* fixed guild change description back button
* removed duplicated "Support List" menu item from tibiacom template
* changed some notice when version check is failed
* (internal) moved changelog to twig
## [0.7.0 - 20.11.2017]
* moved template menus to database, they're now dynamically loaded
* added anonymous usage statistics reporting (only if user agrees, first usage report will be send after 7 days)
* you can edit them in Admin Panel under 'Menus' option
* you can also add custom links, like http://google.pl
* added networks (facebook and twitter) and highscores (top 5) boxes to tibiacom template, configurable in templates/tibiacom/config.php
* added news ticker for kathrine template
* added featured article to tibiacom template (you can add them with add news button)
* added tinymce editor to 'Pages' in admin panel
* added links to edit/delete/hide custom page directly from page
* update forum post after editing news (when forum post has been created)
* enabled code plugin for tinymce which enabled raw html code editing
* removed videos pages, as it can be easily added using custom Menus and Pages with insert Media
* removed bug_report configurable, its now enabled by default
* log some error info when mail cannot be send on account create
* twig getLink function will now return with full url (BASE_URL included)
* verify install post values directly on config page and display error
* updated tinymce to version 4.7.2 (from 4.7.0)
* updated phpmailer to version 5.2.26 (from 5.2.23)
* (#30) (fix) recovering account on servers that doesn't support salts
* (fix) account email confirm function
* (fix) showing changelog with urls in Admin Panel
* (fix) uninstalling plugin
* (fix) polls box in tibiacom template
* (fix) remove hooks from db on plugin deinstall
* (fix) some weird include possibilities with forum and account actions (verify action name)
* (fix) loading hooks from plugin installed from command line
* (fix) some changelog PHP Notice warning
* (internal) moved uninstall logic to Plugins class
* (internal) moved tibiacom boxes to separate directory
* (internal) moved news tickers to twig template
* (internal) moved Forum class to separate file
* (internal) moved deprecated functions to compat.php
* (internal) added some compat functions that are used by shop system
* (internal) renamed constant TICKET -> TICKER
* (internal) shortened message functions
## [0.6.6 - 22.10.2017]
* fixed some php fatal error on spells page
* changed spells.vocations field in db size to 300
* please reload your spells after this update!
## [0.6.5 - 21.10.2017]
* fixed displaying custom pages
* fixed adding new group forum board
## [0.6.4 - 20.10.2017]
* reverted OTS_Account::getLastLogin() cause its used by tibia11-login plugin
## [0.6.3 - 20.10.2017]
* fixed creating account
* fixed viewing thread without being logged
* fixed showing premium account status
## [0.6.2 - 20.10.2017]
* added forums for guilds and groups
* added nice looking menu for my account page in default template
* new command line tool: install_plugin.php - can be used to install plugins from command line. Usage: "php install_plugin.php path_to_file"
* added new tooltip to view characters equipment item name and monster loot
* added items.xml loader class and weapons.xml loader class
* minimum PHP version to install AAC is now 5.3.0 cause of Anonymous functions used by Twig
* Added 'Are you sure?' popup when uninstalling plugin
* added some warnings when plugin json file is incomplete
* fixed showing in characters ban expires when is unlimited
* fixed displaying monster loot when item.name in loot is used instead of item.id
* load also runes into spells table
* display plugin uninstall option only if its possible
* after changing template you will be redirected to latest viewed page
* display gallery add image form only on main gallery page
* (internal) moved most of guilds html-in-php code to twig
* (internal) moved spells page to twig template
* (internal) removed useless spells.spell column that was duplicate of spells.words
* (internal) save monster loot in database in json format instead loading it every time from xml file
* (internal) store monster voices and immunities in json format
* (internal) moved buttons to separate template
* (internal) moved online search form to twig
* (internal) added new function getItemNameById($id)
* (internal) Moved plugin install logic to a new class: Plugins
* (internal) changed spells.vocations database field to store json data instead of comma separated
* (internal) removed $hook_types array, using defined() and constant() functions now
* (internal) removed useless monsters.gfx_name field from database
* (internal) renamed database field monsters.hide_creature to hidden
* (internal) renamed existing Items class to Items_Images
* (internal) optimized Spells class
* (internal) new function: OTS_Guild::hasMember(OTS_Player $player)
* (internal) new function: Forum::hasAccess($board_id)
## [0.6.1 - 17.10.2017]
* fixed signatures loading
* new configurable: session_prefix, to allow more websites on one machine (must be unique for every website on your dedicated server!)
* better error handling for monsters and spells loader (save errors to system/logs/error.log)
* check if file exist before loading (monsters and spells)
* (internal) Account::getAccess() = Account::getGroupId()
* (internal) moved account actions (pages) to account/ directory
* (internal) moved forum actions (pages) to forum/ directory
* (internal) moved forum.edit_post to twig templates
## [0.6.0 - 16.10.2017]
* added faq management - add/edit/move/hide/delete from website
* new account.login view for tibiacom template
* monsters and spells are now being loaded at the installation of the AAC
* fix for php versions under 5.5 where empty() function supported only variables
* added missing change email and change info buttons to account.management default template
* added new indicator icons for create account, create character and change character name
* fixed config loader when some inline comments are present
* fixed editing page in admin panel that contains some html code
* fixed forum new post on mac os and some specific mysql versions
* attempt to fix incorrect views counter behavior (its resetting to 0 in some cases)
* enabled cache http headers for signatures
* check if monster file exist before loading it
* fixed if plugin zip file name contains dot (.)
* renamed screenshots to gallery and movies to videos
* moved install pages to twig
* fixed Account::getGuildAccess function
* removed never used library from sources - dwoo
* moved check_* functions to class Validator
* from now all validators ajax requests will fire onblur instead of onkeyup
* ajax requests returns now json instead of xml
* added 404 response when file is not found
## [0.5.1 - 11.10.2017]
* fixed forum add/edit board
* new configurable: highscores_length, how much highscores to display
* fixed highscores links (ALL, previous and next page)
* update templates cache when installing/uninstalling plugin
* moved character deaths and frags table generation to twig
* fixed some bug when you uninstall plugin and then try to install again on the same page
* check if plugin exist before uninstalling
* fixed some warning in OTS_Base_DB
## [0.5.0 - 10.10.2017]
* moved .htaccess rules to plain php (index.php)
* updated tinymce to the latest (4.7.0) version, you can now embed code, for example youtube videos
* added option to uninstall plugin
* added option to require specified myaac, php or database version for plugins, without that plugin won't be installed
* change accountmanagement links to use friendly_urls
* fixed creating new forum thread
* sample characters are now assigned to admin account and have group_id 4 to not be shown on highscores
* added links loaded from database to admin panel - for future plugins
* print some info to error.log when can't find config.lua
* some fixes in account changecomment action
* show info when account name/number or password is empty on login
* fixed showing account login errors
* added few characters hooks
* fixed some kathrine template js bug when shop is disabled
* you can now use slash '/' in custom pages loaded from database
* added new twig function getLink that convert link taking into account config.friendly_urls
* internalLayoutLink -> getLink
## [0.4.3 - 05.10.2017]
* better config loader taken from latest gesior, you can now include files in your config by doing dofile('config.local.lua')
* fixed country detection in create account
* fixed showing of character deaths and frags
* fixed https://otland.net/threads/myaac-v0-0-1.251454/page-13#post-2466303
* fixed https://otland.net/threads/myaac-v0-0-1.251454/page-13#post-2466313
* fixed rook sample, which will now have level 1, 150 health, 0 mana, and 400 cap.
* fixed samples being deleted by tfs 1.0+ cause of 'deletion' field set to 1
* pages loaded from database have higher priority than normal .php pages, so they will be loaded first if they exist
* moved many pages to twig templates
* change download client links from clients.halfaway.net to tibia-clients.com
* added bugtracker to kathrine template
* added CREDITS file
## [0.4.2 - 14.09.2017]
* updated version number
## [0.4.1 - 13.09.2017]
* fixed log in to admin panel
* fixed File is not .zip plugin upload error
## [0.4.0 - 13.09.2017
* added option to add/edit/delete/hide/move forum boards
* moved some of HTML-in-PHP code to Twig templates
* added bug_report configurable which can enable/disable bug tracker
* log errors instead of showing them to users with system directories
* fix when $_SERVER['HTTP_ACCEPT_ENCODING'] is not set
* when it fails to load config.lua it will output error also to error.log
* automatically detect json file in .zip instead of basing on filename (admin panel - plugins)
* hopefully fixed the error with "The file you are trying to upload is not a .zip file. Please try again."
* fixed wrong name of table in bugtracker
* fixed some bugs in bugtracker
* added report bug link in templates
* fixed some rare error when user is logged in for longer than 15 minutes and tries to login again
* fixed some grammar errors
* some small improvements
* fixed some separators in kathrine template
## [0.3.0 - 28.08.2017]
* added administration panel for screenshots management with auto thumbnail generator and image auto-resizing
* added Twig template engine and moved some html-in-php code to it
* automatically detect player country based on user location (IP) on create account
* player sex (gender) is now configurable at $config['genders']
* fixed recovering account and changing password when salt is enabled
* fixed installing samples when for example Rook Sample already exist and other samples not
* fixed some mysql error when character you trying to create already exist
* fixed some warning when you select nonexistent country
* password change minimal/maximal length notice is now more precise
* added 'enabled' field in myaac_hooks table, which can enable or disable specified hook
* removed DEFAULT '' for TEXT field. It didn't worked under some systems like MAC OS X.
* minimum PHP version to install the MyAAC is now 5.2.0 cause of pathinfo (extension) function
* removed unused admin stylish template
* removed some unused cities field from myaac_spells table
* moved news adding at installation from schema.sql to finish.php
* some optimizations
## [0.2.4 - 09.06.2017]
* fixed invite to guild
* added id field on monsters, so you can delete them in phpmyadmin
* fixed adding some creatures with ' and "
* fixed when there are spaces at beginning of the file (creatures)
* fixed when file is unable to parse (creatures)
* fixed typo loss_items => loss_containers
* more elegant way of showing message on reload creatures and spells
## [0.2.3 - 31.05.2017]
* fixed guild management on OTHire 0.0.3
* set default skills to 10 when creating new character
* fixed displaying of "Create forum thread" in newses
* fixed deleting guild on servers that use players.rank_id field
* fixed phpmailer class loading (https://otland.net/threads/myaac-v0-0-1.251454/page-8#post-2445222)
* fixed displaying vocation amount on online page
* better support for custom vocations, you just need to set in config vocations_amount to yours.
* fixed huge space in player name (https://otland.net/threads/myaac-v0-0-1.251454/page-7#post-2444328)
* fixed Undefined variable (https://otland.net/threads/myaac-v0-0-1.251454/page-7#post-2444034)
* fixed Undefined offset (https://otland.net/threads/myaac-v0-0-1.251454/page-7#post-2444035)
## [0.2.2 - 22.05.2017]
* added missing cache/signature directory
* fixed https://otland.net/threads/myaac-v0-0-1.251454/page-7#post-2443868
## [0.2.1 - 21.05.2017]
* added Swedish translation by Sizaro
* fixed some bugs with installlation & characters & houses
## [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/

View File

@@ -1,11 +1,17 @@
# PLEASE DO NOT USE THIS BRANCH/VERSION
## It is discontinued and won't receive any updates
## Switch to master branch instead
## It's keept only for archival purposes
# myaac # myaac
MyAAC is a free and open-source Automatic Account Creator (AAC) and Content Management System (CMS) written in PHP. It is a fork of the [Gesior](https://github.com/gesior/Gesior2012) project. It supports only MySQL databases. MyAAC is a free and open-source Automatic Account Creator (AAC) and Content Management System (CMS) written in PHP. It is a fork of the [Gesior](https://github.com/gesior/Gesior2012) project. It supports only MySQL databases.
Official website: https://my-aac.org Official website: https://my-aac.org
### REQUIREMENTS ### REQUIREMENTS
- PHP 5.3.0 or later - PHP 5.3.3 or later
- MySQL database - MySQL database
- PDO PHP Extension - PDO PHP Extension
- XML PHP Extension - XML PHP Extension
@@ -28,6 +34,7 @@ Official website: https://my-aac.org
chmod 660 images/guilds chmod 660 images/guilds
chmod 660 images/houses chmod 660 images/houses
chmod 660 images/gallery chmod 660 images/gallery
chmod -R 770 system/cache
Visit http://your_domain/install (http://localhost/install) and follow instructions in the browser. Visit http://your_domain/install (http://localhost/install) and follow instructions in the browser.

View File

@@ -26,8 +26,8 @@
session_start(); session_start();
define('MYAAC', true); define('MYAAC', true);
define('MYAAC_VERSION', '0.7.1'); define('MYAAC_VERSION', '0.7.13-dev');
define('DATABASE_VERSION', 18); define('DATABASE_VERSION', 22);
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' : (strtoupper(PHP_OS) == 'DARWIN' ? 'MAC' : 'LINUX')); define('MYAAC_OS', (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? 'WINDOWS' : (strtoupper(PHP_OS) == 'DARWIN' ? 'MAC' : 'LINUX'));
@@ -99,10 +99,10 @@ if(isset($_SERVER['HTTP_HOST'])) {
define('SERVER_URL', 'https://' . $_SERVER['HTTP_HOST']); define('SERVER_URL', 'https://' . $_SERVER['HTTP_HOST']);
else else
define('SERVER_URL', 'http://' . $_SERVER['HTTP_HOST']); define('SERVER_URL', 'http://' . $_SERVER['HTTP_HOST']);
define('BASE_URL', SERVER_URL . BASE_DIR . '/'); define('BASE_URL', SERVER_URL . BASE_DIR . '/');
define('ADMIN_URL', SERVER_URL . BASE_DIR . '/admin/'); define('ADMIN_URL', SERVER_URL . BASE_DIR . '/admin/');
//define('CURRENT_URL', BASE_URL . $_SERVER['REQUEST_URI']); //define('CURRENT_URL', BASE_URL . $_SERVER['REQUEST_URI']);
} }
?> ?>

View File

@@ -75,7 +75,7 @@ $config = array(
// images // images
'outfit_images_url' => 'http://outfit-images.ots.me/outfit.php', // set to animoutfit.php for animated outfit '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 'item_images_url' => 'http://item-images.ots.me/1092/', // 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)
@@ -107,6 +107,7 @@ $config = array(
'smtp_auth' => true, // need authorization? 'smtp_auth' => true, // need authorization?
'smtp_user' => 'admin@example.org', 'smtp_user' => 'admin@example.org',
'smtp_pass' => '', 'smtp_pass' => '',
'smtp_secure' => '', // What kind of encryption to use on the SMTP connection. Options: '', 'ssl' or 'tls', use 'ssl' for gmail
// reCAPTCHA (prevent spam bots) // reCAPTCHA (prevent spam bots)
'recaptcha_enabled' => false, // enable recaptcha verification code 'recaptcha_enabled' => false, // enable recaptcha verification code
@@ -185,7 +186,8 @@ $config = array(
'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_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' => 3, // this group id and higher won't be shown on the highscores
'highscores_ids_hidden' => array(0), // this ids of players will be hidden on the highscores (should be ids of samples)
'highscores_length' => 100, // how many records per page on highscores 'highscores_length' => 100, // how many records per page on highscores
// characters page // characters page

871
index.php
View File

@@ -1,435 +1,436 @@
<?php <?php
/** /**
* Project: MyAAC * Project: MyAAC
* Automatic Account Creator for Open Tibia Servers * Automatic Account Creator for Open Tibia Servers
* File: index.php * File: index.php
* *
* This is free software; you can redistribute it and/or * This is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This software is distributed in the hope that it will be useful, * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
* @package MyAAC * @package MyAAC
* @author Slawkens <slawkens@gmail.com> * @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC * @copyright 2017 MyAAC
* @link http://my-aac.org * @link http://my-aac.org
*/ */
// uncomment if your php.ini have display_errors disabled and you want to see errors // uncomment if your php.ini have display_errors disabled and you want to see errors
// ini_set('display_errors', 1); // ini_set('display_errors', 1);
// ini_set('display_startup_errors', 1); // ini_set('display_startup_errors', 1);
// error_reporting(E_ALL); // error_reporting(E_ALL);
require_once('common.php'); require_once('common.php');
require_once(SYSTEM . 'functions.php'); require_once(SYSTEM . 'functions.php');
$uri = $_SERVER['REQUEST_URI']; $uri = $_SERVER['REQUEST_URI'];
$tmp = BASE_DIR; $tmp = BASE_DIR;
if(!empty($tmp)) if(!empty($tmp))
$uri = str_replace(BASE_DIR . '/', '', $uri); $uri = str_replace(BASE_DIR . '/', '', $uri);
else else
$uri = str_replace_first('/', '', $uri); $uri = str_replace_first('/', '', $uri);
$uri = str_replace(array('index.php/', '?'), '', $uri); $uri = str_replace(array('index.php/', '?'), '', $uri);
define('URI', $uri); define('URI', $uri);
if(preg_match("/^[A-Za-z0-9-_%\'+]+\.png$/i", $uri)) { if(preg_match("/^[A-Za-z0-9-_%\'+]+\.png$/i", $uri)) {
$tmp = explode('.', $uri); $tmp = explode('.', $uri);
$_REQUEST['name'] = urldecode($tmp[0]); $_REQUEST['name'] = urldecode($tmp[0]);
chdir(TOOLS . 'signature'); chdir(TOOLS . 'signature');
include(TOOLS . 'signature/index.php'); include(TOOLS . 'signature/index.php');
exit(); exit();
} }
else if(preg_match("/^(.*)\.(gif|jpg|png|jpeg|tiff|bmp|css|js|less|map|html|php|zip|rar|gz)$/i", $_SERVER['REQUEST_URI'])) { else if(preg_match("/^(.*)\.(gif|jpg|png|jpeg|tiff|bmp|css|js|less|map|html|php|zip|rar|gz|ttf|woff|ico)$/i", $_SERVER['REQUEST_URI'])) {
header("HTTP/1.0 404 Not Found"); header("HTTP/1.0 404 Not Found");
exit; exit;
} }
require_once(BASE . 'config.local.php'); require_once(BASE . 'config.local.php');
if(file_exists(BASE . 'install') && (!isset($config['installed']) || !$config['installed'])) if(file_exists(BASE . 'install') && (!isset($config['installed']) || !$config['installed']))
{ {
header('Location: ' . BASE_URL . 'install/'); header('Location: ' . BASE_URL . 'install/');
die('Setup detected that <b>install/</b> directory exists. Please visit <a href="' . BASE_URL . 'install">this</a> url to start MyAAC Installation.<br/>Delete <b>install/</b> directory if you already installed MyAAC.<br/>Remember to REFRESH this page when you\'re done!'); die('Setup detected that <b>install/</b> directory exists. Please visit <a href="' . BASE_URL . 'install">this</a> url to start MyAAC Installation.<br/>Delete <b>install/</b> directory if you already installed MyAAC.<br/>Remember to REFRESH this page when you\'re done!');
} }
$found = false; $found = false;
if(empty($uri) || isset($_REQUEST['template'])) { if(empty($uri) || isset($_REQUEST['template'])) {
$_REQUEST['p'] = 'news'; $_REQUEST['p'] = 'news';
$found = true; $found = true;
} }
else { else {
$tmp = strtolower($uri); $tmp = strtolower($uri);
if(!preg_match('/[^A-z0-9_\-]/', $uri) && file_exists(SYSTEM . 'pages/' . $tmp . '.php')) { if(!preg_match('/[^A-z0-9_\-]/', $uri) && file_exists(SYSTEM . 'pages/' . $tmp . '.php')) {
$_REQUEST['p'] = $uri; $_REQUEST['p'] = $uri;
$found = true; $found = true;
} }
else { else {
$rules = array( $rules = array(
'/^account\/manage\/?$/' => array('subtopic' => 'accountmanagement'), '/^account\/manage\/?$/' => array('subtopic' => 'accountmanagement'),
'/^account\/create\/?$/' => array('subtopic' => 'createaccount'), '/^account\/create\/?$/' => array('subtopic' => 'createaccount'),
'/^account\/lost\/?$/' => array('subtopic' => 'lostaccount'), '/^account\/lost\/?$/' => array('subtopic' => 'lostaccount'),
'/^account\/logout\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'logout'), '/^account\/logout\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'logout'),
'/^account\/password\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_password'), '/^account\/password\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_password'),
'/^account\/register\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'register'), '/^account\/register\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'register'),
'/^account\/register\/new\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'register_new'), '/^account\/register\/new\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'register_new'),
'/^account\/email\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_email'), '/^account\/email\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_email'),
'/^account\/info\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_info'), '/^account\/info\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_info'),
'/^account\/character\/create\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'create_character'), '/^account\/character\/create\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'create_character'),
'/^account\/character\/name\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_name'), '/^account\/character\/name\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_name'),
'/^account\/character\/sex\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_sex'), '/^account\/character\/sex\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_sex'),
'/^account\/character\/delete\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'delete_character'), '/^account\/character\/delete\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'delete_character'),
'/^account\/character\/comment\/[A-Za-z0-9-_%+\']+\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_comment', 'name' => '$3'), '/^account\/character\/comment\/[A-Za-z0-9-_%+\']+\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_comment', 'name' => '$3'),
'/^account\/character\/comment\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_comment'), '/^account\/character\/comment\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_comment'),
'/^account\/confirm_email\/[A-Za-z0-9-_]+\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'confirm_email', 'v' => '$2'), '/^account\/confirm_email\/[A-Za-z0-9-_]+\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'confirm_email', 'v' => '$2'),
'/^characters\/[A-Za-z0-9-_%+\']+$/' => array('subtopic' => 'characters', 'name' => '$1'), '/^characters\/[A-Za-z0-9-_%+\']+$/' => array('subtopic' => 'characters', 'name' => '$1'),
'/^changelog\/[0-9]+\/?$/' => array('subtopic' => 'changelog', 'page' => '$1'), '/^changelog\/[0-9]+\/?$/' => array('subtopic' => 'changelog', 'page' => '$1'),
'/^commands\/add\/?$/' => array('subtopic' => 'commands', 'action' => 'add'), '/^commands\/add\/?$/' => array('subtopic' => 'commands', 'action' => 'add'),
'/^commands\/edit\/?$/' => array('subtopic' => 'commands', 'action' => 'edit'), '/^commands\/edit\/?$/' => array('subtopic' => 'commands', 'action' => 'edit'),
'/^faq\/add\/?$/' => array('subtopic' => 'faq', 'action' => 'add'), '/^faq\/add\/?$/' => array('subtopic' => 'faq', 'action' => 'add'),
'/^faq\/edit\/?$/' => array('subtopic' => 'faq', 'action' => 'edit'), '/^faq\/edit\/?$/' => array('subtopic' => 'faq', 'action' => 'edit'),
'/^forum\/add_board\/?$/' => array('subtopic' => 'forum', 'action' => 'add_board'),# '/^forum\/add_board\/?$/' => array('subtopic' => 'forum', 'action' => 'add_board'),#
'/^forum\/edit_board\/?$/' => array('subtopic' => 'forum', 'action' => 'edit_board'), '/^forum\/edit_board\/?$/' => array('subtopic' => 'forum', 'action' => 'edit_board'),
'/^forum\/board\/[0-9]+\/?$/' => array('subtopic' => 'forum', 'action' => 'show_board', 'id' => '$2'), '/^forum\/board\/[0-9]+\/?$/' => array('subtopic' => 'forum', 'action' => 'show_board', 'id' => '$2'),
'/^forum\/board\/[0-9]+\/[0-9]+\/?$/' => array('subtopic' => 'forum', 'action' => 'show_board', 'id' => '$2', 'page' => '$3'), '/^forum\/board\/[0-9]+\/[0-9]+\/?$/' => array('subtopic' => 'forum', 'action' => 'show_board', 'id' => '$2', 'page' => '$3'),
'/^forum\/thread\/[0-9]+\/?$/' => array('subtopic' => 'forum', 'action' => 'show_thread', 'id' => '$2'), '/^forum\/thread\/[0-9]+\/?$/' => array('subtopic' => 'forum', 'action' => 'show_thread', 'id' => '$2'),
'/^forum\/thread\/[0-9]+\/[0-9]+\/?$/' => array('subtopic' => 'forum', 'action' => 'show_thread', 'id' => '$2', 'page' => '$3'), '/^forum\/thread\/[0-9]+\/[0-9]+\/?$/' => array('subtopic' => 'forum', 'action' => 'show_thread', 'id' => '$2', 'page' => '$3'),
'/^gallery\/add\/?$/' => array('subtopic' => 'gallery', 'action' => 'add'), '/^gallery\/add\/?$/' => array('subtopic' => 'gallery', 'action' => 'add'),
'/^gallery\/edit\/?$/' => array('subtopic' => 'gallery', 'action' => 'edit'), '/^gallery\/edit\/?$/' => array('subtopic' => 'gallery', 'action' => 'edit'),
'/^gallery\/[0-9]+\/?$/' => array('subtopic' => 'gallery', 'image' => '$1'), '/^gallery\/[0-9]+\/?$/' => array('subtopic' => 'gallery', 'image' => '$1'),
'/^gifts\/history\/?$/' => array('subtopic' => 'gifts', 'action' => 'show_history'), '/^gifts\/history\/?$/' => array('subtopic' => 'gifts', 'action' => 'show_history'),
'/^guilds\/[A-Za-z0-9-_%+\']+$/' => array('subtopic' => 'guilds', 'action' => 'show', 'guild' => '$1'), '/^guilds\/[A-Za-z0-9-_%+\']+$/' => array('subtopic' => 'guilds', 'action' => 'show', 'guild' => '$1'),
'/^highscores\/[A-Za-z0-9-_]+\/[A-Za-z0-9-_]+\/[0-9]+\/?$/' => array('subtopic' => 'highscores', 'list' => '$1', 'vocation' => '$2', 'page' => '$3'), '/^highscores\/[A-Za-z0-9-_]+\/[A-Za-z0-9-_]+\/[0-9]+\/?$/' => array('subtopic' => 'highscores', 'list' => '$1', 'vocation' => '$2', 'page' => '$3'),
'/^highscores\/[A-Za-z0-9-_]+\/[0-9]+\/?$/' => array('subtopic' => 'highscores', 'list' => '$1', 'page' => '$2'), '/^highscores\/[A-Za-z0-9-_]+\/[0-9]+\/?$/' => array('subtopic' => 'highscores', 'list' => '$1', 'page' => '$2'),
'/^highscores\/[A-Za-z0-9-_]+\/[A-Za-z0-9-_]+\/?$/' => array('subtopic' => 'highscores', 'list' => '$1', 'vocation' => '$2'), '/^highscores\/[A-Za-z0-9-_]+\/[A-Za-z0-9-_]+\/?$/' => array('subtopic' => 'highscores', 'list' => '$1', 'vocation' => '$2'),
'/^highscores\/[A-Za-z0-9-_\']+\/?$/' => array('subtopic' => 'highscores', 'list' => '$1'), '/^highscores\/[A-Za-z0-9-_\']+\/?$/' => array('subtopic' => 'highscores', 'list' => '$1'),
'/^news\/add\/?$/' => array('subtopic' => 'news', 'action' => 'add'), '/^news\/add\/?$/' => array('subtopic' => 'news', 'action' => 'add'),
'/^news\/edit\/?$/' => array('subtopic' => 'news', 'action' => 'edit'), '/^news\/edit\/?$/' => array('subtopic' => 'news', 'action' => 'edit'),
'/^news\/archive\/?$/' => array('subtopic' => 'newsarchive'), '/^news\/archive\/?$/' => array('subtopic' => 'newsarchive'),
'/^news\/archive\/[0-9]+\/?$/' => array('subtopic' => 'newsarchive', 'id' => '$2'), '/^news\/archive\/[0-9]+\/?$/' => array('subtopic' => 'newsarchive', 'id' => '$2'),
'/^polls\/[0-9]+\/?$/' => array('subtopic' => 'polls', 'id' => '$1'), '/^polls\/[0-9]+\/?$/' => array('subtopic' => 'polls', 'id' => '$1'),
'/^spells\/[A-Za-z0-9-_%]+\/[A-Za-z0-9-_]+\/?$/' => array('subtopic' => 'spells', 'vocation' => '$1', 'order' => '$2'), '/^spells\/[A-Za-z0-9-_%]+\/[A-Za-z0-9-_]+\/?$/' => array('subtopic' => 'spells', 'vocation' => '$1', 'order' => '$2'),
'/^gifts\/history\/?$/' => array('subtopic' => 'gifts', 'action' => 'show_history'), '/^gifts\/history\/?$/' => array('subtopic' => 'gifts', 'action' => 'show_history'),
); );
foreach($rules as $rule => $redirect) { foreach($rules as $rule => $redirect) {
if (preg_match($rule, $uri)) { if (preg_match($rule, $uri)) {
$tmp = explode('/', $uri); $tmp = explode('/', $uri);
foreach($redirect as $key => $value) { foreach($redirect as $key => $value) {
if(strpos($value, '$') !== false) { if(strpos($value, '$') !== false) {
$value = str_replace('$' . $value[1], $tmp[$value[1]], $value); $value = str_replace('$' . $value[1], $tmp[$value[1]], $value);
} }
$_REQUEST[$key] = $value; $_REQUEST[$key] = $value;
$_GET[$key] = $value; $_GET[$key] = $value;
} }
$found = true; $found = true;
break; break;
} }
} }
} }
} }
// define page visited, so it can be used within events system // define page visited, so it can be used within events system
$page = isset($_REQUEST['subtopic']) ? $_REQUEST['subtopic'] : (isset($_REQUEST['p']) ? $_REQUEST['p'] : ''); $page = isset($_REQUEST['subtopic']) ? $_REQUEST['subtopic'] : (isset($_REQUEST['p']) ? $_REQUEST['p'] : '');
if(empty($page) || !preg_match('/^[A-z0-9\_\-]+$/', $page)) { if(empty($page) || !preg_match('/^[A-z0-9\_\-]+$/', $page)) {
$tmp = URI; $tmp = URI;
if(!empty($tmp)) { if(!empty($tmp)) {
$page = $tmp; $page = $tmp;
} }
else { else {
if(!$found) if(!$found)
$page = '404'; $page = '404';
else else
$page = 'news'; $page = 'news';
} }
} }
$page = strtolower($page); $page = strtolower($page);
define('PAGE', $page); define('PAGE', $page);
$template_place_holders = array(); $template_place_holders = array();
require_once(SYSTEM . 'init.php'); require_once(SYSTEM . 'init.php');
require_once(SYSTEM . 'template.php'); require_once(SYSTEM . 'template.php');
require_once(SYSTEM . 'login.php'); require_once(SYSTEM . 'login.php');
require_once(SYSTEM . 'status.php'); require_once(SYSTEM . 'status.php');
$twig->addGlobal('config', $config); $twig->addGlobal('config', $config);
$twig->addGlobal('status', $status); $twig->addGlobal('status', $status);
// database migrations // verify myaac tables exists in database
$tmp = ''; if(!tableExist('myaac_account_actions')) {
if(fetchDatabaseConfig('database_version', $tmp)) { // we got version die('Seems that the table <strong>myaac_account_actions</strong> of MyAAC doesn\'t exist in the database. This is a fatal error. You can try to reinstall MyAAC by visiting <a href="' . BASE_URL . 'install">this</a> url.');
$tmp = (int)$tmp; }
if($tmp < DATABASE_VERSION) { // import if older
for($i = $tmp + 1; $i <= DATABASE_VERSION; $i++) { // database migrations
$file = SYSTEM . 'migrations/' . $i . '.php'; $tmp = '';
if(file_exists($file)) { if(fetchDatabaseConfig('database_version', $tmp)) { // we got version
require($file); $tmp = (int)$tmp;
} if($tmp < DATABASE_VERSION) { // import if older
} for($i = $tmp + 1; $i <= DATABASE_VERSION; $i++) {
require(SYSTEM . 'migrations/' . $i . '.php');
updateDatabaseConfig('database_version', DATABASE_VERSION); updateDatabaseConfig('database_version', $i);
} }
} }
else { // register first version }
for($i = 1; $i <= DATABASE_VERSION; $i++) { else { // register first version
require(SYSTEM . 'migrations/' . $i . '.php'); registerDatabaseConfig('database_version', 0);
} for($i = 1; $i <= DATABASE_VERSION; $i++) {
require(SYSTEM . 'migrations/' . $i . '.php');
registerDatabaseConfig('database_version', DATABASE_VERSION); updateDatabaseConfig('database_version', $i);
} }
}
// event system
require_once(SYSTEM . 'hooks.php'); // event system
$hooks = new Hooks(); require_once(SYSTEM . 'hooks.php');
$hooks->load(); $hooks = new Hooks();
$hooks->trigger(HOOK_STARTUP); $hooks->load();
$hooks->trigger(HOOK_STARTUP);
// anonymous usage statistics
// sent only when user agrees // anonymous usage statistics
if(isset($config['anonymous_usage_statistics']) && $config['anonymous_usage_statistics']) { // sent only when user agrees
$report_time = 30 * 24 * 60 * 60; // report one time per 30 days if(isset($config['anonymous_usage_statistics']) && $config['anonymous_usage_statistics']) {
$should_report = true; $report_time = 30 * 24 * 60 * 60; // report one time per 30 days
$should_report = true;
$value = '';
if($cache->enabled() && $cache->fetch('last_usage_report', $value)) { $value = '';
$should_report = time() > (int)$value + $report_time; if($cache->enabled() && $cache->fetch('last_usage_report', $value)) {
} $should_report = time() > (int)$value + $report_time;
else { }
$value = ''; else {
if(fetchDatabaseConfig('last_usage_report', $value)) { $value = '';
$should_report = time() > (int)$value + $report_time; if(fetchDatabaseConfig('last_usage_report', $value)) {
if($cache->enabled()) { $should_report = time() > (int)$value + $report_time;
$cache->set('last_usage_report', $value); if($cache->enabled()) {
} $cache->set('last_usage_report', $value);
} }
else { }
registerDatabaseConfig('last_usage_report', time() - ($report_time - (7 * 24 * 60 * 60))); // first report after a week else {
$should_report = false; registerDatabaseConfig('last_usage_report', time() - ($report_time - (7 * 24 * 60 * 60))); // first report after a week
} $should_report = false;
} }
}
if($should_report) {
require_once(LIBS . 'usage_statistics.php'); if($should_report) {
Usage_Statistics::report(); require_once(LIBS . 'usage_statistics.php');
Usage_Statistics::report();
updateDatabaseConfig('last_usage_report', time());
if($cache->enabled()) { updateDatabaseConfig('last_usage_report', time());
$cache->set('last_usage_report', time()); if($cache->enabled()) {
} $cache->set('last_usage_report', time());
} }
} }
}
if($config['views_counter'])
require_once(SYSTEM . 'counter.php'); if($config['views_counter'])
require_once(SYSTEM . 'counter.php');
if($config['visitors_counter'])
{ if($config['visitors_counter'])
require_once(SYSTEM . 'libs/visitors.php'); {
$visitors = new Visitors($config['visitors_counter_ttl']); require_once(SYSTEM . 'libs/visitors.php');
} $visitors = new Visitors($config['visitors_counter_ttl']);
}
// page content loading
if(!isset($content[0])) // page content loading
$content = ''; if(!isset($content[0]))
$load_it = true; $content = '';
$load_it = true;
// check if site has been closed
$site_closed = false; // check if site has been closed
if(fetchDatabaseConfig('site_closed', $site_closed)) { $site_closed = false;
$site_closed = ($site_closed == 1); if(fetchDatabaseConfig('site_closed', $site_closed)) {
if($site_closed) { $site_closed = ($site_closed == 1);
if(!admin()) if($site_closed) {
{ if(!admin())
$title = getDatabaseConfig('site_closed_title'); {
$content .= '<p class="note">' . getDatabaseConfig('site_closed_message') . '</p><br/>'; $title = getDatabaseConfig('site_closed_title');
$load_it = false; $content .= '<p class="note">' . getDatabaseConfig('site_closed_message') . '</p><br/>';
} $load_it = false;
}
if(!$logged)
{ if(!$logged)
ob_start(); {
require(SYSTEM . 'pages/accountmanagement.php'); ob_start();
$content .= ob_get_contents(); require(SYSTEM . 'pages/accountmanagement.php');
ob_end_clean(); $content .= ob_get_contents();
$load_it = false; ob_end_clean();
} $load_it = false;
} }
} }
define('SITE_CLOSED', $site_closed); }
define('SITE_CLOSED', $site_closed);
// backward support for gesior
if($config['backward_support']) { // backward support for gesior
define('INITIALIZED', true); if($config['backward_support']) {
$SQL = $db; define('INITIALIZED', true);
$layout_header = template_header(); $SQL = $db;
$layout_name = $template_path; $layout_header = template_header();
$news_content = ''; $layout_name = $template_path;
$tickers_content = ''; $news_content = '';
$subtopic = PAGE; $tickers_content = '';
$main_content = ''; $subtopic = PAGE;
$main_content = '';
$config['access_admin_panel'] = 2;
$group_id_of_acc_logged = 0; $config['access_admin_panel'] = 2;
if($logged && $account_logged) $group_id_of_acc_logged = 0;
$group_id_of_acc_logged = $account_logged->getGroupId(); if($logged && $account_logged)
$group_id_of_acc_logged = $account_logged->getGroupId();
$config['site'] = &$config;
$config['server'] = &$config['lua']; $config['site'] = &$config;
$config['site']['shop_system'] = $config['gifts_system']; $config['server'] = &$config['lua'];
$config['site']['shop_system'] = $config['gifts_system'];
if(!isset($config['vdarkborder']))
$config['vdarkborder'] = '#505050'; if(!isset($config['vdarkborder']))
if(!isset($config['darkborder'])) $config['vdarkborder'] = '#505050';
$config['darkborder'] = '#D4C0A1'; if(!isset($config['darkborder']))
if(!isset($config['lightborder'])) $config['darkborder'] = '#D4C0A1';
$config['lightborder'] = '#F1E0C6'; if(!isset($config['lightborder']))
$config['lightborder'] = '#F1E0C6';
$config['site']['download_page'] = true;
$config['site']['serverinfo_page'] = true; $config['site']['download_page'] = true;
$config['site']['screenshot_page'] = true; $config['site']['serverinfo_page'] = true;
$config['site']['screenshot_page'] = true;
if($config['forum'] != '')
$config['forum_link'] = (strtolower($config['forum']) == 'site' ? getLink('forum') : $config['forum']); if($config['forum'] != '')
$config['forum_link'] = (strtolower($config['forum']) == 'site' ? getLink('forum') : $config['forum']);
foreach($status as $key => $value)
$config['status']['serverStatus_' . $key] = $value; foreach($status as $key => $value)
} $config['status']['serverStatus_' . $key] = $value;
}
if($load_it)
{ if($load_it)
if(SITE_CLOSED && admin()) {
$content .= '<p class="note">Site is under maintenance (closed mode). Only privileged users can see it.</p>'; if(SITE_CLOSED && admin())
$content .= '<p class="note">Site is under maintenance (closed mode). Only privileged users can see it.</p>';
if($config['backward_support'])
require(SYSTEM . 'compat_pages.php'); if($config['backward_support'])
require(SYSTEM . 'compat_pages.php');
$ignore = false;
$ignore = false;
$logged_access = 1;
if($logged && $account_logged && $account_logged->isLoaded()) { $logged_access = 1;
$logged_access = $account_logged->getAccess(); if($logged && $account_logged && $account_logged->isLoaded()) {
} $logged_access = $account_logged->getAccess();
}
$query =
$db->query( $query =
'SELECT `id`, `title`, `body`, `php`, `hidden`' . $db->query(
' FROM `' . TABLE_PREFIX . 'pages`' . 'SELECT `id`, `title`, `body`, `php`, `hidden`' .
' WHERE `name` LIKE ' . $db->quote($page) . ' AND `hidden` != 1 AND `access` <= ' . $db->quote($logged_access)); ' FROM `' . TABLE_PREFIX . 'pages`' .
if($query->rowCount() > 0) // found page ' WHERE `name` LIKE ' . $db->quote($page) . ' AND `hidden` != 1 AND `access` <= ' . $db->quote($logged_access));
{ if($query->rowCount() > 0) // found page
$ignore = true; {
$query = $query->fetch(); $ignore = true;
$title = $query['title']; $query = $query->fetch();
$title = $query['title'];
if($query['php'] == '1') // execute it as php code
{ if($query['php'] == '1') // execute it as php code
$tmp = substr($query['body'], 0, 10); {
if(($pos = strpos($tmp, '<?php')) !== false) { $tmp = substr($query['body'], 0, 10);
$tmp = preg_replace('/<\?php/', '', $query['body'], 1); if(($pos = strpos($tmp, '<?php')) !== false) {
} $tmp = preg_replace('/<\?php/', '', $query['body'], 1);
else if(($pos = strpos($tmp, '<?')) !== false) { }
$tmp = preg_replace('/<\?/', '', $query['body'], 1); else if(($pos = strpos($tmp, '<?')) !== false) {
} $tmp = preg_replace('/<\?/', '', $query['body'], 1);
else }
$tmp = $query['body']; else
$tmp = $query['body'];
$php_errors = array();
function error_handler($errno, $errstr) { $php_errors = array();
global $php_errors; function error_handler($errno, $errstr) {
$php_errors[] = array('errno' => $errno, 'errstr' => $errstr); global $php_errors;
} $php_errors[] = array('errno' => $errno, 'errstr' => $errstr);
set_error_handler('error_handler'); }
set_error_handler('error_handler');
ob_start();
eval($tmp); ob_start();
$content .= ob_get_contents(); eval($tmp);
ob_end_clean(); $content .= ob_get_contents();
ob_end_clean();
restore_error_handler();
if(isset($php_errors[0]) && superAdmin()) { restore_error_handler();
var_dump($php_errors); if(isset($php_errors[0]) && superAdmin()) {
} var_dump($php_errors);
} }
else }
$content .= $query['body']; // plain html else
$content .= $query['body']; // plain html
if(hasFlag(FLAG_CONTENT_PAGES) || superAdmin()) {
$content = $twig->render('admin.pages.links.html.twig', array( if(hasFlag(FLAG_CONTENT_PAGES) || superAdmin()) {
'page' => array('id' => $query['id'], 'hidden' => $query['hidden']) $content = $twig->render('admin.pages.links.html.twig', array(
)) . $content; 'page' => array('id' => $query['id'], 'hidden' => $query['hidden'])
} )) . $content;
} }
else }
{ else
$file = SYSTEM . 'pages/' . $page . '.php'; {
if(!@file_exists($file)) $file = SYSTEM . 'pages/' . $page . '.php';
{ if(!@file_exists($file))
$page = '404'; {
$file = SYSTEM . 'pages/404.php'; $page = '404';
} $file = SYSTEM . 'pages/404.php';
} }
}
ob_start();
if($hooks->trigger(HOOK_BEFORE_PAGE)) { ob_start();
if(!$ignore) if($hooks->trigger(HOOK_BEFORE_PAGE)) {
require($file); if(!$ignore)
} require($file);
}
if($config['backward_support'] && isset($main_content[0]))
$content .= $main_content; if($config['backward_support'] && isset($main_content[0]))
$content .= $main_content;
$content .= ob_get_contents();
ob_end_clean(); $content .= ob_get_contents();
$hooks->trigger(HOOK_AFTER_PAGE); ob_end_clean();
} $hooks->trigger(HOOK_AFTER_PAGE);
}
if($config['backward_support']) {
$main_content = $content; if($config['backward_support']) {
if(!isset($title)) $main_content = $content;
$title = ucfirst($page); if(!isset($title))
$title = ucfirst($page);
$topic = $title;
} $topic = $title;
}
$title_full = (isset($title) ? $title . $config['title_separator'] : '') . $config['lua']['serverName'];
if(file_exists($template_path . '/index.php')) $title_full = (isset($title) ? $title . $config['title_separator'] : '') . $config['lua']['serverName'];
require($template_path . '/index.php'); if(file_exists($template_path . '/index.php'))
else if(file_exists($template_path . '/template.php')) // deprecated require($template_path . '/index.php');
require($template_path . '/template.php'); else if(file_exists($template_path . '/template.php')) // deprecated
else if($config['backward_support'] && file_exists($template_path . '/layout.php')) require($template_path . '/template.php');
{ else if($config['backward_support'] && file_exists($template_path . '/layout.php'))
require($template_path . '/layout.php'); {
} require($template_path . '/layout.php');
else }
{ else
// TODO: save more info to log file {
die('ERROR: Cannot load template.'); // TODO: save more info to log file
} die('ERROR: Cannot load template.');
}
echo '<!-- MyAAC ' . MYAAC_VERSION . ' :: http://www.my-aac.org/ -->' . "\n";
if(($config['debug_level'] & 1) == 1) echo base64_decode('PCEtLSBQb3dlcmVkIGJ5IE15QUFDIDo6IGh0dHBzOi8vd3d3Lm15LWFhYy5vcmcvIC0tPg==') . PHP_EOL;
echo '<!-- Generated in :: ' . round(microtime(true) - START_TIME, 4) . ' -->'; if(($config['debug_level'] & 1) == 1)
echo '<!-- Generated in :: ' . round(microtime(true) - START_TIME, 4) . ' -->';
if(($config['debug_level'] & 2) == 2)
echo "\n" . '<!-- Queries done :: ' . $db->queries() . ' -->'; if(($config['debug_level'] & 2) == 2)
echo "\n" . '<!-- Queries done :: ' . $db->queries() . ' -->';
if(($config['debug_level'] & 4) == 4 && function_exists('memory_get_peak_usage'))
echo "\n" . '<!-- Peak memory usage: ' . convert_bytes(memory_get_peak_usage(true)) . ' -->'; if(($config['debug_level'] & 4) == 4 && function_exists('memory_get_peak_usage'))
echo "\n" . '<!-- Peak memory usage: ' . convert_bytes(memory_get_peak_usage(true)) . ' -->';
$hooks->trigger(HOOK_FINISH);
?> $hooks->trigger(HOOK_FINISH);
?>

View File

@@ -1,12 +1,17 @@
<?php <?php
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
if(!isset($_SESSION['var_server_path'])) {
error($locale['step_database_error_config']);
$error = true;
}
$config['server_path'] = $_SESSION['var_server_path']; $config['server_path'] = $_SESSION['var_server_path'];
// take care of trailing slash at the end // take care of trailing slash at the end
if($config['server_path'][strlen($config['server_path']) - 1] != '/') if($config['server_path'][strlen($config['server_path']) - 1] != '/')
$config['server_path'] .= '/'; $config['server_path'] .= '/';
if(!file_exists($config['server_path'] . 'config.lua')) { if((!isset($error) || !$error) && !file_exists($config['server_path'] . 'config.lua')) {
error($locale['step_database_error_config']); error($locale['step_database_error_config']);
$error = true; $error = true;
} }

View File

@@ -78,4 +78,23 @@ function next_form($previous = true, $next = true)
<input type="hidden" name="step" id="step" value="' . $step . '" />' . next_buttons($previous, $next) . ' <input type="hidden" name="step" id="step" value="' . $step . '" />' . next_buttons($previous, $next) . '
</form>'; </form>';
} }
?>
function win_is_writable($path) {
if($path[strlen( $path ) - 1] == '/') { // if it looks like a directory, check a random file within the directory
return win_is_writable( $path . uniqid( mt_rand() ) . '.tmp');
} elseif(is_dir( $path )) { // If it's a directory (and not a file) check a random file within the directory
return win_is_writable( $path . '/' . uniqid( mt_rand() ) . '.tmp' );
}
// check tmp file for read/write capabilities
$should_delete_tmp_file = !file_exists( $path );
$f = @fopen( $path, 'a' );
if ( $f === false )
return false;
fclose( $f );
if($should_delete_tmp_file)
unlink($path);
return true;
}

View File

@@ -1,7 +1,7 @@
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 DEFAULT 0, `ip` INT(10) UNSIGNED NOT NULL DEFAULT 0,
`ipv6` BINARY(16) NOT NULL DEFAULT 0, `ipv6` BINARY(16) NOT NULL DEFAULT 0,
`date` INT(11) NOT NULL DEFAULT 0, `date` INT(11) NOT NULL DEFAULT 0,
`action` VARCHAR(255) NOT NULL DEFAULT '', `action` VARCHAR(255) NOT NULL DEFAULT '',
@@ -109,6 +109,7 @@ CREATE TABLE `myaac_forum`
`post_text` text NOT NULL, `post_text` text NOT NULL,
`post_topic` varchar(255) NOT NULL DEFAULT '', `post_topic` varchar(255) NOT NULL DEFAULT '',
`post_smile` tinyint(1) NOT NULL default '0', `post_smile` tinyint(1) NOT NULL default '0',
`post_html` tinyint(1) NOT NULL default '0',
`post_date` int(20) NOT NULL default '0', `post_date` int(20) NOT NULL default '0',
`last_edit_aid` int(20) NOT NULL default '0', `last_edit_aid` int(20) NOT NULL default '0',
`edit_date` int(20) NOT NULL default '0', `edit_date` int(20) NOT NULL default '0',
@@ -235,7 +236,7 @@ CREATE TABLE `myaac_monsters` (
`summonable` tinyint(1) NOT NULL, `summonable` tinyint(1) NOT NULL,
`convinceable` tinyint(1) NOT NULL, `convinceable` tinyint(1) NOT NULL,
`race` varchar(255) NOT NULL, `race` varchar(255) NOT NULL,
`loot` varchar(500) NOT NULL, `loot` text NOT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE = MyISAM; ) ENGINE = MyISAM;

View File

@@ -0,0 +1,11 @@
We have detected that you don't have access to write to the system/cache directory. Under linux you can fix it by using this two command, where first one should be enough (for apache):<br/><br/><span class="console">chown -R www-data.www-data /var/www/*</span><br/><span class="console">chmod -R 660 system/cache</span>
<style type="text/css">
.console {
font-family:Courier;
color: #CCCCCC;
background: #000000;
border: 3px double #CCCCCC;
padding: 0px;
}
</style>

View File

@@ -1,9 +1,6 @@
<?php <?php
require('../common.php'); require('../common.php');
// step
$step = isset($_POST['step']) ? $_POST['step'] : 'welcome';
// includes // includes
require(SYSTEM . 'functions.php'); require(SYSTEM . 'functions.php');
require(BASE . 'install/includes/functions.php'); require(BASE . 'install/includes/functions.php');
@@ -26,6 +23,9 @@ if(isset($_POST['vars']))
$_SESSION['var_' . $key] = $value; $_SESSION['var_' . $key] = $value;
} }
// step
$step = isset($_POST['step']) ? $_POST['step'] : 'welcome';
$steps = array(1 => 'welcome', 2 => 'license', 3 => 'requirements', 4 => 'config', 5 => 'database', 6 => 'admin', 7 => '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.');
@@ -56,17 +56,54 @@ if($step == 'database')
$step = 'config'; $step = 'config';
} }
} }
else if($step == 'finish') {
// password
$password = $_SESSION['var_password'];
if(isset($_SESSION['var_account'])) {
if(!Validator::accountName($_SESSION['var_account'])) {
$errors[] = $locale['step_admin_account_error_format'];
}
else if(strtoupper($_SESSION['var_account']) == strtoupper($password)) {
$errors[] = $locale['step_admin_account_error_same'];
}
}
else if(isset($_SESSION['var_account_id'])) {
if(!Validator::accountId($_SESSION['var_account_id'])) {
$errors[] = $locale['step_admin_account_id_error_format'];
}
else if($_SESSION['var_account_id'] == $password) {
$errors[] = $locale['step_admin_account_id_error_same'];
}
}
if(empty($password)) {
$errors[] = $locale['step_admin_password_error_empty'];
}
else if(!Validator::password($password)) {
$errors[] = $locale['step_admin_password_error_format'];
}
if(!empty($errors)) {
$step = 'admin';
}
}
$error = false; $error = false;
// step include clearstatcache();
ob_start(); if(is_writable(CACHE) && (MYAAC_OS != 'WINDOWS' || win_is_writable(CACHE))) {
require('steps/' . $step . '.php'); ob_start();
$content = ob_get_contents();
ob_end_clean(); $step_id = array_search($step, $steps);
require('steps/' . $step_id . '-' . $step . '.php');
$content = ob_get_contents();
ob_end_clean();
}
else {
$content = error(file_get_contents(BASE . 'install/includes/twig_error.html'), true);
}
// render // render
require('template/template.php'); require('template/template.php');
//$_SESSION['laststep'] = $step; //$_SESSION['laststep'] = $step;
?>

View File

@@ -22,11 +22,11 @@ function version_check($name, $ok, $info = '', $warning = false)
$failed = false; $failed = false;
// start validating // start validating
version_check($locale['step_requirements_php_version'], (PHP_VERSION_ID >= 50300), PHP_VERSION); version_check($locale['step_requirements_php_version'], (PHP_VERSION_ID >= 50303), PHP_VERSION);
foreach(array('config.local.php', 'images/guilds', 'images/houses', 'images/gallery') as $value) foreach(array('config.local.php', 'images/guilds', 'images/houses', 'images/gallery') as $value)
{ {
$perms = (int) substr(decoct(fileperms(BASE . $value)), 2); $is_writable = is_writable(BASE . $value);
version_check($locale['step_requirements_write_perms'] . ': ' . $value, $perms >= 660); version_check($locale['step_requirements_write_perms'] . ': ' . $value, $is_writable);
} }
$ini_register_globals = ini_get_bool('register_globals'); $ini_register_globals = ini_get_bool('register_globals');

View File

@@ -7,6 +7,7 @@ $clients_list = array(
750, 750,
760, 760,
770, 770,
772,
780, 780,
7920, 7920,
800, 800,

View File

@@ -11,7 +11,8 @@ if(!isset($_SESSION['var_server_path'])) {
} }
if(!$error) { if(!$error) {
$content = "<?php\n"; $content = "<?php";
$content .= PHP_EOL;
foreach($_SESSION as $key => $value) foreach($_SESSION as $key => $value)
{ {
if(strpos($key, 'var_') !== false) if(strpos($key, 'var_') !== false)
@@ -33,13 +34,13 @@ if(!$error) {
} }
} }
} }
require(BASE . 'install/includes/config.php'); require(BASE . 'install/includes/config.php');
if(!$error) { if(!$error) {
success($locale['step_database_importing']); success($locale['step_database_importing']);
require(BASE . 'install/includes/database.php'); require(BASE . 'install/includes/database.php');
if(!tableExist('accounts')) { if(!tableExist('accounts')) {
$locale['step_database_error_table'] = str_replace('$TABLE$', 'accounts', $locale['step_database_error_table']); $locale['step_database_error_table'] = str_replace('$TABLE$', 'accounts', $locale['step_database_error_table']);
error($locale['step_database_error_table']); error($locale['step_database_error_table']);
@@ -69,14 +70,14 @@ if(!$error) {
error($locale['step_database_error_schema'] . ' ' . $error_); error($locale['step_database_error_schema'] . ' ' . $error_);
$error = true; $error = true;
} }
if(!$error) { if(!$error) {
registerDatabaseConfig('database_version', DATABASE_VERSION); 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(!$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 '';"))
@@ -86,32 +87,32 @@ if(!$error) {
if(query("ALTER TABLE `accounts` ADD `key` VARCHAR(64) NOT NULL DEFAULT '' AFTER `email`;")) if(query("ALTER TABLE `accounts` ADD `key` VARCHAR(64) NOT NULL DEFAULT '' AFTER `email`;"))
success($locale['step_database_adding_field'] . ' accounts.key...'); success($locale['step_database_adding_field'] . ' accounts.key...');
} }
if(!fieldExist('blocked', 'accounts')) { if(!fieldExist('blocked', 'accounts')) {
if(query("ALTER TABLE `accounts` ADD `blocked` TINYINT(1) NOT NULL DEFAULT FALSE COMMENT 'internal usage' AFTER `key`;")) if(query("ALTER TABLE `accounts` ADD `blocked` TINYINT(1) NOT NULL DEFAULT FALSE COMMENT 'internal usage' AFTER `key`;"))
success($locale['step_database_adding_field'] . ' accounts.blocked...'); success($locale['step_database_adding_field'] . ' accounts.blocked...');
} }
if(!fieldExist('created', 'accounts')) { if(!fieldExist('created', 'accounts')) {
if(query("ALTER TABLE `accounts` ADD `created` INT(11) NOT NULL DEFAULT 0 AFTER `" . (fieldExist('group_id', 'accounts') ? 'group_id' : 'blocked') . "`;")) if(query("ALTER TABLE `accounts` ADD `created` INT(11) NOT NULL DEFAULT 0 AFTER `" . (fieldExist('group_id', 'accounts') ? 'group_id' : 'blocked') . "`;"))
success($locale['step_database_adding_field'] . ' accounts.created...'); success($locale['step_database_adding_field'] . ' accounts.created...');
} }
if(!fieldExist('rlname', 'accounts')) { if(!fieldExist('rlname', 'accounts')) {
if(query("ALTER TABLE `accounts` ADD `rlname` VARCHAR(255) NOT NULL DEFAULT '' AFTER `created`;")) if(query("ALTER TABLE `accounts` ADD `rlname` VARCHAR(255) NOT NULL DEFAULT '' AFTER `created`;"))
success($locale['step_database_adding_field'] . ' accounts.rlname...'); success($locale['step_database_adding_field'] . ' accounts.rlname...');
} }
if(!fieldExist('location', 'accounts')) { if(!fieldExist('location', 'accounts')) {
if(query("ALTER TABLE `accounts` ADD `location` VARCHAR(255) NOT NULL DEFAULT '' AFTER `rlname`;")) if(query("ALTER TABLE `accounts` ADD `location` VARCHAR(255) NOT NULL DEFAULT '' AFTER `rlname`;"))
success($locale['step_database_adding_field'] . ' accounts.location...'); success($locale['step_database_adding_field'] . ' accounts.location...');
} }
if(!fieldExist('country', 'accounts')) { if(!fieldExist('country', 'accounts')) {
if(query("ALTER TABLE `accounts` ADD `country` VARCHAR(3) NOT NULL DEFAULT '' AFTER `location`;")) if(query("ALTER TABLE `accounts` ADD `country` VARCHAR(3) NOT NULL DEFAULT '' AFTER `location`;"))
success($locale['step_database_adding_field'] . ' accounts.country...'); success($locale['step_database_adding_field'] . ' accounts.country...');
} }
if(fieldExist('page_lastday', 'accounts')) { if(fieldExist('page_lastday', 'accounts')) {
if(query("ALTER TABLE `accounts` CHANGE `page_lastday` `web_lastlogin` INT(11) NOT NULL DEFAULT 0;")) { if(query("ALTER TABLE `accounts` CHANGE `page_lastday` `web_lastlogin` INT(11) NOT NULL DEFAULT 0;")) {
$tmp = str_replace('$FIELD$', 'accounts.page_lastday', $locale['step_database_changing_field']); $tmp = str_replace('$FIELD$', 'accounts.page_lastday', $locale['step_database_changing_field']);
@@ -123,32 +124,32 @@ if(!$error) {
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.web_lastlogin...'); 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.web_flags...'); success($locale['step_database_adding_field'] . ' accounts.web_flags...');
} }
if(!fieldExist('email_hash', 'accounts')) { if(!fieldExist('email_hash', 'accounts')) {
if(query("ALTER TABLE `accounts` ADD `email_hash` VARCHAR(32) NOT NULL DEFAULT '' AFTER `web_flags`;")) if(query("ALTER TABLE `accounts` ADD `email_hash` VARCHAR(32) NOT NULL DEFAULT '' AFTER `web_flags`;"))
success($locale['step_database_adding_field'] . ' accounts.email_hash...'); success($locale['step_database_adding_field'] . ' accounts.email_hash...');
} }
if(!fieldExist('email_verified', 'accounts')) { if(!fieldExist('email_verified', 'accounts')) {
if(query("ALTER TABLE `accounts` ADD `email_verified` TINYINT(1) NOT NULL DEFAULT 0 AFTER `email_hash`;")) if(query("ALTER TABLE `accounts` ADD `email_verified` TINYINT(1) NOT NULL DEFAULT 0 AFTER `email_hash`;"))
success($locale['step_database_adding_field'] . ' accounts.email_verified...'); success($locale['step_database_adding_field'] . ' accounts.email_verified...');
} }
if(!fieldExist('email_new', 'accounts')) { if(!fieldExist('email_new', 'accounts')) {
if(query("ALTER TABLE `accounts` ADD `email_new` VARCHAR(255) NOT NULL DEFAULT '' AFTER `email_hash`;")) if(query("ALTER TABLE `accounts` ADD `email_new` VARCHAR(255) NOT NULL DEFAULT '' AFTER `email_hash`;"))
success($locale['step_database_adding_field'] . ' accounts.email_new...'); success($locale['step_database_adding_field'] . ' accounts.email_new...');
} }
if(!fieldExist('email_new_time', 'accounts')) { if(!fieldExist('email_new_time', 'accounts')) {
if(query("ALTER TABLE `accounts` ADD `email_new_time` INT(11) NOT NULL DEFAULT 0 AFTER `email_new`;")) if(query("ALTER TABLE `accounts` ADD `email_new_time` INT(11) NOT NULL DEFAULT 0 AFTER `email_new`;"))
success($locale['step_database_adding_field'] . ' accounts.email_new_time...'); success($locale['step_database_adding_field'] . ' accounts.email_new_time...');
} }
if(!fieldExist('email_code', 'accounts')) { if(!fieldExist('email_code', 'accounts')) {
if(query("ALTER TABLE `accounts` ADD `email_code` VARCHAR(255) NOT NULL DEFAULT '' AFTER `email_new_time`;")) if(query("ALTER TABLE `accounts` ADD `email_code` VARCHAR(255) NOT NULL DEFAULT '' AFTER `email_new_time`;"))
success($locale['step_database_adding_field'] . ' accounts.email_code...'); success($locale['step_database_adding_field'] . ' accounts.email_code...');
@@ -167,17 +168,22 @@ if(!$error) {
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...');
} }
if(!fieldExist('premium_points', 'accounts')) { if(!fieldExist('premium_points', 'accounts')) {
if(query("ALTER TABLE `accounts` ADD `premium_points` INT(11) NOT NULL DEFAULT 0 AFTER `email_next`;")) if(query("ALTER TABLE `accounts` ADD `premium_points` INT(11) NOT NULL DEFAULT 0 AFTER `email_next`;"))
success($locale['step_database_adding_field'] . ' accounts.premium_points...'); success($locale['step_database_adding_field'] . ' accounts.premium_points...');
} }
if(fieldExist('motd', 'guilds')) {
if(query("ALTER TABLE `guilds` MODIFY `motd` VARCHAR(255) NOT NULL DEFAULT '';"))
success($locale['step_database_modifying_field'] . ' guilds.motd...');
}
if(!fieldExist('description', 'guilds')) { if(!fieldExist('description', 'guilds')) {
if(query("ALTER TABLE `guilds` ADD `description` TEXT NOT NULL;")) if(query("ALTER TABLE `guilds` ADD `description` TEXT NOT NULL;"))
success($locale['step_database_adding_field'] . ' guilds.description...'); success($locale['step_database_adding_field'] . ' guilds.description...');
} }
if(fieldExist('logo_gfx_name', 'guilds')) { if(fieldExist('logo_gfx_name', 'guilds')) {
if(query("ALTER TABLE `guilds` CHANGE `logo_gfx_name` `logo_name` VARCHAR( 255 ) NOT NULL DEFAULT 'default.gif';")) { if(query("ALTER TABLE `guilds` CHANGE `logo_gfx_name` `logo_name` VARCHAR( 255 ) NOT NULL DEFAULT 'default.gif';")) {
$tmp = str_replace('$FIELD$', 'guilds.logo_gfx_name', $locale['step_database_changing_field']); $tmp = str_replace('$FIELD$', 'guilds.logo_gfx_name', $locale['step_database_changing_field']);
@@ -189,15 +195,15 @@ if(!$error) {
if(query("ALTER TABLE `guilds` ADD `logo_name` VARCHAR( 255 ) NOT NULL DEFAULT 'default.gif';")) if(query("ALTER TABLE `guilds` ADD `logo_name` VARCHAR( 255 ) NOT NULL DEFAULT 'default.gif';"))
success($locale['step_database_adding_field'] . ' guilds.logo_name...'); success($locale['step_database_adding_field'] . ' guilds.logo_name...');
} }
if(!fieldExist('created', 'players')) { if(!fieldExist('created', 'players')) {
if(query("ALTER TABLE `players` ADD `created` INT(11) NOT NULL DEFAULT 0;")) if(query("ALTER TABLE `players` ADD `created` INT(11) NOT NULL DEFAULT 0;"))
success($locale['step_database_adding_field'] . ' players.created...'); success($locale['step_database_adding_field'] . ' players.created...');
} }
if(!fieldExist('deleted', 'players') && !fieldExist('deletion', 'players')) { if(!fieldExist('deleted', 'players') && !fieldExist('deletion', 'players')) {
if(query("ALTER TABLE `players` ADD `deleted` TINYINT(1) NOT NULL DEFAULT 0;")) if(query("ALTER TABLE `players` ADD `deleted` TINYINT(1) NOT NULL DEFAULT 0;"))
success($locale['step_database_adding_field'] . ' players.comment...'); success($locale['step_database_adding_field'] . ' players.deleted...');
} }
if(fieldExist('hide_char', 'players')) { if(fieldExist('hide_char', 'players')) {
@@ -213,13 +219,24 @@ if(!$error) {
if(query("ALTER TABLE `players` ADD `hidden` 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...');
} }
if(!fieldExist('comment', 'players')) { if(!fieldExist('comment', 'players')) {
if(query("ALTER TABLE `players` ADD `comment` TEXT NOT NULL;")) if(query("ALTER TABLE `players` ADD `comment` TEXT NOT NULL;"))
success($locale['step_database_adding_field'] . ' players.comment...'); success($locale['step_database_adding_field'] . ' players.comment...');
} }
if(fieldExist('rank_id', 'players')) {
if(query("ALTER TABLE players MODIFY `rank_id` INT(11) NOT NULL DEFAULT 0;"))
success($locale['step_database_modifying_field'] . ' players.rank_id...');
if(fieldExist('guildnick', 'players')) {
if(query("ALTER TABLE players MODIFY `guildnick` VARCHAR(255) NOT NULL DEFAULT '';")) {
success($locale['step_database_modifying_field'] . ' players.guildnick...');
}
}
}
} }
if(!$error && (!isset($_SESSION['saved']))) { if(!$error && (!isset($_SESSION['saved']))) {
$content .= '$config[\'installed\'] = true;'; $content .= '$config[\'installed\'] = true;';
$content .= PHP_EOL; $content .= PHP_EOL;
@@ -234,15 +251,16 @@ if(!$error) {
error($locale['step_config_mail_address_error']); error($locale['step_config_mail_address_error']);
$error = true; $error = true;
} }
$content .= '$config[\'client_download\'] = \'http://tibia-clients.com/clients/download/\'. $config[\'client\'] . \'/exe/windows\';'; $content .= '$config[\'client_download\'] = \'http://tibia-clients.com/clients/download/\'. $config[\'client\'] . \'/exe/windows\';';
$content .= PHP_EOL; $content .= PHP_EOL;
$content .= '$config[\'client_download_linux\'] = \'http://tibia-clients.com/clients/download/\'. $config[\'client\'] . \'/tar/linux\';'; $content .= '$config[\'client_download_linux\'] = \'http://tibia-clients.com/clients/download/\'. $config[\'client\'] . \'/tar/linux\';';
$content .= PHP_EOL; $content .= PHP_EOL;
$content .= '// place for your configuration directives, so you can later easily update myaac'; $content .= '$config[\'session_prefix\'] = \'myaac_' . generateRandomString(8, true, false, true, false) . '_\';';
$content .= PHP_EOL; $content .= PHP_EOL;
$content .= "?>"; $content .= '$config[\'cache_prefix\'] = \'myaac_' . generateRandomString(8, true, false, true, false) . '_\';';
$content .= PHP_EOL;
$file = fopen(BASE . 'config.local.php', 'a+'); $file = fopen(BASE . 'config.local.php', 'a+');
if($file) { if($file) {
if(!$error) { if(!$error) {

View File

@@ -8,6 +8,7 @@ if(!$error) {
echo $twig->render('install.admin.html.twig', array( echo $twig->render('install.admin.html.twig', array(
'locale' => $locale, 'locale' => $locale,
'session' => $_SESSION, 'session' => $_SESSION,
'errors' => isset($errors) ? $errors : null,
'buttons' => next_buttons(true, $error ? false : true) 'buttons' => next_buttons(true, $error ? false : true)
)); ));
} }

View File

@@ -1,6 +1,7 @@
<?php <?php
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
ini_set('max_execution_time', 300);
if(isset($config['installed']) && $config['installed'] && !isset($_SESSION['saved'])) { if(isset($config['installed']) && $config['installed'] && !isset($_SESSION['saved'])) {
warning($locale['already_installed']); warning($locale['already_installed']);
} }
@@ -20,27 +21,7 @@ else {
$salt = generateRandomString(10, false, true, true); $salt = generateRandomString(10, false, true, true);
$password = $salt . $password; $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(); $account_db = new OTS_Account();
if(isset($account)) if(isset($account))
$account_db->find($account); $account_db->find($account);
@@ -55,34 +36,29 @@ else {
$player = new OTS_Player(); $player = new OTS_Player();
$player->setName('Admin'); $player->setName('Admin');
$player->setGroupId($groups->getHighestId()); $player_used = &$player;
} }
else {
$player_used = &$player_db;
}
$player_used->setGroupId($groups->getHighestId());
if($account_db->isLoaded()) { if($account_db->isLoaded()) {
$account_db->setPassword(encrypt($password)); $account_db->setPassword(encrypt($password));
$account_db->setEMail($_SESSION['var_mail_admin']); $account_db->setEMail($_SESSION['var_mail_admin']);
$account_db->save(); $account_db->save();
if($config_salt_enabled) $account_used = &$account_db;
$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());
setSession('account', $account_db->getId());
} }
else { else {
$new_account = new OTS_Account(); $new_account = new OTS_Account();
$new_account->create($account); if(USE_ACCOUNT_NAME) {
$new_account->create($account);
}
else {
$new_account->create(null, $account_id);
}
$new_account->setPassword(encrypt($password)); $new_account->setPassword(encrypt($password));
$new_account->setEMail($_SESSION['var_mail_admin']); $new_account->setEMail($_SESSION['var_mail_admin']);
@@ -90,28 +66,30 @@ else {
$new_account->unblock(); $new_account->unblock();
$new_account->save(); $new_account->save();
if($config_salt_enabled)
$new_account->setCustomField('salt', $salt);
$new_account->setCustomField('created', time()); $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.'); $new_account->logAction('Account created.');
if(!$player_db->isLoaded()) $account_used = &$new_account;
$player->setAccountId($new_account->getId());
else
$player_db->setAccountId($new_account->getId());
setSession('account', $new_account->getId());
} }
if($config_salt_enabled)
$account_used->setCustomField('salt', $salt);
$account_used->setCustomField('web_flags', FLAG_ADMIN + FLAG_SUPER_ADMIN);
$account_used->setCustomField('country', 'us');
if(fieldExist('group_id', 'accounts'))
$account_used->setCustomField('group_id', $groups->getHighestId());
if(fieldExist('type', 'accounts'))
$account_used->setCustomField('type', 5);
if(!$player_db->isLoaded())
$player->setAccountId($account_used->getId());
else
$player_db->setAccountId($account_used->getId());
success($locale['step_database_created_account']); success($locale['step_database_created_account']);
setSession('account', $account_used->getId());
setSession('password', encrypt($password)); setSession('password', encrypt($password));
setSession('remember_me', true); setSession('remember_me', true);
@@ -129,9 +107,12 @@ else {
$player_id = $query['id']; $player_id = $query['id'];
} }
if(query("INSERT INTO `myaac_news` (`id`, `type`, `date`, `category`, `title`, `body`, `player_id`, `comments`, `hidden`) VALUES (NULL, '1', UNIX_TIMESTAMP(), '2', 'Hello!', 'MyAAC is just READY to use!', " . $player_id . ", 'http://my-aac.org', '0'); $query = $db->query("SELECT `id` FROM `" . TABLE_PREFIX ."news` WHERE `title` LIKE 'Hello!';");
INSERT INTO `myaac_news` (`id`, `type`, `date`, `category`, `title`, `body`, `player_id`, `comments`, `hidden`) VALUES (NULL, '2', UNIX_TIMESTAMP(), '4', 'Hello tickets!', 'http://my-aac.org', " . $player_id . ", '', '0');")) { if($query->rowCount() == 0) {
success($locale['step_database_created_news']); if(query("INSERT INTO `" . TABLE_PREFIX ."news` (`id`, `type`, `date`, `category`, `title`, `body`, `player_id`, `comments`, `hidden`) VALUES (NULL, '1', UNIX_TIMESTAMP(), '2', 'Hello!', 'MyAAC is just READY to use!', " . $player_id . ", 'http://my-aac.org', '0');
INSERT INTO `myaac_news` (`id`, `type`, `date`, `category`, `title`, `body`, `player_id`, `comments`, `hidden`) VALUES (NULL, '2', UNIX_TIMESTAMP(), '4', 'Hello tickets!', 'http://my-aac.org', " . $player_id . ", '', '0');")) {
success($locale['step_database_created_news']);
}
} }
$deleted = 'deleted'; $deleted = 'deleted';
@@ -143,31 +124,31 @@ INSERT INTO `myaac_news` (`id`, `type`, `date`, `category`, `title`, `body`, `pl
$query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote('Rook Sample')); $query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote('Rook Sample'));
if($query->rowCount() == 0) { if($query->rowCount() == 0) {
if(!query($insert_into_players . "(null, 'Rook Sample', 4, " . getSession('account') . ", 1, 0, 150, 150, 4200, 118, 114, 38, 57, 130, 0, 0, 0, 0, 100, 11, 2200, 1298, 7, '', 400, 1, 1255179613, 2453925456, 1, 1255179614, 0, 0, UNIX_TIMESTAMP(), 1, '');")) if(!query($insert_into_players . "(null, 'Rook Sample', 1, " . getSession('account') . ", 1, 0, 150, 150, 4200, 118, 114, 38, 57, 130, 0, 0, 0, 0, 100, 1, 1000, 1000, 7, '', 400, 1, 1255179613, 2453925456, 1, 1255179614, 0, 0, UNIX_TIMESTAMP(), 1, '');"))
$success = false; $success = false;
} }
$query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote('Sorcerer Sample')); $query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote('Sorcerer Sample'));
if($query->rowCount() == 0) { if($query->rowCount() == 0) {
if(!query($insert_into_players . "(null, 'Sorcerer Sample', 4, " . getSession('account') . ", 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, 0, UNIX_TIMESTAMP(), 1, '');")) if(!query($insert_into_players . "(null, 'Sorcerer Sample', 1, " . getSession('account') . ", 8, 1, 185, 185, 4200, 118, 114, 38, 57, 130, 0, 35, 35, 0, 100, 1, 1000, 1000, 7, '', 470, 1, 1255179571, 2453925456, 1, 1255179612, 0, 0, UNIX_TIMESTAMP(), 1, '');"))
$success = false; $success = false;
} }
$query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote('Druid Sample')); $query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote('Druid Sample'));
if($query->rowCount() == 0) { if($query->rowCount() == 0) {
if(!query($insert_into_players . "(null, 'Druid Sample', 4, " . getSession('account') . ", 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, 0, UNIX_TIMESTAMP(), 1, '');")) if(!query($insert_into_players . "(null, 'Druid Sample', 1, " . getSession('account') . ", 8, 2, 185, 185, 4200, 118, 114, 38, 57, 130, 0, 35, 35, 0, 100, 1, 1000, 1000, 7, '', 470, 1, 1255179655, 2453925456, 1, 1255179658, 0, 0, UNIX_TIMESTAMP(), 1, '');"))
$success = false; $success = false;
} }
$query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote('Paladin Sample')); $query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote('Paladin Sample'));
if($query->rowCount() == 0) { if($query->rowCount() == 0) {
if(!query($insert_into_players . "(null, 'Paladin Sample', 4, " . getSession('account') . ", 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, 0, UNIX_TIMESTAMP(), 1, '');")) if(!query($insert_into_players . "(null, 'Paladin Sample', 1, " . getSession('account') . ", 8, 3, 185, 185, 4200, 118, 114, 38, 57, 129, 0, 35, 35, 0, 100, 1, 1000, 1000, 7, '', 470, 1, 1255179854, 2453925456, 1, 1255179858, 0, 0, UNIX_TIMESTAMP(), 1, '');"))
$success = false; $success = false;
} }
$query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote('Knight Sample')); $query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote('Knight Sample'));
if($query->rowCount() == 0) { if($query->rowCount() == 0) {
if(!query($insert_into_players . "(null, 'Knight Sample', 4, " . getSession('account') . ", 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, 0, UNIX_TIMESTAMP(), 1, '');")) if(!query($insert_into_players . "(null, 'Knight Sample', 1, " . getSession('account') . ", 8, 4, 185, 185, 4200, 118, 114, 38, 57, 131, 0, 35, 35, 0, 100, 1, 1000, 1000, 7, '', 470, 1, 1255179620, 2453925456, 1, 1255179654, 0, 0, UNIX_TIMESTAMP(), 1, '');"))
$success = false; $success = false;
} }
@@ -196,6 +177,19 @@ INSERT INTO `myaac_news` (`id`, `type`, `date`, `category`, `title`, `body`, `pl
error(Spells::getLastError()); error(Spells::getLastError());
} }
// update config.highscores_ids_hidden
$database_migration_20 = true;
require_once(SYSTEM . 'migrations/20.php');
$content = '';
if(!databaseMigration20($content)) {
$locale['step_database_error_file'] = str_replace('$FILE$', '<b>' . BASE . 'config.local.php</b>', $locale['step_database_error_file']);
warning($locale['step_database_error_file'] . '<br/>
<textarea cols="70" rows="10">' . $content . '</textarea>');
}
// add z_polls tables
require_once(SYSTEM . 'migrations/22.php');
$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']);

View File

@@ -1,5 +1,6 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="<?php echo $locale['direction']; ?>" lang="<?php echo $locale['lang']; ?>" xml:lang="<?php echo $locale['lang']; ?>"> <html xmlns="http://www.w3.org/1999/xhtml" dir="<?php echo $locale['direction']; ?>" lang="<?php echo $locale['lang']; ?>" xml:lang="<?php echo $locale['lang']; ?>">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $locale['encoding']; ?>" /> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $locale['encoding']; ?>" />
<title>MyAAC - <?php echo $locale['installation']; ?></title> <title>MyAAC - <?php echo $locale['installation']; ?></title>
<link rel="stylesheet" type="text/css" href="template/style.css" /> <link rel="stylesheet" type="text/css" href="template/style.css" />
@@ -8,7 +9,7 @@
<div id="wrapper"> <div id="wrapper">
<!--div class="buffer"--> <!--div class="buffer"-->
<div id="header"> <div id="header">
<h1>MyAAC v<?php echo MYAAC_VERSION . ' ' . $locale['installation']; ?></h1> <h1>MyAAC <?php echo $locale['installation']; ?></h1>
</div> </div>
<div id="body"> <div id="body">

25
nginx-sample.conf Normal file
View File

@@ -0,0 +1,25 @@
server {
listen 80;
root /home/otserv/www/public;
index index.php;
server_name your-domain.com;
location / {
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_read_timeout 240;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}
location ~ /\.ht {
deny all;
}
location /system {
deny all;
return 404;
}
}

2
robots.txt Normal file
View File

@@ -0,0 +1,2 @@
User-agent: *
Disallow:

View File

@@ -95,7 +95,7 @@ defined('MYAAC') or die('Direct access not allowed!');
'<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>' . $error); '</ul>' . $error->getMessage());
} }
$db = POT::getInstance()->getDBHandle(); $db = POT::getInstance()->getDBHandle();

View File

@@ -156,6 +156,10 @@ function getFlagImage($country)
if(!isset($config['countries'])) if(!isset($config['countries']))
require(SYSTEM . 'countries.conf.php'); require(SYSTEM . 'countries.conf.php');
if(!isset($config['countries'][$country])) {
return '';
}
return '<img src="images/flags/' . $country . '.gif" title="' . $config['countries'][$country]. '"/>'; return '<img src="images/flags/' . $country . '.gif" title="' . $config['countries'][$country]. '"/>';
} }
@@ -167,7 +171,9 @@ function getFlagImage($country)
*/ */
function getBoolean($v) function getBoolean($v)
{ {
if(!$v || !isset($v[0])) return false; if(is_bool($v)) {
return $v;
}
if(is_numeric($v)) if(is_numeric($v))
return intval($v) > 0; return intval($v) > 0;
@@ -467,7 +473,7 @@ function template_header($is_admin = false)
$ret .= ' $ret .= '
<meta name="description" content="' . $config['meta_description'] . '" /> <meta name="description" content="' . $config['meta_description'] . '" />
<meta name="keywords" content="' . $config['meta_keywords'] . ', myaac, wodzaac" /> <meta name="keywords" content="' . $config['meta_keywords'] . ', myaac, wodzaac" />
<meta name="generator" content="MyAAC ' . MYAAC_VERSION . '" /> <meta name="generator" content="MyAAC" />
<link rel="stylesheet" type="text/css" href="' . BASE_URL . 'tools/messages.css" /> <link rel="stylesheet" type="text/css" href="' . BASE_URL . 'tools/messages.css" />
<script type="text/javascript" src="' . BASE_URL . 'tools/jquery.js"></script> <script type="text/javascript" src="' . BASE_URL . 'tools/jquery.js"></script>
<noscript> <noscript>
@@ -573,7 +579,7 @@ function getCreatureName($killer, $showStatus = false, $extendedInfo = false)
$str .= '<font color="'.($player->isOnline() ? 'green' : 'red').'">' . $player->getName() . '</font></b></a>'; $str .= '<font color="'.($player->isOnline() ? 'green' : 'red').'">' . $player->getName() . '</font></b></a>';
if($extendedInfo) { if($extendedInfo) {
$str .= '<br><small>'.$player->getLevel().' '.$config['vocations'][$player->getVocation()].'</small>'; $str .= '<br><small>'.$player->getLevel().' '.$player->getVocationName().'</small>';
} }
return $str; return $str;
} }
@@ -804,11 +810,16 @@ function getWorldName($id)
*/ */
function _mail($to, $subject, $body, $altBody = '', $add_html_tags = true) function _mail($to, $subject, $body, $altBody = '', $add_html_tags = true)
{ {
/** @var PHPMailer $mailer */
global $mailer, $config; global $mailer, $config;
if(!$mailer) if(!$mailer)
{ {
require(SYSTEM . 'libs/phpmailer/PHPMailerAutoload.php'); require(SYSTEM . 'libs/phpmailer/PHPMailerAutoload.php');
$mailer = new PHPMailer(); $mailer = new PHPMailer();
$mailer->setLanguage('en', LIBS . 'phpmailer/language/');
}
else {
$mailer->clearAllRecipients();
} }
$signature_html = ''; $signature_html = '';
@@ -828,6 +839,7 @@ function _mail($to, $subject, $body, $altBody = '', $add_html_tags = true)
$mailer->SMTPAuth = $config['smtp_auth']; $mailer->SMTPAuth = $config['smtp_auth'];
$mailer->Username = $config['smtp_user']; $mailer->Username = $config['smtp_user'];
$mailer->Password = $config['smtp_pass']; $mailer->Password = $config['smtp_pass'];
$mailer->SMTPSecure = isset($config['smtp_secure']) ? $config['smtp_secure'] : '';
} }
else else
$mailer->IsMail(); $mailer->IsMail();
@@ -883,6 +895,13 @@ function load_config_lua($filename)
if(count($lines) > 0) if(count($lines) > 0)
foreach($lines as $ln => $line) foreach($lines as $ln => $line)
{ {
$line = trim($line);
if(@$line[0] === '{' || @$line[0] === '}') {
// arrays are not supported yet
// just ignore the error
continue;
}
$tmp_exp = explode('=', $line, 2); $tmp_exp = explode('=', $line, 2);
if(strpos($line, 'dofile') !== false) if(strpos($line, 'dofile') !== false)
{ {
@@ -909,6 +928,12 @@ function load_config_lua($filename)
$result[$key] = (string) substr(substr($value, 1), 0, -1); $result[$key] = (string) substr(substr($value, 1), 0, -1);
elseif(in_array($value, array('true', 'false'))) elseif(in_array($value, array('true', 'false')))
$result[$key] = ($value == 'true') ? true : false; $result[$key] = ($value == 'true') ? true : false;
//elseif(substr($value, 0 , 1) == '{' && substr($value, -1 , 1) == '}') {
elseif(@$value[0] === '{') {
// arrays are not supported yet
// just ignore the error
continue;
}
else else
{ {
foreach($result as $tmp_key => $tmp_value) // load values definied by other keys, like: dailyFragsToBlackSkull = dailyFragsToRedSkull foreach($result as $tmp_key => $tmp_value) // load values definied by other keys, like: dailyFragsToBlackSkull = dailyFragsToRedSkull
@@ -970,9 +995,17 @@ function getTopPlayers($limit = 5) {
$deleted = 'deleted'; $deleted = 'deleted';
if(fieldExist('deletion', 'players')) if(fieldExist('deletion', 'players'))
$deleted = 'deletion'; $deleted = 'deletion';
$players = $db->query('SELECT `name`, `level`, `experience` FROM `players` WHERE `group_id` < ' . $config['highscores_groups_hidden'] . ' AND `' . $deleted . '` = 0 AND account_id != 1 ORDER BY `experience` DESC LIMIT 5')->fetchAll(); $is_tfs10 = tableExist('players_online');
$players = $db->query('SELECT `id`, `name`, `level`, `experience`' . ($is_tfs10 ? '' : ', `online`') . ' FROM `players` WHERE `group_id` < ' . $config['highscores_groups_hidden'] . ' AND `id` NOT IN (' . implode(', ', $config['highscores_ids_hidden']) . ') AND `' . $deleted . '` = 0 AND `account_id` != 1 ORDER BY `experience` DESC LIMIT ' . (int)$limit)->fetchAll();
if($is_tfs10) {
foreach($players as &$player) {
$query = $db->query('SELECT `player_id` FROM `players_online` WHERE `player_id` = ' . $player['id']);
$player['online'] = ($query->rowCount() > 0 ? 1 : 0);
}
}
$i = 0; $i = 0;
foreach($players as &$player) { foreach($players as &$player) {
$player['rank'] = ++$i; $player['rank'] = ++$i;

View File

@@ -42,12 +42,12 @@ class Hook
$ret = $tmp($params); $ret = $tmp($params);
}*/ }*/
global $db, $config, $template_path, $ots, $content; global $db, $config, $template_path, $ots, $content, $twig;
if(file_exists(BASE . $this->_file)) { if(file_exists(BASE . $this->_file)) {
require(BASE . $this->_file); $ret = require(BASE . $this->_file);
} }
return true; return $ret === null || $ret == 1 || $ret;
} }
public function name() {return $this->_name;} public function name() {return $this->_name;}
@@ -71,11 +71,17 @@ class Hooks
if(isset(self::$_hooks[$type])) if(isset(self::$_hooks[$type]))
{ {
foreach(self::$_hooks[$type] as $name => $hook) foreach(self::$_hooks[$type] as $name => $hook)
$ret = $hook->execute($params); if(!$hook->execute($params)) {
$ret = false;
}
} }
return $ret; return $ret;
} }
public function exist($type) {
return isset(self::$_hooks[$type]);
}
public function load() public function load()
{ {

View File

@@ -8,14 +8,14 @@
* @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!');
// load configuration // load configuration
require_once(BASE . 'config.php'); require_once(BASE . 'config.php');
if(file_exists(BASE . 'config.local.php')) // user customizations if(file_exists(BASE . 'config.local.php')) // user customizations
require(BASE . 'config.local.php'); require(BASE . 'config.local.php');
if(!isset($config['installed']) || !$config['installed']) { if(!isset($config['installed']) || !$config['installed']) {
header('Location: ' . BASE_URL); die('MyAAC has not been installed yet or there was error during installation. Please install again.');
die('AAC has not been installed yet or there was error during installation. Please install again.');
} }
date_default_timezone_set($config['date_timezone']); date_default_timezone_set($config['date_timezone']);
@@ -87,21 +87,26 @@ if(isset($_REQUEST))
} }
// load otserv config file // load otserv config file
$tmp = ''; $config_lua_reload = true;
if($cache->enabled() && $cache->fetch('config_lua', $tmp)) { if($cache->enabled()) {
$config['lua'] = unserialize($tmp); $tmp = null;
/*if(isset($config['lua']['myaac'][0])) { if($cache->fetch('server_path', $tmp) && $tmp == $config['server_path']) {
foreach($config['lua']['myaac'] as $key => $value) $tmp = null;
$config[$key] = $value; if($cache->fetch('config_lua', $tmp) && $tmp) {
}*/ $config['lua'] = unserialize($tmp);
$config_lua_reload = false;
}
}
} }
else
{ if($config_lua_reload) {
$config['lua'] = load_config_lua($config['server_path'] . 'config.lua'); $config['lua'] = load_config_lua($config['server_path'] . 'config.lua');
// cache config // cache config
if($cache->enabled()) if($cache->enabled()) {
$cache->set('config_lua', serialize($config['lua']), 120); $cache->set('config_lua', serialize($config['lua']), 120);
$cache->set('server_path', $config['server_path']);
}
} }
unset($tmp); unset($tmp);
@@ -148,6 +153,11 @@ else
$config['data_path'] = $tmp; $config['data_path'] = $tmp;
unset($tmp); unset($tmp);
// new config values for compability
if(!isset($config['highscores_ids_hidden']) || count($config['highscores_ids_hidden']) == 0) {
$config['highscores_ids_hidden'] = array(0);
}
// POT // POT
require_once(SYSTEM . 'libs/pot/OTS.php'); require_once(SYSTEM . 'libs/pot/OTS.php');
$ots = POT::getInstance(); $ots = POT::getInstance();

View File

@@ -31,7 +31,7 @@ class Cache_APC
public function get($key) public function get($key)
{ {
$tmp = ''; $tmp = '';
if($this->fetch($key, $tmp)) if($this->fetch($this->prefix . $key, $tmp))
return $tmp; return $tmp;
return ''; return '';
@@ -42,7 +42,7 @@ class Cache_APC
} }
public function delete($key) { public function delete($key) {
apc_delete($key); apc_delete($this->prefix . $key);
} }
public function enabled() { public function enabled() {

View File

@@ -30,7 +30,7 @@ class Cache_eAccelerator
public function get($key) public function get($key)
{ {
$tmp = ''; $tmp = '';
if($this->fetch($key, $tmp)) if($this->fetch($this->prefix . $key, $tmp))
return $tmp; return $tmp;
return ''; return '';
@@ -41,7 +41,7 @@ class Cache_eAccelerator
} }
public function delete($key) { public function delete($key) {
eaccelerator_rm($key); eaccelerator_rm($this->prefix . $key);
} }
public function enabled() { public function enabled() {

View File

@@ -30,7 +30,7 @@ class Cache_XCache
public function get($key) public function get($key)
{ {
$tmp = ''; $tmp = '';
if($this->fetch($key, $tmp)) if($this->fetch($this->prefix . $key, $tmp))
return $tmp; return $tmp;
return ''; return '';
@@ -47,7 +47,7 @@ class Cache_XCache
} }
public function delete($key) { public function delete($key) {
xcache_unset($key); xcache_unset($this->prefix . $key);
} }
public function enabled() { public function enabled() {

View File

@@ -37,7 +37,20 @@ class Forum
{ {
global $db; global $db;
$thread_id = 0; $thread_id = 0;
if($db->insert(TABLE_PREFIX . 'forum', array('first_post' => 0, 'last_post' => time(), 'section' => $section_id, 'replies' => 0, 'views' => 0, 'author_aid' => isset($account_id) ? $account_id : 0, 'author_guid' => isset($player_id) ? $player_id : 0, 'post_text' => $body, 'post_topic' => $title, 'post_smile' => 0, 'post_date' => time(), 'last_edit_aid' => 0, 'edit_date' => 0, 'post_ip' => $_SERVER['REMOTE_ADDR']))) { if($db->insert(TABLE_PREFIX . 'forum', array(
'first_post' => 0,
'last_post' => time(),
'section' => $section_id,
'replies' => 0,
'views' => 0,
'author_aid' => isset($account_id) ? $account_id : 0,
'author_guid' => isset($player_id) ? $player_id : 0,
'post_text' => $body, 'post_topic' => $title,
'post_smile' => 0, 'post_html' => 1,
'post_date' => time(),
'last_edit_aid' => 0, 'edit_date' => 0,
'post_ip' => $_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);
} }
@@ -45,7 +58,7 @@ class Forum
return $thread_id; return $thread_id;
} }
static public function add_post($thread_id, $section, $author_aid, $author_guid, $post_text, $post_topic, $smile) static public function add_post($thread_id, $section, $author_aid, $author_guid, $post_text, $post_topic, $smile, $html)
{ {
global $db; global $db;
$db->insert(TABLE_PREFIX . 'forum', array( $db->insert(TABLE_PREFIX . 'forum', array(
@@ -56,6 +69,7 @@ class Forum
'post_text' => $post_text, 'post_text' => $post_text,
'post_topic' => $post_topic, 'post_topic' => $post_topic,
'post_smile' => $smile, 'post_smile' => $smile,
'post_html' => $html,
'post_date' => time(), 'post_date' => time(),
'post_ip' => $_SERVER['REMOTE_ADDR'] 'post_ip' => $_SERVER['REMOTE_ADDR']
)); ));
@@ -232,16 +246,20 @@ class Forum
foreach($tags as $search => $replace) foreach($tags as $search => $replace)
$text = preg_replace($search, $replace, $text); $text = preg_replace($search, $replace, $text);
return ($smiles == 0 ? Forum::parseSmiles($text) : $text); return ($smiles ? Forum::parseSmiles($text) : $text);
} }
public static function showPost($topic, $text, $smiles) public static function showPost($topic, $text, $smiles = true, $html = false)
{ {
$text = nl2br($text); if($html) {
return '<b>' . $topic . '</b><hr />' . $text;
}
$post = ''; $post = '';
if(!empty($topic)) if(!empty($topic))
$post .= '<b>'.($smiles == 0 ? self::parseSmiles($topic) : $topic).'</b><hr />'; $post .= '<b>'.($smiles ? self::parseSmiles($topic) : $topic).'</b><hr />';
$post .= self::parseBBCode($text, $smiles);
$post .= self::parseBBCode(nl2br($text), $smiles);
return $post; return $post;
} }

View File

@@ -30,20 +30,4 @@ function PHPMailerAutoload($classname)
} }
} }
if (version_compare(PHP_VERSION, '5.1.2', '>=')) {
//SPL autoloading was introduced in PHP 5.1.2
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
spl_autoload_register('PHPMailerAutoload', true, true); spl_autoload_register('PHPMailerAutoload', true, true);
} else {
spl_autoload_register('PHPMailerAutoload');
}
} else {
/**
* Fall back to traditional autoload for old PHP versions
* @param string $classname The name of the class to load
*/
function __autoload($classname)
{
PHPMailerAutoload($classname);
}
}

View File

@@ -10,6 +10,34 @@
*/ */
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
function is_sub_dir($path = NULL, $parent_folder = SITE_PATH) {
//Get directory path minus last folder
$dir = dirname($path);
$folder = substr($path, strlen($dir));
//Check the the base dir is valid
$dir = realpath($dir);
//Only allow valid filename characters
$folder = preg_replace('/[^a-z0-9\.\-_]/i', '', $folder);
//If this is a bad path or a bad end folder name
if( !$dir OR !$folder OR $folder === '.') {
return FALSE;
}
//Rebuild path
$path = $dir. '/' . $folder;
//If this path is higher than the parent folder
if( strcasecmp($path, $parent_folder) > 0 ) {
return $path;
}
return FALSE;
}
class Plugins { class Plugins {
private static $warnings = array(); private static $warnings = array();
private static $error = null; private static $error = null;
@@ -160,16 +188,33 @@ class Plugins {
else { else {
$success = true; $success = true;
foreach($plugin_info['uninstall'] as $file) { foreach($plugin_info['uninstall'] as $file) {
$file = BASE . $file; if(strpos($file, '/') === 0) {
if(!deleteDirectory($file)) {
$success = false; $success = false;
self::$error = "You cannot use absolute paths (starting with slash - '/'): " . $file;
break;
}
$file = str_replace('\\', '/', BASE . $file);
$realpath = str_replace('\\', '/', realpath(dirname($file)));
if(!is_sub_dir($file, BASE) || $realpath != dirname($file)) {
$success = false;
self::$error = "You don't have rights to delete: " . $file;
break;
} }
} }
if($success) {
foreach($plugin_info['uninstall'] as $file) {
if(!deleteDirectory(BASE . $file)) {
self::$warnings[] = 'Cannot delete: ' . $$file;
}
}
}
if (isset($plugin_info['hooks'])) { if (isset($plugin_info['hooks'])) {
foreach ($plugin_info['hooks'] as $_name => $info) { foreach ($plugin_info['hooks'] as $_name => $info) {
if (defined('HOOK_'. $info['type'])) { if (defined('HOOK_'. $info['type'])) {
$hook = constant('HOOK_'. $info['type']); //$hook = constant('HOOK_'. $info['type']);
$query = $db->query('SELECT `id` FROM `' . TABLE_PREFIX . 'hooks` WHERE `name` = ' . $db->quote($_name) . ';'); $query = $db->query('SELECT `id` FROM `' . TABLE_PREFIX . 'hooks` WHERE `name` = ' . $db->quote($_name) . ';');
if ($query->rowCount() == 1) { // found something if ($query->rowCount() == 1) { // found something
$query = $query->fetch(); $query = $query->fetch();
@@ -187,9 +232,6 @@ class Plugins {
return true; return true;
} }
else {
self::$error = error_get_last();
}
} }
} }
} }

View File

@@ -39,7 +39,7 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
* @var array * @var array
* @version 0.1.5 * @version 0.1.5
*/ */
private $data = array('email' => '', 'blocked' => false, 'rlname' => '','location' => '','web_flags' => 0,'lastday' => 0,'premdays' => 0, 'created' => 0); private $data = array('email' => '', 'blocked' => false, 'rlname' => '','location' => '','web_flags' => 0, 'lastday' => 0, 'premdays' => 0, 'created' => 0);
/** /**
* Creates new account. * Creates new account.
@@ -170,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 `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(); $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') . ',' : '')) . $this->db->fieldName('created') . ' FROM ' . $this->db->tableName('accounts') . ' WHERE ' . $this->db->fieldName('id') . ' = ' . (int) $id)->fetch();
} }
/** /**
@@ -249,12 +249,16 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
throw new E_OTS_NotLoaded(); throw new E_OTS_NotLoaded();
} }
$lastday = 'lastday'; $field = 'lastday';
if(fieldExist('premend', 'accounts')) if(fieldExist('premend', 'accounts')) { // othire
$lastday = 'premend'; $field = 'premend';
if(!isset($this->data['premend'])) {
$this->data['premend'] = 0;
}
}
// UPDATE query on database // UPDATE query on database
$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 ' . (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'] . ',' : '') . '`' . $field . '` = ' . (int) $this->data[$field] . ' WHERE `id` = ' . $this->data['id']);
} }
/** /**
@@ -327,23 +331,25 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
return $this->hasFlag(FLAG_SUPER_ADMIN); return $this->hasFlag(FLAG_SUPER_ADMIN);
} }
public function getPremDays() public function getPremDays()
{ {
if( !isset($this->data['lastday']) ) if(!isset($this->data['lastday']) && !isset($this->data['premend'])) {
{ throw new E_OTS_NotLoaded();
throw new E_OTS_NotLoaded(); }
}
if(isset($this->data['premend'])) {
return round(($this->data['premend'] - time()) / (24 * 60 * 60), 2);
}
if($this->data['premdays'] == 0) {
return 0;
}
global $config;
if(isset($config['lua']['freePremium']) && getBoolean($config['lua']['freePremium'])) return -1;
return $this->data['premdays'] - (date("z", time()) + (365 * (date("Y", time()) - date("Y", $this->data['lastday']))) - date("z", $this->data['lastday']));
}
if(fieldExist('premdays', 'accounts'))
return $this->data['premdays'];
if($this->data['lastday'] == 0)
return 0;
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()
{ {
if( !isset($this->data['lastday']) ) if( !isset($this->data['lastday']) )
@@ -353,17 +359,18 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
return $this->data['lastday']; return $this->data['lastday'];
} }
public function isPremium() public function isPremium()
{ {
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;
if(fieldExist('premdays', 'accounts'))
return $this->data['premdays'] > 0; if(isset($this->data['premend'])) {
return $this->data['premend'] > time();
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);
} 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()
{ {
@@ -748,7 +755,7 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
} }
if( !isset($this->data['banned']) ) if( !isset($this->data['banned']) )
$this->loadBan(); $this->loadBan();
return ($this->data['banned'] == 1); return ($this->data['banned'] === true);
} }
public function getBanTime() public function getBanTime()
@@ -774,20 +781,24 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
if(tableExist('account_bans')) { if(tableExist('account_bans')) {
$ban = $this->db->query('SELECT `expires_at` FROM `account_bans` WHERE `account_id` = ' . $this->data['id'] . ' AND (`expires_at` > ' . time() .' OR `expires_at` = -1) ORDER BY `expires_at` DESC')->fetch(); $ban = $this->db->query('SELECT `expires_at` FROM `account_bans` WHERE `account_id` = ' . $this->data['id'] . ' AND (`expires_at` > ' . time() .' OR `expires_at` = -1) ORDER BY `expires_at` DESC')->fetch();
$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'] = isset($ban['expires_at']) ? $ban['expires_at'] : 0;
} }
else if(tableExist('bans')) { else if(tableExist('bans')) {
if(fieldExist('active', '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'] = isset($ban['active']);
$this->data['banned_time'] = $ban['expires']; $this->data['banned_time'] = isset($ban['expires']) ? $ban['expires'] : 0;
} }
else { // tfs 0.2 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(); $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'] = isset($ban['time']) && ($ban['time'] == -1 || $ban['time'] > 0);
$this->data['banned_time'] = $ban['time']; $this->data['banned_time'] = isset($ban['time']) ? $ban['time'] : 0;
} }
} }
else {
$this->data['banned'] = false;
$this->data['banned_time'] = 0;
}
} }
/** /**

View File

@@ -216,11 +216,6 @@ class OTS_Player extends OTS_Row_DAO
if(!isset($this->data['rank_id']) || $this->data['rank_id'] == NULL) if(!isset($this->data['rank_id']) || $this->data['rank_id'] == NULL)
$this->data['rank_id'] = 0; $this->data['rank_id'] = 0;
if(isset($this->data['promotion'])) {
global $config;
if((int)$this->data['promotion'] > 0)
$this->data['vocation'] += ($this->data['promotion'] * $config['vocations_amount']);
}
// loads skills // loads skills
if( $this->isLoaded() ) if( $this->isLoaded() )
{ {
@@ -820,6 +815,12 @@ class OTS_Player extends OTS_Row_DAO
throw new E_OTS_NotLoaded(); throw new E_OTS_NotLoaded();
} }
if(isset($this->data['promotion'])) {
global $config;
if((int)$this->data['promotion'] > 0)
return ($this->data['vocation'] + ($this->data['promotion'] * $config['vocations_amount']));
}
return $this->data['vocation']; return $this->data['vocation'];
} }
@@ -2895,7 +2896,12 @@ class OTS_Player extends OTS_Row_DAO
} }
global $config; global $config;
return $config['vocations'][$this->data['vocation']]; $voc = $this->getVocation();
if(!isset($config['vocations'][$voc])) {
return 'Unknown';
}
return $config['vocations'][$voc];
//return POT::getInstance()->getVocationsList()->getVocationName($this->data['vocation']); //return POT::getInstance()->getVocationsList()->getVocationName($this->data['vocation']);
} }
@@ -3151,6 +3157,14 @@ class OTS_Player extends OTS_Row_DAO
$this->db->query('DELETE FROM ' . $this->db->tableName('player_spells') . ' WHERE ' . $this->db->fieldName('player_id') . ' = ' . $this->data['id'] . ' AND ' . $this->db->fieldName('name') . ' = ' . $this->db->quote( $spell->getName() ) ); $this->db->query('DELETE FROM ' . $this->db->tableName('player_spells') . ' WHERE ' . $this->db->fieldName('player_id') . ' = ' . $this->data['id'] . ' AND ' . $this->db->fieldName('name') . ' = ' . $this->db->quote( $spell->getName() ) );
} }
public static function getPercentLevel($count, $nextLevelCount)
{
if($nextLevelCount > 0)
return min(100, max(0, $count * 100 / $nextLevelCount));
return 0;
}
/** /**
* Magic PHP5 method. * Magic PHP5 method.

View File

@@ -28,13 +28,11 @@ class OTS_Toolbox
* @param int $experience Current experience points. * @param int $experience Current experience points.
* @return int Experience points for level. * @return int Experience points for level.
*/ */
public static function experienceForLevel($level, $experience = 0) public static function experienceForLevel($level, $experience = 0)
{ {
return 50 * ($level - 1) * ($level * $level - 5 * $level + 12) / 3 - $experience; //return 50 * ($level - 1) * ($level * $level - 5 * $level + 12) / 3 - $experience;
/* $level = $level - 1;
$level = $level - 1; return ((50 * $level * $level * $level) - (150 * $level * $level) + (400 * $level)) / 3;
return ((50 * $level * $level * $level) - (150 * $level * $level) + (400 * $level)) / 3;
*/
} }
/** /**

View File

@@ -39,11 +39,13 @@ class Usage_Statistics {
$ret['myaac_version'] = MYAAC_VERSION; $ret['myaac_version'] = MYAAC_VERSION;
$ret['myaac_db_version'] = DATABASE_VERSION; $ret['myaac_db_version'] = DATABASE_VERSION;
$query = $db->query('SELECT `value` FROM `server_config` WHERE `config` = ' . $db->quote('database_version')); if(tableExist('server_config')) {
if($query->rowCount() == 1) { $query = $db->query('SELECT `value` FROM `server_config` WHERE `config` = ' . $db->quote('database_version'));
$query = $query->fetch(); if($query->rowCount() == 1) {
$ret['otserv_db_version'] = $query['value']; $query = $query->fetch();
$ret['otserv_db_version'] = $query['value'];
}
} }
$ret['client_version'] = $config['client']; $ret['client_version'] = $config['client'];
@@ -58,8 +60,8 @@ class Usage_Statistics {
$query = $db->query('SELECT SUM(ROUND(((DATA_LENGTH + INDEX_LENGTH) / 1024 ), 0)) AS "size" $query = $db->query('SELECT SUM(ROUND(((DATA_LENGTH + INDEX_LENGTH) / 1024 ), 0)) AS "size"
FROM INFORMATION_SCHEMA.TABLES FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = "forgottenserver";'); WHERE TABLE_SCHEMA = "' . $config['database_name'] . '";');
if($query->rowCount() == 1) { if($query->rowCount() == 1) {
$query = $query->fetch(); $query = $query->fetch();
$ret['database_size'] = $query['size']; $ret['database_size'] = $query['size'];

View File

@@ -17,10 +17,10 @@ class Validator
self::$lastError = 'Invalid number format.'; self::$lastError = 'Invalid number format.';
return false; return false;
} }
return true; return true;
} }
/** /**
* Validate account id * Validate account id
* Id lenght must be 6-10 chars * Id lenght must be 6-10 chars
@@ -35,28 +35,28 @@ class Validator
self::$lastError = 'Please enter your account number!'; self::$lastError = 'Please enter your account number!';
return false; return false;
} }
if(!Validator::number($id)) { if(!Validator::number($id)) {
self::$lastError = 'Invalid account number format. Please use only numbers 0-9.'; self::$lastError = 'Invalid account number format. Please use only numbers 0-9.';
return false; return false;
} }
$length = strlen($id); $length = strlen($id);
if($length < 6) if($length < 6)
{ {
self::$lastError = 'Account is too short (min. 6 chars).'; self::$lastError = 'Account is too short (min. 6 chars).';
return false; return false;
} }
if($length > 10) if($length > 10)
{ {
self::$lastError = 'Account is too long (max. 10 chars).'; self::$lastError = 'Account is too long (max. 10 chars).';
return false; return false;
} }
return true; return true;
} }
/** /**
* Validate account name * Validate account name
* Name lenght must be 3-32 chars * Name lenght must be 3-32 chars
@@ -71,35 +71,29 @@ class Validator
self::$lastError = 'Please enter your account name!'; self::$lastError = 'Please enter your account name!';
return false; return false;
} }
$length = strlen($name); $length = strlen($name);
if($length < 3) if($length < 3)
{ {
self::$lastError = 'Account name is too short (min. 3 chars).'; self::$lastError = 'Account name is too short (min. 3 chars).';
return false; return false;
} }
if($length > 32) if($length > 32)
{ {
self::$lastError = 'Account name is too long (max. 32 chars).'; self::$lastError = 'Account name is too long (max. 32 chars).';
return false; return false;
} }
if(strspn($name, "QWERTYUIOPASDFGHJKLZXCVBNM0123456789") != $length) if(!preg_match("/[A-Z0-9]/i", $name))
{ {
self::$lastError = 'Invalid account name format. Use only A-Z and numbers 0-9.'; self::$lastError = 'Invalid account name format. Use only A-Z and numbers 0-9.';
return false; return false;
} }
if(!preg_match("/[A-Z0-9]/", $name))
{
self::$lastError = 'Invalid account name format. Use only A-Z and numbers 0-9.';
return false;
}
return true; return true;
} }
/** /**
* Advanced mail validator * Advanced mail validator
* *
@@ -111,17 +105,17 @@ class Validator
self::$lastError = 'Please enter your new email address.'; self::$lastError = 'Please enter your new email address.';
return false; return false;
} }
if(strlen($email) > 255) { if(strlen($email) > 255) {
self::$lastError = 'E-mail is too long (max. 255 chars).'; self::$lastError = 'E-mail is too long (max. 255 chars).';
return false; return false;
} }
if(!preg_match('/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9_](?:[A-z0-9_\-](?!\.)){0,61}[a-zA-Z0-9_]?\.)+[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!$)){0,61}[a-zA-Z0-9_]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/', $email)) { if(!preg_match('/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9_](?:[A-z0-9_\-](?!\.)){0,61}[a-zA-Z0-9_]?\.)+[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!$)){0,61}[a-zA-Z0-9_]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/', $email)) {
self::$lastError = 'Invalid e-mail format.'; self::$lastError = 'Invalid e-mail format.';
return false; return false;
} }
return true; return true;
} }
@@ -138,35 +132,35 @@ class Validator
self::$lastError = 'Please enter the password.'; self::$lastError = 'Please enter the password.';
return false; return false;
} }
if (strlen($password) < 8 || strlen($password) > 30) { if (strlen($password) < 8 || strlen($password) > 30) {
self::$lastError = 'The password must have at least 8 and maximum 30 letters!'; self::$lastError = 'The password must have at least 8 and maximum 30 letters!';
return false; return false;
} }
if(strspn($password, "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890") != strlen($password)) { if(strspn($password, "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890") != strlen($password)) {
self::$lastError = 'Password contains illegal letters (a-z, A-Z and 0-9 only!).'; self::$lastError = 'Password contains illegal letters (a-z, A-Z and 0-9 only!).';
return false; return false;
} }
if(!ctype_alnum($password)) { if(!ctype_alnum($password)) {
self::$lastError = 'Password contains illegal letters (a-z, A-Z and 0-9 only!).'; self::$lastError = 'Password contains illegal letters (a-z, A-Z and 0-9 only!).';
return false; return false;
} }
if(!preg_match('/[a-zA-Z]/', $password)) { if(!preg_match('/[a-zA-Z]/', $password)) {
self::$lastError = 'The password must contain at least one letter A-Z or a-z!'; self::$lastError = 'The password must contain at least one letter A-Z or a-z!';
return false; return false;
} }
if(!preg_match('/[0-9]/', $password)) { if(!preg_match('/[0-9]/', $password)) {
self::$lastError = 'The password must contain at least one letter other than A-Z or a-z!'; self::$lastError = 'The password must contain at least one letter other than A-Z or a-z!';
return false; return false;
} }
return true; return true;
} }
/** /**
* Validate character name. * Validate character name.
* Name lenght must be 3-25 chars * Name lenght must be 3-25 chars
@@ -181,20 +175,20 @@ class Validator
self::$lastError = 'Please enter character name.'; self::$lastError = 'Please enter character name.';
return false; return false;
} }
$length = strlen($name); $length = strlen($name);
if($length < 3) if($length < 3)
{ {
self::$lastError = 'Character name is too short. Min. lenght <b>3</b> characters.'; self::$lastError = 'Character name is too short. Min. lenght <b>3</b> characters.';
return false; return false;
} }
if($length > 25) if($length > 25)
{ {
self::$lastError = 'Character name is too long. Max. lenght <b>25</b> characters.'; self::$lastError = 'Character name is too long. Max. lenght <b>25</b> characters.';
return false; return false;
} }
if(strspn($name, "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM- [ ] '") != $length) if(strspn($name, "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM- [ ] '") != $length)
{ {
self::$lastError = "Invalid name format. Use only A-Z, spaces and '."; self::$lastError = "Invalid name format. Use only A-Z, spaces and '.";
@@ -205,10 +199,10 @@ class Validator
self::$lastError = "Invalid name format. Use only A-Z, spaces and '."; self::$lastError = "Invalid name format. Use only A-Z, spaces and '.";
return false; return false;
} }
return true; return true;
} }
/** /**
* Validate new character name. * Validate new character name.
* Name lenght must be 3-25 chars * Name lenght must be 3-25 chars
@@ -219,9 +213,9 @@ class Validator
public static function newCharacterName($name) public static function newCharacterName($name)
{ {
global $db, $config; global $db, $config;
$name_lower = strtolower($name); $name_lower = strtolower($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)
{ {
@@ -230,27 +224,27 @@ class Validator
return false; return false;
} }
} }
if(substr($name_lower, -1) == "'" || substr($name_lower, -1) == "-") { if(substr($name_lower, -1) == "'" || substr($name_lower, -1) == "-") {
self::$lastError = 'Your name contains illegal characters.'; self::$lastError = 'Your name contains illegal characters.';
return false; return false;
} }
if(substr($name_lower, 1, 1) == ' ') { if(substr($name_lower, 1, 1) == ' ') {
self::$lastError = 'Your name contains illegal space.'; self::$lastError = 'Your name contains illegal space.';
return false; return false;
} }
if(substr($name_lower, -2, 1) == " ") { if(substr($name_lower, -2, 1) == " ") {
self::$lastError = 'Your name contains illegal space.'; self::$lastError = 'Your name contains illegal space.';
return false; return false;
} }
if(strtolower($config['lua']['serverName']) == $name_lower) { if(strtolower($config['lua']['serverName']) == $name_lower) {
self::$lastError = 'Your name cannot be same as server name.'; self::$lastError = 'Your name cannot be same as server name.';
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)
{ {
@@ -259,7 +253,7 @@ class Validator
return false; 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)
{ {
@@ -268,7 +262,7 @@ class Validator
return false; return false;
} }
} }
$name_length = strlen($name_lower); $name_length = strlen($name_lower);
for($i = 0; $i < $name_length; $i++) for($i = 0; $i < $name_length; $i++)
{ {
@@ -277,7 +271,7 @@ class Validator
return false; return false;
} }
} }
for($i = 0; $i < $name_length; $i++) 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] == ' ') { if(isset($name_lower[$i - 1]) && $name_lower[$i - 1] == ' ' && isset($name_lower[$i + 1]) && $name_lower[$i + 1] == ' ') {
@@ -285,7 +279,7 @@ class Validator
return false; return false;
} }
} }
if(isset($config['monsters'])) if(isset($config['monsters']))
{ {
if(in_array($name_lower, $config['monsters'])) { if(in_array($name_lower, $config['monsters'])) {
@@ -293,14 +287,14 @@ class Validator
return false; return false;
} }
} }
$player = new OTS_Player(); $player = new OTS_Player();
$player->find($name); $player->find($name);
if($player->isLoaded()) { if($player->isLoaded()) {
self::$lastError = 'Character with this name already exist.'; self::$lastError = 'Character with this name already exist.';
return false; return false;
} }
//check if was namelocked previously //check if was namelocked previously
if(tableExist('player_namelocks') && fieldExist('name', 'player_namelocks')) { if(tableExist('player_namelocks') && fieldExist('name', 'player_namelocks')) {
$namelock = $db->query('SELECT `player_id` FROM `player_namelocks` WHERE `name` = ' . $db->quote($name)); $namelock = $db->query('SELECT `player_id` FROM `player_namelocks` WHERE `name` = ' . $db->quote($name));
@@ -309,25 +303,25 @@ class Validator
return false; return false;
} }
} }
$monsters = $db->query('SELECT `name` FROM `' . TABLE_PREFIX . 'monsters` WHERE `name` LIKE ' . $db->quote($name_lower)); $monsters = $db->query('SELECT `name` FROM `' . TABLE_PREFIX . 'monsters` WHERE `name` LIKE ' . $db->quote($name_lower));
if($monsters->rowCount() > 0) { if($monsters->rowCount() > 0) {
self::$lastError = 'Your name cannot contains monster name.'; self::$lastError = 'Your name cannot contains monster name.';
return false; return false;
} }
$spells_name = $db->query('SELECT `name` FROM `' . TABLE_PREFIX . 'spells` WHERE `name` LIKE ' . $db->quote($name_lower)); $spells_name = $db->query('SELECT `name` FROM `' . TABLE_PREFIX . 'spells` WHERE `name` LIKE ' . $db->quote($name_lower));
if($spells_name->rowCount() > 0) { if($spells_name->rowCount() > 0) {
self::$lastError = 'Your name cannot contains spell name.'; self::$lastError = 'Your name cannot contains spell name.';
return false; return false;
} }
$spells_words = $db->query('SELECT `words` FROM `' . TABLE_PREFIX . 'spells` WHERE `words` = ' . $db->quote($name_lower)); $spells_words = $db->query('SELECT `words` FROM `' . TABLE_PREFIX . 'spells` WHERE `words` = ' . $db->quote($name_lower));
if($spells_words->rowCount() > 0) { if($spells_words->rowCount() > 0) {
self::$lastError = 'Your name cannot contains spell name.'; self::$lastError = 'Your name cannot contains spell name.';
return false; return false;
} }
if(isset($config['npc'])) if(isset($config['npc']))
{ {
if(in_array($name_lower, $config['npc'])) { if(in_array($name_lower, $config['npc'])) {
@@ -335,26 +329,26 @@ class Validator
return false; return false;
} }
} }
if(strspn($name, "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM- '") != $name_length) { if(strspn($name, "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM- '") != $name_length) {
self::$lastError = 'This name contains invalid letters, words or format. Please use only a-Z, - , \' and space.'; self::$lastError = 'This name contains invalid letters, words or format. Please use only a-Z, - , \' and space.';
return false; return false;
} }
if($name_length < 3 || $name_length > 28) { if($name_length < 3 || $name_length > 28) {
self::$lastError = 'Your name cannot be shorter than 3 characters and longer than 28 characters.'; self::$lastError = 'Your name cannot be shorter than 3 characters and longer than 28 characters.';
return false; return false;
} }
if(!preg_match("/[A-z ']{3,28}/", $name)) { if(!preg_match("/[A-z ']{3,28}/", $name)) {
self::$lastError = 'Your name containst illegal characters.'; self::$lastError = 'Your name containst illegal characters.';
return false; return false;
} }
return true; return true;
} }
/** /**
* Validate guild name * Validate guild name
* Name lenght must be 3-32 chars * Name lenght must be 3-32 chars
@@ -368,20 +362,47 @@ class Validator
self::$lastError = 'Please enter guild name.'; self::$lastError = 'Please enter guild name.';
return false; return false;
} }
if(strspn($name, "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM0123456789- ") != strlen($name)) { if(strspn($name, "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM0123456789- ") != strlen($name)) {
self::$lastError = 'Invalid guild name format.'; self::$lastError = 'Invalid guild name format.';
return false; return false;
} }
if(!preg_match("/[A-z ]{3,32}/", $name)) { if(!preg_match("/[A-z ]{3,32}/", $name)) {
self::$lastError = 'Invalid guild name format.'; self::$lastError = 'Invalid guild name format.';
return false; return false;
} }
return true; return true;
} }
/**
* Validate guild nick
* Nick lenght must be 3-40 chars
*
* @param string $name Name to check
* @return bool Is name valid?
*/
public static function guildNick($name)
{
if(empty($name)) {
self::$lastError = 'Please enter guild nick.';
return false;
}
if(strspn($name, "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM0123456789- ") != strlen($name)) {
self::$lastError = 'Invalid guild nick format.';
return false;
}
if(!preg_match("/[A-z ]{3,40}/", $name)) {
self::$lastError = 'Invalid guild nick format.';
return false;
}
return true;
}
/** /**
* Validate rank name * Validate rank name
* Rank lenght must be 1-32 chars * Rank lenght must be 1-32 chars
@@ -395,17 +416,17 @@ class Validator
self::$lastError = 'Please enter rank name.'; self::$lastError = 'Please enter rank name.';
return false; return false;
} }
if(strspn($name, "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM0123456789-[ ] ") != strlen($name)) { if(strspn($name, "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM0123456789-[ ] ") != strlen($name)) {
self::$lastError = 'Invalid rank name. Please use only a-Z, 0-9 and spaces.'; self::$lastError = 'Invalid rank name. Please use only a-Z, 0-9 and spaces.';
return false; return false;
} }
if(!preg_match("/[A-z ]{1,32}/", $name)) { if(!preg_match("/[A-z ]{1,32}/", $name)) {
self::$lastError = 'Invalid rank name. Please use only a-Z, 0-9 and spaces.'; self::$lastError = 'Invalid rank name. Please use only a-Z, 0-9 and spaces.';
return false; return false;
} }
return true; return true;
} }
/** /**
@@ -417,7 +438,7 @@ class Validator
public static function str($str, $numbers = false) { public static function str($str, $numbers = false) {
return preg_match('/^[a-z0-9\ ]*$/i', $str); return preg_match('/^[a-z0-9\ ]*$/i', $str);
} }
public static function getLastError() { public static function getLastError() {
return self::$lastError; return self::$lastError;
} }

View File

@@ -18,7 +18,7 @@ $locale['loaded'] = 'Loaded';
$locale['not_loaded'] = 'Not 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. If you want to reinstall MyAAC - please delete <strong>config.local.php</strong> file from the main directory and refresh the page.';
// welcome // welcome
$locale['step_welcome'] = 'Welcome'; $locale['step_welcome'] = 'Welcome';
@@ -42,7 +42,6 @@ $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_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 admin@gmail.com'; $locale['step_config_mail_admin_desc'] = 'Address where emails from contact form will be delivered, for example admin@gmail.com';
$locale['step_config_mail_admin_error'] = 'Admin E-Mail is not correct.'; $locale['step_config_mail_admin_error'] = 'Admin E-Mail is not correct.';
@@ -82,10 +81,16 @@ $locale['step_admin'] = 'Admin Account';
$locale['step_admin_title'] = 'Create Admin Account'; $locale['step_admin_title'] = 'Create Admin Account';
$locale['step_admin_account'] = 'Admin account name'; $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_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_error_format'] = 'Invalid account name format. Use only a-Z and numbers 0-9. Minimum 3, maximum 32 characters.';
$locale['step_admin_account_id_desc'] = 'ID of your admin account, which will be used to login to website and server.'; $locale['step_admin_account_error_same'] = 'Password may not be the same as account name.';
$locale['step_admin_account_id'] = 'Admin account number';
$locale['step_admin_account_id_desc'] = 'Number of your admin account, which will be used to login to website and server.';
$locale['step_admin_account_id_error_format'] = 'Invalid account number format. Please use only numbers 0-9. Minimum 6, maximum 10 characters.';
$locale['step_admin_account_id_error_same'] = 'Password may not be the same as account number.';
$locale['step_admin_password'] = 'Admin account password'; $locale['step_admin_password'] = 'Admin account password';
$locale['step_admin_password_desc'] = 'Password to your admin account.'; $locale['step_admin_password_desc'] = 'Password to your admin account.';
$locale['step_admin_password_error_empty'] = 'Please enter the password for your new account.';
$locale['step_admin_password_error_format'] = 'Invalid password format. Use only a-Z and numbers 0-9. Minimum 8, maximum 30 characters.';
// finish // finish
$locale['step_finish_admin_panel'] = 'Admin Panel'; $locale['step_finish_admin_panel'] = 'Admin Panel';

View File

@@ -18,7 +18,7 @@ $locale['loaded'] = 'Załadowane';
$locale['not_loaded'] = 'Nie 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>. Jeśli chcesz zainstalować MyAAC od nowa - proszę usuń plik <strong>config.local.php</strong> z katalogu głównego i odśwież stronę.';
// welcome // welcome
$locale['step_welcome'] = 'Witamy'; $locale['step_welcome'] = 'Witamy';
@@ -42,11 +42,6 @@ $locale['step_config'] = 'Konfiguracja';
$locale['step_config_title'] = 'Podstawowa konfiguracja'; $locale['step_config_title'] = 'Podstawowa konfiguracja';
$locale['step_config_server_path'] = 'Ścieżka do serwera'; $locale['step_config_server_path'] = 'Ścieżka do serwera';
$locale['step_config_server_path_desc'] = 'Ścieżka do Twojego folderu z TFS, gdzie znajduje się plik config.lua.'; $locale['step_config_server_path_desc'] = 'Ścieżka do Twojego folderu z TFS, gdzie znajduje się plik config.lua.';
$locale['step_config_account'] = 'Konto administratora';
$locale['step_config_account_desc'] = 'Nazwa twojego konta admina, która będzie używana do logowania na stronę i do serwera.';
$locale['step_config_password'] = 'Hasło do konta admina';
$locale['step_config_password_desc'] = 'Hasło do Twojego konta administratora.';
$locale['step_config_mail_admin'] = 'E-Mail admina'; $locale['step_config_mail_admin'] = 'E-Mail admina';
$locale['step_config_mail_admin_desc'] = 'Na ten adres będą dostarczane E-Maile z formularza kontaktowego , przykładowo admin@gmail.com'; $locale['step_config_mail_admin_desc'] = 'Na ten adres będą dostarczane E-Maile z formularza kontaktowego , przykładowo admin@gmail.com';
$locale['step_config_mail_admin_error'] = 'E-Mail admina jest niepoprawny.'; $locale['step_config_mail_admin_error'] = 'E-Mail admina jest niepoprawny.';
@@ -55,13 +50,16 @@ $locale['step_config_mail_address_desc'] = 'Ten adres będzie używany do wysył
$locale['step_config_mail_address_error'] = 'E-Mail serwera jest niepoprawny.'; $locale['step_config_mail_address_error'] = 'E-Mail serwera jest niepoprawny.';
$locale['step_config_client'] = 'Wersja klienta'; $locale['step_config_client'] = 'Wersja klienta';
$locale['step_config_client_desc'] = 'Używana do strony pobieranie klienta oraz kilku szablonów'; $locale['step_config_client_desc'] = 'Używana do strony pobieranie klienta oraz kilku szablonów';
$locale['step_config_usage'] = 'Raportowanie Statystyk';
$locale['step_config_usage_desc'] = 'Zezwalaj MyAAC na raportowanie anonimowych statystyk? Dane są wysyłane raz na 30 dni i są w pełni anonimowe.';
// database // database
$locale['step_database'] = 'Baza'; $locale['step_database'] = 'Baza Danych';
$locale['step_database_title'] = 'Baza MySQL'; $locale['step_database_title'] = 'Baza MySQL';
$locale['step_database_importing'] = 'Twoja baza to MySQL. Importowanie schematu...'; $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_database_empty'] = 'Nie można wykryć typu bazy danych z pliku config.lua. Prawdopodobnie Twój OTS nie jest wspierany przez ten AAC.';
$locale['step_database_error_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ć schemat bazy 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..';
@@ -72,9 +70,28 @@ $locale['step_database_adding_field'] = 'Dodawanie pola';
$locale['step_database_modifying_field'] = 'Modyfikacja pola'; $locale['step_database_modifying_field'] = 'Modyfikacja pola';
$locale['step_database_changing_field'] = 'Zmiana $FIELD$ na $FIELD_NEW$...'; $locale['step_database_changing_field'] = 'Zmiana $FIELD$ na $FIELD_NEW$...';
$locale['step_database_imported_players'] = 'Importowanie schematów graczy...'; $locale['step_database_imported_players'] = 'Importowanie schematów graczy...';
$locale['step_database_loaded_monsters'] = 'Załadowano potworki (monsters)...';
$locale['step_database_error_monsters'] = 'Wystąpiły problemy podczas ładowania pliku monsters.xml. Zobacz $LOG$ po więcej informacji.';
$locale['step_database_loaded_spells'] = 'Załadowano czary (spells)...';
$locale['step_database_created_account'] = 'Utworzono konto admina...'; $locale['step_database_created_account'] = 'Utworzono konto admina...';
$locale['step_database_created_news'] = 'Utworzono newsy...'; $locale['step_database_created_news'] = 'Utworzono newsy...';
// admin account
$locale['step_admin'] = 'Konto Admina';
$locale['step_admin_title'] = 'Tworzenie Konta Admina';
$locale['step_admin_account'] = 'Nazwa Konta Admina';
$locale['step_admin_account_desc'] = 'Nazwa Twojego konta admina, która będzie używana do logowania na stronę i do serwera.';
$locale['step_admin_account_error_format'] = 'Nieprawidłowy format nazwy konta. Używaj tylko znaków a-Z oraz liczb 0-9. Minimum 3, maksimum 32 znaków.';
$locale['step_admin_account_error_same'] = 'Hasło nie może być takie same jak nazwa konta.';
$locale['step_admin_account_id'] = 'Numer Konta Admina';
$locale['step_admin_account_id_desc'] = 'Numer Twojego Konta Admina, który będzie używany do logowania do strony i na serwer.';
$locale['step_admin_account_id_error_format'] = 'Nieprawidłowy format numeru konta. Używaj tylko liczb 0-9. Minimum 6, maksimum 10 znaków.';
$locale['step_admin_account_id_error_same'] = 'Hasło nie może być takie same jak numer konta.';
$locale['step_admin_password'] = 'Hasło Konta Admina';
$locale['step_admin_password_desc'] = 'Hasło do Twojego Konta Admina.';
$locale['step_admin_password_error_empty'] = 'Proszę podać hasło do Twojego nowego konta.';
$locale['step_admin_password_error_format'] = 'Nieprawidłowy format hasła. Używaj tylko znaków a-Z oraz liczb 0-9. Minimum 8, maksimum 30 characters.';
// finish // finish
$locale['step_finish_admin_panel'] = 'Panelu Admina'; $locale['step_finish_admin_panel'] = 'Panelu Admina';
$locale['step_finish_homepage'] = 'stronę główną'; $locale['step_finish_homepage'] = 'stronę główną';

View File

@@ -18,7 +18,7 @@ $locale['loaded'] = 'Laddad';
$locale['not_loaded'] = 'Inte Laddad'; $locale['not_loaded'] = 'Inte Laddad';
$locale['please_fill_all'] = 'Vänligen fyll i allt!'; $locale['please_fill_all'] = 'Vänligen fyll i allt!';
$locale['already_installed'] = 'MyAAC är redan installerat. Vänligen ta bort <b>install/<b/> mappen.'; $locale['already_installed'] = 'MyAAC är redan installerat. Vänligen ta bort <b>install/<b/> mappen. Om du vill installera MyAAC igen - ta bort filen <strong>config.local.php</strong> från huvudkatalogen och uppdatera sidan.';
// welcome // welcome
$locale['step_welcome'] = 'Välkommen'; $locale['step_welcome'] = 'Välkommen';

3
system/migrations/19.php Normal file
View File

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

48
system/migrations/20.php Normal file
View File

@@ -0,0 +1,48 @@
<?php
if(!isset($database_migration_20)) {
databaseMigration20();
}
function databaseMigration20(&$content = '') {
global $db;
$config_file = BASE . 'config.local.php';
if(!is_writable($config_file)) { // we can't do anything, just ignore
return false;
}
$content_of_file = trim(file_get_contents($config_file));
if(strpos($content_of_file, 'highscores_ids_hidden') !== false) { // already present
return true;
}
$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") . " OR `name` = " . $db->quote("Account Manager") . ") ORDER BY `id`;");
$highscores_ignored_ids = array();
if($query->rowCount() > 0) {
foreach($query->fetchAll() as $result)
$highscores_ignored_ids[] = $result['id'];
}
else {
$highscores_ignored_ids[] = 0;
}
$php_on_end = substr($content_of_file, -2, 2) == '?>';
$content = PHP_EOL;
if($php_on_end) {
$content .= '<?php';
}
$content .= PHP_EOL;
$content .= '$config[\'highscores_ids_hidden\'] = array(' . implode(', ', $highscores_ignored_ids) . ');';
$content .= PHP_EOL;
if($php_on_end) {
$content .= '?>';
}
file_put_contents($config_file, $content, FILE_APPEND);
return true;
}
?>

14
system/migrations/21.php Normal file
View File

@@ -0,0 +1,14 @@
<?php
$db->query("ALTER TABLE `" . TABLE_PREFIX . "forum` ADD `post_html` TINYINT(1) NOT NULL DEFAULT 0 AFTER `post_smile`;");
$query = $db->query("SELECT `id` FROM `" . TABLE_PREFIX . "forum_boards` WHERE `name` LIKE " . $db->quote('News') . " LIMIT 1;");
if($query->rowCount() == 0) {
return; // don't make anything
}
$query = $query->fetch();
$id = $query['id'];
// update all forum threads with is_html = 1
$db->query("UPDATE `" . TABLE_PREFIX . "forum` SET `post_html` = 1 WHERE `section` = " . $id . " AND `id` = `first_post`;");

29
system/migrations/22.php Normal file
View File

@@ -0,0 +1,29 @@
<?php
if(!tableExist('z_polls'))
$db->query('
CREATE TABLE `z_polls` (
`id` int(11) NOT NULL auto_increment,
`question` varchar(255) NOT NULL,
`description` varchar(255) NOT NULL,
`end` int(11) NOT NULL DEFAULT 0,
`start` int(11) NOT NULL DEFAULT 0,
`answers` int(11) NOT NULL DEFAULT 0,
`votes_all` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;');
if(!tableExist('z_polls_answers'))
$db->query('
CREATE TABLE `z_polls_answers` (
`poll_id` int(11) NOT NULL,
`answer_id` int(11) NOT NULL,
`answer` varchar(255) NOT NULL,
`votes` int(11) NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=latin1;');
if(!fieldExist('vote', 'accounts'))
$db->query('ALTER TABLE `accounts` ADD `vote` INT( 11 ) DEFAULT 0 NOT NULL ;');
else {
$db->query('ALTER TABLE `accounts` MODIFY `vote` INT( 11 ) DEFAULT 0 NOT NULL ;');
}

View File

@@ -140,7 +140,11 @@ if($save) {
$player->setPosX(0); $player->setPosX(0);
$player->setPosY(0); $player->setPosY(0);
$player->setPosZ(0); $player->setPosZ(0);
$player->setStamina($config['otserv_version'] == TFS_03 ? 151200000 : 2520);
if(fieldExist('stamina', 'players')) {
$player->setStamina($char_to_copy->getStamina());
}
if(fieldExist('loss_experience', 'players')) { if(fieldExist('loss_experience', 'players')) {
$player->setLossExperience($char_to_copy->getLossExperience()); $player->setLossExperience($char_to_copy->getLossExperience());
$player->setLossMana($char_to_copy->getLossMana()); $player->setLossMana($char_to_copy->getLossMana());

View File

@@ -110,7 +110,7 @@ $errors = array();
$players = array(); $players = array();
$account_players = $account_logged->getPlayersList(); $account_players = $account_logged->getPlayersList();
$account_players->orderBy('id'); $account_players->orderBy('id');
echo $twig->render('account.management.html.twig', array( echo $twig->render('account.management.html.twig', array(
'welcome_message' => $welcome_message, 'welcome_message' => $welcome_message,
'recovery_key' => $recovery_key, 'recovery_key' => $recovery_key,

View File

@@ -28,29 +28,27 @@ foreach(scandir($aac_path_logs) as $f) {
} }
$server_path_logs = $config['server_path'] . 'logs/'; $server_path_logs = $config['server_path'] . 'logs/';
if(!file_exists($server_path_logs))
$server_path_logs = $config['data_path'] . 'logs/';
if(!file_exists($server_path_logs)) { if(!file_exists($server_path_logs)) {
echo '</table>Logs are not available on this server.'; $server_path_logs = $config['data_path'] . 'logs/';
return;
} }
foreach(scandir($server_path_logs) as $f) { if(file_exists($server_path_logs)) {
if($f[0] == '.' || $f == '..') foreach(scandir($server_path_logs) as $f) {
continue; if($f[0] == '.' || $f == '..')
continue;
if(is_dir($server_path_logs . $f)) { if(is_dir($server_path_logs . $f)) {
foreach(scandir($server_path_logs . $f) as $f2) { foreach(scandir($server_path_logs . $f) as $f2) {
if($f2[0] == '.' || $f2 == '..') if($f2[0] == '.' || $f2 == '..')
continue; continue;
$files[] = array($f . '/' . $f2, $server_path_logs); $files[] = array($f . '/' . $f2, $server_path_logs);
}
continue;
} }
continue; $files[] = array($f, $server_path_logs);
} }
$files[] = array($f, $server_path_logs);
} }
$i = 0; $i = 0;

View File

@@ -16,6 +16,8 @@ if(!hasFlag(FLAG_CONTENT_PAGES) && !superAdmin())
return; return;
} }
header('X-XSS-Protection:0');
$name = $p_title = ''; $name = $p_title = '';
$groups = new OTS_Groups_List(); $groups = new OTS_Groups_List();

View File

@@ -120,7 +120,11 @@ if($id > 0) {
verify_number($experience, 'Experience', 20); verify_number($experience, 'Experience', 20);
$vocation = $_POST['vocation']; $vocation = $_POST['vocation'];
verify_number($vocation, 'Vocation id', 1); verify_number($vocation, 'Vocation id', 11);
if(!isset($config['vocations'][$vocation])) {
echo_error("Vocation with this id doesn't exist.");
}
// health // health
$health = $_POST['health']; $health = $_POST['health'];
@@ -357,14 +361,12 @@ $account = $player->getAccount();
<td> <td>
<select name="vocation"> <select name="vocation">
<?php <?php
$i = 0; foreach($config['vocations'] as $id => $name)
foreach($config['vocations'] as $voc)
{ {
echo '<option value=' . $i; echo '<option value=' . $id;
if($i == $player->getVocation()) if($id == $player->getVocation())
echo ' selected="selected"'; echo ' selected="selected"';
echo '>' . $voc . '</option>'; echo '>' . $name . '</option>';
$i++;
} }

View File

@@ -17,12 +17,12 @@ echo $twig->render('admin.plugins.form.html.twig');
if(isset($_REQUEST['uninstall'])){ if(isset($_REQUEST['uninstall'])){
$uninstall = $_REQUEST['uninstall']; $uninstall = $_REQUEST['uninstall'];
if(Plugins::uninstall($uninstall)) { if(Plugins::uninstall($uninstall)) {
success('Successfully uninstalled plugin ' . $uninstall); success('Successfully uninstalled plugin ' . $uninstall);
} }
else { else {
error('Error while uninstalling plugin ' . $plugin_name . ': ' . Plugins::getError()); error('Error while uninstalling plugin ' . $uninstall . ': ' . Plugins::getError());
} }
} }
else if(isset($_FILES["plugin"]["name"])) else if(isset($_FILES["plugin"]["name"]))
@@ -43,7 +43,7 @@ else if(isset($_FILES["plugin"]["name"]))
break; break;
case UPLOAD_ERR_INI_SIZE: case UPLOAD_ERR_INI_SIZE:
case UPLOAD_ERR_FORM_SIZE: case UPLOAD_ERR_FORM_SIZE:
$error .= ' - file too large (limit of '.ini_get('upload_max_filesize').' bytes).'; $error .= ' - file too large (limit of '.ini_get('upload_max_filesize').' bytes). You can enlarge the limits by changing "upload_max_filesize" in php.ini';
break; break;
case UPLOAD_ERR_PARTIAL: case UPLOAD_ERR_PARTIAL:
$error .= ' - file upload was not completed.'; $error .= ' - file upload was not completed.';
@@ -78,7 +78,7 @@ else if(isset($_FILES["plugin"]["name"]))
} }
else else
error(Plugins::getError()); error(Plugins::getError());
unlink($targetzip); // delete the Zipped file unlink($targetzip); // delete the Zipped file
} }
else else

View File

@@ -231,7 +231,7 @@ if($player->isLoaded() && !$player->isDeleted())
$dead_add_content = ''; $dead_add_content = '';
$deaths = array(); $deaths = array();
if(tableExist('killers')) { if(tableExist('killers')) {
$player_deaths = $db->query('SELECT `id`, `date`, `level` FROM `player_deaths` WHERE `player_id` = '.$player->getId().' ORDER BY `date` DESC LIMIT 0,10;'); $player_deaths = $db->query('SELECT `id`, `date`, `level` FROM `player_deaths` WHERE `player_id` = '.$player->getId().' ORDER BY `date` DESC LIMIT 0,10;')->fetchAll();
if(count($player_deaths)) if(count($player_deaths))
{ {
$number_of_rows = 0; $number_of_rows = 0;
@@ -289,7 +289,7 @@ WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, kil
$deaths_db = $db->query('SELECT $deaths_db = $db->query('SELECT
`player_id`, `time`, `level`, `killed_by`, `is_player`' . $mostdamage . ' `player_id`, `time`, `level`, `killed_by`, `is_player`' . $mostdamage . '
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;')->fetchAll();
if(count($deaths_db)) if(count($deaths_db))
{ {
@@ -328,13 +328,13 @@ WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, kil
//frags list by Xampy //frags list by Xampy
$i = 0; $i = 0;
$frags_limit = 10; // frags limit to show? // default: 10 $frags_limit = 10; // frags limit to show? // default: 10
$player_frags = $db->query('SELECT `player_deaths`.*, `players`.`name`, `killers`.`unjustified` FROM `player_deaths` LEFT JOIN `killers` ON `killers`.`death_id` = `player_deaths`.`id` LEFT JOIN `player_killers` ON `player_killers`.`kill_id` = `killers`.`id` LEFT JOIN `players` ON `players`.`id` = `player_deaths`.`player_id` WHERE `player_killers`.`player_id` = '.$player->getId().' ORDER BY `date` DESC LIMIT 0,'.$frags_limit.';'); $player_frags = $db->query('SELECT `player_deaths`.*, `players`.`name`, `killers`.`unjustified` FROM `player_deaths` LEFT JOIN `killers` ON `killers`.`death_id` = `player_deaths`.`id` LEFT JOIN `player_killers` ON `player_killers`.`kill_id` = `killers`.`id` LEFT JOIN `players` ON `players`.`id` = `player_deaths`.`player_id` WHERE `player_killers`.`player_id` = '.$player->getId().' ORDER BY `date` DESC LIMIT 0,'.$frags_limit.';')->fetchAll();
if(count($player_frags)) if(count($player_frags))
{ {
$row_count = 0; $row_count = 0;
foreach($player_frags as $frag) foreach($player_frags as $frag)
{ {
$description = 'Fragged <a href="' . getPlayerLink($frag[name], false) . '">' . $frag[name] . '</a> at level ' . $frag[level]; $description = 'Fragged <a href="' . getPlayerLink($frag['name'], false) . '">' . $frag['name'] . '</a> at level ' . $frag['level'];
$frags[] = array('time' => $frag['date'], 'description' => $description, 'unjustified' => $frag['unjustified'] != 0); $frags[] = array('time' => $frag['date'], 'description' => $description, 'unjustified' => $frag['unjustified'] != 0);
} }
} }
@@ -375,7 +375,7 @@ WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, kil
'sex' => $player_sex, 'sex' => $player_sex,
'marriage_enabled' => $config['characters']['marriage_info'] && fieldExist('marriage', 'players'), 'marriage_enabled' => $config['characters']['marriage_info'] && fieldExist('marriage', 'players'),
'marital_status' => $marital_status, 'marital_status' => $marital_status,
'vocation' => $config['vocations'][$player->getVocation()], 'vocation' => $player->getVocationName(),
'frags_enabled' => $frags_enabled, 'frags_enabled' => $frags_enabled,
'frags_count' => $frags_count, 'frags_count' => $frags_count,
'town' => isset($config['towns'][$player->getTownId()]) ? $config['towns'][$player->getTownId()] : null, 'town' => isset($config['towns'][$player->getTownId()]) ? $config['towns'][$player->getTownId()] : null,

View File

@@ -26,7 +26,6 @@ if($save)
{ {
if(USE_ACCOUNT_NAME) { if(USE_ACCOUNT_NAME) {
$account_name = $_POST['account']; $account_name = $_POST['account'];
$account_name_up = strtoupper($account_name);
} }
else else
$account_id = $_POST['account']; $account_id = $_POST['account'];
@@ -40,7 +39,7 @@ if($save)
if(!Validator::accountId($account_id)) if(!Validator::accountId($account_id))
$errors['account'] = Validator::getLastError(); $errors['account'] = Validator::getLastError();
} }
else if(!Validator::accountName($account_name_up)) else if(!Validator::accountName($account_name))
$errors['account'] = Validator::getLastError(); $errors['account'] = Validator::getLastError();
// email // email
@@ -72,7 +71,7 @@ if($save)
} }
// password // password
if(!isset($password[0])) { if(empty($password)) {
$errors['password'] = 'Please enter the password for your new account.'; $errors['password'] = 'Please enter the password for your new account.';
} }
elseif($password != $password2) { elseif($password != $password2) {
@@ -83,8 +82,7 @@ if($save)
} }
// check if account name is not equal to password // check if account name is not equal to password
if(USE_ACCOUNT_NAME && $account_name_up == strtoupper($password)) if(USE_ACCOUNT_NAME && strtoupper($account_name) == strtoupper($password)) {
{
$errors['password'] = 'Password may not be the same as account name.'; $errors['password'] = 'Password may not be the same as account name.';
} }
@@ -146,8 +144,13 @@ if($save)
} }
if($config['account_premium_days'] && $config['account_premium_days'] > 0) { if($config['account_premium_days'] && $config['account_premium_days'] > 0) {
$new_account->setCustomField('premdays', $config['account_premium_days']); if(fieldExist('premend', 'accounts')) { // othire
$new_account->setCustomField('lastday', time()); $new_account->setCustomField('premend', time() + $config['account_premium_days'] * 86400);
}
else { // rest
$new_account->setCustomField('premdays', $config['account_premium_days']);
$new_account->setCustomField('lastday', time());
}
} }
if($config['account_premium_points']) { if($config['account_premium_points']) {
@@ -200,9 +203,10 @@ if($save)
if(_mail($email, 'Your account on ' . $config['lua']['serverName'], $mailBody)) if(_mail($email, 'Your account on ' . $config['lua']['serverName'], $mailBody))
echo '<br /><small>These informations were send on email address <b>' . $email . '</b>.'; echo '<br /><small>These informations were send on email address <b>' . $email . '</b>.';
else else {
error('An error occorred while sending email (<b>' . $email . '</b>)! Error:<br/>' . $mailer->ErrorInfo . '<br/>More info in system/logs/error.log'); error('An error occorred while sending email (<b>' . $email . '</b>)! Error:<br/>' . $mailer->ErrorInfo . '<br/>More info in system/logs/error.log');
log_append('error.log', '[createaccount.php] An error occorred while sending email: ' . $mailer->ErrorInfo . '. Error: ' . print_r(error_get_last(), true)); log_append('error.log', '[createaccount.php] An error occorred while sending email: ' . $mailer->ErrorInfo . '. Error: ' . print_r(error_get_last(), true));
}
} }
} }
@@ -210,36 +214,43 @@ if($save)
} }
} }
$country_recognized = null; $country_recognized = null;
if($config['account_country_recognize']) { if($config['account_country_recognize']) {
$country_session = getSession('country');
if($country_session !== false) { // get from session
$country_recognized = $country_session;
}
else {
$info = json_decode(@file_get_contents('http://ipinfo.io/' . $_SERVER['REMOTE_ADDR'] . '/geo'), true); $info = json_decode(@file_get_contents('http://ipinfo.io/' . $_SERVER['REMOTE_ADDR'] . '/geo'), true);
if(isset($info['country'])) { if(isset($info['country'])) {
$country_recognized = strtolower($info['country']); $country_recognized = strtolower($info['country']);
setSession('country', $country_recognized);
} }
} }
}
if(!empty($errors)) if(!empty($errors))
echo $twig->render('error_box.html.twig', array('errors' => $errors)); echo $twig->render('error_box.html.twig', array('errors' => $errors));
if($config['account_country']) { if($config['account_country']) {
$countries = array(); $countries = array();
foreach (array('pl', 'se', 'br', 'us', 'gb') as $c) foreach (array('pl', 'se', 'br', 'us', 'gb') as $c)
$countries[$c] = $config['countries'][$c]; $countries[$c] = $config['countries'][$c];
$countries['--'] = '----------'; $countries['--'] = '----------';
foreach ($config['countries'] as $code => $c) foreach ($config['countries'] as $code => $c)
$countries[$code] = $c; $countries[$code] = $c;
} }
echo $twig->render('account.create.js.html.twig'); echo $twig->render('account.create.js.html.twig');
echo $twig->render('account.create.html.twig', array( echo $twig->render('account.create.html.twig', array(
'account' => isset($_POST['account']) ? $_POST['account'] : '', 'account' => isset($_POST['account']) ? $_POST['account'] : '',
'email' => isset($_POST['email']) ? $_POST['email'] : '', 'email' => isset($_POST['email']) ? $_POST['email'] : '',
'countries' => isset($countries) ? $countries : null, 'countries' => isset($countries) ? $countries : null,
'accept_rules' => isset($_POST['accept_rules']) ? $_POST['accept_rules'] : false, 'accept_rules' => isset($_POST['accept_rules']) ? $_POST['accept_rules'] : false,
'country_recognized' => $country_recognized, 'country_recognized' => $country_recognized,
'country' => isset($country) ? $country : null, 'country' => isset($country) ? $country : null,
'errors' => $errors, 'errors' => $errors,
'save' => $save 'save' => $save
)); ));
?> ?>

View File

@@ -110,21 +110,21 @@ if(empty($_REQUEST['creature']))
$number_of_rows = 0; $number_of_rows = 0;
foreach($monsters as $monster) { foreach($monsters as $monster) {
echo '<TR BGCOLOR="' . getStyle($number_of_rows++) . '"><TD><a href="?subtopic=creatures&creature='.urlencode($monster['name']).'">'.$monster['name'].'</a></TD><TD>'.$monster['health'].'</TD><TD>'.$monster['exp'].'</TD>'; echo '<TR BGCOLOR="' . getStyle($number_of_rows++) . '"><TD><a href="?subtopic=creatures&creature='.urlencode($monster['name']).'">'.$monster['name'].'</a></TD><TD>'.$monster['health'].'</TD><TD>'.$monster['exp'].'</TD>';
if($monster['summonable']) { if($monster['summonable']) {
echo '<TD>'.$monster['mana'].'</TD>'; echo '<TD>'.$monster['mana'].'</TD>';
} }
else { else {
echo '<TD>---</TD>'; echo '<TD>---</TD>';
} }
if($monster['convinceable']) { if($monster['convinceable']) {
echo '<TD>'.$monster['mana'].'</TD>'; echo '<TD>'.$monster['mana'].'</TD>';
} }
else { else {
echo '<TD>---</TD>'; echo '<TD>---</TD>';
} }
echo '<td>'.ucwords($monster['race']).'</td></tr>'; echo '<td>'.ucwords($monster['race']).'</td></tr>';
} }
@@ -170,13 +170,13 @@ if(isset($monster['name']))
echo '</TABLE></td><td align=left> echo '</TABLE></td><td align=left>
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=40%> <TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=40%>
<tr><td align=left>'; <tr><td align=left>';
$monster['gfx_name'] = trim(mb_strtolower($monster['name'])).".gif"; $monster['gfx_name'] = trim(strtolower($monster['name'])).".gif";
if(!file_exists('images/monsters/'.$monster['gfx_name'])) { if(!file_exists('images/monsters/'.$monster['gfx_name'])) {
$gfx_name = str_replace(" ", "", $monster['gfx_name']); $gfx_name = str_replace(" ", "", $monster['gfx_name']);
if(file_exists('images/monsters/' . $gfx_name)) if(file_exists('images/monsters/' . $gfx_name))
echo '<img src="images/monsters/'.$gfx_name.'" height="128" width="128">'; echo '<img src="images/monsters/'.$gfx_name.'" height="128" width="128">';
else else
echo '<img src="images/monsters/nophoto.png" height="128" width="128">'; echo '<img src="images/monsters/nophoto.png" height="128" width="128">';
} }
else else
echo '<img src="images/monsters/' . $monster['gfx_name'] . '" height="128" width="128">'; echo '<img src="images/monsters/' . $monster['gfx_name'] . '" height="128" width="128">';
@@ -190,19 +190,19 @@ if(isset($monster['name']))
$number_of_rows++; $number_of_rows++;
echo '<tr BGCOLOR="'.getStyle($number_of_rows).'"><td width="100"><b>Immunities: </b></td><td width="100%">'.implode(', ', $immunities).'</td></tr>'; echo '<tr BGCOLOR="'.getStyle($number_of_rows).'"><td width="100"><b>Immunities: </b></td><td width="100%">'.implode(', ', $immunities).'</td></tr>';
} }
$voices = json_decode($monster['voices'], true); $voices = json_decode($monster['voices'], true);
if(count($voices) > 0) if(count($voices) > 0)
{ {
foreach($voices as &$voice) { foreach($voices as &$voice) {
$voice = '"' . $voice . '"'; $voice = '"' . $voice . '"';
} }
$number_of_rows++; $number_of_rows++;
echo '<tr BGCOLOR="'.getStyle($number_of_rows).'"><td width="100"><b>Voices: </b></td><td width="100%">'.implode(', ', $voices).'</td></tr>'; echo '<tr BGCOLOR="'.getStyle($number_of_rows).'"><td width="100"><b>Voices: </b></td><td width="100%">'.implode(', ', $voices).'</td></tr>';
} }
echo '</TABLE></td></tr>'; echo '</TABLE></td></tr>';
$loot = json_decode($monster['loot'], true); $loot = json_decode($monster['loot'], true);
if($loot) if($loot)
{ {
@@ -214,18 +214,18 @@ if(isset($monster['name']))
} }
return ($a['chance'] > $b['chance']) ? -1 : 1; return ($a['chance'] > $b['chance']) ? -1 : 1;
} }
usort($loot, 'sort_by_chance'); usort($loot, 'sort_by_chance');
$i = 0; $i = 0;
foreach($loot as $item) { foreach($loot as $item) {
$name = getItemNameById($item['id']); $name = getItemNameById($item['id']);
$tooltip = $name . '<br/>Chance: ' . round($item['chance'] / 1000, 2) . '%<br/>Max count: ' . $item['count']; $tooltip = $name . '<br/>Chance: ' . round($item['chance'] / 1000, 2) . '%<br/>Max count: ' . $item['count'];
echo '<img src="' . $config['item_images_url'] . $item['id'] . '.gif" class="tooltip" title="' . $tooltip . '" width="32" height="32" border="0" alt=" ' .$name . '" />'; echo '<img src="' . $config['item_images_url'] . $item['id'] . '.gif" class="tooltip" title="' . $tooltip . '" width="32" height="32" border="0" alt=" ' .$name . '" />';
$i++; $i++;
} }
echo '</td></tr></TABLE>'; echo '</td></tr></TABLE>';
} }

View File

@@ -28,7 +28,7 @@ if(!$logged)
require_once(LIBS . 'forum.php'); require_once(LIBS . 'forum.php');
$canEdit = hasFlag(FLAG_CONTENT_FORUM) || superAdmin(); $canEdit = Forum::isModerator();
if($canEdit) if($canEdit)
{ {
$groups = new OTS_Groups_List(); $groups = new OTS_Groups_List();
@@ -172,7 +172,7 @@ if(empty($action))
return; return;
} }
$errors = array();
if($action == 'show_board' || $action == 'show_thread') if($action == 'show_board' || $action == 'show_thread')
{ {
require(PAGES . 'forum/' . $action . '.php'); require(PAGES . 'forum/' . $action . '.php');

View File

@@ -18,14 +18,14 @@ if(Forum::canPost($account_logged))
return; return;
} }
$thread = $db->query("SELECT `author_guid`, `author_aid`, `first_post`, `post_topic`, `post_date`, `post_text`, `post_smile`, `id`, `section` FROM `" . TABLE_PREFIX . "forum` WHERE `id` = ".$post_id." LIMIT 1")->fetch(); $thread = $db->query("SELECT `author_guid`, `author_aid`, `first_post`, `post_topic`, `post_date`, `post_text`, `post_smile`, `post_html`, `id`, `section` FROM `" . TABLE_PREFIX . "forum` WHERE `id` = ".$post_id." LIMIT 1")->fetch();
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="' . getLink('forum') . '">Boards</a> >> <a href="' . getForumBoardLink($thread['section']) . '">'.$sections[$thread['section']]['name'].'</a> >> <a href="' . getForumThreadLink($thread['first_post']) . '">'.$first_post['post_topic'].'</a> >> <b>Edit post</b>'; echo '<a href="' . getLink('forum') . '">Boards</a> >> <a href="' . getForumBoardLink($thread['section']) . '">'.$sections[$thread['section']]['name'].'</a> >> <a href="' . getForumThreadLink($thread['first_post']) . '">'.$first_post['post_topic'].'</a> >> <b>Edit post</b>';
if(Forum::hasAccess($thread['section'] && ($account_logged->getId() == $thread['author_aid'] || Forum::isModerator()))) if(Forum::hasAccess($thread['section'] && ($account_logged->getId() == $thread['author_aid'] || Forum::isModerator())))
{ {
$char_id = $post_topic = $text = $smile = null; $char_id = $post_topic = $text = $smile = $html = null;
$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();
$saved = false; $saved = false;
if(isset($_REQUEST['save'])) if(isset($_REQUEST['save']))
@@ -33,9 +33,10 @@ if(Forum::canPost($account_logged))
$text = stripslashes(trim($_REQUEST['text'])); $text = stripslashes(trim($_REQUEST['text']));
$char_id = (int) $_REQUEST['char_id']; $char_id = (int) $_REQUEST['char_id'];
$post_topic = stripslashes(trim($_REQUEST['topic'])); $post_topic = stripslashes(trim($_REQUEST['topic']));
$smile = (int) $_REQUEST['smile']; $smile = isset($_REQUEST['smile']) ? (int)$_REQUEST['smile'] : 0;
$html = isset($_REQUEST['html']) ? (int)$_REQUEST['html'] : 0;
$lenght = 0; $lenght = 0;
for($i = 0; $i <= strlen($post_topic); $i++) for($i = 0; $i < strlen($post_topic); $i++)
{ {
if(ord($post_topic[$i]) >= 33 && ord($post_topic[$i]) <= 126) if(ord($post_topic[$i]) >= 33 && ord($post_topic[$i]) <= 126)
$lenght++; $lenght++;
@@ -43,12 +44,11 @@ if(Forum::canPost($account_logged))
if(($lenght < 1 || strlen($post_topic) > 60) && $thread['id'] == $thread['first_post']) if(($lenght < 1 || strlen($post_topic) > 60) && $thread['id'] == $thread['first_post'])
$errors[] = 'Too short or too long topic (short: '.$lenght.' long: '.strlen($post_topic).' letters). Minimum 1 letter, maximum 60 letters.'; $errors[] = 'Too short or too long topic (short: '.$lenght.' long: '.strlen($post_topic).' letters). Minimum 1 letter, maximum 60 letters.';
$lenght = 0; $lenght = 0;
for($i = 0; $i <= strlen($text); $i++) for($i = 0; $i < strlen($text); $i++)
{ {
if(ord($text[$i]) >= 33 && ord($text[$i]) <= 126) if(ord($text[$i]) >= 33 && ord($text[$i]) <= 126)
$lenght++; $lenght++;
} }
if($lenght < 1 || strlen($text) > 15000) if($lenght < 1 || strlen($text) > 15000)
$errors[] = 'Too short or too long post (short: '.$lenght.' long: '.strlen($text).' letters). Minimum 1 letter, maximum 15000 letters.'; $errors[] = 'Too short or too long post (short: '.$lenght.' long: '.strlen($text).' letters). Minimum 1 letter, maximum 15000 letters.';
if($char_id == 0) if($char_id == 0)
@@ -56,7 +56,7 @@ if(Forum::canPost($account_logged))
if(empty($post_topic) && $thread['id'] == $thread['first_post']) if(empty($post_topic) && $thread['id'] == $thread['first_post'])
$errors[] = 'Thread topic can\'t be empty.'; $errors[] = 'Thread topic can\'t be empty.';
$player_on_account == false; $player_on_account = false;
if(count($errors) == 0) if(count($errors) == 0)
{ {
@@ -71,7 +71,7 @@ if(Forum::canPost($account_logged))
$saved = true; $saved = true;
if($account_logged->getId() != $thread['author_aid']) if($account_logged->getId() != $thread['author_aid'])
$char_id = $thread['author_guid']; $char_id = $thread['author_guid'];
$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` = ".$smile.", `post_html` = ".$html.", `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: ' . getForumThreadLink($thread['first_post'], $_page)); header('Location: ' . getForumThreadLink($thread['first_post'], $_page));
@@ -83,6 +83,7 @@ if(Forum::canPost($account_logged))
$char_id = (int) $thread['author_guid']; $char_id = (int) $thread['author_guid'];
$post_topic = $thread['post_topic']; $post_topic = $thread['post_topic'];
$smile = (int) $thread['post_smile']; $smile = (int) $thread['post_smile'];
$html = (int) $thread['post_html'];
} }
if(!$saved) if(!$saved)
@@ -94,9 +95,12 @@ if(Forum::canPost($account_logged))
'post_id' => $post_id, 'post_id' => $post_id,
'players' => $players_from_account, 'players' => $players_from_account,
'player_id' => $char_id, 'player_id' => $char_id,
'topic' => htmlspecialchars($post_topic), 'post_topic' => $canEdit ? $post_topic : htmlspecialchars($post_topic),
'text' => htmlspecialchars($text), 'post_text' => $canEdit ? $text : htmlspecialchars($text),
'smile' => $smile 'post_smile' => $smile > 0,
'post_html' => $html > 0,
'html' => $html,
'canEdit' => $canEdit
)); ));
} }
} }

View File

@@ -27,7 +27,8 @@ if(Forum::canPost($account_logged))
$text = isset($_REQUEST['text']) ? stripslashes(trim($_REQUEST['text'])) : NULL; $text = isset($_REQUEST['text']) ? stripslashes(trim($_REQUEST['text'])) : NULL;
$char_id = (int) (isset($_REQUEST['char_id']) ? $_REQUEST['char_id'] : 0); $char_id = (int) (isset($_REQUEST['char_id']) ? $_REQUEST['char_id'] : 0);
$post_topic = isset($_REQUEST['topic']) ? stripslashes(trim($_REQUEST['topic'])) : ''; $post_topic = isset($_REQUEST['topic']) ? stripslashes(trim($_REQUEST['topic'])) : '';
$smile = (int) (isset($_REQUEST['smile']) ? $_REQUEST['smile'] : 0); $smile = (isset($_REQUEST['smile']) ? (int)$_REQUEST['smile'] : 0);
$html = (isset($_REQUEST['html']) ? (int)$_REQUEST['html'] : 0);
$saved = false; $saved = false;
if(isset($_REQUEST['quote'])) if(isset($_REQUEST['quote']))
{ {
@@ -72,7 +73,7 @@ if(Forum::canPost($account_logged))
if(count($errors) == 0) if(count($errors) == 0)
{ {
$saved = true; $saved = true;
Forum::add_post($thread['id'], $thread['section'], $account_logged->getId(), (int) $char_id, $text, $post_topic, (int) $smile, time(), $_SERVER['REMOTE_ADDR']); Forum::add_post($thread['id'], $thread['section'], $account_logged->getId(), (int) $char_id, $text, $post_topic, $smile, $html, time(), $_SERVER['REMOTE_ADDR']);
$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;
@@ -85,11 +86,14 @@ if(Forum::canPost($account_logged))
{ {
if(!empty($errors)) if(!empty($errors))
echo $twig->render('error_box.html.twig', array('errors' => $errors)); echo $twig->render('error_box.html.twig', array('errors' => $errors));
$threads = $db->query("SELECT `players`.`name`, `" . TABLE_PREFIX . "forum`.`post_text`, `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`post_smile` 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` DESC LIMIT 5")->fetchAll(); $threads = $db->query("SELECT `players`.`name`, `" . TABLE_PREFIX . "forum`.`post_text`, `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`post_smile`, `" . TABLE_PREFIX . "forum`.`post_html`, `" . TABLE_PREFIX . "forum`.`author_aid` 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` DESC LIMIT 5")->fetchAll();
foreach($threads as &$thread) { foreach($threads as &$thread) {
$thread['post'] = Forum::showPost($thread['post_topic'], $thread['post_text'], $thread['post_smile']); $player_account = new OTS_Account();
$player_account->load($thread['author_aid']);
if($player_account->isLoaded()) {
$thread['post'] = Forum::showPost(($thread['post_html'] > 0 ? $thread['post_topic'] : htmlspecialchars($thread['post_topic'])), ($thread['post_html'] > 0 ? $thread['post_text'] : htmlspecialchars($thread['post_text'])), $thread['post_smile'] == 0, $thread['post_html'] > 0);
}
} }
echo $twig->render('forum.new_post.html.twig', array( echo $twig->render('forum.new_post.html.twig', array(
@@ -98,9 +102,11 @@ if(Forum::canPost($account_logged))
'players' => $players_from_account, 'players' => $players_from_account,
'post_topic' => $post_topic, 'post_topic' => $post_topic,
'post_text' => $text, 'post_text' => $text,
'post_smile' => $smile, 'post_smile' => $smile > 0,
'post_html' => $html > 0,
'topic' => $thread['post_topic'], 'topic' => $thread['post_topic'],
'threads' => $threads 'threads' => $threads,
'canEdit' => $canEdit
)); ));
} }
} }

View File

@@ -24,7 +24,8 @@ if(Forum::canPost($account_logged))
$text = isset($_REQUEST['text']) ? stripslashes($_REQUEST['text']) : ''; $text = isset($_REQUEST['text']) ? stripslashes($_REQUEST['text']) : '';
$char_id = (int)(isset($_REQUEST['char_id']) ? $_REQUEST['char_id'] : 0); $char_id = (int)(isset($_REQUEST['char_id']) ? $_REQUEST['char_id'] : 0);
$post_topic = isset($_REQUEST['topic']) ? stripslashes($_REQUEST['topic']) : ''; $post_topic = isset($_REQUEST['topic']) ? stripslashes($_REQUEST['topic']) : '';
$smile = (int)(isset($_REQUEST['smile']) ? $_REQUEST['smile'] : 0); $smile = (isset($_REQUEST['smile']) ? (int)$_REQUEST['smile'] : 0);
$html = (isset($_REQUEST['html']) ? (int)$_REQUEST['html'] : 0);
$saved = false; $saved = false;
if (isset($_REQUEST['save'])) { if (isset($_REQUEST['save'])) {
$errors = array(); $errors = array();
@@ -68,7 +69,7 @@ if(Forum::canPost($account_logged))
} }
if (count($errors) == 0) { if (count($errors) == 0) {
$saved = true; $saved = true;
$db->query("INSERT INTO `" . TABLE_PREFIX . "forum` (`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 ('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` (`first_post` ,`last_post` ,`section` ,`replies` ,`views` ,`author_aid` ,`author_guid` ,`post_text` ,`post_topic` ,`post_smile`, `post_html` ,`post_date` ,`last_edit_aid` ,`edit_date`, `post_ip`) VALUES ('0', '" . time() . "', '" . (int)$section_id . "', '0', '0', '" . $account_logged->getId() . "', '" . (int)$char_id . "', " . $db->quote($text) . ", " . $db->quote($post_topic) . ", '" . (int)$smile . "', '" . (int)$html . "', '" . time() . "', '0', '0', '" . $_SERVER['REMOTE_ADDR'] . "')");
$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: ' . getForumThreadLink($thread_id)); header('Location: ' . getForumThreadLink($thread_id));
@@ -85,8 +86,10 @@ if(Forum::canPost($account_logged))
'players' => $players_from_account, 'players' => $players_from_account,
'post_player_id' => $char_id, 'post_player_id' => $char_id,
'post_thread' => $post_topic, 'post_thread' => $post_topic,
'text' => $text, 'post_text' => $text,
'smiles_enabled' => $smile > 0 'post_smile' => $smile > 0,
'post_html' => $html > 0,
'canEdit' => $canEdit
)); ));
} }
} }

View File

@@ -13,7 +13,7 @@ defined('MYAAC') or die('Direct access not allowed!');
$links_to_pages = ''; $links_to_pages = '';
$thread_id = (int) $_REQUEST['id']; $thread_id = (int) $_REQUEST['id'];
$_page = (int) (isset($_REQUEST['page']) ? $_REQUEST['page'] : 0); $_page = (int) (isset($_REQUEST['page']) ? $_REQUEST['page'] : 0);
$thread_name = $db->query("SELECT `players`.`name`, `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`section` FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread_id." AND `" . TABLE_PREFIX . "forum`.`id` = `" . TABLE_PREFIX . "forum`.`first_post` AND `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` LIMIT 1")->fetch(); $thread_name = $db->query("SELECT `players`.`name`, `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`section`, `" . TABLE_PREFIX . "forum`.`post_html` FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread_id." AND `" . TABLE_PREFIX . "forum`.`id` = `" . TABLE_PREFIX . "forum`.`first_post` AND `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` LIMIT 1")->fetch();
if(empty($thread_name['name'])) { if(empty($thread_name['name'])) {
echo 'Thread with this ID does not exits.'; echo 'Thread with this ID does not exits.';
@@ -33,11 +33,11 @@ for($i = 0; $i < $posts_count['posts_count'] / $config['forum_threads_per_page']
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`.`post_html`, `" . 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="' . getLink('forum') . '">Boards</a> >> <a href="' . getForumBoardLink($threads[0]['section']) . '">'.$sections[$threads[0]['section']]['name'].'</a> >> <b>'.$thread_name['post_topic'].'</b>'; echo '<a href="' . getLink('forum') . '">Boards</a> >> <a href="' . getForumBoardLink($threads[0]['section']) . '">'.$sections[$threads[0]['section']]['name'].'</a> >> <b>'.($thread_name['post_html'] ? $thread_name['post_topic'] : htmlspecialchars($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>&nbsp;</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>'.($thread_name['post_html'] ? $thread_name['post_topic'] : 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>&nbsp;</td></tr>';
$player = $ots->createObject('Player'); $player = $ots->createObject('Player');
foreach($threads as $thread) foreach($threads as $thread)
{ {
@@ -47,8 +47,8 @@ foreach($threads as $thread)
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 />'; echo '<tr bgcolor="' . getStyle($number_of_rows++) . '"><td valign="top">' . getPlayerLink($thread['name']) . '<br /><br /><font size="1">Profession: '.$player->getVocationName().'<br />Level: '.$thread['level'].'<br />';
$rank = $player->getRank(); $rank = $player->getRank();
if($rank->isLoaded()) if($rank->isLoaded())
{ {
@@ -56,11 +56,9 @@ foreach($threads as $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">'.Forum::showPost(($canEditForum ? $thread['post_topic'] : htmlspecialchars($thread['post_topic'])), ($canEditForum ? $thread['post_text'] : htmlspecialchars($thread['post_text'])), $thread['post_smile']).'</td></tr> echo '<br />Posts: '.(int) $posts['posts'].'<br /></font></td><td valign="top">'.Forum::showPost(($thread['post_html'] > 0 ? $thread['post_topic'] : htmlspecialchars($thread['post_topic'])), ($thread['post_html'] > 0 ? $thread['post_text'] : htmlspecialchars($thread['post_text'])), $thread['post_smile'] == 0, $thread['post_html'] > 0).'</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)
{ {

View File

@@ -11,13 +11,13 @@
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
$guild_name = isset($_REQUEST['guild']) ? urldecode($_REQUEST['guild']) : null; $guild_name = isset($_REQUEST['guild']) ? urldecode($_REQUEST['guild']) : null;
$new_rank = isset($_REQUEST['rank_name']) ? $_REQUEST['rank_name'] : null; $rank_name = isset($_REQUEST['rank_name']) ? $_REQUEST['rank_name'] : null;
if(!Validator::guildName($guild_name)) { if(!Validator::guildName($guild_name)) {
$errors[] = Validator::getLastError(); $errors[] = Validator::getLastError();
} }
if(empty($errors)) { if(empty($errors)) {
if(!Validator::rankName($new_rank)) { if(!Validator::rankName($rank_name)) {
$errors[] = 'Invalid rank name format.'; $errors[] = 'Invalid rank name format.';
} }
if(!$logged) { if(!$logged) {
@@ -45,7 +45,7 @@ if(empty($errors)) {
$new_rank = new OTS_GuildRank(); $new_rank = new OTS_GuildRank();
$new_rank->setGuild($guild); $new_rank->setGuild($guild);
$new_rank->setLevel(1); $new_rank->setLevel(1);
$new_rank->setName($new_rank); $new_rank->setName($rank_name);
$new_rank->save(); $new_rank->save();
header("Location: ?subtopic=guilds&guild=".$guild->getName()."&action=manager"); header("Location: ?subtopic=guilds&guild=".$guild->getName()."&action=manager");
echo 'New rank added. Redirecting...'; echo 'New rank added. Redirecting...';

View File

@@ -32,6 +32,12 @@ if(!$new_nick) {
$player = new OTS_Player(); $player = new OTS_Player();
$player->find($name); $player->find($name);
$player_from_account = false; $player_from_account = false;
if(!Validator::guildNick($new_nick)) {
echo Validator::getLastError();
return;
}
if(strlen($new_nick) <= 40) if(strlen($new_nick) <= 40)
{ {
if($player->isLoaded()) if($player->isLoaded())

View File

@@ -94,7 +94,7 @@ else
{ {
if(isset($_REQUEST['todo']) && $_REQUEST['todo'] == 'save') { if(isset($_REQUEST['todo']) && $_REQUEST['todo'] == 'save') {
$player->setRank(); $player->setRank();
$twig->render('success.html.twig', array( echo $twig->render('success.html.twig', array(
'title' => 'Leave guild', 'title' => 'Leave guild',
'description' => 'Player with name <b>'.$player->getName().'</b> leaved guild <b>'.$guild->getName().'</b>.', 'description' => 'Player with name <b>'.$player->getName().'</b> leaved guild <b>'.$guild->getName().'</b>.',
'custom_buttons' => $twig->render('guilds.back_button.html.twig', array( 'custom_buttons' => $twig->render('guilds.back_button.html.twig', array(

View File

@@ -12,7 +12,7 @@ defined('MYAAC') or die('Direct access not allowed!');
$guild_name = isset($_REQUEST['guild']) ? urldecode($_REQUEST['guild']) : null; $guild_name = isset($_REQUEST['guild']) ? urldecode($_REQUEST['guild']) : null;
if(!Validator::guildName($guild_name)) { if(!Validator::guildName($guild_name)) {
$errors[] = Validator::get; $errors[] = Validator::getLastError();
} }
if(empty($errors)) { if(empty($errors)) {

View File

@@ -10,6 +10,7 @@
*/ */
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
$title = 'Guilds';
$guild_name = isset($_REQUEST['guild']) ? urldecode($_REQUEST['guild']) : null; $guild_name = isset($_REQUEST['guild']) ? urldecode($_REQUEST['guild']) : null;
if(!Validator::guildName($guild_name)) if(!Validator::guildName($guild_name))
$errors[] = Validator::getLastError(); $errors[] = Validator::getLastError();
@@ -41,6 +42,7 @@ else
$players_from_account_in_guild = array(); $players_from_account_in_guild = array();
if($logged) if($logged)
{ {
$players_from_account_ids = array();
$account_players = $account_logged->getPlayers(); $account_players = $account_logged->getPlayers();
foreach($account_players as $player) foreach($account_players as $player)
{ {

View File

@@ -22,11 +22,17 @@ $add_sql = '';
$config_vocations = $config['vocations']; $config_vocations = $config['vocations'];
if($config['highscores_vocation_box'] && isset($vocation)) if($config['highscores_vocation_box'] && isset($vocation))
{ {
for($i = 1; $i < count($config_vocations) / 2; $i++) foreach($config['vocations'] as $id => $name) {
{ if(strtolower($name) == $vocation) {
if(strtolower($config_vocations[$i]) == $vocation) $add_vocs = array($id);
{
$add_sql = 'AND ' . $db->fieldName('vocation') . ' = ' . $db->quote($i); $i = $id + $config['vocations_amount'];
while(isset($config['vocations'][$i])) {
$add_vocs[] = $i;
$i += $config['vocations_amount'];
}
$add_sql = 'AND `vocation` IN (' . implode(', ', $add_vocs) . ')';
break; break;
} }
} }
@@ -121,16 +127,16 @@ 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 . $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); $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.id NOT IN (' . implode(', ', $config['highscores_ids_hidden']) . ') AND 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 . $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); $skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',value,level,vocation' . $promotion . $outfit . ' FROM accounts,players,player_skills WHERE players.id NOT IN (' . implode(', ', $config['highscores_ids_hidden']) . ') AND 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 . $outfit . ',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.id NOT IN (' . implode(', ', $config['highscores_ids_hidden']) . ') AND 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`' .
' ORDER BY value DESC' . ' ORDER BY value DESC' .
' LIMIT 101 OFFSET '.$offset); ' LIMIT 101 OFFSET '.$offset);
@@ -138,10 +144,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 . $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); $skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',maglevel,level,vocation' . $promotion . $outfit . ' FROM accounts, players WHERE players.id NOT IN (' . implode(', ', $config['highscores_ids_hidden']) . ') AND 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 . $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); $skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',level,experience,vocation' . $promotion . $outfit . ' FROM accounts, players WHERE players.id NOT IN (' . implode(', ', $config['highscores_ids_hidden']) . ') AND 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';
} }
} }
@@ -178,6 +184,7 @@ $i = 0;
$online_exist = false; $online_exist = false;
if(fieldExist('online', 'players')) if(fieldExist('online', 'players'))
$online_exist = true; $online_exist = true;
foreach($skills as $player) foreach($skills as $player)
{ {
if(!$online_exist) { if(!$online_exist) {
@@ -211,7 +218,11 @@ echo '
$player['vocation'] += ($player['promotion'] * $config['vocations_amount']); $player['vocation'] += ($player['promotion'] * $config['vocations_amount']);
} }
echo '<br/><small>' . $config['vocations'][$player['vocation']] . '</small>'; $tmp = 'Unknown';
if(isset($config['vocations'][$player['vocation']])) {
$tmp = $config['vocations'][$player['vocation']];
}
echo '<br/><small>' . $tmp . '</small>';
} }
echo ' echo '
</td> </td>
@@ -228,8 +239,10 @@ echo '
$show_link_to_next_page = true; $show_link_to_next_page = true;
} }
if(!$i) if(!$i) {
echo '<tr bgcolor="' . $config['darkborder'] . '"><td colspan="' . ($skill == POT::SKILL__LEVEL ? 5 : 4) . '">No records yet.</td></tr>'; $extra = ($config['highscores_outfit'] ? 1 : 0);
echo '<tr bgcolor="' . $config['darkborder'] . '"><td colspan="' . ($skill == POT::SKILL__LEVEL ? 5 + $extra : 4 + $extra) . '">No records yet.</td></tr>';
}
?> ?>
</table> </table>
@@ -255,7 +268,7 @@ if($config['highscores_country_box'])
echo echo
'<TABLE BORDER=0 width="100%" CELLPADDING=4 CELLSPACING=1> '<TABLE BORDER=0 width="100%" CELLPADDING=4 CELLSPACING=1>
<TR BGCOLOR="' . $config['vdarkborder'] . '"> <TR BGCOLOR="' . $config['vdarkborder'] . '">
<TD CLASS=whites><B>Choose a country</B></TD> <TD CLASS=white><B>Choose a country</B></TD>
</TR> </TR>
<TR BGCOLOR="'.$config['lightborder'].'"> <TR BGCOLOR="'.$config['lightborder'].'">
<TD> <TD>
@@ -271,7 +284,7 @@ if($config['highscores_country_box'])
echo ' echo '
<TABLE BORDER=0 width="100%" CELLPADDING=4 CELLSPACING=1> <TABLE BORDER=0 width="100%" CELLPADDING=4 CELLSPACING=1>
<TR BGCOLOR="'.$config['vdarkborder'].'"> <TR BGCOLOR="'.$config['vdarkborder'].'">
<TD CLASS=whites><B>Choose a skill</B></TD> <TD CLASS=white><B>Choose a skill</B></TD>
</TR> </TR>
<TR BGCOLOR="'.$config['lightborder'].'"> <TR BGCOLOR="'.$config['lightborder'].'">
<TD>'; <TD>';
@@ -302,7 +315,7 @@ if($config['highscores_vocation_box'])
echo echo
'<table border="0" width="100%" cellpadding="4" cellspacing="1"> '<table border="0" width="100%" cellpadding="4" cellspacing="1">
<tr bgcolor="' . $config['vdarkborder'] . '"> <tr bgcolor="' . $config['vdarkborder'] . '">
<td class=whites><b>Choose a vocation</b></td> <td class="white"><b>Choose a vocation</b></td>
</tr> </tr>
<tr bgcolor="'.$config['lightborder'].'"> <tr bgcolor="'.$config['lightborder'].'">
<td> <td>

View File

@@ -45,7 +45,7 @@ if(tableExist('player_killers')) // tfs 0.3
$players_rows .= 'eliminated'; $players_rows .= 'eliminated';
elseif($count > 19) elseif($count > 19)
$players_rows .= 'annihilated'; $players_rows .= 'annihilated';
$players_rows .= 'at level <b>' . $death['level'] . '</b> by '; $players_rows .= 'at level <b>' . $death['level'] . '</b> by ';
} }
else if($i == $count) else if($i == $count)
@@ -76,15 +76,15 @@ if(tableExist('player_killers')) // tfs 0.3
$players_rows .= '.</TD>'; $players_rows .= '.</TD>';
if($config['multiworld']) if($config['multiworld'])
$player_rows .= '<TD>'.$config['worlds'][(int)$death['world_id']].'</TD>'; $player_rows .= '<TD>'.$config['worlds'][(int)$death['world_id']].'</TD>';
$players_rows .= '</TR>'; $players_rows .= '</TR>';
} }
} }
} }
else { else {
//$players_deaths = $db->query("SELECT `p`.`name` AS `victim`, `player_deaths`.`killed_by` as `killed_by`, `player_deaths`.`time` as `time`, `player_deaths`.`is_player` as `is_player`, `player_deaths`.`level` as `level` FROM `player_deaths`, `players` as `d` INNER JOIN `players` as `p` ON player_deaths.player_id = p.id WHERE player_deaths.`is_player`='1' ORDER BY `time` DESC LIMIT " . $config['last_kills_limit'] . ";"); //$players_deaths = $db->query("SELECT `p`.`name` AS `victim`, `player_deaths`.`killed_by` as `killed_by`, `player_deaths`.`time` as `time`, `player_deaths`.`is_player` as `is_player`, `player_deaths`.`level` as `level` FROM `player_deaths`, `players` as `d` INNER JOIN `players` as `p` ON player_deaths.player_id = p.id WHERE player_deaths.`is_player`='1' ORDER BY `time` DESC LIMIT " . $config['last_kills_limit'] . ";");
$players_deaths = $db->query("SELECT `p`.`name` AS `victim`, `d`.`killed_by` as `killed_by`, `d`.`time` as `time`, `d`.`level`, `d`.`is_player` FROM `player_deaths` as `d` INNER JOIN `players` as `p` ON d.player_id = p.id ORDER BY `time` DESC LIMIT 20;"); $players_deaths = $db->query("SELECT `p`.`name` AS `victim`, `d`.`killed_by` as `killed_by`, `d`.`time` as `time`, `d`.`level`, `d`.`is_player`, `d`.`mostdamage_by` as `mostdamage_by`, `d`.`mostdamage_is_player` as `mostdamage_is_player` FROM `player_deaths` as `d` INNER JOIN `players` as `p` ON d.player_id = p.id ORDER BY `time` DESC LIMIT " . $config['last_kills_limit'] . ";");
if(!empty($players_deaths)) if(!empty($players_deaths))
{ {
@@ -95,7 +95,15 @@ $players_deaths = $db->query("SELECT `p`.`name` AS `victim`, `d`.`killed_by` as
$players_rows .= getPlayerLink($death['killed_by']); $players_rows .= getPlayerLink($death['killed_by']);
else else
$players_rows .= $death['killed_by']; $players_rows .= $death['killed_by'];
if (!empty($death['mostdamage_by'])) {
$player_rows .= ' and ';
if($death['mostdamage_is_player'] == '1')
$players_rows .= getPlayerLink($death['mostdamage_by']);
else
$players_rows .= $death['mostdamage_by'];
}
$players_rows .= '.</TR>'; $players_rows .= '.</TR>';
} }
} }

View File

@@ -387,7 +387,7 @@ class News
if(!self::verify($title, $body, $article_text, $article_image, $errors)) if(!self::verify($title, $body, $article_text, $article_image, $errors))
return false; return false;
$db->insert(TABLE_PREFIX . 'news', array('title' => $title, 'body' => $body, 'type' => $type, 'date' => time(), 'category' => $category, 'player_id' => isset($player_id) ? $player_id : 0, 'comments' => $comments, 'article_text' => $article_text, 'article_image' => $article_image)); $db->insert(TABLE_PREFIX . 'news', array('title' => $title, 'body' => $body, 'type' => $type, 'date' => time(), 'category' => $category, 'player_id' => isset($player_id) ? $player_id : 0, 'comments' => $comments, 'article_text' => ($type == 3 ? $article_text : ''), 'article_image' => ($type == 3 ? $article_image : '')));
return true; return true;
} }

View File

@@ -13,31 +13,6 @@ $title = 'Polls';
/* Polls System By Averatec from pervera.pl & otland.net */ /* Polls System By Averatec from pervera.pl & otland.net */
if(!tableExist('z_polls'))
$db->query('
CREATE TABLE `z_polls` (
`id` int(11) NOT NULL auto_increment,
`question` varchar(255) NOT NULL,
`description` varchar(255) NOT NULL,
`end` int(11) NOT NULL DEFAULT 0,
`start` int(11) NOT NULL DEFAULT 0,
`answers` int(11) NOT NULL DEFAULT 0,
`votes_all` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;');
if(!tableExist('z_polls_answers'))
$db->query('
CREATE TABLE `z_polls_answers` (
`poll_id` int(11) NOT NULL,
`answer_id` int(11) NOT NULL,
`answer` varchar(255) NOT NULL,
`votes` int(11) NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=latin1;');
if(!fieldExist('vote', 'accounts'))
$db->query('ALTER TABLE `accounts` ADD `vote` INT( 11 ) NOT NULL ;');
function getColorByPercent($percent) function getColorByPercent($percent)
{ {
if($percent < 15) if($percent < 15)

View File

@@ -75,8 +75,13 @@ if(isset($config['lua']['statustimeout']))
// get status timeout from server config // get status timeout from server config
$status_timeout = eval('return ' . $config['lua']['statusTimeout'] . ';') / 1000 + 1; $status_timeout = eval('return ' . $config['lua']['statusTimeout'] . ';') / 1000 + 1;
if($status['lastCheck'] + $status_timeout < time()) if($status['lastCheck'] + $status_timeout < time()) {
{ updateStatus();
}
function updateStatus() {
global $db, $cache, $config, $status, $status_ip, $status_port;
// get server status and save it to database // get server status and save it to database
$serverInfo = new OTS_ServerInfo($status_ip, $status_port); $serverInfo = new OTS_ServerInfo($status_ip, $status_port);
$serverStatus = $serverInfo->status(); $serverStatus = $serverInfo->status();
@@ -98,9 +103,14 @@ if($status['lastCheck'] + $status_timeout < time())
if($config['online_afk']) if($config['online_afk'])
{ {
// get amount of players that are currently logged in-game, including disconnected clients (exited) // get amount of players that are currently logged in-game, including disconnected clients (exited)
$query = $db->query('SELECT COUNT(' . $db->fieldName('id') . ') AS playersTotal FROM ' . $db->tableName('players') . if(tableExist('players_online')) { // tfs 1.x
' WHERE ' . $db->fieldName('online') . ' > 0'); $query = $db->query('SELECT COUNT(`player_id`) AS `playersTotal` FROM `players_online`;');
}
else {
$query = $db->query('SELECT COUNT(`id`) AS `playersTotal` FROM `players` WHERE `online` > 0');
}
$status['playersTotal'] = 0;
if($query->rowCount() > 0) if($query->rowCount() > 0)
{ {
$query = $query->fetch(); $query = $query->fetch();
@@ -132,5 +142,4 @@ if($status['lastCheck'] + $status_timeout < time())
foreach($status as $key => $value) { foreach($status as $key => $value) {
updateDatabaseConfig('status_' . $key, $value); updateDatabaseConfig('status_' . $key, $value);
} }
} }
?>

View File

@@ -15,42 +15,38 @@ if($config['template_allow_change'])
{ {
if(isset($_GET['template'])) if(isset($_GET['template']))
{ {
$template_name = $_GET['template'];
if(!preg_match("/[^A-z0-9_\-]/", $template_name)) { // validate template if(!preg_match("/[^A-z0-9_\-]/", $template_name)) { // validate template
//setcookie('template', $template_name, 0, BASE_DIR . '/', $_SERVER["SERVER_NAME"]); //setcookie('template', $template_name, 0, BASE_DIR . '/', $_SERVER["SERVER_NAME"]);
$template_name = $_GET['template'];
setSession('template', $template_name); setSession('template', $template_name);
header('Location:' . getSession('last_uri')); header('Location:' . getSession('last_uri'));
} }
else
$template_name = $config['template'];
} }
else { else {
$template_session = getSession('template'); $template_session = getSession('template');
if ($template_session !== false) { if ($template_session !== false) {
if (!preg_match("/[^A-z0-9_\-]/", $template_session)) { if (!preg_match("/[^A-z0-9_\-]/", $template_session)) {
$template_name = $template_session; $template_name = $template_session;
} else {
$template_name = $config['template'];
} }
} }
} }
} }
$template_path = 'templates/' . $template_name; $template_path = 'templates/' . $template_name;
if(!file_exists($template_path . '/index.php') && if(!file_exists(BASE . $template_path . '/index.php') &&
!file_exists($template_path . '/template.php') && !file_exists(BASE . $template_path . '/template.php') &&
!file_exists($template_path . '/layout.php')) !file_exists(BASE . $template_path . '/layout.php'))
{ {
$template_name = 'kathrine'; $template_name = 'kathrine';
$template_path = TEMPLATES . $template_name; $template_path = 'templates/' . $template_name;
} }
$file = $template_path . '/config.ini'; $file = BASE . $template_path . '/config.ini';
$exists = file_exists($file); $exists = file_exists($file);
if($exists || ($config['backward_support'] && file_exists($template_path . '/layout_config.ini'))) if($exists || ($config['backward_support'] && file_exists(BASE . $template_path . '/layout_config.ini')))
{ {
if(!$exists) if(!$exists)
$file = $template_path . '/layout_config.ini'; $file = BASE . $template_path . '/layout_config.ini';
if($cache->enabled()) if($cache->enabled())
{ {
@@ -69,8 +65,8 @@ if($exists || ($config['backward_support'] && file_exists($template_path . '/lay
foreach($template_ini as $key => $value) foreach($template_ini as $key => $value)
$config[$key] = $value; $config[$key] = $value;
} }
else if(file_exists($template_path . '/config.php')) else if(file_exists(BASE . $template_path . '/config.php'))
require($template_path . '/config.php'); require(BASE . $template_path . '/config.php');
$template = array(); $template = array();
$template['link_account_manage'] = getLink('account/manage'); $template['link_account_manage'] = getLink('account/manage');

View File

@@ -51,7 +51,17 @@
<div id="two"> <div id="two">
<h1>My account</h1> <h1>My account</h1>
<p>Welcome to your account page, {{ account }}<br> <p>Welcome to your account page, {{ account }}<br>
You have {{ account_logged.getPremDays() }} days remaining premium account.</p> {% if config.lua.freePremium %}
You have unlimited Premium Account.
{% else %}
{% set premiumDays = account_logged.getPremDays() %}
{% if premiumDays == 0 %}
You don't have Premium Account
{% else %}
You have {{ premiumDays }} days remaining Premium Account.
{% endif %}
{% endif %}
</p>
{# if account dont have recovery key show hint #} {# if account dont have recovery key show hint #}
{% if recovery_key is empty %} {% if recovery_key is empty %}
@@ -74,6 +84,7 @@
</div> </div>
<br/><br/> <br/><br/>
{% endif %} {% endif %}
<a name="General+Information"></a>
<h2>General Information</h2> <h2>General Information</h2>
<table width="100%"> <table width="100%">
<tr style="background-color: {{ config.lightborder }};" > <tr style="background-color: {{ config.lightborder }};" >
@@ -108,6 +119,7 @@
{% endautoescape %} {% endautoescape %}
</table> </table>
<br/> <br/>
<a name="Public+Information"></a>
<h2>Public Information</h2> <h2>Public Information</h2>
<table width="100%"> <table width="100%">
<tr style="background-color: {{ config.lightborder }};" > <tr style="background-color: {{ config.lightborder }};" >
@@ -123,6 +135,7 @@
<input type="submit" value="Change Info" /> <input type="submit" value="Change Info" />
</form> </form>
<br/> <br/>
<a name="Account+Logs" ></a>
<h2>Action Log</h2> <h2>Action Log</h2>
<table> <table>
<tr bgcolor="{{ config.vdarkborder }}" class="white"> <tr bgcolor="{{ config.vdarkborder }}" class="white">
@@ -141,6 +154,7 @@
{% endautoescape %} {% endautoescape %}
</table> </table>
<br/> <br/>
<a name="Characters" ></a>
<h2>Character list: {{ players|length }} characters.</h2> <h2>Character list: {{ players|length }} characters.</h2>
<table> <table>
<tr bgcolor="{{ config.vdarkborder }}" class="white"> <tr bgcolor="{{ config.vdarkborder }}" class="white">
@@ -150,7 +164,7 @@
{% for player in players %} {% for player in players %}
{% set i = i + 1 %} {% set i = i + 1 %}
<tr bgcolor="{{ getStyle(i) }}"> <tr bgcolor="{{ getStyle(i) }}">
<td><a href="{{ getLink('characters/' ~ player.getName()|urlencode) }}">{{ player.getName() }}</a></td><td>{{ player.getLevel() }}</td><td>{{ config.vocations[player.getVocation()] }}</td><td>{{ config.towns[player.getTownId()] }}</td><td>{% if player.getLastLogin() > 0 %}{{ player.getLastLogin|date('d F Y (H:i)') }}{% else %}Never.{% endif %}</td><td>{% if player.isOnline() %}<font color="green">ONLINE</font>{% else %}<font color="red">Offline</font>{% endif %}</td><td>{% if player.isHidden() %}Hidden{% else %}Visible{% endif %}</td><td>[<a href="{{ getLink('account/character/comment/' ~ player.getName|urlencode) }}" >Edit</a>]</td> <td><a href="{{ getLink('characters/' ~ player.getName()|urlencode) }}">{{ player.getName() }}</a></td><td>{{ player.getLevel() }}</td><td>{{ player.getVocationName() }}</td><td>{{ config.towns[player.getTownId()] }}</td><td>{% if player.getLastLogin() > 0 %}{{ player.getLastLogin|date('d F Y (H:i)') }}{% else %}Never.{% endif %}</td><td>{% if player.isOnline() %}<font color="green">ONLINE</font>{% else %}<font color="red">Offline</font>{% endif %}</td><td>{% if player.isHidden() %}Hidden{% else %}Visible{% endif %}</td><td>[<a href="{{ getLink('account/character/comment/' ~ player.getName|urlencode) }}" >Edit</a>]</td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>

View File

@@ -35,7 +35,7 @@
{% if status.online %} {% 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/>
{{ status.uptimeReadable }}, {{ status.players }}/{{ status.playersMax }}<br/> {{ status.uptimeReadable }}, {{ status.players }}/{{ status.playersMax }}<br/>
{{ status.lua.ip }} : {{ status.lua.loginPort }} {{ config.lua.ip }} : {{ config.lua.loginPort }}
<br/><br/><u><a id="more-button" href="#"></a></u> <br/><br/><u><a id="more-button" href="#"></a></u>
<span id="status-more"> <span id="status-more">
@@ -74,4 +74,4 @@
return false; return false;
}); });
</script> </script>
{% endif %} {% endif %}

View File

@@ -3,8 +3,8 @@
tinymce.init({ tinymce.init({
selector : "textarea", selector : "textarea",
theme : "modern", theme : "modern",
plugins: 'print preview searchreplace autolink directionality visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor toc insertdatetime advlist lists textcolor wordcount spellchecker imagetools contextmenu colorpicker textpattern help code', plugins: 'print preview searchreplace autolink directionality visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor toc insertdatetime advlist lists textcolor wordcount spellchecker imagetools contextmenu colorpicker textpattern help code emoticons',
toolbar1: 'formatselect | bold italic strikethrough forecolor backcolor | link | alignleft aligncenter alignright alignjustify | numlist bullist outdent indent | removeformat code', toolbar1: 'formatselect | bold italic strikethrough forecolor backcolor | emoticons link | alignleft aligncenter alignright alignjustify | numlist bullist outdent indent | removeformat code',
image_advtab: true, image_advtab: true,
relative_urls : false, relative_urls : false,
remove_script_host : false, remove_script_host : false,

View File

@@ -19,7 +19,12 @@
</tr> </tr>
<tr> <tr>
<td>PHP:</td> <td>PHP:</td>
<td><input type="checkbox" id="php" name="php" title="Check if page should be executed as PHP" value="1"{% if php %} checked="true"{% endif %}{% if action == 'edit' %} disabled{% endif %}/></td> <td>
<input type="checkbox" id="php" name="php" title="Check if page should be executed as PHP" value="1"{% if php %} checked="true"{% endif %}{% if action == 'edit' %} disabled{% endif %}/>
{% if action == 'edit' %}
<input type="hidden" name="php" value="{% if php %}1{% else %}0{% endif %}"/>
{% endif %}
</td>
</tr> </tr>
<tr> <tr>
<td>Content:</td> <td>Content:</td>
@@ -74,8 +79,8 @@
tinymce.init({ tinymce.init({
selector : "#body", selector : "#body",
theme : "modern", theme : "modern",
plugins: 'code print preview searchreplace autolink directionality visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor toc insertdatetime advlist lists textcolor wordcount spellchecker imagetools contextmenu colorpicker textpattern help', plugins: 'code print preview searchreplace autolink directionality visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor toc insertdatetime advlist lists textcolor wordcount spellchecker imagetools contextmenu colorpicker textpattern help emoticons',
toolbar1: 'formatselect | bold italic strikethrough forecolor backcolor | link | alignleft aligncenter alignright alignjustify | numlist bullist outdent indent | removeformat code', toolbar1: 'formatselect | bold italic strikethrough forecolor backcolor | emoticons link | alignleft aligncenter alignright alignjustify | numlist bullist outdent indent | removeformat code',
image_advtab: true, image_advtab: true,
relative_urls : false, relative_urls : false,
remove_script_host : false, remove_script_host : false,

View File

@@ -23,7 +23,7 @@
{% endfor %} {% endfor %}
{% else %} {% else %}
<tr> <tr>
<td bgcolor="{{ config.lightborder }}">There are no change logs for the moment.</td> <td colspan="4" bgcolor="{{ config.darkborder }}">There are no changelogs for the moment.</td>
</tr> </tr>
{% endif %} {% endif %}

View File

@@ -256,10 +256,11 @@
</tr> </tr>
{% set i = 0 %} {% set i = 0 %}
{% for frag in frags %} {% for frag in frags %}
<tr bgcolor="'{{ getStyle(i) }}"> <tr bgcolor="{{ getStyle(i) }}">
<td width="20%" align="center">{{ frag.time|date("j M Y, H:i") }}</td> <td width="20%" align="center">{{ frag.time|date("j M Y, H:i") }}</td>
<td>{{ frag.description|raw }}({% if frag.unjustified %}<font size="1" color="red">Unjustified</font>{% else %}<font size="1" color="green">Justified</font>{% endif %})</td> <td>{{ frag.description|raw }}({% if frag.unjustified %}<font size="1" color="red">Unjustified</font>{% else %}<font size="1" color="green">Justified</font>{% endif %})</td>
</tr> </tr>
{% set i = i + 1 %}
{% endfor %} {% endfor %}
</table> </table>
<!-- FRAGS_END --> <!-- FRAGS_END -->
@@ -380,12 +381,8 @@
<td> <td>
<nobr>{{ i }}.&#160;{{ player.getName() }}{% if player.isDeleted() %}<font color="red"> [DELETED]</font>{% endif %}</nobr> <nobr>{{ i }}.&#160;{{ player.getName() }}{% if player.isDeleted() %}<font color="red"> [DELETED]</font>{% endif %}</nobr>
</td> </td>
{% set vocation = 'Unknown' %}
{% if config.vocations[player.getVocation()] is defined %}
{% set vocation = config.vocations[player.getVocation()] %}
{% endif %}
<td>{{ player.getLevel() }} {{ vocation }}</td> <td>{{ player.getLevel() }} {{ player.getVocationName() }}</td>
<td>{% if player.isOnline() %}<b><font color="green">Online</font></b>{% endif %}</td> <td>{% if player.isOnline() %}<b><font color="green">Online</font></b>{% endif %}</td>
<td> <td>
<table border="0" cellspacing="0" cellpadding="0"> <table border="0" cellspacing="0" cellpadding="0">

View File

@@ -17,9 +17,9 @@
{% set i = i + 1 %} {% set i = i + 1 %}
<tr bgcolor="{{ getStyle(i) }}"> <tr bgcolor="{{ getStyle(i) }}">
<td colspan="2" style="cursor: pointer;" onclick="toggleVisibility('faq_{{ i }}'); return false;"> <td colspan="2" style="cursor: pointer;" onclick="toggleVisibility('faq_{{ i }}'); return false;">
<b>{{ faq.question }}</b> <b>{{ faq.question|raw }}</b>
<div id="faq_{{ i }}" style="display: none;">{{ faq.answer }}</div> <div id="faq_{{ i }}" style="display: none;">{{ faq.answer|raw }}</div>
</td> </td>
{% if canEdit %} {% if canEdit %}
<td> <td>

View File

@@ -22,21 +22,27 @@
</tr> </tr>
<tr bgcolor="{{ config.lightborder }}"> <tr bgcolor="{{ config.lightborder }}">
<td><b>Topic:</b></td> <td><b>Topic:</b></td>
<td><input type="text" value="{{ topic|raw }}" name="topic" size="40" maxlength="60" /> (Optional)</td> <td><input type="text" value="{{ post_topic|raw }}" name="topic" size="40" maxlength="60" /> (Optional)</td>
</tr> </tr>
<tr bgcolor="{{ config.darkborder }}"> <tr bgcolor="{{ config.darkborder }}">
<td valign="top"><b>Message:</b><font size="1"><br/>You can use:<br/>[player]Nick[/player]<br />[url]http://address.com/[/url]<br />[img]http://images.com/images3.gif[/img]<br />[code]Code[/code]<br />[b]<b>Text</b>[/b]<br />[i]<i>Text</i>[/i]<br/>[u]<u>Text</u>[/u]<br />and smileys:<br />;) , :) , :D , :( , :rolleyes:<br />:cool: , :eek: , :o , :p</font> <td valign="top"><b>Message:</b><font size="1"><br/>You can use:<br/>[player]Nick[/player]<br />[url]http://address.com/[/url]<br />[img]http://images.com/images3.gif[/img]<br />[code]Code[/code]<br />[b]<b>Text</b>[/b]<br />[i]<i>Text</i>[/i]<br/>[u]<u>Text</u>[/u]<br />and smileys:<br />;) , :) , :D , :( , :rolleyes:<br />:cool: , :eek: , :o , :p</font>
</td> </td>
<td> <td>
<textarea rows="10" cols="60" name="text">{{ text|raw }}</textarea><br />(Max. 15,000 letters) <textarea rows="10" cols="60" name="text">{{ post_text|raw }}</textarea><br />(Max. 15,000 letters)
</td> </td>
</tr> </tr>
<tr bgcolor="{{ config.lightborder }}"> <tr bgcolor="{{ config.lightborder }}">
<td valign="top">Options:</td> <td valign="top">Options:</td>
<td> <td>
<label> <label>
<input type="checkbox" name="smile" value="1"{% if smile == 1 %} checked="checked"{% endif %}/>Disable Smileys in This Post <input type="checkbox" name="smile" value="1"{% if post_smile %} checked="checked"{% endif %}/>Disable Smileys in This Post
</label> </label>
{% if canEdit %}
<br/>
<label>
<input type="checkbox" name="html" value="1"{% if post_html %} checked="checked"{% endif %}/>Enable HTML in this post (moderator only)
</label>
{% endif %}
</td> </td>
</tr> </tr>
</table> </table>

View File

@@ -28,7 +28,17 @@
</tr> </tr>
<tr bgcolor="{{ config.lightborder }}"> <tr bgcolor="{{ config.lightborder }}">
<td valign="top">Options:</td> <td valign="top">Options:</td>
<td><label><input type="checkbox" name="smile" value="1"{% if post_smile == 1 %} checked="checked"{% endif %}/>Disable Smileys in This Post </label></td> <td>
<label>
<input type="checkbox" name="smile" value="1"{% if post_smile %} checked="checked"{% endif %}/>Disable Smileys in This Post
</label>
{% if canEdit %}
<br/>
<label>
<input type="checkbox" name="html" value="1"{% if post_html %} checked="checked"{% endif %}/>Enable HTML in this post (moderator only)
</label>
{% endif %}
</td>
</tr> </tr>
</table> </table>
<center> <center>

View File

@@ -25,11 +25,21 @@
</tr> </tr>
<tr bgcolor="{{ config.darkborder }}"> <tr bgcolor="{{ config.darkborder }}">
<td valign="top"><b>Message:</b><font size="1"><br />You can use:<br />[player]Nick[/player]<br />[url]http://address.com/[/url]<br />[img]http://images.com/images3.gif[/img]<br />[code]Code[/code]<br />[b]<b>Text</b>[/b]<br />[i]<i>Text</i>[/i]<br />[u]<u>Text</u>[/u]<br />and smileys:<br />;) , :) , :D , :( , :rolleyes:<br />:cool: , :eek: , :o , :p</font></td> <td valign="top"><b>Message:</b><font size="1"><br />You can use:<br />[player]Nick[/player]<br />[url]http://address.com/[/url]<br />[img]http://images.com/images3.gif[/img]<br />[code]Code[/code]<br />[b]<b>Text</b>[/b]<br />[i]<i>Text</i>[/i]<br />[u]<u>Text</u>[/u]<br />and smileys:<br />;) , :) , :D , :( , :rolleyes:<br />:cool: , :eek: , :o , :p</font></td>
<td><textarea rows="10" cols="60" name="text">{{ text|escape }}</textarea><br />(Max. 15,000 letters)</td> <td><textarea rows="10" cols="60" name="text">{{ post_text|escape }}</textarea><br />(Max. 15,000 letters)</td>
</tr> </tr>
<tr bgcolor="{{ config.lightborder }}"> <tr bgcolor="{{ config.lightborder }}">
<td valign="top">Options:</td> <td valign="top">Options:</td>
<td><label><input type="checkbox" name="smile" value="1"{% if smiles_enabled %} checked="checked"{% endif %}/>Disable Smileys in This Post </label></td> <td>
<label>
<input type="checkbox" name="smile" value="1"{% if post_smile %} checked="checked"{% endif %}/>Disable Smileys in This Post
</label>
{% if canEdit %}
<br/>
<label>
<input type="checkbox" name="html" value="1"{% if post_html %} checked="checked"{% endif %}/>Enable HTML in this post (moderator only)
</label>
{% endif %}
</td>
</tr> </tr>
</table> </table>
<center> <center>

View File

@@ -23,5 +23,10 @@
{% endfor %} {% endfor %}
</table> </table>
{% if errors is defined %}
{% for error in errors %}
<p class="error">{{ error }}</p>
{% endfor %}
{% endif %}
{{ buttons|raw }} {{ buttons|raw }}
</form> </form>

View File

@@ -23,7 +23,7 @@
<br/> <br/>
<select name="vars[client]" id="vars_client"> <select name="vars[client]" id="vars_client">
{% for id, version in clients %} {% for id, version in clients %}
<option value="{{ id }}">{{ version }}</option> <option value="{{ id }}"{% if session['var_client'] is not null and session['var_client'] == id %} selected{% endif %}>{{ version }}</option>
{% endfor %} {% endfor %}
</select> </select>
</td> </td>
@@ -38,7 +38,7 @@
</label> </label>
<br/> <br/>
<input type="hidden" value="0" name="vars[usage]"> <input type="hidden" value="0" name="vars[usage]">
<input type="checkbox" name="vars[usage]" id="vars_usage" value="1" checked/> <input type="checkbox" name="vars[usage]" id="vars_usage" value="1"{% if session['var_usage'] is null or session['var_usage'] == 1 %} checked{% endif %}/>
</td> </td>
<td> <td>
<em>{{ locale.step_config_usage_desc }}</em> <em>{{ locale.step_config_usage_desc }}</em>

View File

@@ -1,17 +1,7 @@
<script type="text/javascript" src="{{ constant('BASE_URL') }}tools/tinymce/tinymce.min.js"></script>
<script type="text/javascript">
tinymce.init({
selector : "#body",
theme : "modern",
plugins: 'print preview searchreplace autolink directionality visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor toc insertdatetime advlist lists textcolor wordcount spellchecker imagetools contextmenu colorpicker textpattern help code',
toolbar1: 'formatselect | bold italic strikethrough forecolor backcolor | link | alignleft aligncenter alignright alignjustify | numlist bullist outdent indent | removeformat code',
image_advtab: true
});
</script>
{% if action != 'edit' %} {% if action != 'edit' %}
<a id="news-button" href="#">Add news</a> <a id="news-button" href="#">Add news</a>
{% endif %} {% endif %}
<form method="post" action="{{ news_link_form }}"> <form method="post" action="{{ news_link_form }}" id="news-edit-form">
{% if action == 'edit' %} {% if action == 'edit' %}
<input type="hidden" name="id" value="{{ news_id }}" /> <input type="hidden" name="id" value="{{ news_id }}" />
{% endif %} {% endif %}
@@ -47,7 +37,7 @@
</tr> </tr>
{% set rows = rows + 1 %} {% set rows = rows + 1 %}
<tr id="article-text" bgcolor="{{ getStyle(rows) }}"{% if article_text is empty %} style="display: none;"{% endif %}> <tr id="article-text" bgcolor="{{ getStyle(rows) }}"{% if type is not defined or type != constant('ARTICLE') %} style="display: none;"{% endif %}>
<td><b>Article short text:<br/>This will be displayed on news page.<br/>Rest will be available on "read more" page.</b></td> <td><b>Article short text:<br/>This will be displayed on news page.<br/>Rest will be available on "read more" page.</b></td>
<td> <td>
<textarea name="article_text">{% if article_text is not empty %}{{ article_text }}{% endif %}</textarea> <textarea name="article_text">{% if article_text is not empty %}{{ article_text }}{% endif %}</textarea>
@@ -55,7 +45,7 @@
</tr> </tr>
{% set rows = rows + 1 %} {% set rows = rows + 1 %}
<tr id="article-image" bgcolor="{{ getStyle(rows) }}"{% if article_image is empty %} style="display: none;"{% endif %}> <tr id="article-image" bgcolor="{{ getStyle(rows) }}"{% if type is not defined or type != constant('ARTICLE') %} style="display: none;"{% endif %}>
<td><b>Article image:</b></td> <td><b>Article image:</b></td>
<td> <td>
<input type="text" name="article_image" value="{% if article_image is not empty %}{{ article_image }}{% else %}images/news/announcement.jpg{% endif %}" /> <input type="text" name="article_image" value="{% if article_image is not empty %}{{ article_image }}{% else %}images/news/announcement.jpg{% endif %}" />
@@ -121,7 +111,7 @@
<input type="submit" value="Submit"/> <input type="submit" value="Submit"/>
</td> </td>
<td align="left"> <td align="left">
<input type="button" onclick="window.location = '{{ news_link }}';" value="Cancel"/> <input id="cancel" type="button" value="Cancel"/>
</td> </td>
</tr> </tr>
</table> </table>
@@ -150,4 +140,49 @@
}); });
}); });
</script> </script>
{% endif %} {% endif %}
<script type="text/javascript" src="{{ constant('BASE_URL') }}tools/tinymce/tinymce.min.js"></script>
<script type="text/javascript">
var unsaved = false;
var lastContent = '';
tinymce.init({
selector : "#body",
theme : "modern",
plugins: 'print preview searchreplace autolink directionality visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor toc insertdatetime advlist lists textcolor wordcount spellchecker imagetools contextmenu colorpicker textpattern help code emoticons',
toolbar1: 'formatselect | bold italic strikethrough forecolor backcolor | emoticons link | alignleft aligncenter alignright alignjustify | numlist bullist outdent indent | removeformat code',
image_advtab: true,
setup: function(ed){
ed.on('NodeChange', function(e) {
if(ed.getContent() != lastContent) {
unsaved = true;
}
});
}
});
$(document).ready(function() {
$(":input").change(function(){ //trigers change in all input fields including text type
unsaved = true;
});
$("#cancel").click(function( event ) {
unsaved = false;
window.location = '{{ news_link }}';
});
$("#news-edit-form").submit(function( event ) {
unsaved = false;
});
lastContent = $("#body").val();
});
function unloadPage(){
if(unsaved){
return "You have unsaved changes on this page. Do you want to leave this page and discard your changes or stay on this page?";
}
}
window.onbeforeunload = unloadPage;
</script>

View File

@@ -3,7 +3,7 @@
<td class="white"><b>Server Status</b></td> <td class="white"><b>Server Status</b></td>
</tr> </tr>
{% if players|length == 0 %} {% if players|length == 0 %}
<tr bgcolor="{{ config.darkborder }}"><td>Currently no one is playing on {{ config.lua.serverName }}.</td></tr></table> <tr bgcolor="{{ config.darkborder }}"><td>Currently no one is playing on&nbsp;{{ config.lua.serverName }}.</td></tr></table>
{% else %} {% else %}
<tr bgcolor="{{ config.darkborder }}"> <tr bgcolor="{{ config.darkborder }}">
<td> <td>
@@ -14,7 +14,7 @@
{% set players_count = players|length %} {% set players_count = players|length %}
{% set afk = players_count - status.players %} {% set afk = players_count - status.players %}
{% if afk < 0 %} {% if afk < 0 %}
{% set players = players + afk|abs %} {% set players_count = players_count + afk|abs %}
{% set afk = 0 %} {% set afk = 0 %}
{% endif %} {% endif %}
Currently there are <b>{{ status.players }}</b> active and <b>{{ afk }}</b> AFK players.<br/> Currently there are <b>{{ status.players }}</b> active and <b>{{ afk }}</b> AFK players.<br/>
@@ -26,6 +26,7 @@
</td> </td>
</tr> </tr>
</table> </table>
<br/>
{# vocation statistics #} {# vocation statistics #}
{% if config.online_vocations %} {% if config.online_vocations %}
<br/> <br/>
@@ -101,7 +102,7 @@
<td>{{ player.country_image|raw }}</td> <td>{{ player.country_image|raw }}</td>
{% endif %} {% endif %}
{% if config.online_outfit %} {% if config.online_outfit %}
<td width="5%"><img style="position:absolute;margin-top:{% if player.looktype in [75, 266, 302] %}-20px;margin-left:-0px;{% else %}-45px;margin-left:-25px;{% endif %}" src="{{ player.outfit }}" alt="player outfit"/></td> <td width="5%"><img style="position:absolute;margin-top:{% if player.player.looktype in [75, 266, 302] %}-20px;margin-left:-0px;{% else %}-45px;margin-left:-25px;{% endif %}" src="{{ player.outfit }}" alt="player outfit"/></td>
{% endif %} {% endif %}
<td>{{ player.name|raw }}{{ player.skull }}</td> <td>{{ player.name|raw }}{{ player.skull }}</td>
<td>{{ player.level }}</td> <td>{{ player.level }}</td>

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 351 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

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