Compare commits

..

49 Commits

Author SHA1 Message Date
slawkens
35b0795b51 * update to 0.4.3 2017-10-05 17:19:49 +02:00
slawkens
04a7796665 * moved some guild pages and account to twig
* fixed account create javascript warnings when fields are empty
2017-10-05 17:07:49 +02:00
slawkens1
755deae717 * enable auto_reload option for twig 2017-10-05 00:48:34 +02:00
slawkens1
6d66dc9043 * fixed country detection (was a little typo) 2017-10-05 00:38:48 +02:00
slawkens1
bbd9cd2101 * fixed showing of character deaths and frags 2017-10-04 20:52:36 +02:00
slawkens
b6ccde075d * moved some more pages to twig
* moved online, movies, google_analytics code, faq, experience_table, downloads to twig
* added new global variabl to twig (status)
* removed some unused page (custom.php)
* automatically append trailing slash at config.item_images_url
* moved downloads from clients.halfaway.net to tibia-clients.com
* show some more info on monster loot (currently only on TFS 0.3 and those that use item.id in monster files instead of item name)
* some more unimportant fixes
2017-10-04 17:49:54 +02:00
slawkens1
e94b9006e6 * set deletion = 0 on sample characters, so it won't be deleted by tfs 1.0 on startup 2017-09-30 14:06:52 +02:00
slawkens1
e9c8159bf3 * new, better config.lua parser from latest gesior
you can also now include files in your config.lua file by using
dofile('config.local.lua') and it will be loaded by aac
2017-09-30 00:32:26 +02:00
slawkens1
919f69ef46 * first check if page to load exist in database, then in pages/ dir 2017-09-29 22:33:25 +02:00
slawkens1
4ac2fe27d5 * fixed rook sample
* rook sample will now have level 1, 150 health, 0 mana, and 400 cap.
2017-09-29 18:30:53 +02:00
slawkens1
be2daeb4ab * fixed https://otland.net/threads/myaac-v0-0-1.251454/page-13#post-2466303
and https://otland.net/threads/myaac-v0-0-1.251454/page-13#post-2466313
2017-09-26 03:02:51 +02:00
slawkens1
7b96ce9b8c * added CREDITS file 2017-09-14 20:13:23 +02:00
slawkens
801188f957 * fixed country selection in create account
* deleted some useless code
2017-09-14 16:37:01 +02:00
slawkens
c546a46847 * moved rules to twig
* added bugtracker to kathrine template
2017-09-14 15:03:09 +02:00
slawkens
6527d21794 * updated version number
* updated to 0.4.2
2017-09-14 08:37:53 +02:00
slawkens
7fad722927 * update to 0.4.1 2017-09-13 16:39:09 +02:00
slawkens
ab249eb95f * fixed log in to admin panel
* fixed File is not .zip plugin upload error
2017-09-13 16:35:06 +02:00
slawkens
bdbd215aad * renamed some variable that caused problems with some templates 2017-09-13 15:53:56 +02:00
slawkens
68212a36bb *this 2017-09-13 15:35:08 +02:00
slawkens
ac3691dc08 * update to 0.4.0
* fixed some bugs in bugtracker
* updated database to version 9
2017-09-13 15:30:18 +02:00
slawkens
3a6aab67d5 * moved account.create and news.archive to twig
* added new configurable date_timezone
2017-09-13 14:32:50 +02:00
slawkens
2c5b3f4da3 * added some more mime types to zip file detection 2017-09-13 10:53:04 +02:00
slawkens
73eca63c4f * automatically detect json file in .zip instead of basing on filename 2017-09-13 09:03:48 +02:00
slawkens
c504588993 * added option to add/edit/delete/hide/move forum boards
* now whole account management page is moved to Twig
* renamed table forum_sections to forum_boards
* fixed some rare error when user is logged in for longer than 15 minutes and tries to login again
2017-09-12 15:55:23 +02:00
slawkens
5b14c6d4d4 * fixed global config variable in twig templates
* rest from account.create_character moved to twig
* fixed some grammar errors
* fixed some separators in kathrine template
2017-09-11 17:41:27 +02:00
slawkens
4685c7b868 * renamed twig templates to .twig, so IDE's can correctly render it
* moved news.add to twig template
* now twig templates will be loaded directly from template dir f.e. templates/kathrine/news.html.twig
2017-09-11 11:11:43 +02:00
slawkens
0e185c8bcf *more templates moved to Twig
*some not important small changes
2017-09-08 07:36:33 +02:00
Sławek
e230949edd Merge pull request #9 from AngelOfDeaths/patch-1
*Added to template bugtracker
2017-09-04 20:30:54 +02:00
Angel Of Death
a897b5e98c *Rework old code 2017-09-04 20:19:22 +02:00
Sławek
186d3dbd38 Merge pull request #8 from AngelOfDeaths/patch-4
*Added Bug Report page
2017-09-04 09:19:50 +02:00
Sławek
127c04070b Merge pull request #7 from AngelOfDeaths/patch-3
*Added Support Label and Report Bug
2017-09-04 09:19:10 +02:00
AngelOfDeaths
6ff65050f5 *correct to shop history transactions 2017-09-03 21:08:20 +02:00
AngelOfDeaths
d605ef4b28 *Added shopoffer 2017-09-03 18:46:34 +02:00
AngelOfDeaths
9466b7ce75 *Added to template bugtracker 2017-09-03 18:29:39 +02:00
AngelOfDeaths
7f6eff666e *Added Bug Report page 2017-09-03 17:42:45 +02:00
AngelOfDeaths
e878b4df48 *Added Support Label and Report Bug 2017-09-03 17:27:39 +02:00
Sławek
2c3c1529a7 Merge pull request #5 from AngelOfDeaths/patch-1
* Fix
2017-09-03 15:42:20 +02:00
Sławek
ecce524c7b Merge pull request #6 from AngelOfDeaths/patch-2
* Fixed Wrong name of table
2017-09-03 15:42:03 +02:00
AngelOfDeaths
5af617b869 * Fixed Wrong name of table 2017-09-03 14:48:51 +02:00
AngelOfDeaths
3f886c9f7c * Fix
missing . on bugtracker.php line 288
2017-09-03 14:40:05 +02:00
slawkens
d50fb7a291 * moved characters.php html code to Twig template
* moved news.php to Twig news.html template
* fixed some duplicated code in signature generators
* always check if name parameter is set when generating signatures
2017-09-01 17:00:29 +02:00
slawkens
37502c5562 * moved more templates to Twig
* now you can replace template in your main template, example is templates/kathrine/templates/success.html
* removed output_errors, replace with template
* some grammar fixes
* moved some forum code to Twig templates
* added movies link to tibiacom template
2017-08-31 17:01:17 +02:00
slawkens
7620ec896b Merge branch 'master' of https://github.com/slawkens/myaac 2017-08-29 17:38:37 +02:00
slawkens
8a87186833 * more templates moved to Twig 2017-08-29 17:38:32 +02:00
slawkens1
b0f8013762 * and this 2017-08-28 23:59:04 +02:00
slawkens1
3a6a1c448a * log errors instead showing them to users with system directories
* now it will print a notice, and aditionally log full path into
system/logs/error.log
* also, when it fails to load config.lua it will output error also to
error.log
* fix when $_SERVER['HTTP_ACCEPT_ENCODING'] is not set.
2017-08-28 23:58:53 +02:00
slawkens1
2cd9f80b34 * fixed Twig loading on case-sensitive systems 2017-08-28 22:52:27 +02:00
slawkens1
d88de8e072 * fixed Twig loading on case-sensitive systems 2017-08-28 22:43:03 +02:00
slawkens1
6e6ce55a7b * some better info when fetching latest version 2017-08-28 21:06:57 +02:00
339 changed files with 6882 additions and 4615 deletions

View File

@@ -1,3 +1,41 @@
[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

2
CREDITS Normal file
View File

@@ -0,0 +1,2 @@
* Gesior.pl (2007 - 2008)
* Slawkens (2009 - 2017)

View File

@@ -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';

View File

@@ -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.4.3
* @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.4.3');
define('DATABASE_VERSION', 7); define('DATABASE_VERSION', 9);
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'));

View File

@@ -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.4.3
* @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 &copy; 2016. All rights reserved.'*/, 'footer' => ''/*'<br/>Your Server &copy; 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',
@@ -201,13 +202,16 @@ $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
@@ -228,7 +232,8 @@ $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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

View File

@@ -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.4.3
* @link http://my-aac.org * @link http://my-aac.org
*/ */
@@ -55,6 +55,9 @@ 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
@@ -168,58 +171,59 @@ 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;
if($logged && $account_logged && $account_logged->isLoaded()) {
$logged_access = $account_logged->getAccess();
}
$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
{ {
$logged_access = 0; $ignore = true;
if($logged && $account_logged && $account_logged->isLoaded()) { $query = $query->fetch();
$logged_access = $account_logged->getAccess(); $title = $query['title'];
}
$query = if($query['php'] == '1') // execute it as php code
$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
{ {
$ignore = true; $tmp = substr($query['body'], 0, 10);
$query = $query->fetch(); if(($pos = strpos($tmp, '<?php')) !== false) {
$title = $query['title']; $tmp = preg_replace('/<\?php/', '', $query['body'], 1);
}
if($query['php'] == '1') // execute it as php code else if(($pos = strpos($tmp, '<?')) !== false) {
{ $tmp = preg_replace('/<\?/', '', $query['body'], 1);
$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);
}
} }
else 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 else
$content .= $query['body']; // plain html
}
else
{
$file = SYSTEM . 'pages/' . $page . '.php';
if(!@file_exists($file))
{ {
$page = '404'; $page = '404';
$file = SYSTEM . 'pages/404.php'; $file = SYSTEM . 'pages/404.php';

View File

@@ -11,15 +11,15 @@ CREATE TABLE `myaac_account_actions`
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 +67,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 +77,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`
( (

View File

@@ -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;

View File

@@ -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', 1, 1, 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', 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, 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', 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, 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', 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, 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', 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, 0, UNIX_TIMESTAMP(), 1, '');"))
$success = false; $success = false;
} }

View 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.4.3
* @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!');

View 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.4.3
* @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!');

View 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.4.3
* @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!');

View File

@@ -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.4.3
* @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>';
} }
@@ -124,9 +133,7 @@ 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();
} }
@@ -218,10 +225,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 +449,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 +609,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 +622,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 +750,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 +800,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 +811,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 +838,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 +884,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,12 +1091,9 @@ 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 +1165,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);
} }
@@ -1214,18 +1177,53 @@ function load_config_lua($filename)
if(!@file_exists($config_file)) if(!@file_exists($config_file))
die('ERROR: Cannot find ' . $filename . ' file.'); die('ERROR: Cannot find ' . $filename . ' file.');
$tempFile = @tempnam('/tmp', 'lua'); $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 = "'";
$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;
}
}
}
}
// TODO: new parser that will also load dofile() includes $result = array_merge($result, isset($config['lua']) ? $config['lua'] : array());
// 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);
return $result; return $result;
} }
?> ?>

View 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.4.3
* @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!');
@@ -46,7 +46,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);
} }

View 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.4.3
* @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) {
@@ -86,10 +88,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]))
{ {

View 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.4.3
* @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