Compare commits

...

35 Commits

Author SHA1 Message Date
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
315 changed files with 5304 additions and 3351 deletions

View File

@@ -1,3 +1,27 @@
[0.4.2 - 14.09.2017]
- updated version number
[0.4.1 - 13.09.2017]
- fixed log in to admin panel
- fixed File is not .zip plugin upload error
[0.4.0 - 13.09.2017
- added option to add/edit/delete/hide/move forum boards
- moved some of HTML-in-PHP code to Twig templates
- added bug_report configurable which can enable/disable bug tracker
- log errors instead of showing them to users with system directories
- fix when $_SERVER['HTTP_ACCEPT_ENCODING'] is not set
- when it fails to load config.lua it will output error also to error.log
- automatically detect json file in .zip instead of basing on filename (admin panel - plugins)
- hopefully fixed the error with "The file you are trying to upload is not a .zip file. Please try again."
- fixed wrong name of table in bugtracker
- fixed some bugs in bugtracker
- added report bug link in templates
- fixed some rare error when user is logged in for longer than 15 minutes and tries to login again
- fixed some grammar errors
- some small improvements
- fixed some separators in kathrine template
[0.3.0 - 28.08.2017]
- added administration panel for screenshots management with auto thumbnail generator and image auto-resizing
- added Twig template engine and moved some html-in-php code to it

View File

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

View File

@@ -21,14 +21,14 @@
* @package MyAAC
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.3.0
* @version 0.4.2
* @link http://my-aac.org
*/
session_start();
define('MYAAC', true);
define('MYAAC_VERSION', '0.3.0');
define('DATABASE_VERSION', 7);
define('MYAAC_VERSION', '0.4.2');
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'));

View File

@@ -13,7 +13,7 @@
* @package MyAAC
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.3.0
* @version 0.4.2
* @link http://my-aac.org
*/
@@ -45,7 +45,7 @@ $config = array(
// footer
'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_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()

View File

@@ -21,7 +21,7 @@
* @package MyAAC
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.3.0
* @version 0.4.2
* @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

View File

@@ -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`
(

View File

@@ -5,7 +5,7 @@
* @package MyAAC
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.3.0
* @version 0.4.2
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');

View File

@@ -5,7 +5,7 @@
* @package MyAAC
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.3.0
* @version 0.4.2
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');

View File

@@ -5,7 +5,7 @@
* @package MyAAC
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.3.0
* @version 0.4.2
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');

View File

@@ -5,17 +5,26 @@
* @package MyAAC
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.3.0
* @version 0.4.2
* @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

View File

@@ -5,7 +5,7 @@
* @package MyAAC
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.3.0
* @version 0.4.2
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');

View File

@@ -5,7 +5,7 @@
* @package MyAAC
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.3.0
* @version 0.4.2
* @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) {

View File

@@ -5,7 +5,7 @@
* @package MyAAC
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.3.0
* @version 0.4.2
* @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