Compare commits
193 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
6e221fe469 | ||
![]() |
679e08ec11 | ||
![]() |
603495ca97 | ||
![]() |
4c6af13574 | ||
![]() |
3fcbd42445 | ||
![]() |
e6d2e363d5 | ||
![]() |
0a067577a3 | ||
![]() |
a5b599088a | ||
![]() |
51ba514d2a | ||
![]() |
b83fb05b82 | ||
![]() |
cf12265cd8 | ||
![]() |
e4110a6981 | ||
![]() |
412908026d | ||
![]() |
8a7887cf06 | ||
![]() |
779dd003dd | ||
![]() |
0b2895dc56 | ||
![]() |
fed5d08703 | ||
![]() |
f131f27ac3 | ||
![]() |
19dbbdcf4f | ||
![]() |
d650035980 | ||
![]() |
fbc803d09f | ||
![]() |
df4c594d4f | ||
![]() |
482445cb98 | ||
![]() |
1c002c63a3 | ||
![]() |
cd366b6087 | ||
![]() |
83dc5b7650 | ||
![]() |
d9675b1bc6 | ||
![]() |
036520566c | ||
![]() |
8b302749ff | ||
![]() |
68b3e2cfee | ||
![]() |
9ee6906e4d | ||
![]() |
be38f51cc7 | ||
![]() |
aaed21f752 | ||
![]() |
a1dddd7df8 | ||
![]() |
f26795ca7a | ||
![]() |
7d6bbb3385 | ||
![]() |
37f792d9ce | ||
![]() |
867c86d702 | ||
![]() |
05f8756a12 | ||
![]() |
c581c35a73 | ||
![]() |
b37bd5f0ae | ||
![]() |
56a01e1e64 | ||
![]() |
6aa58bddd8 | ||
![]() |
0515f2825a | ||
![]() |
0d37e07a0d | ||
![]() |
ab69b182e6 | ||
![]() |
7b84614a79 | ||
![]() |
361e536243 | ||
![]() |
39fee6e57d | ||
![]() |
56a0c6e6bf | ||
![]() |
eb8993e746 | ||
![]() |
edeb781600 | ||
![]() |
9aa4e308c1 | ||
![]() |
05abf41b64 | ||
![]() |
ac9c43e280 | ||
![]() |
c05e7f29c5 | ||
![]() |
583f3394fc | ||
![]() |
5e414ebda8 | ||
![]() |
21b1383c9a | ||
![]() |
6c9e09ea73 | ||
![]() |
195ec4b11e | ||
![]() |
bf988a7f6e | ||
![]() |
25f8028ae3 | ||
![]() |
28299744c4 | ||
![]() |
72212f8256 | ||
![]() |
1610a4ab91 | ||
![]() |
87a3d1e5d1 | ||
![]() |
2b6d65e955 | ||
![]() |
cd44d28674 | ||
![]() |
2edeb1b3e2 | ||
![]() |
9f946d4bc4 | ||
![]() |
5266f33af5 | ||
![]() |
85c9a1e84d | ||
![]() |
5951fe21ec | ||
![]() |
c6b6638705 | ||
![]() |
8ab7be9fb8 | ||
![]() |
762fa31c28 | ||
![]() |
c2678aa91f | ||
![]() |
d4900eac84 | ||
![]() |
f9b6e9fa2e | ||
![]() |
cfb460c137 | ||
![]() |
f9e6966687 | ||
![]() |
913b4297cf | ||
![]() |
23c1df72aa | ||
![]() |
cde42ec3fa | ||
![]() |
0104d2fd36 | ||
![]() |
85d1f3419a | ||
![]() |
e45d27b5c7 | ||
![]() |
a3d94db6eb | ||
![]() |
ef904c854b | ||
![]() |
7a7eb4e553 | ||
![]() |
c7f549742d | ||
![]() |
1850ef70d8 | ||
![]() |
0b693a02bd | ||
![]() |
508db95cba | ||
![]() |
bbae0c3ade | ||
![]() |
0239f940a0 | ||
![]() |
1df0c2b313 | ||
![]() |
a9d9ace532 | ||
![]() |
cb83e17710 | ||
![]() |
1727df7082 | ||
![]() |
3d585a3d02 | ||
![]() |
69f822b69c | ||
![]() |
abfe3b08af | ||
![]() |
66a3c46aaf | ||
![]() |
c914a73352 | ||
![]() |
5041ed1564 | ||
![]() |
4daaa67710 | ||
![]() |
dd572b00d0 | ||
![]() |
3fef1a6eec | ||
![]() |
6d81a29bb6 | ||
![]() |
3f1c638a14 | ||
![]() |
7caca74d57 | ||
![]() |
d95aea319e | ||
![]() |
9aed09d250 | ||
![]() |
3ebcd788fb | ||
![]() |
816751f464 | ||
![]() |
f84ae88aa4 | ||
![]() |
315e0400ff | ||
![]() |
22cf7f5d4f | ||
![]() |
6ec829e47f | ||
![]() |
a119d75589 | ||
![]() |
92028a2492 | ||
![]() |
42ef8487c8 | ||
![]() |
e92e5d1040 | ||
![]() |
a1950cf27e | ||
![]() |
27fb0ffb06 | ||
![]() |
6c3439acf9 | ||
![]() |
005356ebb3 | ||
![]() |
f0adabf567 | ||
![]() |
739782109e | ||
![]() |
87ba018ab8 | ||
![]() |
041702615f | ||
![]() |
0a82f306f6 | ||
![]() |
856e72150c | ||
![]() |
e2857f8ca5 | ||
![]() |
04d9ec9c94 | ||
![]() |
e984a467ef | ||
![]() |
8342a7b8a8 | ||
![]() |
269af1930c | ||
![]() |
b7bb950abc | ||
![]() |
4a19458c15 | ||
![]() |
b6db420465 | ||
![]() |
7b234ad41f | ||
![]() |
35b0795b51 | ||
![]() |
04a7796665 | ||
![]() |
755deae717 | ||
![]() |
6d66dc9043 | ||
![]() |
bbd9cd2101 | ||
![]() |
b6ccde075d | ||
![]() |
e94b9006e6 | ||
![]() |
e9c8159bf3 | ||
![]() |
919f69ef46 | ||
![]() |
4ac2fe27d5 | ||
![]() |
be2daeb4ab | ||
![]() |
7b96ce9b8c | ||
![]() |
801188f957 | ||
![]() |
c546a46847 | ||
![]() |
6527d21794 | ||
![]() |
7fad722927 | ||
![]() |
ab249eb95f | ||
![]() |
bdbd215aad | ||
![]() |
68212a36bb | ||
![]() |
ac3691dc08 | ||
![]() |
3a6aab67d5 | ||
![]() |
2c5b3f4da3 | ||
![]() |
73eca63c4f | ||
![]() |
c504588993 | ||
![]() |
5b14c6d4d4 | ||
![]() |
4685c7b868 | ||
![]() |
0e185c8bcf | ||
![]() |
e230949edd | ||
![]() |
a897b5e98c | ||
![]() |
186d3dbd38 | ||
![]() |
127c04070b | ||
![]() |
6ff65050f5 | ||
![]() |
d605ef4b28 | ||
![]() |
9466b7ce75 | ||
![]() |
7f6eff666e | ||
![]() |
e878b4df48 | ||
![]() |
2c3c1529a7 | ||
![]() |
ecce524c7b | ||
![]() |
5af617b869 | ||
![]() |
3f886c9f7c | ||
![]() |
d50fb7a291 | ||
![]() |
37502c5562 | ||
![]() |
7620ec896b | ||
![]() |
8a87186833 | ||
![]() |
b0f8013762 | ||
![]() |
3a6a1c448a | ||
![]() |
2cd9f80b34 | ||
![]() |
d88de8e072 | ||
![]() |
6e6ce55a7b |
@@ -1,33 +1,7 @@
|
||||
Options -Indexes -MultiViews
|
||||
|
||||
RewriteEngine On
|
||||
#RewriteBase /
|
||||
|
||||
# Page parser
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^([A-Za-z0-9-_+']+)\.png/?$ tools/signature/index.php?name=$1 [L]
|
||||
RewriteRule ^characters/([A-Za-z0-9-_+']+)$ index.php?subtopic=characters&name=$1
|
||||
RewriteRule ^guilds/([A-Za-z0-9-_+']+)$ index.php?subtopic=guilds&action=show&guild=$1
|
||||
RewriteRule ^forum/board/([0-9]+)$ index.php?subtopic=forum&action=show_board&id=$1
|
||||
RewriteRule ^forum/board/([0-9]+)/([0-9]+)$ index.php?subtopic=forum&action=show_board&id=$1&page=$2
|
||||
RewriteRule ^forum/thread/([0-9]+)$ index.php?subtopic=forum&action=show_thread&id=$1
|
||||
RewriteRule ^forum/thread/([0-9]+)/([0-9]+)$ index.php?subtopic=forum&action=show_thread&id=$1&page=$2
|
||||
RewriteRule ^forum/board/([0-9]+)/([0-9]+)$ index.php?subtopic=forum&action=show_thread&id=$1&page=$2
|
||||
RewriteRule ^account/manage$ index.php?subtopic=accountmanagement
|
||||
RewriteRule ^account/create$ index.php?subtopic=createaccount
|
||||
RewriteRule ^account/lost$ index.php?subtopic=lostaccount
|
||||
RewriteRule ^account/logout$ index.php?subtopic=accountmanagement&action=logout
|
||||
RewriteRule ^news/archive/([0-9]+)$ index.php?subtopic=newsarchive&id=$1
|
||||
RewriteRule ^news/archive$ index.php?subtopic=newsarchive
|
||||
RewriteRule ^highscores/([A-Za-z0-9-_]+)/([A-Za-z0-9-_]+)?$ index.php?subtopic=highscores&list=$1&vocation=$2
|
||||
RewriteRule ^highscores/([A-Za-z0-9-_']+)$ index.php?subtopic=highscores&list=$1
|
||||
RewriteRule ^polls/([0-9]+)$ index.php?subtopic=polls&id=$1
|
||||
RewriteRule ^admin/$ admin/index.php
|
||||
RewriteRule ^install/$ install/index.php
|
||||
|
||||
# temp solution >.>
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^([A-Za-z0-9-_]+)/?$ index.php?p=$1 [L]
|
||||
RewriteRule ^([A-Za-z0-9-_]+)/([A-Za-z0-9-_]+)?$ index.php?p=$1&action=$2 [L]
|
||||
RewriteRule ^.*$ index.php [L]
|
475
CHANGELOG
@@ -1,156 +1,387 @@
|
||||
[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
|
||||
* 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
|
||||
* 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)
|
||||
* 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
|
||||
* 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
|
||||
* 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
|
||||
* 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"
|
||||
* 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
|
||||
* 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
|
||||
* this is just release to update version number
|
||||
|
||||
[0.1.2 - 11.05.2017]
|
||||
- forgot to update CHANGELOG and MYAAC_VERSION
|
||||
* 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
|
||||
* 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
|
||||
* 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
|
||||
* 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
|
||||
* 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
|
||||
* 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()
|
||||
* 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.
|
||||
|
@@ -1,11 +1,11 @@
|
||||
# myaac
|
||||
MyAAC is a free and open-source Automatic Account Creator (AAC) written in PHP. It is a fork of the [Gesior](https://github.com/gesior/Gesior2012) project. It supports only MySQL databases.
|
||||
MyAAC is a free and open-source Automatic Account Creator (AAC) 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: http://my-aac.org
|
||||
Official website: https://my-aac.org
|
||||
|
||||
### REQUIREMENTS
|
||||
|
||||
- PHP 5.2.0 or later
|
||||
- PHP 5.3.0 or later
|
||||
- MySQL database
|
||||
- PDO PHP Extension
|
||||
- XML PHP Extension
|
||||
@@ -27,7 +27,7 @@ Official website: http://my-aac.org
|
||||
chmod 660 config.local.php
|
||||
chmod 660 images/guilds
|
||||
chmod 660 images/houses
|
||||
chmod 660 images/screenshots
|
||||
chmod 660 images/gallery
|
||||
|
||||
Visit http://your_domain/install (http://localhost/install) and follow instructions in the browser.
|
||||
|
||||
|
37
TODO
Normal file
@@ -0,0 +1,37 @@
|
||||
// MyAAC TODO
|
||||
|
||||
0.*
|
||||
* support duplicated vocation names with different ids
|
||||
* plugins: option to define custom requirements check in json file, to check if system meets the requirement
|
||||
* add support for defining max myaac version in plugin.json file
|
||||
* cache Menus in templates
|
||||
* don't show error indicators on first time load - createaccount page
|
||||
* update Twig to the latest version from 1.x branch
|
||||
* semantic versioning support for plugins (github.com/composer/semver)
|
||||
* add some notice to the user that installing step "Import Schema" will take some time
|
||||
* check user IP on installing to prevent install by random user
|
||||
|
||||
1.0:
|
||||
* i18n support (issue #1 on github)
|
||||
* New Admin Panel layout and interface
|
||||
* add changelog management interface
|
||||
* remove tibiacom template, and include it as a plugin
|
||||
|
||||
2.0
|
||||
* remove compat functions
|
||||
* folder restructure:
|
||||
* var/ (for logs, cache and data), config/, bin, public/ (for index and images and other public content), system/ (for php files and classess)
|
||||
* rename templates to layouts as templates is meant to be used for twig templates
|
||||
* change gifts_system to shop_system configurable
|
||||
* move most used options in system/templates dir to separate directories (more transparent)
|
||||
|
||||
At any time between (version not specified):
|
||||
* better news archive with search function (like on tibia.com)
|
||||
* guild wars management (issue #13 on github)
|
||||
* update account.management page to be more realistic (like on tibia.com)
|
||||
* update guilds page to be more realistic (like on tibia.com)
|
||||
* possibility to add extra cache engines with plugins
|
||||
* preferably configurable (enable/disable) forum TinyMCE editor
|
||||
* new cache engine - plain php, is good with pure php 7.0+ and opcache
|
||||
* OTAdmin support in Admin Panel
|
||||
* database towns table support for TFS 1.3
|
@@ -9,6 +9,8 @@ if(file_exists(BASE . 'install') && (!isset($config['installed']) || !$config['i
|
||||
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!');
|
||||
}
|
||||
|
||||
define('ADMIN_PANEL', true);
|
||||
|
||||
$content = '';
|
||||
|
||||
// validate page
|
||||
@@ -25,6 +27,9 @@ require(SYSTEM . 'status.php');
|
||||
require(SYSTEM . 'login.php');
|
||||
require(ADMIN . 'includes/functions.php');
|
||||
|
||||
$twig->addGlobal('config', $config);
|
||||
$twig->addGlobal('status', $status);
|
||||
|
||||
// if we're not logged in - show login box
|
||||
if(!$logged || !admin()) {
|
||||
$page = 'login';
|
||||
|
@@ -28,7 +28,7 @@ h1, h2, h3, h4, h5, h6 {color: #313334; font-weight: bold;}
|
||||
margin-left:5px;
|
||||
}
|
||||
|
||||
.button { background:#eee url(images/button.gif) repeat-x 0 0; border:solid 1px #b1a874; color:#7f7f7f; font-size:11px; padding:2px 6px 2px 6px; cursor:pointer; line-height:14px !important; }
|
||||
.button { background:#eee repeat-x 0 0; border:solid 1px #b1a874; color:#7f7f7f; font-size:11px; padding:2px 6px 2px 6px; cursor:pointer; line-height:14px !important; }
|
||||
.button:hover { color:#333; border-color:#857b42; }
|
||||
|
||||
.field, .button { -moz-border-radius:4px; -webkit-border-radius:4px; }
|
||||
@@ -126,7 +126,7 @@ a.ico:hover { color:#333;}
|
||||
font-size: 12px;
|
||||
}
|
||||
#status .success {
|
||||
margin: 0px:
|
||||
margin: 0px;
|
||||
}
|
||||
#version {
|
||||
position: absolute; top: 10px; right: 10px;
|
||||
|
@@ -26,7 +26,7 @@
|
||||
<a href="<?php echo BASE_URL; ?>" target="_blank">Preview</a> <span class="separator">|</span> <a href="?action=logout">Log out<img src="<?php echo BASE_URL; ?>images/icons/logout.png" alt="" title="Log out" /></a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<h1><?php echo $config['lua']['serverName'] . ' - ' . $title; ?> - Admin Panel</h1>
|
||||
<h1><?php echo $config['lua']['serverName'] . (isset($title) ? ' - ' . $title : ''); ?> - Admin Panel</h1>
|
||||
</div>
|
||||
<div id="wrapper">
|
||||
<?php
|
||||
@@ -39,10 +39,12 @@
|
||||
'Dashboard' => 'dashboard',
|
||||
'Mailer' => 'mailer',
|
||||
'Pages' => 'pages',
|
||||
'Menus' => 'menus',
|
||||
'Plugins' => 'plugins',
|
||||
'Statistics' => 'statistics',
|
||||
'Visitors' => 'visitors',
|
||||
'Players' => 'players',
|
||||
'Items' => 'items',
|
||||
'Tools' => array(
|
||||
'phpinfo' => 'phpinfo'
|
||||
),
|
||||
@@ -78,6 +80,19 @@
|
||||
}
|
||||
echo '</li>';
|
||||
}
|
||||
|
||||
$query = $db->query('SELECT `name`, `page`, `flags` FROM `' . TABLE_PREFIX . 'admin_menu` ORDER BY `ordering`');
|
||||
$menu_db = $query->fetchAll();
|
||||
foreach($menu_db as $item) {
|
||||
if($item['flags'] == 0 || hasFlag($item['flags'])) {
|
||||
echo '<li><h3>
|
||||
<a href="?p=' . $item['page'] . '">';
|
||||
if($page == $item['page']) echo '<u>';
|
||||
echo $item['name'];
|
||||
if($page == $item['page']) echo '</u>';
|
||||
echo '</a></h3></li>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
|
41
common.php
@@ -21,14 +21,13 @@
|
||||
* @package MyAAC
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
* @copyright 2017 MyAAC
|
||||
* @version 0.3.0
|
||||
* @link http://my-aac.org
|
||||
*/
|
||||
session_start();
|
||||
|
||||
define('MYAAC', true);
|
||||
define('MYAAC_VERSION', '0.3.0');
|
||||
define('DATABASE_VERSION', 7);
|
||||
define('MYAAC_VERSION', '0.7.5');
|
||||
define('DATABASE_VERSION', 20);
|
||||
define('TABLE_PREFIX', 'myaac_');
|
||||
define('START_TIME', microtime(true));
|
||||
define('MYAAC_OS', (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? 'WINDOWS' : (strtoupper(PHP_OS) == 'DARWIN' ? 'MAC' : 'LINUX'));
|
||||
@@ -43,12 +42,14 @@ define('FLAG_CONTENT_FORUM', 32);
|
||||
define('FLAG_CONTENT_COMMANDS', 64);
|
||||
define('FLAG_CONTENT_SPELLS', 128);
|
||||
define('FLAG_CONTENT_MONSTERS', 256);
|
||||
define('FLAG_CONTENT_SCREENSHOTS', 512);
|
||||
define('FLAG_CONTENT_MOVIES', 1024);
|
||||
define('FLAG_CONTENT_GALLERY', 512);
|
||||
define('FLAG_CONTENT_VIDEOS', 1024);
|
||||
define('FLAG_CONTENT_FAQ', 2048);
|
||||
define('FLAG_CONTENT_MENUS', 4096);
|
||||
|
||||
// news
|
||||
define('NEWS', 1);
|
||||
define('TICKET', 2);
|
||||
define('TICKER', 2);
|
||||
define('ARTICLE', 3);
|
||||
|
||||
// directories
|
||||
@@ -59,10 +60,19 @@ define('CACHE', SYSTEM . 'cache/');
|
||||
define('LOCALE', SYSTEM . 'locale/');
|
||||
define('LIBS', SYSTEM . 'libs/');
|
||||
define('LOGS', SYSTEM . 'logs/');
|
||||
define('PAGES', SYSTEM . 'pages/');
|
||||
define('PLUGINS', BASE . 'plugins/');
|
||||
define('TEMPLATES', BASE . 'templates/');
|
||||
define('TOOLS', BASE . 'tools/');
|
||||
|
||||
// menu categories
|
||||
define('MENU_CATEGORY_NEWS', 1);
|
||||
define('MENU_CATEGORY_ACCOUNT', 2);
|
||||
define('MENU_CATEGORY_COMMUNITY', 3);
|
||||
define('MENU_CATEGORY_FORUM', 4);
|
||||
define('MENU_CATEGORY_LIBRARY', 5);
|
||||
define('MENU_CATEGORY_SHOP', 6);
|
||||
|
||||
// otserv versions
|
||||
define('OTSERV', 1);
|
||||
define('OTSERV_06', 2);
|
||||
@@ -84,12 +94,15 @@ $basedir = str_replace('/admin', '', $basedir);
|
||||
$basedir = str_replace('/install', '', $basedir);
|
||||
define('BASE_DIR', $basedir);
|
||||
|
||||
if(isset($_SERVER['HTTPS'][0]) && $_SERVER['HTTPS'] == 'on')
|
||||
define('SERVER_URL', 'https://' . $_SERVER['HTTP_HOST']);
|
||||
else
|
||||
define('SERVER_URL', 'http://' . $_SERVER['HTTP_HOST']);
|
||||
|
||||
define('BASE_URL', SERVER_URL . BASE_DIR . '/');
|
||||
define('ADMIN_URL', SERVER_URL . BASE_DIR . '/admin/');
|
||||
//define('CURRENT_URL', BASE_URL . $_SERVER['REQUEST_URI']);
|
||||
if(isset($_SERVER['HTTP_HOST'])) {
|
||||
if (isset($_SERVER['HTTPS'][0]) && $_SERVER['HTTPS'] == 'on')
|
||||
define('SERVER_URL', 'https://' . $_SERVER['HTTP_HOST']);
|
||||
else
|
||||
define('SERVER_URL', 'http://' . $_SERVER['HTTP_HOST']);
|
||||
|
||||
define('BASE_URL', SERVER_URL . BASE_DIR . '/');
|
||||
define('ADMIN_URL', SERVER_URL . BASE_DIR . '/admin/');
|
||||
|
||||
//define('CURRENT_URL', BASE_URL . $_SERVER['REQUEST_URI']);
|
||||
}
|
||||
?>
|
||||
|
31
config.php
@@ -13,7 +13,6 @@
|
||||
* @package MyAAC
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
* @copyright 2017 MyAAC
|
||||
* @version 0.3.0
|
||||
* @link http://my-aac.org
|
||||
*/
|
||||
|
||||
@@ -30,11 +29,13 @@ $config = array(
|
||||
// used for the Downloads page and some templates aswell
|
||||
'client' => 1098, // 954 = client 9.54
|
||||
|
||||
'session_prefix' => 'myaac_', // must be unique for every site on your server
|
||||
'friendly_urls' => false, // mod_rewrite is required for this, it makes links looks more elegant to eye, and also are SEO friendly (example: http://my-aac.org/guilds/Testing instead of http://my-aac.org/?subtopic=guilds&name=Testing). Remember to rename .htaccess.dist to .htaccess
|
||||
'gzip_output' => false, // gzip page content before sending it to the browser, uses less bandwidth but more cpu cycles
|
||||
|
||||
// gesior backward support (templates & pages)
|
||||
// allows using gesior templates and pages with myaac
|
||||
// might bring some performance when disabled
|
||||
'backward_support' => true,
|
||||
|
||||
// head options (html)
|
||||
@@ -45,7 +46,7 @@ $config = array(
|
||||
// footer
|
||||
'footer' => ''/*'<br/>Your Server © 2016. All rights reserved.'*/,
|
||||
|
||||
'debug_level' => 0, // 0 - disabled, 1 - show load time, 2 - show db query counter, 3 - both, 4 - memory usage, 5 - load time & load time, 6 - queries & memory usage, 7 - all
|
||||
'debug_level' => 0, // 0 - disabled, 1 - show load time, 2 - show db query counter, 3 - both, 4 - memory usage, 5 - load time & memory usage, 6 - queries & memory usage, 7 - all
|
||||
|
||||
'language' => 'en', // default language (currently only 'en' available)
|
||||
'language_allow_change' => false,
|
||||
@@ -65,16 +66,16 @@ $config = array(
|
||||
'database_password' => '',
|
||||
'database_name' => '',
|
||||
|
||||
// multiworld system
|
||||
// multiworld system (only TFS 0.3)
|
||||
'multiworld' => false, // use multiworld system?
|
||||
'worlds' => array( // list of worlds
|
||||
//'1' => 'Your World Name',
|
||||
//'2' => 'Your Second World Name'
|
||||
),
|
||||
|
||||
// items
|
||||
// images
|
||||
'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_management' => true, // disable if you're using other method to manage users (fe. tfs account manager)
|
||||
@@ -109,7 +110,7 @@ $config = array(
|
||||
|
||||
// reCAPTCHA (prevent spam bots)
|
||||
'recaptcha_enabled' => false, // enable recaptcha verification code
|
||||
'recaptcha_site_key' => '', // get your own public and private keys at https://www.google.com/recaptcha
|
||||
'recaptcha_site_key' => '', // get your own site and secret keys at https://www.google.com/recaptcha
|
||||
'recaptcha_secret_key' => '',
|
||||
'recaptcha_theme' => 'light', // light, dark
|
||||
|
||||
@@ -157,7 +158,8 @@ $config = array(
|
||||
|
||||
'signature_enabled' => true,
|
||||
'signature_type' => 'tibian', // signature engine to use: tibian, mango, gesior
|
||||
'signature_cache_time' => 5, // how long to store cached file (in minutes)
|
||||
'signature_cache_time' => 5, // how long to store cached file (in minutes), default 5 minutes
|
||||
'signature_browser_cache' => 60, // how long to cache by browser (in minutes), default 1 hour
|
||||
|
||||
// online page
|
||||
'online_record' => true, // display players record?
|
||||
@@ -184,6 +186,8 @@ $config = array(
|
||||
'highscores_outfit' => true, // show player outfit?
|
||||
'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_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
|
||||
|
||||
// characters page
|
||||
'characters' => array( // what things to display on character view page (true/false in each option)
|
||||
@@ -201,14 +205,17 @@ $config = array(
|
||||
),
|
||||
|
||||
// news page
|
||||
'news_limit' => 5, // limit of news on latest news page
|
||||
'news_limit' => 5, // limit of news on the latest news page
|
||||
'news_ticker_limit' => 5, // limit of news in tickers (mini news) (0 to disable)
|
||||
'news_date_format' => 'j.n.Y', // check php manual date() function for more info about this
|
||||
'news_author' => true,
|
||||
'news_author' => true, // show author of the news
|
||||
|
||||
// gifts/shop system
|
||||
'gifts_system' => false,
|
||||
|
||||
|
||||
// support/system
|
||||
'bug_report' => true, // this configurable has no effect, its always enabled
|
||||
|
||||
// forum
|
||||
'forum' => 'site', // link to the server forum, set to "site" if you want to use build in forum system, otherwise leave empty if you aren't going to use any forum
|
||||
'forum_level_required' => 0, // level required to post, 0 to disable
|
||||
@@ -224,11 +231,13 @@ $config = array(
|
||||
'status_port' => '',
|
||||
|
||||
// other
|
||||
'anonymous_usage_statistics' => true,
|
||||
'email_lai_sec_interval' => 60, // time in seconds between e-mails to one account from lost account interface, block spam
|
||||
'google_analytics_id' => '', // e.g.: UA-XXXXXXX-X
|
||||
'experiencetable_columns' => 5, // how many columns to display in experience table page. * experiencetable_rows, 5 = 500 (will show up to 500 level)
|
||||
'experiencetable_rows' => 100, // till how many levels in one column
|
||||
|
||||
'date_timezone' => 'Europe/Berlin', // more info at http://php.net/manual/en/timezones.php
|
||||
|
||||
'monsters' => array(),
|
||||
'npc' => array()
|
||||
);
|
||||
|
BIN
images/changelog/unknown.png
Normal file
After Width: | Height: | Size: 797 B |
Before Width: | Height: | Size: 122 KiB After Width: | Height: | Size: 122 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
BIN
images/global/general/blank.gif
Executable file
After Width: | Height: | Size: 71 B |
BIN
images/global/general/box-bottom.gif
Executable file
After Width: | Height: | Size: 2.0 KiB |
BIN
images/global/general/box-top.gif
Executable file
After Width: | Height: | Size: 2.0 KiB |
BIN
images/global/general/chain.gif
Executable file
After Width: | Height: | Size: 845 B |
BIN
images/global/general/favicon.ico
Executable file
After Width: | Height: | Size: 3.6 KiB |
BIN
images/global/general/hide.gif
Executable file
After Width: | Height: | Size: 469 B |
BIN
images/global/general/minus.gif
Executable file
After Width: | Height: | Size: 224 B |
BIN
images/global/general/nok.gif
Executable file
After Width: | Height: | Size: 117 B |
BIN
images/global/general/ok.gif
Executable file
After Width: | Height: | Size: 113 B |
BIN
images/global/general/plus.gif
Executable file
After Width: | Height: | Size: 224 B |
BIN
images/global/general/show.gif
Executable file
After Width: | Height: | Size: 681 B |
BIN
images/items/empty.gif
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
images/news/announcement.jpg
Normal file
After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
BIN
images/plus.png
Normal file
After Width: | Height: | Size: 9.1 KiB |
264
index.php
@@ -21,7 +21,6 @@
|
||||
* @package MyAAC
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
* @copyright 2017 MyAAC
|
||||
* @version 0.3.0
|
||||
* @link http://my-aac.org
|
||||
*/
|
||||
|
||||
@@ -31,29 +30,145 @@
|
||||
// error_reporting(E_ALL);
|
||||
|
||||
require_once('common.php');
|
||||
require_once(BASE . 'config.local.php');
|
||||
require_once(SYSTEM . 'functions.php');
|
||||
|
||||
$uri = $_SERVER['REQUEST_URI'];
|
||||
|
||||
$tmp = BASE_DIR;
|
||||
if(!empty($tmp))
|
||||
$uri = str_replace(BASE_DIR . '/', '', $uri);
|
||||
else
|
||||
$uri = str_replace_first('/', '', $uri);
|
||||
|
||||
$uri = str_replace(array('index.php/', '?'), '', $uri);
|
||||
define('URI', $uri);
|
||||
|
||||
if(preg_match("/^[A-Za-z0-9-_%\'+]+\.png$/i", $uri)) {
|
||||
$tmp = explode('.', $uri);
|
||||
$_REQUEST['name'] = urldecode($tmp[0]);
|
||||
|
||||
chdir(TOOLS . 'signature');
|
||||
include(TOOLS . 'signature/index.php');
|
||||
exit();
|
||||
}
|
||||
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");
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once(BASE . 'config.local.php');
|
||||
if(file_exists(BASE . 'install') && (!isset($config['installed']) || !$config['installed']))
|
||||
{
|
||||
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!');
|
||||
}
|
||||
|
||||
$found = false;
|
||||
if(empty($uri) || isset($_REQUEST['template'])) {
|
||||
$_REQUEST['p'] = 'news';
|
||||
$found = true;
|
||||
}
|
||||
else {
|
||||
$tmp = strtolower($uri);
|
||||
if(!preg_match('/[^A-z0-9_\-]/', $uri) && file_exists(SYSTEM . 'pages/' . $tmp . '.php')) {
|
||||
$_REQUEST['p'] = $uri;
|
||||
$found = true;
|
||||
}
|
||||
else {
|
||||
$rules = array(
|
||||
'/^account\/manage\/?$/' => array('subtopic' => 'accountmanagement'),
|
||||
'/^account\/create\/?$/' => array('subtopic' => 'createaccount'),
|
||||
'/^account\/lost\/?$/' => array('subtopic' => 'lostaccount'),
|
||||
'/^account\/logout\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'logout'),
|
||||
'/^account\/password\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_password'),
|
||||
'/^account\/register\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'register'),
|
||||
'/^account\/register\/new\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'register_new'),
|
||||
'/^account\/email\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_email'),
|
||||
'/^account\/info\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_info'),
|
||||
'/^account\/character\/create\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'create_character'),
|
||||
'/^account\/character\/name\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_name'),
|
||||
'/^account\/character\/sex\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_sex'),
|
||||
'/^account\/character\/delete\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'delete_character'),
|
||||
'/^account\/character\/comment\/[A-Za-z0-9-_%+\']+\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_comment', 'name' => '$3'),
|
||||
'/^account\/character\/comment\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_comment'),
|
||||
'/^account\/confirm_email\/[A-Za-z0-9-_]+\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'confirm_email', 'v' => '$2'),
|
||||
'/^characters\/[A-Za-z0-9-_%+\']+$/' => array('subtopic' => 'characters', 'name' => '$1'),
|
||||
'/^changelog\/[0-9]+\/?$/' => array('subtopic' => 'changelog', 'page' => '$1'),
|
||||
'/^commands\/add\/?$/' => array('subtopic' => 'commands', 'action' => 'add'),
|
||||
'/^commands\/edit\/?$/' => array('subtopic' => 'commands', 'action' => 'edit'),
|
||||
'/^faq\/add\/?$/' => array('subtopic' => 'faq', 'action' => 'add'),
|
||||
'/^faq\/edit\/?$/' => array('subtopic' => 'faq', 'action' => 'edit'),
|
||||
'/^forum\/add_board\/?$/' => array('subtopic' => 'forum', 'action' => 'add_board'),#
|
||||
'/^forum\/edit_board\/?$/' => array('subtopic' => 'forum', 'action' => 'edit_board'),
|
||||
'/^forum\/board\/[0-9]+\/?$/' => array('subtopic' => 'forum', 'action' => 'show_board', 'id' => '$2'),
|
||||
'/^forum\/board\/[0-9]+\/[0-9]+\/?$/' => array('subtopic' => 'forum', 'action' => 'show_board', 'id' => '$2', 'page' => '$3'),
|
||||
'/^forum\/thread\/[0-9]+\/?$/' => array('subtopic' => 'forum', 'action' => 'show_thread', 'id' => '$2'),
|
||||
'/^forum\/thread\/[0-9]+\/[0-9]+\/?$/' => array('subtopic' => 'forum', 'action' => 'show_thread', 'id' => '$2', 'page' => '$3'),
|
||||
'/^gallery\/add\/?$/' => array('subtopic' => 'gallery', 'action' => 'add'),
|
||||
'/^gallery\/edit\/?$/' => array('subtopic' => 'gallery', 'action' => 'edit'),
|
||||
'/^gallery\/[0-9]+\/?$/' => array('subtopic' => 'gallery', 'image' => '$1'),
|
||||
'/^gifts\/history\/?$/' => array('subtopic' => 'gifts', 'action' => 'show_history'),
|
||||
'/^guilds\/[A-Za-z0-9-_%+\']+$/' => array('subtopic' => 'guilds', 'action' => 'show', 'guild' => '$1'),
|
||||
'/^highscores\/[A-Za-z0-9-_]+\/[A-Za-z0-9-_]+\/[0-9]+\/?$/' => array('subtopic' => 'highscores', 'list' => '$1', 'vocation' => '$2', 'page' => '$3'),
|
||||
'/^highscores\/[A-Za-z0-9-_]+\/[0-9]+\/?$/' => array('subtopic' => 'highscores', 'list' => '$1', 'page' => '$2'),
|
||||
'/^highscores\/[A-Za-z0-9-_]+\/[A-Za-z0-9-_]+\/?$/' => array('subtopic' => 'highscores', 'list' => '$1', 'vocation' => '$2'),
|
||||
'/^highscores\/[A-Za-z0-9-_\']+\/?$/' => array('subtopic' => 'highscores', 'list' => '$1'),
|
||||
'/^news\/add\/?$/' => array('subtopic' => 'news', 'action' => 'add'),
|
||||
'/^news\/edit\/?$/' => array('subtopic' => 'news', 'action' => 'edit'),
|
||||
'/^news\/archive\/?$/' => array('subtopic' => 'newsarchive'),
|
||||
'/^news\/archive\/[0-9]+\/?$/' => array('subtopic' => 'newsarchive', 'id' => '$2'),
|
||||
'/^polls\/[0-9]+\/?$/' => array('subtopic' => 'polls', 'id' => '$1'),
|
||||
'/^spells\/[A-Za-z0-9-_%]+\/[A-Za-z0-9-_]+\/?$/' => array('subtopic' => 'spells', 'vocation' => '$1', 'order' => '$2'),
|
||||
'/^gifts\/history\/?$/' => array('subtopic' => 'gifts', 'action' => 'show_history'),
|
||||
);
|
||||
|
||||
foreach($rules as $rule => $redirect) {
|
||||
if (preg_match($rule, $uri)) {
|
||||
$tmp = explode('/', $uri);
|
||||
foreach($redirect as $key => $value) {
|
||||
|
||||
if(strpos($value, '$') !== false) {
|
||||
$value = str_replace('$' . $value[1], $tmp[$value[1]], $value);
|
||||
}
|
||||
|
||||
$_REQUEST[$key] = $value;
|
||||
$_GET[$key] = $value;
|
||||
}
|
||||
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// define page visited, so it can be used within events system
|
||||
$page = isset($_REQUEST['subtopic']) ? $_REQUEST['subtopic'] : (isset($_GET['p']) ? $_GET['p'] : '');
|
||||
if(empty($page) || preg_match('/[^A-z0-9_\-]/', $page))
|
||||
$page = 'news';
|
||||
$page = isset($_REQUEST['subtopic']) ? $_REQUEST['subtopic'] : (isset($_REQUEST['p']) ? $_REQUEST['p'] : '');
|
||||
if(empty($page) || !preg_match('/^[A-z0-9\_\-]+$/', $page)) {
|
||||
$tmp = URI;
|
||||
if(!empty($tmp)) {
|
||||
$page = $tmp;
|
||||
}
|
||||
else {
|
||||
if(!$found)
|
||||
$page = '404';
|
||||
else
|
||||
$page = 'news';
|
||||
}
|
||||
}
|
||||
|
||||
$page = strtolower($page);
|
||||
define('PAGE', $page);
|
||||
|
||||
$template_place_holders = array();
|
||||
|
||||
require_once(SYSTEM . 'functions.php');
|
||||
require_once(SYSTEM . 'init.php');
|
||||
require_once(SYSTEM . 'template.php');
|
||||
require_once(SYSTEM . 'login.php');
|
||||
require_once(SYSTEM . 'status.php');
|
||||
require_once(SYSTEM . 'template.php');
|
||||
|
||||
$twig->addGlobal('config', $config);
|
||||
$twig->addGlobal('status', $status);
|
||||
|
||||
// database migrations
|
||||
$tmp = '';
|
||||
@@ -84,6 +199,41 @@ $hooks = new Hooks();
|
||||
$hooks->load();
|
||||
$hooks->trigger(HOOK_STARTUP);
|
||||
|
||||
// anonymous usage statistics
|
||||
// sent only when user agrees
|
||||
if(isset($config['anonymous_usage_statistics']) && $config['anonymous_usage_statistics']) {
|
||||
$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)) {
|
||||
$should_report = time() > (int)$value + $report_time;
|
||||
}
|
||||
else {
|
||||
$value = '';
|
||||
if(fetchDatabaseConfig('last_usage_report', $value)) {
|
||||
$should_report = time() > (int)$value + $report_time;
|
||||
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
|
||||
$should_report = false;
|
||||
}
|
||||
}
|
||||
|
||||
if($should_report) {
|
||||
require_once(LIBS . 'usage_statistics.php');
|
||||
Usage_Statistics::report();
|
||||
|
||||
updateDatabaseConfig('last_usage_report', time());
|
||||
if($cache->enabled()) {
|
||||
$cache->set('last_usage_report', time());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($config['views_counter'])
|
||||
require_once(SYSTEM . 'counter.php');
|
||||
|
||||
@@ -129,6 +279,7 @@ if($config['backward_support']) {
|
||||
$layout_header = template_header();
|
||||
$layout_name = $template_path;
|
||||
$news_content = '';
|
||||
$tickers_content = '';
|
||||
$subtopic = PAGE;
|
||||
$main_content = '';
|
||||
|
||||
@@ -153,7 +304,7 @@ if($config['backward_support']) {
|
||||
$config['site']['screenshot_page'] = true;
|
||||
|
||||
if($config['forum'] != '')
|
||||
$config['forum_link'] = (strtolower($config['forum']) == 'site' ? internalLayoutLink('forum') : $config['forum']);
|
||||
$config['forum_link'] = (strtolower($config['forum']) == 'site' ? getLink('forum') : $config['forum']);
|
||||
|
||||
foreach($status as $key => $value)
|
||||
$config['status']['serverStatus_' . $key] = $value;
|
||||
@@ -168,58 +319,65 @@ if($load_it)
|
||||
require(SYSTEM . 'compat_pages.php');
|
||||
|
||||
$ignore = false;
|
||||
$file = SYSTEM . 'pages/' . $page . '.php';
|
||||
if(!@file_exists($file))
|
||||
|
||||
$logged_access = 1;
|
||||
if($logged && $account_logged && $account_logged->isLoaded()) {
|
||||
$logged_access = $account_logged->getAccess();
|
||||
}
|
||||
|
||||
$query =
|
||||
$db->query(
|
||||
'SELECT `id`, `title`, `body`, `php`, `hidden`' .
|
||||
' FROM `' . TABLE_PREFIX . 'pages`' .
|
||||
' WHERE `name` LIKE ' . $db->quote($page) . ' AND `hidden` != 1 AND `access` <= ' . $db->quote($logged_access));
|
||||
if($query->rowCount() > 0) // found page
|
||||
{
|
||||
$logged_access = 0;
|
||||
if($logged && $account_logged && $account_logged->isLoaded()) {
|
||||
$logged_access = $account_logged->getAccess();
|
||||
}
|
||||
$ignore = true;
|
||||
$query = $query->fetch();
|
||||
$title = $query['title'];
|
||||
|
||||
$query =
|
||||
$db->query(
|
||||
'SELECT `title`, `body`, `php`' .
|
||||
' FROM `' . TABLE_PREFIX . 'pages`' .
|
||||
' WHERE `name` LIKE ' . $db->quote($page) . ' AND `hidden` != 1 AND `access` <= ' . $db->quote($logged_access));
|
||||
if($query->rowCount() > 0) // found page
|
||||
if($query['php'] == '1') // execute it as php code
|
||||
{
|
||||
$ignore = true;
|
||||
$query = $query->fetch();
|
||||
$title = $query['title'];
|
||||
|
||||
if($query['php'] == '1') // execute it as php code
|
||||
{
|
||||
$tmp = substr($query['body'], 0, 10);
|
||||
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
|
||||
$tmp = $query['body'];
|
||||
|
||||
$php_errors = array();
|
||||
function error_handler($errno, $errstr) {
|
||||
global $php_errors;
|
||||
$php_errors[] = array('errno' => $errno, 'errstr' => $errstr);
|
||||
}
|
||||
set_error_handler('error_handler');
|
||||
|
||||
ob_start();
|
||||
eval($tmp);
|
||||
$content .= ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
restore_error_handler();
|
||||
if(isset($php_errors[0]) && superAdmin()) {
|
||||
var_dump($php_errors);
|
||||
}
|
||||
$tmp = substr($query['body'], 0, 10);
|
||||
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
|
||||
$content .= $query['body']; // plain html
|
||||
$tmp = $query['body'];
|
||||
|
||||
$php_errors = array();
|
||||
function error_handler($errno, $errstr) {
|
||||
global $php_errors;
|
||||
$php_errors[] = array('errno' => $errno, 'errstr' => $errstr);
|
||||
}
|
||||
set_error_handler('error_handler');
|
||||
|
||||
ob_start();
|
||||
eval($tmp);
|
||||
$content .= ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
restore_error_handler();
|
||||
if(isset($php_errors[0]) && superAdmin()) {
|
||||
var_dump($php_errors);
|
||||
}
|
||||
}
|
||||
else
|
||||
$content .= $query['body']; // plain html
|
||||
|
||||
if(hasFlag(FLAG_CONTENT_PAGES) || superAdmin()) {
|
||||
$content = $twig->render('admin.pages.links.html.twig', array(
|
||||
'page' => array('id' => $query['id'], 'hidden' => $query['hidden'])
|
||||
)) . $content;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$file = SYSTEM . 'pages/' . $page . '.php';
|
||||
if(!@file_exists($file))
|
||||
{
|
||||
$page = '404';
|
||||
$file = SYSTEM . 'pages/404.php';
|
||||
|
@@ -1,12 +1,17 @@
|
||||
<?php
|
||||
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'];
|
||||
// take care of trailing slash at the end
|
||||
if($config['server_path'][strlen($config['server_path']) - 1] != '/')
|
||||
$config['server_path'] .= '/';
|
||||
|
||||
if(!file_exists($config['server_path'] . 'config.lua')) {
|
||||
if((!isset($error) || !$error) && !file_exists($config['server_path'] . 'config.lua')) {
|
||||
error($locale['step_database_error_config']);
|
||||
$error = true;
|
||||
}
|
||||
|
@@ -62,9 +62,9 @@ function next_buttons($previous = true, $next = true)
|
||||
$ret .= '<input class="button" type="submit" onclick="document.getElementById(\'step\').value=\'' . $steps[$i + 1] . '\';" value="' . $locale['next'] . '" />';
|
||||
*/
|
||||
if($previous)
|
||||
$ret .= '<input type="button" class="button" onclick="document.getElementById(\'step\').value=\'' . $steps[$i - 1] . '\'; this.form.submit();" value="' . $locale['previous'] . '" />';
|
||||
$ret .= '<input type="button" class="button" onclick="document.getElementById(\'step\').value=\'' . $steps[$i - 1] . '\'; this.form.submit();" value="« ' . $locale['previous'] . '" />';
|
||||
if($next)
|
||||
$ret .= '<input type="button" class="button" onclick="document.getElementById(\'step\').value=\'' . $steps[$i + 1] . '\'; this.form.submit();" value="' . $locale['next'] . '" />';
|
||||
$ret .= '<input type="button" class="button" onclick="document.getElementById(\'step\').value=\'' . $steps[$i + 1] . '\'; this.form.submit(); " value="' . $locale['next'] . ' »" />';
|
||||
|
||||
$ret .= '</div>';
|
||||
return $ret;
|
||||
@@ -78,4 +78,23 @@ function next_form($previous = true, $next = true)
|
||||
<input type="hidden" name="step" id="step" value="' . $step . '" />' . next_buttons($previous, $next) . '
|
||||
</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;
|
||||
}
|
@@ -1,26 +1,37 @@
|
||||
CREATE TABLE `myaac_account_actions`
|
||||
(
|
||||
`account_id` INT(11) NOT NULL,
|
||||
`ip` INT(11) NOT NULL DEFAULT 0,
|
||||
`ipv6` BINARY(16) NOT NULL DEFAULT 0,
|
||||
`date` INT(11) NOT NULL DEFAULT 0,
|
||||
`action` VARCHAR(255) NOT NULL DEFAULT '',
|
||||
KEY (`account_id`)
|
||||
`account_id` INT(11) NOT NULL,
|
||||
`ip` INT(11) NOT NULL DEFAULT 0,
|
||||
`ipv6` BINARY(16) NOT NULL DEFAULT 0,
|
||||
`date` INT(11) NOT NULL DEFAULT 0,
|
||||
`action` VARCHAR(255) NOT NULL DEFAULT '',
|
||||
KEY (`account_id`)
|
||||
) ENGINE = MyISAM;
|
||||
|
||||
CREATE TABLE `myaac_admin_menu`
|
||||
(
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` VARCHAR(255) NOT NULL DEFAULT '',
|
||||
`page` VARCHAR(255) NOT NULL DEFAULT '',
|
||||
`ordering` INT(11) NOT NULL DEFAULT 0,
|
||||
`flags` INT(11) NOT NULL DEFAULT 0,
|
||||
`enabled` INT(1) NOT NULL DEFAULT 1,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = MyISAM;
|
||||
|
||||
CREATE TABLE `myaac_bugtracker`
|
||||
(
|
||||
`account` VARCHAR(255) NOT NULL,
|
||||
`type` INT(11) NOT NULL,
|
||||
`status` INT(11) NOT NULL,
|
||||
`type` INT(11) NOT NULL DEFAULT 0,
|
||||
`status` INT(11) NOT NULL DEFAULT 0,
|
||||
`text` text NOT NULL,
|
||||
`id` INT(11) NOT NULL,
|
||||
`subject` VARCHAR(255) NOT NULL,
|
||||
`reply` INT(11) NOT NULL,
|
||||
`who` INT(11) NOT NULL,
|
||||
`id` INT(11) NOT NULL DEFAULT 0,
|
||||
`subject` VARCHAR(255) NOT NULL DEFAULT '',
|
||||
`reply` INT(11) NOT NULL DEFAULT 0,
|
||||
`who` INT(11) NOT NULL DEFAULT 0,
|
||||
`uid` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`tag` INT(11) NOT NULL,
|
||||
PRIMARY KEY (`uid`)
|
||||
`tag` INT(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`uid`)
|
||||
) ENGINE = MyISAM;
|
||||
|
||||
CREATE TABLE `myaac_changelog`
|
||||
@@ -67,21 +78,23 @@ CREATE TABLE `myaac_faq`
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = MyISAM;
|
||||
|
||||
CREATE TABLE `myaac_forum_sections`
|
||||
CREATE TABLE `myaac_forum_boards`
|
||||
(
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` VARCHAR(32) NOT NULL,
|
||||
`description` VARCHAR(255) NOT NULL DEFAULT '',
|
||||
`ordering` INT(11) NOT NULL DEFAULT 0,
|
||||
`guild` INT(11) NOT NULL DEFAULT 0,
|
||||
`access` INT(11) NOT NULL DEFAULT 0,
|
||||
`closed` TINYINT(1) NOT NULL DEFAULT 0,
|
||||
`hidden` TINYINT(1) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = MyISAM;
|
||||
INSERT INTO `myaac_forum_sections` (`id`, `name`, `description`, `closed`) VALUES (NULL, 'News', 'News commenting', 1);
|
||||
INSERT INTO `myaac_forum_sections` (`id`, `name`, `description`) VALUES (NULL, 'Trade', 'Trade offers.');
|
||||
INSERT INTO `myaac_forum_sections` (`id`, `name`, `description`) VALUES (NULL, 'Quests', 'Quest making.');
|
||||
INSERT INTO `myaac_forum_sections` (`id`, `name`, `description`) VALUES (NULL, 'Pictures', 'Your pictures.');
|
||||
INSERT INTO `myaac_forum_sections` (`id`, `name`, `description`) VALUES (NULL, 'Bug Report', 'Report bugs there.');
|
||||
INSERT INTO `myaac_forum_boards` (`id`, `name`, `description`, `ordering`, `closed`) VALUES (NULL, 'News', 'News commenting', 0, 1);
|
||||
INSERT INTO `myaac_forum_boards` (`id`, `name`, `description`, `ordering`) VALUES (NULL, 'Trade', 'Trade offers.', 1);
|
||||
INSERT INTO `myaac_forum_boards` (`id`, `name`, `description`, `ordering`) VALUES (NULL, 'Quests', 'Quest making.', 2);
|
||||
INSERT INTO `myaac_forum_boards` (`id`, `name`, `description`, `ordering`) VALUES (NULL, 'Pictures', 'Your pictures.', 3);
|
||||
INSERT INTO `myaac_forum_boards` (`id`, `name`, `description`, `ordering`) VALUES (NULL, 'Bug Report', 'Report bugs there.', 4);
|
||||
|
||||
CREATE TABLE `myaac_forum`
|
||||
(
|
||||
@@ -94,7 +107,7 @@ CREATE TABLE `myaac_forum`
|
||||
`author_aid` int(20) NOT NULL default '0',
|
||||
`author_guid` int(20) NOT NULL default '0',
|
||||
`post_text` text NOT NULL,
|
||||
`post_topic` varchar(255) NOT NULL,
|
||||
`post_topic` varchar(255) NOT NULL DEFAULT '',
|
||||
`post_smile` tinyint(1) NOT NULL default '0',
|
||||
`post_date` int(20) NOT NULL default '0',
|
||||
`last_edit_aid` int(20) NOT NULL default '0',
|
||||
@@ -112,30 +125,121 @@ CREATE TABLE `myaac_hooks`
|
||||
`name` VARCHAR(30) NOT NULL DEFAULT '',
|
||||
`type` INT(2) NOT NULL DEFAULT 0,
|
||||
`file` VARCHAR(100) NOT NULL,
|
||||
`ordering` INT(11) NOT NULL DEFAULT 0,
|
||||
`enabled` INT(1) NOT NULL DEFAULT 1,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = MyISAM;
|
||||
|
||||
CREATE TABLE `myaac_items`
|
||||
(
|
||||
`id` INT(11) NOT NULL,
|
||||
`article` VARCHAR(5) NOT NULL DEFAULT '',
|
||||
`name` VARCHAR(50) NOT NULL DEFAULT '',
|
||||
`plural` VARCHAR(50) NOT NULL DEFAULT '',
|
||||
`attributes` VARCHAR(500) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = MyISAM;
|
||||
|
||||
CREATE TABLE `myaac_menu`
|
||||
(
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`template` VARCHAR(255) NOT NULL,
|
||||
`name` VARCHAR(255) NOT NULL,
|
||||
`link` VARCHAR(255) NOT NULL,
|
||||
`category` INT(11) NOT NULL DEFAULT 1,
|
||||
`ordering` INT(11) NOT NULL DEFAULT 0,
|
||||
`enabled` INT(1) NOT NULL DEFAULT 1,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = MyISAM;
|
||||
|
||||
/* MENU_CATEGORY_NEWS kathrine */
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Latest News', 'news', 1, 0);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'News Archive', 'news/archive', 1, 1);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Changelog', 'changelog', 1, 2);
|
||||
/* MENU_CATEGORY_ACCOUNT kathrine */
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Account Management', 'account/manage', 2, 0);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Create Account', 'account/create', 2, 1);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Lost Account?', 'account/lost', 2, 2);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Server Rules', 'rules', 2, 3);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Downloads', 'downloads', 5, 4);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Report Bug', 'bugtracker', 2, 5);
|
||||
/* MENU_CATEGORY_COMMUNITY kathrine */
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Who is Online?', 'online', 3, 0);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Characters', 'characters', 3, 1);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Guilds', 'guilds', 3, 2);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Highscores', 'highscores', 3, 3);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Last Deaths', 'lastkills', 3, 4);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Houses', 'houses', 3, 5);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Bans', 'bans', 3, 6);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Forum', 'forum', 3, 7);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Team', 'team', 3, 8);
|
||||
/* MENU_CATEGORY_LIBRARY kathrine */
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Monsters', 'creatures', 5, 0);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Spells', 'spells', 5, 1);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Server Info', 'serverInfo', 5, 2);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Commands', 'commands', 5, 3);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Gallery', 'gallery', 5, 4);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Experience Table', 'experienceTable', 5, 5);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'FAQ', 'faq', 5, 6);
|
||||
/* MENU_CATEGORY_SHOP kathrine */
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Buy Points', 'points', 6, 0);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Shop Offer', 'gifts', 6, 1);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Shop History', 'gifts/history', 6, 2);
|
||||
/* MENU_CATEGORY_NEWS tibiacom */
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Latest News', 'news', 1, 0);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'News Archive', 'news/archive', 1, 1);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Changelog', 'changelog', 1, 2);
|
||||
/* MENU_CATEGORY_ACCOUNT tibiacom */
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Account Management', 'account/manage', 2, 0);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Create Account', 'account/create', 2, 1);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Lost Account?', 'account/lost', 2, 2);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Server Rules', 'rules', 2, 3);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Downloads', 'downloads', 2, 4);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Report Bug', 'bugtracker', 2, 5);
|
||||
/* MENU_CATEGORY_COMMUNITY tibiacom */
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Characters', 'characters', 3, 0);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Who Is Online?', 'online', 3, 1);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Highscores', 'highscores', 3, 2);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Last Kills', 'lastkills', 3, 3);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Houses', 'houses', 3, 4);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Guilds', 'guilds', 3, 5);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Polls', 'polls', 3, 6);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Bans', 'bans', 3, 7);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Support List', 'team', 3, 8);
|
||||
/* MENU_CATEGORY_FORUM tibiacom */
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Forum', 'forum', 4, 0);
|
||||
/* MENU_CATEGORY_LIBRARY tibiacom */
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Creatures', 'creatures', 5, 0);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Spells', 'spells', 5, 1);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Commands', 'commands', 5, 2);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Exp Stages', 'experienceStages', 5, 3);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Gallery', 'gallery', 5, 4);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Server Info', 'serverInfo', 5, 5);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Experience Table', 'experienceTable', 5, 6);
|
||||
/* MENU_CATEGORY_SHOP tibiacom */
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Buy Points', 'points', 6, 0);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Shop Offer', 'gifts', 6, 1);
|
||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Shop History', 'gifts/history', 6, 2);
|
||||
|
||||
CREATE TABLE `myaac_monsters` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`hide_creature` tinyint(1) NOT NULL default '0',
|
||||
`hidden` tinyint(1) NOT NULL default 0,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`mana` int(11) NOT NULL,
|
||||
`mana` int(11) NOT NULL DEFAULT 0,
|
||||
`exp` int(11) NOT NULL,
|
||||
`health` int(11) NOT NULL,
|
||||
`speed_lvl` int(11) NOT NULL default '1',
|
||||
`speed_lvl` int(11) NOT NULL default 1,
|
||||
`use_haste` tinyint(1) NOT NULL,
|
||||
`voices` text NOT NULL,
|
||||
`immunities` varchar(255) NOT NULL,
|
||||
`summonable` tinyint(1) NOT NULL,
|
||||
`convinceable` tinyint(1) NOT NULL,
|
||||
`race` varchar(255) NOT NULL,
|
||||
`gfx_name` varchar(255) NOT NULL,
|
||||
`file_path` varchar(255) NOT NULL,
|
||||
`loot` varchar(500) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = MyISAM;
|
||||
|
||||
CREATE TABLE `myaac_movies`
|
||||
CREATE TABLE `myaac_videos`
|
||||
(
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`title` VARCHAR(100) NOT NULL DEFAULT '',
|
||||
@@ -151,13 +255,15 @@ CREATE TABLE `myaac_news`
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`title` VARCHAR(100) NOT NULL,
|
||||
`body` TEXT NOT NULL,
|
||||
`type` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '1 - news, 2 - ticket, 3 - article',
|
||||
`type` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '1 - news, 2 - ticker, 3 - article',
|
||||
`date` INT(11) NOT NULL DEFAULT 0,
|
||||
`category` TINYINT(1) NOT NULL DEFAULT 0,
|
||||
`player_id` INT(11) NOT NULL DEFAULT 0,
|
||||
`last_modified_by` INT(11) NOT NULL DEFAULT 0,
|
||||
`last_modified_date` INT(11) NOT NULL DEFAULT 0,
|
||||
`comments` VARCHAR(50) NOT NULL,
|
||||
`comments` VARCHAR(50) NOT NULL DEFAULT '',
|
||||
`article_text` VARCHAR(300) NOT NULL DEFAULT '',
|
||||
`article_image` VARCHAR(100) NOT NULL DEFAULT '',
|
||||
`hidden` TINYINT(1) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = MyISAM;
|
||||
@@ -202,7 +308,7 @@ CREATE TABLE `myaac_pages`
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = MyISAM;
|
||||
|
||||
CREATE TABLE `myaac_screenshots`
|
||||
CREATE TABLE `myaac_gallery`
|
||||
(
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`comment` VARCHAR(255) NOT NULL DEFAULT '',
|
||||
@@ -214,7 +320,7 @@ CREATE TABLE `myaac_screenshots`
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = MyISAM;
|
||||
|
||||
INSERT INTO `myaac_screenshots` (`id`, `ordering`, `comment`, `image`, `thumb`, `author`) VALUES (NULL, 1, 'Demon', 'images/screenshots/demon.jpg', 'images/screenshots/demon_thumb.gif', 'MyAAC');
|
||||
INSERT INTO `myaac_gallery` (`id`, `ordering`, `comment`, `image`, `thumb`, `author`) VALUES (NULL, 1, 'Demon', 'images/gallery/demon.jpg', 'images/gallery/demon_thumb.gif', 'MyAAC');
|
||||
|
||||
CREATE TABLE `myaac_spells`
|
||||
(
|
||||
@@ -223,17 +329,18 @@ CREATE TABLE `myaac_spells`
|
||||
`name` VARCHAR(255) NOT NULL,
|
||||
`words` VARCHAR(255) NOT NULL,
|
||||
`category` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '1 - attack, 2 - healing, 3 - summon, 4 - supply, 5 - support',
|
||||
`type` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '1 - instant, 2 - rune',
|
||||
`type` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '1 - instant, 2 - conjure, 3 - rune',
|
||||
`level` INT(11) NOT NULL DEFAULT 0,
|
||||
`maglevel` INT(11) NOT NULL DEFAULT 0,
|
||||
`mana` INT(11) NOT NULL DEFAULT 0,
|
||||
`soul` TINYINT(3) NOT NULL DEFAULT 0,
|
||||
`conjure_count` TINYINT(3) NOT NULL DEFAULT 0,
|
||||
`item_id` INT(11) NOT NULL DEFAULT 0,
|
||||
`premium` TINYINT(1) NOT NULL DEFAULT 0,
|
||||
`vocations` VARCHAR(32) NOT NULL,
|
||||
`vocations` VARCHAR(100) NOT NULL DEFAULT '',
|
||||
`hidden` TINYINT(1) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE (`spell`)
|
||||
UNIQUE (`name`)
|
||||
) ENGINE = MyISAM;
|
||||
|
||||
CREATE TABLE `myaac_visitors`
|
||||
@@ -243,3 +350,12 @@ CREATE TABLE `myaac_visitors`
|
||||
`page` VARCHAR(100) NOT NULL,
|
||||
UNIQUE (`ip`)
|
||||
) ENGINE = MyISAM;
|
||||
|
||||
CREATE TABLE `myaac_weapons`
|
||||
(
|
||||
`id` INT(11) NOT NULL,
|
||||
`level` INT(11) NOT NULL DEFAULT 0,
|
||||
`maglevel` INT(11) NOT NULL DEFAULT 0,
|
||||
`vocations` VARCHAR(100) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = MyISAM;
|
||||
|
11
install/includes/twig_error.html
Normal 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>
|
@@ -1,48 +1,109 @@
|
||||
<?php
|
||||
require('../common.php');
|
||||
|
||||
// step
|
||||
$step = isset($_POST['step']) ? $_POST['step'] : 'welcome';
|
||||
|
||||
// includes
|
||||
require(SYSTEM . 'functions.php');
|
||||
require(BASE . 'install/includes/functions.php');
|
||||
require(BASE . 'install/includes/locale.php');
|
||||
require(BASE . 'config.local.php');
|
||||
|
||||
// twig
|
||||
require_once LIBS . 'Twig/Autoloader.php';
|
||||
Twig_Autoloader::register();
|
||||
|
||||
$twig_loader = new Twig_Loader_Filesystem(SYSTEM . 'templates');
|
||||
$twig = new Twig_Environment($twig_loader, array(
|
||||
'cache' => CACHE . 'twig/',
|
||||
'auto_reload' => true
|
||||
));
|
||||
|
||||
if(isset($_POST['vars']))
|
||||
{
|
||||
foreach($_POST['vars'] as $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');
|
||||
if(!in_array($step, $steps)) // check if step is valid
|
||||
die('ERROR: Unknown step.');
|
||||
|
||||
$errors = array();
|
||||
if($step == 'database')
|
||||
{
|
||||
foreach($_POST['vars'] as $key => $value)
|
||||
{
|
||||
if(empty($value))
|
||||
if($key != 'usage' && empty($value))
|
||||
{
|
||||
$step = 'config';
|
||||
$errors = '<p class="error">' . $locale['please_fill_all'] . '</p>';
|
||||
$errors[] = $locale['please_fill_all'];
|
||||
break;
|
||||
}
|
||||
else if($key == 'mail_admin' && !Validator::email($value))
|
||||
{
|
||||
$errors[] = $locale['step_config_mail_admin_error'];
|
||||
break;
|
||||
}
|
||||
else if($key == 'mail_address' && !Validator::email($value))
|
||||
{
|
||||
$errors[] = $locale['step_config_mail_address_error'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($errors)) {
|
||||
$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;
|
||||
|
||||
// step include
|
||||
ob_start();
|
||||
require('steps/' . $step . '.php');
|
||||
$content = ob_get_contents();
|
||||
ob_end_clean();
|
||||
clearstatcache();
|
||||
if(is_writable(CACHE) && (MYAAC_OS != 'WINDOWS' || win_is_writable(CACHE))) {
|
||||
ob_start();
|
||||
|
||||
$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
|
||||
require('template/template.php');
|
||||
//$_SESSION['laststep'] = $step;
|
||||
|
||||
?>
|
||||
//$_SESSION['laststep'] = $step;
|
27
install/steps/1-welcome.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
if(isset($config['installed']) && $config['installed'] && !isset($_SESSION['saved'])) {
|
||||
echo '<p class="warning">' . $locale['already_installed'] . '</p>';
|
||||
}
|
||||
else {
|
||||
unset($_SESSION['saved']);
|
||||
|
||||
$locales = array();
|
||||
foreach(get_locales() as $tmp_locale)
|
||||
{
|
||||
$lang_file_main = LOCALE . $tmp_locale . '/main.php';
|
||||
$lang_file_install = LOCALE . $tmp_locale . '/install.php';
|
||||
if(@file_exists($lang_file_main)
|
||||
&& @file_exists($lang_file_install))
|
||||
{
|
||||
require($lang_file_main);
|
||||
$locales[] = array('id' => $tmp_locale, 'name' => $locale['name']);
|
||||
}
|
||||
}
|
||||
echo $twig->render('install.welcome.html.twig', array(
|
||||
'locales' => $locales,
|
||||
'locale' => $locale,
|
||||
'buttons' => next_buttons(false, true)
|
||||
));
|
||||
}
|
||||
?>
|
8
install/steps/2-license.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
|
||||
echo $twig->render('install.license.html.twig', array(
|
||||
'license' => file_get_contents(BASE . 'LICENSE'),
|
||||
'buttons' => next_buttons()
|
||||
));
|
||||
?>
|
@@ -22,8 +22,8 @@ function version_check($name, $ok, $info = '', $warning = false)
|
||||
$failed = false;
|
||||
|
||||
// start validating
|
||||
version_check($locale['step_requirements_php_version'], (PHP_VERSION_ID >= 50200), PHP_VERSION);
|
||||
foreach(array('config.local.php', 'images/guilds', 'images/houses', 'images/screenshots') as $value)
|
||||
version_check($locale['step_requirements_php_version'], (PHP_VERSION_ID >= 50300), PHP_VERSION);
|
||||
foreach(array('config.local.php', 'images/guilds', 'images/houses', 'images/gallery') as $value)
|
||||
{
|
||||
$perms = (int) substr(decoct(fileperms(BASE . $value)), 2);
|
||||
version_check($locale['step_requirements_write_perms'] . ': ' . $value, $perms >= 660);
|
86
install/steps/4-config.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
|
||||
$clients_list = array(
|
||||
710,
|
||||
740,
|
||||
750,
|
||||
760,
|
||||
770,
|
||||
772,
|
||||
780,
|
||||
7920,
|
||||
800,
|
||||
810,
|
||||
821,
|
||||
822,
|
||||
831,
|
||||
840,
|
||||
841,
|
||||
842,
|
||||
850,
|
||||
852,
|
||||
853,
|
||||
854,
|
||||
855,
|
||||
857,
|
||||
860,
|
||||
870,
|
||||
|
||||
900,
|
||||
910,
|
||||
920,
|
||||
930,
|
||||
940,
|
||||
942,
|
||||
944,
|
||||
946,
|
||||
950,
|
||||
952,
|
||||
953,
|
||||
954,
|
||||
960,
|
||||
970,
|
||||
980,
|
||||
|
||||
1000,
|
||||
1010,
|
||||
1021,
|
||||
1031,
|
||||
1034,
|
||||
1041,
|
||||
1050,
|
||||
1053,
|
||||
1054,
|
||||
1058,
|
||||
1075,
|
||||
1077,
|
||||
1079,
|
||||
1080,
|
||||
1090,
|
||||
1093,
|
||||
1094,
|
||||
1095,
|
||||
1096,
|
||||
1097,
|
||||
1098,
|
||||
1100,
|
||||
);
|
||||
|
||||
$clients = array();
|
||||
foreach($clients_list as $client) {
|
||||
$client_version = (string)($client / 100);
|
||||
if(strpos($client_version, '.') == false)
|
||||
$client_version .= '.0';
|
||||
|
||||
$clients[$client] = $client_version;
|
||||
}
|
||||
|
||||
echo $twig->render('install.config.html.twig', array(
|
||||
'clients' => $clients,
|
||||
'locale' => $locale,
|
||||
'session' => $_SESSION,
|
||||
'errors' => isset($errors) ? $errors : null,
|
||||
'buttons' => next_buttons()
|
||||
));
|
||||
?>
|
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
|
||||
//ini_set('display_errors', false);
|
||||
ini_set('max_execution_time', 300);
|
||||
$error = false;
|
||||
@@ -10,7 +11,8 @@ if(!isset($_SESSION['var_server_path'])) {
|
||||
}
|
||||
|
||||
if(!$error) {
|
||||
$content = "<?php\n";
|
||||
$content = "<?php";
|
||||
$content .= PHP_EOL;
|
||||
foreach($_SESSION as $key => $value)
|
||||
{
|
||||
if(strpos($key, 'var_') !== false)
|
||||
@@ -22,7 +24,11 @@ if(!$error) {
|
||||
$value .= "/";
|
||||
}
|
||||
|
||||
if($key != 'var_account' && $key != 'var_account_id' && $key != 'var_password') {
|
||||
if($key == 'var_usage') {
|
||||
$content .= '$config[\'anonymous_usage_statistics\'] = ' . ((int)$value == 1 ? 'true' : 'false') . ';';
|
||||
$content .= PHP_EOL;
|
||||
}
|
||||
else if($key != 'var_account' && $key != 'var_account_id' && $key != 'var_password') {
|
||||
$content .= '$config[\'' . str_replace('var_', '', $key) . '\'] = \'' . $value . '\';';
|
||||
$content .= PHP_EOL;
|
||||
}
|
||||
@@ -84,7 +90,7 @@ if(!$error) {
|
||||
|
||||
if(!fieldExist('blocked', 'accounts')) {
|
||||
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.created...');
|
||||
success($locale['step_database_adding_field'] . ' accounts.blocked...');
|
||||
}
|
||||
|
||||
if(!fieldExist('created', 'accounts')) {
|
||||
@@ -221,22 +227,24 @@ if(!$error) {
|
||||
|
||||
$content .= '$config[\'mail_enabled\'] = true;';
|
||||
$content .= PHP_EOL;
|
||||
if(!check_mail($_SESSION['var_mail_admin'])) {
|
||||
if(!Validator::email($_SESSION['var_mail_admin'])) {
|
||||
error($locale['step_config_mail_admin_error']);
|
||||
$error = true;
|
||||
}
|
||||
if(!check_mail($_SESSION['var_mail_address'])) {
|
||||
if(!Validator::email($_SESSION['var_mail_address'])) {
|
||||
error($locale['step_config_mail_address_error']);
|
||||
$error = true;
|
||||
}
|
||||
|
||||
$content .= '$config[\'client_download\'] = \'http://clients.halfaway.net/windows.php?tibia=\'. $config[\'client\'];';
|
||||
$content .= '$config[\'client_download\'] = \'http://tibia-clients.com/clients/download/\'. $config[\'client\'] . \'/exe/windows\';';
|
||||
$content .= PHP_EOL;
|
||||
$content .= '$config[\'client_download_linux\'] = \'http://clients.halfaway.net/linux.php?tibia=\'. $config[\'client\'];';
|
||||
$content .= '$config[\'client_download_linux\'] = \'http://tibia-clients.com/clients/download/\'. $config[\'client\'] . \'/tar/linux\';';
|
||||
$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 .= "?>";
|
||||
$content .= '$config[\'cache_prefix\'] = \'myaac_' . generateRandomString(8, true, false, true, false) . '_\';';
|
||||
$content .= PHP_EOL;
|
||||
|
||||
$file = fopen(BASE . 'config.local.php', 'a+');
|
||||
if($file) {
|
||||
if(!$error) {
|
15
install/steps/6-admin.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
|
||||
require(BASE . 'install/includes/config.php');
|
||||
if(!$error) {
|
||||
require(BASE . 'install/includes/database.php');
|
||||
|
||||
echo $twig->render('install.admin.html.twig', array(
|
||||
'locale' => $locale,
|
||||
'session' => $_SESSION,
|
||||
'errors' => isset($errors) ? $errors : null,
|
||||
'buttons' => next_buttons(true, $error ? false : true)
|
||||
));
|
||||
}
|
||||
?>
|
227
install/steps/7-finish.php
Normal file
@@ -0,0 +1,227 @@
|
||||
<?php
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
|
||||
if(isset($config['installed']) && $config['installed'] && !isset($_SESSION['saved'])) {
|
||||
warning($locale['already_installed']);
|
||||
}
|
||||
else {
|
||||
require(SYSTEM . 'init.php');
|
||||
if(!$error) {
|
||||
if(USE_ACCOUNT_NAME)
|
||||
$account = isset($_SESSION['var_account']) ? $_SESSION['var_account'] : null;
|
||||
else
|
||||
$account_id = isset($_SESSION['var_account_id']) ? $_SESSION['var_account_id'] : null;
|
||||
|
||||
$password = $_SESSION['var_password'];
|
||||
|
||||
$config_salt_enabled = fieldExist('salt', 'accounts');
|
||||
if($config_salt_enabled)
|
||||
{
|
||||
$salt = generateRandomString(10, false, true, true);
|
||||
$password = $salt . $password;
|
||||
}
|
||||
|
||||
$account_db = new OTS_Account();
|
||||
if(isset($account))
|
||||
$account_db->find($account);
|
||||
else
|
||||
$account_db->load($account_id);
|
||||
|
||||
$player_db = new OTS_Player();
|
||||
$player_db->find('Admin');
|
||||
$groups = new OTS_Groups_List();
|
||||
if(!$player_db->isLoaded())
|
||||
{
|
||||
$player = new OTS_Player();
|
||||
$player->setName('Admin');
|
||||
|
||||
$player_used = &$player;
|
||||
}
|
||||
else {
|
||||
$player_used = &$player_db;
|
||||
}
|
||||
|
||||
$player_used->setGroupId($groups->getHighestId());
|
||||
|
||||
if($account_db->isLoaded()) {
|
||||
$account_db->setPassword(encrypt($password));
|
||||
$account_db->setEMail($_SESSION['var_mail_admin']);
|
||||
$account_db->save();
|
||||
|
||||
$account_used = &$account_db;
|
||||
}
|
||||
else {
|
||||
$new_account = new OTS_Account();
|
||||
if(USE_ACCOUNT_NAME) {
|
||||
$new_account->create($account);
|
||||
}
|
||||
else {
|
||||
$new_account->create(null, $account_id);
|
||||
}
|
||||
|
||||
$new_account->setPassword(encrypt($password));
|
||||
$new_account->setEMail($_SESSION['var_mail_admin']);
|
||||
|
||||
$new_account->unblock();
|
||||
$new_account->save();
|
||||
|
||||
$new_account->setCustomField('created', time());
|
||||
$new_account->logAction('Account created.');
|
||||
|
||||
$account_used = &$new_account;
|
||||
}
|
||||
|
||||
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']);
|
||||
|
||||
setSession('account', $account_used->getId());
|
||||
setSession('password', encrypt($password));
|
||||
setSession('remember_me', true);
|
||||
|
||||
if($player_db->isLoaded()) {
|
||||
$player_db->save();
|
||||
}
|
||||
else {
|
||||
$player->save();
|
||||
}
|
||||
|
||||
$player_id = 0;
|
||||
$query = $db->query("SELECT `id` FROM `players` WHERE `name` = " . $db->quote('Admin') . ";");
|
||||
if($query->rowCount() == 1) {
|
||||
$query = $query->fetch();
|
||||
$player_id = $query['id'];
|
||||
}
|
||||
|
||||
$query = $db->query("SELECT `id` FROM `" . TABLE_PREFIX ."news` WHERE `title` LIKE 'Hello!';");
|
||||
if($query->rowCount() == 0) {
|
||||
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';
|
||||
if(fieldExist('deletion', 'players'))
|
||||
$deleted = 'deletion';
|
||||
|
||||
$insert_into_players = "INSERT INTO `players` (`id`, `name`, `group_id`, `account_id`, `level`, `vocation`, `health`, `healthmax`, `experience`, `lookbody`, `lookfeet`, `lookhead`, `looklegs`, `looktype`, `maglevel`, `mana`, `manamax`, `manaspent`, `soul`, `town_id`, `posx`, `posy`, `posz`, `conditions`, `cap`, `sex`, `lastlogin`, `lastip`, `save`, `lastlogout`, `balance`, `$deleted`, `created`, `hidden`, `comment`) VALUES ";
|
||||
$success = true;
|
||||
|
||||
$highscores_ignored_ids = array();
|
||||
$query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote('Rook Sample'));
|
||||
if($query->rowCount() == 0) {
|
||||
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;
|
||||
else {
|
||||
$highscores_ignored_ids[] = $db->lastInsertId();
|
||||
}
|
||||
}
|
||||
|
||||
$query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote('Sorcerer Sample'));
|
||||
if($query->rowCount() == 0) {
|
||||
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;
|
||||
else {
|
||||
$highscores_ignored_ids[] = $db->lastInsertId();
|
||||
}
|
||||
}
|
||||
|
||||
$query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote('Druid Sample'));
|
||||
if($query->rowCount() == 0) {
|
||||
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;
|
||||
else {
|
||||
$highscores_ignored_ids[] = $db->lastInsertId();
|
||||
}
|
||||
}
|
||||
|
||||
$query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote('Paladin Sample'));
|
||||
if($query->rowCount() == 0) {
|
||||
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;
|
||||
else {
|
||||
$highscores_ignored_ids[] = $db->lastInsertId();
|
||||
}
|
||||
}
|
||||
|
||||
$query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote('Knight Sample'));
|
||||
if($query->rowCount() == 0) {
|
||||
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;
|
||||
else {
|
||||
$highscores_ignored_ids[] = $db->lastInsertId();
|
||||
}
|
||||
}
|
||||
|
||||
if($success) {
|
||||
success($locale['step_database_imported_players']);
|
||||
}
|
||||
|
||||
require(LIBS . 'creatures.php');
|
||||
if(Creatures::loadFromXML()) {
|
||||
success($locale['step_database_loaded_monsters']);
|
||||
|
||||
if(Creatures::getMonstersList()->hasErrors()) {
|
||||
$locale['step_database_error_monsters'] = str_replace('$LOG$', 'system/logs/error.log', $locale['step_database_error_monsters']);
|
||||
warning($locale['step_database_error_monsters']);
|
||||
}
|
||||
}
|
||||
else {
|
||||
error(Creatures::getLastError());
|
||||
}
|
||||
|
||||
require(LIBS . 'spells.php');
|
||||
if(Spells::loadFromXML()) {
|
||||
success($locale['step_database_loaded_spells']);
|
||||
}
|
||||
else {
|
||||
error(Spells::getLastError());
|
||||
}
|
||||
|
||||
$content = PHP_EOL;
|
||||
$content .= '$config[\'highscores_ids_hidden\'] = array(' . implode(', ', $highscores_ignored_ids) . ');';
|
||||
$content .= PHP_EOL;
|
||||
|
||||
$file = fopen(BASE . 'config.local.php', 'a+');
|
||||
if($file) {
|
||||
fwrite($file, $content);
|
||||
}
|
||||
else {
|
||||
$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>');
|
||||
}
|
||||
|
||||
$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('$LINK$', generateLink('http://my-aac.org', 'http://my-aac.org', true), $locale['step_finish_desc']);
|
||||
|
||||
success($locale['step_finish_desc']);
|
||||
|
||||
if(!isset($_SESSION['installed'])) {
|
||||
file_get_contents('http://my-aac.org/report_install.php?v=' . MYAAC_VERSION . '&b=' . urlencode(BASE_URL));
|
||||
$_SESSION['installed'] = true;
|
||||
}
|
||||
|
||||
foreach($_SESSION as $key => $value) {
|
||||
if(strpos($key, 'var_') !== false)
|
||||
unset($_SESSION[$key]);
|
||||
}
|
||||
unset($_SESSION['saved']);
|
||||
}
|
||||
}
|
||||
?>
|
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
|
||||
?>
|
||||
<form action="<?php echo BASE_URL; ?>install/" method="post" autocomplete="off">
|
||||
<input type="hidden" name="step" id="step" value="finish" />
|
||||
<table>
|
||||
<?php
|
||||
require(BASE . 'install/includes/config.php');
|
||||
if(!$error) {
|
||||
require(BASE . 'install/includes/database.php');
|
||||
|
||||
foreach(array(USE_ACCOUNT_NAME ? 'account' : 'account_id', 'password') as $value)
|
||||
echo '
|
||||
<tr>
|
||||
<td>
|
||||
<label for="vars_' . $value . '">
|
||||
<span>' . $locale['step_admin_' . $value] . '</span>
|
||||
</label>
|
||||
<br>
|
||||
<input type="text" name="vars[' . $value . ']" id="vars_' . $value . '"' . (isset($_SESSION['var_' . $value]) ? ' value="' . $_SESSION['var_' . $value] . '"' : '') . '/>
|
||||
</td>
|
||||
<td>
|
||||
<em>' . $locale['step_admin_' . $value . '_desc'] . '</em>
|
||||
</td>
|
||||
</tr>';
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<?php echo next_buttons(true, $error ? false : true);
|
||||
?>
|
||||
</form>
|
@@ -1,115 +0,0 @@
|
||||
<?php
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
|
||||
$clients = array(
|
||||
710,
|
||||
740,
|
||||
750,
|
||||
760,
|
||||
770,
|
||||
780,
|
||||
7920,
|
||||
800,
|
||||
810,
|
||||
821,
|
||||
822,
|
||||
831,
|
||||
840,
|
||||
841,
|
||||
842,
|
||||
850,
|
||||
852,
|
||||
853,
|
||||
854,
|
||||
855,
|
||||
857,
|
||||
860,
|
||||
870,
|
||||
|
||||
900,
|
||||
910,
|
||||
920,
|
||||
930,
|
||||
940,
|
||||
942,
|
||||
944,
|
||||
946,
|
||||
950,
|
||||
952,
|
||||
953,
|
||||
954,
|
||||
960,
|
||||
970,
|
||||
980,
|
||||
|
||||
1000,
|
||||
1010,
|
||||
1021,
|
||||
1031,
|
||||
1034,
|
||||
1041,
|
||||
1050,
|
||||
1053,
|
||||
1054,
|
||||
1058,
|
||||
1075,
|
||||
1077,
|
||||
1079,
|
||||
1080,
|
||||
1090,
|
||||
1093,
|
||||
1094,
|
||||
1095,
|
||||
1096,
|
||||
1097,
|
||||
1098,
|
||||
);
|
||||
|
||||
?>
|
||||
<form action="<?php echo BASE_URL; ?>install/" method="post" autocomplete="off">
|
||||
<input type="hidden" name="step" id="step" value="database" />
|
||||
<table>
|
||||
<?php
|
||||
foreach(array('server_path', 'mail_admin', 'mail_address') as $value)
|
||||
echo '
|
||||
<tr>
|
||||
<td>
|
||||
<label for="vars_' . $value . '">
|
||||
<span>' . $locale['step_config_' . $value] . '</span>
|
||||
</label>
|
||||
<br>
|
||||
<input type="text" name="vars[' . $value . ']" id="vars_' . $value . '"' . (isset($_SESSION['var_' . $value]) ? ' value="' . $_SESSION['var_' . $value] . '"' : '') . '/>
|
||||
</td>
|
||||
<td>
|
||||
<em>' . $locale['step_config_' . $value . '_desc'] . '</em>
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
echo '
|
||||
<tr>
|
||||
<td>
|
||||
<label for="vars_client">
|
||||
<span>' . $locale['step_config_client'] . '</span>
|
||||
</label>
|
||||
<br>
|
||||
<select name="vars[client]" id="vars_client">';
|
||||
//$i = 0;
|
||||
foreach($clients as $client) {
|
||||
$client_version = (string)($client / 100);
|
||||
if(strpos($client_version, '.') == false)
|
||||
$client_version .= '.0';
|
||||
echo '<option value="' . $client . '">' . $client_version . '</option>';
|
||||
}
|
||||
|
||||
echo '
|
||||
</td>
|
||||
<td>
|
||||
<em>' . $locale['step_config_client_desc'] . '</em>
|
||||
</td>
|
||||
</tr>';
|
||||
?>
|
||||
</table>
|
||||
<?php
|
||||
echo next_buttons(true, true);
|
||||
?>
|
||||
</form>
|
@@ -1,199 +0,0 @@
|
||||
<?php
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
|
||||
if(isset($config['installed']) && $config['installed'] && !isset($_SESSION['saved'])) {
|
||||
warning($locale['already_installed']);
|
||||
}
|
||||
else {
|
||||
require(SYSTEM . 'init.php');
|
||||
//require(BASE . 'install/includes/config.php');
|
||||
if(!$error) {
|
||||
//require(BASE . 'install/includes/database.php');
|
||||
|
||||
if(USE_ACCOUNT_NAME)
|
||||
$account = isset($_SESSION['var_account']) ? $_SESSION['var_account'] : NULL;
|
||||
else
|
||||
$account_id = isset($_SESSION['var_account_id']) ? $_SESSION['var_account_id'] : NULL;
|
||||
|
||||
$password = $_SESSION['var_password'];
|
||||
|
||||
$config_salt_enabled = fieldExist('salt', 'accounts');
|
||||
if($config_salt_enabled)
|
||||
{
|
||||
$salt = generateRandomString(10, false, true, true);
|
||||
$password = $salt . $password;
|
||||
}
|
||||
|
||||
$account_db = new OTS_Account();
|
||||
$account_db->load(1);
|
||||
if($account_db->isLoaded()) {
|
||||
if(USE_ACCOUNT_NAME)
|
||||
$account_db->setName('dummy_account');
|
||||
|
||||
$account_db->setPassword('for sample characters. ' . generateRandomString(10));
|
||||
$account_db->save();
|
||||
}
|
||||
else {
|
||||
$new_account = new OTS_Account();
|
||||
if(USE_ACCOUNT_NAME)
|
||||
$new_account->create('dummy_account', 1);
|
||||
else
|
||||
$new_account->create(NULL, 1);
|
||||
|
||||
$new_account->setPassword('for sample characters. ' . generateRandomString(10));
|
||||
$new_account->save();
|
||||
}
|
||||
|
||||
$account_db = new OTS_Account();
|
||||
if(isset($account))
|
||||
$account_db->find($account);
|
||||
else
|
||||
$account_db->load($account_id);
|
||||
|
||||
$player_db = new OTS_Player();
|
||||
$player_db->find('Admin');
|
||||
$groups = new OTS_Groups_List();
|
||||
if(!$player_db->isLoaded())
|
||||
{
|
||||
$player = new OTS_Player();
|
||||
$player->setName('Admin');
|
||||
|
||||
$player->setGroupId($groups->getHighestId());
|
||||
}
|
||||
|
||||
if($account_db->isLoaded()) {
|
||||
$account_db->setPassword(encrypt($password));
|
||||
$account_db->setEMail($_SESSION['var_mail_admin']);
|
||||
$account_db->save();
|
||||
|
||||
if($config_salt_enabled)
|
||||
$account_db->setCustomField('salt', $salt);
|
||||
|
||||
$account_db->setCustomField('web_flags', 3);
|
||||
$account_db->setCustomField('country', 'us');
|
||||
if(fieldExist('group_id', 'accounts'))
|
||||
$account_db->setCustomField('group_id', $groups->getHighestId());
|
||||
if(fieldExist('type', 'accounts'))
|
||||
$account_db->setCustomField('type', 5);
|
||||
|
||||
if(!$player_db->isLoaded())
|
||||
$player->setAccountId($account_db->getId());
|
||||
else
|
||||
$player_db->setAccountId($account_db->getId());
|
||||
|
||||
$_SESSION['account'] = $account_db->getId();
|
||||
}
|
||||
else {
|
||||
$new_account = new OTS_Account();
|
||||
$new_account->create($account);
|
||||
|
||||
$new_account->setPassword(encrypt($password));
|
||||
$new_account->setEMail($_SESSION['var_mail_admin']);
|
||||
|
||||
$new_account->unblock();
|
||||
$new_account->save();
|
||||
|
||||
if($config_salt_enabled)
|
||||
$new_account->setCustomField('salt', $salt);
|
||||
|
||||
$new_account->setCustomField('created', time());
|
||||
$new_account->setCustomField('web_flags', 3);
|
||||
$new_account->setCustomField('country', 'us');
|
||||
if(fieldExist('group_id', 'accounts'))
|
||||
$new_account->setCustomField('group_id', $groups->getHighestId());
|
||||
if(fieldExist('type', 'accounts'))
|
||||
$new_account->setCustomField('type', 5);
|
||||
|
||||
$new_account->logAction('Account created.');
|
||||
|
||||
if(!$player_db->isLoaded())
|
||||
$player->setAccountId($new_account->getId());
|
||||
else
|
||||
$player_db->setAccountId($new_account->getId());
|
||||
|
||||
$_SESSION['account'] = $new_account->getId();
|
||||
}
|
||||
|
||||
success($locale['step_database_created_account']);
|
||||
$_SESSION['password'] = encrypt($password);
|
||||
$_SESSION['remember_me'] = true;
|
||||
|
||||
if($player_db->isLoaded()) {
|
||||
$player_db->save();
|
||||
}
|
||||
else {
|
||||
$player->save();
|
||||
}
|
||||
|
||||
$player_id = 0;
|
||||
$query = $db->query("SELECT `id` FROM `players` WHERE `name` = " . $db->quote('Admin') . ";");
|
||||
if($query->rowCount() == 1) {
|
||||
$query = $query->fetch();
|
||||
$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');
|
||||
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';
|
||||
if(fieldExist('deletion', 'players'))
|
||||
$deleted = 'deletion';
|
||||
|
||||
$insert_into_players = "INSERT INTO `players` (`id`, `name`, `group_id`, `account_id`, `level`, `vocation`, `health`, `healthmax`, `experience`, `lookbody`, `lookfeet`, `lookhead`, `looklegs`, `looktype`, `maglevel`, `mana`, `manamax`, `manaspent`, `soul`, `town_id`, `posx`, `posy`, `posz`, `conditions`, `cap`, `sex`, `lastlogin`, `lastip`, `save`, `lastlogout`, `balance`, `$deleted`, `created`, `hidden`, `comment`) VALUES ";
|
||||
$success = true;
|
||||
|
||||
$query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote('Rook Sample'));
|
||||
if($query->rowCount() == 0) {
|
||||
if(!query($insert_into_players . "(null, 'Rook Sample', 1, 1, 8, 0, 185, 185, 4200, 118, 114, 38, 57, 130, 0, 35, 35, 0, 100, 11, 2200, 1298, 7, '', 470, 1, 1255179613, 2453925456, 1, 1255179614, 0, 1, UNIX_TIMESTAMP(), 1, '');"))
|
||||
$success = false;
|
||||
}
|
||||
|
||||
$query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote('Sorcerer Sample'));
|
||||
if($query->rowCount() == 0) {
|
||||
if(!query($insert_into_players . "(null, 'Sorcerer Sample', 1, 1, 8, 1, 185, 185, 4200, 118, 114, 38, 57, 130, 0, 35, 35, 0, 100, 11, 2200, 1298, 7, '', 470, 1, 1255179571, 2453925456, 1, 1255179612, 0, 1, UNIX_TIMESTAMP(), 1, '');"))
|
||||
$success = false;
|
||||
}
|
||||
|
||||
$query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote('Druid Sample'));
|
||||
if($query->rowCount() == 0) {
|
||||
if(!query($insert_into_players . "(null, 'Druid Sample', 1, 1, 8, 2, 185, 185, 4200, 118, 114, 38, 57, 130, 0, 35, 35, 0, 100, 11, 2200, 1298, 7, '', 470, 1, 1255179655, 2453925456, 1, 1255179658, 0, 1, UNIX_TIMESTAMP(), 1, '');"))
|
||||
$success = false;
|
||||
}
|
||||
|
||||
$query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote('Paladin Sample'));
|
||||
if($query->rowCount() == 0) {
|
||||
if(!query($insert_into_players . "(null, 'Paladin Sample', 1, 1, 8, 3, 185, 185, 4200, 118, 114, 38, 57, 129, 0, 35, 35, 0, 100, 11, 2200, 1298, 7, '', 470, 1, 1255179854, 2453925456, 1, 1255179858, 0, 1, UNIX_TIMESTAMP(), 1, '');"))
|
||||
$success = false;
|
||||
}
|
||||
|
||||
$query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote('Knight Sample'));
|
||||
if($query->rowCount() == 0) {
|
||||
if(!query($insert_into_players . "(null, 'Knight Sample', 1, 1, 8, 4, 185, 185, 4200, 118, 114, 38, 57, 131, 0, 35, 35, 0, 100, 11, 2200, 1298, 7, '', 470, 1, 1255179620, 2453925456, 1, 1255179654, 0, 1, UNIX_TIMESTAMP(), 1, '');"))
|
||||
$success = false;
|
||||
}
|
||||
|
||||
if($success) {
|
||||
success($locale['step_database_imported_players']);
|
||||
}
|
||||
|
||||
$locale['step_finish_desc'] = str_replace('$ADMIN_PANEL$', generateLink(ADMIN_URL, $locale['step_finish_admin_panel'], true), $locale['step_finish_desc']);
|
||||
$locale['step_finish_desc'] = str_replace('$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']);
|
||||
|
||||
success($locale['step_finish_desc']);
|
||||
|
||||
if(!isset($_SESSION['installed'])) {
|
||||
file_get_contents('http://my-aac.org/report_install.php?v=' . MYAAC_VERSION . '&b=' . urlencode(BASE_URL));
|
||||
$_SESSION['installed'] = true;
|
||||
}
|
||||
|
||||
foreach($_SESSION as $key => $value) {
|
||||
if(strpos($key, 'var_') !== false)
|
||||
unset($_SESSION[$key]);
|
||||
}
|
||||
unset($_SESSION['saved']);
|
||||
}
|
||||
}
|
||||
?>
|
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
?>
|
||||
<form action="<?php echo BASE_URL; ?>install/" method="post">
|
||||
<input type="hidden" name="step" id="step" value="requirements" />
|
||||
<textarea rows="10" cols="80" readonly="1"><?php echo file_get_contents(BASE . 'LICENSE'); ?></textarea>
|
||||
|
||||
<?php echo next_buttons();
|
||||
?>
|
||||
</form>
|
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
if(isset($config['installed']) && $config['installed'] && !isset($_SESSION['saved'])) {
|
||||
echo '<p class="warning">' . $locale['already_installed'] . '</p>';
|
||||
}
|
||||
else {
|
||||
unset($_SESSION['saved']);
|
||||
?>
|
||||
<form action="<?php echo BASE_URL; ?>install/" method="post">
|
||||
<input type="hidden" name="step" id="step" value="license" />
|
||||
<div class="input"><p><?php echo $locale['step_welcome_desc']; ?></p>
|
||||
<select name="lang">
|
||||
<?php
|
||||
foreach(get_locales() as $tmp_locale)
|
||||
{
|
||||
$lang_file_main = LOCALE . $tmp_locale . '/main.php';
|
||||
$lang_file_install = LOCALE . $tmp_locale . '/install.php';
|
||||
if(@file_exists($lang_file_main)
|
||||
&& @file_exists($lang_file_install))
|
||||
{
|
||||
require($lang_file_main);
|
||||
echo '<option value="' . $tmp_locale . '">' . $locale['name'] . '</option>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<?php echo next_buttons(false, true); ?>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
?>
|
@@ -1,11 +1,20 @@
|
||||
{
|
||||
"name": "Example Plugin",
|
||||
"description": "This is just an example of a Plugin for MyAAC.",
|
||||
"version": "1.0",
|
||||
"author": "nobody",
|
||||
"contact": "nobody@example.org",
|
||||
"install": "plugins/example/install.php",
|
||||
"hooks": {
|
||||
"name": "Example Plugin",
|
||||
"description": "This is just an example of a Plugin for MyAAC.",
|
||||
"version": "1.0",
|
||||
"author": "nobody",
|
||||
"contact": "nobody@example.org",
|
||||
"require": {
|
||||
"myaac": "0.4.3",
|
||||
"php": "5.2.0"
|
||||
},
|
||||
"install": "plugins/example/install.php",
|
||||
"uninstall": [
|
||||
"plugins/example.json",
|
||||
"plugins/example/install.php",
|
||||
"plugins/example/before.php"
|
||||
],
|
||||
"hooks": {
|
||||
"Example Hook": {
|
||||
"type": "BEFORE_PAGE",
|
||||
"file": "plugins/example/before.php"
|
||||
|
39
system/bin/install_plugin.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
if(php_sapi_name() != "cli") {
|
||||
die('This script can be run only in command line mode.');
|
||||
}
|
||||
|
||||
require_once('../../common.php');
|
||||
require_once(SYSTEM . 'functions.php');
|
||||
require_once(SYSTEM . 'init.php');
|
||||
require_once(SYSTEM . 'hooks.php');
|
||||
require_once(LIBS . 'plugins.php');
|
||||
|
||||
if($argc != 2) {
|
||||
exit('This command expects one parameter: zip file name (plugin)' . PHP_EOL);
|
||||
}
|
||||
|
||||
$path_to_file = $argv[1];
|
||||
$ext = strtolower(pathinfo($path_to_file, PATHINFO_EXTENSION));
|
||||
if($ext != 'zip') {// check if it is zipped/compressed file
|
||||
exit('Please install only .zip files.' . PHP_EOL);
|
||||
}
|
||||
|
||||
if(!file_exists($path_to_file)) {
|
||||
exit('ERROR: File ' . $path_to_file . ' does not exist' . PHP_EOL);
|
||||
}
|
||||
|
||||
if(Plugins::install($path_to_file)) {
|
||||
foreach(Plugins::getWarnings() as $warning) {
|
||||
echo 'WARNING: ' . $warning;
|
||||
}
|
||||
|
||||
$info = Plugins::getPluginInfo();
|
||||
echo (isset($info['name']) ? $info['name'] . ' p' : 'P') . 'lugin has been successfully installed.';
|
||||
}
|
||||
else
|
||||
echo 'ERROR: ' . Plugins::getError();
|
||||
|
||||
echo PHP_EOL;
|
||||
?>
|
63
system/compat.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/**
|
||||
* Deprecated functions (compat)
|
||||
*
|
||||
* @package MyAAC
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
* @copyright 2017 MyAAC
|
||||
* @link http://my-aac.org
|
||||
*/
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
|
||||
function check_name($name, &$errors = '') {
|
||||
if(Validator::characterName($name))
|
||||
return true;
|
||||
|
||||
$errors = Validator::getLastError();
|
||||
return false;
|
||||
}
|
||||
|
||||
function check_account_id($id, &$errors = '') {
|
||||
if(Validator::accountId($id))
|
||||
return true;
|
||||
|
||||
$errors = Validator::getLastError();
|
||||
return false;
|
||||
}
|
||||
|
||||
function check_account_name($name, &$errors = '') {
|
||||
if(Validator::accountName($name))
|
||||
return true;
|
||||
|
||||
$errors = Validator::getLastError();
|
||||
return false;
|
||||
}
|
||||
|
||||
function check_name_new_char($name, &$errors = '') {
|
||||
if(Validator::newCharacterName($name))
|
||||
return true;
|
||||
|
||||
$errors = Validator::getLastError();
|
||||
return false;
|
||||
}
|
||||
|
||||
function check_rank_name($name, &$errors = '') {
|
||||
if(Validator::rankName($name))
|
||||
return true;
|
||||
|
||||
$errors = Validator::getLastError();
|
||||
return false;
|
||||
}
|
||||
|
||||
function check_guild_name($name, &$errors = '') {
|
||||
if(Validator::guildName($name))
|
||||
return true;
|
||||
|
||||
$errors = Validator::getLastError();
|
||||
return false;
|
||||
}
|
||||
|
||||
function news_place() {
|
||||
return tickers();
|
||||
}
|
||||
?>
|
@@ -5,7 +5,6 @@
|
||||
* @package MyAAC
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
* @copyright 2017 MyAAC
|
||||
* @version 0.3.0
|
||||
* @link http://my-aac.org
|
||||
*/
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
|
@@ -5,7 +5,6 @@
|
||||
* @package MyAAC
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
* @copyright 2017 MyAAC
|
||||
* @version 0.3.0
|
||||
* @link http://my-aac.org
|
||||
*/
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
@@ -15,19 +14,20 @@ $views_counter = 1; // default value, must be here!
|
||||
if($cache->enabled())
|
||||
{
|
||||
$value = 0;
|
||||
if(!$cache->fetch('views_counter', $value))
|
||||
if(!$cache->fetch('views_counter', $value) || $value <= 1)
|
||||
{
|
||||
$value = 0;
|
||||
if(fetchDatabaseConfig('views_counter', $value))
|
||||
$views_counter = $value;
|
||||
else
|
||||
registerDatabaseConfig('views_counter', 1); // save in the database
|
||||
registerDatabaseConfig('views_counter', 2); // save in the database
|
||||
}
|
||||
else
|
||||
else {
|
||||
$views_counter = $value;
|
||||
}
|
||||
|
||||
$cache->set('views_counter', ++$views_counter, 60 * 60);
|
||||
if(($views_counter % COUNTER_SYNC) == 0) // sync with database
|
||||
if($views_counter > 1 && ($views_counter % COUNTER_SYNC) == 0) // sync with database
|
||||
updateDatabaseConfig('views_counter', $views_counter);
|
||||
/*
|
||||
{
|
||||
|
@@ -5,7 +5,6 @@
|
||||
* @package MyAAC
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
* @copyright 2017 MyAAC
|
||||
* @version 0.3.0
|
||||
* @link http://my-aac.org
|
||||
*/
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
|
@@ -1,4 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* Database connection
|
||||
*
|
||||
* @package MyAAC
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
* @copyright 2017 MyAAC
|
||||
* @link http://my-aac.org
|
||||
*/
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
|
||||
if(!isset($config['database_type'][0]) || !isset($config['database_user'][0]) || !isset($config['database_password'][0]) || !isset($config['database_name'][0]))
|
||||
|
@@ -5,18 +5,29 @@
|
||||
* @package MyAAC
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
* @copyright 2017 MyAAC
|
||||
* @version 0.3.0
|
||||
* @link http://my-aac.org
|
||||
*/
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
function success($message) {
|
||||
echo '<p class="success">' . $message . '</p>';
|
||||
|
||||
function message($message, $type, $return)
|
||||
{
|
||||
if($return)
|
||||
return '<p class="' . $type . '">' . $message . '</p>';
|
||||
|
||||
echo '<p class="' . $type . '">' . $message . '</p>';
|
||||
return true;
|
||||
}
|
||||
function warning($message) {
|
||||
echo '<p class="warning">' . $message . '</p>';
|
||||
function success($message, $return = false) {
|
||||
return message($message, 'success', $return);
|
||||
}
|
||||
function error($message) {
|
||||
echo '<p class="error">' . $message . '</p>';
|
||||
function warning($message, $return = false) {
|
||||
return message($message, 'warning', $return);
|
||||
}
|
||||
function note($message, $return = false) {
|
||||
return message($message, 'note', $return);
|
||||
}
|
||||
function error($message, $return = false) {
|
||||
return message($message, 'error', $return);
|
||||
}
|
||||
|
||||
function longToIp($ip)
|
||||
@@ -29,46 +40,27 @@ function generateLink($url, $name, $blank = false) {
|
||||
return '<a href="' . $url . '"' . ($blank ? ' target="_blank"' : '') . '>' . $name . '</a>';
|
||||
}
|
||||
|
||||
function getLink($page, $name, $blank = false) {
|
||||
return generateLink(getPageLink($page), $name, $blank);
|
||||
function getFullLink($page, $name, $blank = false) {
|
||||
return generateLink(getLink($page), $name, $blank);
|
||||
}
|
||||
|
||||
function getPageLink($page, $action = null)
|
||||
function getLink($page, $action = null)
|
||||
{
|
||||
global $config;
|
||||
|
||||
// TODO: tibiacom template is not working correctly with this
|
||||
if($config['friendly_urls'])
|
||||
return BASE_URL . $page . ($action ? '/' . $action : '');
|
||||
|
||||
return BASE_URL . '?subtopic=' . $page . ($action ? '&action=' . $action : '');
|
||||
return BASE_URL . ($config['friendly_urls'] ? '' : '?') . $page . ($action ? '/' . $action : '');
|
||||
}
|
||||
function internalLayoutLink($page, $action = null) {return getPageLink($page, $action);}
|
||||
function internalLayoutLink($page, $action = null) {return getLink($page, $action);}
|
||||
|
||||
function getForumThreadLink($thread_id, $page = NULL)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$url = '';
|
||||
if($config['friendly_urls'])
|
||||
$url = BASE_URL . 'forum/thread/' . (int)$thread_id . (isset($page) ? '/' . $page : '');
|
||||
else
|
||||
$url = BASE_URL . '?subtopic=forum&action=show_thread&id=' . (int)$thread_id . (isset($page) ? '&page=' . $page : '');
|
||||
|
||||
return $url;
|
||||
return BASE_URL . ($config['friendly_urls'] ? '' : '?') . 'forum/thread/' . (int)$thread_id . (isset($page) ? '/' . $page : '');
|
||||
}
|
||||
|
||||
function getForumBoardLink($board_id, $page = NULL)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$url = '';
|
||||
if($config['friendly_urls'])
|
||||
$url = BASE_URL . 'forum/board/' . (int)$board_id . (isset($page) ? '/' . $page : '');
|
||||
else
|
||||
$url = BASE_URL . '?subtopic=forum&action=show_board&id=' . (int)$board_id . (isset($page) ? '&page=' . $page : '');
|
||||
|
||||
return $url;
|
||||
return BASE_URL . ($config['friendly_urls'] ? '' : '?') . 'forum/board/' . (int)$board_id . (isset($page) ? '/' . $page : '');
|
||||
}
|
||||
|
||||
function getPlayerLink($name, $generate = true)
|
||||
@@ -82,12 +74,8 @@ function getPlayerLink($name, $generate = true)
|
||||
if($player->isLoaded())
|
||||
$name = $player->getName();
|
||||
}
|
||||
|
||||
$url = '';
|
||||
if($config['friendly_urls'])
|
||||
$url = BASE_URL . 'characters/' . urlencode($name);
|
||||
else
|
||||
$url = BASE_URL . '?subtopic=characters&name=' . urlencode($name);
|
||||
|
||||
$url = BASE_URL . ($config['friendly_urls'] ? '' : '?') . 'characters/' . urlencode($name);
|
||||
|
||||
if(!$generate) return $url;
|
||||
return generateLink($url, $name);
|
||||
@@ -106,13 +94,9 @@ function getHouseLink($name, $generate = true)
|
||||
if($house->rowCount() > 0)
|
||||
$name = $house->fetchColumn();
|
||||
}
|
||||
|
||||
$url = '';
|
||||
if($config['friendly_urls'])
|
||||
$url = BASE_URL . 'houses/' . urlencode($name);
|
||||
else
|
||||
$url = BASE_URL . '?subtopic=houses&page=view&house=' . urlencode($name);
|
||||
|
||||
|
||||
$url = BASE_URL . ($config['friendly_urls'] ? '' : '?') . 'houses/' . urlencode($name);
|
||||
|
||||
if(!$generate) return $url;
|
||||
return generateLink($url, $name);
|
||||
}
|
||||
@@ -124,31 +108,43 @@ function getGuildLink($name, $generate = true)
|
||||
if(is_numeric($name))
|
||||
{
|
||||
$guild = $db->query(
|
||||
'SELECT ' . $db->fieldName('name') .
|
||||
' FROM ' . $db->tableName('guilds') .
|
||||
' WHERE ' . $db->fieldName('id') . ' = ' . (int)$name);
|
||||
'SELECT `name` FROM `guilds` WHERE `id` = ' . (int)$name);
|
||||
if($guild->rowCount() > 0)
|
||||
$name = $guild->fetchColumn();
|
||||
}
|
||||
|
||||
$url = '';
|
||||
if($config['friendly_urls'])
|
||||
$url = BASE_URL . 'guilds/' . urlencode($name);
|
||||
else
|
||||
$url = BASE_URL . '?subtopic=guilds&action=show&guild=' . urlencode($name);
|
||||
$url = BASE_URL . ($config['friendly_urls'] ? '' : '?') . 'guilds/' . urlencode($name);
|
||||
|
||||
if(!$generate) return $url;
|
||||
return generateLink($url, $name);
|
||||
}
|
||||
|
||||
function getItemNameById($id) {
|
||||
global $db;
|
||||
$query = $db->query('SELECT `name` FROM `' . TABLE_PREFIX . 'items` WHERE `id` = ' . $db->quote($id) . ' LIMIT 1;');
|
||||
if($query->rowCount() == 1) {
|
||||
$item = $query->fetch();
|
||||
return $item['name'];
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
function getItemImage($id, $count = 1)
|
||||
{
|
||||
$tooltip = '';
|
||||
|
||||
$name = getItemNameById($id);
|
||||
if(!empty($name)) {
|
||||
$tooltip = ' class="tooltip" title="' . $name . '"';
|
||||
}
|
||||
|
||||
$file_name = $id;
|
||||
if($count > 1)
|
||||
$file_name .= '-' . $count;
|
||||
|
||||
global $config;
|
||||
return '<img src="' . $config['item_images_url'] . $file_name . '.gif" width="32" height="32" border="0" alt=" ' .$id . '" />';
|
||||
return '<img src="' . $config['item_images_url'] . $file_name . '.gif"' . $tooltip . ' width="32" height="32" border="0" alt=" ' .$id . '" />';
|
||||
}
|
||||
|
||||
function getFlagImage($country)
|
||||
@@ -218,10 +214,11 @@ function generateRandomString($length, $lowCase = true, $upCase = false, $numeri
|
||||
*
|
||||
* @return array Forum sections.
|
||||
*/
|
||||
function getForumSections()
|
||||
function getForumBoards()
|
||||
{
|
||||
global $db;
|
||||
$sections = $db->query('SELECT `id`, `name`, `description`, `closed` FROM ' . TABLE_PREFIX . 'forum_sections WHERE hidden != 1 ORDER BY `ordering`;');
|
||||
global $db, $canEdit;
|
||||
$sections = $db->query('SELECT `id`, `name`, `description`, `closed`, `guild`, `access`' . ($canEdit ? ', `hidden`, `ordering`' : '') . ' FROM `' . TABLE_PREFIX . 'forum_boards` ' . (!$canEdit ? ' WHERE `hidden` != 1' : '') .
|
||||
' ORDER BY `ordering`;');
|
||||
if($sections)
|
||||
return $sections->fetchAll();
|
||||
|
||||
@@ -255,7 +252,7 @@ function fetchDatabaseConfig($name, &$value)
|
||||
*/
|
||||
function getDatabaseConfig($name)
|
||||
{
|
||||
$value = NULL;
|
||||
$value = null;
|
||||
fetchDatabaseConfig($name, $value);
|
||||
return $value;
|
||||
}
|
||||
@@ -406,303 +403,6 @@ function delete_guild($id)
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate character name.
|
||||
* Name lenght must be 3-25 chars
|
||||
*
|
||||
* @param string $name Name to check
|
||||
* @param string $error Error description will be placed here
|
||||
* @return bool Is name valid?
|
||||
*/
|
||||
function check_name($name, &$error = '')
|
||||
{
|
||||
if(!isset($name[0]))
|
||||
{
|
||||
$error = 'Please enter character name.';
|
||||
return false;
|
||||
}
|
||||
|
||||
$length = strlen($name);
|
||||
if($length < 3)
|
||||
{
|
||||
$error = 'Character name is too short. Min. lenght <b>3</b> characters.';
|
||||
return false;
|
||||
}
|
||||
|
||||
if($length > 25)
|
||||
{
|
||||
$error = 'Character name is too long. Max. lenght <b>25</b> characters.';
|
||||
return false;
|
||||
}
|
||||
|
||||
if(strspn($name, "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM- [ ] '") != $length)
|
||||
{
|
||||
$error = 'Invalid name format. Use only A-Z.';
|
||||
return false;
|
||||
}
|
||||
|
||||
return preg_match("/[A-z ']{1,25}/", $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate account id
|
||||
* Id lenght must be 6-10 chars
|
||||
*
|
||||
* @param string $name Account name to check
|
||||
* @param string $error Error description will be placed here
|
||||
* @return bool Is account name valid?
|
||||
*/
|
||||
function check_account_id($id, &$error = '')
|
||||
{
|
||||
if(!isset($id[0]))
|
||||
{
|
||||
$error = 'Please enter an account.';
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!check_number($id)) {
|
||||
$error = 'Invalid account name format. Use only numbers 0-9.';
|
||||
return false;
|
||||
}
|
||||
|
||||
$length = strlen($id);
|
||||
if($length < 6)
|
||||
{
|
||||
$error = 'Account is too short (min. 6 chars).';
|
||||
return false;
|
||||
}
|
||||
|
||||
if($length > 10)
|
||||
{
|
||||
$error = 'Account is too long (max. 10 chars).';
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate account name
|
||||
* Name lenght must be 3-32 chars
|
||||
*
|
||||
* @param string $name Account name to check
|
||||
* @param string $error Error description will be placed here
|
||||
* @return bool Is account name valid?
|
||||
*/
|
||||
function check_account_name($name, &$error = '')
|
||||
{
|
||||
if(!isset($name[0]))
|
||||
{
|
||||
$error = 'Please enter an account name.';
|
||||
return false;
|
||||
}
|
||||
|
||||
$length = strlen($name);
|
||||
if($length < 3)
|
||||
{
|
||||
$error = 'Account name is too short (min. 3 chars).';
|
||||
return false;
|
||||
}
|
||||
|
||||
if($length > 32)
|
||||
{
|
||||
$error = 'Account name is too long (max. 32 chars).';
|
||||
return false;
|
||||
}
|
||||
|
||||
if(strspn($name, "QWERTYUIOPASDFGHJKLZXCVBNM0123456789") != $length)
|
||||
{
|
||||
$error = 'Invalid account name format. Use only A-Z and numbers 0-9.';
|
||||
return false;
|
||||
}
|
||||
|
||||
return preg_match("/[A-Z0-9]/", $name);
|
||||
}
|
||||
|
||||
//is it valid nick for new char?
|
||||
function check_name_new_char($name, &$error = '')
|
||||
{
|
||||
global $db, $config;
|
||||
|
||||
$name_lower = strtolower($name);
|
||||
|
||||
$first_words_blocked = array('admin ', 'administrator ', 'gm ', 'cm ', 'god ','tutor ', "'", '-');
|
||||
foreach($first_words_blocked as $word)
|
||||
{
|
||||
if($word == substr($name_lower, 0, strlen($word))) {
|
||||
$error = 'Your name contains blocked words.';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(substr($name_lower, -1) == "'" || substr($name_lower, -1) == "-") {
|
||||
$error = 'Your name contains illegal characters.';
|
||||
return false;
|
||||
}
|
||||
|
||||
if(substr($name_lower, 1, 1) == ' ') {
|
||||
$error = 'Your name contains illegal space.';
|
||||
return false;
|
||||
}
|
||||
|
||||
if(substr($name_lower, -2, 1) == " ") {
|
||||
$error = 'Your name contains illegal space.';
|
||||
return false;
|
||||
}
|
||||
|
||||
if(strtolower($config['lua']['serverName']) == $name_lower) {
|
||||
$error = 'Your name cannot be same as server name.';
|
||||
return false;
|
||||
}
|
||||
|
||||
$names_blocked = array('admin', 'administrator', 'gm', 'cm', 'god', 'tutor');
|
||||
foreach($names_blocked as $word)
|
||||
{
|
||||
if($word == $name_lower) {
|
||||
$error = 'Your name contains blocked words.';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$words_blocked = array('admin', 'administrator', 'gamemaster', 'game master', 'game-master', "game'master", '--', "''","' ", " '", '- ', ' -', "-'", "'-", 'fuck', 'sux', 'suck', 'noob', 'tutor');
|
||||
foreach($words_blocked as $word)
|
||||
{
|
||||
if(!(strpos($name_lower, $word) === false)) {
|
||||
$error = 'Your name contains illegal words.';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$name_length = strlen($name_lower);
|
||||
for($i = 0; $i < $name_length; $i++)
|
||||
{
|
||||
if(isset($name_lower[$i]) && isset($name_lower[$i + 1]) && $name_lower[$i] == $name_lower[$i + 1] && isset($name_lower[$i + 2]) && $name_lower[$i] == $name_lower[$i + 2]) {
|
||||
$error = 'Your name is invalid.';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for($i = 0; $i < $name_length; $i++)
|
||||
{
|
||||
if(isset($name_lower[$i - 1]) && $name_lower[$i - 1] == ' ' && isset($name_lower[$i + 1]) && $name_lower[$i + 1] == ' ') {
|
||||
$error = 'Your name contains too many spaces.';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($config['monsters']))
|
||||
{
|
||||
if(in_array($name_lower, $config['monsters'])) {
|
||||
$error = 'Your name cannot contains monster name.';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$player = new OTS_Player();
|
||||
$player->find($name);
|
||||
if($player->isLoaded()) {
|
||||
$error = 'Player with this name already exist.';
|
||||
return false;
|
||||
}
|
||||
|
||||
//check if was namelocked previously
|
||||
if(tableExist('player_namelocks') && fieldExist('name', 'player_namelocks')) {
|
||||
$namelock = $db->query('SELECT `player_id` FROM `player_namelocks` WHERE `name` = ' . $db->quote($name));
|
||||
if($namelock->rowCount() > 0) {
|
||||
$error = 'Character with this name has been namelocked.';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$monsters = $db->query(
|
||||
'SELECT ' . $db->fieldName('name') .
|
||||
' FROM ' . $db->tableName(TABLE_PREFIX . 'monsters') .
|
||||
' WHERE ' . $db->fieldName('name') . ' LIKE ' . $db->quote($name_lower));
|
||||
if($monsters->rowCount() > 0) {
|
||||
$error = 'Your name cannot contains monster name.';
|
||||
return false;
|
||||
}
|
||||
|
||||
$spells_name = $db->query(
|
||||
'SELECT ' . $db->fieldName('name') .
|
||||
' FROM ' . $db->tableName(TABLE_PREFIX . 'spells') .
|
||||
' WHERE ' . $db->fieldName('name') . ' LIKE ' . $db->quote($name_lower));
|
||||
if($spells_name->rowCount() > 0) {
|
||||
$error = 'Your name cannot contains spell name.';
|
||||
return false;
|
||||
}
|
||||
|
||||
$spells_words = $db->query(
|
||||
'SELECT ' . $db->fieldName('words') .
|
||||
' FROM ' . $db->tableName(TABLE_PREFIX . 'spells') .
|
||||
' WHERE ' . $db->fieldName('words') . ' = ' . $db->quote($name_lower));
|
||||
if($spells_words->rowCount() > 0) {
|
||||
$error = 'Your name cannot contains spell name.';
|
||||
return false;
|
||||
}
|
||||
|
||||
if(isset($config['npc']))
|
||||
{
|
||||
if(in_array($name_lower, $config['npc'])) {
|
||||
$error = 'Your name cannot contains NPC name.';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(strspn($name, "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM- '") != $name_length) {
|
||||
$error = 'This name contains invalid letters, words or format. Please use only a-Z, - , \' and space.';
|
||||
return false;
|
||||
}
|
||||
|
||||
if($name_length < 3 || $name_length > 28) {
|
||||
$error = 'Your name cannot be shorter than 3 characters and longer than 28 characters.';
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if(!preg_match("/[A-z ']{3,28}/", $name)) {
|
||||
$error = 'Your name containst illegal characters.';
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function check_rank_name($name)
|
||||
{
|
||||
if(strspn($name, "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM0123456789-[ ] ") != strlen($name))
|
||||
return false;
|
||||
|
||||
return preg_match("/[A-z ]{1,32}/", $name);
|
||||
}
|
||||
|
||||
function check_guild_name($name)
|
||||
{
|
||||
if(strspn($name, "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM0123456789- ") != strlen($name))
|
||||
return false;
|
||||
|
||||
return preg_match("/[A-z ]{3,32}/", $name);
|
||||
}
|
||||
|
||||
function check_password($pass)
|
||||
{
|
||||
if(strspn($pass, "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890") != strlen($pass))
|
||||
return false;
|
||||
|
||||
return preg_match("/[A-z0-9]/", $pass);
|
||||
}
|
||||
|
||||
function check_mail($email)
|
||||
{
|
||||
return 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);
|
||||
//return preg_match("/[A-z0-9._-]+@[A-z0-9-]+\.[A-z]{2,4}/", $email);
|
||||
}
|
||||
|
||||
function check_number($number)
|
||||
{
|
||||
return preg_match ("/^([0-9]+)$/", $number);
|
||||
}
|
||||
|
||||
//################### DISPLAY FUNCTIONS #####################
|
||||
//return shorter text (news ticker)
|
||||
function short_text($text, $limit)
|
||||
@@ -713,64 +413,16 @@ function short_text($text, $limit)
|
||||
return $text;
|
||||
}
|
||||
|
||||
function news_place()
|
||||
function tickers()
|
||||
{
|
||||
global $template_path, $news_content;
|
||||
|
||||
$news = '';
|
||||
if(PAGE == 'news')
|
||||
{
|
||||
//add tickers to site - without it tickers will not be showed
|
||||
if(isset($news_content))
|
||||
$news .= $news_content;
|
||||
|
||||
//featured article
|
||||
/* $news .= ' <div id="featuredarticle" class="Box">
|
||||
<div class="Corner-tl" style="background-image:url('.$template_path.'/images/content/corner-tl.gif);"></div>
|
||||
<div class="Corner-tr" style="background-image:url('.$template_path.'/images/content/corner-tr.gif);"></div>
|
||||
<div class="Border_1" style="background-image:url('.$template_path.'/images/content/border-1.gif);"></div>
|
||||
<div class="BorderTitleText" style="background-image:url('.$template_path.'/images/content/title-background-green.gif);"></div>
|
||||
<img class="Title" src="'.$template_path.'/images/strings/headline-featuredarticle.gif" alt="Contentbox headline" />
|
||||
<div class="Border_2">
|
||||
<div class="Border_3">
|
||||
<div class="BoxContent" style="background-image:url('.$template_path.'/images/content/scroll.gif);">
|
||||
<div id=\'TeaserThumbnail\'><img src="'.$template_path.'/images/news/features.jpg" width=150 height=100 border=0 alt="" /></div><div id=\'TeaserText\'><div style="position: relative; top: -2px; margin-bottom: 2px;" >
|
||||
<b>Tutaj wpisz tytul</b></div>
|
||||
tutaj wpisz tresc newsa<br>
|
||||
zdjecie laduje sie w <i>tibiacom/images/news/features.jpg</i><br>
|
||||
skad sie laduje mozesz zmienic linijke ponad komentarzem
|
||||
</div> </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="Border_1" style="background-image:url('.$template_path.'/images/content/border-1.gif);"></div>
|
||||
<div class="CornerWrapper-b"><div class="Corner-bl" style="background-image:url('.$template_path.'/images/content/corner-bl.gif);"></div></div>
|
||||
<div class="CornerWrapper-b"><div class="Corner-br" style="background-image:url('.$template_path.'/images/content/corner-br.gif);"></div></div>
|
||||
</div>';*/
|
||||
global $tickers_content, $featured_article;
|
||||
|
||||
if(PAGE == 'news') {
|
||||
if(isset($tickers_content))
|
||||
return $tickers_content . $featured_article;
|
||||
}
|
||||
|
||||
return $news;
|
||||
}
|
||||
|
||||
function output_errors($errors)
|
||||
{
|
||||
global $template_path;
|
||||
?>
|
||||
<div class="SmallBox" >
|
||||
<div class="MessageContainer" >
|
||||
<div class="BoxFrameHorizontal" style="background-image:url(<?php echo $template_path; ?>/images/content/box-frame-horizontal.gif);" /></div>
|
||||
<div class="BoxFrameEdgeLeftTop" style="background-image:url(<?php echo $template_path; ?>/images/content/box-frame-edge.gif);" /></div>
|
||||
<div class="BoxFrameEdgeRightTop" style="background-image:url(<?php echo $template_path; ?>/images/content/box-frame-edge.gif);" /></div>
|
||||
<div class="ErrorMessage" >
|
||||
<div class="BoxFrameVerticalLeft" style="background-image:url(<?php echo $template_path; ?>/images/content/box-frame-vertical.gif);" />
|
||||
</div>
|
||||
<div class="BoxFrameVerticalRight" style="background-image:url(<?php echo $template_path; ?>/images/content/box-frame-vertical.gif);" /></div>
|
||||
<div class="AttentionSign" style="background-image:url(<?php echo $template_path; ?>/images/content/attentionsign.gif);" />
|
||||
</div><b>The Following Errors Have Occurred:</b><br/>
|
||||
<?php
|
||||
foreach($errors as $field => $message)
|
||||
echo $message . '<br/>';
|
||||
|
||||
echo '</div> <div class="BoxFrameHorizontal" style="background-image:url('.$template_path.'/images/content/box-frame-horizontal.gif);" /></div> <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></div> <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></div> </div></div><br/>';
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -809,8 +461,8 @@ function template_header($is_admin = false)
|
||||
<meta http-equiv="content-type" content="text/html; charset=' . $charset . '" />';
|
||||
if(!$is_admin)
|
||||
$ret .= '
|
||||
<title>' . $title_full . '</title>
|
||||
<base href="' . BASE_URL . '" />';
|
||||
<base href="' . BASE_URL . '" />
|
||||
<title>' . $title_full . '</title>';
|
||||
|
||||
$ret .= '
|
||||
<meta name="description" content="' . $config['meta_description'] . '" />
|
||||
@@ -823,11 +475,7 @@ function template_header($is_admin = false)
|
||||
Please turn it on, or be aware that some features on this website will not work correctly.</div>
|
||||
</noscript>
|
||||
';
|
||||
if(admin())
|
||||
$ret .= '<!--script type="text/javascript" src="' . BASE_URL . 'tools/tiny_mce/tiny_mce.js"></script>
|
||||
<script type="text/javascript" src="' . BASE_URL . 'tools/jquery.qtip.js" ></script>
|
||||
<script type="text/javascript" src="' . BASE_URL . 'tools/admin.js"></script-->
|
||||
';
|
||||
|
||||
if($config['recaptcha_enabled'])
|
||||
$ret .= "<script src='https://www.google.com/recaptcha/api.js'></script>";
|
||||
return $ret;
|
||||
@@ -838,13 +486,14 @@ function template_header($is_admin = false)
|
||||
*/
|
||||
function template_footer()
|
||||
{
|
||||
global $visitors, $config, $views_counter;
|
||||
global $config, $views_counter;
|
||||
$ret = '';
|
||||
if(admin())
|
||||
$ret .= generateLink(ADMIN_URL, 'Admin Panel', true);
|
||||
|
||||
if($config['visitors_counter'])
|
||||
{
|
||||
global $visitors;
|
||||
$amount = $visitors->getAmountVisitors();
|
||||
$ret .= '<br/>Currently there ' . ($amount > 1 ? 'are' : 'is') . ' ' . $amount . ' visitor' . ($amount > 1 ? 's' : '') . '.';
|
||||
}
|
||||
@@ -864,21 +513,11 @@ function template_footer()
|
||||
|
||||
function template_ga_code()
|
||||
{
|
||||
global $config;
|
||||
global $config, $twig;
|
||||
if(!isset($config['google_analytics_id'][0]))
|
||||
return '';
|
||||
|
||||
return "
|
||||
<script>
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
|
||||
|
||||
ga('create', '" . $config['google_analytics_id'] . "', 'auto');
|
||||
ga('send', 'pageview');
|
||||
|
||||
</script>";
|
||||
return $twig->render('google_analytics.html.twig');
|
||||
}
|
||||
|
||||
function template_form()
|
||||
@@ -920,6 +559,8 @@ function getCreatureName($killer, $showStatus = false, $extendedInfo = false)
|
||||
{
|
||||
global $vowels, $ots, $config;
|
||||
$str = "";
|
||||
$players_rows = '';
|
||||
|
||||
if(is_numeric($killer))
|
||||
{
|
||||
$player = $ots->createObject('Player');
|
||||
@@ -1029,7 +670,7 @@ function getSkillName($skillId, $suffix = true)
|
||||
*/
|
||||
function hasFlag($flag) {
|
||||
global $logged, $logged_flags;
|
||||
return $logged && ($logged_flags & $flag) == $flag;
|
||||
return ($logged && ($logged_flags & $flag) == $flag);
|
||||
}
|
||||
/**
|
||||
* Check if current logged user have got admin flag set.
|
||||
@@ -1122,15 +763,32 @@ function get_templates()
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates list of installed plugins
|
||||
* @return array $plugins
|
||||
*/
|
||||
function get_plugins()
|
||||
{
|
||||
$ret = array();
|
||||
|
||||
$path = PLUGINS;
|
||||
foreach(scandir($path) as $file) {
|
||||
$file_ext = pathinfo($file, PATHINFO_EXTENSION);
|
||||
$file_name = pathinfo($file, PATHINFO_FILENAME);
|
||||
if ($file == '.' || $file == '..' || $file == 'disabled' || $file == 'example.json' || is_dir($path . $file) || $file_ext != 'json')
|
||||
continue;
|
||||
|
||||
$ret[] = str_replace('.json', '', $file_name);
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
function getWorldName($id)
|
||||
{
|
||||
global $config;
|
||||
foreach($config['worlds'] as $_id => $details)
|
||||
{
|
||||
if($id == $_id)
|
||||
return $details['name'];
|
||||
}
|
||||
|
||||
if(isset($config['worlds'][$id]))
|
||||
return $config['worlds'][$id];
|
||||
|
||||
return $config['lua']['serverName'];
|
||||
}
|
||||
|
||||
@@ -1202,7 +860,7 @@ function convert_bytes($size)
|
||||
function log_append($file, $str)
|
||||
{
|
||||
$f = fopen(LOGS . $file, 'a');
|
||||
fwrite($f, $str . PHP_EOL);
|
||||
fwrite($f, '[' . date(DateTime::RFC1123) . '] ' . $str . PHP_EOL);
|
||||
fclose($f);
|
||||
}
|
||||
|
||||
@@ -1212,20 +870,152 @@ function load_config_lua($filename)
|
||||
|
||||
$config_file = $filename;
|
||||
if(!@file_exists($config_file))
|
||||
die('ERROR: Cannot find ' . $filename . ' file.');
|
||||
{
|
||||
log_append('error.log', '[load_config_file] Fatal error: Cannot load config.lua (' . $filename . '). Error: ' . print_r(error_get_last(), true));
|
||||
die('ERROR: Cannot find ' . $filename . ' file. More info in system/logs/error.log');
|
||||
}
|
||||
|
||||
$tempFile = @tempnam('/tmp', 'lua');
|
||||
$file = fopen($tempFile, 'w');
|
||||
if(!$file) die('Cannot load server config!');
|
||||
$result = array();
|
||||
$config_string = file_get_contents($filename);
|
||||
$config_string = str_replace("\r\n", "\n", $config_string);
|
||||
$config_string = str_replace("\r", "\n", $config_string);
|
||||
$lines = explode("\n", $config_string);
|
||||
if(count($lines) > 0)
|
||||
foreach($lines as $ln => $line)
|
||||
{
|
||||
$tmp_exp = explode('=', $line, 2);
|
||||
if(strpos($line, 'dofile') !== false)
|
||||
{
|
||||
$delimiter = '"';
|
||||
if(strpos($line, $delimiter) === false)
|
||||
$delimiter = "'";
|
||||
|
||||
$tmp = explode($delimiter, $line);
|
||||
$result = array_merge($result, load_config_lua($config['server_path'] . $tmp[1]));
|
||||
}
|
||||
else if(count($tmp_exp) >= 2)
|
||||
{
|
||||
$key = trim($tmp_exp[0]);
|
||||
if(substr($key, 0, 2) != '--')
|
||||
{
|
||||
$value = trim($tmp_exp[1]);
|
||||
if(strpos($value, '--') !== false) {// found some deep comment
|
||||
$value = preg_replace('/--.*$/i', '', $value);
|
||||
}
|
||||
|
||||
if(is_numeric($value))
|
||||
$result[$key] = (float) $value;
|
||||
elseif(in_array(substr($value, 0 , 1), array("'", '"')) && in_array(substr($value, -1 , 1), array("'", '"')))
|
||||
$result[$key] = (string) substr(substr($value, 1), 0, -1);
|
||||
elseif(in_array($value, array('true', 'false')))
|
||||
$result[$key] = ($value == 'true') ? true : false;
|
||||
else
|
||||
{
|
||||
foreach($result as $tmp_key => $tmp_value) // load values definied by other keys, like: dailyFragsToBlackSkull = dailyFragsToRedSkull
|
||||
$value = str_replace($tmp_key, $tmp_value, $value);
|
||||
$ret = @eval("return $value;");
|
||||
if((string) $ret == '') // = parser error
|
||||
{
|
||||
die('ERROR: Loading config.lua file. Line <b>' . ($ln + 1) . '</b> of LUA config file is not valid [key: <b>' . $key . '</b>]');
|
||||
}
|
||||
$result[$key] = $ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// TODO: new parser that will also load dofile() includes
|
||||
|
||||
// strip lua comments to prevent parsing errors
|
||||
fwrite($file, preg_replace('/(-)(-)(.*)/', '', file_get_contents($config_file)));
|
||||
fclose($file);
|
||||
|
||||
$result = array_merge(parse_ini_file($tempFile, true), isset($config['lua']) ? $config['lua'] : array());
|
||||
@unlink($tempFile);
|
||||
$result = array_merge($result, isset($config['lua']) ? $config['lua'] : array());
|
||||
return $result;
|
||||
}
|
||||
|
||||
function str_replace_first($search, $replace, $subject) {
|
||||
$pos = strpos($subject, $search);
|
||||
if ($pos !== false) {
|
||||
return substr_replace($subject, $replace, $pos, strlen($search));
|
||||
}
|
||||
|
||||
return $subject;
|
||||
}
|
||||
|
||||
function setSession($key, $data) {
|
||||
global $config;
|
||||
$_SESSION[$config['session_prefix'] . $key] = $data;
|
||||
}
|
||||
function getSession($key) {
|
||||
global $config;
|
||||
return (isset($_SESSION[$config['session_prefix'] . $key])) ? $_SESSION[$config['session_prefix'] . $key] : false;
|
||||
}
|
||||
function unsetSession($key) {
|
||||
global $config;
|
||||
unset($_SESSION[$config['session_prefix'] . $key]);
|
||||
}
|
||||
|
||||
function getTopPlayers($limit = 5) {
|
||||
global $cache, $config, $db;
|
||||
|
||||
$fetch_from_db = true;
|
||||
if($cache->enabled())
|
||||
{
|
||||
$tmp = '';
|
||||
if($cache->fetch('top_' . $limit . '_level', $tmp))
|
||||
{
|
||||
$players = unserialize($tmp);
|
||||
$fetch_from_db = false;
|
||||
}
|
||||
}
|
||||
|
||||
if($fetch_from_db)
|
||||
{
|
||||
$deleted = 'deleted';
|
||||
if(fieldExist('deletion', 'players'))
|
||||
$deleted = 'deletion';
|
||||
|
||||
$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;
|
||||
foreach($players as &$player) {
|
||||
$player['rank'] = ++$i;
|
||||
}
|
||||
|
||||
if($cache->enabled())
|
||||
$cache->set('top_' . $limit . '_level', serialize($players), 120);
|
||||
}
|
||||
|
||||
return $players;
|
||||
}
|
||||
|
||||
function deleteDirectory($dir) {
|
||||
if(!file_exists($dir)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!is_dir($dir)) {
|
||||
return unlink($dir);
|
||||
}
|
||||
|
||||
foreach(scandir($dir) as $item) {
|
||||
if($item == '.' || $item == '..') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!deleteDirectory($dir . DIRECTORY_SEPARATOR . $item)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return rmdir($dir);
|
||||
}
|
||||
|
||||
// validator functions
|
||||
require_once(LIBS . 'validator.php');
|
||||
require_once(SYSTEM . 'compat.php');
|
||||
?>
|
||||
|
@@ -5,7 +5,6 @@
|
||||
* @package MyAAC
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
* @copyright 2017 MyAAC
|
||||
* @version 0.3.0
|
||||
* @link http://my-aac.org
|
||||
*/
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
@@ -16,17 +15,14 @@ define('HOOK_AFTER_PAGE', 3);
|
||||
define('HOOK_FINISH', 4);
|
||||
define('HOOK_TIBIACOM_ARTICLE', 5);
|
||||
define('HOOK_TIBIACOM_BORDER_3', 6);
|
||||
define('HOOK_CHARACTERS_BEFORE_INFORMATIONS', 7);
|
||||
define('HOOK_CHARACTERS_AFTER_INFORMATIONS', 8);
|
||||
define('HOOK_CHARACTERS_BEFORE_SIGNATURE', 9);
|
||||
define('HOOK_CHARACTERS_AFTER_SIGNATURE', 10);
|
||||
define('HOOK_CHARACTERS_AFTER_ACCOUNT', 11);
|
||||
define('HOOK_CHARACTERS_AFTER_CHARACTERS', 12);
|
||||
define('HOOK_FIRST', HOOK_STARTUP);
|
||||
define('HOOK_LAST', HOOK_TIBIACOM_BORDER_3);
|
||||
|
||||
$hook_types = array(
|
||||
'STARTUP' => HOOK_STARTUP,
|
||||
'BEFORE_PAGE' => HOOK_BEFORE_PAGE,
|
||||
'AFTER_PAGE' => HOOK_AFTER_PAGE,
|
||||
'FINISH' => HOOK_FINISH,
|
||||
'TIBIACOM_ARTICLE' => HOOK_TIBIACOM_ARTICLE,
|
||||
'TIBIACOM_BORDER_3' => HOOK_TIBIACOM_BORDER_3
|
||||
);
|
||||
define('HOOK_LAST', HOOK_CHARACTERS_AFTER_CHARACTERS);
|
||||
|
||||
class Hook
|
||||
{
|
||||
@@ -46,7 +42,7 @@ class Hook
|
||||
$ret = $tmp($params);
|
||||
}*/
|
||||
|
||||
global $db, $config, $template_path, $ots;
|
||||
global $db, $config, $template_path, $ots, $content;
|
||||
if(file_exists(BASE . $this->_file)) {
|
||||
require(BASE . $this->_file);
|
||||
}
|
||||
@@ -84,7 +80,7 @@ class Hooks
|
||||
public function load()
|
||||
{
|
||||
global $db;
|
||||
$hooks = $db->query('SELECT `name`, `type`, `file` FROM `' . TABLE_PREFIX . 'hooks` WHERE `enabled` = 1;');
|
||||
$hooks = $db->query('SELECT `name`, `type`, `file` FROM `' . TABLE_PREFIX . 'hooks` WHERE `enabled` = 1 ORDER BY `ordering`;');
|
||||
foreach($hooks as $hook)
|
||||
$this->register($hook['name'], $hook['type'], $hook['file']);
|
||||
}
|
||||
|
@@ -5,7 +5,6 @@
|
||||
* @package MyAAC
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
* @copyright 2017 MyAAC
|
||||
* @version 0.3.0
|
||||
* @link http://my-aac.org
|
||||
*/
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
@@ -14,12 +13,17 @@ require_once(BASE . 'config.php');
|
||||
if(file_exists(BASE . 'config.local.php')) // user customizations
|
||||
require(BASE . 'config.local.php');
|
||||
|
||||
if(!isset($config['installed']) || !$config['installed']) {
|
||||
die('MyAAC has not been installed yet or there was error during installation. Please install again.');
|
||||
}
|
||||
|
||||
date_default_timezone_set($config['date_timezone']);
|
||||
// take care of trailing slash at the end
|
||||
if($config['server_path'][strlen($config['server_path']) - 1] != '/')
|
||||
$config['server_path'] .= '/';
|
||||
|
||||
// enable gzip compression if supported by the browser
|
||||
if($config['gzip_output'] && (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false) && function_exists('ob_gzhandler'))
|
||||
if($config['gzip_output'] && isset($_SERVER['HTTP_ACCEPT_ENCODING']) && strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && function_exists('ob_gzhandler'))
|
||||
ob_start('ob_gzhandler');
|
||||
|
||||
// cache
|
||||
@@ -27,12 +31,13 @@ require_once(SYSTEM . 'libs/cache.php');
|
||||
$cache = Cache::getInstance($config['cache_engine'], $config['cache_prefix']);
|
||||
|
||||
// twig
|
||||
require_once LIBS . 'twig/Autoloader.php';
|
||||
require_once(LIBS . 'Twig/Autoloader.php');
|
||||
Twig_Autoloader::register();
|
||||
|
||||
$loader = new Twig_Loader_Filesystem(SYSTEM . 'templates');
|
||||
$twig = new Twig_Environment($loader, array(
|
||||
$twig_loader = new Twig_Loader_Filesystem(SYSTEM . 'templates');
|
||||
$twig = new Twig_Environment($twig_loader, array(
|
||||
'cache' => CACHE . 'twig/',
|
||||
'auto_reload' => true
|
||||
));
|
||||
|
||||
$function = new Twig_SimpleFunction('getStyle', function ($i) {
|
||||
@@ -40,6 +45,22 @@ $function = new Twig_SimpleFunction('getStyle', function ($i) {
|
||||
});
|
||||
$twig->addFunction($function);
|
||||
|
||||
$function = new Twig_SimpleFunction('getLink', function ($s) {
|
||||
return getLink($s);
|
||||
});
|
||||
$twig->addFunction($function);
|
||||
|
||||
$function = new Twig_SimpleFunction('hook', function ($hook) {
|
||||
global $hooks;
|
||||
$hooks->trigger($hook);
|
||||
});
|
||||
$twig->addFunction($function);
|
||||
|
||||
$filter = new Twig_SimpleFilter('urlencode', function ($s) {
|
||||
return urlencode($s);
|
||||
});
|
||||
$twig->addFilter($filter);
|
||||
|
||||
// trim values we receive
|
||||
if(isset($_POST))
|
||||
{
|
||||
@@ -86,10 +107,12 @@ unset($tmp);
|
||||
if(isset($config['lua']['servername']))
|
||||
$config['lua']['serverName'] = $config['lua']['servername'];
|
||||
|
||||
|
||||
if(isset($config['lua']['houserentperiod']))
|
||||
$config['lua']['houseRentPeriod'] = $config['lua']['houserentperiod'];
|
||||
|
||||
if($config['item_images_url'][strlen($config['item_images_url']) - 1] != '/')
|
||||
$config['item_images_url'] .= '/';
|
||||
|
||||
// localize data/ directory
|
||||
if(isset($config['lua']['dataDirectory'][0]))
|
||||
{
|
||||
@@ -124,6 +147,11 @@ else
|
||||
$config['data_path'] = $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
|
||||
require_once(SYSTEM . 'libs/pot/OTS.php');
|
||||
$ots = POT::getInstance();
|
||||
|
@@ -5,21 +5,20 @@
|
||||
* @package MyAAC
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
* @copyright 2017 MyAAC
|
||||
* @version 0.3.0
|
||||
* @link http://my-aac.org
|
||||
*/
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
require_once(SYSTEM . 'libs/items.php');
|
||||
require_once(SYSTEM . 'libs/items_images.php');
|
||||
|
||||
Items::$files = array(
|
||||
Items_Images::$files = array(
|
||||
'otb' => SYSTEM . 'data/items.otb',
|
||||
'spr' => SYSTEM . 'data/Tibia.spr',
|
||||
'dat' => SYSTEM . 'data/Tibia.dat'
|
||||
);
|
||||
Items::$outputDir = BASE . 'images/items/';
|
||||
Items_Images::$outputDir = BASE . 'images/items/';
|
||||
|
||||
function generateItem($id = 100, $count = 1) {
|
||||
Items::generate($id, $count);
|
||||
Items_Images::generate($id, $count);
|
||||
}
|
||||
|
||||
function itemImageExists($id, $count = 1)
|
||||
@@ -31,7 +30,7 @@ function itemImageExists($id, $count = 1)
|
||||
if($count > 1)
|
||||
$file_name .= '-' . $count;
|
||||
|
||||
$file_name = Items::$outputDir . $file_name . '.gif';
|
||||
$file_name = Items_Images::$outputDir . $file_name . '.gif';
|
||||
return file_exists($file_name);
|
||||
}
|
||||
|
||||
@@ -43,7 +42,7 @@ function outputItem($id = 100, $count = 1)
|
||||
if(!itemImageExists($id, $count))
|
||||
{
|
||||
//echo 'plik istnieje';
|
||||
Items::generate($id, $count);
|
||||
Items_Images::generate($id, $count);
|
||||
}
|
||||
|
||||
$expires = 60 * 60 * 24 * 30; // 30 days
|
||||
@@ -56,7 +55,7 @@ function outputItem($id = 100, $count = 1)
|
||||
if($count > 1)
|
||||
$file_name .= '-' . $count;
|
||||
|
||||
$file_name = Items::$outputDir . $file_name . '.gif';
|
||||
$file_name = Items_Images::$outputDir . $file_name . '.gif';
|
||||
readfile($file_name);
|
||||
}
|
||||
?>
|
||||
|