mirror of
https://github.com/slawkens/myaac.git
synced 2025-09-14 12:33:35 +02:00
Compare commits
70 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
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
|
Options -Indexes -MultiViews
|
||||||
|
|
||||||
RewriteEngine On
|
RewriteEngine On
|
||||||
#RewriteBase /
|
|
||||||
|
|
||||||
# Page parser
|
|
||||||
RewriteCond %{REQUEST_FILENAME} !-f
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
RewriteCond %{REQUEST_FILENAME} !-d
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
RewriteRule ^([A-Za-z0-9-_+']+)\.png/?$ tools/signature/index.php?name=$1 [L]
|
RewriteRule ^.*$ index.php [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]
|
|
67
CHANGELOG
67
CHANGELOG
@@ -1,3 +1,70 @@
|
|||||||
|
[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]
|
[0.3.0 - 28.08.2017]
|
||||||
- added administration panel for screenshots management with auto thumbnail generator and image auto-resizing
|
- 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
|
- added Twig template engine and moved some html-in-php code to it
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
# myaac
|
# 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
|
### REQUIREMENTS
|
||||||
|
|
||||||
|
@@ -25,6 +25,9 @@ require(SYSTEM . 'status.php');
|
|||||||
require(SYSTEM . 'login.php');
|
require(SYSTEM . 'login.php');
|
||||||
require(ADMIN . 'includes/functions.php');
|
require(ADMIN . 'includes/functions.php');
|
||||||
|
|
||||||
|
$twig->addGlobal('config', $config);
|
||||||
|
$twig->addGlobal('status', $status);
|
||||||
|
|
||||||
// if we're not logged in - show login box
|
// if we're not logged in - show login box
|
||||||
if(!$logged || !admin()) {
|
if(!$logged || !admin()) {
|
||||||
$page = 'login';
|
$page = 'login';
|
||||||
|
@@ -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>
|
<a href="<?php echo BASE_URL; ?>" target="_blank">Preview</a> <span class="separator">|</span> <a href="?action=logout">Log out<img src="<?php echo BASE_URL; ?>images/icons/logout.png" alt="" title="Log out" /></a>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<h1><?php echo $config['lua']['serverName'] . ' - ' . $title; ?> - Admin Panel</h1>
|
<h1><?php echo $config['lua']['serverName'] . (isset($title) ? ' - ' . $title : ''); ?> - Admin Panel</h1>
|
||||||
</div>
|
</div>
|
||||||
<div id="wrapper">
|
<div id="wrapper">
|
||||||
<?php
|
<?php
|
||||||
@@ -78,6 +78,19 @@
|
|||||||
}
|
}
|
||||||
echo '</li>';
|
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>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -21,14 +21,14 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.3.0
|
* @version 0.5.1
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
define('MYAAC', true);
|
define('MYAAC', true);
|
||||||
define('MYAAC_VERSION', '0.3.0');
|
define('MYAAC_VERSION', '0.5.1');
|
||||||
define('DATABASE_VERSION', 7);
|
define('DATABASE_VERSION', 10);
|
||||||
define('TABLE_PREFIX', 'myaac_');
|
define('TABLE_PREFIX', 'myaac_');
|
||||||
define('START_TIME', microtime(true));
|
define('START_TIME', microtime(true));
|
||||||
define('MYAAC_OS', (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? 'WINDOWS' : (strtoupper(PHP_OS) == 'DARWIN' ? 'MAC' : 'LINUX'));
|
define('MYAAC_OS', (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? 'WINDOWS' : (strtoupper(PHP_OS) == 'DARWIN' ? 'MAC' : 'LINUX'));
|
||||||
|
16
config.php
16
config.php
@@ -13,7 +13,7 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.3.0
|
* @version 0.5.1
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -35,6 +35,7 @@ $config = array(
|
|||||||
|
|
||||||
// gesior backward support (templates & pages)
|
// gesior backward support (templates & pages)
|
||||||
// allows using gesior templates and pages with myaac
|
// allows using gesior templates and pages with myaac
|
||||||
|
// might bring some performance when disabled
|
||||||
'backward_support' => true,
|
'backward_support' => true,
|
||||||
|
|
||||||
// head options (html)
|
// head options (html)
|
||||||
@@ -45,7 +46,7 @@ $config = array(
|
|||||||
// footer
|
// footer
|
||||||
'footer' => ''/*'<br/>Your Server © 2016. All rights reserved.'*/,
|
'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' => 'en', // default language (currently only 'en' available)
|
||||||
'language_allow_change' => false,
|
'language_allow_change' => false,
|
||||||
@@ -65,7 +66,7 @@ $config = array(
|
|||||||
'database_password' => '',
|
'database_password' => '',
|
||||||
'database_name' => '',
|
'database_name' => '',
|
||||||
|
|
||||||
// multiworld system
|
// multiworld system (only TFS 0.3)
|
||||||
'multiworld' => false, // use multiworld system?
|
'multiworld' => false, // use multiworld system?
|
||||||
'worlds' => array( // list of worlds
|
'worlds' => array( // list of worlds
|
||||||
//'1' => 'Your World Name',
|
//'1' => 'Your World Name',
|
||||||
@@ -184,6 +185,7 @@ $config = array(
|
|||||||
'highscores_outfit' => true, // show player outfit?
|
'highscores_outfit' => true, // show player outfit?
|
||||||
'highscores_country_box' => false, // doesnt work yet! (not implemented)
|
'highscores_country_box' => false, // doesnt work yet! (not implemented)
|
||||||
'highscores_groups_hidden' => 4, // this group id and higher won't be shown on the highscores
|
'highscores_groups_hidden' => 4, // this group id and higher won't be shown on the highscores
|
||||||
|
'highscores_length' => 100, // how many records per page on highscores
|
||||||
|
|
||||||
// characters page
|
// characters page
|
||||||
'characters' => array( // what things to display on character view page (true/false in each option)
|
'characters' => array( // what things to display on character view page (true/false in each option)
|
||||||
@@ -201,14 +203,17 @@ $config = array(
|
|||||||
),
|
),
|
||||||
|
|
||||||
// news page
|
// 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_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_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/shop system
|
||||||
'gifts_system' => false,
|
'gifts_system' => false,
|
||||||
|
|
||||||
|
// support/system
|
||||||
|
'bug_report' => true,
|
||||||
|
|
||||||
// forum
|
// 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' => '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
|
'forum_level_required' => 0, // level required to post, 0 to disable
|
||||||
@@ -228,6 +233,7 @@ $config = array(
|
|||||||
'google_analytics_id' => '', // e.g.: UA-XXXXXXX-X
|
'google_analytics_id' => '', // e.g.: UA-XXXXXXX-X
|
||||||
'experiencetable_columns' => 5, // how many columns to display in experience table page. * experiencetable_rows, 5 = 500 (will show up to 500 level)
|
'experiencetable_columns' => 5, // how many columns to display in experience table page. * experiencetable_rows, 5 = 500 (will show up to 500 level)
|
||||||
'experiencetable_rows' => 100, // till how many levels in one column
|
'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(),
|
'monsters' => array(),
|
||||||
'npc' => array()
|
'npc' => array()
|
||||||
|
BIN
images/items/empty.gif
Normal file
BIN
images/items/empty.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
112
index.php
112
index.php
@@ -21,7 +21,7 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.3.0
|
* @version 0.5.1
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -39,22 +39,117 @@ 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!');
|
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!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
require_once(SYSTEM . 'functions.php');
|
||||||
|
|
||||||
|
$uri = $_SERVER['REQUEST_URI'];
|
||||||
|
if(!empty(BASE_DIR))
|
||||||
|
$uri = str_replace(BASE_DIR . '/', '', $uri);
|
||||||
|
else
|
||||||
|
$uri = str_replace_first('/', '', $uri);
|
||||||
|
|
||||||
|
$uri = str_replace(array('index.php/', '?'), '', $uri);
|
||||||
|
$uri = strtolower($uri);
|
||||||
|
|
||||||
|
$found = false;
|
||||||
|
if(empty($uri) || isset($_REQUEST['template'])) {
|
||||||
|
$_REQUEST['p'] = 'news';
|
||||||
|
$found = true;
|
||||||
|
}
|
||||||
|
else if(!preg_match('/[^A-z0-9_\-]/', $uri) && file_exists(SYSTEM . 'pages/' . $uri . '.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' => 'changepassword'),
|
||||||
|
'/^account\/register\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'registeraccount'),
|
||||||
|
'/^account\/register\/new\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'registernew'),
|
||||||
|
'/^account\/email\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'changeemail'),
|
||||||
|
'/^account\/info\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'changeinfo'),
|
||||||
|
'/^account\/character\/create\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'createcharacter'),
|
||||||
|
'/^account\/character\/name\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'changename'),
|
||||||
|
'/^account\/character\/sex\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'changesex'),
|
||||||
|
'/^account\/character\/delete\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'deletecharacter'),
|
||||||
|
'/^account\/character\/comment\/[A-Za-z]+\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'changecomment', 'name' => '$3'),
|
||||||
|
'/^account\/character\/comment\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'changecomment'),
|
||||||
|
'/^characters\/[A-Za-z0-9-_%+\']+$/' => array('subtopic' => 'characters', 'name' => '$1'),
|
||||||
|
'/^commands\/add\/?$/' => array('subtopic' => 'commands', 'action' => 'add'),
|
||||||
|
'/^commands\/edit\/?$/' => array('subtopic' => 'commands', 'action' => 'edit'),
|
||||||
|
'/^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'),
|
||||||
|
'/^guilds\/[A-Za-z0-9-_%+\']+$/' => array('subtopic' => 'guilds', 'action' => 'show', 'guild' => '$1'),
|
||||||
|
'/^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'),
|
||||||
|
'/^gifts\/history\/?$/' => array('subtopic' => 'gifts', 'action' => 'show_history'),
|
||||||
|
'/^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'),
|
||||||
|
'/^polls\/[0-9]+\/?$/' => array('subtopic' => 'polls', 'id' => '$1')
|
||||||
|
);
|
||||||
|
|
||||||
|
if (preg_match("/^[A-Za-z0-9-_%\'+]+\.png$/i", $uri)) {
|
||||||
|
$tmp = explode('.', $uri);
|
||||||
|
$_REQUEST['name'] = urldecode($tmp[0]);
|
||||||
|
|
||||||
|
chdir(TOOLS . 'signature');
|
||||||
|
include('index.php');
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$found)
|
||||||
|
$_REQUEST['p'] = $uri;
|
||||||
|
}
|
||||||
|
|
||||||
// define page visited, so it can be used within events system
|
// define page visited, so it can be used within events system
|
||||||
$page = isset($_REQUEST['subtopic']) ? $_REQUEST['subtopic'] : (isset($_GET['p']) ? $_GET['p'] : '');
|
$page = isset($_REQUEST['subtopic']) ? $_REQUEST['subtopic'] : (isset($_REQUEST['p']) ? $_REQUEST['p'] : '');
|
||||||
if(empty($page) || preg_match('/[^A-z0-9_\-]/', $page))
|
if(empty($page) || preg_match('/[^A-z0-9\/_\-]/', $page)) {
|
||||||
|
if(!$found)
|
||||||
|
$page = '404';
|
||||||
|
else
|
||||||
$page = 'news';
|
$page = 'news';
|
||||||
|
}
|
||||||
|
|
||||||
$page = strtolower($page);
|
$page = strtolower($page);
|
||||||
define('PAGE', $page);
|
define('PAGE', $page);
|
||||||
|
|
||||||
$template_place_holders = array();
|
$template_place_holders = array();
|
||||||
|
|
||||||
require_once(SYSTEM . 'functions.php');
|
|
||||||
require_once(SYSTEM . 'init.php');
|
require_once(SYSTEM . 'init.php');
|
||||||
require_once(SYSTEM . 'login.php');
|
require_once(SYSTEM . 'login.php');
|
||||||
require_once(SYSTEM . 'status.php');
|
require_once(SYSTEM . 'status.php');
|
||||||
require_once(SYSTEM . 'template.php');
|
require_once(SYSTEM . 'template.php');
|
||||||
|
|
||||||
|
$twig->addGlobal('config', $config);
|
||||||
|
$twig->addGlobal('status', $status);
|
||||||
|
|
||||||
// database migrations
|
// database migrations
|
||||||
$tmp = '';
|
$tmp = '';
|
||||||
if(fetchDatabaseConfig('database_version', $tmp)) { // we got version
|
if(fetchDatabaseConfig('database_version', $tmp)) { // we got version
|
||||||
@@ -153,7 +248,7 @@ if($config['backward_support']) {
|
|||||||
$config['site']['screenshot_page'] = true;
|
$config['site']['screenshot_page'] = true;
|
||||||
|
|
||||||
if($config['forum'] != '')
|
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)
|
foreach($status as $key => $value)
|
||||||
$config['status']['serverStatus_' . $key] = $value;
|
$config['status']['serverStatus_' . $key] = $value;
|
||||||
@@ -168,9 +263,7 @@ if($load_it)
|
|||||||
require(SYSTEM . 'compat_pages.php');
|
require(SYSTEM . 'compat_pages.php');
|
||||||
|
|
||||||
$ignore = false;
|
$ignore = false;
|
||||||
$file = SYSTEM . 'pages/' . $page . '.php';
|
|
||||||
if(!@file_exists($file))
|
|
||||||
{
|
|
||||||
$logged_access = 0;
|
$logged_access = 0;
|
||||||
if($logged && $account_logged && $account_logged->isLoaded()) {
|
if($logged && $account_logged && $account_logged->isLoaded()) {
|
||||||
$logged_access = $account_logged->getAccess();
|
$logged_access = $account_logged->getAccess();
|
||||||
@@ -220,6 +313,9 @@ if($load_it)
|
|||||||
$content .= $query['body']; // plain html
|
$content .= $query['body']; // plain html
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
$file = SYSTEM . 'pages/' . $page . '.php';
|
||||||
|
if(!@file_exists($file) && !$found)
|
||||||
{
|
{
|
||||||
$page = '404';
|
$page = '404';
|
||||||
$file = SYSTEM . 'pages/404.php';
|
$file = SYSTEM . 'pages/404.php';
|
||||||
|
@@ -8,18 +8,29 @@ CREATE TABLE `myaac_account_actions`
|
|||||||
KEY (`account_id`)
|
KEY (`account_id`)
|
||||||
) ENGINE = MyISAM;
|
) 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`
|
CREATE TABLE `myaac_bugtracker`
|
||||||
(
|
(
|
||||||
`account` VARCHAR(255) NOT NULL,
|
`account` VARCHAR(255) NOT NULL,
|
||||||
`type` INT(11) NOT NULL,
|
`type` INT(11) NOT NULL DEFAULT 0,
|
||||||
`status` INT(11) NOT NULL,
|
`status` INT(11) NOT NULL DEFAULT 0,
|
||||||
`text` text NOT NULL,
|
`text` text NOT NULL,
|
||||||
`id` INT(11) NOT NULL,
|
`id` INT(11) NOT NULL DEFAULT 0,
|
||||||
`subject` VARCHAR(255) NOT NULL,
|
`subject` VARCHAR(255) NOT NULL DEFAULT '',
|
||||||
`reply` INT(11) NOT NULL,
|
`reply` INT(11) NOT NULL DEFAULT 0,
|
||||||
`who` INT(11) NOT NULL,
|
`who` INT(11) NOT NULL DEFAULT 0,
|
||||||
`uid` INT(11) NOT NULL AUTO_INCREMENT,
|
`uid` INT(11) NOT NULL AUTO_INCREMENT,
|
||||||
`tag` INT(11) NOT NULL,
|
`tag` INT(11) NOT NULL DEFAULT 0,
|
||||||
PRIMARY KEY (`uid`)
|
PRIMARY KEY (`uid`)
|
||||||
) ENGINE = MyISAM;
|
) ENGINE = MyISAM;
|
||||||
|
|
||||||
@@ -67,7 +78,7 @@ CREATE TABLE `myaac_faq`
|
|||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE = MyISAM;
|
) ENGINE = MyISAM;
|
||||||
|
|
||||||
CREATE TABLE `myaac_forum_sections`
|
CREATE TABLE `myaac_forum_boards`
|
||||||
(
|
(
|
||||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||||
`name` VARCHAR(32) NOT NULL,
|
`name` VARCHAR(32) NOT NULL,
|
||||||
@@ -77,11 +88,11 @@ CREATE TABLE `myaac_forum_sections`
|
|||||||
`hidden` TINYINT(1) NOT NULL DEFAULT 0,
|
`hidden` TINYINT(1) NOT NULL DEFAULT 0,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE = MyISAM;
|
) ENGINE = MyISAM;
|
||||||
INSERT INTO `myaac_forum_sections` (`id`, `name`, `description`, `closed`) VALUES (NULL, 'News', 'News commenting', 1);
|
INSERT INTO `myaac_forum_boards` (`id`, `name`, `description`, `ordering`, `closed`) VALUES (NULL, 'News', 'News commenting', 0, 1);
|
||||||
INSERT INTO `myaac_forum_sections` (`id`, `name`, `description`) VALUES (NULL, 'Trade', 'Trade offers.');
|
INSERT INTO `myaac_forum_boards` (`id`, `name`, `description`, `ordering`) VALUES (NULL, 'Trade', 'Trade offers.', 1);
|
||||||
INSERT INTO `myaac_forum_sections` (`id`, `name`, `description`) VALUES (NULL, 'Quests', 'Quest making.');
|
INSERT INTO `myaac_forum_boards` (`id`, `name`, `description`, `ordering`) VALUES (NULL, 'Quests', 'Quest making.', 2);
|
||||||
INSERT INTO `myaac_forum_sections` (`id`, `name`, `description`) VALUES (NULL, 'Pictures', 'Your pictures.');
|
INSERT INTO `myaac_forum_boards` (`id`, `name`, `description`, `ordering`) VALUES (NULL, 'Pictures', 'Your pictures.', 3);
|
||||||
INSERT INTO `myaac_forum_sections` (`id`, `name`, `description`) VALUES (NULL, 'Bug Report', 'Report bugs there.');
|
INSERT INTO `myaac_forum_boards` (`id`, `name`, `description`, `ordering`) VALUES (NULL, 'Bug Report', 'Report bugs there.', 4);
|
||||||
|
|
||||||
CREATE TABLE `myaac_forum`
|
CREATE TABLE `myaac_forum`
|
||||||
(
|
(
|
||||||
@@ -112,6 +123,7 @@ CREATE TABLE `myaac_hooks`
|
|||||||
`name` VARCHAR(30) NOT NULL DEFAULT '',
|
`name` VARCHAR(30) NOT NULL DEFAULT '',
|
||||||
`type` INT(2) NOT NULL DEFAULT 0,
|
`type` INT(2) NOT NULL DEFAULT 0,
|
||||||
`file` VARCHAR(100) NOT NULL,
|
`file` VARCHAR(100) NOT NULL,
|
||||||
|
`ordering` INT(11) NOT NULL DEFAULT 0,
|
||||||
`enabled` INT(1) NOT NULL DEFAULT 1,
|
`enabled` INT(1) NOT NULL DEFAULT 1,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE = MyISAM;
|
) ENGINE = MyISAM;
|
||||||
|
@@ -230,9 +230,9 @@ if(!$error) {
|
|||||||
$error = true;
|
$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 .= 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 .= PHP_EOL;
|
||||||
$content .= '// place for your configuration directives, so you can later easily update myaac';
|
$content .= '// place for your configuration directives, so you can later easily update myaac';
|
||||||
$content .= PHP_EOL;
|
$content .= PHP_EOL;
|
||||||
|
@@ -146,31 +146,31 @@ INSERT INTO `myaac_news` (`id`, `type`, `date`, `category`, `title`, `body`, `pl
|
|||||||
|
|
||||||
$query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote('Rook Sample'));
|
$query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote('Rook Sample'));
|
||||||
if($query->rowCount() == 0) {
|
if($query->rowCount() == 0) {
|
||||||
if(!query($insert_into_players . "(null, 'Rook Sample', 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, '');"))
|
if(!query($insert_into_players . "(null, 'Rook Sample', 4, " . $_SESSION['account'] . ", 1, 0, 150, 150, 4200, 118, 114, 38, 57, 130, 0, 0, 0, 0, 100, 11, 2200, 1298, 7, '', 400, 1, 1255179613, 2453925456, 1, 1255179614, 0, 0, UNIX_TIMESTAMP(), 1, '');"))
|
||||||
$success = false;
|
$success = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote('Sorcerer Sample'));
|
$query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote('Sorcerer Sample'));
|
||||||
if($query->rowCount() == 0) {
|
if($query->rowCount() == 0) {
|
||||||
if(!query($insert_into_players . "(null, 'Sorcerer Sample', 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, '');"))
|
if(!query($insert_into_players . "(null, 'Sorcerer Sample', 4, " . $_SESSION['account'] . ", 8, 1, 185, 185, 4200, 118, 114, 38, 57, 130, 0, 35, 35, 0, 100, 11, 2200, 1298, 7, '', 470, 1, 1255179571, 2453925456, 1, 1255179612, 0, 0, UNIX_TIMESTAMP(), 1, '');"))
|
||||||
$success = false;
|
$success = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote('Druid Sample'));
|
$query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote('Druid Sample'));
|
||||||
if($query->rowCount() == 0) {
|
if($query->rowCount() == 0) {
|
||||||
if(!query($insert_into_players . "(null, 'Druid Sample', 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, '');"))
|
if(!query($insert_into_players . "(null, 'Druid Sample', 4, " . $_SESSION['account'] . ", 8, 2, 185, 185, 4200, 118, 114, 38, 57, 130, 0, 35, 35, 0, 100, 11, 2200, 1298, 7, '', 470, 1, 1255179655, 2453925456, 1, 1255179658, 0, 0, UNIX_TIMESTAMP(), 1, '');"))
|
||||||
$success = false;
|
$success = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote('Paladin Sample'));
|
$query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote('Paladin Sample'));
|
||||||
if($query->rowCount() == 0) {
|
if($query->rowCount() == 0) {
|
||||||
if(!query($insert_into_players . "(null, 'Paladin Sample', 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, '');"))
|
if(!query($insert_into_players . "(null, 'Paladin Sample', 4, " . $_SESSION['account'] . ", 8, 3, 185, 185, 4200, 118, 114, 38, 57, 129, 0, 35, 35, 0, 100, 11, 2200, 1298, 7, '', 470, 1, 1255179854, 2453925456, 1, 1255179858, 0, 0, UNIX_TIMESTAMP(), 1, '');"))
|
||||||
$success = false;
|
$success = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote('Knight Sample'));
|
$query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote('Knight Sample'));
|
||||||
if($query->rowCount() == 0) {
|
if($query->rowCount() == 0) {
|
||||||
if(!query($insert_into_players . "(null, 'Knight Sample', 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, '');"))
|
if(!query($insert_into_players . "(null, 'Knight Sample', 4, " . $_SESSION['account'] . ", 8, 4, 185, 185, 4200, 118, 114, 38, 57, 131, 0, 35, 35, 0, 100, 11, 2200, 1298, 7, '', 470, 1, 1255179620, 2453925456, 1, 1255179654, 0, 0, UNIX_TIMESTAMP(), 1, '');"))
|
||||||
$success = false;
|
$success = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -4,7 +4,16 @@
|
|||||||
"version": "1.0",
|
"version": "1.0",
|
||||||
"author": "nobody",
|
"author": "nobody",
|
||||||
"contact": "nobody@example.org",
|
"contact": "nobody@example.org",
|
||||||
|
"require": {
|
||||||
|
"myaac": "0.4.3",
|
||||||
|
"php": "5.2.0"
|
||||||
|
},
|
||||||
"install": "plugins/example/install.php",
|
"install": "plugins/example/install.php",
|
||||||
|
"uninstall": [
|
||||||
|
"plugins/example.json",
|
||||||
|
"plugins/example/install.php",
|
||||||
|
"plugins/example/before.php"
|
||||||
|
],
|
||||||
"hooks": {
|
"hooks": {
|
||||||
"Example Hook": {
|
"Example Hook": {
|
||||||
"type": "BEFORE_PAGE",
|
"type": "BEFORE_PAGE",
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.3.0
|
* @version 0.5.1
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.3.0
|
* @version 0.5.1
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.3.0
|
* @version 0.5.1
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
@@ -5,17 +5,26 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.3.0
|
* @version 0.5.1
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
function success($message) {
|
function success($message, $return = false) {
|
||||||
|
if($return)
|
||||||
|
return '<p class="success">' . $message . '</p>';
|
||||||
|
|
||||||
echo '<p class="success">' . $message . '</p>';
|
echo '<p class="success">' . $message . '</p>';
|
||||||
}
|
}
|
||||||
function warning($message) {
|
function warning($message, $return = false) {
|
||||||
|
if($return)
|
||||||
|
return '<p class="warning">' . $message . '</p>';
|
||||||
|
|
||||||
echo '<p class="warning">' . $message . '</p>';
|
echo '<p class="warning">' . $message . '</p>';
|
||||||
}
|
}
|
||||||
function error($message) {
|
function error($message, $return = false) {
|
||||||
|
if($return)
|
||||||
|
return '<p class="error">' . $message . '</p>';
|
||||||
|
|
||||||
echo '<p class="error">' . $message . '</p>';
|
echo '<p class="error">' . $message . '</p>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,46 +38,27 @@ function generateLink($url, $name, $blank = false) {
|
|||||||
return '<a href="' . $url . '"' . ($blank ? ' target="_blank"' : '') . '>' . $name . '</a>';
|
return '<a href="' . $url . '"' . ($blank ? ' target="_blank"' : '') . '>' . $name . '</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLink($page, $name, $blank = false) {
|
function getFullLink($page, $name, $blank = false) {
|
||||||
return generateLink(getPageLink($page), $name, $blank);
|
return generateLink(getLink($page), $name, $blank);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPageLink($page, $action = null)
|
function getLink($page, $action = null)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
return BASE_URL . ($config['friendly_urls'] ? '' : '?') . $page . ($action ? '/' . $action : '');
|
||||||
// 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 : '');
|
|
||||||
}
|
}
|
||||||
function internalLayoutLink($page, $action = null) {return getPageLink($page, $action);}
|
function internalLayoutLink($page, $action = null) {return getLink($page, $action);}
|
||||||
|
|
||||||
function getForumThreadLink($thread_id, $page = NULL)
|
function getForumThreadLink($thread_id, $page = NULL)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
return BASE_URL . ($config['friendly_urls'] ? '' : '?') . 'forum/thread/' . (int)$thread_id . (isset($page) ? '/' . $page : '');
|
||||||
$url = '';
|
|
||||||
if($config['friendly_urls'])
|
|
||||||
$url = BASE_URL . 'forum/thread/' . (int)$thread_id . (isset($page) ? '/' . $page : '');
|
|
||||||
else
|
|
||||||
$url = BASE_URL . '?subtopic=forum&action=show_thread&id=' . (int)$thread_id . (isset($page) ? '&page=' . $page : '');
|
|
||||||
|
|
||||||
return $url;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getForumBoardLink($board_id, $page = NULL)
|
function getForumBoardLink($board_id, $page = NULL)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
return BASE_URL . ($config['friendly_urls'] ? '' : '?') . 'forum/board/' . (int)$board_id . (isset($page) ? '/' . $page : '');
|
||||||
$url = '';
|
|
||||||
if($config['friendly_urls'])
|
|
||||||
$url = BASE_URL . 'forum/board/' . (int)$board_id . (isset($page) ? '/' . $page : '');
|
|
||||||
else
|
|
||||||
$url = BASE_URL . '?subtopic=forum&action=show_board&id=' . (int)$board_id . (isset($page) ? '&page=' . $page : '');
|
|
||||||
|
|
||||||
return $url;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPlayerLink($name, $generate = true)
|
function getPlayerLink($name, $generate = true)
|
||||||
@@ -83,11 +73,7 @@ function getPlayerLink($name, $generate = true)
|
|||||||
$name = $player->getName();
|
$name = $player->getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
$url = '';
|
$url = BASE_URL . ($config['friendly_urls'] ? '' : '?') . 'characters/' . urlencode($name);
|
||||||
if($config['friendly_urls'])
|
|
||||||
$url = BASE_URL . 'characters/' . urlencode($name);
|
|
||||||
else
|
|
||||||
$url = BASE_URL . '?subtopic=characters&name=' . urlencode($name);
|
|
||||||
|
|
||||||
if(!$generate) return $url;
|
if(!$generate) return $url;
|
||||||
return generateLink($url, $name);
|
return generateLink($url, $name);
|
||||||
@@ -107,11 +93,7 @@ function getHouseLink($name, $generate = true)
|
|||||||
$name = $house->fetchColumn();
|
$name = $house->fetchColumn();
|
||||||
}
|
}
|
||||||
|
|
||||||
$url = '';
|
$url = BASE_URL . ($config['friendly_urls'] ? '' : '?') . 'houses/' . urlencode($name);
|
||||||
if($config['friendly_urls'])
|
|
||||||
$url = BASE_URL . 'houses/' . urlencode($name);
|
|
||||||
else
|
|
||||||
$url = BASE_URL . '?subtopic=houses&page=view&house=' . urlencode($name);
|
|
||||||
|
|
||||||
if(!$generate) return $url;
|
if(!$generate) return $url;
|
||||||
return generateLink($url, $name);
|
return generateLink($url, $name);
|
||||||
@@ -124,18 +106,12 @@ function getGuildLink($name, $generate = true)
|
|||||||
if(is_numeric($name))
|
if(is_numeric($name))
|
||||||
{
|
{
|
||||||
$guild = $db->query(
|
$guild = $db->query(
|
||||||
'SELECT ' . $db->fieldName('name') .
|
'SELECT `name` FROM `guilds` WHERE `id` = ' . (int)$name);
|
||||||
' FROM ' . $db->tableName('guilds') .
|
|
||||||
' WHERE ' . $db->fieldName('id') . ' = ' . (int)$name);
|
|
||||||
if($guild->rowCount() > 0)
|
if($guild->rowCount() > 0)
|
||||||
$name = $guild->fetchColumn();
|
$name = $guild->fetchColumn();
|
||||||
}
|
}
|
||||||
|
|
||||||
$url = '';
|
$url = BASE_URL . ($config['friendly_urls'] ? '' : '?') . 'guilds/' . urlencode($name);
|
||||||
if($config['friendly_urls'])
|
|
||||||
$url = BASE_URL . 'guilds/' . urlencode($name);
|
|
||||||
else
|
|
||||||
$url = BASE_URL . '?subtopic=guilds&action=show&guild=' . urlencode($name);
|
|
||||||
|
|
||||||
if(!$generate) return $url;
|
if(!$generate) return $url;
|
||||||
return generateLink($url, $name);
|
return generateLink($url, $name);
|
||||||
@@ -218,10 +194,11 @@ function generateRandomString($length, $lowCase = true, $upCase = false, $numeri
|
|||||||
*
|
*
|
||||||
* @return array Forum sections.
|
* @return array Forum sections.
|
||||||
*/
|
*/
|
||||||
function getForumSections()
|
function getForumBoards()
|
||||||
{
|
{
|
||||||
global $db;
|
global $db, $canEdit;
|
||||||
$sections = $db->query('SELECT `id`, `name`, `description`, `closed` FROM ' . TABLE_PREFIX . 'forum_sections WHERE hidden != 1 ORDER BY `ordering`;');
|
$sections = $db->query('SELECT `id`, `name`, `description`, `closed`' . ($canEdit ? ', `hidden`, `ordering`' : '') . ' FROM `' . TABLE_PREFIX . 'forum_boards` ' . (!$canEdit ? ' WHERE `hidden` != 1' : '') .
|
||||||
|
' ORDER BY `ordering`;');
|
||||||
if($sections)
|
if($sections)
|
||||||
return $sections->fetchAll();
|
return $sections->fetchAll();
|
||||||
|
|
||||||
@@ -441,7 +418,7 @@ function check_name($name, &$error = '')
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return preg_match("/[A-z ']{1,25}/", $name);
|
return preg_match("/[A-z ']/", $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -601,7 +578,7 @@ function check_name_new_char($name, &$error = '')
|
|||||||
$player = new OTS_Player();
|
$player = new OTS_Player();
|
||||||
$player->find($name);
|
$player->find($name);
|
||||||
if($player->isLoaded()) {
|
if($player->isLoaded()) {
|
||||||
$error = 'Player with this name already exist.';
|
$error = 'Character with this name already exist.';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -614,28 +591,19 @@ function check_name_new_char($name, &$error = '')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$monsters = $db->query(
|
$monsters = $db->query('SELECT `name` FROM `' . TABLE_PREFIX . 'monsters` WHERE `name` LIKE ' . $db->quote($name_lower));
|
||||||
'SELECT ' . $db->fieldName('name') .
|
|
||||||
' FROM ' . $db->tableName(TABLE_PREFIX . 'monsters') .
|
|
||||||
' WHERE ' . $db->fieldName('name') . ' LIKE ' . $db->quote($name_lower));
|
|
||||||
if($monsters->rowCount() > 0) {
|
if($monsters->rowCount() > 0) {
|
||||||
$error = 'Your name cannot contains monster name.';
|
$error = 'Your name cannot contains monster name.';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$spells_name = $db->query(
|
$spells_name = $db->query('SELECT `name` FROM `' . TABLE_PREFIX . 'spells` WHERE `name` LIKE ' . $db->quote($name_lower));
|
||||||
'SELECT ' . $db->fieldName('name') .
|
|
||||||
' FROM ' . $db->tableName(TABLE_PREFIX . 'spells') .
|
|
||||||
' WHERE ' . $db->fieldName('name') . ' LIKE ' . $db->quote($name_lower));
|
|
||||||
if($spells_name->rowCount() > 0) {
|
if($spells_name->rowCount() > 0) {
|
||||||
$error = 'Your name cannot contains spell name.';
|
$error = 'Your name cannot contains spell name.';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$spells_words = $db->query(
|
$spells_words = $db->query('SELECT `words` FROM `' . TABLE_PREFIX . 'spells` WHERE `words` = ' . $db->quote($name_lower));
|
||||||
'SELECT ' . $db->fieldName('words') .
|
|
||||||
' FROM ' . $db->tableName(TABLE_PREFIX . 'spells') .
|
|
||||||
' WHERE ' . $db->fieldName('words') . ' = ' . $db->quote($name_lower));
|
|
||||||
if($spells_words->rowCount() > 0) {
|
if($spells_words->rowCount() > 0) {
|
||||||
$error = 'Your name cannot contains spell name.';
|
$error = 'Your name cannot contains spell name.';
|
||||||
return false;
|
return false;
|
||||||
@@ -751,28 +719,6 @@ function news_place()
|
|||||||
return $news;
|
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/>';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Template place holder
|
* Template place holder
|
||||||
*
|
*
|
||||||
@@ -823,11 +769,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>
|
Please turn it on, or be aware that some features on this website will not work correctly.</div>
|
||||||
</noscript>
|
</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'])
|
if($config['recaptcha_enabled'])
|
||||||
$ret .= "<script src='https://www.google.com/recaptcha/api.js'></script>";
|
$ret .= "<script src='https://www.google.com/recaptcha/api.js'></script>";
|
||||||
return $ret;
|
return $ret;
|
||||||
@@ -838,13 +780,14 @@ function template_header($is_admin = false)
|
|||||||
*/
|
*/
|
||||||
function template_footer()
|
function template_footer()
|
||||||
{
|
{
|
||||||
global $visitors, $config, $views_counter;
|
global $config, $views_counter;
|
||||||
$ret = '';
|
$ret = '';
|
||||||
if(admin())
|
if(admin())
|
||||||
$ret .= generateLink(ADMIN_URL, 'Admin Panel', true);
|
$ret .= generateLink(ADMIN_URL, 'Admin Panel', true);
|
||||||
|
|
||||||
if($config['visitors_counter'])
|
if($config['visitors_counter'])
|
||||||
{
|
{
|
||||||
|
global $visitors;
|
||||||
$amount = $visitors->getAmountVisitors();
|
$amount = $visitors->getAmountVisitors();
|
||||||
$ret .= '<br/>Currently there ' . ($amount > 1 ? 'are' : 'is') . ' ' . $amount . ' visitor' . ($amount > 1 ? 's' : '') . '.';
|
$ret .= '<br/>Currently there ' . ($amount > 1 ? 'are' : 'is') . ' ' . $amount . ' visitor' . ($amount > 1 ? 's' : '') . '.';
|
||||||
}
|
}
|
||||||
@@ -864,21 +807,11 @@ function template_footer()
|
|||||||
|
|
||||||
function template_ga_code()
|
function template_ga_code()
|
||||||
{
|
{
|
||||||
global $config;
|
global $config, $twig;
|
||||||
if(!isset($config['google_analytics_id'][0]))
|
if(!isset($config['google_analytics_id'][0]))
|
||||||
return '';
|
return '';
|
||||||
|
|
||||||
return "
|
return $twig->render('google_analytics.html.twig');
|
||||||
<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>";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function template_form()
|
function template_form()
|
||||||
@@ -920,6 +853,8 @@ function getCreatureName($killer, $showStatus = false, $extendedInfo = false)
|
|||||||
{
|
{
|
||||||
global $vowels, $ots, $config;
|
global $vowels, $ots, $config;
|
||||||
$str = "";
|
$str = "";
|
||||||
|
$players_rows = '';
|
||||||
|
|
||||||
if(is_numeric($killer))
|
if(is_numeric($killer))
|
||||||
{
|
{
|
||||||
$player = $ots->createObject('Player');
|
$player = $ots->createObject('Player');
|
||||||
@@ -1125,11 +1060,8 @@ function get_templates()
|
|||||||
function getWorldName($id)
|
function getWorldName($id)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
foreach($config['worlds'] as $_id => $details)
|
if(isset($config['worlds'][$id]))
|
||||||
{
|
return $config['worlds'][$id];
|
||||||
if($id == $_id)
|
|
||||||
return $details['name'];
|
|
||||||
}
|
|
||||||
|
|
||||||
return $config['lua']['serverName'];
|
return $config['lua']['serverName'];
|
||||||
}
|
}
|
||||||
@@ -1202,7 +1134,7 @@ function convert_bytes($size)
|
|||||||
function log_append($file, $str)
|
function log_append($file, $str)
|
||||||
{
|
{
|
||||||
$f = fopen(LOGS . $file, 'a');
|
$f = fopen(LOGS . $file, 'a');
|
||||||
fwrite($f, $str . PHP_EOL);
|
fwrite($f, '[' . date(DateTime::RFC1123) . '] ' . $str . PHP_EOL);
|
||||||
fclose($f);
|
fclose($f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1212,20 +1144,66 @@ function load_config_lua($filename)
|
|||||||
|
|
||||||
$config_file = $filename;
|
$config_file = $filename;
|
||||||
if(!@file_exists($config_file))
|
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');
|
$result = array();
|
||||||
$file = fopen($tempFile, 'w');
|
$config_string = file_get_contents($filename);
|
||||||
if(!$file) die('Cannot load server config!');
|
$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 = "'";
|
||||||
|
|
||||||
// TODO: new parser that will also load dofile() includes
|
$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(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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 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());
|
$result = array_merge($result, isset($config['lua']) ? $config['lua'] : array());
|
||||||
@unlink($tempFile);
|
|
||||||
return $result;
|
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;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.3.0
|
* @version 0.5.1
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
@@ -16,8 +16,14 @@ define('HOOK_AFTER_PAGE', 3);
|
|||||||
define('HOOK_FINISH', 4);
|
define('HOOK_FINISH', 4);
|
||||||
define('HOOK_TIBIACOM_ARTICLE', 5);
|
define('HOOK_TIBIACOM_ARTICLE', 5);
|
||||||
define('HOOK_TIBIACOM_BORDER_3', 6);
|
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_FIRST', HOOK_STARTUP);
|
||||||
define('HOOK_LAST', HOOK_TIBIACOM_BORDER_3);
|
define('HOOK_LAST', HOOK_CHARACTERS_AFTER_CHARACTERS);
|
||||||
|
|
||||||
$hook_types = array(
|
$hook_types = array(
|
||||||
'STARTUP' => HOOK_STARTUP,
|
'STARTUP' => HOOK_STARTUP,
|
||||||
@@ -25,7 +31,13 @@ $hook_types = array(
|
|||||||
'AFTER_PAGE' => HOOK_AFTER_PAGE,
|
'AFTER_PAGE' => HOOK_AFTER_PAGE,
|
||||||
'FINISH' => HOOK_FINISH,
|
'FINISH' => HOOK_FINISH,
|
||||||
'TIBIACOM_ARTICLE' => HOOK_TIBIACOM_ARTICLE,
|
'TIBIACOM_ARTICLE' => HOOK_TIBIACOM_ARTICLE,
|
||||||
'TIBIACOM_BORDER_3' => HOOK_TIBIACOM_BORDER_3
|
'TIBIACOM_BORDER_3' => HOOK_TIBIACOM_BORDER_3,
|
||||||
|
'CHARACTERS_BEFORE_INFORMATIONS' => HOOK_CHARACTERS_BEFORE_INFORMATIONS,
|
||||||
|
'CHARACTERS_AFTER_INFORMATIONS' => HOOK_CHARACTERS_AFTER_INFORMATIONS,
|
||||||
|
'CHARACTERS_BEFORE_SIGNATURE' => HOOK_CHARACTERS_BEFORE_SIGNATURE,
|
||||||
|
'CHARACTERS_AFTER_SIGNATURE' => HOOK_CHARACTERS_AFTER_SIGNATURE,
|
||||||
|
'CHARACTERS_AFTER_ACCOUNT' => HOOK_CHARACTERS_AFTER_ACCOUNT,
|
||||||
|
'CHARACTERS_AFTER_CHARACTERS' => HOOK_CHARACTERS_AFTER_CHARACTERS
|
||||||
);
|
);
|
||||||
|
|
||||||
class Hook
|
class Hook
|
||||||
@@ -46,7 +58,7 @@ class Hook
|
|||||||
$ret = $tmp($params);
|
$ret = $tmp($params);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
global $db, $config, $template_path, $ots;
|
global $db, $config, $template_path, $ots, $content;
|
||||||
if(file_exists(BASE . $this->_file)) {
|
if(file_exists(BASE . $this->_file)) {
|
||||||
require(BASE . $this->_file);
|
require(BASE . $this->_file);
|
||||||
}
|
}
|
||||||
@@ -84,7 +96,7 @@ class Hooks
|
|||||||
public function load()
|
public function load()
|
||||||
{
|
{
|
||||||
global $db;
|
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)
|
foreach($hooks as $hook)
|
||||||
$this->register($hook['name'], $hook['type'], $hook['file']);
|
$this->register($hook['name'], $hook['type'], $hook['file']);
|
||||||
}
|
}
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.3.0
|
* @version 0.5.1
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
@@ -14,12 +14,13 @@ require_once(BASE . 'config.php');
|
|||||||
if(file_exists(BASE . 'config.local.php')) // user customizations
|
if(file_exists(BASE . 'config.local.php')) // user customizations
|
||||||
require(BASE . 'config.local.php');
|
require(BASE . 'config.local.php');
|
||||||
|
|
||||||
|
date_default_timezone_set($config['date_timezone']);
|
||||||
// take care of trailing slash at the end
|
// take care of trailing slash at the end
|
||||||
if($config['server_path'][strlen($config['server_path']) - 1] != '/')
|
if($config['server_path'][strlen($config['server_path']) - 1] != '/')
|
||||||
$config['server_path'] .= '/';
|
$config['server_path'] .= '/';
|
||||||
|
|
||||||
// enable gzip compression if supported by the browser
|
// 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');
|
ob_start('ob_gzhandler');
|
||||||
|
|
||||||
// cache
|
// cache
|
||||||
@@ -27,12 +28,13 @@ require_once(SYSTEM . 'libs/cache.php');
|
|||||||
$cache = Cache::getInstance($config['cache_engine'], $config['cache_prefix']);
|
$cache = Cache::getInstance($config['cache_engine'], $config['cache_prefix']);
|
||||||
|
|
||||||
// twig
|
// twig
|
||||||
require_once LIBS . 'twig/Autoloader.php';
|
require_once LIBS . 'Twig/Autoloader.php';
|
||||||
Twig_Autoloader::register();
|
Twig_Autoloader::register();
|
||||||
|
|
||||||
$loader = new Twig_Loader_Filesystem(SYSTEM . 'templates');
|
$twig_loader = new Twig_Loader_Filesystem(SYSTEM . 'templates');
|
||||||
$twig = new Twig_Environment($loader, array(
|
$twig = new Twig_Environment($twig_loader, array(
|
||||||
'cache' => CACHE . 'twig/',
|
'cache' => CACHE . 'twig/',
|
||||||
|
'auto_reload' => true
|
||||||
));
|
));
|
||||||
|
|
||||||
$function = new Twig_SimpleFunction('getStyle', function ($i) {
|
$function = new Twig_SimpleFunction('getStyle', function ($i) {
|
||||||
@@ -40,6 +42,21 @@ $function = new Twig_SimpleFunction('getStyle', function ($i) {
|
|||||||
});
|
});
|
||||||
$twig->addFunction($function);
|
$twig->addFunction($function);
|
||||||
|
|
||||||
|
$function = new Twig_SimpleFunction('getLink', function ($s) {
|
||||||
|
global $config;
|
||||||
|
if($config['friendly_urls'])
|
||||||
|
return $s;
|
||||||
|
|
||||||
|
return '?' . $s;
|
||||||
|
});
|
||||||
|
$twig->addFunction($function);
|
||||||
|
|
||||||
|
$function = new Twig_SimpleFunction('hook', function ($hook) {
|
||||||
|
global $hooks;
|
||||||
|
$hooks->trigger($hook);
|
||||||
|
});
|
||||||
|
$twig->addFunction($function);
|
||||||
|
|
||||||
// trim values we receive
|
// trim values we receive
|
||||||
if(isset($_POST))
|
if(isset($_POST))
|
||||||
{
|
{
|
||||||
@@ -86,10 +103,12 @@ unset($tmp);
|
|||||||
if(isset($config['lua']['servername']))
|
if(isset($config['lua']['servername']))
|
||||||
$config['lua']['serverName'] = $config['lua']['servername'];
|
$config['lua']['serverName'] = $config['lua']['servername'];
|
||||||
|
|
||||||
|
|
||||||
if(isset($config['lua']['houserentperiod']))
|
if(isset($config['lua']['houserentperiod']))
|
||||||
$config['lua']['houseRentPeriod'] = $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
|
// localize data/ directory
|
||||||
if(isset($config['lua']['dataDirectory'][0]))
|
if(isset($config['lua']['dataDirectory'][0]))
|
||||||
{
|
{
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2017 MyAAC
|
* @copyright 2017 MyAAC
|
||||||
* @version 0.3.0
|
* @version 0.5.1
|
||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user