mirror of
https://github.com/slawkens/myaac.git
synced 2025-09-14 12:33:35 +02:00
Compare commits
31 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
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 |
17
CHANGELOG
17
CHANGELOG
@@ -1,3 +1,20 @@
|
||||
[0.4.0 - 13.09.2017
|
||||
- added option to add/edit/delete/hide/move forum boards
|
||||
- moved some of HTML-in-PHP code to Twig templates
|
||||
- added bug_report configurable which can enable/disable bug tracker
|
||||
- log errors instead of showing them to users with system directories
|
||||
- fix when $_SERVER['HTTP_ACCEPT_ENCODING'] is not set
|
||||
- when it fails to load config.lua it will output error also to error.log
|
||||
- automatically detect json file in .zip instead of basing on filename (admin panel - plugins)
|
||||
- hopefully fixed the error with "The file you are trying to upload is not a .zip file. Please try again."
|
||||
- fixed wrong name of table in bugtracker
|
||||
- fixed some bugs in bugtracker
|
||||
- added report bug link in templates
|
||||
- fixed some rare error when user is logged in for longer than 15 minutes and tries to login again
|
||||
- fixed some grammar errors
|
||||
- some small improvements
|
||||
- fixed some separators in kathrine template
|
||||
|
||||
[0.3.0 - 28.08.2017]
|
||||
- added administration panel for screenshots management with auto thumbnail generator and image auto-resizing
|
||||
- added Twig template engine and moved some html-in-php code to it
|
||||
|
@@ -25,6 +25,8 @@ require(SYSTEM . 'status.php');
|
||||
require(SYSTEM . 'login.php');
|
||||
require(ADMIN . 'includes/functions.php');
|
||||
|
||||
$twig->addGlobal('config', $config);
|
||||
|
||||
// if we're not logged in - show login box
|
||||
if(!$logged || !admin()) {
|
||||
$page = 'login';
|
||||
|
@@ -21,14 +21,14 @@
|
||||
* @package MyAAC
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
* @copyright 2017 MyAAC
|
||||
* @version 0.3.0
|
||||
* @version 0.4.0
|
||||
* @link http://my-aac.org
|
||||
*/
|
||||
session_start();
|
||||
|
||||
define('MYAAC', true);
|
||||
define('MYAAC_VERSION', '0.3.0');
|
||||
define('DATABASE_VERSION', 7);
|
||||
define('DATABASE_VERSION', 9);
|
||||
define('TABLE_PREFIX', 'myaac_');
|
||||
define('START_TIME', microtime(true));
|
||||
define('MYAAC_OS', (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? 'WINDOWS' : (strtoupper(PHP_OS) == 'DARWIN' ? 'MAC' : 'LINUX'));
|
||||
|
@@ -13,7 +13,7 @@
|
||||
* @package MyAAC
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
* @copyright 2017 MyAAC
|
||||
* @version 0.3.0
|
||||
* @version 0.4.0
|
||||
* @link http://my-aac.org
|
||||
*/
|
||||
|
||||
@@ -45,7 +45,7 @@ $config = array(
|
||||
// footer
|
||||
'footer' => ''/*'<br/>Your Server © 2016. All rights reserved.'*/,
|
||||
|
||||
'debug_level' => 0, // 0 - disabled, 1 - show load time, 2 - show db query counter, 3 - both, 4 - memory usage, 5 - load time & load time, 6 - queries & memory usage, 7 - all
|
||||
'debug_level' => 0, // 0 - disabled, 1 - show load time, 2 - show db query counter, 3 - both, 4 - memory usage, 5 - load time & memory usage, 6 - queries & memory usage, 7 - all
|
||||
|
||||
'language' => 'en', // default language (currently only 'en' available)
|
||||
'language_allow_change' => false,
|
||||
@@ -209,6 +209,9 @@ $config = array(
|
||||
// gifts/shop system
|
||||
'gifts_system' => false,
|
||||
|
||||
// support/system
|
||||
'bug_report' => true,
|
||||
|
||||
// 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
|
||||
@@ -228,6 +231,7 @@ $config = array(
|
||||
'google_analytics_id' => '', // e.g.: UA-XXXXXXX-X
|
||||
'experiencetable_columns' => 5, // how many columns to display in experience table page. * experiencetable_rows, 5 = 500 (will show up to 500 level)
|
||||
'experiencetable_rows' => 100, // till how many levels in one column
|
||||
'date_timezone' => 'Europe/Berlin',
|
||||
|
||||
'monsters' => array(),
|
||||
'npc' => array()
|
||||
|
@@ -21,7 +21,7 @@
|
||||
* @package MyAAC
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
* @copyright 2017 MyAAC
|
||||
* @version 0.3.0
|
||||
* @version 0.4.0
|
||||
* @link http://my-aac.org
|
||||
*/
|
||||
|
||||
@@ -55,6 +55,8 @@ require_once(SYSTEM . 'login.php');
|
||||
require_once(SYSTEM . 'status.php');
|
||||
require_once(SYSTEM . 'template.php');
|
||||
|
||||
$twig->addGlobal('config', $config);
|
||||
|
||||
// database migrations
|
||||
$tmp = '';
|
||||
if(fetchDatabaseConfig('database_version', $tmp)) { // we got version
|
||||
|
@@ -11,15 +11,15 @@ CREATE TABLE `myaac_account_actions`
|
||||
CREATE TABLE `myaac_bugtracker`
|
||||
(
|
||||
`account` VARCHAR(255) NOT NULL,
|
||||
`type` INT(11) NOT NULL,
|
||||
`status` INT(11) NOT NULL,
|
||||
`type` INT(11) NOT NULL DEFAULT 0,
|
||||
`status` INT(11) NOT NULL DEFAULT 0,
|
||||
`text` text NOT NULL,
|
||||
`id` INT(11) NOT NULL,
|
||||
`subject` VARCHAR(255) NOT NULL,
|
||||
`reply` INT(11) NOT NULL,
|
||||
`who` INT(11) NOT NULL,
|
||||
`id` INT(11) NOT NULL DEFAULT 0,
|
||||
`subject` VARCHAR(255) NOT NULL DEFAULT '',
|
||||
`reply` INT(11) NOT NULL DEFAULT 0,
|
||||
`who` INT(11) NOT NULL DEFAULT 0,
|
||||
`uid` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`tag` INT(11) NOT NULL,
|
||||
`tag` INT(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`uid`)
|
||||
) ENGINE = MyISAM;
|
||||
|
||||
@@ -67,7 +67,7 @@ CREATE TABLE `myaac_faq`
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = MyISAM;
|
||||
|
||||
CREATE TABLE `myaac_forum_sections`
|
||||
CREATE TABLE `myaac_forum_boards`
|
||||
(
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` VARCHAR(32) NOT NULL,
|
||||
@@ -77,11 +77,11 @@ CREATE TABLE `myaac_forum_sections`
|
||||
`hidden` TINYINT(1) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = MyISAM;
|
||||
INSERT INTO `myaac_forum_sections` (`id`, `name`, `description`, `closed`) VALUES (NULL, 'News', 'News commenting', 1);
|
||||
INSERT INTO `myaac_forum_sections` (`id`, `name`, `description`) VALUES (NULL, 'Trade', 'Trade offers.');
|
||||
INSERT INTO `myaac_forum_sections` (`id`, `name`, `description`) VALUES (NULL, 'Quests', 'Quest making.');
|
||||
INSERT INTO `myaac_forum_sections` (`id`, `name`, `description`) VALUES (NULL, 'Pictures', 'Your pictures.');
|
||||
INSERT INTO `myaac_forum_sections` (`id`, `name`, `description`) VALUES (NULL, 'Bug Report', 'Report bugs there.');
|
||||
INSERT INTO `myaac_forum_boards` (`id`, `name`, `description`, `ordering`, `closed`) VALUES (NULL, 'News', 'News commenting', 0, 1);
|
||||
INSERT INTO `myaac_forum_boards` (`id`, `name`, `description`, `ordering`) VALUES (NULL, 'Trade', 'Trade offers.', 1);
|
||||
INSERT INTO `myaac_forum_boards` (`id`, `name`, `description`, `ordering`) VALUES (NULL, 'Quests', 'Quest making.', 2);
|
||||
INSERT INTO `myaac_forum_boards` (`id`, `name`, `description`, `ordering`) VALUES (NULL, 'Pictures', 'Your pictures.', 3);
|
||||
INSERT INTO `myaac_forum_boards` (`id`, `name`, `description`, `ordering`) VALUES (NULL, 'Bug Report', 'Report bugs there.', 4);
|
||||
|
||||
CREATE TABLE `myaac_forum`
|
||||
(
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* @package MyAAC
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
* @copyright 2017 MyAAC
|
||||
* @version 0.3.0
|
||||
* @version 0.4.0
|
||||
* @link http://my-aac.org
|
||||
*/
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* @package MyAAC
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
* @copyright 2017 MyAAC
|
||||
* @version 0.3.0
|
||||
* @version 0.4.0
|
||||
* @link http://my-aac.org
|
||||
*/
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* @package MyAAC
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
* @copyright 2017 MyAAC
|
||||
* @version 0.3.0
|
||||
* @version 0.4.0
|
||||
* @link http://my-aac.org
|
||||
*/
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
|
@@ -5,17 +5,26 @@
|
||||
* @package MyAAC
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
* @copyright 2017 MyAAC
|
||||
* @version 0.3.0
|
||||
* @version 0.4.0
|
||||
* @link http://my-aac.org
|
||||
*/
|
||||
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>';
|
||||
}
|
||||
function warning($message) {
|
||||
function warning($message, $return = false) {
|
||||
if($return)
|
||||
return '<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>';
|
||||
}
|
||||
|
||||
@@ -218,10 +227,11 @@ function generateRandomString($length, $lowCase = true, $upCase = false, $numeri
|
||||
*
|
||||
* @return array Forum sections.
|
||||
*/
|
||||
function getForumSections()
|
||||
function getForumBoards()
|
||||
{
|
||||
global $db;
|
||||
$sections = $db->query('SELECT `id`, `name`, `description`, `closed` FROM ' . TABLE_PREFIX . 'forum_sections WHERE hidden != 1 ORDER BY `ordering`;');
|
||||
global $db, $canEdit;
|
||||
$sections = $db->query('SELECT `id`, `name`, `description`, `closed`' . ($canEdit ? ', `hidden`, `ordering`' : '') . ' FROM `' . TABLE_PREFIX . 'forum_boards` ' . (!$canEdit ? ' WHERE `hidden` != 1' : '') .
|
||||
' ORDER BY `ordering`;');
|
||||
if($sections)
|
||||
return $sections->fetchAll();
|
||||
|
||||
@@ -441,7 +451,7 @@ function check_name($name, &$error = '')
|
||||
return false;
|
||||
}
|
||||
|
||||
return preg_match("/[A-z ']{1,25}/", $name);
|
||||
return preg_match("/[A-z ']/", $name);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -601,7 +611,7 @@ function check_name_new_char($name, &$error = '')
|
||||
$player = new OTS_Player();
|
||||
$player->find($name);
|
||||
if($player->isLoaded()) {
|
||||
$error = 'Player with this name already exist.';
|
||||
$error = 'Character with this name already exist.';
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -614,28 +624,19 @@ function check_name_new_char($name, &$error = '')
|
||||
}
|
||||
}
|
||||
|
||||
$monsters = $db->query(
|
||||
'SELECT ' . $db->fieldName('name') .
|
||||
' FROM ' . $db->tableName(TABLE_PREFIX . 'monsters') .
|
||||
' WHERE ' . $db->fieldName('name') . ' LIKE ' . $db->quote($name_lower));
|
||||
$monsters = $db->query('SELECT `name` FROM `' . TABLE_PREFIX . 'monsters` WHERE `name` LIKE ' . $db->quote($name_lower));
|
||||
if($monsters->rowCount() > 0) {
|
||||
$error = 'Your name cannot contains monster name.';
|
||||
return false;
|
||||
}
|
||||
|
||||
$spells_name = $db->query(
|
||||
'SELECT ' . $db->fieldName('name') .
|
||||
' FROM ' . $db->tableName(TABLE_PREFIX . 'spells') .
|
||||
' WHERE ' . $db->fieldName('name') . ' LIKE ' . $db->quote($name_lower));
|
||||
$spells_name = $db->query('SELECT `name` FROM `' . TABLE_PREFIX . 'spells` WHERE `name` LIKE ' . $db->quote($name_lower));
|
||||
if($spells_name->rowCount() > 0) {
|
||||
$error = 'Your name cannot contains spell name.';
|
||||
return false;
|
||||
}
|
||||
|
||||
$spells_words = $db->query(
|
||||
'SELECT ' . $db->fieldName('words') .
|
||||
' FROM ' . $db->tableName(TABLE_PREFIX . 'spells') .
|
||||
' WHERE ' . $db->fieldName('words') . ' = ' . $db->quote($name_lower));
|
||||
$spells_words = $db->query('SELECT `words` FROM `' . TABLE_PREFIX . 'spells` WHERE `words` = ' . $db->quote($name_lower));
|
||||
if($spells_words->rowCount() > 0) {
|
||||
$error = 'Your name cannot contains spell name.';
|
||||
return false;
|
||||
@@ -751,28 +752,6 @@ function news_place()
|
||||
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
|
||||
*
|
||||
@@ -1202,7 +1181,7 @@ function convert_bytes($size)
|
||||
function log_append($file, $str)
|
||||
{
|
||||
$f = fopen(LOGS . $file, 'a');
|
||||
fwrite($f, $str . PHP_EOL);
|
||||
fwrite($f, '[' . date(DateTime::RFC1123) . '] ' . $str . PHP_EOL);
|
||||
fclose($f);
|
||||
}
|
||||
|
||||
@@ -1215,8 +1194,11 @@ function load_config_lua($filename)
|
||||
die('ERROR: Cannot find ' . $filename . ' file.');
|
||||
|
||||
$tempFile = @tempnam('/tmp', 'lua');
|
||||
$file = fopen($tempFile, 'w');
|
||||
if(!$file) die('Cannot load server config!');
|
||||
$file = @fopen($tempFile, 'w');
|
||||
if(!$file) {
|
||||
log_append('error.log', '[functions.php] Cannot load config.lua file. Error: ' . print_r(error_get_last(), true));
|
||||
die('Cannot load server config! More info in system/logs/error.log file.');
|
||||
}
|
||||
|
||||
// TODO: new parser that will also load dofile() includes
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* @package MyAAC
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
* @copyright 2017 MyAAC
|
||||
* @version 0.3.0
|
||||
* @version 0.4.0
|
||||
* @link http://my-aac.org
|
||||
*/
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* @package MyAAC
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
* @copyright 2017 MyAAC
|
||||
* @version 0.3.0
|
||||
* @version 0.4.0
|
||||
* @link http://my-aac.org
|
||||
*/
|
||||
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
|
||||
require(BASE . 'config.local.php');
|
||||
|
||||
date_default_timezone_set($config['date_timezone']);
|
||||
// take care of trailing slash at the end
|
||||
if($config['server_path'][strlen($config['server_path']) - 1] != '/')
|
||||
$config['server_path'] .= '/';
|
||||
|
||||
// enable gzip compression if supported by the browser
|
||||
if($config['gzip_output'] && (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false) && function_exists('ob_gzhandler'))
|
||||
if($config['gzip_output'] && isset($_SERVER['HTTP_ACCEPT_ENCODING']) && strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && function_exists('ob_gzhandler'))
|
||||
ob_start('ob_gzhandler');
|
||||
|
||||
// cache
|
||||
@@ -27,12 +28,12 @@ require_once(SYSTEM . 'libs/cache.php');
|
||||
$cache = Cache::getInstance($config['cache_engine'], $config['cache_prefix']);
|
||||
|
||||
// twig
|
||||
require_once LIBS . 'twig/Autoloader.php';
|
||||
require_once LIBS . 'Twig/Autoloader.php';
|
||||
Twig_Autoloader::register();
|
||||
|
||||
$loader = new Twig_Loader_Filesystem(SYSTEM . 'templates');
|
||||
$twig = new Twig_Environment($loader, array(
|
||||
'cache' => CACHE . 'twig/',
|
||||
$twig_loader = new Twig_Loader_Filesystem(SYSTEM . 'templates');
|
||||
$twig = new Twig_Environment($twig_loader, array(
|
||||
'cache' => CACHE . 'twig/'
|
||||
));
|
||||
|
||||
$function = new Twig_SimpleFunction('getStyle', function ($i) {
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* @package MyAAC
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
* @copyright 2017 MyAAC
|
||||
* @version 0.3.0
|
||||
* @version 0.4.0
|
||||
* @link http://my-aac.org
|
||||
*/
|
||||
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